index.vue 6.1 KB

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