...
|
...
|
@@ -8,25 +8,35 @@ |
8
|
8
|
<view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30">
|
9
|
9
|
<block v-if="userInfo.isToken || userInfo.isThirdLogin">
|
10
|
10
|
<view @click.top="openPersonalInfo" class="u-m-r-20">
|
11
|
|
- <image class="avatar" mode="aspectFill" :src="userInfo.avatar || thirdObj.avatarUrl || '../../static/logo.png'"></image>
|
|
11
|
+ <image class="avatar" mode="aspectFill"
|
|
12
|
+ :src="userInfo.avatar || thirdObj.avatarUrl || '../../static/logo.png'"></image>
|
12
|
13
|
</view>
|
13
|
14
|
<view class="u-flex-1" @click.top="openPersonalInfo">
|
14
|
15
|
<view class="nickName u-flex">
|
15
|
16
|
<view class="name u-m-r-10" v-if="userInfo.realName || userInfo.nickName">
|
16
|
|
- <text style="#FFFFFF;font-size: 18px;">{{ userInfo.realName || userInfo.nickName }}</text>
|
|
17
|
+ <text
|
|
18
|
+ style="#FFFFFF;font-size: 18px;">{{ userInfo.realName || userInfo.nickName }}</text>
|
17
|
19
|
</view>
|
18
|
|
- <view v-if="userInfo.isThirdLogin" @click.stop="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view>
|
|
20
|
+ <view v-if="userInfo.isThirdLogin" @click.stop="clickAccountFunc" class="detail"><text
|
|
21
|
+ class="text">绑定账号</text></view>
|
19
|
22
|
</view>
|
20
|
|
- <view style="color: #ffffff; font-size: 14px" v-if="userInfo.phoneNumber">{{ handlePhoneFunc(userInfo.phoneNumber || '') }}</view>
|
|
23
|
+ <view style="color: #ffffff; font-size: 14px" v-if="userInfo.phoneNumber">
|
|
24
|
+ {{ handlePhoneFunc(userInfo.phoneNumber || '') }}</view>
|
21
|
25
|
</view>
|
22
|
26
|
</block>
|
23
|
27
|
<block v-else>
|
24
|
28
|
<view class="u-m-r-20" @click="openLoginFunc">
|
25
|
|
- <view class="avatar u-flex"><image class="avatar" mode="aspectFill" src="../../static/logo.png"></image></view>
|
|
29
|
+ <view class="avatar u-flex">
|
|
30
|
+ <image class="avatar" mode="aspectFill" src="../../static/logo.png"></image>
|
|
31
|
+ </view>
|
|
32
|
+ </view>
|
|
33
|
+ <view class="u-flex-1">
|
|
34
|
+ <view @click="openLoginFunc" class="u-font-lg click-login login-btn">请点击登录</view>
|
26
|
35
|
</view>
|
27
|
|
- <view class="u-flex-1"><view @click="openLoginFunc" class="u-font-lg click-login login-btn">请点击登录</view></view>
|
28
|
36
|
</block>
|
29
|
|
- <view v-if="userInfo.isToken" @click="openPersonalInfo"><u-icon name="arrow-right" color="white" size="13"></u-icon></view>
|
|
37
|
+ <view v-if="userInfo.isToken" @click="openPersonalInfo">
|
|
38
|
+ <u-icon name="arrow-right" color="white" size="13"></u-icon>
|
|
39
|
+ </view>
|
30
|
40
|
</view>
|
31
|
41
|
<!-- 登录 -->
|
32
|
42
|
<!-- #endif -->
|
...
|
...
|
@@ -34,14 +44,22 @@ |
34
|
44
|
<view class="u-flex my-nav">
|
35
|
45
|
<view class="nav-main">
|
36
|
46
|
<view @click="onTokenJump('/sysNotifySubPage/sysNotifyPage/systemNotify')" class="u-flex nav-link">
|
37
|
|
- <view class="nav-image"><image class="image" src="../../static/sys-not.png"></image></view>
|
|
47
|
+ <view class="nav-image">
|
|
48
|
+ <image class="image" src="../../static/sys-not.png"></image>
|
|
49
|
+ </view>
|
38
|
50
|
<view class="nav-center"><text class="text">系统通知</text></view>
|
39
|
|
- <view class="nav-right"><image class="image" src="../../static/arrow-right.png"></image></view>
|
|
51
|
+ <view class="nav-right">
|
|
52
|
+ <image class="image" src="../../static/arrow-right.png"></image>
|
|
53
|
+ </view>
|
40
|
54
|
</view>
|
41
|
55
|
<view @click="onTokenJump('/feedBackSubPage/feedback/feedback')" class="u-flex nav-link">
|
42
|
|
- <view class="nav-image"><image class="image" src="../../static/find-sugg.png"></image></view>
|
|
56
|
+ <view class="nav-image">
|
|
57
|
+ <image class="image" src="../../static/find-sugg.png"></image>
|
|
58
|
+ </view>
|
43
|
59
|
<view class="nav-center"><text class="text">意见反馈</text></view>
|
44
|
|
- <view class="nav-right"><image class="image" src="../../static/arrow-right.png"></image></view>
|
|
60
|
+ <view class="nav-right">
|
|
61
|
+ <image class="image" src="../../static/arrow-right.png"></image>
|
|
62
|
+ </view>
|
45
|
63
|
</view>
|
46
|
64
|
</view>
|
47
|
65
|
<view @click="onLoginoutFunc" class="u-flex" style="justify-content: center; width: 600rpx">
|
...
|
...
|
@@ -53,18 +71,12 @@ |
53
|
71
|
<u-modal :showConfirmButton="false" :show="show" :title="title">
|
54
|
72
|
<view v-if="!bindPhone" class="loginPhone">
|
55
|
73
|
<view class="form-row">
|
56
|
|
- <u--input shape="circle" class="input" prefixIcon="account-fill" type="text" placeholder="登录账号" v-model="bindAccountObj.appUserKey"></u--input>
|
|
74
|
+ <u--input shape="circle" class="input" prefixIcon="account-fill" type="text" placeholder="登录账号"
|
|
75
|
+ v-model="bindAccountObj.appUserKey"></u--input>
|
57
|
76
|
</view>
|
58
|
77
|
<view class="form-row item-bind">
|
59
|
|
- <u--input
|
60
|
|
- class="input"
|
61
|
|
- shape="circle"
|
62
|
|
- prefixIcon="lock-fill"
|
63
|
|
- suffixIconStyle="color: #909399"
|
64
|
|
- type="password"
|
65
|
|
- placeholder="登录密码"
|
66
|
|
- v-model="bindAccountObj.appUserSecret"
|
67
|
|
- ></u--input>
|
|
78
|
+ <u--input class="input" shape="circle" prefixIcon="lock-fill" suffixIconStyle="color: #909399"
|
|
79
|
+ type="password" placeholder="登录密码" v-model="bindAccountObj.appUserSecret"></u--input>
|
68
|
80
|
</view>
|
69
|
81
|
<view class="u-flex item-phone">
|
70
|
82
|
<view class="phone-hide">手机验证码登录</view>
|
...
|
...
|
@@ -73,25 +85,14 @@ |
73
|
85
|
</view>
|
74
|
86
|
<view v-else class="loginPhone">
|
75
|
87
|
<view class="form-row">
|
76
|
|
- <u--input
|
77
|
|
- shape="circle"
|
78
|
|
- class="input"
|
79
|
|
- type="text"
|
80
|
|
- v-model="bindPhoneObj.appUserKey"
|
81
|
|
- placeholder="请输入手机号码"
|
82
|
|
- placeholder-style="font-weight:normal;color:#bbbbbb;"
|
83
|
|
- ></u--input>
|
|
88
|
+ <u--input shape="circle" class="input" type="text" v-model="bindPhoneObj.appUserKey"
|
|
89
|
+ placeholder="请输入手机号码" placeholder-style="font-weight:normal;color:#bbbbbb;"></u--input>
|
84
|
90
|
</view>
|
85
|
91
|
<view class="form-row row-top">
|
86
|
|
- <u--input
|
87
|
|
- shape="circle"
|
88
|
|
- class="input"
|
89
|
|
- type="text"
|
90
|
|
- v-model="bindPhoneObj.appUserSecret"
|
91
|
|
- placeholder="请输入验证码"
|
92
|
|
- placeholder-style="font-weight:normal;color:#bbbbbb;"
|
93
|
|
- ></u--input>
|
94
|
|
- <view style="color: #377dff" class="getvcode" :class="{ forhidden: readonly }" @click="getVcode">{{ codeText }}</view>
|
|
92
|
+ <u--input shape="circle" class="input" type="text" v-model="bindPhoneObj.appUserSecret"
|
|
93
|
+ placeholder="请输入验证码" placeholder-style="font-weight:normal;color:#bbbbbb;"></u--input>
|
|
94
|
+ <view style="color: #377dff" class="getvcode" :class="{ forhidden: readonly }"
|
|
95
|
+ @click="getVcode">{{ codeText }}</view>
|
95
|
96
|
</view>
|
96
|
97
|
<view class="u-flex item-phone">
|
97
|
98
|
<view class="phone-hide">手机验证码登录</view>
|
...
|
...
|
@@ -100,8 +101,12 @@ |
100
|
101
|
</view>
|
101
|
102
|
<view class="bottom-content">
|
102
|
103
|
<view class="u-flex content">
|
103
|
|
- <view class="cancel"><u-button @click="show = false" type="info" shape="circle" text="取消"></u-button></view>
|
104
|
|
- <view class="confrim"><u-button @click="bindConfirm" type="primary" shape="circle" text="确认"></u-button></view>
|
|
104
|
+ <view class="cancel">
|
|
105
|
+ <u-button @click="show = false" type="info" shape="circle" text="取消"></u-button>
|
|
106
|
+ </view>
|
|
107
|
+ <view class="confrim">
|
|
108
|
+ <u-button @click="bindConfirm" type="primary" shape="circle" text="确认"></u-button>
|
|
109
|
+ </view>
|
105
|
110
|
</view>
|
106
|
111
|
</view>
|
107
|
112
|
</u-modal>
|
...
|
...
|
@@ -122,145 +127,215 @@ |
122
|
127
|
</template>
|
123
|
128
|
|
124
|
129
|
<script>
|
125
|
|
-var clear;
|
126
|
|
-import base from '@/config/baseUrl';
|
127
|
|
-import fTabbar from '@/components/module/f-tabbar/f-tabbar';
|
128
|
|
-import fNavbar from '@/components/module/f-navbar/f-navbar';
|
129
|
|
-import { mapState, mapMutations } from 'vuex';
|
|
130
|
+ var clear;
|
|
131
|
+ import base from '@/config/baseUrl';
|
|
132
|
+ import fTabbar from '@/components/module/f-tabbar/f-tabbar';
|
|
133
|
+ import fNavbar from '@/components/module/f-navbar/f-navbar';
|
|
134
|
+ import {
|
|
135
|
+ mapState,
|
|
136
|
+ mapMutations
|
|
137
|
+ } from 'vuex';
|
130
|
138
|
|
131
|
|
-export default {
|
132
|
|
- components: {
|
133
|
|
- fTabbar,
|
134
|
|
- fNavbar
|
135
|
|
- },
|
136
|
|
- data() {
|
137
|
|
- return {
|
138
|
|
- PrimaryColor: '#0079fe', //主题色
|
139
|
|
- showLogout: false,
|
140
|
|
- readonly: false,
|
141
|
|
- codeText: '获取验证码',
|
142
|
|
- tips: '验证码',
|
143
|
|
- bindPhone: false,
|
144
|
|
- show: false,
|
145
|
|
- title: '绑定账号',
|
146
|
|
- systemInfo: base.systemInfo,
|
147
|
|
- PrimaryButtonColor: '#0079fe', //主题色
|
148
|
|
- bindAccountObj: {
|
149
|
|
- appUserKey: '',
|
150
|
|
- appUserSecret: ''
|
151
|
|
- },
|
152
|
|
- bindPhoneObj: {
|
153
|
|
- appUserKey: '',
|
154
|
|
- appUserSecret: ''
|
155
|
|
- },
|
156
|
|
- thirdObj: {},
|
157
|
|
- getOpenId: '',
|
158
|
|
- mpOwnConfig: {}
|
159
|
|
- };
|
160
|
|
- },
|
161
|
|
- mounted() {
|
162
|
|
- this.getPlateForm();
|
163
|
|
- },
|
164
|
|
- onLoad(e) {
|
165
|
|
- // 隐藏原生的tabbar
|
166
|
|
- uni.hideTabBar();
|
167
|
|
- // if (e.obj != null) {
|
168
|
|
- // const params = JSON.parse(decodeURIComponent(e.obj));
|
169
|
|
- // // uni.$u.toast('eee', params.avatarUrl);
|
170
|
|
- // this.thirdObj = params;
|
171
|
|
- // }
|
172
|
|
- this.getOpenId = getApp().globalData.openId;
|
173
|
|
- },
|
174
|
|
- computed: {
|
175
|
|
- ...mapState(['userInfo', 'plateInfo'])
|
176
|
|
- },
|
177
|
|
- methods: {
|
178
|
|
- //获取平台定制信息
|
179
|
|
- getPlateForm() {
|
180
|
|
- uni.$u.http.get('/yt/app_design/get').then(res => {
|
181
|
|
- if (res) {
|
182
|
|
- this.mpOwnConfig = {
|
183
|
|
- bg: res.background,
|
184
|
|
- logo: res.logo,
|
185
|
|
- name: res.name
|
186
|
|
- };
|
187
|
|
- }
|
188
|
|
- });
|
189
|
|
- },
|
190
|
|
- handlePhoneFunc(e) {
|
191
|
|
- //前三后四位显示
|
192
|
|
- const result = /^(\d{3})\d{4}(\d{4})$/;
|
193
|
|
- const y = e.toString().replace(result, '$1****$2');
|
194
|
|
- return y;
|
195
|
|
- },
|
196
|
|
- ...mapMutations(['emptyUserInfo', 'setUserInfo', 'setPlateInfo']),
|
197
|
|
- // 跳转前判断登录
|
198
|
|
- onTokenJump(url) {
|
199
|
|
- this.judgeLogin(r => {
|
200
|
|
- uni.navigateTo({
|
201
|
|
- url: url
|
202
|
|
- });
|
203
|
|
- });
|
204
|
|
- },
|
205
|
|
- onJump(url) {
|
206
|
|
- uni.navigateTo({
|
207
|
|
- url: url
|
208
|
|
- });
|
209
|
|
- },
|
210
|
|
- openLoginFunc() {
|
211
|
|
- uni.navigateTo({
|
212
|
|
- url: '/publicLoginSubPage/public/login'
|
213
|
|
- });
|
|
139
|
+ export default {
|
|
140
|
+ components: {
|
|
141
|
+ fTabbar,
|
|
142
|
+ fNavbar
|
214
|
143
|
},
|
215
|
|
- openPersonalInfo() {
|
216
|
|
- let obj = {
|
217
|
|
- data: this.userInfo,
|
218
|
|
- third: this.thirdObj
|
|
144
|
+ data() {
|
|
145
|
+ return {
|
|
146
|
+ PrimaryColor: '#0079fe', //主题色
|
|
147
|
+ showLogout: false,
|
|
148
|
+ readonly: false,
|
|
149
|
+ codeText: '获取验证码',
|
|
150
|
+ tips: '验证码',
|
|
151
|
+ bindPhone: false,
|
|
152
|
+ show: false,
|
|
153
|
+ title: '绑定账号',
|
|
154
|
+ systemInfo: base.systemInfo,
|
|
155
|
+ PrimaryButtonColor: '#0079fe', //主题色
|
|
156
|
+ bindAccountObj: {
|
|
157
|
+ appUserKey: '',
|
|
158
|
+ appUserSecret: ''
|
|
159
|
+ },
|
|
160
|
+ bindPhoneObj: {
|
|
161
|
+ appUserKey: '',
|
|
162
|
+ appUserSecret: ''
|
|
163
|
+ },
|
|
164
|
+ thirdObj: {},
|
|
165
|
+ getOpenId: '',
|
|
166
|
+ mpOwnConfig: {}
|
219
|
167
|
};
|
220
|
|
- uni.navigateTo({
|
221
|
|
- url: '/publicLoginSubPage/other/set?data=' + JSON.stringify(obj)
|
222
|
|
- });
|
223
|
168
|
},
|
224
|
|
- clickAccountFunc() {
|
225
|
|
- this.show = true;
|
226
|
|
- this.resetFunc();
|
|
169
|
+ mounted() {
|
|
170
|
+ this.getPlateForm();
|
227
|
171
|
},
|
228
|
|
- resetFunc() {
|
229
|
|
- this.bindPhone = false;
|
230
|
|
- this.bindAccountObj = {};
|
231
|
|
- this.bindPhoneObj = {};
|
|
172
|
+ onLoad(e) {
|
|
173
|
+ // 隐藏原生的tabbar
|
|
174
|
+ uni.hideTabBar();
|
|
175
|
+ // if (e.obj != null) {
|
|
176
|
+ // const params = JSON.parse(decodeURIComponent(e.obj));
|
|
177
|
+ // // uni.$u.toast('eee', params.avatarUrl);
|
|
178
|
+ // this.thirdObj = params;
|
|
179
|
+ // }
|
|
180
|
+ this.getOpenId = getApp().globalData.openId;
|
232
|
181
|
},
|
233
|
|
- bindConfirm() {
|
234
|
|
- //需要绑定
|
235
|
|
- if (!this.bindPhone) {
|
236
|
|
- if (this.bindAccountObj.appUserKey == '' || this.bindAccountObj.appUserKey == undefined) {
|
237
|
|
- return uni.$u.toast('请输入登录账号~');
|
238
|
|
- }
|
239
|
|
- const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/;
|
240
|
|
- if (this.bindAccountObj.appUserSecret == '') {
|
241
|
|
- uni.showToast({
|
242
|
|
- title: '请输入登录密码~',
|
243
|
|
- icon: 'none'
|
244
|
|
- });
|
245
|
|
- return;
|
246
|
|
- } else if (!passReg.test(this.bindAccountObj.appUserSecret)) {
|
247
|
|
- uni.showModal({
|
248
|
|
- title: '提示',
|
249
|
|
- content: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~',
|
250
|
|
- showCancel: false
|
|
182
|
+ computed: {
|
|
183
|
+ ...mapState(['userInfo', 'plateInfo'])
|
|
184
|
+ },
|
|
185
|
+ methods: {
|
|
186
|
+ //获取平台定制信息
|
|
187
|
+ getPlateForm() {
|
|
188
|
+ uni.$u.http.get('/yt/app_design/get').then(res => {
|
|
189
|
+ if (res) {
|
|
190
|
+ this.mpOwnConfig = {
|
|
191
|
+ bg: res.background,
|
|
192
|
+ logo: res.logo,
|
|
193
|
+ name: res.name
|
|
194
|
+ };
|
|
195
|
+ }
|
|
196
|
+ });
|
|
197
|
+ },
|
|
198
|
+ handlePhoneFunc(e) {
|
|
199
|
+ //前三后四位显示
|
|
200
|
+ const result = /^(\d{3})\d{4}(\d{4})$/;
|
|
201
|
+ const y = e.toString().replace(result, '$1****$2');
|
|
202
|
+ return y;
|
|
203
|
+ },
|
|
204
|
+ ...mapMutations(['emptyUserInfo', 'setUserInfo', 'setPlateInfo']),
|
|
205
|
+ // 跳转前判断登录
|
|
206
|
+ onTokenJump(url) {
|
|
207
|
+ this.judgeLogin(() => {
|
|
208
|
+ uni.navigateTo({
|
|
209
|
+ url: url
|
251
|
210
|
});
|
252
|
|
- return;
|
253
|
|
- }
|
254
|
|
- const postData = {
|
255
|
|
- loginMethod: 'ACCOUNT',
|
256
|
|
- ...this.bindAccountObj,
|
257
|
|
- platformName: 'WECHAT',
|
258
|
|
- thirdUserId: this.getOpenId
|
259
|
|
- };
|
260
|
|
- uni.$u.http
|
261
|
|
- .post('/yt/third/bind', postData)
|
262
|
|
- .then(res => {
|
263
|
|
- if (res) {
|
|
211
|
+ });
|
|
212
|
+ },
|
|
213
|
+ onJump(url) {
|
|
214
|
+ uni.navigateTo({
|
|
215
|
+ url: url
|
|
216
|
+ });
|
|
217
|
+ },
|
|
218
|
+ openLoginFunc() {
|
|
219
|
+ uni.navigateTo({
|
|
220
|
+ url: '/publicLoginSubPage/public/login'
|
|
221
|
+ });
|
|
222
|
+ },
|
|
223
|
+ openPersonalInfo() {
|
|
224
|
+ let obj = {
|
|
225
|
+ data: this.userInfo,
|
|
226
|
+ third: this.thirdObj
|
|
227
|
+ };
|
|
228
|
+ uni.navigateTo({
|
|
229
|
+ url: '/publicLoginSubPage/other/set?data=' + JSON.stringify(obj)
|
|
230
|
+ });
|
|
231
|
+ },
|
|
232
|
+ clickAccountFunc() {
|
|
233
|
+ this.show = true;
|
|
234
|
+ this.resetFunc();
|
|
235
|
+ },
|
|
236
|
+ resetFunc() {
|
|
237
|
+ this.bindPhone = false;
|
|
238
|
+ this.bindAccountObj = {};
|
|
239
|
+ this.bindPhoneObj = {};
|
|
240
|
+ },
|
|
241
|
+ bindConfirm() {
|
|
242
|
+ //需要绑定
|
|
243
|
+ if (!this.bindPhone) {
|
|
244
|
+ if (this.bindAccountObj.appUserKey == '' || this.bindAccountObj.appUserKey == undefined) {
|
|
245
|
+ return uni.$u.toast('请输入登录账号~');
|
|
246
|
+ }
|
|
247
|
+ const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/;
|
|
248
|
+ if (this.bindAccountObj.appUserSecret == '') {
|
|
249
|
+ uni.showToast({
|
|
250
|
+ title: '请输入登录密码~',
|
|
251
|
+ icon: 'none'
|
|
252
|
+ });
|
|
253
|
+ return;
|
|
254
|
+ } else if (!passReg.test(this.bindAccountObj.appUserSecret)) {
|
|
255
|
+ uni.showModal({
|
|
256
|
+ title: '提示',
|
|
257
|
+ content: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~',
|
|
258
|
+ showCancel: false
|
|
259
|
+ });
|
|
260
|
+ return;
|
|
261
|
+ }
|
|
262
|
+ const postData = {
|
|
263
|
+ loginMethod: 'ACCOUNT',
|
|
264
|
+ ...this.bindAccountObj,
|
|
265
|
+ platformName: 'WECHAT',
|
|
266
|
+ thirdUserId: this.getOpenId
|
|
267
|
+ };
|
|
268
|
+ uni.$u.http
|
|
269
|
+ .post('/yt/third/bind', postData)
|
|
270
|
+ .then(res => {
|
|
271
|
+ if (res) {
|
|
272
|
+ this.show = false;
|
|
273
|
+ // 储存登录信息
|
|
274
|
+ let resObj = {
|
|
275
|
+ refreshToken: res.refreshToken,
|
|
276
|
+ isToken: res.token
|
|
277
|
+ };
|
|
278
|
+ let userInfo = {
|
|
279
|
+ ...resObj,
|
|
280
|
+ token: true, //token用于判断是否登录
|
|
281
|
+ isThirdLogin: false,
|
|
282
|
+ isThirdLoginAndNoDind: true
|
|
283
|
+ };
|
|
284
|
+ if (userInfo.token) {
|
|
285
|
+ this.setUserInfo(userInfo);
|
|
286
|
+ }
|
|
287
|
+ uni.showToast({
|
|
288
|
+ title: '账号绑定成功~',
|
|
289
|
+ icon: 'none'
|
|
290
|
+ });
|
|
291
|
+ this.saveUserInfo();
|
|
292
|
+ }
|
|
293
|
+ })
|
|
294
|
+ .catch(e => {
|
|
295
|
+ let msg = e.message || e.data?.message;
|
|
296
|
+ // if (msg == undefined) {
|
|
297
|
+ // msg = '';
|
|
298
|
+ // }
|
|
299
|
+ if (msg) uni.$u.toast(msg);
|
|
300
|
+ this.show = true;
|
|
301
|
+ });
|
|
302
|
+ } else {
|
|
303
|
+ const phoneRegular = /^1\d{10}$/;
|
|
304
|
+ if (this.bindPhoneObj.appUserKey == '') {
|
|
305
|
+ uni.showToast({
|
|
306
|
+ title: '请输入手机号码~',
|
|
307
|
+ icon: 'none'
|
|
308
|
+ });
|
|
309
|
+ return;
|
|
310
|
+ } else if (!phoneRegular.test(this.bindPhoneObj.appUserKey)) {
|
|
311
|
+ uni.showToast({
|
|
312
|
+ title: '手机号格式不正确~',
|
|
313
|
+ icon: 'none'
|
|
314
|
+ });
|
|
315
|
+ return;
|
|
316
|
+ }
|
|
317
|
+ if (this.bindPhoneObj.appUserSecret == '') {
|
|
318
|
+ uni.showToast({
|
|
319
|
+ title: '请输入验证码~',
|
|
320
|
+ icon: 'none'
|
|
321
|
+ });
|
|
322
|
+ return;
|
|
323
|
+ } else if (!/^\d{6}$/.test(this.bindPhoneObj.appUserSecret)) {
|
|
324
|
+ uni.showToast({
|
|
325
|
+ title: '验证码格式不正确~',
|
|
326
|
+ icon: 'none'
|
|
327
|
+ });
|
|
328
|
+ return;
|
|
329
|
+ }
|
|
330
|
+ const postData = {
|
|
331
|
+ loginMethod: 'PHONE',
|
|
332
|
+ ...this.bindPhoneObj,
|
|
333
|
+ platformName: 'WECHAT',
|
|
334
|
+ thirdUserId: this.getOpenId
|
|
335
|
+ };
|
|
336
|
+ uni.$u.http
|
|
337
|
+ .post('/yt/third/bind', postData)
|
|
338
|
+ .then(res => {
|
264
|
339
|
this.show = false;
|
265
|
340
|
// 储存登录信息
|
266
|
341
|
let resObj = {
|
...
|
...
|
@@ -277,185 +352,116 @@ export default { |
277
|
352
|
this.setUserInfo(userInfo);
|
278
|
353
|
}
|
279
|
354
|
uni.showToast({
|
280
|
|
- title: '账号绑定成功~',
|
|
355
|
+ title: '手机绑定成功~',
|
281
|
356
|
icon: 'none'
|
282
|
357
|
});
|
283
|
358
|
this.saveUserInfo();
|
284
|
|
- }
|
285
|
|
- })
|
286
|
|
- .catch(e => {
|
287
|
|
- let msg = e.data?.message;
|
288
|
|
- if (msg == undefined) {
|
289
|
|
- msg = '';
|
290
|
|
- }
|
291
|
|
- uni.$u.toast(msg);
|
292
|
|
- this.show = true;
|
293
|
|
- });
|
294
|
|
- } else {
|
295
|
|
- const phoneRegular = /^1\d{10}$/;
|
296
|
|
- if (this.bindPhoneObj.appUserKey == '') {
|
297
|
|
- uni.showToast({
|
298
|
|
- title: '请输入手机号码~',
|
299
|
|
- icon: 'none'
|
300
|
|
- });
|
301
|
|
- return;
|
302
|
|
- } else if (!phoneRegular.test(this.bindPhoneObj.appUserKey)) {
|
|
359
|
+ })
|
|
360
|
+ .catch(e => {
|
|
361
|
+ let msg = e.message || e.data?.message;
|
|
362
|
+ // msg = '';
|
|
363
|
+ // }
|
|
364
|
+ if (msg) uni.$u.toast(msg);
|
|
365
|
+ this.show = true;
|
|
366
|
+ });
|
|
367
|
+ }
|
|
368
|
+ },
|
|
369
|
+ saveUserInfo() {
|
|
370
|
+ //储存个人信息
|
|
371
|
+ uni.$u.http.get('/yt/user/me/info').then(res => {
|
|
372
|
+ if (res) {
|
|
373
|
+ this.setUserInfo(res);
|
|
374
|
+ }
|
|
375
|
+ });
|
|
376
|
+ //储存平台信息
|
|
377
|
+ uni.$u.http.get('/yt/platform/get').then(res => {
|
|
378
|
+ if (res) {
|
|
379
|
+ this.setPlateInfo(res);
|
|
380
|
+ }
|
|
381
|
+ });
|
|
382
|
+ },
|
|
383
|
+ bindPhoneFunc() {
|
|
384
|
+ this.bindPhone = true;
|
|
385
|
+ },
|
|
386
|
+ bindAccountFunc() {
|
|
387
|
+ this.bindPhone = false;
|
|
388
|
+ },
|
|
389
|
+ //验证码按钮文字状态
|
|
390
|
+ getCodeState() {
|
|
391
|
+ const _this = this;
|
|
392
|
+ this.readonly = true;
|
|
393
|
+ this.codeText = '60S后重新获取';
|
|
394
|
+ var s = 60;
|
|
395
|
+ clear = setInterval(() => {
|
|
396
|
+ s--;
|
|
397
|
+ _this.codeText = s + 'S后重新获取';
|
|
398
|
+ if (s <= 0) {
|
|
399
|
+ clearInterval(clear);
|
|
400
|
+ _this.codeText = '获取验证码';
|
|
401
|
+ _this.readonly = false;
|
|
402
|
+ }
|
|
403
|
+ }, 1000);
|
|
404
|
+ },
|
|
405
|
+ //获取验证码
|
|
406
|
+ getVcode() {
|
|
407
|
+ if (this.readonly) {
|
303
|
408
|
uni.showToast({
|
304
|
|
- title: '手机号格式不正确~',
|
|
409
|
+ title: '验证码已发送~',
|
305
|
410
|
icon: 'none'
|
306
|
411
|
});
|
307
|
412
|
return;
|
308
|
413
|
}
|
309
|
|
- if (this.bindPhoneObj.appUserSecret == '') {
|
|
414
|
+ if (this.bindPhoneObj.appUserKey == '') {
|
310
|
415
|
uni.showToast({
|
311
|
|
- title: '请输入验证码~',
|
|
416
|
+ title: '请输入手机号~',
|
312
|
417
|
icon: 'none'
|
313
|
418
|
});
|
314
|
419
|
return;
|
315
|
|
- } else if (!/^\d{6}$/.test(this.bindPhoneObj.appUserSecret)) {
|
|
420
|
+ }
|
|
421
|
+ const phoneRegular = /^1\d{10}$/;
|
|
422
|
+ if (!phoneRegular.test(this.bindPhoneObj.appUserKey)) {
|
316
|
423
|
uni.showToast({
|
317
|
|
- title: '验证码格式不正确~',
|
|
424
|
+ title: '手机号格式不正确~',
|
318
|
425
|
icon: 'none'
|
319
|
426
|
});
|
320
|
427
|
return;
|
321
|
428
|
}
|
322
|
|
- const postData = {
|
323
|
|
- loginMethod: 'PHONE',
|
324
|
|
- ...this.bindPhoneObj,
|
325
|
|
- platformName: 'WECHAT',
|
326
|
|
- thirdUserId: this.getOpenId
|
327
|
|
- };
|
328
|
|
- uni.$u.http
|
329
|
|
- .post('/yt/third/bind', postData)
|
330
|
|
- .then(res => {
|
331
|
|
- this.show = false;
|
332
|
|
- // 储存登录信息
|
333
|
|
- let resObj = {
|
334
|
|
- refreshToken: res.refreshToken,
|
335
|
|
- isToken: res.token
|
336
|
|
- };
|
337
|
|
- let userInfo = {
|
338
|
|
- ...resObj,
|
339
|
|
- token: true, //token用于判断是否登录
|
340
|
|
- isThirdLogin: false,
|
341
|
|
- isThirdLoginAndNoDind: true
|
342
|
|
- };
|
343
|
|
- if (userInfo.token) {
|
344
|
|
- this.setUserInfo(userInfo);
|
345
|
|
- }
|
346
|
|
- uni.showToast({
|
347
|
|
- title: '手机绑定成功~',
|
348
|
|
- icon: 'none'
|
349
|
|
- });
|
350
|
|
- this.saveUserInfo();
|
351
|
|
- })
|
352
|
|
- .catch(e => {
|
353
|
|
- let msg = e.data?.msg;
|
354
|
|
- if (msg == undefined) {
|
355
|
|
- msg = '';
|
356
|
|
- }
|
357
|
|
- uni.$u.toast(msg);
|
358
|
|
- this.show = true;
|
359
|
|
- });
|
360
|
|
- }
|
361
|
|
- },
|
362
|
|
- saveUserInfo() {
|
363
|
|
- //储存个人信息
|
364
|
|
- uni.$u.http.get('/yt/user/me/info').then(res => {
|
365
|
|
- if (res) {
|
366
|
|
- this.setUserInfo(res);
|
367
|
|
- }
|
368
|
|
- });
|
369
|
|
- //储存平台信息
|
370
|
|
- uni.$u.http.get('/yt/platform/get').then(res => {
|
371
|
|
- if (res) {
|
372
|
|
- this.setPlateInfo(res);
|
373
|
|
- }
|
374
|
|
- });
|
375
|
|
- },
|
376
|
|
- bindPhoneFunc() {
|
377
|
|
- this.bindPhone = true;
|
378
|
|
- },
|
379
|
|
- bindAccountFunc() {
|
380
|
|
- this.bindPhone = false;
|
381
|
|
- },
|
382
|
|
- //验证码按钮文字状态
|
383
|
|
- getCodeState() {
|
384
|
|
- const _this = this;
|
385
|
|
- this.readonly = true;
|
386
|
|
- this.codeText = '60S后重新获取';
|
387
|
|
- var s = 60;
|
388
|
|
- clear = setInterval(() => {
|
389
|
|
- s--;
|
390
|
|
- _this.codeText = s + 'S后重新获取';
|
391
|
|
- if (s <= 0) {
|
392
|
|
- clearInterval(clear);
|
393
|
|
- _this.codeText = '获取验证码';
|
394
|
|
- _this.readonly = false;
|
395
|
|
- }
|
396
|
|
- }, 1000);
|
397
|
|
- },
|
398
|
|
- //获取验证码
|
399
|
|
- getVcode() {
|
400
|
|
- if (this.readonly) {
|
401
|
|
- uni.showToast({
|
402
|
|
- title: '验证码已发送~',
|
403
|
|
- icon: 'none'
|
404
|
|
- });
|
405
|
|
- return;
|
406
|
|
- }
|
407
|
|
- if (this.bindPhoneObj.appUserKey == '') {
|
408
|
|
- uni.showToast({
|
409
|
|
- title: '请输入手机号~',
|
410
|
|
- icon: 'none'
|
|
429
|
+ let httpData = {};
|
|
430
|
+ // 获取验证码接口
|
|
431
|
+ uni.$u.http.post(`/yt/noauth/send_login_code/${this.bindPhoneObj.appUserKey}`).then(res => {
|
|
432
|
+ if (res) {
|
|
433
|
+ this.getCodeState(); //开始倒计时
|
|
434
|
+ }
|
411
|
435
|
});
|
412
|
|
- return;
|
413
|
|
- }
|
414
|
|
- const phoneRegular = /^1\d{10}$/;
|
415
|
|
- if (!phoneRegular.test(this.bindPhoneObj.appUserKey)) {
|
416
|
|
- uni.showToast({
|
417
|
|
- title: '手机号格式不正确~',
|
418
|
|
- icon: 'none'
|
|
436
|
+ },
|
|
437
|
+ onLoginoutFunc() {
|
|
438
|
+ this.showLogout = true;
|
|
439
|
+ },
|
|
440
|
+ closeLogout() {
|
|
441
|
+ this.showLogout = false;
|
|
442
|
+ },
|
|
443
|
+ logoutBtn() {
|
|
444
|
+ let that = this;
|
|
445
|
+ uni.showModal({
|
|
446
|
+ title: '退出登录',
|
|
447
|
+ content: '你确定退出登录吗?',
|
|
448
|
+ success(res) {
|
|
449
|
+ if (res.confirm) {
|
|
450
|
+ that.emptyUserInfo();
|
|
451
|
+ that.showLogout = false;
|
|
452
|
+ setTimeout(() => {
|
|
453
|
+ uni.navigateTo({
|
|
454
|
+ url: '/publicLoginSubPage/public/login'
|
|
455
|
+ });
|
|
456
|
+ }, 500);
|
|
457
|
+ } else if (res.cancel) {}
|
|
458
|
+ }
|
419
|
459
|
});
|
420
|
|
- return;
|
421
|
460
|
}
|
422
|
|
- let httpData = {};
|
423
|
|
- // 获取验证码接口
|
424
|
|
- uni.$u.http.post(`/yt/noauth/send_login_code/${this.bindPhoneObj.appUserKey}`).then(res => {
|
425
|
|
- if (res) {
|
426
|
|
- this.getCodeState(); //开始倒计时
|
427
|
|
- }
|
428
|
|
- });
|
429
|
|
- },
|
430
|
|
- onLoginoutFunc() {
|
431
|
|
- this.showLogout = true;
|
432
|
|
- },
|
433
|
|
- closeLogout() {
|
434
|
|
- this.showLogout = false;
|
435
|
|
- },
|
436
|
|
- logoutBtn() {
|
437
|
|
- let that = this;
|
438
|
|
- uni.showModal({
|
439
|
|
- title: '退出登录',
|
440
|
|
- content: '你确定退出登录吗?',
|
441
|
|
- success(res) {
|
442
|
|
- if (res.confirm) {
|
443
|
|
- that.emptyUserInfo();
|
444
|
|
- that.showLogout = false;
|
445
|
|
- setTimeout(() => {
|
446
|
|
- uni.navigateTo({
|
447
|
|
- url: '/publicLoginSubPage/public/login'
|
448
|
|
- });
|
449
|
|
- }, 500);
|
450
|
|
- } else if (res.cancel) {
|
451
|
|
- }
|
452
|
|
- }
|
453
|
|
- });
|
454
|
461
|
}
|
455
|
|
- }
|
456
|
|
-};
|
|
462
|
+ };
|
457
|
463
|
</script>
|
458
|
464
|
|
459
|
465
|
<style lang="scss" scoped>
|
460
|
|
-@import './static/personal.scss';
|
461
|
|
-</style> |
|
466
|
+ @import './static/personal.scss';
|
|
467
|
+</style> |
...
|
...
|
|