Commit fbdfab0191d7f311e421b55e610867668c13871a
Merge branch 'ft-dev' into 'main'
fix:修改第三方登录获取openid 合并冲突 See merge request huang/thingskit-app!46
Showing
12 changed files
with
78 additions
and
122 deletions
... | ... | @@ -71,11 +71,26 @@ |
71 | 71 | </view> |
72 | 72 | <!-- #endif --> |
73 | 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"> | |
74 | + <view | |
75 | + :style="[ | |
76 | + { position: list.status !== 'CLEARED_ACK' && list.status !== 'ACTIVE_ACK' ? 'relative' : '' }, | |
77 | + { right: list.status !== 'CLEARED_ACK' && list.status !== 'ACTIVE_ACK' ? '-210rpx' : '' } | |
78 | + ]" | |
79 | + v-if="list.status !== 'CLEARED_ACK' && list.status !== 'ACTIVE_ACK'" | |
80 | + class="u-flex" | |
81 | + style="width: 260rpx" | |
82 | + > | |
75 | 83 | <u-button @click="handleSubmit" type="primary" shape="circle" text="处理"></u-button> |
76 | 84 | </view> |
77 | 85 | <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> | |
86 | + <view | |
87 | + :style="[{ position: list.status == 'ACTIVE_ACK' ? 'relative' : '' }, { right: list.status == 'ACTIVE_ACK' ? '207rpx' : '' }]" | |
88 | + v-if="list.status == 'ACTIVE_ACK'" | |
89 | + class="u-flex" | |
90 | + style="width: 260rpx" | |
91 | + > | |
92 | + <u-button @click="handleRemove" type="error" shape="circle" text="清除"></u-button> | |
93 | + </view> | |
79 | 94 | </view> |
80 | 95 | </view> |
81 | 96 | </template> |
... | ... | @@ -126,7 +141,7 @@ export default { |
126 | 141 | uni.$u.toast(e.data?.message); |
127 | 142 | }); |
128 | 143 | }, |
129 | - //清除 | |
144 | + // 清除 | |
130 | 145 | handleRemove() { |
131 | 146 | uni.$u.http |
132 | 147 | .post(`/alarm/${this.list.id}/clear`) | ... | ... |
1 | 1 | <template> |
2 | - <view class="alert-page"> | |
2 | + <view class="alert-page" :class="show ? 'pop-no-scroll' : ''"> | |
3 | 3 | <!-- 公共组件-每个页面必须引入 --> |
4 | 4 | <public-module></public-module> |
5 | 5 | <!-- 吸顶组件 --> |
... | ... | @@ -278,6 +278,9 @@ export default { |
278 | 278 | } |
279 | 279 | }, |
280 | 280 | methods: { |
281 | + moveHandle() { | |
282 | + return false; | |
283 | + }, | |
281 | 284 | inputChanged(e) { |
282 | 285 | this.resetData(); |
283 | 286 | this.topBack(); |
... | ... | @@ -514,4 +517,10 @@ export default { |
514 | 517 | /deep/ .uni-calendar--fixed { |
515 | 518 | bottom: 172rpx !important; |
516 | 519 | } |
520 | +.pop-no-scroll { | |
521 | + overflow: hidden; | |
522 | + position: fixed; | |
523 | + height: 100%; | |
524 | + width: 100%; | |
525 | +} | |
517 | 526 | </style> | ... | ... |
... | ... | @@ -7,17 +7,17 @@ |
7 | 7 | <!-- 登录 --> |
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 | - <view @click="openPersonalInfo" class="u-m-r-20"> | |
10 | + <view @click.top="openPersonalInfo" class="u-m-r-20"> | |
11 | 11 | <image class="avatar" mode="aspectFill" :src="!userInfo.avatar ? '../../static/logo.png' : userInfo.avatar || thirdObj.avatarUrl"></image> |
12 | 12 | </view> |
13 | - <view class="u-flex-1"> | |
13 | + <view class="u-flex-1" @click.top="openPersonalInfo"> | |
14 | 14 | <view class="nickName u-flex"> |
15 | - <view @click="openPersonalInfo" class="name u-m-r-10" v-if="userInfo.realName || userInfo.nickName"> | |
15 | + <view class="name u-m-r-10" v-if="userInfo.realName || userInfo.nickName"> | |
16 | 16 | <text style="#FFFFFF;font-size: 18px;">{{ userInfo.realName || userInfo.nickName }}</text> |
17 | 17 | </view> |
18 | - <view v-if="userInfo.isThirdLogin" @click="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view> | |
18 | + <view v-if="userInfo.isThirdLogin" @click.stop="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view> | |
19 | 19 | </view> |
20 | - <view @click="openPersonalInfo" style="color:#FFFFFF;font-size: 14px;" v-if="userInfo.phoneNumber">{{ userInfo.phoneNumber | phone }}</view> | |
20 | + <view style="color:#FFFFFF;font-size: 14px;" v-if="userInfo.phoneNumber">{{ userInfo.phoneNumber | phone }}</view> | |
21 | 21 | </view> |
22 | 22 | </block> |
23 | 23 | <block v-else> | ... | ... |
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <public-module></public-module> |
5 | 5 | <view class="f__login"> |
6 | 6 | <view class="loginPhone"> |
7 | - <view class="phone-main" style="margin-top: 173rpx;"> | |
7 | + <view class="phone-main" style="margin-top: 240rpx;"> | |
8 | 8 | <text class="text">手机验证码登录</text> |
9 | 9 | <view class="circleStyle"></view> |
10 | 10 | </view> | ... | ... |
... | ... | @@ -46,10 +46,14 @@ |
46 | 46 | </u--form> |
47 | 47 | </view> |
48 | 48 | <view class="basic-bottom u-flex"> |
49 | - <view class="item" v-if="info.data.isThirdLogin"> | |
49 | + <view class="item" v-if="info.data.isThirdLoginAndNoDind"> | |
50 | 50 | <button class="submit" size="default" @click="clearAccountFunc" :style="{ background: InfoColor }"><text class="un-bind-text">解绑</text></button> |
51 | 51 | </view> |
52 | - <view class="item" style="margin-right: 60rpx;" :style="[{ position: info.data.isThirdLogin ? '' : 'relative' }, { right: info.data.isThirdLogin ? '' : '-190rpx' }]"> | |
52 | + <view | |
53 | + class="item" | |
54 | + style="margin-right: 60rpx;" | |
55 | + :style="[{ position: info.data.isThirdLoginAndNoDind ? '' : 'relative' }, { right: info.data.isThirdLoginAndNoDind ? '' : '-190rpx' }]" | |
56 | + > | |
53 | 57 | <button class="submit" size="default" @click="onSubmitFunc" :style="{ background: PrimaryColor }"><text class="un-bind-text">确认</text></button> |
54 | 58 | </view> |
55 | 59 | </view> |
... | ... | @@ -116,6 +120,7 @@ export default { |
116 | 120 | let getOpenId = getApp().globalData.openId; |
117 | 121 | if (getOpenId) { |
118 | 122 | this.openIds = getOpenId; |
123 | + console.log('OPenid', this.openIds); | |
119 | 124 | } |
120 | 125 | }, |
121 | 126 | computed: { |
... | ... | @@ -128,7 +133,7 @@ export default { |
128 | 133 | //解绑 |
129 | 134 | let httpData = { |
130 | 135 | appUserId: e.data?.userId, |
131 | - thirdUserId: e.third?.thirdUserId == null ? this.openIds : e.third?.thirdUserId | |
136 | + thirdUserId: e.data?.thirdUserId == null ? this.openIds : e.data?.thirdUserId | |
132 | 137 | }; |
133 | 138 | uni.$u.http.delete('/yt/third', httpData).then(res => { |
134 | 139 | if (res) { | ... | ... |
1 | 1 | .code-page { |
2 | 2 | min-height: 100vh; |
3 | 3 | background-color: #fff; |
4 | + width: 750rpx; | |
5 | + background: url(/static/login.png) no-repeat; | |
4 | 6 | } |
5 | 7 | .f__login { |
6 | 8 | padding: 48rpx 32rpx; |
... | ... | @@ -19,18 +21,7 @@ |
19 | 21 | font-family: PingFangSC-Semibold, PingFang SC; |
20 | 22 | font-weight: 600; |
21 | 23 | } |
22 | - .circleStyle { | |
23 | - position: absolute; | |
24 | - width: 145rpx; | |
25 | - height: 300rpx; | |
26 | - left: -31rpx; | |
27 | - top: 10rpx; | |
28 | - border-radius: 0 100rpx 100rpx 0/0 150rpx 150rpx 0; | |
29 | - background-color: #f0f2f5; | |
30 | - opacity: 0.5; | |
31 | - } | |
32 | 24 | } |
33 | - | |
34 | 25 | .form-row { |
35 | 26 | position: relative; |
36 | 27 | border-bottom: 1rpx solid #e8e8e8; |
... | ... | @@ -45,7 +36,6 @@ |
45 | 36 | padding: 0; |
46 | 37 | font-weight: bold; |
47 | 38 | } |
48 | - | |
49 | 39 | .getvcode { |
50 | 40 | font-family: PingFangSC-Regular, PingFang SC; |
51 | 41 | font-weight: 400; |
... | ... | @@ -53,7 +43,6 @@ |
53 | 43 | height: 80rpx; |
54 | 44 | color: #6299ff; |
55 | 45 | line-height: 80rpx; |
56 | - // background: #eee; | |
57 | 46 | min-width: 188rpx; |
58 | 47 | text-align: center; |
59 | 48 | border-radius: 8rpx; |
... | ... | @@ -64,12 +53,9 @@ |
64 | 53 | z-index: 11; |
65 | 54 | |
66 | 55 | &.forhidden { |
67 | - // background: #eee; | |
68 | - // color: #cccccc; | |
69 | 56 | } |
70 | 57 | } |
71 | 58 | } |
72 | - | |
73 | 59 | .submit { |
74 | 60 | margin-top: 60rpx; |
75 | 61 | width: 100%; |
... | ... | @@ -80,20 +66,6 @@ |
80 | 66 | color: #ffffff; |
81 | 67 | } |
82 | 68 | } |
83 | - .circleStyleBottom { | |
84 | - position: absolute; | |
85 | - width: 145rpx; | |
86 | - height: 300rpx; | |
87 | - right: -31rpx; | |
88 | - top: 804rpx; | |
89 | - //#ifndef MP | |
90 | - top: 804rpx; | |
91 | - //#endif | |
92 | - border-radius: 0 100rpx 100rpx 0/0 150rpx 150rpx 0; | |
93 | - background: linear-gradient(241deg, #00c9a7 0%, rgba(0, 223, 252, 0.5) 100%); | |
94 | - opacity: 0.1; | |
95 | - transform: rotate(180deg); | |
96 | - } | |
97 | 69 | .account-style { |
98 | 70 | flex-direction: row; |
99 | 71 | margin-top: 48rpx; | ... | ... |
1 | 1 | <template> |
2 | 2 | <view class="login-page"> |
3 | 3 | <!-- 公共组件-每个页面必须引入 --> |
4 | - | |
5 | 4 | <public-module></public-module> |
6 | - | |
7 | 5 | <view class="u-flex login-main"> |
8 | 6 | <view class="content"> |
9 | 7 | <view class="hello login-text-muted">您好,</view> |
... | ... | @@ -11,17 +9,15 @@ |
11 | 9 | <view class="hello-welcome login-text-muted">欢迎来到ThingsKit!</view> |
12 | 10 | </view> |
13 | 11 | </view> |
14 | - | |
15 | 12 | <view class="f__login"> |
16 | 13 | <view class="loginPhone"> |
17 | 14 | <view class="form-row u-flex"> |
18 | 15 | <view class="v-input"><input type="text" v-model="loginForm.username" maxlength="32" placeholder="请输入登录账号" /></view> |
19 | 16 | <u-icon></u-icon> |
20 | 17 | </view> |
21 | - | |
22 | 18 | <view class="form-row u-flex"> |
23 | 19 | <view class="v-input"><input type="text" v-model="loginForm.password" maxlength="32" placeholder="请输入登录密码" :password="!showPassword" /></view> |
24 | - <view class="v-password" style="padding: 30rpx;" @click="showPasswordMode"> | |
20 | + <view class="v-password" style="padding: 30rpx" @click="showPasswordMode"> | |
25 | 21 | <u-icon color="#9a9a9a" :name="showPassword ? '/static/eye.png' : '/static/eye-hide.png'"></u-icon> |
26 | 22 | </view> |
27 | 23 | |
... | ... | @@ -50,13 +46,9 @@ |
50 | 46 | |
51 | 47 | <script> |
52 | 48 | import { mapMutations, mapActions } from 'vuex'; |
53 | - | |
54 | 49 | import { loginApp } from '@/config/login'; |
55 | - | |
56 | 50 | import baseUrl from '@/config/baseUrl.js'; |
57 | - | |
58 | 51 | import WXBizDataCrypt from '@/config/WXBizDataCrypt.js'; |
59 | - | |
60 | 52 | import { appId, appSecrect } from '@/config/constant.js'; |
61 | 53 | |
62 | 54 | export default { |
... | ... | @@ -67,21 +59,16 @@ export default { |
67 | 59 | |
68 | 60 | password: '' |
69 | 61 | }, |
70 | - | |
71 | 62 | showPassword: false, |
72 | - | |
73 | 63 | code: '', |
74 | - | |
75 | 64 | openid: '' |
76 | 65 | }; |
77 | 66 | }, |
78 | - | |
79 | 67 | onLoad() { |
80 | 68 | wx.login({ |
81 | 69 | success: res => { |
82 | 70 | if (res.code) { |
83 | 71 | this.code = res.code; |
84 | - | |
85 | 72 | //这里获取openid |
86 | 73 | } else { |
87 | 74 | return; |
... | ... | @@ -92,93 +79,59 @@ export default { |
92 | 79 | |
93 | 80 | methods: { |
94 | 81 | ...mapMutations(['setUserInfo']), |
95 | - | |
96 | 82 | ...mapActions(['updateBadgeTotal']), |
97 | - | |
98 | 83 | //微信授权登录 |
99 | - | |
100 | 84 | //#ifdef MP-WEIXIN |
101 | - | |
102 | 85 | onWenxinAuthorization() { |
103 | 86 | wx.getUserProfile({ |
104 | 87 | desc: '微信第三方授权', |
105 | - | |
106 | 88 | success: reswenxin => { |
107 | - console.log('res=======>', reswenxin); | |
108 | - | |
109 | 89 | if (reswenxin.errMsg === 'getUserProfile:ok' && reswenxin.encryptedData) { |
110 | - console.log('获取code', this.code); | |
111 | - | |
112 | 90 | //获取用户信息 |
113 | - | |
114 | 91 | let obj = { |
115 | 92 | avatarUrl: reswenxin.userInfo.avatarUrl, |
116 | - | |
117 | 93 | thirdUserId: this.openid |
118 | 94 | }; |
119 | - | |
120 | 95 | //判断是否需要绑定 |
121 | - | |
122 | 96 | uni.$u.http |
123 | - | |
124 | 97 | .get(`/yt/third/login/${this.code}`) |
125 | - | |
126 | 98 | .then(res => { |
127 | - console.log('Res', res); | |
128 | - | |
129 | - //设置全局变量openId | |
130 | - | |
131 | - // getApp().globalData.openId = res.data.openid; | |
132 | - | |
133 | - if (res.token == '' || (res.token == null && res.refreshToken)) { | |
99 | + if (res.token == '' || (res.token == null && res.thirdUserId)) { | |
134 | 100 | //需要绑定 |
135 | - | |
136 | 101 | let userInfo = { |
137 | 102 | isThirdLogin: true, //用于判断是否是第三方登录并且需要绑定账号 |
138 | - | |
139 | - avatar: obj.avatarUrl | |
103 | + avatar: obj.avatarUrl, | |
104 | + thirdUserId: res.thirdUserId | |
140 | 105 | }; |
141 | - | |
142 | 106 | this.setUserInfo(userInfo); |
143 | - | |
144 | 107 | //设置全局变量openId |
145 | - | |
146 | - getApp().globalData.openId = res.refreshToken; | |
147 | - | |
108 | + getApp().globalData.openId = res.thirdUserId; | |
148 | 109 | uni.reLaunch({ |
149 | 110 | url: '../../pages/personal/personal' |
150 | 111 | }); |
151 | 112 | } else { |
152 | 113 | // 不需要绑定,直接第三方登录使用 |
153 | - | |
154 | 114 | let resObj = { |
155 | 115 | refreshToken: res.refreshToken, |
156 | - | |
157 | 116 | isToken: res.token |
158 | 117 | }; |
159 | - | |
160 | 118 | let userInfo = { |
161 | 119 | ...resObj, |
162 | - | |
163 | 120 | token: true, //token用于判断是否登录 |
164 | - | |
165 | - isThirdLoginAndNoDind: true //用于判断是否是第三方登录并且不需要绑定账号 | |
121 | + isThirdLoginAndNoDind: true, //用于判断是否是第三方登录并且不需要绑定账号 | |
122 | + thirdUserId: res.thirdUserId | |
166 | 123 | }; |
167 | - | |
124 | + //设置全局变量openId | |
125 | + getApp().globalData.openId = res.thirdUserId; | |
168 | 126 | if (userInfo.token) { |
169 | 127 | this.setUserInfo(userInfo); |
170 | 128 | } |
171 | - | |
172 | 129 | uni.showToast({ |
173 | 130 | title: '第三方账号登录成功~', |
174 | - | |
175 | 131 | icon: 'none' |
176 | 132 | }); |
177 | - | |
178 | 133 | this.saveUserInfo(); |
179 | - | |
180 | 134 | this.getAlarmTotalData(); |
181 | - | |
182 | 135 | uni.reLaunch({ |
183 | 136 | url: '../../pages/personal/personal' |
184 | 137 | }); |
... | ... | @@ -210,7 +163,6 @@ export default { |
210 | 163 | } |
211 | 164 | }); |
212 | 165 | }, |
213 | - | |
214 | 166 | async getAlarmTotalData() { |
215 | 167 | const res = await uni.$u.http.get('/yt/homepage/app'); |
216 | 168 | if (res) { |
... | ... | @@ -218,7 +170,6 @@ export default { |
218 | 170 | this.updateBadgeTotal(res.totalAlarm.activedAlarm); |
219 | 171 | } |
220 | 172 | }, |
221 | - | |
222 | 173 | onSubmitFunc() { |
223 | 174 | if (this.loginForm.username == '') { |
224 | 175 | return uni.$u.toast('请输入登录账号~'); |
... | ... | @@ -268,19 +219,17 @@ export default { |
268 | 219 | this.setUserInfo(userInfo); |
269 | 220 | } |
270 | 221 | |
271 | - uni | |
272 | - .showToast({ | |
273 | - title: '登录成功~', | |
222 | + uni.showToast({ | |
223 | + title: '登录成功~', | |
274 | 224 | |
275 | - icon: 'none' | |
276 | - }) | |
277 | - .then(async res => { | |
278 | - this.saveUserInfo(); | |
279 | - await this.getAlarmTotalData(); | |
280 | - uni.reLaunch({ | |
281 | - url: '/pages/personal/personal' | |
282 | - }); | |
225 | + icon: 'none' | |
226 | + }).then(async res => { | |
227 | + this.saveUserInfo(); | |
228 | + await this.getAlarmTotalData(); | |
229 | + uni.reLaunch({ | |
230 | + url: '/pages/personal/personal' | |
283 | 231 | }); |
232 | + }); | |
284 | 233 | } |
285 | 234 | }) |
286 | 235 | |
... | ... | @@ -288,19 +237,16 @@ export default { |
288 | 237 | uni.$u.toast(e.data?.message); |
289 | 238 | }); |
290 | 239 | }, |
291 | - | |
292 | 240 | openCodeFunc() { |
293 | 241 | uni.navigateTo({ |
294 | 242 | url: '../other/code' |
295 | 243 | }); |
296 | 244 | }, |
297 | - | |
298 | 245 | findPassrordFunc() { |
299 | 246 | uni.navigateTo({ |
300 | 247 | url: '../other/findPassword' |
301 | 248 | }); |
302 | 249 | }, |
303 | - | |
304 | 250 | showPasswordMode() { |
305 | 251 | this.showPassword = !this.showPassword; |
306 | 252 | } |
... | ... | @@ -314,4 +260,4 @@ export default { |
314 | 260 | /deep/ button { |
315 | 261 | background: rgba(0, 0, 0, 0); |
316 | 262 | } |
317 | -</style> | |
263 | +</style> | ... | ... |
... | ... | @@ -192,6 +192,13 @@ button { |
192 | 192 | // color: #333333; |
193 | 193 | color: #ffffff; |
194 | 194 | } |
195 | + | |
196 | +.notify-detail-text { | |
197 | + font-size: 16px; | |
198 | + font-family: PingFangSC-Regular, PingFang SC; | |
199 | + font-weight: bold; | |
200 | + color: #333333; | |
201 | +} | |
195 | 202 | // 定义flex等分 |
196 | 203 | @for $i from 0 through 12 { |
197 | 204 | .u-flex-#{$i} { | ... | ... |
... | ... | @@ -4,6 +4,10 @@ |
4 | 4 | <public-module></public-module> |
5 | 5 | <view class="notify-column"> |
6 | 6 | <view class="column-list"> |
7 | + <view style="margin-left: 36rpx;position: relative;top: 21rpx;"> | |
8 | + <text class="notify-detail-text">{{ notifyList.title }}</text> | |
9 | + </view> | |
10 | + <view style="height: 25rpx;"></view> | |
7 | 11 | <u-list height="140rpx"> |
8 | 12 | <u-list-item> |
9 | 13 | <u-cell :value="`${notifyList.senderDate}`" :title="`${notifyList.senderName}`"> |
... | ... | @@ -12,9 +16,7 @@ |
12 | 16 | </u-list-item> |
13 | 17 | </u-list> |
14 | 18 | <view class="bottom-text"> |
15 | - <view class="u-flex column"> | |
16 | - <text class="text" style="font-weight: bold;">{{ notifyList.title }}</text> | |
17 | - </view> | |
19 | + <view class="u-flex column"></view> | |
18 | 20 | <view style="margin-top: 21rpx;"> |
19 | 21 | <!-- 富文本解析 --> |
20 | 22 | <u-parse :content="notifyList.content"></u-parse> | ... | ... |
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <!-- 公共组件-每个页面必须引入 --> |
4 | 4 | <public-module></public-module> |
5 | 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;"> | |
6 | + <view @click="openTypeClick" style="background-color: #f8f9fa;width: 700rpx;position: relative;top: 16rpx;"> | |
7 | 7 | <u--input suffixIcon="arrow-down" shape="circle" disabled v-model="model1.userInfo.type" placeholder="请选择类型" border="surround"></u--input> |
8 | 8 | <u-action-sheet :show="showType" :actions="actions" title="请选择类型" @close="showType = false" @select="typeSelect"></u-action-sheet> |
9 | 9 | </view> | ... | ... |