Commit 2a3c5288a9b6354c179b0eaac5ae38f071047f04
1 parent
1ef8fed8
feat:新增第三方登录和账号绑定功能,refractor:修改意见反馈样式,fix:DEFECT-346去除通知筛选输入框
Showing
14 changed files
with
386 additions
and
110 deletions
config/WXBizDataCrypt.js
0 → 100644
1 | +var crypto = require('crypto') | ||
2 | + | ||
3 | +function WXBizDataCrypt(appId, sessionKey) { | ||
4 | + this.appId = appId | ||
5 | + this.sessionKey = sessionKey | ||
6 | +} | ||
7 | + | ||
8 | +WXBizDataCrypt.prototype.decryptData = function (encryptedData, iv) { | ||
9 | + // base64 decode | ||
10 | + var sessionKey = new Buffer(this.sessionKey, 'base64') | ||
11 | + encryptedData = new Buffer(encryptedData, 'base64') | ||
12 | + iv = new Buffer(iv, 'base64') | ||
13 | + | ||
14 | + try { | ||
15 | + // 解密 | ||
16 | + var decipher = crypto.createDecipheriv('aes-128-cbc', sessionKey, iv) | ||
17 | + // 设置自动 padding 为 true,删除填充补位 | ||
18 | + decipher.setAutoPadding(true) | ||
19 | + var decoded = decipher.update(encryptedData, 'binary', 'utf8') | ||
20 | + decoded += decipher.final('utf8') | ||
21 | + | ||
22 | + decoded = JSON.parse(decoded) | ||
23 | + | ||
24 | + } catch (err) { | ||
25 | + throw new Error('Illegal Buffer') | ||
26 | + } | ||
27 | + | ||
28 | + if (decoded.watermark.appid !== this.appId) { | ||
29 | + throw new Error('Illegal Buffer') | ||
30 | + } | ||
31 | + | ||
32 | + return decoded | ||
33 | +} | ||
34 | + | ||
35 | +module.exports = WXBizDataCrypt |
@@ -17,7 +17,7 @@ uni.$u.http.setConfig((config) => { | @@ -17,7 +17,7 @@ uni.$u.http.setConfig((config) => { | ||
17 | config.baseURL = base.baseUrl; /* 根域名 */ | 17 | config.baseURL = base.baseUrl; /* 根域名 */ |
18 | config.header = { | 18 | config.header = { |
19 | "Content-Type": "application/json", | 19 | "Content-Type": "application/json", |
20 | - Authorization: "Bearer " + token, | 20 | + 'X-Authorization': "Bearer " + token, |
21 | }; | 21 | }; |
22 | config.custom = { | 22 | config.custom = { |
23 | load: true, //是否显示加载动画 | 23 | load: true, //是否显示加载动画 |
@@ -36,7 +36,7 @@ uni.$u.http.interceptors.request.use( | @@ -36,7 +36,7 @@ uni.$u.http.interceptors.request.use( | ||
36 | config.data = config.data || {}; | 36 | config.data = config.data || {}; |
37 | // 根据custom参数中配置的是否需要token,添加对应的请求头 | 37 | // 根据custom参数中配置的是否需要token,添加对应的请求头 |
38 | if (config?.custom?.auth) { | 38 | if (config?.custom?.auth) { |
39 | - config.header.Authorization = | 39 | + config.header['X-Authorization'] = |
40 | "Bearer " + store.state.userInfo.isToken || | 40 | "Bearer " + store.state.userInfo.isToken || |
41 | uni.getStorageSync("userInfo").isToken || | 41 | uni.getStorageSync("userInfo").isToken || |
42 | undefined; | 42 | undefined; |
@@ -114,7 +114,7 @@ uni.$u.http.interceptors.response.use( | @@ -114,7 +114,7 @@ uni.$u.http.interceptors.response.use( | ||
114 | }); | 114 | }); |
115 | store.commit("emptyUserInfo"); | 115 | store.commit("emptyUserInfo"); |
116 | } else { | 116 | } else { |
117 | - errorData = message || "请检查网络或服务器"; | 117 | + errorData = message || ""; |
118 | } | 118 | } |
119 | uni.$u.toast(errorData); | 119 | uni.$u.toast(errorData); |
120 | return Promise.reject(response); | 120 | return Promise.reject(response); |
1 | <template> | 1 | <template> |
2 | <view class="feedback-page"> | 2 | <view class="feedback-page"> |
3 | - <!-- 公共组件-每个页面必须引入 --> | ||
4 | - <public-module></public-module> | ||
5 | - <view class="form-page"> | ||
6 | - <u--form labelPosition="left" :model="feedbackData" :rules="rules" ref="myfeedBackFormRef"> | ||
7 | - <u-form-item required label="主题" prop="feedbackInfo.title" borderBottom ref="item1"> | ||
8 | - <u--input placeholder="请输入主题" v-model="feedbackData.feedbackInfo.title" border="none"></u--input> | ||
9 | - </u-form-item> | ||
10 | - <u-form-item required label="姓名" prop="feedbackInfo.name" borderBottom ref="item1"> | ||
11 | - <u--input placeholder="请输入姓名" v-model="feedbackData.feedbackInfo.name" border="none"></u--input> | ||
12 | - </u-form-item> | ||
13 | - <u-form-item label="手机" prop="feedbackInfo.phone" borderBottom ref="item1"> | ||
14 | - <u--input placeholder="请输入手机" v-model="feedbackData.feedbackInfo.phone" border="none"></u--input> | ||
15 | - </u-form-item> | ||
16 | - <u-form-item label="QQ" prop="feedbackInfo.qq" borderBottom ref="item1"> | ||
17 | - <u--input placeholder="请输入QQ" v-model="feedbackData.feedbackInfo.qq" border="none"></u--input> | ||
18 | - </u-form-item> | ||
19 | - <u-form-item label="邮箱" prop="feedbackInfo.email" borderBottom ref="item1"> | ||
20 | - <u--input placeholder="请输入邮箱" v-model="feedbackData.feedbackInfo.email" border="none"></u--input> | ||
21 | - </u-form-item> | ||
22 | - <u-form-item label="图片" prop="feedbackInfo.images" borderBottom ref="item1"> | ||
23 | - <u-upload :sizeType="compressed" :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="6"></u-upload> | ||
24 | - </u-form-item> | ||
25 | - <u-form-item required label="反馈" prop="feedbackInfo.message" borderBottom ref="item1"> | ||
26 | - <u--textarea placeholder="请输入反馈信息" v-model="feedbackData.feedbackInfo.message" count></u--textarea> | ||
27 | - </u-form-item> | ||
28 | - </u--form> | ||
29 | - <u-button class="buttonSty" shape="circle" type="primary" text="提交" customStyle="margin-top: 17rpx" @click="submit"></u-button> | ||
30 | - <!-- #ifdef MP --> | ||
31 | - <view style="height: 18rpx;"></view> | ||
32 | - <!-- #endif --> | ||
33 | - <!-- #ifndef MP --> | ||
34 | - <view style="height: 52rpx;"></view> | ||
35 | - <!-- #endif --> | 3 | + <view style="overflow-y: scroll;overflow: hidden;height: 1500rpx;"> |
4 | + <!-- 公共组件-每个页面必须引入 --> | ||
5 | + <public-module></public-module> | ||
6 | + <view class="form-page"> | ||
7 | + <u--form labelPosition="left" :model="feedbackData" :rules="rules" ref="myfeedBackFormRef"> | ||
8 | + <u-form-item required label="主题" prop="feedbackInfo.title" borderBottom ref="item1"> | ||
9 | + <u--input placeholder="请输入主题" v-model="feedbackData.feedbackInfo.title" border="none"></u--input> | ||
10 | + </u-form-item> | ||
11 | + <u-form-item required label="姓名" prop="feedbackInfo.name" borderBottom ref="item1"> | ||
12 | + <u--input placeholder="请输入姓名" v-model="feedbackData.feedbackInfo.name" border="none"></u--input> | ||
13 | + </u-form-item> | ||
14 | + <u-form-item label="手机" prop="feedbackInfo.phone" borderBottom ref="item1"> | ||
15 | + <u--input placeholder="请输入手机" v-model="feedbackData.feedbackInfo.phone" border="none"></u--input> | ||
16 | + </u-form-item> | ||
17 | + <u-form-item label="QQ" prop="feedbackInfo.qq" borderBottom ref="item1"> | ||
18 | + <u--input placeholder="请输入QQ" v-model="feedbackData.feedbackInfo.qq" border="none"></u--input> | ||
19 | + </u-form-item> | ||
20 | + <u-form-item label="邮箱" prop="feedbackInfo.email" borderBottom ref="item1"> | ||
21 | + <u--input placeholder="请输入邮箱" v-model="feedbackData.feedbackInfo.email" border="none"></u--input> | ||
22 | + </u-form-item> | ||
23 | + <view class="info"> | ||
24 | + <view class="info-contain"> | ||
25 | + <u-form-item label="反馈" prop="feedbackInfo.message" borderBottom ref="item1"> | ||
26 | + <u--textarea placeholder="请输入反馈信息" v-model="feedbackData.feedbackInfo.message" count></u--textarea> | ||
27 | + </u-form-item> | ||
28 | + </view> | ||
29 | + </view> | ||
30 | + <view class="feed-back-text" style="margin: 15px 0px 0px -16rpx;">上传图片(最多6张)</view> | ||
31 | + <view class="info" style="margin-top: 15rpx;background: rgba(1, 1, 1, 0);"> | ||
32 | + <view class="info-contain"> | ||
33 | + <u-form-item label="图片" prop="feedbackInfo.images" borderBottom ref="item1"> | ||
34 | + <u-upload :sizeType="compressed" :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="6"></u-upload> | ||
35 | + </u-form-item> | ||
36 | + </view> | ||
37 | + </view> | ||
38 | + </u--form> | ||
39 | + <view style="width:427rpx;margin:0 auto;"> | ||
40 | + <u-button class="buttonSty button-sty" shape="circle" type="primary" text="提交" customStyle="margin-top: 129rpx" @click="submit"></u-button> | ||
41 | + </view> | ||
42 | + </view> | ||
43 | + <!-- #ifdef MP --> | ||
44 | + <view style="height: 18rpx;"></view> | ||
45 | + <!-- #endif --> | ||
46 | + <!-- #ifndef MP --> | ||
47 | + <view style="height: 52rpx;"></view> | ||
48 | + <!-- #endif --> | ||
49 | + </view> | ||
50 | + <view style="height: 20rpx;"></view> | ||
51 | + <f-tabbar></f-tabbar> | ||
36 | </view> | 52 | </view> |
37 | - <view style="height: 20rpx;"></view> | ||
38 | - <f-tabbar></f-tabbar> | ||
39 | </view> | 53 | </view> |
40 | </template> | 54 | </template> |
41 | 55 | ||
@@ -261,18 +275,50 @@ export default { | @@ -261,18 +275,50 @@ export default { | ||
261 | background-color: #f8f9fa; | 275 | background-color: #f8f9fa; |
262 | padding-top: 9rpx; | 276 | padding-top: 9rpx; |
263 | padding-left: 27rpx; | 277 | padding-left: 27rpx; |
278 | + overflow-y: scroll; | ||
279 | + overflow: hidden; | ||
264 | } | 280 | } |
265 | .form-page { | 281 | .form-page { |
266 | width: 700rpx; | 282 | width: 700rpx; |
267 | background-color: #ffffff; | 283 | background-color: #ffffff; |
268 | - border-radius: 20px; | 284 | + border-radius: 10px; |
269 | margin-top: 20rpx; | 285 | margin-top: 20rpx; |
270 | padding-left: 15rpx; | 286 | padding-left: 15rpx; |
271 | padding: 0 20rpx; | 287 | padding: 0 20rpx; |
288 | + height: 500rpx; | ||
289 | + .info { | ||
290 | + width: 700rpx; | ||
291 | + background-color: #ffffff; | ||
292 | + border-radius: 10px; | ||
293 | + margin-top: 80rpx; | ||
294 | + height: 256rpx; | ||
295 | + margin-left: -20rpx; | ||
296 | + .info-contain { | ||
297 | + margin: 0rpx 27rpx; | ||
298 | + /deep/ .u-line { | ||
299 | + display: none !important; | ||
300 | + } | ||
301 | + /deep/ .u-form-item__body__left__content__label { | ||
302 | + display: none !important; | ||
303 | + } | ||
304 | + /deep/.u-form-item__body__right { | ||
305 | + margin-left: -106rpx; | ||
306 | + } | ||
307 | + /deep/.u-textarea--radius { | ||
308 | + border: none !important; | ||
309 | + } | ||
310 | + } | ||
311 | + } | ||
312 | + /deep/.u-button--primary{ | ||
313 | + background-color: #377DFF!important; | ||
314 | + border-color: #377DFF!important; | ||
315 | + } | ||
272 | } | 316 | } |
273 | //#ifndef MP | 317 | //#ifndef MP |
274 | .buttonSty { | 318 | .buttonSty { |
275 | margin-top: 30rpx !important; | 319 | margin-top: 30rpx !important; |
276 | } | 320 | } |
277 | //#endif | 321 | //#endif |
322 | + | ||
323 | + | ||
278 | </style> | 324 | </style> |
@@ -7,11 +7,13 @@ | @@ -7,11 +7,13 @@ | ||
7 | <!-- 登录 --> | 7 | <!-- 登录 --> |
8 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> | 8 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> |
9 | <block v-if="userInfo.isToken"> | 9 | <block v-if="userInfo.isToken"> |
10 | - <view @click="openPersonalInfo" class="u-m-r-20"><image class="avatar" mode="aspectFill" :src="userInfo.avatar || '/static/default.png'"></image></view> | 10 | + <view @click="openPersonalInfo" class="u-m-r-20"> |
11 | + <image class="avatar" mode="aspectFill" :src="userInfo.avatar || userInfo.avatarUrl || '/static/default.png'"></image> | ||
12 | + </view> | ||
11 | <view @click="openPersonalInfo" class="u-flex-1"> | 13 | <view @click="openPersonalInfo" class="u-flex-1"> |
12 | <view class="nickName u-flex"> | 14 | <view class="nickName u-flex"> |
13 | - <view class="name u-m-r-10" v-if="userInfo.realName"> | ||
14 | - <text style="#FFFFFF;font-size: 18px;">{{ userInfo.realName }}</text> | 15 | + <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> | ||
15 | </view> | 17 | </view> |
16 | </view> | 18 | </view> |
17 | <view style="color:#FFFFFF;font-size: 14px;" v-if="userInfo.phoneNumber">{{ userInfo.phoneNumber | phone }}</view> | 19 | <view style="color:#FFFFFF;font-size: 14px;" v-if="userInfo.phoneNumber">{{ userInfo.phoneNumber | phone }}</view> |
@@ -22,9 +24,9 @@ | @@ -22,9 +24,9 @@ | ||
22 | <view class="u-m-r-20" @click="openLoginFunc"> | 24 | <view class="u-m-r-20" @click="openLoginFunc"> |
23 | <view class="avatar u-flex"><u-icon name="account-fill" color="black" size="30"></u-icon></view> | 25 | <view class="avatar u-flex"><u-icon name="account-fill" color="black" size="30"></u-icon></view> |
24 | </view> | 26 | </view> |
25 | - <view class="u-flex-1" @click="openLoginFunc"> | ||
26 | - <view class="u-font-lg click-login login-btn ">请点击登录</view> | ||
27 | - <view v-if="userInfo.isToken" @click="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view> | 27 | + <view class="u-flex-1"> |
28 | + <view @click="openLoginFunc" class="u-font-lg click-login login-btn ">请点击登录</view> | ||
29 | + <view @click="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view> | ||
28 | </view> | 30 | </view> |
29 | </block> | 31 | </block> |
30 | <view v-if="userInfo.isToken"><u-icon name="arrow-right" color="white" size="13"></u-icon></view> | 32 | <view v-if="userInfo.isToken"><u-icon name="arrow-right" color="white" size="13"></u-icon></view> |
@@ -34,11 +36,13 @@ | @@ -34,11 +36,13 @@ | ||
34 | <!-- 登录 --> | 36 | <!-- 登录 --> |
35 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> | 37 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> |
36 | <block v-if="userInfo.isToken"> | 38 | <block v-if="userInfo.isToken"> |
37 | - <view @click="openPersonalInfo" class="u-m-r-20"><image class="avatar" mode="aspectFill" :src="userInfo.avatar || '/static/default.png'"></image></view> | 39 | + <view @click="openPersonalInfo" class="u-m-r-20"> |
40 | + <image class="avatar" mode="aspectFill" :src="userInfo.avatar || userInfo.avatarUrl || '/static/default.png'"></image> | ||
41 | + </view> | ||
38 | <view @click="openPersonalInfo" class="u-flex-1"> | 42 | <view @click="openPersonalInfo" class="u-flex-1"> |
39 | <view class="nickName u-flex"> | 43 | <view class="nickName u-flex"> |
40 | - <view class="name u-m-r-10" v-if="userInfo.realName"> | ||
41 | - <text style="#FFFFFF;font-size: 18px;">{{ userInfo.realName }}</text> | 44 | + <view class="name u-m-r-10" v-if="userInfo.realName || userInfo.nickName"> |
45 | + <text style="#FFFFFF;font-size: 18px;">{{ userInfo.realName || userInfo.nickName }}</text> | ||
42 | </view> | 46 | </view> |
43 | </view> | 47 | </view> |
44 | <view style="color:#FFFFFF;font-size: 14px;" v-if="userInfo.phoneNumber">{{ userInfo.phoneNumber | phone }}</view> | 48 | <view style="color:#FFFFFF;font-size: 14px;" v-if="userInfo.phoneNumber">{{ userInfo.phoneNumber | phone }}</view> |
@@ -49,9 +53,9 @@ | @@ -49,9 +53,9 @@ | ||
49 | <view class="u-m-r-20" @click="openLoginFunc"> | 53 | <view class="u-m-r-20" @click="openLoginFunc"> |
50 | <view class="avatar u-flex" style="justify-content: center"><u-icon name="account-fill" color="black" size="30"></u-icon></view> | 54 | <view class="avatar u-flex" style="justify-content: center"><u-icon name="account-fill" color="black" size="30"></u-icon></view> |
51 | </view> | 55 | </view> |
52 | - <view class="u-flex-1" @click="openLoginFunc"> | ||
53 | - <view class="u-font-lg login-btn">登录</view> | ||
54 | - <view v-if="userInfo.isToken" @click="clickAccountFunc" style="color: black" class="detail">绑定账号</view> | 56 | + <view class="u-flex-1"> |
57 | + <view @click="openLoginFunc" class="u-font-lg login-btn">登录</view> | ||
58 | + <view @click="clickAccountFunc" style="color: black" class="detail">绑定账号</view> | ||
55 | </view> | 59 | </view> |
56 | </block> | 60 | </block> |
57 | <view><u-icon name="arrow-right" color="black" size="13"></u-icon></view> | 61 | <view><u-icon name="arrow-right" color="black" size="13"></u-icon></view> |
@@ -80,7 +84,7 @@ | @@ -80,7 +84,7 @@ | ||
80 | <u-modal :showConfirmButton="false" :show="show" :title="title"> | 84 | <u-modal :showConfirmButton="false" :show="show" :title="title"> |
81 | <view v-if="!bindPhone" class="loginPhone"> | 85 | <view v-if="!bindPhone" class="loginPhone"> |
82 | <view class="form-row"> | 86 | <view class="form-row"> |
83 | - <u--input shape="circle" class="input" prefixIcon="account-fill" type="text" placeholder="登录账号" v-model="bindAccountObj.account"></u--input> | 87 | + <u--input shape="circle" class="input" prefixIcon="account-fill" type="text" placeholder="登录账号" v-model="bindAccountObj.appUserKey"></u--input> |
84 | </view> | 88 | </view> |
85 | <view class="form-row item-bind"> | 89 | <view class="form-row item-bind"> |
86 | <u--input | 90 | <u--input |
@@ -90,7 +94,7 @@ | @@ -90,7 +94,7 @@ | ||
90 | suffixIconStyle="color: #909399" | 94 | suffixIconStyle="color: #909399" |
91 | type="password" | 95 | type="password" |
92 | placeholder="登录密码" | 96 | placeholder="登录密码" |
93 | - v-model="bindAccountObj.password" | 97 | + v-model="bindAccountObj.appUserSecret" |
94 | @change="passwordChange" | 98 | @change="passwordChange" |
95 | ></u--input> | 99 | ></u--input> |
96 | </view> | 100 | </view> |
@@ -105,7 +109,7 @@ | @@ -105,7 +109,7 @@ | ||
105 | shape="circle" | 109 | shape="circle" |
106 | class="input" | 110 | class="input" |
107 | type="text" | 111 | type="text" |
108 | - v-model="bindPhoneObj.phoneNumber" | 112 | + v-model="bindPhoneObj.appUserKey" |
109 | placeholder="请输入手机号码" | 113 | placeholder="请输入手机号码" |
110 | placeholder-style="font-weight:normal;color:#bbbbbb;" | 114 | placeholder-style="font-weight:normal;color:#bbbbbb;" |
111 | ></u--input> | 115 | ></u--input> |
@@ -115,7 +119,7 @@ | @@ -115,7 +119,7 @@ | ||
115 | shape="circle" | 119 | shape="circle" |
116 | class="input" | 120 | class="input" |
117 | type="text" | 121 | type="text" |
118 | - v-model="bindPhoneObj.code" | 122 | + v-model="bindPhoneObj.appUserSecret" |
119 | placeholder="请输入验证码" | 123 | placeholder="请输入验证码" |
120 | placeholder-style="font-weight:normal;color:#bbbbbb;" | 124 | placeholder-style="font-weight:normal;color:#bbbbbb;" |
121 | ></u--input> | 125 | ></u--input> |
@@ -167,7 +171,6 @@ export default { | @@ -167,7 +171,6 @@ export default { | ||
167 | showLogout: false, | 171 | showLogout: false, |
168 | readonly: false, | 172 | readonly: false, |
169 | codeText: '获取验证码', | 173 | codeText: '获取验证码', |
170 | - phone: '', //号码 | ||
171 | tips: '验证码', | 174 | tips: '验证码', |
172 | bindPhone: false, | 175 | bindPhone: false, |
173 | show: false, | 176 | show: false, |
@@ -175,24 +178,29 @@ export default { | @@ -175,24 +178,29 @@ export default { | ||
175 | systemInfo: base.systemInfo, | 178 | systemInfo: base.systemInfo, |
176 | PrimaryButtonColor: '#0079fe', //主题色 | 179 | PrimaryButtonColor: '#0079fe', //主题色 |
177 | bindAccountObj: { | 180 | bindAccountObj: { |
178 | - username: '', | ||
179 | - password: '' | 181 | + appUserKey: '', |
182 | + appUserSecret: '' | ||
180 | }, | 183 | }, |
181 | bindPhoneObj: { | 184 | bindPhoneObj: { |
182 | - phoneNumber: '', | ||
183 | - code: '' | ||
184 | - } | 185 | + appUserKey: '', |
186 | + appUserSecret: '' | ||
187 | + }, | ||
188 | + thirdObj: {} | ||
185 | }; | 189 | }; |
186 | }, | 190 | }, |
187 | - onLoad() { | 191 | + onLoad(e) { |
188 | // 隐藏原生的tabbar | 192 | // 隐藏原生的tabbar |
189 | uni.hideTabBar(); | 193 | uni.hideTabBar(); |
194 | + if (e.obj !== null) { | ||
195 | + const params = JSON.parse(e.obj); | ||
196 | + this.thirdObj = params; | ||
197 | + } | ||
190 | }, | 198 | }, |
191 | computed: { | 199 | computed: { |
192 | ...mapState(['userInfo']) | 200 | ...mapState(['userInfo']) |
193 | }, | 201 | }, |
194 | methods: { | 202 | methods: { |
195 | - ...mapMutations(['emptyUserInfo']), | 203 | + ...mapMutations(['emptyUserInfo', 'setUserInfo']), |
196 | // 跳转前判断登录 | 204 | // 跳转前判断登录 |
197 | onTokenJump(url) { | 205 | onTokenJump(url) { |
198 | this.judgeLogin(() => { | 206 | this.judgeLogin(() => { |
@@ -221,14 +229,136 @@ export default { | @@ -221,14 +229,136 @@ export default { | ||
221 | }, | 229 | }, |
222 | clickAccountFunc() { | 230 | clickAccountFunc() { |
223 | this.show = true; | 231 | this.show = true; |
232 | + this.resetFunc(); | ||
233 | + }, | ||
234 | + resetFunc() { | ||
235 | + this.bindPhone = false; | ||
236 | + this.bindAccountObj = {}; | ||
237 | + this.bindPhoneObj = {}; | ||
224 | }, | 238 | }, |
225 | bindConfirm() { | 239 | bindConfirm() { |
240 | + //需要绑定 | ||
226 | if (!this.bindPhone) { | 241 | if (!this.bindPhone) { |
227 | - console.log('Account submit', this.bindAccountObj); | 242 | + if (this.bindAccountObj.appUserKey == '') { |
243 | + return uni.$u.toast('请输入登录账号~'); | ||
244 | + } | ||
245 | + const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/; | ||
246 | + if (this.bindAccountObj.appUserSecret == '') { | ||
247 | + uni.showToast({ | ||
248 | + title: '请输入登录密码~', | ||
249 | + icon: 'none' | ||
250 | + }); | ||
251 | + return; | ||
252 | + } else if (!passReg.test(this.bindAccountObj.appUserSecret)) { | ||
253 | + uni.showToast({ | ||
254 | + title: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~', | ||
255 | + icon: 'none', | ||
256 | + duration: 3000 | ||
257 | + }); | ||
258 | + return; | ||
259 | + } | ||
260 | + const postData = { | ||
261 | + loginMethod: 'ACCOUNT', | ||
262 | + ...this.bindAccountObj, | ||
263 | + platformName: 'WECHAT', | ||
264 | + ...this.thirdObj | ||
265 | + }; | ||
266 | + uni.$u.http | ||
267 | + .post('/yt/third/bind', postData) | ||
268 | + .then(res => { | ||
269 | + if (res) { | ||
270 | + this.show = false; | ||
271 | + // 储存登录信息 | ||
272 | + let resObj = { | ||
273 | + refreshToken: res.refreshToken, | ||
274 | + isToken: res.token | ||
275 | + }; | ||
276 | + let userInfo = { | ||
277 | + ...resObj, | ||
278 | + token: true //token用于判断是否登录 | ||
279 | + }; | ||
280 | + if (userInfo.token) { | ||
281 | + this.setUserInfo(userInfo); | ||
282 | + } | ||
283 | + uni.showToast({ | ||
284 | + title: '账号绑定成功~', | ||
285 | + icon: 'none' | ||
286 | + }); | ||
287 | + this.saveUserInfo(); | ||
288 | + } | ||
289 | + }) | ||
290 | + .catch(e => { | ||
291 | + uni.$u.toast(e.data?.message); | ||
292 | + }); | ||
228 | } else { | 293 | } else { |
229 | - console.log('Phone submit', this.bindPhoneObj); | 294 | + const phoneRegular = /^1\d{10}$/; |
295 | + if (this.bindPhoneObj.appUserKey == '') { | ||
296 | + uni.showToast({ | ||
297 | + title: '请输入手机号码~', | ||
298 | + icon: 'none' | ||
299 | + }); | ||
300 | + return; | ||
301 | + } else if (!phoneRegular.test(this.bindPhoneObj.appUserKey)) { | ||
302 | + uni.showToast({ | ||
303 | + title: '手机号格式不正确~', | ||
304 | + icon: 'none' | ||
305 | + }); | ||
306 | + return; | ||
307 | + } | ||
308 | + if (this.bindPhoneObj.appUserSecret == '') { | ||
309 | + uni.showToast({ | ||
310 | + title: '请输入验证码~', | ||
311 | + icon: 'none' | ||
312 | + }); | ||
313 | + return; | ||
314 | + } else if (!/^\d{6}$/.test(this.bindPhoneObj.appUserSecret)) { | ||
315 | + uni.showToast({ | ||
316 | + title: '验证码格式不正确~', | ||
317 | + icon: 'none' | ||
318 | + }); | ||
319 | + return; | ||
320 | + } | ||
321 | + const postData = { | ||
322 | + loginMethod: 'PHONE', | ||
323 | + ...this.bindPhoneObj, | ||
324 | + platformName: 'WECHAT', | ||
325 | + ...this.thirdObj | ||
326 | + }; | ||
327 | + uni.$u.http | ||
328 | + .post('/yt/third/bind', postData) | ||
329 | + .then(res => { | ||
330 | + this.show = false; | ||
331 | + // 储存登录信息 | ||
332 | + let resObj = { | ||
333 | + refreshToken: res.refreshToken, | ||
334 | + isToken: res.token | ||
335 | + }; | ||
336 | + let userInfo = { | ||
337 | + ...resObj, | ||
338 | + token: true //token用于判断是否登录 | ||
339 | + }; | ||
340 | + if (userInfo.token) { | ||
341 | + this.setUserInfo(userInfo); | ||
342 | + } | ||
343 | + uni.showToast({ | ||
344 | + title: '手机绑定成功~', | ||
345 | + icon: 'none' | ||
346 | + }); | ||
347 | + this.saveUserInfo(); | ||
348 | + }) | ||
349 | + .catch(e => { | ||
350 | + uni.$u.toast(e.data?.message); | ||
351 | + }); | ||
230 | } | 352 | } |
231 | }, | 353 | }, |
354 | + saveUserInfo() { | ||
355 | + //储存个人信息 | ||
356 | + uni.$u.http.get('/yt/user/me/info').then(res => { | ||
357 | + if (res) { | ||
358 | + this.setUserInfo(res); | ||
359 | + } | ||
360 | + }); | ||
361 | + }, | ||
232 | bindPhoneFunc() { | 362 | bindPhoneFunc() { |
233 | this.bindPhone = true; | 363 | this.bindPhone = true; |
234 | }, | 364 | }, |
@@ -253,7 +383,6 @@ export default { | @@ -253,7 +383,6 @@ export default { | ||
253 | }, | 383 | }, |
254 | //获取验证码 | 384 | //获取验证码 |
255 | getVcode() { | 385 | getVcode() { |
256 | - console.log('getVcode'); | ||
257 | if (this.readonly) { | 386 | if (this.readonly) { |
258 | uni.showToast({ | 387 | uni.showToast({ |
259 | title: '验证码已发送~', | 388 | title: '验证码已发送~', |
@@ -261,7 +390,7 @@ export default { | @@ -261,7 +390,7 @@ export default { | ||
261 | }); | 390 | }); |
262 | return; | 391 | return; |
263 | } | 392 | } |
264 | - if (this.phone == '') { | 393 | + if (this.bindPhoneObj.appUserKey == '') { |
265 | uni.showToast({ | 394 | uni.showToast({ |
266 | title: '请输入手机号~', | 395 | title: '请输入手机号~', |
267 | icon: 'none' | 396 | icon: 'none' |
@@ -269,7 +398,7 @@ export default { | @@ -269,7 +398,7 @@ export default { | ||
269 | return; | 398 | return; |
270 | } | 399 | } |
271 | const phoneRegular = /^1\d{10}$/; | 400 | const phoneRegular = /^1\d{10}$/; |
272 | - if (!phoneRegular.test(this.phone)) { | 401 | + if (!phoneRegular.test(this.bindPhoneObj.appUserKey)) { |
273 | uni.showToast({ | 402 | uni.showToast({ |
274 | title: '手机号格式不正确~', | 403 | title: '手机号格式不正确~', |
275 | icon: 'none' | 404 | icon: 'none' |
@@ -278,9 +407,11 @@ export default { | @@ -278,9 +407,11 @@ export default { | ||
278 | } | 407 | } |
279 | let httpData = {}; | 408 | let httpData = {}; |
280 | // 获取验证码接口 | 409 | // 获取验证码接口 |
281 | - // uni.$u.http.post('您的接口', httpData).then(res => { | ||
282 | - this.getCodeState(); //开始倒计时 | ||
283 | - // }) | 410 | + uni.$u.http.post(`/yt/noauth/sendLoginSmsCode/${this.bindPhoneObj.appUserKey}`).then(res => { |
411 | + if (res) { | ||
412 | + this.getCodeState(); //开始倒计时 | ||
413 | + } | ||
414 | + }); | ||
284 | }, | 415 | }, |
285 | onLoginoutFunc() { | 416 | onLoginoutFunc() { |
286 | this.showLogout = true; | 417 | this.showLogout = true; |
@@ -85,7 +85,9 @@ | @@ -85,7 +85,9 @@ | ||
85 | } | 85 | } |
86 | // 获取验证码接口 | 86 | // 获取验证码接口 |
87 | uni.$u.http.post(`/yt/noauth/sendLoginSmsCode/${this.phone}` ).then(res => { | 87 | uni.$u.http.post(`/yt/noauth/sendLoginSmsCode/${this.phone}` ).then(res => { |
88 | + if(res){ | ||
88 | this.getCodeState(); //开始倒计时 | 89 | this.getCodeState(); //开始倒计时 |
90 | + } | ||
89 | }) | 91 | }) |
90 | }, | 92 | }, |
91 | onSubmit() { | 93 | onSubmit() { |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | } | 9 | } |
10 | } | 10 | } |
11 | .set-main { | 11 | .set-main { |
12 | - border-radius: 20px; | 12 | + border-radius: 10px; |
13 | margin-top: 37rpx; | 13 | margin-top: 37rpx; |
14 | padding-left: 15rpx; | 14 | padding-left: 15rpx; |
15 | justify-content: space-between; | 15 | justify-content: space-between; |
@@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
41 | } | 41 | } |
42 | .basic-main { | 42 | .basic-main { |
43 | background-color: #ffffff; | 43 | background-color: #ffffff; |
44 | - border-radius: 20px; | 44 | + border-radius: 10px; |
45 | margin-top: 20rpx; | 45 | margin-top: 20rpx; |
46 | padding-left: 15rpx; | 46 | padding-left: 15rpx; |
47 | } | 47 | } |
@@ -38,8 +38,10 @@ | @@ -38,8 +38,10 @@ | ||
38 | 38 | ||
39 | <script> | 39 | <script> |
40 | import { mapMutations } from 'vuex'; | 40 | import { mapMutations } from 'vuex'; |
41 | -import { getUserInfo } from '@/components/module/f-login/f-login.js'; | ||
42 | import { loginApp } from '@/config/login'; | 41 | import { loginApp } from '@/config/login'; |
42 | +import baseUrl from '@/config/baseUrl.js'; | ||
43 | +import WXBizDataCrypt from '@/config/WXBizDataCrypt.js'; | ||
44 | +import { appId, appSecrect } from '@/config/constant.js'; | ||
43 | 45 | ||
44 | export default { | 46 | export default { |
45 | data() { | 47 | data() { |
@@ -49,46 +51,97 @@ export default { | @@ -49,46 +51,97 @@ export default { | ||
49 | password: '' | 51 | password: '' |
50 | }, | 52 | }, |
51 | showPassword: false, | 53 | showPassword: false, |
52 | - code: '' | 54 | + code: '', |
55 | + openid: '', | ||
56 | + session_key: '' | ||
53 | }; | 57 | }; |
54 | }, | 58 | }, |
55 | onLoad() { | 59 | onLoad() { |
56 | - uni.login({ | 60 | + //#ifdef MP-WEIXIN |
61 | + wx.login({ | ||
57 | success: res => { | 62 | success: res => { |
58 | - if (res.errMsg == 'login:ok') { | 63 | + if (res.code) { |
59 | this.code = res.code; | 64 | this.code = res.code; |
60 | - console.log('This code', this.code); | ||
61 | - } else { | ||
62 | - uni.showToast({ | ||
63 | - title: '系统异常' | 65 | + wx.request({ |
66 | + url: `https://api.weixin.qq.com/sns/jscode2session?appid=${appId}&secret=${appSecrect}&js_code=${this.code}&grant_type=authorization_code`, | ||
67 | + method: 'GET', | ||
68 | + success: res => { | ||
69 | + if (res.statusCode == 200) { | ||
70 | + this.openid = res.data.openid; | ||
71 | + this.session_key = res.data.session_key; | ||
72 | + } | ||
73 | + } | ||
64 | }); | 74 | }); |
75 | + } else { | ||
65 | } | 76 | } |
66 | } | 77 | } |
67 | }); | 78 | }); |
79 | + //#endif | ||
68 | }, | 80 | }, |
69 | methods: { | 81 | methods: { |
70 | ...mapMutations(['setUserInfo']), | 82 | ...mapMutations(['setUserInfo']), |
71 | //微信授权登录 | 83 | //微信授权登录 |
72 | onAuthorization(e) { | 84 | onAuthorization(e) { |
73 | - getUserInfo( | ||
74 | - info => { | ||
75 | - console.log('授权信息', info); | ||
76 | - let httpData = { | ||
77 | - code: this.code, | ||
78 | - nickName: info.nickName || '', //昵称 | ||
79 | - avatarUrl: info.avatarUrl || '', //头像 | ||
80 | - gender: info.gender || '' //性别 0:未知 1:男 2:女 | ||
81 | - }; | ||
82 | - // #ifdef APP-PLUS||MP | ||
83 | - setTimeout(() => { | ||
84 | - uni.reLaunch({ | ||
85 | - url: '/pages/personal/personal' | ||
86 | - }); | ||
87 | - }, 500); | ||
88 | - // #endif | ||
89 | - }, | ||
90 | - err => {} | ||
91 | - ); | 85 | + wx.getUserProfile({ |
86 | + desc: '获取用户信息', | ||
87 | + success: res => { | ||
88 | + if (res) { | ||
89 | + let pc = new WXBizDataCrypt(appId, this.session_key); | ||
90 | + let data = pc.decryptData(res.encryptedData, res.iv); | ||
91 | + let obj = { | ||
92 | + avatarUrl: data.avatarUrl, | ||
93 | + nickName: data.nickName, | ||
94 | + thirdUserId: this.openid | ||
95 | + }; | ||
96 | + //判断是否需要绑定 | ||
97 | + uni.$u.http | ||
98 | + .get(`/yt/third/login/${this.openid}`) | ||
99 | + .then(res => { | ||
100 | + if (res.token == '' || res.token == null) { | ||
101 | + } else { | ||
102 | + // 储存登录信息 | ||
103 | + let resObj = { | ||
104 | + refreshToken: res.refreshToken, | ||
105 | + isToken: res.token | ||
106 | + }; | ||
107 | + let userInfo = { | ||
108 | + ...resObj, | ||
109 | + token: true //token用于判断是否登录 | ||
110 | + }; | ||
111 | + if (userInfo.token) { | ||
112 | + this.setUserInfo(userInfo); | ||
113 | + } | ||
114 | + uni.showToast({ | ||
115 | + title: '第三方账号登录成功~', | ||
116 | + icon: 'none' | ||
117 | + }); | ||
118 | + this.saveUserInfo(); | ||
119 | + // return uni.showToast({ | ||
120 | + // title: '不需要绑定' | ||
121 | + // }); | ||
122 | + } | ||
123 | + }) | ||
124 | + .catch(e => { | ||
125 | + uni.$u.toast(e.data?.message); | ||
126 | + }); | ||
127 | + // #ifdef APP-PLUS||MP | ||
128 | + setTimeout(() => { | ||
129 | + uni.reLaunch({ | ||
130 | + url: '/pages/personal/personal?obj=' + JSON.stringify(obj) | ||
131 | + }); | ||
132 | + }, 500); | ||
133 | + // #endif | ||
134 | + } | ||
135 | + } | ||
136 | + }); | ||
137 | + }, | ||
138 | + saveUserInfo() { | ||
139 | + //储存个人信息 | ||
140 | + uni.$u.http.get('/yt/user/me/info').then(res => { | ||
141 | + if (res) { | ||
142 | + this.setUserInfo(res); | ||
143 | + } | ||
144 | + }); | ||
92 | }, | 145 | }, |
93 | onSubmitFunc() { | 146 | onSubmitFunc() { |
94 | if (this.loginForm.username == '') { | 147 | if (this.loginForm.username == '') { |
@@ -93,6 +93,9 @@ | @@ -93,6 +93,9 @@ | ||
93 | justify-content: center; | 93 | justify-content: center; |
94 | flex-direction: column; | 94 | flex-direction: column; |
95 | margin-top: 370rpx; | 95 | margin-top: 370rpx; |
96 | + /* #ifdef APP-PLUS */ | ||
97 | + margin-top: 250rpx; | ||
98 | + /* #endif */ | ||
96 | .link-text { | 99 | .link-text { |
97 | color: #999999; | 100 | color: #999999; |
98 | font-size: 13px; | 101 | font-size: 13px; |
@@ -166,6 +166,12 @@ button { | @@ -166,6 +166,12 @@ button { | ||
166 | font-weight: 400; | 166 | font-weight: 400; |
167 | color: #ffffff; | 167 | color: #ffffff; |
168 | } | 168 | } |
169 | +.feed-back-text { | ||
170 | + font-size: 15px; | ||
171 | + font-family: PingFangSC-Regular, PingFang SC; | ||
172 | + font-weight: 400; | ||
173 | + color: #2f384e; | ||
174 | +} | ||
169 | // 定义flex等分 | 175 | // 定义flex等分 |
170 | @for $i from 0 through 12 { | 176 | @for $i from 0 through 12 { |
171 | .u-flex-#{$i} { | 177 | .u-flex-#{$i} { |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | /deep/.u-list-item { | 7 | /deep/.u-list-item { |
8 | background: #ffffff; | 8 | background: #ffffff; |
9 | width: 695rpx; | 9 | width: 695rpx; |
10 | - border-radius: 20px; | 10 | + border-radius: 10px; |
11 | margin-top: 20rpx; | 11 | margin-top: 20rpx; |
12 | } | 12 | } |
13 | .notify-main { | 13 | .notify-main { |
@@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
21 | width: 700rpx; | 21 | width: 700rpx; |
22 | height: 136rpx; | 22 | height: 136rpx; |
23 | background: #ffffff; | 23 | background: #ffffff; |
24 | - border-radius: 20px; | 24 | + border-radius: 10px; |
25 | .item { | 25 | .item { |
26 | justify-content: space-between; | 26 | justify-content: space-between; |
27 | flex-direction: row; | 27 | flex-direction: row; |
@@ -2,10 +2,11 @@ | @@ -2,10 +2,11 @@ | ||
2 | <view class="notify-page"> | 2 | <view class="notify-page"> |
3 | <!-- 公共组件-每个页面必须引入 --> | 3 | <!-- 公共组件-每个页面必须引入 --> |
4 | <public-module></public-module> | 4 | <public-module></public-module> |
5 | - <view @click="openTypeClick" style="width: 700rpx;"> | ||
6 | - <u--input suffixIcon="arrow-down" shape="circle" v-model="model1.userInfo.type" placeholder="请选择类型" border="surround"></u--input> | 5 | + <view @click="openTypeClick" style="width: 700rpx;position: fixed;top: 0;z-index: 1;"> |
6 | + <u--input suffixIcon="arrow-down" shape="circle" disabled v-model="model1.userInfo.type" placeholder="请选择类型" border="surround"></u--input> | ||
7 | <u-action-sheet :show="showType" :actions="actions" title="请选择类型" @close="showType = false" @select="typeSelect"></u-action-sheet> | 7 | <u-action-sheet :show="showType" :actions="actions" title="请选择类型" @close="showType = false" @select="typeSelect"></u-action-sheet> |
8 | </view> | 8 | </view> |
9 | + <view style="height: 76rpx;"></view> | ||
9 | <view class="notify-main"> | 10 | <view class="notify-main"> |
10 | <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"> | 11 | <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"> |
11 | <view class="u-flex main"> | 12 | <view class="u-flex main"> |