index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <view>
  3. <view>index/index</view>
  4. <view class="welcome" v-if="false">
  5. <view class="welcome-state1" >
  6. <view class="welcome-next" style="z-index: 999;" @click="gotoIndex()">{{step?step+'|':''}}跳过</view>
  7. </view>
  8. <u-image id="imgw"
  9. height="auto"
  10. v-if="imgmode" @load="imgsload" ref="imgw" mode="widthFix">
  11. <view slot="loading"></view>
  12. <view slot="error"></view>
  13. </u-image>
  14. <u-image v-if="!imgmode" :height="imgH" mode="aspectFill">
  15. <view slot="loading"></view>
  16. <view slot="error"></view>
  17. </u-image>
  18. <view class="welcome-foot">
  19. <u-image width="185px" height="48px" src="/static/logo.png"></u-image>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import * as loginApi from '@/apis/login.js'
  26. import * as API from '@/apis/index.js'
  27. export default {
  28. data() {
  29. return {
  30. isReady:true,
  31. isReady2:false,
  32. step:2,
  33. imgH:'',
  34. imgmode:true
  35. }
  36. },
  37. onUnload(){
  38. document.body.style=""
  39. },
  40. onReady() {
  41. },
  42. onLoad(op) {
  43. return;
  44. this.findNoLTextConfigure()
  45. this.findByOpenId()
  46. if(op.friends){
  47. this.carhelp.set("friends_invitation",{
  48. op:op,
  49. date:new Date().getTime()
  50. })
  51. uni.redirectTo({
  52. url:'/pages/login/login'
  53. })
  54. //this.onReadyIng()
  55. }else if(op.gunId){
  56. var k=API.codeOperation("jp_team51_charge_id:A_"+op.gunId);
  57. if(k){
  58. uni.redirectTo({
  59. url:k
  60. })
  61. }
  62. }else if(op.jpcode){
  63. var k=API.codeOperation(op.jpcode);
  64. if(k){
  65. uni.redirectTo({
  66. url:k
  67. })
  68. }
  69. }else{
  70. this.onReadyIng()
  71. }
  72. },
  73. methods: {
  74. imgsload(e){
  75. uni.getSystemInfo({
  76. success: (res) => {
  77. //(res)
  78. const query = uni.createSelectorQuery().in(this);
  79. query.select('#imgw').boundingClientRect(data => {
  80. //("得到布局位置信息" + JSON.stringify(data));
  81. //("节点离页面顶部的距离为" + data.height);
  82. var windowH=res.windowHeight;
  83. var imgH= data.height;
  84. var value=windowH-imgH;
  85. //(value)
  86. if(value>=100){
  87. this.imgmode=true
  88. document.getElementsByClassName("welcome-foot")[0].style="height:"+value+"px"
  89. }else{
  90. this.imgmode=false
  91. }
  92. }).exec();
  93. }
  94. })
  95. },
  96. findNoLTextConfigure(){
  97. API.getTips().then((response) => {
  98. this.carhelp.setConfigMessage(response.data.tipsList)
  99. }).catch(error => {
  100. })
  101. loginApi.findNoLTextConfigure().then((response) => {
  102. this.carhelp.setConfig(response.data.configure)
  103. this.setBackImg()
  104. }).catch(error => {
  105. uni.showToast({
  106. title: error,
  107. icon: "none"
  108. })
  109. })
  110. },
  111. findByOpenId(){
  112. var openId=this.carhelp.getOpenId()
  113. if(openId==""){
  114. //("--------findByOpenId----------")
  115. setTimeout(()=>{
  116. this.findByOpenId()
  117. },1000)
  118. return
  119. }
  120. loginApi.findByOpenIdDetailed(openId).then((response) => {
  121. let [error, res] = response;
  122. if (res.data.code == 200&&res.data.result) {
  123. var token = res ? res.data.data.token : '';
  124. this.carhelp.setPersonInfo(res.data.data.regUser );
  125. this.carhelp.setToken(token);
  126. this.carhelp.setPersonInfoPlus(res.data.data);
  127. } else{
  128. this.carhelp.logoff()
  129. }
  130. this.isReady2=true;
  131. }).catch(error => {
  132. })
  133. },
  134. setBackImg(){
  135. var img=this.carhelp.getConfig().homepageLogo
  136. if(img){
  137. this.$refs.imgw.src=img
  138. //document.body.style="background:url("+img+") no-repeat;background-size: 100%;"
  139. }else{
  140. this.$refs.imgw.src="/static/welcome_bg.png"
  141. }
  142. if(this.$refs.imgw){ }
  143. },
  144. gotoIndex(){
  145. if(this.isReady){
  146. this.isReady=false
  147. uni.redirectTo({
  148. url: '/pages/index/index'
  149. });
  150. }
  151. },
  152. indexstep(){
  153. setTimeout(()=>{
  154. this.step--;
  155. if(this.step<0){
  156. if(this.isReady2){
  157. this.gotoIndex()
  158. }else{
  159. this.step=0;
  160. this.indexstep()
  161. }
  162. }else{
  163. this.indexstep()
  164. }
  165. },1000)
  166. },
  167. onReadyIng(){
  168. //let state = {};
  169. uni.getSystemInfo({
  170. success: (res) => {
  171. var windowH=res.windowHeight;
  172. this.imgH=(windowH-100)+"px";
  173. }
  174. })
  175. this.indexstep()
  176. this.setBackImg( )
  177. },
  178. }
  179. }
  180. </script>
  181. <style lang="scss">
  182. .content {
  183. display: flex;
  184. flex-direction: column;
  185. align-items: center;
  186. justify-content: center;
  187. .logo {
  188. height: 200rpx;
  189. width: 200rpx;
  190. margin-top: 200rpx;
  191. margin-left: auto;
  192. margin-right: auto;
  193. margin-bottom: 50rpx;
  194. }
  195. }
  196. /* .logo {
  197. height: 200rpx;
  198. width: 200rpx;
  199. margin-top: 200rpx;
  200. margin-left: auto;
  201. margin-right: auto;
  202. margin-bottom: 50rpx;
  203. } */
  204. .text-area {
  205. display: flex;
  206. justify-content: center;
  207. }
  208. .title {
  209. font-size: 36rpx;
  210. color: #8f8f94;
  211. }
  212. </style>
  213. <style>
  214. page{
  215. background-color: #ffffff;
  216. }
  217. </style>
  218. <style lang="scss" scoped>
  219. .welcome{
  220. position: relative;
  221. }
  222. .welcome-next{
  223. position: absolute;
  224. padding: 4px 15px;
  225. color:#fff;
  226. border-radius: 14px;
  227. background:rgba(0,0,0,0.5);
  228. right: 15px;
  229. top: 15px;
  230. }
  231. .welcome-foot{
  232. position:fixed;
  233. left: 0;
  234. right: 0;
  235. bottom: 0;
  236. background-color: #fff;
  237. height: 100px;
  238. display: flex;
  239. align-items: center;
  240. justify-content: center;
  241. }
  242. .welcome-logo{
  243. position: absolute;
  244. left: 50%;
  245. margin-left: -100px;
  246. top: 120px;
  247. }
  248. .welcome-btn{
  249. position: fixed;
  250. left: 48px;
  251. right: 48px;
  252. bottom:48px;
  253. text-align: center;
  254. .welcomeBtn{
  255. color:#009143;
  256. border-color:#fff;
  257. }
  258. p{
  259. color:#fff;
  260. margin-top: 12px;
  261. font-size: 16px;
  262. }
  263. }
  264. </style>