Commit 7846a407473f99acda31e4cc6cd0c47a3f80a2d9
Merge branch 'dev-ft' into 'main'
fix:修改告警分页问题隐藏样式问题 fix:移除解密插件 See merge request huang/thingskit-app!41
Showing
18 changed files
with
159 additions
and
152 deletions
@@ -70,8 +70,12 @@ | @@ -70,8 +70,12 @@ | ||
70 | <view><u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea></view> | 70 | <view><u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea></view> |
71 | </view> | 71 | </view> |
72 | <!-- #endif --> | 72 | <!-- #endif --> |
73 | - <view v-if="list.status !== 'CLEARED_ACK'" style="margin-top: 44rpx;display: flex;align-items: center;justify-content: center;"> | ||
74 | - <view class="u-flex" style="width: 400rpx"><u-button @click="handleSubmit" type="primary" shape="circle" text="处理"></u-button></view> | 73 | + <view style="margin-top: 44rpx;display: flex;align-items: center;justify-content: space-between;"> |
74 | + <view v-if="list.status !== 'CLEARED_ACK' && list.status !== 'ACTIVE_ACK'" class="u-flex" style="width: 260rpx"> | ||
75 | + <u-button @click="handleSubmit" type="primary" shape="circle" text="处理"></u-button> | ||
76 | + </view> | ||
77 | + <view style="width: 30rpx;"></view> | ||
78 | + <view v-if="list.status == 'ACTIVE_ACK'" class="u-flex" style="width: 260rpx"><u-button @click="handleRemove" type="error" shape="circle" text="清除"></u-button></view> | ||
75 | </view> | 79 | </view> |
76 | </view> | 80 | </view> |
77 | </template> | 81 | </template> |
@@ -95,6 +99,7 @@ export default { | @@ -95,6 +99,7 @@ export default { | ||
95 | uni.hideTabBar(); | 99 | uni.hideTabBar(); |
96 | }, | 100 | }, |
97 | methods: { | 101 | methods: { |
102 | + //处理 | ||
98 | handleSubmit() { | 103 | handleSubmit() { |
99 | if (this.formModel.result == '') return uni.$u.toast('请输入处理结果'); | 104 | if (this.formModel.result == '') return uni.$u.toast('请输入处理结果'); |
100 | else | 105 | else |
@@ -121,6 +126,31 @@ export default { | @@ -121,6 +126,31 @@ export default { | ||
121 | uni.$u.toast(e.data?.message); | 126 | uni.$u.toast(e.data?.message); |
122 | }); | 127 | }); |
123 | }, | 128 | }, |
129 | + //清除 | ||
130 | + handleRemove() { | ||
131 | + uni.$u.http | ||
132 | + .post(`/alarm/${this.list.id}/clear`) | ||
133 | + .then(res => { | ||
134 | + if (res == '') { | ||
135 | + uni.showToast({ | ||
136 | + title: '清除成功~', | ||
137 | + icon: 'none' | ||
138 | + }); | ||
139 | + let pages = getCurrentPages(); //获取所有页面栈实例列表 | ||
140 | + let nowPage = pages[pages.length - 1]; //当前页页面实例 | ||
141 | + let prevPage = pages[pages.length - 2]; //上一页页面实例 | ||
142 | + prevPage.$vm.detailStatus = true; | ||
143 | + setTimeout(() => { | ||
144 | + uni.navigateBack({ | ||
145 | + delta: 1 | ||
146 | + }); | ||
147 | + }, 500); | ||
148 | + } | ||
149 | + }) | ||
150 | + .catch(e => { | ||
151 | + uni.$u.toast(e.data?.message); | ||
152 | + }); | ||
153 | + }, | ||
124 | formatDetailText(e) { | 154 | formatDetailText(e) { |
125 | //去除字符串双引号 | 155 | //去除字符串双引号 |
126 | const jsonStr = JSON.stringify(e); | 156 | const jsonStr = JSON.stringify(e); |
@@ -302,7 +302,7 @@ export default { | @@ -302,7 +302,7 @@ export default { | ||
302 | this.selectTimeVal = e.value; | 302 | this.selectTimeVal = e.value; |
303 | let curTime = new Date(); | 303 | let curTime = new Date(); |
304 | const formatS = curTime.getTime(); | 304 | const formatS = curTime.getTime(); |
305 | - let addMinute = new Date(curTime.setMinutes(curTime.getMinutes() + this.selectTimeVal)); | 305 | + let addMinute = new Date(curTime.setMinutes(curTime.getMinutes() - this.selectTimeVal)); |
306 | const formatE = addMinute.getTime(); | 306 | const formatE = addMinute.getTime(); |
307 | this.timeData.getTimeGapS = formatS; | 307 | this.timeData.getTimeGapS = formatS; |
308 | this.timeData.getTimeGapE = formatE; | 308 | this.timeData.getTimeGapE = formatE; |
@@ -323,8 +323,8 @@ export default { | @@ -323,8 +323,8 @@ export default { | ||
323 | this.startTimeArea = ''; | 323 | this.startTimeArea = ''; |
324 | this.endTimeArea = ''; | 324 | this.endTimeArea = ''; |
325 | } else { | 325 | } else { |
326 | - this.startTimeArea = this.timeData.getTimeGapS; | ||
327 | - this.endTimeArea = this.timeData.getTimeGapE; | 326 | + this.startTimeArea = this.timeData.getTimeGapE; |
327 | + this.endTimeArea = this.timeData.getTimeGapS; | ||
328 | } | 328 | } |
329 | this.loadData( | 329 | this.loadData( |
330 | 1, | 330 | 1, |
@@ -5,12 +5,12 @@ | @@ -5,12 +5,12 @@ | ||
5 | <view class="org-sty"> | 5 | <view class="org-sty"> |
6 | <view @click="openOrg" class="org-item"> | 6 | <view @click="openOrg" class="org-item"> |
7 | <view class="u-flex org-contact"><text class="text">组织关系</text></view> | 7 | <view class="u-flex org-contact"><text class="text">组织关系</text></view> |
8 | - <view class="u-flex org-device"> | 8 | + <view @click="openOrg" class="u-flex org-device"> |
9 | <image class="device-image" src="../../../static/org.png"></image> | 9 | <image class="device-image" src="../../../static/org.png"></image> |
10 | <text class="device-text">摄像头数:{{ cameraTotal }}</text> | 10 | <text class="device-text">摄像头数:{{ cameraTotal }}</text> |
11 | </view> | 11 | </view> |
12 | </view> | 12 | </view> |
13 | - <view class="org-item"><image class="image" src="../../../static/arrow-right.png"></image></view> | 13 | + <view @click="openOrg" class="org-item"><image class="image" src="../../../static/arrow-right.png"></image></view> |
14 | </view> | 14 | </view> |
15 | <view style="height: 150rpx;"></view> | 15 | <view style="height: 150rpx;"></view> |
16 | <!-- 自带分页组件 --> | 16 | <!-- 自带分页组件 --> |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,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 || userInfo.isThirdLogin"> | 9 | <block v-if="userInfo.isToken || userInfo.isThirdLogin"> |
10 | <view @click="openPersonalInfo" class="u-m-r-20"> | 10 | <view @click="openPersonalInfo" class="u-m-r-20"> |
11 | - <image class="avatar" mode="aspectFill" :src="!userInfo.avatar ? '../../static/logo.png' : userInfo.avatar"></image> | 11 | + <image class="avatar" mode="aspectFill" :src="!userInfo.avatar ? '../../static/logo.png' : userInfo.avatar || thirdObj.avatarUrl"></image> |
12 | </view> | 12 | </view> |
13 | <view class="u-flex-1"> | 13 | <view class="u-flex-1"> |
14 | <view class="nickName u-flex"> | 14 | <view class="nickName u-flex"> |
@@ -154,17 +154,19 @@ export default { | @@ -154,17 +154,19 @@ export default { | ||
154 | appUserKey: '', | 154 | appUserKey: '', |
155 | appUserSecret: '' | 155 | appUserSecret: '' |
156 | }, | 156 | }, |
157 | - thirdObj: {} | 157 | + thirdObj: {}, |
158 | + getOpenId: '' | ||
158 | }; | 159 | }; |
159 | }, | 160 | }, |
160 | onLoad(e) { | 161 | onLoad(e) { |
161 | // 隐藏原生的tabbar | 162 | // 隐藏原生的tabbar |
162 | uni.hideTabBar(); | 163 | uni.hideTabBar(); |
163 | - if (e.obj != null) { | ||
164 | - const params = JSON.parse(decodeURIComponent(e.obj)); | ||
165 | - this.thirdObj = params; | ||
166 | - } | ||
167 | - console.log('UserInfo', this.userInfo); | 164 | + // if (e.obj != null) { |
165 | + // const params = JSON.parse(decodeURIComponent(e.obj)); | ||
166 | + // // uni.$u.toast('eee', params.avatarUrl); | ||
167 | + // this.thirdObj = params; | ||
168 | + // } | ||
169 | + this.getOpenId = getApp().globalData.openId; | ||
168 | }, | 170 | }, |
169 | computed: { | 171 | computed: { |
170 | ...mapState(['userInfo']) | 172 | ...mapState(['userInfo']) |
@@ -232,7 +234,7 @@ export default { | @@ -232,7 +234,7 @@ export default { | ||
232 | loginMethod: 'ACCOUNT', | 234 | loginMethod: 'ACCOUNT', |
233 | ...this.bindAccountObj, | 235 | ...this.bindAccountObj, |
234 | platformName: 'WECHAT', | 236 | platformName: 'WECHAT', |
235 | - ...this.thirdObj | 237 | + thirdUserId: this.getOpenId |
236 | }; | 238 | }; |
237 | uni.$u.http | 239 | uni.$u.http |
238 | .post('/yt/third/bind', postData) | 240 | .post('/yt/third/bind', postData) |
@@ -260,8 +262,8 @@ export default { | @@ -260,8 +262,8 @@ export default { | ||
260 | } | 262 | } |
261 | }) | 263 | }) |
262 | .catch(e => { | 264 | .catch(e => { |
263 | - uni.$u.toast(e.data?.msg || e.data?.message); | ||
264 | - this.show = false; | 265 | + uni.$u.toast(e.data?.msg); |
266 | + this.show = true; | ||
265 | }); | 267 | }); |
266 | } else { | 268 | } else { |
267 | const phoneRegular = /^1\d{10}$/; | 269 | const phoneRegular = /^1\d{10}$/; |
@@ -295,7 +297,7 @@ export default { | @@ -295,7 +297,7 @@ export default { | ||
295 | loginMethod: 'PHONE', | 297 | loginMethod: 'PHONE', |
296 | ...this.bindPhoneObj, | 298 | ...this.bindPhoneObj, |
297 | platformName: 'WECHAT', | 299 | platformName: 'WECHAT', |
298 | - ...this.thirdObj | 300 | + thirdUserId: this.getOpenId |
299 | }; | 301 | }; |
300 | uni.$u.http | 302 | uni.$u.http |
301 | .post('/yt/third/bind', postData) | 303 | .post('/yt/third/bind', postData) |
@@ -321,8 +323,8 @@ export default { | @@ -321,8 +323,8 @@ export default { | ||
321 | this.saveUserInfo(); | 323 | this.saveUserInfo(); |
322 | }) | 324 | }) |
323 | .catch(e => { | 325 | .catch(e => { |
324 | - uni.$u.toast(e.data?.msg || e.data?.message); | ||
325 | - this.show = false; | 326 | + uni.$u.toast(e.data?.msg); |
327 | + this.show = true; | ||
326 | }); | 328 | }); |
327 | } | 329 | } |
328 | }, | 330 | }, |
@@ -11,8 +11,10 @@ | @@ -11,8 +11,10 @@ | ||
11 | width: 50px; | 11 | width: 50px; |
12 | height: 50px; | 12 | height: 50px; |
13 | border-radius: 25px; | 13 | border-radius: 25px; |
14 | - background-color: #ccc; | 14 | + background: #d8d8d8; |
15 | justify-content: center; | 15 | justify-content: center; |
16 | + border: 2px solid #ffffff; | ||
17 | + box-shadow: 0px 14px 26px 0px rgba(4, 7, 26, 0.2); | ||
16 | } | 18 | } |
17 | .click-login { | 19 | .click-login { |
18 | font-size: 18px; | 20 | font-size: 18px; |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <!-- 公共组件-每个页面必须引入 --> | 3 | <!-- 公共组件-每个页面必须引入 --> |
4 | <public-module></public-module> | 4 | <public-module></public-module> |
5 | <view @click="upAvatar" class="u-flex set-main"> | 5 | <view @click="upAvatar" class="u-flex set-main"> |
6 | - <view class="main-image"><image class="image" :src="avatar || '/static/logo.png'"></image></view> | 6 | + <view class="main-image"><image class="image" :src="avatar || '../../static/logo.png'"></image></view> |
7 | <view class="main-right-image"><image class="image" src="../../static/arrow-right.png"></image></view> | 7 | <view class="main-right-image"><image class="image" src="../../static/arrow-right.png"></image></view> |
8 | </view> | 8 | </view> |
9 | <view class="u-m-t-20 basic-text"><text class="text">基本资料</text></view> | 9 | <view class="u-m-t-20 basic-text"><text class="text">基本资料</text></view> |
@@ -46,8 +46,12 @@ | @@ -46,8 +46,12 @@ | ||
46 | </u--form> | 46 | </u--form> |
47 | </view> | 47 | </view> |
48 | <view class="basic-bottom u-flex"> | 48 | <view class="basic-bottom u-flex"> |
49 | - <view class="item" v-if="info.data.isToken"><button class="submit" size="default" @click="clearAccountFunc" :style="{ background: InfoColor }">解绑</button></view> | ||
50 | - <view class="item" style="margin-right: 60rpx;"><button class="submit" size="default" @click="onSubmitFunc" :style="{ background: PrimaryColor }">确认</button></view> | 49 | + <view class="item" v-if="info.data.isThirdLogin"> |
50 | + <button class="submit" size="default" @click="clearAccountFunc" :style="{ background: InfoColor }"><text class="un-bind-text">解绑</text></button> | ||
51 | + </view> | ||
52 | + <view class="item" style="margin-right: 60rpx;" :style="[{ position: info.data.isThirdLogin ? '' : 'relative' }, { right: info.data.isThirdLogin ? '' : '-190rpx' }]"> | ||
53 | + <button class="submit" size="default" @click="onSubmitFunc" :style="{ background: PrimaryColor }"><text class="un-bind-text">确认</text></button> | ||
54 | + </view> | ||
51 | </view> | 55 | </view> |
52 | <!-- #ifdef MP --> | 56 | <!-- #ifdef MP --> |
53 | <view class="u-m-t-40"><text style="visibility: hidden;">#</text></view> | 57 | <view class="u-m-t-40"><text style="visibility: hidden;">#</text></view> |
@@ -67,12 +71,16 @@ | @@ -67,12 +71,16 @@ | ||
67 | </template> | 71 | </template> |
68 | 72 | ||
69 | <script> | 73 | <script> |
74 | +import { mapMutations } from 'vuex'; | ||
75 | +import baseUrl from '@/config/baseUrl.js'; | ||
76 | +import { mapState } from 'vuex'; | ||
77 | + | ||
70 | export default { | 78 | export default { |
71 | data() { | 79 | data() { |
72 | return { | 80 | return { |
73 | showBind: false, | 81 | showBind: false, |
74 | PrimaryColor: '#377DFF', //主题色 | 82 | PrimaryColor: '#377DFF', //主题色 |
75 | - InfoColor: '#E3E4E5', //主题色 | 83 | + InfoColor: '#00C9A7', //主题色 |
76 | myInfoModel: { | 84 | myInfoModel: { |
77 | userInfo: { | 85 | userInfo: { |
78 | realName: '', | 86 | realName: '', |
@@ -87,7 +95,8 @@ export default { | @@ -87,7 +95,8 @@ export default { | ||
87 | avatar: '', | 95 | avatar: '', |
88 | id: '', | 96 | id: '', |
89 | info: {}, | 97 | info: {}, |
90 | - openIds: '' | 98 | + openIds: '', |
99 | + isUpdatePersonOrLoginInfo: false | ||
91 | }; | 100 | }; |
92 | }, | 101 | }, |
93 | onLoad(e) { | 102 | onLoad(e) { |
@@ -99,7 +108,7 @@ export default { | @@ -99,7 +108,7 @@ export default { | ||
99 | this.myInfoModel.userInfo.username = params.data.username; | 108 | this.myInfoModel.userInfo.username = params.data.username; |
100 | this.myInfoModel.userInfo.email = params.data.email; | 109 | this.myInfoModel.userInfo.email = params.data.email; |
101 | this.myInfoModel.userInfo.accountExpireTime = params.data.accountExpireTime; | 110 | this.myInfoModel.userInfo.accountExpireTime = params.data.accountExpireTime; |
102 | - this.avatar = params.data.avatar == undefined ? '../../static/avatar-test.png' : params.data.avatar; | 111 | + this.avatar = params.data.avatar == undefined ? '../../static/logo.png' : params.data.avatar; |
103 | this.id = params.data.userId; | 112 | this.id = params.data.userId; |
104 | } | 113 | } |
105 | }, | 114 | }, |
@@ -109,7 +118,11 @@ export default { | @@ -109,7 +118,11 @@ export default { | ||
109 | this.openIds = getOpenId; | 118 | this.openIds = getOpenId; |
110 | } | 119 | } |
111 | }, | 120 | }, |
121 | + computed: { | ||
122 | + ...mapState(['userInfo']) | ||
123 | + }, | ||
112 | methods: { | 124 | methods: { |
125 | + ...mapMutations(['setUserInfo']), | ||
113 | confrimBind(e) { | 126 | confrimBind(e) { |
114 | if (e) { | 127 | if (e) { |
115 | //解绑 | 128 | //解绑 |
@@ -136,8 +149,13 @@ export default { | @@ -136,8 +149,13 @@ export default { | ||
136 | this.showBind = true; | 149 | this.showBind = true; |
137 | }, | 150 | }, |
138 | // 修改头像 | 151 | // 修改头像 |
139 | - upAvatar() { | ||
140 | - var that = this; | 152 | + async upAvatar() { |
153 | + let token; | ||
154 | + token = this.userInfo.isToken || uni.getStorageSync('userInfo').isToken || undefined; | ||
155 | + // #ifdef H5 | ||
156 | + token = window.sessionStorage.getItem('userInfo').isToken; | ||
157 | + // #endif | ||
158 | + if (!token) return uni.$u.toast('请登录后上传图片'); | ||
141 | uni.chooseImage({ | 159 | uni.chooseImage({ |
142 | count: 1, | 160 | count: 1, |
143 | sourceType: ['camera', 'album'], | 161 | sourceType: ['camera', 'album'], |
@@ -166,17 +184,21 @@ export default { | @@ -166,17 +184,21 @@ export default { | ||
166 | }); | 184 | }); |
167 | return; | 185 | return; |
168 | } | 186 | } |
169 | - uni.$u.http | ||
170 | - .upload('/yt/oss/upload', { | ||
171 | - filePath: tempFilePaths[0], | ||
172 | - name: 'file' | ||
173 | - }) | ||
174 | - .then(res => { | ||
175 | - if (res) { | ||
176 | - that.avatar = res.fileStaticUri; | ||
177 | - return uni.$u.toast('头像上传成功'); | ||
178 | - } | ||
179 | - }); | 187 | + uni.uploadFile({ |
188 | + url: `${baseUrl.baseUrl}/yt/oss/upload`, | ||
189 | + filePath: tempFilePaths[0], | ||
190 | + name: 'file', | ||
191 | + header: { | ||
192 | + 'content-type': 'multipart/form-data', | ||
193 | + Authorization: 'Bearer ' + token | ||
194 | + }, | ||
195 | + formData: {}, | ||
196 | + success: res => { | ||
197 | + let objImage = JSON.parse(res.data); | ||
198 | + this.avatar = objImage.fileStaticUri; | ||
199 | + uni.$u.toast('头像上传成功'); | ||
200 | + } | ||
201 | + }); | ||
180 | } | 202 | } |
181 | }); | 203 | }); |
182 | }, | 204 | }, |
@@ -192,6 +214,7 @@ export default { | @@ -192,6 +214,7 @@ export default { | ||
192 | .put('/yt/user/center', httpData) | 214 | .put('/yt/user/center', httpData) |
193 | .then(res => { | 215 | .then(res => { |
194 | if (res) { | 216 | if (res) { |
217 | + this.setUserInfo(res); | ||
195 | uni.showToast({ | 218 | uni.showToast({ |
196 | title: '更新个人资料成功~', | 219 | title: '更新个人资料成功~', |
197 | icon: 'none' | 220 | icon: 'none' |
@@ -6,7 +6,6 @@ | @@ -6,7 +6,6 @@ | ||
6 | <view class="content"> | 6 | <view class="content"> |
7 | <view class="hello login-text-muted">您好,</view> | 7 | <view class="hello login-text-muted">您好,</view> |
8 | <view class="hello-welcome login-text-muted">欢迎来到ThingsKit!</view> | 8 | <view class="hello-welcome login-text-muted">欢迎来到ThingsKit!</view> |
9 | - <view class="circleStyle"></view> | ||
10 | </view> | 9 | </view> |
11 | </view> | 10 | </view> |
12 | <view class="f__login"> | 11 | <view class="f__login"> |
@@ -17,7 +16,9 @@ | @@ -17,7 +16,9 @@ | ||
17 | </view> | 16 | </view> |
18 | <view class="form-row u-flex"> | 17 | <view class="form-row u-flex"> |
19 | <view class="v-input"><input type="text" v-model="loginForm.password" maxlength="32" placeholder="请输入登录密码" :password="!showPassword" /></view> | 18 | <view class="v-input"><input type="text" v-model="loginForm.password" maxlength="32" placeholder="请输入登录密码" :password="!showPassword" /></view> |
20 | - <view class="v-password" @click="showPasswordMode"><u-icon color="#9a9a9a" size="25" :name="showPassword ? 'eye-fill' : 'eye-off'"></u-icon></view> | 19 | + <view class="v-password" @click="showPasswordMode"> |
20 | + <u-icon color="#9a9a9a" width="18" height="15" :name="showPassword ? '/static/eye.png' : '/static/eye-hide.png'"></u-icon> | ||
21 | + </view> | ||
21 | <u-icon></u-icon> | 22 | <u-icon></u-icon> |
22 | </view> | 23 | </view> |
23 | <button class="submit" size="default" @click="onSubmitFunc"><text class="text">登录</text></button> | 24 | <button class="submit" size="default" @click="onSubmitFunc"><text class="text">登录</text></button> |
@@ -28,8 +29,7 @@ | @@ -28,8 +29,7 @@ | ||
28 | <view class="u-flex link-login"> | 29 | <view class="u-flex link-login"> |
29 | <view class="link-text login-text-gray">第三方账号登录</view> | 30 | <view class="link-text login-text-gray">第三方账号登录</view> |
30 | <view style="height:20rpx"></view> | 31 | <view style="height:20rpx"></view> |
31 | - <view @click="onAuthorization" class="link-image"><image class="image" src="../../static/weixin.png" mode="aspectFill"></image></view> | ||
32 | - <view class="circleStyleBottom"></view> | 32 | + <button class="link-image" @tap="onWenxinAuthorization"><image class="image" src="../../static/weixin.png" mode="aspectFill"></image></button> |
33 | </view> | 33 | </view> |
34 | </view> | 34 | </view> |
35 | </view> | 35 | </view> |
@@ -52,79 +52,59 @@ export default { | @@ -52,79 +52,59 @@ export default { | ||
52 | }, | 52 | }, |
53 | showPassword: false, | 53 | showPassword: false, |
54 | code: '', | 54 | code: '', |
55 | - openid: '', | ||
56 | - session_key: '' | 55 | + openid: '' |
57 | }; | 56 | }; |
58 | }, | 57 | }, |
59 | onLoad() { | 58 | onLoad() { |
60 | - //#ifdef MP-WEIXIN | ||
61 | wx.login({ | 59 | wx.login({ |
62 | success: res => { | 60 | success: res => { |
63 | if (res.code) { | 61 | if (res.code) { |
64 | this.code = res.code; | 62 | this.code = res.code; |
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 | - //设置全局变量openId | ||
73 | - getApp().globalData.openId = res.data.openid; | ||
74 | - } | ||
75 | - }, | ||
76 | - complete: e => { | ||
77 | - if (e.data.errcode != null) { | ||
78 | - return; | ||
79 | - // return uni.$u.toast('获取用户唯一id失败'); | ||
80 | - } | ||
81 | - } | ||
82 | - }); | 63 | + //这里获取openid |
83 | } else { | 64 | } else { |
65 | + return; | ||
84 | } | 66 | } |
85 | } | 67 | } |
86 | }); | 68 | }); |
87 | - //#endif | ||
88 | }, | 69 | }, |
89 | methods: { | 70 | methods: { |
90 | ...mapMutations(['setUserInfo']), | 71 | ...mapMutations(['setUserInfo']), |
91 | ...mapActions(['updateBadgeTotal']), | 72 | ...mapActions(['updateBadgeTotal']), |
92 | //微信授权登录 | 73 | //微信授权登录 |
93 | //#ifdef MP-WEIXIN | 74 | //#ifdef MP-WEIXIN |
94 | - onAuthorization() { | ||
95 | - /** | ||
96 | - * 注意:通过wx.getUserProfile并不能获取用户的openid,openid是唯一识别用户的标识, | ||
97 | - * 所以最好在用户授权登录时就获取。调用wx.login()获取 | ||
98 | - */ | 75 | + onWenxinAuthorization() { |
99 | wx.getUserProfile({ | 76 | wx.getUserProfile({ |
100 | - desc: '获取用户授权信息', | ||
101 | - success: res => { | ||
102 | - if (res) { | ||
103 | - //微信官方自带解密(node.js实现) | ||
104 | - let pc = new WXBizDataCrypt(appId, this.session_key); | ||
105 | - let data = pc.decryptData(res.encryptedData, res.iv); | 77 | + desc: '微信第三方授权', |
78 | + success: reswenxin => { | ||
79 | + console.log('res=======>', reswenxin); | ||
80 | + if (reswenxin.errMsg === 'getUserProfile:ok' && reswenxin.encryptedData) { | ||
81 | + console.log('获取code', this.code); | ||
82 | + //获取用户信息 | ||
106 | let obj = { | 83 | let obj = { |
107 | - avatarUrl: data.avatarUrl, | ||
108 | - nickName: data.nickName, | 84 | + avatarUrl: reswenxin.userInfo.avatarUrl, |
109 | thirdUserId: this.openid | 85 | thirdUserId: this.openid |
110 | }; | 86 | }; |
111 | //判断是否需要绑定 | 87 | //判断是否需要绑定 |
112 | uni.$u.http | 88 | uni.$u.http |
113 | - .get(`/yt/third/login/${this.openid}`) | 89 | + .get(`/yt/third/login/${this.code}`) |
114 | .then(res => { | 90 | .then(res => { |
115 | - if (res.token == '' || res.token == null) { | ||
116 | - //需要绑定,跳转我的页面进行绑定,显示绑定按钮 | ||
117 | - uni.reLaunch({ | ||
118 | - url: '../../pages/personal/personal' | ||
119 | - }); | 91 | + console.log('Res', res); |
92 | + //设置全局变量openId | ||
93 | + // getApp().globalData.openId = res.data.openid; | ||
94 | + if (res.token == '' || (res.token == null && res.refreshToken)) { | ||
95 | + //需要绑定 | ||
120 | let userInfo = { | 96 | let userInfo = { |
121 | - isThirdLogin: true, //token用于判断是否登录 | ||
122 | - avatar: data.avatarUrl | 97 | + isThirdLogin: true, //用于判断是否是第三方登录并且需要绑定账号 |
98 | + avatar: obj.avatarUrl | ||
123 | }; | 99 | }; |
124 | this.setUserInfo(userInfo); | 100 | this.setUserInfo(userInfo); |
101 | + //设置全局变量openId | ||
102 | + getApp().globalData.openId = res.refreshToken; | ||
103 | + uni.reLaunch({ | ||
104 | + url: '../../pages/personal/personal' | ||
105 | + }); | ||
125 | } else { | 106 | } else { |
126 | - // 不需要绑定 | ||
127 | - // 储存登录信息 | 107 | + // 不需要绑定,直接第三方登录使用 |
128 | let resObj = { | 108 | let resObj = { |
129 | refreshToken: res.refreshToken, | 109 | refreshToken: res.refreshToken, |
130 | isToken: res.token | 110 | isToken: res.token |
@@ -132,7 +112,7 @@ export default { | @@ -132,7 +112,7 @@ export default { | ||
132 | let userInfo = { | 112 | let userInfo = { |
133 | ...resObj, | 113 | ...resObj, |
134 | token: true, //token用于判断是否登录 | 114 | token: true, //token用于判断是否登录 |
135 | - isThirdLogin: false | 115 | + isThirdLoginAndNoDind: true //用于判断是否是第三方登录并且不需要绑定账号 |
136 | }; | 116 | }; |
137 | if (userInfo.token) { | 117 | if (userInfo.token) { |
138 | this.setUserInfo(userInfo); | 118 | this.setUserInfo(userInfo); |
@@ -151,18 +131,11 @@ export default { | @@ -151,18 +131,11 @@ export default { | ||
151 | .catch(e => { | 131 | .catch(e => { |
152 | uni.$u.toast(e.data?.message); | 132 | uni.$u.toast(e.data?.message); |
153 | }); | 133 | }); |
154 | - /** | ||
155 | - * 有些时候uni.navigatorBack({})没有返回到上级页面 | ||
156 | - * 才使用uni.reLaunch()进行跳转 | ||
157 | - */ | ||
158 | - // #ifdef MP | ||
159 | - setTimeout(() => { | ||
160 | - uni.reLaunch({ | ||
161 | - url: '../../pages/personal/personal?obj=' + encodeURIComponent(JSON.stringify(obj)) | ||
162 | - }); | ||
163 | - }, 500); | ||
164 | - // #endif | ||
165 | } | 134 | } |
135 | + }, | ||
136 | + fail: res => { | ||
137 | + //拒绝授权 | ||
138 | + return; | ||
166 | } | 139 | } |
167 | }); | 140 | }); |
168 | }, | 141 | }, |
@@ -243,14 +216,6 @@ export default { | @@ -243,14 +216,6 @@ export default { | ||
243 | uni.$u.toast(e.data?.message); | 216 | uni.$u.toast(e.data?.message); |
244 | }); | 217 | }); |
245 | }, | 218 | }, |
246 | - saveUserInfo() { | ||
247 | - //储存个人信息 | ||
248 | - uni.$u.http.get('/yt/user/me/info').then(res => { | ||
249 | - if (res) { | ||
250 | - this.setUserInfo(res); | ||
251 | - } | ||
252 | - }); | ||
253 | - }, | ||
254 | openCodeFunc() { | 219 | openCodeFunc() { |
255 | uni.navigateTo({ | 220 | uni.navigateTo({ |
256 | url: '../other/code' | 221 | url: '../other/code' |
@@ -270,4 +235,7 @@ export default { | @@ -270,4 +235,7 @@ export default { | ||
270 | 235 | ||
271 | <style lang="scss" scoped> | 236 | <style lang="scss" scoped> |
272 | @import './static/login.scss'; | 237 | @import './static/login.scss'; |
238 | +/deep/ button { | ||
239 | + background: rgba(0, 0, 0, 0); | ||
240 | +} | ||
273 | </style> | 241 | </style> |
1 | .login-page { | 1 | .login-page { |
2 | min-height: 100vh; | 2 | min-height: 100vh; |
3 | - background-color: #fff; | 3 | + width: 750rpx; |
4 | + background: url(/static/login.png) no-repeat; | ||
4 | .login-main { | 5 | .login-main { |
5 | flex-direction: column; | 6 | flex-direction: column; |
6 | .content { | 7 | .content { |
7 | height: 250rpx; | 8 | height: 250rpx; |
8 | margin-top: 90rpx; | 9 | margin-top: 90rpx; |
9 | margin-left: -107rpx; | 10 | margin-left: -107rpx; |
11 | + position: relative; | ||
12 | + top: 50rpx; | ||
13 | + left: -15rpx; | ||
10 | .hello { | 14 | .hello { |
11 | font-size: 30px; | 15 | font-size: 30px; |
12 | color: #3a4759; | 16 | color: #3a4759; |
@@ -21,16 +25,6 @@ | @@ -21,16 +25,6 @@ | ||
21 | } | 25 | } |
22 | } | 26 | } |
23 | } | 27 | } |
24 | - .circleStyle { | ||
25 | - position: absolute; | ||
26 | - width: 145rpx; | ||
27 | - height: 300rpx; | ||
28 | - left: -31rpx; | ||
29 | - top: 10rpx; | ||
30 | - border-radius: 0 100rpx 100rpx 0/0 150rpx 150rpx 0; | ||
31 | - background-color: #f0f2f5; | ||
32 | - opacity: 0.5; | ||
33 | - } | ||
34 | } | 28 | } |
35 | 29 | ||
36 | .f__login { | 30 | .f__login { |
@@ -47,7 +41,7 @@ | @@ -47,7 +41,7 @@ | ||
47 | margin-top: 60rpx; | 41 | margin-top: 60rpx; |
48 | .v-input { | 42 | .v-input { |
49 | width: 690rpx; | 43 | width: 690rpx; |
50 | - border-bottom: 2px solid #e5e5e5; | 44 | + border-bottom: 1px solid #e5e5e5; |
51 | } | 45 | } |
52 | .v-password { | 46 | .v-password { |
53 | position: absolute; | 47 | position: absolute; |
@@ -107,19 +101,4 @@ | @@ -107,19 +101,4 @@ | ||
107 | } | 101 | } |
108 | } | 102 | } |
109 | } | 103 | } |
110 | - .circleStyleBottom { | ||
111 | - position: absolute; | ||
112 | - width: 145rpx; | ||
113 | - height: 300rpx; | ||
114 | - right: -31rpx; | ||
115 | - top: 404rpx; | ||
116 | - //#ifndef MP | ||
117 | - top: 504rpx; | ||
118 | - //#endif | ||
119 | - border-radius: 0 100rpx 100rpx 0/0 150rpx 150rpx 0; | ||
120 | - background: linear-gradient(241deg, #00c9a7 0%, rgba(0, 223, 252, 0.5) 100%); | ||
121 | - opacity: 0.1; | ||
122 | - transform: rotate(180deg); | ||
123 | - z-index: -9999; | ||
124 | - } | ||
125 | } | 104 | } |
static/eye-hide.png
0 → 100644
822 Bytes
static/eye.png
0 → 100644
976 Bytes
static/login.png
0 → 100644
13 KB
@@ -14,6 +14,7 @@ export const mutations = { | @@ -14,6 +14,7 @@ export const mutations = { | ||
14 | // #endif | 14 | // #endif |
15 | // #ifndef H5 | 15 | // #ifndef H5 |
16 | uni.setStorageSync('userInfo', state.userInfo); | 16 | uni.setStorageSync('userInfo', state.userInfo); |
17 | + wx.setStorageSync('userInfo', state.userInfo); | ||
17 | // #endif | 18 | // #endif |
18 | } | 19 | } |
19 | }, | 20 | }, |
@@ -185,6 +185,13 @@ button { | @@ -185,6 +185,13 @@ button { | ||
185 | font-weight: 400; | 185 | font-weight: 400; |
186 | color: #333333 !important; | 186 | color: #333333 !important; |
187 | } | 187 | } |
188 | +.un-bind-text { | ||
189 | + font-size: 16px; | ||
190 | + font-family: PingFangSC-Regular, PingFang SC; | ||
191 | + font-weight: 400; | ||
192 | + // color: #333333; | ||
193 | + color: #ffffff; | ||
194 | +} | ||
188 | // 定义flex等分 | 195 | // 定义flex等分 |
189 | @for $i from 0 through 12 { | 196 | @for $i from 0 through 12 { |
190 | .u-flex-#{$i} { | 197 | .u-flex-#{$i} { |
@@ -13,9 +13,9 @@ | @@ -13,9 +13,9 @@ | ||
13 | </u-list> | 13 | </u-list> |
14 | <view class="bottom-text"> | 14 | <view class="bottom-text"> |
15 | <view class="u-flex column"> | 15 | <view class="u-flex column"> |
16 | - <text class="text">{{ notifyList.title }}</text> | 16 | + <text class="text" style="font-weight: bold;">{{ notifyList.title }}</text> |
17 | </view> | 17 | </view> |
18 | - <view style="margin-top: 20rpx;"> | 18 | + <view style="margin-top: 21rpx;"> |
19 | <!-- 富文本解析 --> | 19 | <!-- 富文本解析 --> |
20 | <u-parse :content="notifyList.content"></u-parse> | 20 | <u-parse :content="notifyList.content"></u-parse> |
21 | <!-- 富文本解析 --> | 21 | <!-- 富文本解析 --> |
@@ -2,9 +2,11 @@ | @@ -2,9 +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;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> | 5 | + <view style="width: 750rpx;height:53rpx;background-color: #f8f9fa;position:fixed;top:0;z-index: 99999;"> |
6 | + <view @click="openTypeClick" style="background-color: #f8f9fa;width: 700rpx;position: relative;top: 10rpx;"> | ||
7 | + <u--input suffixIcon="arrow-down" shape="circle" disabled v-model="model1.userInfo.type" placeholder="请选择类型" border="surround"></u--input> | ||
8 | + <u-action-sheet :show="showType" :actions="actions" title="请选择类型" @close="showType = false" @select="typeSelect"></u-action-sheet> | ||
9 | + </view> | ||
8 | </view> | 10 | </view> |
9 | <view style="height: 76rpx;"></view> | 11 | <view style="height: 76rpx;"></view> |
10 | <view class="notify-main"> | 12 | <view class="notify-main"> |
@@ -82,7 +84,8 @@ export default { | @@ -82,7 +84,8 @@ export default { | ||
82 | onShow() { | 84 | onShow() { |
83 | this.pre = uni.getStorageSync('storagePre'); | 85 | this.pre = uni.getStorageSync('storagePre'); |
84 | if (this.pre) { | 86 | if (this.pre) { |
85 | - this.loadData(1); | 87 | + this.page.num = 1; |
88 | + this.loadData(this.page.num); | ||
86 | } | 89 | } |
87 | }, | 90 | }, |
88 | onHide() { | 91 | onHide() { |
@@ -97,19 +100,11 @@ export default { | @@ -97,19 +100,11 @@ export default { | ||
97 | uni.hideKeyboard(); | 100 | uni.hideKeyboard(); |
98 | }, | 101 | }, |
99 | typeSelect(e) { | 102 | typeSelect(e) { |
100 | - this.topBack(); | ||
101 | this.isJudgeNextPage = e.value; | 103 | this.isJudgeNextPage = e.value; |
102 | this.page.num = 1; | 104 | this.page.num = 1; |
103 | this.model1.userInfo.type = e.name; | 105 | this.model1.userInfo.type = e.name; |
104 | this.loadData(1, this.isJudgeNextPage == '' ? null : this.isJudgeNextPage); | 106 | this.loadData(1, this.isJudgeNextPage == '' ? null : this.isJudgeNextPage); |
105 | }, | 107 | }, |
106 | - //筛选数据让它回到顶部 | ||
107 | - topBack() { | ||
108 | - uni.pageScrollTo({ | ||
109 | - scrollTop: 0, // 滚动到页面的目标位置 这个是滚动到顶部, 0 | ||
110 | - duration: 300 // 滚动动画的时长 | ||
111 | - }); | ||
112 | - }, | ||
113 | /*下拉刷新的回调 */ | 108 | /*下拉刷新的回调 */ |
114 | downCallback() { | 109 | downCallback() { |
115 | //联网加载数据 | 110 | //联网加载数据 |