no message
Showing
11 changed files
with
115 additions
and
127 deletions
| ... | @@ -3,101 +3,26 @@ | ... | @@ -3,101 +3,26 @@ |
| 3 | import * as api from '@/common/api.js'; | 3 | import * as api from '@/common/api.js'; |
| 4 | import config from '@/config.js'; | 4 | import config from '@/config.js'; |
| 5 | 5 | ||
| 6 | |||
| 7 | let firstload = false | ||
| 8 | export default { | 6 | export default { |
| 9 | onLaunch: function() { | 7 | onLaunch: function() { |
| 10 | console.log('App Launch'); | 8 | console.log('App Launch'); |
| 11 | firstload = true | ||
| 12 | this.globalData.baseUrl = config.baseUrl; | ||
| 13 | this.globalData.baseUrl_api = config.baseUrl_api; | 9 | this.globalData.baseUrl_api = config.baseUrl_api; |
| 14 | this.globalData.fileUrl = config.fileUrl; | ||
| 15 | |||
| 16 | new Promise((resolve, reject) => { | ||
| 17 | uni.checkSession({ | ||
| 18 | success: res => { | ||
| 19 | loginServer | ||
| 20 | .getCurrUser(true) | ||
| 21 | .catch(() => { | ||
| 22 | return loginServer.pcLogin(); | ||
| 23 | }) | ||
| 24 | .then(user => { | ||
| 25 | resolve(user); | ||
| 26 | }); | ||
| 27 | }, | 10 | }, |
| 28 | fail: res => { | 11 | onShow: function() { |
| 29 | loginServer | 12 | console.log('App Show'); |
| 30 | .wxLogin() | 13 | uni.getStorage({ |
| 31 | .then(loginRes => { | 14 | key: 'token', |
| 32 | return loginServer.pcLogin(loginRes.code); | 15 | success: () => { |
| 33 | }) | ||
| 34 | .then(user => { | ||
| 35 | resolve(user); | ||
| 36 | }); | ||
| 37 | } | ||
| 38 | }); | ||
| 39 | }) | ||
| 40 | .then(()=>{ | ||
| 41 | return loginServer.getNowOpenId() | ||
| 42 | }) | ||
| 43 | .then(() => { | ||
| 44 | return loginServer.initData() | ||
| 45 | // console.log(22222222) | ||
| 46 | // const currUser = uni.getStorageSync('currUser'); | ||
| 47 | // // console.log(currUser) | ||
| 48 | // return Promise.all([api.getVenue(), api.getOwnMemberInfo()]).then(res => { | ||
| 49 | // let ven = res[0].data; | ||
| 50 | // let men = res[1]?.data; | ||
| 51 | |||
| 52 | // if (ven.venuePic) { | ||
| 53 | // ven.venuePicArr = ven.venuePic.split(','); | ||
| 54 | // } | ||
| 55 | // if (ven.businessPeriod) { | ||
| 56 | // ven.startBus = ven.businessPeriod.split(',')[0]; | ||
| 57 | // ven.endBus = ven.businessPeriod.split(',')[1]; | ||
| 58 | // } | ||
| 59 | // ven.latitude = ven.lal.split(',')[0]; | ||
| 60 | // ven.longitude = ven.lal.split(',')[1]; | ||
| 61 | |||
| 62 | // this.globalData.venue = ven; | ||
| 63 | // this.globalData.isVip = men?.isVip; | ||
| 64 | // // this.globalData.relateProjectId = men.info.relateProjectId; | ||
| 65 | // this.globalData.relateProjectIdList = men?.info?.relateProjectIdList; | ||
| 66 | // this.globalData.relateVenueProjectIdList = men?.info?.relateVenueProjectIdList; | ||
| 67 | |||
| 68 | // this.globalData.venueConfig = { | ||
| 69 | // normalOverDay: ven.resSiteConfig?.normalOrderNum, | ||
| 70 | // normalPeriodStart: ven.resSiteConfig?.normalOrderPeriod.split(',')[0], | ||
| 71 | // normalPeriodEnd: ven.resSiteConfig?.normalOrderPeriod.split(',')[1] | ||
| 72 | // }; | ||
| 73 | // if (men?.isVip) { | ||
| 74 | // this.globalData.venueConfig.memberOverDay = ven.resSiteConfig?.memberOrderNum; | ||
| 75 | // this.globalData.venueConfig.memberPeriodStart = ven.resSiteConfig?.memberOrderPeriod.split(',')[0]; | ||
| 76 | // this.globalData.venueConfig.memberPeriodEnd = ven.resSiteConfig?.memberOrderPeriod.split(',')[1]; | ||
| 77 | // } | ||
| 78 | // }); | ||
| 79 | }) | ||
| 80 | .then(() => { | ||
| 81 | this.globalData.isLogin = true; | 16 | this.globalData.isLogin = true; |
| 82 | let firstLoadCallback = getApp().firstLoadCallback; | 17 | let firstLoadCallback = getApp().firstLoadCallback; |
| 83 | if (firstLoadCallback) { | 18 | if (firstLoadCallback) { |
| 84 | firstLoadCallback(); | 19 | firstLoadCallback(); |
| 85 | } | 20 | } |
| 86 | }); | ||
| 87 | }, | 21 | }, |
| 88 | onShow: function() { | 22 | fail: () => { |
| 89 | console.log('App Show'); | 23 | this.globalData.isLogin = false; |
| 90 | // loginServer.getNowOpenId() | ||
| 91 | if (!firstload) { | ||
| 92 | loginServer.getCurrUser(true) | ||
| 93 | .catch(() => { | ||
| 94 | return loginServer.pcLogin().then(() => { | ||
| 95 | uni.redirectTo({ | ||
| 96 | url: getCurrentPages()[getCurrentPages().length - 1].$page.fullPath | ||
| 97 | }) | ||
| 98 | }); | ||
| 99 | }) | ||
| 100 | } | 24 | } |
| 25 | }) | ||
| 101 | }, | 26 | }, |
| 102 | onHide: function() { | 27 | onHide: function() { |
| 103 | console.log('App Hide'); | 28 | console.log('App Hide'); | ... | ... |
| ... | @@ -3,7 +3,7 @@ import config from '@/config.js' | ... | @@ -3,7 +3,7 @@ import config from '@/config.js' |
| 3 | 3 | ||
| 4 | function getTrainList(venueId) { | 4 | function getTrainList(venueId) { |
| 5 | return request({ | 5 | return request({ |
| 6 | url: `/train/info/list`, | 6 | url: `/train/info/h5List`, |
| 7 | method: 'get' | 7 | method: 'get' |
| 8 | }) | 8 | }) |
| 9 | } | 9 | } | ... | ... |
| ... | @@ -180,6 +180,18 @@ function getNowOpenId() { | ... | @@ -180,6 +180,18 @@ function getNowOpenId() { |
| 180 | }) | 180 | }) |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | function h5Login(userName) { | ||
| 184 | return request({ | ||
| 185 | url: `/h5Login`, | ||
| 186 | method: 'post', | ||
| 187 | params: { | ||
| 188 | username: userName | ||
| 189 | } | ||
| 190 | }).then((res) => { | ||
| 191 | uni.setStorageSync('token', 'Bearer ' + res.data.token); | ||
| 192 | }) | ||
| 193 | } | ||
| 194 | |||
| 183 | function initData() { | 195 | function initData() { |
| 184 | console.log('initData') | 196 | console.log('initData') |
| 185 | 197 | ||
| ... | @@ -189,7 +201,7 @@ function initData() { | ... | @@ -189,7 +201,7 @@ function initData() { |
| 189 | let ven = res[0].data; | 201 | let ven = res[0].data; |
| 190 | let men = res[1]?.data; | 202 | let men = res[1]?.data; |
| 191 | 203 | ||
| 192 | const app = getApp(); | 204 | const app = getApp(); |
| 193 | 205 | ||
| 194 | if (ven.venuePic) { | 206 | if (ven.venuePic) { |
| 195 | ven.venuePicArr = ven.venuePic.split(','); | 207 | ven.venuePicArr = ven.venuePic.split(','); |
| ... | @@ -228,5 +240,6 @@ export { | ... | @@ -228,5 +240,6 @@ export { |
| 228 | getWxUser, | 240 | getWxUser, |
| 229 | getWxUserPhone, | 241 | getWxUserPhone, |
| 230 | checkUserAuth, | 242 | checkUserAuth, |
| 243 | h5Login, | ||
| 231 | initData | 244 | initData |
| 232 | } | 245 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
components/login/index.vue
0 → 100644
| 1 | <template> | ||
| 2 | <uni-popup class="popYanZhengBox" ref="popYanZheng" type="center"> | ||
| 3 | <view class="popup-content"> | ||
| 4 | <view class="t">温馨提示</view> | ||
| 5 | <view class="p">该微信未绑定系统内手机号,绑定手机号后正常使用。</view> | ||
| 6 | <button class="start" type="default" @click="login">绑定手机号</button> | ||
| 7 | </view> | ||
| 8 | </uni-popup> | ||
| 9 | </template> | ||
| 10 | |||
| 11 | <script setup> | ||
| 12 | import { | ||
| 13 | onMounted, | ||
| 14 | ref | ||
| 15 | } from "vue"; | ||
| 16 | import { | ||
| 17 | h5Login | ||
| 18 | } from '@/common/login.js'; | ||
| 19 | |||
| 20 | const app = getApp(); | ||
| 21 | |||
| 22 | const popYanZheng = ref(null); | ||
| 23 | |||
| 24 | |||
| 25 | onMounted(() => { | ||
| 26 | if (!app.globalData.isLogin) { | ||
| 27 | popYanZheng.value.open() | ||
| 28 | } | ||
| 29 | }) | ||
| 30 | |||
| 31 | function login() { | ||
| 32 | h5Login('12000013583') | ||
| 33 | .then(() => { | ||
| 34 | popYanZheng.value.close() | ||
| 35 | }) | ||
| 36 | } | ||
| 37 | </script> | ||
| 38 | |||
| 39 | <style> | ||
| 40 | |||
| 41 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | // prod | 1 | // prod |
| 2 | // const baseUrl = 'https://research.wtwuxicenter.com/'; | 2 | // const baseUrl_api = 'https://research.wtwuxicenter.com/'; |
| 3 | // const baseUrl_api=`${baseUrl}/prod-api`; | ||
| 4 | 3 | ||
| 5 | // uat | ||
| 6 | // const baseUrl = 'https://jxt.itechtop.cn'; | ||
| 7 | const baseUrl = 'https://jxt.wtwuxicenter.com'; | ||
| 8 | const baseUrl_api = `${baseUrl}/prod-api`; | ||
| 9 | 4 | ||
| 10 | // staging | 5 | // staging |
| 11 | // const baseUrl = 'https://5q5re1d432g2.ngrok2.xiaomiqiu123.top'; | 6 | const baseUrl_api = "http://192.168.1.118:8080"; |
| 12 | |||
| 13 | // const baseUrl = "http://192.168.1.118:8081"; | ||
| 14 | // const baseUrl_api = `${baseUrl}`; | ||
| 15 | |||
| 16 | const fileUrl = "http://r.itechtop.cn"; | ||
| 17 | 7 | ||
| 18 | export default { | 8 | export default { |
| 19 | baseUrl: baseUrl, | 9 | baseUrl_api: baseUrl_api |
| 20 | fileUrl: fileUrl, | ||
| 21 | baseUrl_api: baseUrl_api, | ||
| 22 | }; | 10 | }; |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | import App from './App' | 1 | import App from './App' |
| 2 | |||
| 2 | // #ifndef VUE3 | 3 | // #ifndef VUE3 |
| 3 | import Vue from 'vue' | 4 | import Vue from 'vue' |
| 4 | Vue.config.productionTip = false | 5 | Vue.config.productionTip = false |
| ... | @@ -13,8 +14,12 @@ app.$mount() | ... | @@ -13,8 +14,12 @@ app.$mount() |
| 13 | import { | 14 | import { |
| 14 | createSSRApp | 15 | createSSRApp |
| 15 | } from 'vue' | 16 | } from 'vue' |
| 17 | import login from '@/components/login' | ||
| 18 | |||
| 16 | export function createApp() { | 19 | export function createApp() { |
| 17 | const app = createSSRApp(App) | 20 | const app = createSSRApp(App) |
| 21 | app.component('showLogin', login) | ||
| 22 | |||
| 18 | return { | 23 | return { |
| 19 | app | 24 | app |
| 20 | } | 25 | } | ... | ... |
| 1 | { | 1 | { |
| 2 | "hash": "15550c90", | 2 | "hash": "3d4f5fa7", |
| 3 | "browserHash": "63dbbbb8", | 3 | "browserHash": "a63ce521", |
| 4 | "optimized": { | 4 | "optimized": { |
| 5 | "lodash": { | 5 | "lodash": { |
| 6 | "src": "../../lodash/lodash.js", | 6 | "src": "../../lodash/lodash.js", |
| 7 | "file": "lodash.js", | 7 | "file": "lodash.js", |
| 8 | "fileHash": "547f3844", | 8 | "fileHash": "ab53c0da", |
| 9 | "needsInterop": true | 9 | "needsInterop": true |
| 10 | } | 10 | } |
| 11 | }, | 11 | }, | ... | ... |
| ... | @@ -3,9 +3,9 @@ var __commonJS = (cb, mod) => function __require() { | ... | @@ -3,9 +3,9 @@ var __commonJS = (cb, mod) => function __require() { |
| 3 | return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | 3 | return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; |
| 4 | }; | 4 | }; |
| 5 | 5 | ||
| 6 | // ../../../../../../Users/yangyang/project/gd_yc/node_modules/lodash/lodash.js | 6 | // ../../../../../../Users/huamingqi/projects/train/gd_yc/node_modules/lodash/lodash.js |
| 7 | var require_lodash = __commonJS({ | 7 | var require_lodash = __commonJS({ |
| 8 | "../../../../../../Users/yangyang/project/gd_yc/node_modules/lodash/lodash.js"(exports, module) { | 8 | "../../../../../../Users/huamingqi/projects/train/gd_yc/node_modules/lodash/lodash.js"(exports, module) { |
| 9 | (function() { | 9 | (function() { |
| 10 | var undefined; | 10 | var undefined; |
| 11 | var VERSION = "4.17.21"; | 11 | var VERSION = "4.17.21"; | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <view class="page"> | 2 | <view class="page"> |
| 3 | <show-login></show-login> | ||
| 3 | <view class="uni-margin-wrap"> | 4 | <view class="uni-margin-wrap"> |
| 4 | <!-- <view class="logobox"> | 5 | <!-- <view class="logobox"> |
| 5 | <image class="logo" :src="venue.venueLogo"></image> | 6 | <image class="logo" :src="venue.venueLogo"></image> |
| 6 | <text>{{venue.venueName}}</text> | 7 | <text>{{venue.venueName}}</text> |
| 7 | </view> --> | 8 | </view> --> |
| 8 | 9 | ||
| 9 | <swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" | 10 | <!-- <swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" |
| 10 | :duration="duration" indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff"> | 11 | :duration="duration" indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff"> |
| 11 | <swiper-item v-for="(p, index) in venue.venuePicArr" :key="index"> | 12 | <swiper-item v-for="(p, index) in venue.venuePicArr" :key="index"> |
| 12 | <view class="swiper-item"> | 13 | <view class="swiper-item"> |
| 13 | <image mode="aspectFill" :src="p"></image> | 14 | <image mode="aspectFill" :src="p"></image> |
| 14 | </view> | 15 | </view> |
| 15 | </swiper-item> | 16 | </swiper-item> |
| 16 | </swiper> | 17 | </swiper> --> |
| 17 | </view> | 18 | </view> |
| 18 | <view class="infoArea"> | 19 | <view class="infoArea"> |
| 19 | <view class="contentbox"> | 20 | <view class="contentbox"> |
| ... | @@ -79,14 +80,17 @@ | ... | @@ -79,14 +80,17 @@ |
| 79 | getWxUserPhone | 80 | getWxUserPhone |
| 80 | } from '@/common/login.js'; | 81 | } from '@/common/login.js'; |
| 81 | import { | 82 | import { |
| 82 | onLoad,onShow, | 83 | onLoad, |
| 84 | onShow, | ||
| 83 | onReady, | 85 | onReady, |
| 84 | onShareAppMessage, | 86 | onShareAppMessage, |
| 85 | onShareTimeline,onPullDownRefresh | 87 | onShareTimeline, |
| 88 | onPullDownRefresh | ||
| 86 | } from '@dcloudio/uni-app'; | 89 | } from '@dcloudio/uni-app'; |
| 87 | import { | 90 | import { |
| 88 | ref, | 91 | ref, |
| 89 | getCurrentInstance | 92 | getCurrentInstance, |
| 93 | nextTick | ||
| 90 | } from 'vue'; | 94 | } from 'vue'; |
| 91 | 95 | ||
| 92 | 96 | ||
| ... | @@ -117,9 +121,17 @@ | ... | @@ -117,9 +121,17 @@ |
| 117 | let proId; | 121 | let proId; |
| 118 | let goPath; | 122 | let goPath; |
| 119 | const svId = ref(null); | 123 | const svId = ref(null); |
| 120 | const list = ref([{id:0,name:'培训助手',path:'/pages_hotel/hotel/index'},{id:1,name:'我的',path:'/pages_hotel/hotel/mycenter'}]); | 124 | const list = ref([{ |
| 121 | 125 | id: 0, | |
| 122 | onShow(()=>{ | 126 | name: '培训助手', |
| 127 | path: '/pages_hotel/hotel/index' | ||
| 128 | }, { | ||
| 129 | id: 1, | ||
| 130 | name: '我的', | ||
| 131 | path: '/pages_hotel/hotel/mycenter' | ||
| 132 | }]); | ||
| 133 | |||
| 134 | onShow(() => { | ||
| 123 | if (app.globalData.isLogin) { | 135 | if (app.globalData.isLogin) { |
| 124 | init(); | 136 | init(); |
| 125 | } else { | 137 | } else { |
| ... | @@ -141,10 +153,11 @@ | ... | @@ -141,10 +153,11 @@ |
| 141 | }) | 153 | }) |
| 142 | 154 | ||
| 143 | let currUser | 155 | let currUser |
| 156 | |||
| 144 | function checkUserPhone(path) { | 157 | function checkUserPhone(path) { |
| 145 | currUser = uni.getStorageSync('currUser') | 158 | currUser = uni.getStorageSync('currUser') |
| 146 | if(!currUser){ | 159 | if (!currUser) { |
| 147 | loginServer.pcLogin().then(()=>{ | 160 | loginServer.pcLogin().then(() => { |
| 148 | currUser = uni.getStorageSync('currUser') | 161 | currUser = uni.getStorageSync('currUser') |
| 149 | if (currUser.phonenumber) { | 162 | if (currUser.phonenumber) { |
| 150 | debugger | 163 | debugger |
| ... | @@ -215,13 +228,13 @@ | ... | @@ -215,13 +228,13 @@ |
| 215 | } | 228 | } |
| 216 | 229 | ||
| 217 | function init() { | 230 | function init() { |
| 218 | venue.value = app.globalData.venue | 231 | // venue.value = app.globalData.venue |
| 219 | latitude.value = app.globalData.venue.latitude | 232 | // latitude.value = app.globalData.venue.latitude |
| 220 | longitude.value = app.globalData.venue.longitude | 233 | // longitude.value = app.globalData.venue.longitude |
| 221 | // 修改页头标题 | 234 | // // 修改页头标题 |
| 222 | uni.setNavigationBarTitle({ | 235 | // uni.setNavigationBarTitle({ |
| 223 | title: venue.value.venueName | 236 | // title: venue.value.venueName |
| 224 | }); | 237 | // }); |
| 225 | } | 238 | } |
| 226 | 239 | ||
| 227 | function open() { | 240 | function open() { |
| ... | @@ -269,7 +282,7 @@ | ... | @@ -269,7 +282,7 @@ |
| 269 | url: item.path | 282 | url: item.path |
| 270 | }); | 283 | }); |
| 271 | // } | 284 | // } |
| 272 | }else{ | 285 | } else { |
| 273 | uni.showToast({ | 286 | uni.showToast({ |
| 274 | title: `暂未开放`, | 287 | title: `暂未开放`, |
| 275 | icon: 'none' | 288 | icon: 'none' |
| ... | @@ -279,7 +292,11 @@ | ... | @@ -279,7 +292,11 @@ |
| 279 | } | 292 | } |
| 280 | </script> | 293 | </script> |
| 281 | <style scope lang="scss"> | 294 | <style scope lang="scss"> |
| 282 | .singlePop{ max-height: 60vh;overflow: auto;} | 295 | .singlePop { |
| 296 | max-height: 60vh; | ||
| 297 | overflow: auto; | ||
| 298 | } | ||
| 299 | |||
| 283 | .map { | 300 | .map { |
| 284 | width: 100rpx; | 301 | width: 100rpx; |
| 285 | height: 100rpx; | 302 | height: 100rpx; | ... | ... |
| ... | @@ -48,8 +48,7 @@ | ... | @@ -48,8 +48,7 @@ |
| 48 | getList(); | 48 | getList(); |
| 49 | }); | 49 | }); |
| 50 | function getList(){ | 50 | function getList(){ |
| 51 | const venueId = app.globalData.venue.id | 51 | hotel.getTrainList().then(res => { |
| 52 | hotel.getTrainList(venueId).then(res => { | ||
| 53 | list.value = res.rows; | 52 | list.value = res.rows; |
| 54 | }); | 53 | }); |
| 55 | } | 54 | } | ... | ... |
-
Please register or sign in to post a comment