4b268e3f by 华明祺

登录

1 parent 9e55c13c
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';
...@@ -14,15 +14,13 @@ export default { ...@@ -14,15 +14,13 @@ export default {
14 14
15 this.globalData.baseUrl_api = config.baseUrl_api; 15 this.globalData.baseUrl_api = config.baseUrl_api;
16 16
17
18 let userName = uni.getStorageSync('userName') 17 let userName = uni.getStorageSync('userName')
19 if (userName) { 18 if (userName) {
20 this.globalData.isLogin = true; 19 this.globalData.isLogin = true;
20 getInfo()
21 } else { 21 } else {
22 this.globalData.isLogin = false; 22 this.globalData.isLogin = false;
23
24 } 23 }
25
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',
...@@ -16,6 +17,13 @@ function pcLogin(data) { ...@@ -16,6 +17,13 @@ function pcLogin(data) {
16 .then(getInfo) 17 .then(getInfo)
17 } 18 }
18 19
20 function bindIdcCode(idcCode) {
21 return request({
22 url: `${config.baseUrl_api}/bind?idcCode=${idcCode}`,
23 method: 'post'
24 })
25 }
26
19 function h5Login(userName) { 27 function h5Login(userName) {
20 return request({ 28 return request({
21 url: `/h5Login`, 29 url: `/h5Login`,
...@@ -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
91 uni.setStorageSync('userName', user.userName) 99 uni.setStorageSync('userName', user.userName)
92 uni.setStorageSync('perId', aes.encrypt(personInfo.perId)) 100 uni.setStorageSync('perId', aes.encrypt(user.userId))
93 app.globalData.deptType = user.dept.deptType
94 app.globalData.userInfo = user 101 app.globalData.userInfo = user
95 }) 102 })
96 } 103 }
...@@ -116,14 +123,14 @@ function getMyOwnMemberInfo() { ...@@ -116,14 +123,14 @@ function getMyOwnMemberInfo() {
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,
...@@ -134,27 +141,36 @@ function getWxUserPhone(phoneRes) { ...@@ -134,27 +141,36 @@ function getWxUserPhone(phoneRes) {
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) {
155 if (app.globalData.userInfo.perId) {
147 return true 156 return true
148 } else { 157 } else {
149 uni.navigateTo({ 158 uni.navigateTo({
150 url: '/pages/index/binding?path=' + encodeURIComponent(path) 159 url: '/myCenter/personInfo/index?path=' + encodeURIComponent(path)
160 })
161 return false
162 }
163 } else {
164 uni.navigateTo({
165 url: '/pages/index/login?path=' + encodeURIComponent(path)
151 }) 166 })
152 return false; 167 return false
153 } 168 }
154 } 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,
...@@ -163,5 +179,7 @@ export { ...@@ -163,5 +179,7 @@ export {
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,
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
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>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
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>
...@@ -127,12 +127,12 @@ function building() { ...@@ -127,12 +127,12 @@ function building() {
127 duration: 2000 127 duration: 2000
128 }); 128 });
129 } 129 }
130 function goPath(path) { 130 function goPath(path) {
131 if(path) 131 if(path)
132 uni.navigateTo({ 132 uni.navigateTo({
133 url: path 133 url: path
134 }); 134 });
135 } 135 }
136 </script> 136 </script>
137 137
138 <style scoped lang="scss"> 138 <style scoped lang="scss">
......
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
...@@ -211,6 +211,13 @@ ...@@ -211,6 +211,13 @@
211 } 211 }
212 }, 212 },
213 { 213 {
214 "path": "personInfo/index",
215 "style": {
216 "navigationBarTitleText": "个人会员信息",
217 "enablePullDownRefresh": false
218 }
219 },
220 {
214 "path": "mytrain/mytrain", 221 "path": "mytrain/mytrain",
215 "style": { 222 "style": {
216 "navigationBarTitleText": "我的培训", 223 "navigationBarTitleText": "我的培训",
...@@ -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 }
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
9 <view> 9 <view>
10 <!-- 密码登录 --> 10 <!-- 密码登录 -->
11 <view class="formbox"> 11 <view class="formbox">
12
13 <view> 12 <view>
14 <view class="round-input-item"> 13 <view class="round-input-item">
15 <image class="icon" :src="config.baseUrl_api+'/fs/static/login/tag01@2x.png'"></image> 14 <image class="icon" :src="config.baseUrl_api+'/fs/static/login/tag01@2x.png'"></image>
...@@ -88,48 +87,48 @@ ...@@ -88,48 +87,48 @@
88 </template> 87 </template>
89 88
90 <script setup> 89 <script setup>
91 import { 90 import {
92 ref 91 ref
93 } from 'vue' 92 } from 'vue'
94 93
95 import { 94 import {
96 onLoad 95 onLoad
97 } from '@dcloudio/uni-app' 96 } from '@dcloudio/uni-app'
98 import config from '@/config.js' 97 import config from '@/config.js'
99 import { 98 import {
100 pcLogin, 99 pcLogin,
101 getWxUserPhone, 100 getWxUserPhone,
102 getCodeImg, 101 getCodeImg,
103 getSmsCode, 102 getSmsCode,
104 loginByPhone 103 loginByPhone
105 } from '@/common/login.js' 104 } from '@/common/login.js'
106 105
107 106
108 const popup = ref(null) 107 const popup = ref(null)
109 const agree = ref(true) 108 const agree = ref(true)
110 const loading = ref(false) 109 const loading = ref(false)
111 const showAgree = ref(false) 110 const showAgree = ref(false)
112 const form = ref({}) 111 const form = ref({})
113 const codeUrl = ref('') 112 const codeUrl = ref('')
114 const inputstyle = ref({ 113 const inputstyle = ref({
115 borderColor: 'transparent', 114 borderColor: 'transparent',
116 fontSize: '30rpx' 115 fontSize: '30rpx'
117 }) 116 })
118 const app = getApp() 117 const app = getApp()
119 118
120 let path = '/pages/index/index'; 119 let path = '/pages/index/index';
121 onLoad((option) => { 120 onLoad((option) => {
122 if (option.path) { 121 if (option.path) {
123 path = decodeURIComponent(option.path) 122 path = decodeURIComponent(option.path)
124 } 123 }
125 getCode() 124 getCode()
126 }) 125 })
127 126
128 function radioChange() { 127 function radioChange() {
129 popup.value.open() 128 popup.value.open()
130 agree.value = true 129 agree.value = true
131 } 130 }
132 function decryptPhoneNumber(res) { 131 function decryptPhoneNumber(res) {
133 // console.log(res) 132 // console.log(res)
134 133
135 loading.value = true 134 loading.value = true
...@@ -146,29 +145,29 @@ const app = getApp() ...@@ -146,29 +145,29 @@ const app = getApp()
146 } else { 145 } else {
147 loading.value = false 146 loading.value = false
148 } 147 }
149 } 148 }
150 149
151 function subscribe() { 150 function subscribe() {
152 uni.requestSubscribeMessage({ 151 uni.requestSubscribeMessage({
153 tmplIds: ['pvrlpWl1MDJfOghILwUsQtfcg96LWdstVOFLrDxGcdM'], 152 tmplIds: ['pvrlpWl1MDJfOghILwUsQtfcg96LWdstVOFLrDxGcdM'],
154 success: (res) => { 153 success: (res) => {
155 console.log('success:', res) 154 console.log('success:', res)
156 } 155 }
157 }) 156 })
158 } 157 }
159 158
160 function showAgreement() { 159 function showAgreement() {
161 popup.value.open() 160 popup.value.open()
162 } 161 }
163 162
164 function getCode() { 163 function getCode() {
165 getCodeImg().then((res) => { 164 getCodeImg().then((res) => {
166 codeUrl.value = 'data:image/gif;base64,' + res.data.img 165 codeUrl.value = 'data:image/gif;base64,' + res.data.img
167 form.value.uuid = res.data.uuid 166 form.value.uuid = res.data.uuid
168 }) 167 })
169 } 168 }
170 169
171 function handleLogin() { 170 function handleLogin() {
172 if (!form.value.username) { 171 if (!form.value.username) {
173 uni.showToast({ 172 uni.showToast({
174 title: '账号不能为空', 173 title: '账号不能为空',
...@@ -197,7 +196,7 @@ const app = getApp() ...@@ -197,7 +196,7 @@ const app = getApp()
197 url: path 196 url: path
198 }) 197 })
199 }) 198 })
200 } 199 }
201 </script> 200 </script>
202 201
203 <style scoped lang="scss"> 202 <style scoped lang="scss">
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
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
...@@ -37,29 +37,29 @@ ...@@ -37,29 +37,29 @@
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 {
...@@ -67,32 +67,37 @@ ...@@ -67,32 +67,37 @@
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({
...@@ -105,7 +110,7 @@ ...@@ -105,7 +110,7 @@
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
...@@ -85,15 +85,18 @@ import { ...@@ -85,15 +85,18 @@ import {
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,
...@@ -112,8 +115,12 @@ const countDown = ref({ ...@@ -112,8 +115,12 @@ const countDown = ref({
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
...@@ -152,7 +159,6 @@ function login() { ...@@ -152,7 +159,6 @@ function login() {
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'
...@@ -178,9 +184,21 @@ function login() { ...@@ -178,9 +184,21 @@ function login() {
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
187 if(!app.globalData.userInfo.perId){
181 uni.redirectTo({ 188 uni.redirectTo({
182 url: '/pages/index/index' 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
183 }) 199 })
200 }
201 }
184 }) 202 })
185 } 203 }
186 } 204 }
......
1 <template> 1 <template>
2 <view class="box"> 2 <view class="box" v-if='isShow'>
3 <view class="topBg"> 3 <view class="topBg">
4 <view class="userInfoBox"> 4 <view class="userInfoBox">
5 <view class="headImg"> 5 <view class="headImg">
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
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>
...@@ -42,8 +42,16 @@ ...@@ -42,8 +42,16 @@
42 </view> 42 </view>
43 </template> 43 </template>
44 </uni-list-item> --> 44 </uni-list-item> -->
45 45 <uni-list-item :border="false" title="个人会员" showArrow clickable
46 <uni-list-item :border="false" title="我的培训" showArrow clickable @click="goPath('/myCenter/mytrain/mytrain')"> 46 @click="goPath('/myCenter/personInfo/index')">
47 <template v-slot:header>
48 <view class="slot-box">
49 <image class="slot-image" mode="widthFix"></image>
50 </view>
51 </template>
52 </uni-list-item>
53 <uni-list-item :border="false" title="我的培训" showArrow clickable
54 @click="goPath('/myCenter/mytrain/mytrain')">
47 <template v-slot:header> 55 <template v-slot:header>
48 <view class="slot-box"> 56 <view class="slot-box">
49 <image class="slot-image" mode="widthFix"></image> 57 <image class="slot-image" mode="widthFix"></image>
...@@ -51,7 +59,7 @@ ...@@ -51,7 +59,7 @@
51 </template> 59 </template>
52 </uni-list-item> 60 </uni-list-item>
53 61
54 <!-- <uni-list-item :border="false" title="我的赛事" showArrow :to="`./match`"> 62 <!-- <uni-list-item :border="false" title="我的赛事" showArrow :to="`./match`">
55 <template v-slot:header> 63 <template v-slot:header>
56 <view class="slot-box"> 64 <view class="slot-box">
57 <image class="slot-image" src="/static/user_icon04.png" mode="widthFix"></image> 65 <image class="slot-image" src="/static/user_icon04.png" mode="widthFix"></image>
...@@ -67,32 +75,40 @@ ...@@ -67,32 +75,40 @@
67 <script setup> 75 <script setup>
68 import * as my from '@/myCenter/center_api.js'; 76 import * as my from '@/myCenter/center_api.js';
69 import * as loginServer from '@/common/login.js'; 77 import * as loginServer from '@/common/login.js';
70 import { ref } from 'vue'; 78 import {
71 import { onLoad, onShow } from '@dcloudio/uni-app'; 79 onMounted,
80 ref
81 } from 'vue';
82 import {
83 onLoad,
84 onShow
85 } from '@dcloudio/uni-app';
72 86
73 const user = ref({}); 87 const user = ref({});
74 const app = getApp(); 88 const app = getApp();
89 const isShow = ref(false)
90
91 onMounted(() => {
92 init()
93 })
75 94
76 onShow(() => {
77 if (app.globalData.isLogin) {
78 init();
79 } else {
80 app.firstLoadCallback = () => {
81 init();
82 };
83 }
84 });
85 function init() { 95 function init() {
86 console.log(app.globalData.isLogin) 96 if (app.globalData.isLogin) {
87 if(app.globalData.userInfo){ 97 isShow.value = true
98 if (app.globalData.userInfo) {
88 const currUser = app.globalData.userInfo 99 const currUser = app.globalData.userInfo
89 user.value = currUser; 100 user.value = currUser;
90 } else { 101 } else {
91 loginServer.getInfo().then(res=>{ 102 loginServer.getInfo().then(res => {
92 const currUser = app.globalData.userInfo 103 const currUser = app.globalData.userInfo
93 user.value = currUser 104 user.value = currUser
94 }) 105 })
95 } 106 }
107 } else {
108 uni.redirectTo({
109 url: '/pages/index/login?path=' + encodeURIComponent(getCurrentPages()[0].$page.fullPath)
110 })
111 }
96 } 112 }
97 113
98 function goBack() { 114 function goBack() {
...@@ -127,74 +143,87 @@ function building() { ...@@ -127,74 +143,87 @@ function building() {
127 duration: 2000 143 duration: 2000
128 }); 144 });
129 } 145 }
130 function goPath(path) { 146
131 if(path) 147 function goPath(path) {
148 if (path)
132 uni.navigateTo({ 149 uni.navigateTo({
133 url: path 150 url: path
134 }); 151 });
135 } 152 }
136 </script> 153 </script>
137 154
138 <style scoped lang="scss"> 155 <style scoped lang="scss">
139 .box { 156 .box {
140 width: 100vw; 157 width: 100vw;
141 overflow: hidden; 158 overflow: hidden;
142 } 159 }
143 .rMainBox { 160
161 .rMainBox {
144 box-sizing: border-box; 162 box-sizing: border-box;
145 padding: 20rpx 25rpx 0; 163 padding: 20rpx 25rpx 0;
146 margin: 25rpx; 164 margin: 25rpx;
147 } 165 }
148 .userInfoBox { 166
167 .userInfoBox {
149 height: 200rpx; 168 height: 200rpx;
150 } 169 }
151 .nameBox { 170
171 .nameBox {
152 position: absolute; 172 position: absolute;
153 left: 180rpx; 173 left: 180rpx;
154 top: 70rpx; 174 top: 70rpx;
155 font-size: 30rpx; 175 font-size: 30rpx;
156 } 176 }
157 .nameBox view { 177
178 .nameBox view {
158 color: #7b7f83; 179 color: #7b7f83;
159 font-size: 26rpx; 180 font-size: 26rpx;
160 margin-top: 10rpx; 181 margin-top: 10rpx;
161 } 182 }
162 .goback { 183
184 .goback {
163 position: absolute; 185 position: absolute;
164 color: #fff; 186 color: #fff;
165 top: 100rpx; 187 top: 100rpx;
166 left: 35rpx; 188 left: 35rpx;
167 } 189 }
168 .forAdmin { 190
191 .forAdmin {
169 padding: 25rpx; 192 padding: 25rpx;
170 box-sizing: border-box; 193 box-sizing: border-box;
171 } 194 }
172 .topBg { 195
173 } 196 .topBg {}
174 .onlyCardBottom { 197
198 .onlyCardBottom {
175 position: relative; 199 position: relative;
176 width: 660rpx; 200 width: 660rpx;
177 margin: auto; 201 margin: auto;
178 height: 90rpx; 202 height: 90rpx;
203
179 .bbg { 204 .bbg {
180 height: 90rpx; 205 height: 90rpx;
181 width: 660rpx; 206 width: 660rpx;
182 } 207 }
208
183 .cardBottom { 209 .cardBottom {
184 width: 660rpx; 210 width: 660rpx;
185 background: transparent; 211 background: transparent;
186 height: 90rpx; 212 height: 90rpx;
213
187 text { 214 text {
188 font-size: 28rpx; 215 font-size: 28rpx;
189 color: #925921; 216 color: #925921;
190 } 217 }
218
191 .renewBtn { 219 .renewBtn {
192 background: #874f02; 220 background: #874f02;
193 color: #fff; 221 color: #fff;
194 } 222 }
195 } 223 }
196 } 224 }
197 .headImg { 225
226 .headImg {
198 border-radius: 50%; 227 border-radius: 50%;
199 position: relative; 228 position: relative;
200 top: 50rpx; 229 top: 50rpx;
...@@ -204,59 +233,67 @@ function building() { ...@@ -204,59 +233,67 @@ function building() {
204 border: 4px solid #ffffff; 233 border: 4px solid #ffffff;
205 background: #c4f9cb; 234 background: #c4f9cb;
206 left: 40rpx; 235 left: 40rpx;
236
207 button { 237 button {
208 display: block; 238 display: block;
209 padding: 0; 239 padding: 0;
210 } 240 }
241
211 image { 242 image {
212 width: 100rpx; 243 width: 100rpx;
213 height: 100rpx; 244 height: 100rpx;
214 display: block; 245 display: block;
215 } 246 }
216 } 247 }
217 248
218 .slot-image { 249 .slot-image {
219 width: 50rpx; 250 width: 50rpx;
220 position: relative; 251 position: relative;
221 top: -8rpx; 252 top: -8rpx;
222 height: 50rpx; 253 height: 50rpx;
223 margin-right: 30rpx; 254 margin-right: 30rpx;
224 } 255 }
225 256
226 .myList { 257 .myList {}
227 } 258
228 .funcBar { 259 .funcBar {
229 display: flex; 260 display: flex;
230 background: #fff; 261 background: #fff;
231 width: 700rpx; 262 width: 700rpx;
232 height: 140rpx; 263 height: 140rpx;
233 justify-content: space-around; 264 justify-content: space-around;
234 } 265 }
235 .funcBar view { 266
267 .funcBar view {
236 display: flex; 268 display: flex;
237 align-items: center; 269 align-items: center;
238 font-size: 36rpx; 270 font-size: 36rpx;
239 } 271 }
240 .funcBar image { 272
273 .funcBar image {
241 width: 80rpx; 274 width: 80rpx;
242 height: 80rpx; 275 height: 80rpx;
243 } 276 }
244 .topbgimg { 277
278 .topbgimg {
245 width: 100vw; 279 width: 100vw;
246 position: absolute; 280 position: absolute;
247 z-index: -1; 281 z-index: -1;
248 } 282 }
249 .reportItembox { 283
284 .reportItembox {
250 overflow: hidden; 285 overflow: hidden;
251 display: flex; 286 display: flex;
252 flex-wrap: wrap; 287 flex-wrap: wrap;
253 justify-content: space-between; 288 justify-content: space-between;
254 } 289 }
255 .reportItem { 290
291 .reportItem {
256 background: #fff; 292 background: #fff;
257 border-radius: 15rpx; 293 border-radius: 15rpx;
258 width: 340rpx; 294 width: 340rpx;
259 margin-top: 25rpx; 295 margin-top: 25rpx;
296
260 .t { 297 .t {
261 border-bottom: 1px solid #e5e5e5; 298 border-bottom: 1px solid #e5e5e5;
262 height: 70rpx; 299 height: 70rpx;
...@@ -265,15 +302,18 @@ function building() { ...@@ -265,15 +302,18 @@ function building() {
265 font-size: 30rpx; 302 font-size: 30rpx;
266 padding-left: 36rpx; 303 padding-left: 36rpx;
267 } 304 }
305
268 .rbody { 306 .rbody {
269 display: flex; 307 display: flex;
270 padding: 36rpx; 308 padding: 36rpx;
271 box-sizing: border-box; 309 box-sizing: border-box;
310
272 view { 311 view {
273 font-size: 26rpx; 312 font-size: 26rpx;
274 color: #888; 313 color: #888;
275 width: 40%; 314 width: 40%;
276 } 315 }
316
277 text { 317 text {
278 color: #00c176; 318 color: #00c176;
279 font-weight: bold; 319 font-weight: bold;
...@@ -282,15 +322,18 @@ function building() { ...@@ -282,15 +322,18 @@ function building() {
282 margin-bottom: 20rpx; 322 margin-bottom: 20rpx;
283 } 323 }
284 } 324 }
285 } 325 }
286 .changephonepop { 326
327 .changephonepop {
287 width: 100%; 328 width: 100%;
288 } 329 }
289 .changephonepop view { 330
331 .changephonepop view {
290 width: 100%; 332 width: 100%;
291 margin: 0 0 30rpx; 333 margin: 0 0 30rpx;
292 } 334 }
293 .changephonepop view input { 335
336 .changephonepop view input {
294 width: 100%; 337 width: 100%;
295 background: #f4f4f4; 338 background: #f4f4f4;
296 font-size: 30rpx; 339 font-size: 30rpx;
...@@ -298,11 +341,13 @@ function building() { ...@@ -298,11 +341,13 @@ function building() {
298 padding: 0 15rpx; 341 padding: 0 15rpx;
299 box-sizing: border-box; 342 box-sizing: border-box;
300 line-height: 80rpx; 343 line-height: 80rpx;
301 } 344 }
302 .changephonepop view.ffff { 345
346 .changephonepop view.ffff {
303 display: flex; 347 display: flex;
304 } 348 }
305 .changephonepop view button { 349
350 .changephonepop view button {
306 font-size: 24rpx; 351 font-size: 24rpx;
307 margin-left: 10rpx; 352 margin-left: 10rpx;
308 white-space: nowrap; 353 white-space: nowrap;
...@@ -312,5 +357,5 @@ function building() { ...@@ -312,5 +357,5 @@ function building() {
312 color: #fff; 357 color: #fff;
313 padding: 0; 358 padding: 0;
314 border: none; 359 border: none;
315 } 360 }
316 </style> 361 </style>
...\ No newline at end of file ...\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!