登录
Showing
10 changed files
with
455 additions
and
240 deletions
| 1 | <script> | 1 | <script> |
| 2 | import { | 2 | import { |
| 3 | h5Login | 3 | getInfo |
| 4 | } from '@/common/login.js'; | 4 | } from '@/common/login.js'; |
| 5 | import * as api from '@/common/api.js'; | 5 | import * as api from '@/common/api.js'; |
| 6 | import config from '@/config.js'; | 6 | import config from '@/config.js'; |
| ... | @@ -13,16 +13,14 @@ export default { | ... | @@ -13,16 +13,14 @@ export default { |
| 13 | firstload = true | 13 | firstload = true |
| 14 | 14 | ||
| 15 | this.globalData.baseUrl_api = config.baseUrl_api; | 15 | this.globalData.baseUrl_api = config.baseUrl_api; |
| 16 | |||
| 17 | |||
| 18 | let userName = uni.getStorageSync('userName') | ||
| 19 | if (userName) { | ||
| 20 | this.globalData.isLogin = true; | ||
| 21 | } else { | ||
| 22 | this.globalData.isLogin = false; | ||
| 23 | 16 | ||
| 24 | } | 17 | let userName = uni.getStorageSync('userName') |
| 25 | 18 | if (userName) { | |
| 19 | this.globalData.isLogin = true; | ||
| 20 | getInfo() | ||
| 21 | } else { | ||
| 22 | this.globalData.isLogin = false; | ||
| 23 | } | ||
| 26 | }, | 24 | }, |
| 27 | onShow: function() { | 25 | onShow: function() { |
| 28 | console.log('App Show'); | 26 | console.log('App Show'); | ... | ... |
| 1 | import request from './request' | 1 | import request from './request' |
| 2 | import config from '@/config.js' | 2 | import config from '@/config.js' |
| 3 | import aes from '@/common/aes.js' | 3 | import aes from '@/common/aes.js' |
| 4 | |||
| 4 | function pcLogin(data) { | 5 | function pcLogin(data) { |
| 5 | return request({ | 6 | return request({ |
| 6 | // url: '/login', | 7 | // url: '/login', |
| 7 | url: `${config.baseUrl_api}/loginZtx`, | 8 | url: `${config.baseUrl_api}/loginZtx`, |
| 8 | method: 'post', | 9 | method: 'post', |
| 9 | headers: { | 10 | headers: { |
| 10 | isToken: false | 11 | isToken: false |
| 11 | }, | 12 | }, |
| 12 | params: data | 13 | params: data |
| 13 | }).then((res) => { | 14 | }).then((res) => { |
| 14 | uni.setStorageSync('token', 'Bearer ' + res.data.token) | 15 | uni.setStorageSync('token', 'Bearer ' + res.data.token) |
| 15 | }) | 16 | }) |
| 16 | .then(getInfo) | 17 | .then(getInfo) |
| 18 | } | ||
| 19 | |||
| 20 | function bindIdcCode(idcCode) { | ||
| 21 | return request({ | ||
| 22 | url: `${config.baseUrl_api}/bind?idcCode=${idcCode}`, | ||
| 23 | method: 'post' | ||
| 24 | }) | ||
| 17 | } | 25 | } |
| 18 | 26 | ||
| 19 | function h5Login(userName) { | 27 | function h5Login(userName) { |
| ... | @@ -36,6 +44,7 @@ function h5LoginAuto() { | ... | @@ -36,6 +44,7 @@ function h5LoginAuto() { |
| 36 | uni.redirectTo({ | 44 | uni.redirectTo({ |
| 37 | url: '/pages/index/login' | 45 | url: '/pages/index/login' |
| 38 | }) | 46 | }) |
| 47 | return Promise.reject() | ||
| 39 | } | 48 | } |
| 40 | } | 49 | } |
| 41 | 50 | ||
| ... | @@ -71,7 +80,7 @@ function loginByPhone(phonenumber, code) { | ... | @@ -71,7 +80,7 @@ function loginByPhone(phonenumber, code) { |
| 71 | code | 80 | code |
| 72 | } | 81 | } |
| 73 | return request({ | 82 | return request({ |
| 74 | url: '/userLoginByPhone', | 83 | url: `${config.baseUrl_api}/userLoginByPhoneForPc`, |
| 75 | method: 'post', | 84 | method: 'post', |
| 76 | params: data | 85 | params: data |
| 77 | }).then((res) => { | 86 | }).then((res) => { |
| ... | @@ -82,15 +91,13 @@ function loginByPhone(phonenumber, code) { | ... | @@ -82,15 +91,13 @@ function loginByPhone(phonenumber, code) { |
| 82 | // 获取用户详细信息 | 91 | // 获取用户详细信息 |
| 83 | function getInfo() { | 92 | function getInfo() { |
| 84 | return request({ | 93 | return request({ |
| 85 | url: `${config.baseUrl_api}/getInfo`, | 94 | url: `${config.baseUrl_api}/getInfoForPc`, |
| 86 | method: 'get' | 95 | method: 'get' |
| 87 | }).then(res => { | 96 | }).then(res => { |
| 88 | const app = getApp() | 97 | const app = getApp() |
| 89 | const user = res.data.user | 98 | const user = res.data.user |
| 90 | const personInfo = res.data.personInfo | 99 | uni.setStorageSync('userName', user.userName) |
| 91 | uni.setStorageSync('userName', user.userName) | 100 | uni.setStorageSync('perId', aes.encrypt(user.userId)) |
| 92 | uni.setStorageSync('perId', aes.encrypt(personInfo.perId)) | ||
| 93 | app.globalData.deptType = user.dept.deptType | ||
| 94 | app.globalData.userInfo = user | 101 | app.globalData.userInfo = user |
| 95 | }) | 102 | }) |
| 96 | } | 103 | } |
| ... | @@ -114,54 +121,65 @@ function getMyOwnMemberInfo() { | ... | @@ -114,54 +121,65 @@ function getMyOwnMemberInfo() { |
| 114 | app.globalData.memberInfo = res.data.memberInfo | 121 | app.globalData.memberInfo = res.data.memberInfo |
| 115 | app.globalData.isExam = res.data?.dept?.isExam | 122 | app.globalData.isExam = res.data?.dept?.isExam |
| 116 | }) | 123 | }) |
| 117 | } | 124 | } |
| 118 | 125 | ||
| 119 | //for match | 126 | // for match |
| 120 | function getWxUserPhone(phoneRes) { | 127 | function getWxUserPhone(phoneRes) { |
| 121 | const currUser = uni.getStorageSync('currUser'); | 128 | const currUser = uni.getStorageSync('currUser') |
| 122 | // getNowOpenId() | 129 | // getNowOpenId() |
| 123 | const nowOpenId = uni.getStorageSync('nowOpenId'); | 130 | const nowOpenId = uni.getStorageSync('nowOpenId') |
| 124 | return request({ | 131 | return request({ |
| 125 | url: `/system/wx/updateMobile?openId=${nowOpenId}`, | 132 | url: `/system/wx/updateMobile?openId=${nowOpenId}`, |
| 126 | method: "POST", | 133 | method: 'POST', |
| 127 | params: { | 134 | params: { |
| 128 | appId: appId, | 135 | appId: appId, |
| 129 | userId: currUser.id, | 136 | userId: currUser.id, |
| 130 | encryptedData: phoneRes.encryptedData, | 137 | encryptedData: phoneRes.encryptedData, |
| 131 | errMsg: phoneRes.errMsg, | 138 | errMsg: phoneRes.errMsg, |
| 132 | iv: phoneRes.iv, | 139 | iv: phoneRes.iv, |
| 133 | rawData: phoneRes.rawData, | 140 | rawData: phoneRes.rawData, |
| 134 | signature: phoneRes.signature | 141 | signature: phoneRes.signature |
| 135 | } | 142 | } |
| 136 | }).then((res) => { | 143 | }).then((res) => { |
| 137 | let user = res.data; | 144 | const user = res.data |
| 138 | // uni.setStorageSync('token', 'Bearer '+ user.token); | 145 | // uni.setStorageSync('token', 'Bearer '+ user.token); |
| 139 | uni.setStorageSync('token', user.token); | 146 | uni.setStorageSync('token', user.token) |
| 140 | uni.setStorageSync('currUser', user); | 147 | uni.setStorageSync('currUser', user) |
| 141 | return user | 148 | return user |
| 142 | }) | 149 | }) |
| 143 | } | 150 | } |
| 151 | |||
| 144 | function checkUserAuth(path) { | 152 | function checkUserAuth(path) { |
| 145 | const app = getApp() | 153 | const app = getApp() |
| 146 | if (app.globalData.isLogin) { | 154 | if (app.globalData.isLogin) { |
| 147 | return true | 155 | if (app.globalData.userInfo.perId) { |
| 148 | } else { | 156 | return true |
| 149 | uni.navigateTo({ | 157 | } else { |
| 150 | url: '/pages/index/binding?path=' + encodeURIComponent(path) | 158 | uni.navigateTo({ |
| 151 | }) | 159 | url: '/myCenter/personInfo/index?path=' + encodeURIComponent(path) |
| 152 | return false; | 160 | }) |
| 153 | } | 161 | return false |
| 154 | } | 162 | } |
| 163 | } else { | ||
| 164 | uni.navigateTo({ | ||
| 165 | url: '/pages/index/login?path=' + encodeURIComponent(path) | ||
| 166 | }) | ||
| 167 | return false | ||
| 168 | } | ||
| 169 | } | ||
| 155 | 170 | ||
| 156 | export { | 171 | export { |
| 157 | pcLogin,getInfo, | 172 | pcLogin, |
| 173 | getInfo, | ||
| 158 | getCodeImg, | 174 | getCodeImg, |
| 159 | getSmsCode, | 175 | getSmsCode, |
| 160 | h5Login, | 176 | h5Login, |
| 161 | h5LoginAuto, | 177 | h5LoginAuto, |
| 162 | loginByPhone, | 178 | loginByPhone, |
| 163 | groupMemberRegister, | 179 | groupMemberRegister, |
| 164 | getMyOwnMemberInfo, | 180 | getMyOwnMemberInfo, |
| 165 | logout, | 181 | logout, |
| 166 | getWxUserPhone,checkUserAuth | 182 | getWxUserPhone, |
| 183 | checkUserAuth, | ||
| 184 | bindIdcCode | ||
| 167 | } | 185 | } | ... | ... |
| ... | @@ -8,9 +8,9 @@ | ... | @@ -8,9 +8,9 @@ |
| 8 | // const baseUrl_api = 'https://newsystem.taekwondo.org.cn/stage-api/' | 8 | // const baseUrl_api = 'https://newsystem.taekwondo.org.cn/stage-api/' |
| 9 | 9 | ||
| 10 | // train | 10 | // train |
| 11 | const baseUrl_api = 'http://192.168.1.11:8787' | 11 | const baseUrl_api = 'http://192.168.1.98:8787' |
| 12 | const trainUrl_api = 'http://192.168.1.25:8686' | 12 | const trainUrl_api = 'http://192.168.1.98:8686' |
| 13 | //match | 13 | // match |
| 14 | // const baseUrl_api = 'http://192.168.1.132:8081' | 14 | // const baseUrl_api = 'http://192.168.1.132:8081' |
| 15 | export default { | 15 | export default { |
| 16 | baseUrl_api, | 16 | baseUrl_api, | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <view class="box"> | 2 | <view class="box"> |
| 3 | <view class="topBg"> | 3 | <view class="topBg"> |
| 4 | <view class="userInfoBox"> | 4 | <view class="userInfoBox"> |
| 5 | <view class="headImg"> | 5 | <view class="headImg"> |
| 6 | <image mode="aspectFill" :src="avatarUrl"></image> | 6 | <image mode="aspectFill" :src="avatarUrl"></image> |
| 7 | </view> | 7 | </view> |
| 8 | <view class="nameBox"> | 8 | <view class="nameBox"> |
| 9 | {{ user.nickName }} | 9 | {{ user.nickName }} |
| 10 | <view>{{ user.phonenumber }}</view> | 10 | <view>{{ user.phonenumber }}</view> |
| 11 | </view> | 11 | </view> |
| 12 | </view> | 12 | </view> |
| 13 | </view> | 13 | </view> |
| 14 | <view class="rMainBox"> | 14 | <view class="rMainBox"> |
| 15 | <uni-list :border="false" class="myList"> | 15 | <uni-list :border="false" class="myList"> |
| 16 | <!-- <uni-list-item :border="false" title="个人信息" showArrow :to="`./myInfo`"> | 16 | <!-- <uni-list-item :border="false" title="个人信息" showArrow :to="`./myInfo`"> |
| 17 | <template v-slot:header> | 17 | <template v-slot:header> |
| 18 | <view class="slot-box"> | 18 | <view class="slot-box"> |
| 19 | <image class="slot-image" src="/static/user_icon03.png" mode="widthFix"></image> | 19 | <image class="slot-image" src="/static/user_icon03.png" mode="widthFix"></image> |
| ... | @@ -43,25 +43,25 @@ | ... | @@ -43,25 +43,25 @@ |
| 43 | </template> | 43 | </template> |
| 44 | </uni-list-item> --> | 44 | </uni-list-item> --> |
| 45 | 45 | ||
| 46 | <uni-list-item :border="false" title="我的培训" showArrow clickable @click="goPath('/myCenter/mytrain/mytrain')"> | 46 | <uni-list-item :border="false" title="我的培训" showArrow clickable @click="goPath('/myCenter/mytrain/mytrain')"> |
| 47 | <template v-slot:header> | 47 | <template v-slot:header> |
| 48 | <view class="slot-box"> | 48 | <view class="slot-box"> |
| 49 | <image class="slot-image" mode="widthFix"></image> | 49 | <image class="slot-image" mode="widthFix"></image> |
| 50 | </view> | 50 | </view> |
| 51 | </template> | 51 | </template> |
| 52 | </uni-list-item> | 52 | </uni-list-item> |
| 53 | 53 | ||
| 54 | <!-- <uni-list-item :border="false" title="我的赛事" showArrow :to="`./match`"> | 54 | <!-- <uni-list-item :border="false" title="我的赛事" showArrow :to="`./match`"> |
| 55 | <template v-slot:header> | 55 | <template v-slot:header> |
| 56 | <view class="slot-box"> | 56 | <view class="slot-box"> |
| 57 | <image class="slot-image" src="/static/user_icon04.png" mode="widthFix"></image> | 57 | <image class="slot-image" src="/static/user_icon04.png" mode="widthFix"></image> |
| 58 | </view> | 58 | </view> |
| 59 | </template> | 59 | </template> |
| 60 | </uni-list-item> --> | 60 | </uni-list-item> --> |
| 61 | </uni-list> | 61 | </uni-list> |
| 62 | </view> | 62 | </view> |
| 63 | 63 | ||
| 64 | </view> | 64 | </view> |
| 65 | </template> | 65 | </template> |
| 66 | 66 | ||
| 67 | <script setup> | 67 | <script setup> |
| ... | @@ -74,29 +74,29 @@ const user = ref({}); | ... | @@ -74,29 +74,29 @@ const user = ref({}); |
| 74 | const app = getApp(); | 74 | const app = getApp(); |
| 75 | 75 | ||
| 76 | onShow(() => { | 76 | onShow(() => { |
| 77 | if (app.globalData.isLogin) { | 77 | if (app.globalData.isLogin) { |
| 78 | init(); | 78 | init(); |
| 79 | } else { | 79 | } else { |
| 80 | app.firstLoadCallback = () => { | 80 | app.firstLoadCallback = () => { |
| 81 | init(); | 81 | init(); |
| 82 | }; | 82 | }; |
| 83 | } | 83 | } |
| 84 | }); | 84 | }); |
| 85 | function init() { | 85 | function init() { |
| 86 | console.log(app.globalData.isLogin) | 86 | console.log(app.globalData.isLogin) |
| 87 | if(app.globalData.userInfo){ | 87 | if(app.globalData.userInfo){ |
| 88 | const currUser = app.globalData.userInfo | 88 | const currUser = app.globalData.userInfo |
| 89 | user.value = currUser; | 89 | user.value = currUser; |
| 90 | } else { | 90 | } else { |
| 91 | loginServer.getInfo().then(res=>{ | 91 | loginServer.getInfo().then(res=>{ |
| 92 | const currUser = app.globalData.userInfo | 92 | const currUser = app.globalData.userInfo |
| 93 | user.value = currUser | 93 | user.value = currUser |
| 94 | }) | 94 | }) |
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | function goBack() { | 98 | function goBack() { |
| 99 | uni.navigateBack({}); | 99 | uni.navigateBack({}); |
| 100 | } | 100 | } |
| 101 | // function goQcode() { | 101 | // function goQcode() { |
| 102 | // uni.scanCode({ | 102 | // uni.scanCode({ |
| ... | @@ -121,18 +121,18 @@ function goBack() { | ... | @@ -121,18 +121,18 @@ function goBack() { |
| 121 | // }); | 121 | // }); |
| 122 | // } | 122 | // } |
| 123 | function building() { | 123 | function building() { |
| 124 | uni.showToast({ | 124 | uni.showToast({ |
| 125 | title: '暂未开放,敬请期待。', | 125 | title: '暂未开放,敬请期待。', |
| 126 | icon: 'none', | 126 | icon: 'none', |
| 127 | duration: 2000 | 127 | duration: 2000 |
| 128 | }); | 128 | }); |
| 129 | } | ||
| 130 | function goPath(path) { | ||
| 131 | if(path) | ||
| 132 | uni.navigateTo({ | ||
| 133 | url: path | ||
| 134 | }); | ||
| 129 | } | 135 | } |
| 130 | function goPath(path) { | ||
| 131 | if(path) | ||
| 132 | uni.navigateTo({ | ||
| 133 | url: path | ||
| 134 | }); | ||
| 135 | } | ||
| 136 | </script> | 136 | </script> |
| 137 | 137 | ||
| 138 | <style scoped lang="scss"> | 138 | <style scoped lang="scss"> | ... | ... |
myCenter/personInfo/index.vue
0 → 100644
| 1 | <template> | ||
| 2 | <view class="bg"> | ||
| 3 | <view class="formbox" v-if="form.perId"> | ||
| 4 | 身份证号:{{form.idcCode}} | ||
| 5 | </view> | ||
| 6 | <view class="formbox" v-else> | ||
| 7 | <view> | ||
| 8 | <view class="round-input-item"> | ||
| 9 | <uni-easyinput :styles="inputstyle" placeholder="身份证" v-model="form.idcCode" /> | ||
| 10 | </view> | ||
| 11 | </view> | ||
| 12 | <view class="flex-item"> | ||
| 13 | </view> | ||
| 14 | <view class="center-item"> | ||
| 15 | <button @click="handleBind" class="btn-red">绑定个人会员</button> | ||
| 16 | </view> | ||
| 17 | </view> | ||
| 18 | </view> | ||
| 19 | </template> | ||
| 20 | |||
| 21 | <script setup> | ||
| 22 | import { | ||
| 23 | ref | ||
| 24 | } from 'vue' | ||
| 25 | |||
| 26 | import { | ||
| 27 | onLoad | ||
| 28 | } from '@dcloudio/uni-app' | ||
| 29 | import config from '@/config.js' | ||
| 30 | import { | ||
| 31 | bindIdcCode | ||
| 32 | } from '@/common/login.js' | ||
| 33 | |||
| 34 | |||
| 35 | const app=getApp() | ||
| 36 | const form = ref({}) | ||
| 37 | |||
| 38 | let path = '/pages/myCenter/index'; | ||
| 39 | onLoad((option) => { | ||
| 40 | if (option.path) { | ||
| 41 | path = decodeURIComponent(option.path) | ||
| 42 | } | ||
| 43 | |||
| 44 | form.value=app.globalData.userInfo | ||
| 45 | }) | ||
| 46 | |||
| 47 | function handleBind() { | ||
| 48 | if (!form.value.idcCode) { | ||
| 49 | uni.showToast({ | ||
| 50 | title: '身份证号不能为空', | ||
| 51 | icon: 'none' | ||
| 52 | }) | ||
| 53 | return | ||
| 54 | } | ||
| 55 | |||
| 56 | bindIdcCode(form.value.idcCode) | ||
| 57 | .then((res) => { | ||
| 58 | uni.redirectTo({ | ||
| 59 | url: path | ||
| 60 | }) | ||
| 61 | }) | ||
| 62 | } | ||
| 63 | </script> | ||
| 64 | |||
| 65 | <style scoped lang="scss"> | ||
| 66 | .bg{background: linear-gradient(60deg,#ad1820 50%,#044a9f 50%);padding: 1px;height: 100vh;overflow: hidden;} | ||
| 67 | .formbox { | ||
| 68 | background: #fff; | ||
| 69 | width: 700rpx; | ||
| 70 | padding: 50rpx;box-sizing: border-box; | ||
| 71 | margin: auto; | ||
| 72 | border-radius: 20rpx; | ||
| 73 | } | ||
| 74 | .logoView { | ||
| 75 | /* margin: 20vh 0; */ | ||
| 76 | } | ||
| 77 | |||
| 78 | .logo { | ||
| 79 | width: 420rpx; | ||
| 80 | height: 179rpx; | ||
| 81 | margin: 60rpx auto 60rpx; | ||
| 82 | display: block; | ||
| 83 | } | ||
| 84 | |||
| 85 | .h1 { | ||
| 86 | font-size: 36rpx; | ||
| 87 | color: #000000; | ||
| 88 | text-align: center; | ||
| 89 | } | ||
| 90 | |||
| 91 | .start { | ||
| 92 | margin: 0 auto 80rpx; | ||
| 93 | font-size: 30rpx; | ||
| 94 | color: #fff; | ||
| 95 | height: 80rpx; | ||
| 96 | width: 480rpx; | ||
| 97 | border-radius: 40rpx; | ||
| 98 | background: #44A92F; | ||
| 99 | } | ||
| 100 | |||
| 101 | .agreeArea { | ||
| 102 | text-align: center; | ||
| 103 | } | ||
| 104 | |||
| 105 | .agreeArea label { | ||
| 106 | font-size: 26rpx; | ||
| 107 | } | ||
| 108 | |||
| 109 | .agreeArea label text { | ||
| 110 | color: #00C176; | ||
| 111 | } | ||
| 112 | |||
| 113 | .tip { | ||
| 114 | margin: 30rpx 0 0; | ||
| 115 | font-size: 20rpx; | ||
| 116 | color: #181818; | ||
| 117 | } | ||
| 118 | |||
| 119 | .h3 {} | ||
| 120 | .round-input-item { | ||
| 121 | overflow: hidden; | ||
| 122 | background: RGBA(247, 247, 248, 1); | ||
| 123 | border-radius: 40rpx; | ||
| 124 | padding: 0 0 0 30rpx; | ||
| 125 | height: 80rpx; | ||
| 126 | margin-bottom: 30rpx; | ||
| 127 | display: flex; | ||
| 128 | align-items: center; | ||
| 129 | |||
| 130 | image { | ||
| 131 | width: 180rpx; | ||
| 132 | height: 80rpx; | ||
| 133 | |||
| 134 | &.icon { | ||
| 135 | width: 30rpx; | ||
| 136 | height: 30rpx; | ||
| 137 | margin-right: 16rpx; | ||
| 138 | } | ||
| 139 | } | ||
| 140 | |||
| 141 | input { | ||
| 142 | border-left: 1rpx solid RGBA(214, 216, 219, 1); | ||
| 143 | padding: 0 0 0 20rpx; | ||
| 144 | font-size: 30rpx; | ||
| 145 | } | ||
| 146 | |||
| 147 | input::-webkit-input-placeholder { | ||
| 148 | color: RGBA(158, 166, 174, 1); | ||
| 149 | font-size: 30rpx; | ||
| 150 | } | ||
| 151 | |||
| 152 | input::placeholder { | ||
| 153 | color: RGBA(158, 166, 174, 1); | ||
| 154 | font-size: 30rpx; | ||
| 155 | } | ||
| 156 | |||
| 157 | input::-moz-placeholder { | ||
| 158 | color: RGBA(158, 166, 174, 1); | ||
| 159 | font-size: 30rpx; | ||
| 160 | } | ||
| 161 | |||
| 162 | text { | ||
| 163 | font-size: 28rpx; | ||
| 164 | color: #014A9F; padding: 0 20rpx; | ||
| 165 | } | ||
| 166 | |||
| 167 | } | ||
| 168 | |||
| 169 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -33,7 +33,7 @@ | ... | @@ -33,7 +33,7 @@ |
| 33 | } | 33 | } |
| 34 | }, | 34 | }, |
| 35 | { | 35 | { |
| 36 | "path": "pages/myCenter/myCenter", | 36 | "path": "pages/myCenter/index", |
| 37 | "style": { | 37 | "style": { |
| 38 | "navigationBarTitleText": "我的", | 38 | "navigationBarTitleText": "我的", |
| 39 | "enablePullDownRefresh": false | 39 | "enablePullDownRefresh": false |
| ... | @@ -209,6 +209,13 @@ | ... | @@ -209,6 +209,13 @@ |
| 209 | "navigationBarTitleText": "个人中心", | 209 | "navigationBarTitleText": "个人中心", |
| 210 | "enablePullDownRefresh": false | 210 | "enablePullDownRefresh": false |
| 211 | } | 211 | } |
| 212 | }, | ||
| 213 | { | ||
| 214 | "path": "personInfo/index", | ||
| 215 | "style": { | ||
| 216 | "navigationBarTitleText": "个人会员信息", | ||
| 217 | "enablePullDownRefresh": false | ||
| 218 | } | ||
| 212 | }, | 219 | }, |
| 213 | { | 220 | { |
| 214 | "path": "mytrain/mytrain", | 221 | "path": "mytrain/mytrain", |
| ... | @@ -263,7 +270,7 @@ | ... | @@ -263,7 +270,7 @@ |
| 263 | "pagePath": "pages/webView/auth", | 270 | "pagePath": "pages/webView/auth", |
| 264 | "text": "认证查询" | 271 | "text": "认证查询" |
| 265 | }, { | 272 | }, { |
| 266 | "pagePath": "pages/myCenter/myCenter", | 273 | "pagePath": "pages/myCenter/index", |
| 267 | "text": "我的" | 274 | "text": "我的" |
| 268 | }] | 275 | }] |
| 269 | } | 276 | } | ... | ... |
This diff is collapsed.
Click to expand it.
| 1 | <template> | 1 | <template> |
| 2 | <view class="page"> | 2 | <view class="page"> |
| 3 | <swiper> | 3 | <swiper> |
| 4 | <swiper-item>1</swiper-item> | 4 | <swiper-item>1</swiper-item> |
| 5 | <swiper-item>2</swiper-item> | 5 | <swiper-item>2</swiper-item> |
| 6 | <swiper-item>3</swiper-item> | 6 | <swiper-item>3</swiper-item> |
| 7 | </swiper> | 7 | </swiper> |
| 8 | <view class="girdBox"> | 8 | <view class="girdBox"> |
| 9 | <view @click="goPath('/training/trainList')"> | 9 | <view @click="goPath('/training/trainList')"> |
| 10 | <image />新闻资讯 | 10 | <image />新闻资讯 |
| 11 | </view> | 11 | </view> |
| 12 | <view @click="goPath('/match/index')"> | 12 | <view @click="goPath('/match/index')"> |
| 13 | <image />赛事报名 | 13 | <image />赛事报名 |
| 14 | </view> | 14 | </view> |
| 15 | 15 | ||
| 16 | <view @click="goPath('/training/trainList')"> | 16 | <view @click="goPath('/training/trainList')"> |
| 17 | <image />培训报名 | 17 | <image />培训报名 |
| 18 | </view> | 18 | </view> |
| 19 | <view @click="goPath()"> | 19 | <view @click="goPath()"> |
| 20 | <image />团体会员 | 20 | <image />团体会员 |
| 21 | </view> | 21 | </view> |
| 22 | <view @click="goPath()"> | 22 | <view @click="goPath()"> |
| 23 | <image />地方协会 | 23 | <image />地方协会 |
| 24 | </view> | 24 | </view> |
| 25 | <view @click="goPath()"> | 25 | <view @click="goPath()"> |
| 26 | <image />考点查询 | 26 | <image />考点查询 |
| 27 | </view> | 27 | </view> |
| 28 | <view @click="goPath('/webView/vipSystem')"> | 28 | <view @click="goPath('/webView/vipSystem')"> |
| 29 | <image />会员系统 | 29 | <image />会员系统 |
| 30 | </view> | 30 | </view> |
| 31 | <view @click="goPath('/myCenter/index')"> | 31 | <view @click="goTab('/pages/myCenter/index')"> |
| 32 | <image />我的 | 32 | <image />我的 |
| 33 | </view> | 33 | </view> |
| 34 | 34 | ||
| 35 | </view> | 35 | </view> |
| 36 | </view> | 36 | </view> |
| 37 | </template> | 37 | </template> |
| 38 | 38 | ||
| 39 | <script setup> | 39 | <script setup> |
| 40 | import * as api from '@/common/api.js'; | 40 | import * as api from '@/common/api.js'; |
| 41 | import * as loginServer from '@/common/login.js'; | 41 | import * as loginServer from '@/common/login.js'; |
| 42 | import config from '@/config.js' | 42 | import config from '@/config.js' |
| 43 | import { | 43 | import { |
| 44 | onLoad, | 44 | onLoad, |
| 45 | onShow, | 45 | onShow, |
| 46 | onReady, | 46 | onReady, |
| 47 | onPullDownRefresh | 47 | onPullDownRefresh |
| 48 | } from '@dcloudio/uni-app'; | 48 | } from '@dcloudio/uni-app'; |
| 49 | import { | 49 | import { |
| 50 | ref, | 50 | ref, |
| 51 | getCurrentInstance | 51 | getCurrentInstance |
| 52 | } from 'vue'; | 52 | } from 'vue'; |
| 53 | 53 | ||
| 54 | 54 | ||
| 55 | const { | 55 | const { |
| 56 | proxy | 56 | proxy |
| 57 | } = getCurrentInstance() | 57 | } = getCurrentInstance() |
| 58 | const app = getApp(); | 58 | const app = getApp(); |
| 59 | const svId = ref(null); | 59 | const svId = ref(null); |
| 60 | 60 | ||
| 61 | const messageList = ref([]) | 61 | const messageList = ref([]) |
| 62 | onShow(() => { | 62 | onShow(() => { |
| 63 | if (app.globalData.isLogin) { | 63 | if (app.globalData.isLogin) { |
| 64 | init() | 64 | init() |
| 65 | } else { | 65 | } else { |
| 66 | app.firstLoadCallback = () => { | 66 | app.firstLoadCallback = () => { |
| 67 | init() | 67 | init() |
| 68 | }; | 68 | }; |
| 69 | } | 69 | } |
| 70 | }) | 70 | }) |
| 71 | onLoad(option => { | 71 | onLoad(option => { |
| 72 | 72 | ||
| 73 | }); | 73 | }); |
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | function goPath(path) { | 76 | function goPath(path) { |
| 77 | if(path) | 77 | if(path) |
| 78 | uni.navigateTo({ | 78 | uni.navigateTo({ |
| 79 | url: path | 79 | url: path |
| 80 | }); | 80 | }); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | function goTab(path){ | ||
| 84 | uni.switchTab({ | ||
| 85 | url: path | ||
| 86 | }) | ||
| 87 | } | ||
| 83 | 88 | ||
| 84 | 89 | ||
| 85 | function init() { | 90 | function init() { |
| 86 | uni.showLoading({ | 91 | uni.showLoading({ |
| 87 | title: '加载中' | 92 | title: '加载中' |
| 88 | }); | 93 | }); |
| 89 | uni.hideLoading(); | 94 | uni.hideLoading(); |
| 90 | 95 | ||
| 91 | } | 96 | } |
| 92 | 97 | ||
| 93 | 98 | ||
| 94 | 99 | ||
| 95 | function goItem(item) { | 100 | function goItem(item) { |
| 96 | if (item.path) { | 101 | if (item.path) { |
| 97 | let path = item.path | 102 | let path = item.path |
| 98 | uni.navigateTo({ | 103 | uni.navigateTo({ |
| 99 | url: item.path | 104 | url: item.path |
| 100 | }); | 105 | }); |
| 101 | 106 | ||
| 102 | } else { | 107 | } else { |
| 103 | uni.showToast({ | 108 | uni.showToast({ |
| 104 | title: `暂未开放`, | 109 | title: `暂未开放`, |
| 105 | icon: 'none' | 110 | icon: 'none' |
| 106 | }); | 111 | }); |
| 107 | } | 112 | } |
| 108 | } | 113 | } |
| 109 | </script> | 114 | </script> |
| 110 | <style scope lang="scss"> | 115 | <style scope lang="scss"> |
| 111 | .page{width: 100vw;overflow: hidden;} | 116 | .page{width: 100vw;overflow: hidden;} | ... | ... |
| ... | @@ -5,10 +5,10 @@ | ... | @@ -5,10 +5,10 @@ |
| 5 | <view class="retop"> | 5 | <view class="retop"> |
| 6 | <image class="logotop" :src="config.baseUrl_api+'/fs/static/login/logo@2x.png'"></image> | 6 | <image class="logotop" :src="config.baseUrl_api+'/fs/static/login/logo@2x.png'"></image> |
| 7 | <view class="loginbox"> | 7 | <view class="loginbox"> |
| 8 | <view class="loginNav"> | 8 | <!-- <view class="loginNav"> |
| 9 | <view class="n1" :class="isActive==0?'active':''" @click="changeActive(0)">密码登录</view> | 9 | <view class="n1" :class="isActive==0?'active':''" @click="changeActive(0)">密码登录</view> |
| 10 | <view class="n2" :class="isActive==1?'active':''" @click="changeActive(1)">短信登录</view> | 10 | <view class="n2" :class="isActive==1?'active':''" @click="changeActive(1)">短信登录</view> |
| 11 | </view> | 11 | </view> --> |
| 12 | <!-- 密码登录 --> | 12 | <!-- 密码登录 --> |
| 13 | <view class="formbox"> | 13 | <view class="formbox"> |
| 14 | <form v-if="isActive==0"> | 14 | <form v-if="isActive==0"> |
| ... | @@ -55,9 +55,9 @@ | ... | @@ -55,9 +55,9 @@ |
| 55 | <view class="center-item"> | 55 | <view class="center-item"> |
| 56 | <button @click="login" class="btn-red">登录</button> | 56 | <button @click="login" class="btn-red">登录</button> |
| 57 | </view> | 57 | </view> |
| 58 | <view class="center-item"> | 58 | <!--<view class="center-item"> |
| 59 | <text class="text-red" @click="goRegister">没有账号,去注册</text> | 59 | <text class="text-red" @click="goRegister">没有账号,去注册</text> |
| 60 | </view> | 60 | </view> --> |
| 61 | 61 | ||
| 62 | </view> | 62 | </view> |
| 63 | 63 | ||
| ... | @@ -84,16 +84,19 @@ import { | ... | @@ -84,16 +84,19 @@ import { |
| 84 | getSmsCode, | 84 | getSmsCode, |
| 85 | pcLogin, | 85 | pcLogin, |
| 86 | loginByPhone | 86 | loginByPhone |
| 87 | } from '@/common/login.js' | 87 | } from '@/common/login.js' |
| 88 | import { | ||
| 89 | onLoad | ||
| 90 | } from '@dcloudio/uni-app' | ||
| 88 | 91 | ||
| 89 | const isActive = ref(0) | 92 | const isActive = ref(1) |
| 90 | const agree = ref(false) | 93 | const agree = ref(false) |
| 91 | const isRember = ref(true) | 94 | const isRember = ref(true) |
| 92 | const codeUrl = ref(null) | 95 | const codeUrl = ref(null) |
| 93 | const inputstyle = ref({ | 96 | const inputstyle = ref({ |
| 94 | borderColor: 'transparent', | 97 | borderColor: 'transparent', |
| 95 | fontSize: '30rpx' | 98 | fontSize: '30rpx' |
| 96 | }) | 99 | }) |
| 97 | const form = ref({ | 100 | const form = ref({ |
| 98 | username: null, | 101 | username: null, |
| 99 | password: null, | 102 | password: null, |
| ... | @@ -109,11 +112,15 @@ const form2 = ref({ | ... | @@ -109,11 +112,15 @@ const form2 = ref({ |
| 109 | const countDown = ref({ | 112 | const countDown = ref({ |
| 110 | start: false, | 113 | start: false, |
| 111 | second: 60 | 114 | second: 60 |
| 112 | }) | 115 | }) |
| 113 | 116 | ||
| 114 | const app = getApp() | 117 | const app = getApp() |
| 115 | 118 | const switchTab=['/pages/index/index','/pages/webView/auth','/pages/myCenter/index'] | |
| 116 | onMounted(() => { | 119 | let path = '/pages/index/index'; |
| 120 | onLoad((option) => { | ||
| 121 | if (option.path) { | ||
| 122 | path = decodeURIComponent(option.path) | ||
| 123 | } | ||
| 117 | getCode() | 124 | getCode() |
| 118 | }) | 125 | }) |
| 119 | 126 | ||
| ... | @@ -151,8 +158,7 @@ function login() { | ... | @@ -151,8 +158,7 @@ function login() { |
| 151 | } | 158 | } |
| 152 | 159 | ||
| 153 | pcLogin(form.value) | 160 | pcLogin(form.value) |
| 154 | .then((res) => { | 161 | .then((res) => { |
| 155 | |||
| 156 | app.globalData.isLogin = true | 162 | app.globalData.isLogin = true |
| 157 | uni.redirectTo({ | 163 | uni.redirectTo({ |
| 158 | url: '/pages/index/index' | 164 | url: '/pages/index/index' |
| ... | @@ -177,10 +183,22 @@ function login() { | ... | @@ -177,10 +183,22 @@ function login() { |
| 177 | 183 | ||
| 178 | loginByPhone(form2.value.telNo,form2.value.code) | 184 | loginByPhone(form2.value.telNo,form2.value.code) |
| 179 | .then(() => { | 185 | .then(() => { |
| 180 | app.globalData.isLogin = true | 186 | app.globalData.isLogin = true |
| 181 | uni.redirectTo({ | 187 | if(!app.globalData.userInfo.perId){ |
| 182 | url: '/pages/index/index' | 188 | uni.redirectTo({ |
| 183 | }) | 189 | url: '/myCenter/personInfo/index?path=' + encodeURIComponent(path) |
| 190 | }) | ||
| 191 | }else{ | ||
| 192 | if(switchTab.indexOf(path)>-1){ | ||
| 193 | uni.switchTab({ | ||
| 194 | url: path | ||
| 195 | }) | ||
| 196 | }else{ | ||
| 197 | uni.redirectTo({ | ||
| 198 | url: path | ||
| 199 | }) | ||
| 200 | } | ||
| 201 | } | ||
| 184 | }) | 202 | }) |
| 185 | } | 203 | } |
| 186 | } | 204 | } | ... | ... |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment