Commit e6a9cc83a789b214fa3acfaf1787db72b5eb0de1
Merge branch 'sqy_dev' into 'main'
修改滚动的一系列问题,和其他问题 See merge request huang/thingskit-app!51
Showing
10 changed files
with
1054 additions
and
1119 deletions
1 | 1 | <template> |
2 | 2 | <view class="command-record"> |
3 | - <!-- 公共组件-每个页面必须引入 --> | |
4 | - <public-module></public-module> | |
5 | - <view class="search"> | |
6 | - <view> | |
7 | - <view class="search-left"><u--input prefixIcon="search" placeholder="请输入名称搜索" shape="circle" @change="inputChanged"></u--input></view> | |
8 | - </view> | |
9 | - <view @click="openSearchDialog" class="search-right"> | |
10 | - <text>筛选</text> | |
11 | - <image src="../../../static/shaixuan.png" /> | |
12 | - </view> | |
3 | + <view class="filter-button" @click="openSearchDialog"> | |
4 | + <text>筛选</text> | |
5 | + <image src="../../../static/shaixuan.png" /> | |
13 | 6 | </view> |
14 | - <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"> | |
7 | + | |
8 | + <mescroll-uni ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback" height="700px"> | |
15 | 9 | <view @click="openCommandDetail(item)" class="list-item" v-for="(item, index) in list" :key="index"> |
16 | 10 | <view class="item"> |
17 | 11 | <view class="item-first"> |
... | ... | @@ -30,10 +24,10 @@ |
30 | 24 | <view class="time">{{ format(item.createTime) }}</view> |
31 | 25 | </view> |
32 | 26 | </view> |
33 | - </mescroll-body> | |
27 | + </mescroll-uni> | |
34 | 28 | <!-- 告警筛选 --> |
35 | - <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20" @touchmove.stop.prevent="disabledScroll"> | |
36 | - <view class="filter" @touchmove.stop.prevent="disabledScroll"> | |
29 | + <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20" @touchmove.stop.prevent="disabledScroll"> | |
30 | + <view class="filter" @touchmove.stop.prevent="disabledScroll"> | |
37 | 31 | <view class="filter-title"><text>筛选条件</text></view> |
38 | 32 | <FilterItem :filterList="issueStatus" title="下发状态" @clickTag="currentIndex => handleClickTag(currentIndex, issueStatus)"></FilterItem> |
39 | 33 | <view class="button-group"> |
... | ... | @@ -58,6 +52,7 @@ |
58 | 52 | import FilterItem from '@/pages/device/FilterItem.vue'; |
59 | 53 | import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; |
60 | 54 | import { formatToDate } from '@/plugins/utils.js'; |
55 | +import { debounce } from '@/plugins/throttle.js'; | |
61 | 56 | export default { |
62 | 57 | mixins: [MescrollMixin], |
63 | 58 | components: { |
... | ... | @@ -118,7 +113,7 @@ export default { |
118 | 113 | format(date) { |
119 | 114 | return formatToDate(date, 'YYYY-MM-DD HH:mm:ss'); |
120 | 115 | }, |
121 | - disabledScroll(){ | |
116 | + disabledScroll() { | |
122 | 117 | return; |
123 | 118 | }, |
124 | 119 | /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */ |
... | ... | @@ -184,7 +179,6 @@ export default { |
184 | 179 | }, |
185 | 180 | confirmFilter() { |
186 | 181 | const issueStatus = this.issueStatus.find(item => item.checked); |
187 | - console.log('--------',this.tbDeviceId) | |
188 | 182 | this.loadData(1, { |
189 | 183 | status: issueStatus.type ? issueStatus.type : undefined, |
190 | 184 | tbDeviceId: this.tbDeviceId |
... | ... | @@ -205,76 +199,69 @@ export default { |
205 | 199 | |
206 | 200 | <style lang="scss" scoped> |
207 | 201 | .command-record { |
208 | - padding: 0 20rpx; | |
209 | - .search { | |
202 | + padding: 0 30rpx; | |
203 | + .filter-button { | |
204 | + font-size: 12px; | |
205 | + width: 160rpx; | |
206 | + height: 64rpx; | |
207 | + border-radius: 32rpx; | |
210 | 208 | display: flex; |
211 | - justify-content: space-between; | |
212 | - padding-bottom: 10rpx; | |
213 | - border-bottom: 1px solid #f5f5f5; | |
214 | - .search-left { | |
215 | - width: 580rpx; | |
216 | - background-color: #f8f9fa; | |
217 | - border-radius: 200rpx; | |
218 | - } | |
219 | - .search-right { | |
220 | - display: flex; | |
221 | - align-items: center; | |
222 | - text { | |
223 | - color: #333; | |
224 | - font-size: 14px; | |
225 | - } | |
226 | - image { | |
227 | - width: 40rpx; | |
228 | - height: 40rpx; | |
229 | - } | |
209 | + justify-content: center; | |
210 | + align-items: center; | |
211 | + background: #f0f1f2; | |
212 | + color: #666; | |
213 | + image { | |
214 | + width: 28rpx; | |
215 | + height: 28rpx; | |
216 | + margin-left: 4rpx; | |
230 | 217 | } |
231 | 218 | } |
219 | +} | |
232 | 220 | |
233 | - .list-item { | |
234 | - width: 690rpx; | |
235 | - background-color: #fff; | |
236 | - border-radius: 20rpx; | |
237 | - margin: 0 auto; | |
238 | - margin-bottom: 20rpx; | |
239 | - color: #333; | |
240 | - .item { | |
241 | - padding: 30rpx; | |
242 | - view { | |
243 | - font-size: 14px; | |
244 | - margin-bottom: 10rpx; | |
245 | - } | |
246 | - .time { | |
247 | - margin-top: 20rpx; | |
248 | - color: #999; | |
249 | - } | |
250 | - .item-first { | |
221 | +.list-item { | |
222 | + width: 690rpx; | |
223 | + background-color: #fff; | |
224 | + border-radius: 20rpx; | |
225 | + margin: 20rpx auto; | |
226 | + color: #333; | |
227 | + .item { | |
228 | + padding: 30rpx; | |
229 | + view { | |
230 | + font-size: 14px; | |
231 | + margin-bottom: 10rpx; | |
232 | + } | |
233 | + .time { | |
234 | + margin-top: 20rpx; | |
235 | + color: #999; | |
236 | + } | |
237 | + .item-first { | |
238 | + display: flex; | |
239 | + justify-content: space-between; | |
240 | + align-items: center; | |
241 | + font-size: 15px; | |
242 | + font-weight: 500; | |
243 | + align-items: center; | |
244 | + .item-right { | |
251 | 245 | display: flex; |
252 | - justify-content: space-between; | |
246 | + justify-content: center; | |
253 | 247 | align-items: center; |
254 | - font-size: 15px; | |
255 | - font-weight: 500; | |
256 | - align-items: center; | |
257 | - .item-right { | |
258 | - display: flex; | |
259 | - justify-content: center; | |
260 | - align-items: center; | |
261 | - width: 104rpx; | |
262 | - height: 36rpx; | |
263 | - font-size: 10px; | |
264 | - border-radius: 20rpx; | |
265 | - } | |
266 | - .item-fail { | |
267 | - color: #848383; | |
268 | - background-color: #84838325; | |
269 | - } | |
270 | - .item.success { | |
271 | - color: #00c9a7; | |
272 | - background-color: #00c9a725; | |
273 | - } | |
248 | + width: 104rpx; | |
249 | + height: 36rpx; | |
250 | + font-size: 10px; | |
251 | + border-radius: 20rpx; | |
252 | + } | |
253 | + .item-fail { | |
254 | + color: #848383; | |
255 | + background-color: #84838325; | |
274 | 256 | } |
257 | + .item.success { | |
258 | + color: #00c9a7; | |
259 | + background-color: #00c9a725; | |
260 | + } | |
275 | 261 | } |
276 | 262 | } |
277 | 263 | } |
264 | + | |
278 | 265 | .filter { |
279 | 266 | padding: 0 30rpx; |
280 | 267 | .filter-title { | ... | ... |
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | <image src="../../../static/shaixuan.png" /> |
6 | 6 | </view> |
7 | 7 | |
8 | - <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"> | |
8 | + <mescroll-uni ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback" height="700px"> | |
9 | 9 | <view @click="openDeviceDetail(item)" class="list-item" v-for="(item, index) in list" :key="index"> |
10 | 10 | <view class="item"> |
11 | 11 | <view class="item-first"> |
... | ... | @@ -56,9 +56,9 @@ |
56 | 56 | <view class="time">{{ item.createdTime }}</view> |
57 | 57 | </view> |
58 | 58 | </view> |
59 | - </mescroll-body> | |
59 | + </mescroll-uni> | |
60 | 60 | <!-- 告警筛选 --> |
61 | - <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20" @touchmove.stop.prevent="disabledScroll"> | |
61 | + <u-popup @close="close" closeable bgColor="#fff" :show="show" mode="bottom" :round="20" @touchmove.stop.prevent="disabledScroll"> | |
62 | 62 | <view class="filter" @touchmove.stop.prevent="disabledScroll"> |
63 | 63 | <view class="filter-title"><text>筛选条件</text></view> |
64 | 64 | <FilterItem :filterList="alarmStatus" title="告警状态" @clickTag="currentIndex => handleClickTag(currentIndex, alarmStatus)"></FilterItem> |
... | ... | @@ -224,7 +224,7 @@ export default { |
224 | 224 | }; |
225 | 225 | }, |
226 | 226 | methods: { |
227 | - disabledScroll(){ | |
227 | + disabledScroll() { | |
228 | 228 | return; |
229 | 229 | }, |
230 | 230 | /*下拉刷新的回调 */ |
... | ... | @@ -409,4 +409,4 @@ export default { |
409 | 409 | } |
410 | 410 | } |
411 | 411 | } |
412 | -</style> | |
412 | +</style> | ... | ... |
... | ... | @@ -29,10 +29,11 @@ |
29 | 29 | canvas2d |
30 | 30 | canvasId="daskujdhasljkdcnzjkdfhuoqwlqwjhkdsamjczxnmdasd123321" |
31 | 31 | :chartData="chartData" |
32 | - :opts="{ xAxis: { disabled: true }, legend: { show: false } }" | |
32 | + :ontouch="true" | |
33 | + :opts="{ xAxis: { disabled: true, itemCount: 6, scrollShow: true }, legend: { show: false }, enableScroll: true }" | |
33 | 34 | /> |
34 | 35 | </view> |
35 | - <mescroll-empty v-if="!historyData.length"/> | |
36 | + <mescroll-empty v-if="!historyData.length" /> | |
36 | 37 | </view> |
37 | 38 | <view class="historyData-bottom" v-show="historyData.length"> |
38 | 39 | <view class="table"> |
... | ... | @@ -306,7 +307,8 @@ export default { |
306 | 307 | this.timeData.getTimeGap = ''; |
307 | 308 | this.timeData.getType = ''; |
308 | 309 | this.startTs = formatToDate(date[0], 'x'); |
309 | - this.endTs = formatToDate(date[date.length - 1], 'x'); | |
310 | + // 最后时间的最后一秒 | |
311 | + this.endTs = formatToDate(`${date[date.length - 1]} 23:59:59`, 'x'); | |
310 | 312 | }, |
311 | 313 | calendarClose() { |
312 | 314 | this.showCalendar = false; | ... | ... |
1 | -<template> | |
2 | - <view class="personal"> | |
3 | - <!-- 公共组件-每个页面必须引入 --> | |
4 | - <public-module></public-module> | |
5 | - <view class="headBox"> | |
6 | - <!-- #ifdef MP || APP-PLUS --> | |
7 | - <!-- 登录 --> | |
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"> | |
10 | - <view @click.top="openPersonalInfo" class="u-m-r-20"> | |
11 | - <image class="avatar" mode="aspectFill" :src="!userInfo.avatar ? '../../static/logo.png' : userInfo.avatar || thirdObj.avatarUrl"></image> | |
12 | - </view> | |
13 | - <view class="u-flex-1" @click.top="openPersonalInfo"> | |
14 | - <view class="nickName u-flex"> | |
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> | |
17 | - </view> | |
18 | - <view v-if="userInfo.isThirdLogin" @click.stop="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view> | |
19 | - </view> | |
20 | - <view style="color:#FFFFFF;font-size: 14px;" v-if="userInfo.phoneNumber">{{ userInfo.phoneNumber | phone }}</view> | |
21 | - </view> | |
22 | - </block> | |
23 | - <block v-else> | |
24 | - <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> | |
26 | - </view> | |
27 | - <view class="u-flex-1"><view @click="openLoginFunc" class="u-font-lg click-login login-btn ">请点击登录</view></view> | |
28 | - </block> | |
29 | - <view v-if="userInfo.isToken" @click="openPersonalInfo"><u-icon name="arrow-right" color="white" size="13"></u-icon></view> | |
30 | - </view> | |
31 | - <!-- 登录 --> | |
32 | - <!-- #endif --> | |
33 | - </view> | |
34 | - <view class="u-flex my-nav"> | |
35 | - <view class="nav-main"> | |
36 | - <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> | |
38 | - <view class="nav-center"><text class="text">系统通知</text></view> | |
39 | - <view class="nav-right"><image class="image" src="../../static/arrow-right.png"></image></view> | |
40 | - </view> | |
41 | - <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> | |
43 | - <view class="nav-center"><text class="text">意见反馈</text></view> | |
44 | - <view class="nav-right"><image class="image" src="../../static/arrow-right.png"></image></view> | |
45 | - </view> | |
46 | - </view> | |
47 | - <view @click="onLoginoutFunc" v-if="userInfo.isToken" class="u-flex" style="justify-content: center; width: 600rpx"> | |
48 | - <button class="submit" size="default" @click="onLoginoutFunc"><text class="text">退出账号</text></button> | |
49 | - </view> | |
50 | - </view> | |
51 | - <!-- 绑定账号 --> | |
52 | - <view> | |
53 | - <u-modal :showConfirmButton="false" :show="show" :title="title"> | |
54 | - <view v-if="!bindPhone" class="loginPhone"> | |
55 | - <view class="form-row"> | |
56 | - <u--input shape="circle" class="input" prefixIcon="account-fill" type="text" placeholder="登录账号" v-model="bindAccountObj.appUserKey"></u--input> | |
57 | - </view> | |
58 | - <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> | |
68 | - </view> | |
69 | - <view class="u-flex item-phone"> | |
70 | - <view class="phone-hide">手机验证码登录</view> | |
71 | - <view class="bind-phone-text" @click="bindPhoneFunc">手机绑定</view> | |
72 | - </view> | |
73 | - </view> | |
74 | - <view v-else class="loginPhone"> | |
75 | - <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> | |
84 | - </view> | |
85 | - <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> | |
95 | - </view> | |
96 | - <view class="u-flex item-phone"> | |
97 | - <view class="phone-hide">手机验证码登录</view> | |
98 | - <view class="bind-phone-text" @click="bindAccountFunc">账号绑定</view> | |
99 | - </view> | |
100 | - </view> | |
101 | - <view class="bottom-content"> | |
102 | - <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> | |
105 | - </view> | |
106 | - </view> | |
107 | - </u-modal> | |
108 | - </view> | |
109 | - <!-- 退出登录 --> | |
110 | - <view> | |
111 | - <u-popup bgColor="transparent" :overlay="true" :show="showLogout" mode="bottom"> | |
112 | - <view class="u-flex logout-main"> | |
113 | - <view class="main"><text style="color: #999999">确定要退出当前账号?</text></view> | |
114 | - <view @click.top="logoutBtn" class="main"><text style="color: #f95e5a">退出登录</text></view> | |
115 | - <view class="main1"><text @click.top="closeLogout" style="color: #3478f7">取消</text></view> | |
116 | - </view> | |
117 | - </u-popup> | |
118 | - </view> | |
119 | - <!-- 退出登录 --> | |
120 | - <f-tabbar></f-tabbar> | |
121 | - </view> | |
122 | -</template> | |
123 | - | |
124 | -<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 | -import { appId } from '@/config/constant.js'; | |
131 | - | |
132 | -export default { | |
133 | - components: { | |
134 | - fTabbar, | |
135 | - fNavbar | |
136 | - }, | |
137 | - data() { | |
138 | - return { | |
139 | - PrimaryColor: '#0079fe', //主题色 | |
140 | - showLogout: false, | |
141 | - readonly: false, | |
142 | - codeText: '获取验证码', | |
143 | - tips: '验证码', | |
144 | - bindPhone: false, | |
145 | - show: false, | |
146 | - title: '绑定账号', | |
147 | - systemInfo: base.systemInfo, | |
148 | - PrimaryButtonColor: '#0079fe', //主题色 | |
149 | - bindAccountObj: { | |
150 | - appUserKey: '', | |
151 | - appUserSecret: '' | |
152 | - }, | |
153 | - bindPhoneObj: { | |
154 | - appUserKey: '', | |
155 | - appUserSecret: '' | |
156 | - }, | |
157 | - thirdObj: {}, | |
158 | - getOpenId: '' | |
159 | - }; | |
160 | - }, | |
161 | - onLoad(e) { | |
162 | - // 隐藏原生的tabbar | |
163 | - uni.hideTabBar(); | |
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; | |
170 | - }, | |
171 | - computed: { | |
172 | - ...mapState(['userInfo']) | |
173 | - }, | |
174 | - methods: { | |
175 | - ...mapMutations(['emptyUserInfo', 'setUserInfo']), | |
176 | - // 跳转前判断登录 | |
177 | - onTokenJump(url) { | |
178 | - this.judgeLogin(() => { | |
179 | - uni.navigateTo({ | |
180 | - url: url | |
181 | - }); | |
182 | - }); | |
183 | - }, | |
184 | - onJump(url) { | |
185 | - uni.navigateTo({ | |
186 | - url: url | |
187 | - }); | |
188 | - }, | |
189 | - openLoginFunc() { | |
190 | - uni.navigateTo({ | |
191 | - url: '/publicLoginSubPage/public/login' | |
192 | - }); | |
193 | - }, | |
194 | - openPersonalInfo() { | |
195 | - let obj = { | |
196 | - data: this.userInfo, | |
197 | - third: this.thirdObj | |
198 | - }; | |
199 | - uni.navigateTo({ | |
200 | - url: '/publicLoginSubPage/other/set?data=' + JSON.stringify(obj) | |
201 | - }); | |
202 | - }, | |
203 | - clickAccountFunc() { | |
204 | - this.show = true; | |
205 | - this.resetFunc(); | |
206 | - }, | |
207 | - resetFunc() { | |
208 | - this.bindPhone = false; | |
209 | - this.bindAccountObj = {}; | |
210 | - this.bindPhoneObj = {}; | |
211 | - }, | |
212 | - bindConfirm() { | |
213 | - //需要绑定 | |
214 | - if (!this.bindPhone) { | |
215 | - if (this.bindAccountObj.appUserKey == '') { | |
216 | - return uni.$u.toast('请输入登录账号~'); | |
217 | - } | |
218 | - const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/; | |
219 | - if (this.bindAccountObj.appUserSecret == '') { | |
220 | - uni.showToast({ | |
221 | - title: '请输入登录密码~', | |
222 | - icon: 'none' | |
223 | - }); | |
224 | - return; | |
225 | - } else if (!passReg.test(this.bindAccountObj.appUserSecret)) { | |
226 | - uni.showToast({ | |
227 | - title: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~', | |
228 | - icon: 'none', | |
229 | - duration: 3000 | |
230 | - }); | |
231 | - return; | |
232 | - } | |
233 | - const postData = { | |
234 | - loginMethod: 'ACCOUNT', | |
235 | - ...this.bindAccountObj, | |
236 | - platformName: 'WECHAT', | |
237 | - thirdUserId: this.getOpenId | |
238 | - }; | |
239 | - uni.$u.http | |
240 | - .post('/yt/third/bind', postData) | |
241 | - .then(res => { | |
242 | - if (res) { | |
243 | - this.show = false; | |
244 | - // 储存登录信息 | |
245 | - let resObj = { | |
246 | - refreshToken: res.refreshToken, | |
247 | - isToken: res.token | |
248 | - }; | |
249 | - let userInfo = { | |
250 | - ...resObj, | |
251 | - token: true, //token用于判断是否登录 | |
252 | - isThirdLogin: false, | |
253 | - isThirdLoginAndNoDind: true | |
254 | - }; | |
255 | - if (userInfo.token) { | |
256 | - this.setUserInfo(userInfo); | |
257 | - } | |
258 | - uni.showToast({ | |
259 | - title: '账号绑定成功~', | |
260 | - icon: 'none' | |
261 | - }); | |
262 | - this.saveUserInfo(); | |
263 | - } | |
264 | - }) | |
265 | - .catch(e => { | |
266 | - uni.$u.toast(e.data?.msg); | |
267 | - this.show = true; | |
268 | - }); | |
269 | - } else { | |
270 | - const phoneRegular = /^1\d{10}$/; | |
271 | - if (this.bindPhoneObj.appUserKey == '') { | |
272 | - uni.showToast({ | |
273 | - title: '请输入手机号码~', | |
274 | - icon: 'none' | |
275 | - }); | |
276 | - return; | |
277 | - } else if (!phoneRegular.test(this.bindPhoneObj.appUserKey)) { | |
278 | - uni.showToast({ | |
279 | - title: '手机号格式不正确~', | |
280 | - icon: 'none' | |
281 | - }); | |
282 | - return; | |
283 | - } | |
284 | - if (this.bindPhoneObj.appUserSecret == '') { | |
285 | - uni.showToast({ | |
286 | - title: '请输入验证码~', | |
287 | - icon: 'none' | |
288 | - }); | |
289 | - return; | |
290 | - } else if (!/^\d{6}$/.test(this.bindPhoneObj.appUserSecret)) { | |
291 | - uni.showToast({ | |
292 | - title: '验证码格式不正确~', | |
293 | - icon: 'none' | |
294 | - }); | |
295 | - return; | |
296 | - } | |
297 | - const postData = { | |
298 | - loginMethod: 'PHONE', | |
299 | - ...this.bindPhoneObj, | |
300 | - platformName: 'WECHAT', | |
301 | - thirdUserId: this.getOpenId | |
302 | - }; | |
303 | - uni.$u.http | |
304 | - .post('/yt/third/bind', postData) | |
305 | - .then(res => { | |
306 | - this.show = false; | |
307 | - // 储存登录信息 | |
308 | - let resObj = { | |
309 | - refreshToken: res.refreshToken, | |
310 | - isToken: res.token | |
311 | - }; | |
312 | - let userInfo = { | |
313 | - ...resObj, | |
314 | - token: true, //token用于判断是否登录 | |
315 | - isThirdLogin: false, | |
316 | - isThirdLoginAndNoDind: true | |
317 | - }; | |
318 | - if (userInfo.token) { | |
319 | - this.setUserInfo(userInfo); | |
320 | - } | |
321 | - uni.showToast({ | |
322 | - title: '手机绑定成功~', | |
323 | - icon: 'none' | |
324 | - }); | |
325 | - this.saveUserInfo(); | |
326 | - }) | |
327 | - .catch(e => { | |
328 | - uni.$u.toast(e.data?.msg); | |
329 | - this.show = true; | |
330 | - }); | |
331 | - } | |
332 | - }, | |
333 | - saveUserInfo() { | |
334 | - //储存个人信息 | |
335 | - uni.$u.http.get('/yt/user/me/info').then(res => { | |
336 | - if (res) { | |
337 | - this.setUserInfo(res); | |
338 | - } | |
339 | - }); | |
340 | - }, | |
341 | - bindPhoneFunc() { | |
342 | - this.bindPhone = true; | |
343 | - }, | |
344 | - bindAccountFunc() { | |
345 | - this.bindPhone = false; | |
346 | - }, | |
347 | - //验证码按钮文字状态 | |
348 | - getCodeState() { | |
349 | - const _this = this; | |
350 | - this.readonly = true; | |
351 | - this.codeText = '60S后重新获取'; | |
352 | - var s = 60; | |
353 | - clear = setInterval(() => { | |
354 | - s--; | |
355 | - _this.codeText = s + 'S后重新获取'; | |
356 | - if (s <= 0) { | |
357 | - clearInterval(clear); | |
358 | - _this.codeText = '获取验证码'; | |
359 | - _this.readonly = false; | |
360 | - } | |
361 | - }, 1000); | |
362 | - }, | |
363 | - //获取验证码 | |
364 | - getVcode() { | |
365 | - if (this.readonly) { | |
366 | - uni.showToast({ | |
367 | - title: '验证码已发送~', | |
368 | - icon: 'none' | |
369 | - }); | |
370 | - return; | |
371 | - } | |
372 | - if (this.bindPhoneObj.appUserKey == '') { | |
373 | - uni.showToast({ | |
374 | - title: '请输入手机号~', | |
375 | - icon: 'none' | |
376 | - }); | |
377 | - return; | |
378 | - } | |
379 | - const phoneRegular = /^1\d{10}$/; | |
380 | - if (!phoneRegular.test(this.bindPhoneObj.appUserKey)) { | |
381 | - uni.showToast({ | |
382 | - title: '手机号格式不正确~', | |
383 | - icon: 'none' | |
384 | - }); | |
385 | - return; | |
386 | - } | |
387 | - let httpData = {}; | |
388 | - // 获取验证码接口 | |
389 | - uni.$u.http.post(`/yt/noauth/sendLoginSmsCode/${this.bindPhoneObj.appUserKey}`).then(res => { | |
390 | - if (res) { | |
391 | - this.getCodeState(); //开始倒计时 | |
392 | - } | |
393 | - }); | |
394 | - }, | |
395 | - onLoginoutFunc() { | |
396 | - this.showLogout = true; | |
397 | - }, | |
398 | - closeLogout() { | |
399 | - this.showLogout = false; | |
400 | - }, | |
401 | - logoutBtn() { | |
402 | - let that = this; | |
403 | - uni.showModal({ | |
404 | - title: '退出登录', | |
405 | - content: '你确定退出登录吗?', | |
406 | - success(res) { | |
407 | - if (res.confirm) { | |
408 | - that.emptyUserInfo(); | |
409 | - that.showLogout = false; | |
410 | - setTimeout(() => { | |
411 | - uni.navigateTo({ | |
412 | - url: '/publicLoginSubPage/public/login' | |
413 | - }); | |
414 | - }, 500); | |
415 | - } else if (res.cancel) { | |
416 | - } | |
417 | - } | |
418 | - }); | |
419 | - } | |
420 | - } | |
421 | -}; | |
422 | -</script> | |
423 | - | |
424 | -<style lang="scss" scoped> | |
425 | -@import './static/personal.scss'; | |
1 | +<template> | |
2 | + <view class="personal"> | |
3 | + <!-- 公共组件-每个页面必须引入 --> | |
4 | + <public-module></public-module> | |
5 | + <view class="headBox"> | |
6 | + <!-- #ifdef MP || APP-PLUS --> | |
7 | + <!-- 登录 --> | |
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"> | |
10 | + <view @click.top="openPersonalInfo" class="u-m-r-20"> | |
11 | + <image class="avatar" mode="aspectFill" :src="!userInfo.avatar ? '../../static/logo.png' : userInfo.avatar || thirdObj.avatarUrl"></image> | |
12 | + </view> | |
13 | + <view class="u-flex-1" @click.top="openPersonalInfo"> | |
14 | + <view class="nickName u-flex"> | |
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> | |
17 | + </view> | |
18 | + <view v-if="userInfo.isThirdLogin" @click.stop="clickAccountFunc" class="detail"><text class="text">绑定账号</text></view> | |
19 | + </view> | |
20 | + <view style="color:#FFFFFF;font-size: 14px;" v-if="userInfo.phoneNumber">{{ userInfo.phoneNumber | phone }}</view> | |
21 | + </view> | |
22 | + </block> | |
23 | + <block v-else> | |
24 | + <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> | |
26 | + </view> | |
27 | + <view class="u-flex-1"><view @click="openLoginFunc" class="u-font-lg click-login login-btn ">请点击登录</view></view> | |
28 | + </block> | |
29 | + <view v-if="userInfo.isToken" @click="openPersonalInfo"><u-icon name="arrow-right" color="white" size="13"></u-icon></view> | |
30 | + </view> | |
31 | + <!-- 登录 --> | |
32 | + <!-- #endif --> | |
33 | + </view> | |
34 | + <view class="u-flex my-nav"> | |
35 | + <view class="nav-main"> | |
36 | + <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> | |
38 | + <view class="nav-center"><text class="text">系统通知</text></view> | |
39 | + <view class="nav-right"><image class="image" src="../../static/arrow-right.png"></image></view> | |
40 | + </view> | |
41 | + <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> | |
43 | + <view class="nav-center"><text class="text">意见反馈</text></view> | |
44 | + <view class="nav-right"><image class="image" src="../../static/arrow-right.png"></image></view> | |
45 | + </view> | |
46 | + </view> | |
47 | + <view @click="onLoginoutFunc" class="u-flex" style="justify-content: center; width: 600rpx"> | |
48 | + <button class="submit" size="default" @click="onLoginoutFunc"><text class="text">退出账号</text></button> | |
49 | + </view> | |
50 | + </view> | |
51 | + <!-- 绑定账号 --> | |
52 | + <view> | |
53 | + <u-modal :showConfirmButton="false" :show="show" :title="title"> | |
54 | + <view v-if="!bindPhone" class="loginPhone"> | |
55 | + <view class="form-row"> | |
56 | + <u--input shape="circle" class="input" prefixIcon="account-fill" type="text" placeholder="登录账号" v-model="bindAccountObj.appUserKey"></u--input> | |
57 | + </view> | |
58 | + <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> | |
68 | + </view> | |
69 | + <view class="u-flex item-phone"> | |
70 | + <view class="phone-hide">手机验证码登录</view> | |
71 | + <view class="bind-phone-text" @click="bindPhoneFunc">手机绑定</view> | |
72 | + </view> | |
73 | + </view> | |
74 | + <view v-else class="loginPhone"> | |
75 | + <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> | |
84 | + </view> | |
85 | + <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> | |
95 | + </view> | |
96 | + <view class="u-flex item-phone"> | |
97 | + <view class="phone-hide">手机验证码登录</view> | |
98 | + <view class="bind-phone-text" @click="bindAccountFunc">账号绑定</view> | |
99 | + </view> | |
100 | + </view> | |
101 | + <view class="bottom-content"> | |
102 | + <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> | |
105 | + </view> | |
106 | + </view> | |
107 | + </u-modal> | |
108 | + </view> | |
109 | + <!-- 退出登录 --> | |
110 | + <view> | |
111 | + <u-popup bgColor="transparent" :overlay="true" :show="showLogout" mode="bottom"> | |
112 | + <view class="u-flex logout-main"> | |
113 | + <view class="main"><text style="color: #999999">确定要退出当前账号?</text></view> | |
114 | + <view @click.top="logoutBtn" class="main"><text style="color: #f95e5a">退出登录</text></view> | |
115 | + <view class="main1"><text @click.top="closeLogout" style="color: #3478f7">取消</text></view> | |
116 | + </view> | |
117 | + </u-popup> | |
118 | + </view> | |
119 | + <!-- 退出登录 --> | |
120 | + <f-tabbar></f-tabbar> | |
121 | + </view> | |
122 | +</template> | |
123 | + | |
124 | +<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 | +import { appId } from '@/config/constant.js'; | |
131 | + | |
132 | +export default { | |
133 | + components: { | |
134 | + fTabbar, | |
135 | + fNavbar | |
136 | + }, | |
137 | + data() { | |
138 | + return { | |
139 | + PrimaryColor: '#0079fe', //主题色 | |
140 | + showLogout: false, | |
141 | + readonly: false, | |
142 | + codeText: '获取验证码', | |
143 | + tips: '验证码', | |
144 | + bindPhone: false, | |
145 | + show: false, | |
146 | + title: '绑定账号', | |
147 | + systemInfo: base.systemInfo, | |
148 | + PrimaryButtonColor: '#0079fe', //主题色 | |
149 | + bindAccountObj: { | |
150 | + appUserKey: '', | |
151 | + appUserSecret: '' | |
152 | + }, | |
153 | + bindPhoneObj: { | |
154 | + appUserKey: '', | |
155 | + appUserSecret: '' | |
156 | + }, | |
157 | + thirdObj: {}, | |
158 | + getOpenId: '' | |
159 | + }; | |
160 | + }, | |
161 | + onLoad(e) { | |
162 | + // 隐藏原生的tabbar | |
163 | + uni.hideTabBar(); | |
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; | |
170 | + }, | |
171 | + computed: { | |
172 | + ...mapState(['userInfo']) | |
173 | + }, | |
174 | + methods: { | |
175 | + ...mapMutations(['emptyUserInfo', 'setUserInfo']), | |
176 | + // 跳转前判断登录 | |
177 | + onTokenJump(url) { | |
178 | + this.judgeLogin(() => { | |
179 | + uni.navigateTo({ | |
180 | + url: url | |
181 | + }); | |
182 | + }); | |
183 | + }, | |
184 | + onJump(url) { | |
185 | + uni.navigateTo({ | |
186 | + url: url | |
187 | + }); | |
188 | + }, | |
189 | + openLoginFunc() { | |
190 | + uni.navigateTo({ | |
191 | + url: '/publicLoginSubPage/public/login' | |
192 | + }); | |
193 | + }, | |
194 | + openPersonalInfo() { | |
195 | + let obj = { | |
196 | + data: this.userInfo, | |
197 | + third: this.thirdObj | |
198 | + }; | |
199 | + uni.navigateTo({ | |
200 | + url: '/publicLoginSubPage/other/set?data=' + JSON.stringify(obj) | |
201 | + }); | |
202 | + }, | |
203 | + clickAccountFunc() { | |
204 | + this.show = true; | |
205 | + this.resetFunc(); | |
206 | + }, | |
207 | + resetFunc() { | |
208 | + this.bindPhone = false; | |
209 | + this.bindAccountObj = {}; | |
210 | + this.bindPhoneObj = {}; | |
211 | + }, | |
212 | + bindConfirm() { | |
213 | + //需要绑定 | |
214 | + if (!this.bindPhone) { | |
215 | + if (this.bindAccountObj.appUserKey == '') { | |
216 | + return uni.$u.toast('请输入登录账号~'); | |
217 | + } | |
218 | + const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/; | |
219 | + if (this.bindAccountObj.appUserSecret == '') { | |
220 | + uni.showToast({ | |
221 | + title: '请输入登录密码~', | |
222 | + icon: 'none' | |
223 | + }); | |
224 | + return; | |
225 | + } else if (!passReg.test(this.bindAccountObj.appUserSecret)) { | |
226 | + uni.showToast({ | |
227 | + title: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~', | |
228 | + icon: 'none', | |
229 | + duration: 3000 | |
230 | + }); | |
231 | + return; | |
232 | + } | |
233 | + const postData = { | |
234 | + loginMethod: 'ACCOUNT', | |
235 | + ...this.bindAccountObj, | |
236 | + platformName: 'WECHAT', | |
237 | + thirdUserId: this.getOpenId | |
238 | + }; | |
239 | + uni.$u.http | |
240 | + .post('/yt/third/bind', postData) | |
241 | + .then(res => { | |
242 | + if (res) { | |
243 | + this.show = false; | |
244 | + // 储存登录信息 | |
245 | + let resObj = { | |
246 | + refreshToken: res.refreshToken, | |
247 | + isToken: res.token | |
248 | + }; | |
249 | + let userInfo = { | |
250 | + ...resObj, | |
251 | + token: true, //token用于判断是否登录 | |
252 | + isThirdLogin: false, | |
253 | + isThirdLoginAndNoDind: true | |
254 | + }; | |
255 | + if (userInfo.token) { | |
256 | + this.setUserInfo(userInfo); | |
257 | + } | |
258 | + uni.showToast({ | |
259 | + title: '账号绑定成功~', | |
260 | + icon: 'none' | |
261 | + }); | |
262 | + this.saveUserInfo(); | |
263 | + } | |
264 | + }) | |
265 | + .catch(e => { | |
266 | + uni.$u.toast(e.data?.msg); | |
267 | + this.show = true; | |
268 | + }); | |
269 | + } else { | |
270 | + const phoneRegular = /^1\d{10}$/; | |
271 | + if (this.bindPhoneObj.appUserKey == '') { | |
272 | + uni.showToast({ | |
273 | + title: '请输入手机号码~', | |
274 | + icon: 'none' | |
275 | + }); | |
276 | + return; | |
277 | + } else if (!phoneRegular.test(this.bindPhoneObj.appUserKey)) { | |
278 | + uni.showToast({ | |
279 | + title: '手机号格式不正确~', | |
280 | + icon: 'none' | |
281 | + }); | |
282 | + return; | |
283 | + } | |
284 | + if (this.bindPhoneObj.appUserSecret == '') { | |
285 | + uni.showToast({ | |
286 | + title: '请输入验证码~', | |
287 | + icon: 'none' | |
288 | + }); | |
289 | + return; | |
290 | + } else if (!/^\d{6}$/.test(this.bindPhoneObj.appUserSecret)) { | |
291 | + uni.showToast({ | |
292 | + title: '验证码格式不正确~', | |
293 | + icon: 'none' | |
294 | + }); | |
295 | + return; | |
296 | + } | |
297 | + const postData = { | |
298 | + loginMethod: 'PHONE', | |
299 | + ...this.bindPhoneObj, | |
300 | + platformName: 'WECHAT', | |
301 | + thirdUserId: this.getOpenId | |
302 | + }; | |
303 | + uni.$u.http | |
304 | + .post('/yt/third/bind', postData) | |
305 | + .then(res => { | |
306 | + this.show = false; | |
307 | + // 储存登录信息 | |
308 | + let resObj = { | |
309 | + refreshToken: res.refreshToken, | |
310 | + isToken: res.token | |
311 | + }; | |
312 | + let userInfo = { | |
313 | + ...resObj, | |
314 | + token: true, //token用于判断是否登录 | |
315 | + isThirdLogin: false, | |
316 | + isThirdLoginAndNoDind: true | |
317 | + }; | |
318 | + if (userInfo.token) { | |
319 | + this.setUserInfo(userInfo); | |
320 | + } | |
321 | + uni.showToast({ | |
322 | + title: '手机绑定成功~', | |
323 | + icon: 'none' | |
324 | + }); | |
325 | + this.saveUserInfo(); | |
326 | + }) | |
327 | + .catch(e => { | |
328 | + uni.$u.toast(e.data?.msg); | |
329 | + this.show = true; | |
330 | + }); | |
331 | + } | |
332 | + }, | |
333 | + saveUserInfo() { | |
334 | + //储存个人信息 | |
335 | + uni.$u.http.get('/yt/user/me/info').then(res => { | |
336 | + if (res) { | |
337 | + this.setUserInfo(res); | |
338 | + } | |
339 | + }); | |
340 | + }, | |
341 | + bindPhoneFunc() { | |
342 | + this.bindPhone = true; | |
343 | + }, | |
344 | + bindAccountFunc() { | |
345 | + this.bindPhone = false; | |
346 | + }, | |
347 | + //验证码按钮文字状态 | |
348 | + getCodeState() { | |
349 | + const _this = this; | |
350 | + this.readonly = true; | |
351 | + this.codeText = '60S后重新获取'; | |
352 | + var s = 60; | |
353 | + clear = setInterval(() => { | |
354 | + s--; | |
355 | + _this.codeText = s + 'S后重新获取'; | |
356 | + if (s <= 0) { | |
357 | + clearInterval(clear); | |
358 | + _this.codeText = '获取验证码'; | |
359 | + _this.readonly = false; | |
360 | + } | |
361 | + }, 1000); | |
362 | + }, | |
363 | + //获取验证码 | |
364 | + getVcode() { | |
365 | + if (this.readonly) { | |
366 | + uni.showToast({ | |
367 | + title: '验证码已发送~', | |
368 | + icon: 'none' | |
369 | + }); | |
370 | + return; | |
371 | + } | |
372 | + if (this.bindPhoneObj.appUserKey == '') { | |
373 | + uni.showToast({ | |
374 | + title: '请输入手机号~', | |
375 | + icon: 'none' | |
376 | + }); | |
377 | + return; | |
378 | + } | |
379 | + const phoneRegular = /^1\d{10}$/; | |
380 | + if (!phoneRegular.test(this.bindPhoneObj.appUserKey)) { | |
381 | + uni.showToast({ | |
382 | + title: '手机号格式不正确~', | |
383 | + icon: 'none' | |
384 | + }); | |
385 | + return; | |
386 | + } | |
387 | + let httpData = {}; | |
388 | + // 获取验证码接口 | |
389 | + uni.$u.http.post(`/yt/noauth/sendLoginSmsCode/${this.bindPhoneObj.appUserKey}`).then(res => { | |
390 | + if (res) { | |
391 | + this.getCodeState(); //开始倒计时 | |
392 | + } | |
393 | + }); | |
394 | + }, | |
395 | + onLoginoutFunc() { | |
396 | + this.showLogout = true; | |
397 | + }, | |
398 | + closeLogout() { | |
399 | + this.showLogout = false; | |
400 | + }, | |
401 | + logoutBtn() { | |
402 | + let that = this; | |
403 | + uni.showModal({ | |
404 | + title: '退出登录', | |
405 | + content: '你确定退出登录吗?', | |
406 | + success(res) { | |
407 | + if (res.confirm) { | |
408 | + that.emptyUserInfo(); | |
409 | + that.showLogout = false; | |
410 | + setTimeout(() => { | |
411 | + uni.navigateTo({ | |
412 | + url: '/publicLoginSubPage/public/login' | |
413 | + }); | |
414 | + }, 500); | |
415 | + } else if (res.cancel) { | |
416 | + } | |
417 | + } | |
418 | + }); | |
419 | + } | |
420 | + } | |
421 | +}; | |
422 | +</script> | |
423 | + | |
424 | +<style lang="scss" scoped> | |
425 | +@import './static/personal.scss'; | |
426 | 426 | </style> | ... | ... |
1 | -<template> | |
2 | - <view class="code-page"> | |
3 | - <!-- 公共组件-每个页面必须引入 --> | |
4 | - <public-module></public-module> | |
5 | - <view class="f__login"> | |
6 | - <view class="loginPhone"> | |
7 | - <view class="phone-main" style="margin-top: 240rpx;"> | |
8 | - <text class="text">手机验证码登录</text> | |
9 | - <view class="circleStyle"></view> | |
10 | - </view> | |
11 | - <view class="form-row"> | |
12 | - <u-input v-model="phone" type="number" placeholder="请输入手机号码" border="bottom"></u-input> | |
13 | - </view> | |
14 | - <view class="form-row"> | |
15 | - <u-input type="number" v-model="vCode" placeholder="请输入验证码" border="bottom"> | |
16 | - <template slot="suffix" @click="getVcode"> | |
17 | - <view class="getvcode" >{{ codeText }}</view> | |
18 | - </template> | |
19 | - </u-input> | |
20 | - </view> | |
21 | - <button class="submit" size="default" @click="onSubmit"><text class="text">登录</text></button> | |
22 | - <view class="u-flex account-style"><view class="content" @click="openAccountFunc">账号密码登录</view></view> | |
23 | - <view class="circleStyleBottom"></view> | |
24 | - </view> | |
25 | - </view> | |
26 | - </view> | |
27 | -</template> | |
28 | - | |
29 | -<script> | |
30 | - var clear; | |
31 | - import { mapState, mapMutations } from 'vuex'; | |
32 | - export default { | |
33 | - data() { | |
34 | - return { | |
35 | - readonly: false, | |
36 | - codeText: '发送验证码', | |
37 | - phone: '', //号码 | |
38 | - vCode: '', //验证码 | |
39 | - } | |
40 | - }, | |
41 | - methods: { | |
42 | - ...mapMutations(['setUserInfo']), | |
43 | - //验证码按钮文字状态 | |
44 | - getCodeState() { | |
45 | - const _this = this; | |
46 | - this.readonly = true; | |
47 | - this.codeText = '60S后重新获取'; | |
48 | - var s = 60; | |
49 | - clear = setInterval(() => { | |
50 | - s--; | |
51 | - _this.codeText = s + 'S后重新获取'; | |
52 | - if (s <= 0) { | |
53 | - clearInterval(clear); | |
54 | - _this.codeText = '发送验证码'; | |
55 | - _this.readonly = false; | |
56 | - } | |
57 | - }, 1000); | |
58 | - }, | |
59 | - //获取验证码 | |
60 | - getVcode() { | |
61 | - if (this.readonly) { | |
62 | - uni.showToast({ | |
63 | - title: '验证码已发送~', | |
64 | - icon: 'none' | |
65 | - }); | |
66 | - return; | |
67 | - } | |
68 | - if (this.phone == '') { | |
69 | - uni.showToast({ | |
70 | - title: '请输入手机号~', | |
71 | - icon: 'none' | |
72 | - }); | |
73 | - return; | |
74 | - } | |
75 | - const phoneRegular = /^1\d{10}$/; | |
76 | - if (!phoneRegular.test(this.phone)) { | |
77 | - uni.showToast({ | |
78 | - title: '手机号格式不正确~', | |
79 | - icon: 'none' | |
80 | - }); | |
81 | - return; | |
82 | - } | |
83 | - // 获取验证码接口 | |
84 | - uni.$u.http.post(`/yt/noauth/sendLoginSmsCode/${this.phone}` ).then(res => { | |
85 | - if(res){ | |
86 | - this.getCodeState(); //开始倒计时 | |
87 | - } | |
88 | - }) | |
89 | - }, | |
90 | - onSubmit() { | |
91 | - const phoneRegular = /^1\d{10}$/; | |
92 | - if(this.phone==''){ | |
93 | - uni.showToast({ | |
94 | - title: '请输入手机号码~', | |
95 | - icon: 'none' | |
96 | - }); | |
97 | - return; | |
98 | - }else if (!phoneRegular.test(this.phone)) { | |
99 | - uni.showToast({ | |
100 | - title: '手机号格式不正确~', | |
101 | - icon: 'none' | |
102 | - }); | |
103 | - return; | |
104 | - } | |
105 | - if (this.vCode == '') { | |
106 | - uni.showToast({ | |
107 | - title: '请输入验证码~', | |
108 | - icon: 'none' | |
109 | - }); | |
110 | - return; | |
111 | - } else if(!(/^\d{6}$/.test(this.vCode))){ | |
112 | - uni.showToast({ | |
113 | - title: '验证码格式不正确~', | |
114 | - icon: 'none' | |
115 | - }); | |
116 | - return | |
117 | - } | |
118 | - let httpData = { | |
119 | - code: this.vCode, | |
120 | - phoneNumber: this.phone | |
121 | - } | |
122 | - uni.$u.http.post('/yt/auth/code/login', httpData).then(res => { | |
123 | - if (res) { | |
124 | - // 储存登录信息 | |
125 | - let resObj = { | |
126 | - refreshToken: res.refreshToken, | |
127 | - isToken: res.token | |
128 | - }; | |
129 | - let userInfo = { | |
130 | - ...resObj, | |
131 | - token: true ,//token用于判断是否登录 | |
132 | - isThirdLogin: false | |
133 | - }; | |
134 | - if (userInfo.token) { | |
135 | - this.setUserInfo(userInfo); | |
136 | - } | |
137 | - uni.showToast({ | |
138 | - title: '登录成功~', | |
139 | - icon: 'none' | |
140 | - }).then(res => { | |
141 | - uni.reLaunch({ | |
142 | - url: '/pages/personal/personal' | |
143 | - }); | |
144 | - }); | |
145 | - this.saveUserInfo(); | |
146 | - | |
147 | - } | |
148 | - }); | |
149 | - }, | |
150 | - saveUserInfo() { | |
151 | - //储存个人信息 | |
152 | - uni.$u.http.get('/yt/user/me/info').then(res => { | |
153 | - if (res) { | |
154 | - this.setUserInfo(res); | |
155 | - } | |
156 | - }); | |
157 | - }, | |
158 | - openAccountFunc(){ | |
159 | - uni.navigateTo({ | |
160 | - url:"../public/login" | |
161 | - }) | |
162 | - } | |
163 | - } | |
164 | - } | |
165 | -</script> | |
166 | - | |
167 | -<style lang="scss" scoped> | |
168 | - @import './static/code.scss'; | |
1 | +<template> | |
2 | + <view class="code-page"> | |
3 | + <!-- 公共组件-每个页面必须引入 --> | |
4 | + <public-module></public-module> | |
5 | + <view class="f__login"> | |
6 | + <view class="loginPhone"> | |
7 | + <view class="phone-main" style="margin-top: 240rpx;"> | |
8 | + <text class="text">手机验证码登录</text> | |
9 | + <view class="circleStyle"></view> | |
10 | + </view> | |
11 | + <view class="form-row"><u-input v-model="phone" type="number" placeholder="请输入手机号码" border="bottom"></u-input></view> | |
12 | + <view class="form-row"> | |
13 | + <u-input type="number" v-model="vCode" placeholder="请输入验证码" border="bottom"> | |
14 | + <template slot="suffix" @click="getVcode"> | |
15 | + <view class="getvcode">{{ codeText }}</view> | |
16 | + </template> | |
17 | + </u-input> | |
18 | + </view> | |
19 | + <button class="submit" size="default" @click="onSubmit"><text class="text">登录</text></button> | |
20 | + <view class="u-flex account-style"><view class="content" @click="openAccountFunc">账号密码登录</view></view> | |
21 | + <view class="circleStyleBottom"></view> | |
22 | + </view> | |
23 | + </view> | |
24 | + </view> | |
25 | +</template> | |
26 | + | |
27 | +<script> | |
28 | +var clear; | |
29 | +import { mapState, mapMutations } from 'vuex'; | |
30 | +export default { | |
31 | + data() { | |
32 | + return { | |
33 | + readonly: false, | |
34 | + codeText: '发送验证码', | |
35 | + phone: '', //号码 | |
36 | + vCode: '' //验证码 | |
37 | + }; | |
38 | + }, | |
39 | + methods: { | |
40 | + ...mapMutations(['setUserInfo']), | |
41 | + //验证码按钮文字状态 | |
42 | + getCodeState() { | |
43 | + const _this = this; | |
44 | + this.readonly = true; | |
45 | + this.codeText = '60s后重新获取'; | |
46 | + var s = 60; | |
47 | + clear = setInterval(() => { | |
48 | + s--; | |
49 | + _this.codeText = s + 's后重新获取'; | |
50 | + if (s <= 0) { | |
51 | + clearInterval(clear); | |
52 | + _this.codeText = '发送验证码'; | |
53 | + _this.readonly = false; | |
54 | + } | |
55 | + }, 1000); | |
56 | + }, | |
57 | + //获取验证码 | |
58 | + getVcode() { | |
59 | + if (this.readonly) { | |
60 | + uni.showToast({ | |
61 | + title: '验证码已发送~', | |
62 | + icon: 'none' | |
63 | + }); | |
64 | + return; | |
65 | + } | |
66 | + if (this.phone == '') { | |
67 | + uni.showToast({ | |
68 | + title: '请输入手机号~', | |
69 | + icon: 'none' | |
70 | + }); | |
71 | + return; | |
72 | + } | |
73 | + const phoneRegular = /^1\d{10}$/; | |
74 | + if (!phoneRegular.test(this.phone)) { | |
75 | + uni.showToast({ | |
76 | + title: '手机号格式不正确~', | |
77 | + icon: 'none' | |
78 | + }); | |
79 | + return; | |
80 | + } | |
81 | + // 获取验证码接口 | |
82 | + uni.$u.http | |
83 | + .post(`/yt/noauth/sendLoginSmsCode/${this.phone}`) | |
84 | + .then(res => { | |
85 | + if (res) { | |
86 | + this.getCodeState(); //开始倒计时 | |
87 | + } | |
88 | + }) | |
89 | + .catch(err => { | |
90 | + uni.showToast({ | |
91 | + title: err.data.msg, | |
92 | + icon: 'none' | |
93 | + }); | |
94 | + }); | |
95 | + }, | |
96 | + onSubmit() { | |
97 | + const phoneRegular = /^1\d{10}$/; | |
98 | + if (this.phone == '') { | |
99 | + uni.showToast({ | |
100 | + title: '请输入手机号码~', | |
101 | + icon: 'none' | |
102 | + }); | |
103 | + return; | |
104 | + } else if (!phoneRegular.test(this.phone)) { | |
105 | + uni.showToast({ | |
106 | + title: '手机号格式不正确~', | |
107 | + icon: 'none' | |
108 | + }); | |
109 | + return; | |
110 | + } | |
111 | + if (this.vCode == '') { | |
112 | + uni.showToast({ | |
113 | + title: '请输入验证码~', | |
114 | + icon: 'none' | |
115 | + }); | |
116 | + return; | |
117 | + } else if (!/^\d{6}$/.test(this.vCode)) { | |
118 | + uni.showToast({ | |
119 | + title: '验证码格式不正确~', | |
120 | + icon: 'none' | |
121 | + }); | |
122 | + return; | |
123 | + } | |
124 | + let httpData = { | |
125 | + code: this.vCode, | |
126 | + phoneNumber: this.phone | |
127 | + }; | |
128 | + uni.$u.http.post('/yt/auth/code/login', httpData).then(res => { | |
129 | + if (res) { | |
130 | + // 储存登录信息 | |
131 | + let resObj = { | |
132 | + refreshToken: res.refreshToken, | |
133 | + isToken: res.token | |
134 | + }; | |
135 | + let userInfo = { | |
136 | + ...resObj, | |
137 | + token: true, //token用于判断是否登录 | |
138 | + isThirdLogin: false | |
139 | + }; | |
140 | + if (userInfo.token) { | |
141 | + this.setUserInfo(userInfo); | |
142 | + } | |
143 | + uni | |
144 | + .showToast({ | |
145 | + title: '登录成功~', | |
146 | + icon: 'none' | |
147 | + }) | |
148 | + .then(res => { | |
149 | + uni.reLaunch({ | |
150 | + url: '/pages/personal/personal' | |
151 | + }); | |
152 | + }); | |
153 | + this.saveUserInfo(); | |
154 | + } | |
155 | + }); | |
156 | + }, | |
157 | + saveUserInfo() { | |
158 | + //储存个人信息 | |
159 | + uni.$u.http.get('/yt/user/me/info').then(res => { | |
160 | + if (res) { | |
161 | + this.setUserInfo(res); | |
162 | + } | |
163 | + }); | |
164 | + }, | |
165 | + openAccountFunc() { | |
166 | + uni.navigateTo({ | |
167 | + url: '../public/login' | |
168 | + }); | |
169 | + } | |
170 | + } | |
171 | +}; | |
172 | +</script> | |
173 | + | |
174 | +<style lang="scss" scoped> | |
175 | +@import './static/code.scss'; | |
169 | 176 | </style> | ... | ... |
1 | -<template> | |
2 | - <view class="find-password-page"> | |
3 | - <public-module></public-module> | |
4 | - <view class="top u-flex" > | |
5 | - <view @click="showPhone" :style="{color:!nextStatus?'#0079fe':''}" class="item">1.验证手机号码</view> | |
6 | - <view :style="{color:!nextStatus?'':'#0079fe'}" class="item">2.设置新密码</view> | |
7 | - </view> | |
8 | - <view v-if="!nextStatus" style="margin-top: 40rpx;" class="f__login"> | |
9 | - <view class="loginPhone"> | |
10 | - <view class="form-row"><u-input v-model="phone" type="number" placeholder="请输入手机号码" border="bottom"></u-input></view> | |
11 | - <view style="height: 25rpx;"></view> | |
12 | - <view class="form-row"> | |
13 | - <u-input type="number" v-model="vCode" placeholder="请输入短信验证码" border="bottom"> | |
14 | - <template slot="suffix" @click="getVcode"> | |
15 | - <view class="getvcode">{{ codeText }}</view> | |
16 | - </template> | |
17 | - </u-input> | |
18 | - </view> | |
19 | - <button class="submit" size="default" @click="onNextSubmit"><text style="color:#fff">下一步</text></button> | |
20 | - </view> | |
21 | - </view> | |
22 | - <view v-else style="margin-top: 40rpx;" class="f__login"> | |
23 | - <view class="loginPhone"> | |
24 | - <view class="form-row u-flex"> | |
25 | - <u-input v-model="password" :password="showPasswordF" placeholder="请设置6-20位新的登录密码" border="bottom"> | |
26 | - <template slot="suffix" @click="showPasswordModeF"> | |
27 | - <view style="padding:20rpx"><u-icon :name="showPasswordF ? '/static/eye-hide.png' : '/static/eye.png'"></u-icon></view> | |
28 | - </template> | |
29 | - </u-input> | |
30 | - </view> | |
31 | - <view class="form-row u-flex"> | |
32 | - <u-input v-model="rePassword" :password="showPasswordS" placeholder="请再次输入新的登录密码" border="bottom"> | |
33 | - <template slot="suffix" @click="showPasswordModeS"> | |
34 | - <view style="padding:20rpx"><u-icon :name="showPasswordS ? '/static/eye-hide.png' : '/static/eye.png'"></u-icon></view> | |
35 | - </template> | |
36 | - </u-input> | |
37 | - </view> | |
38 | - <button class="submit" size="default" @click="onSubmit"><text style="color:#fff">确定</text></button> | |
39 | - </view> | |
40 | - </view> | |
41 | - </view> | |
42 | -</template> | |
43 | - | |
44 | -<script> | |
45 | -var clear; | |
46 | -export default { | |
47 | - data() { | |
48 | - return { | |
49 | - readonly: false, | |
50 | - codeText: '发送验证码', | |
51 | - phone: '', //号码 | |
52 | - vCode: '', //验证码 | |
53 | - nextStatus: false, | |
54 | - password: '', | |
55 | - rePassword: '', | |
56 | - showPasswordF: true, | |
57 | - showPasswordS: true | |
58 | - }; | |
59 | - }, | |
60 | - methods: { | |
61 | - //验证码按钮文字状态 | |
62 | - getCodeState() { | |
63 | - const _this = this; | |
64 | - this.readonly = true; | |
65 | - this.codeText = '60s后重新获取'; | |
66 | - var s = 60; | |
67 | - clear = setInterval(() => { | |
68 | - s--; | |
69 | - _this.codeText = s + 's后重新获取'; | |
70 | - if (s <= 0) { | |
71 | - clearInterval(clear); | |
72 | - _this.codeText = '发送验证码'; | |
73 | - _this.readonly = false; | |
74 | - } | |
75 | - }, 1000); | |
76 | - }, | |
77 | - //获取验证码 | |
78 | - getVcode() { | |
79 | - if (this.readonly) { | |
80 | - uni.showToast({ | |
81 | - title: '验证码已发送~', | |
82 | - icon: 'none' | |
83 | - }); | |
84 | - return; | |
85 | - } | |
86 | - if (this.phone == '') { | |
87 | - uni.showToast({ | |
88 | - title: '请输入手机号~', | |
89 | - icon: 'none' | |
90 | - }); | |
91 | - return; | |
92 | - } | |
93 | - const phoneRegular = /^1\d{10}$/; | |
94 | - if (!phoneRegular.test(this.phone)) { | |
95 | - uni.showToast({ | |
96 | - title: '手机号格式不正确~', | |
97 | - icon: 'none' | |
98 | - }); | |
99 | - return; | |
100 | - } | |
101 | - let httpData = {}; | |
102 | - // 获取验证码接口 | |
103 | - uni.$u.http.post(`/yt/noauth/resetCode/${this.phone}` ).then(res => { | |
104 | - this.getCodeState(); //开始倒计时 | |
105 | - }) | |
106 | - }, | |
107 | - onNextSubmit() { | |
108 | - const phoneRegular = /^1\d{10}$/; | |
109 | - if(this.phone==''){ | |
110 | - uni.showToast({ | |
111 | - title: '请输入手机号码~', | |
112 | - icon: 'none' | |
113 | - }); | |
114 | - return; | |
115 | - }else if (!phoneRegular.test(this.phone)) { | |
116 | - uni.showToast({ | |
117 | - title: '手机号格式不正确~', | |
118 | - icon: 'none' | |
119 | - }); | |
120 | - return; | |
121 | - } | |
122 | - if (this.vCode == '') { | |
123 | - uni.showToast({ | |
124 | - title: '请输入验证码~', | |
125 | - icon: 'none' | |
126 | - }); | |
127 | - return; | |
128 | - } else if(!(/^\d{6}$/.test(this.vCode))){ | |
129 | - uni.showToast({ | |
130 | - title: '验证码格式不正确~', | |
131 | - icon: 'none' | |
132 | - }); | |
133 | - return | |
134 | - } | |
135 | - this.nextStatus = true | |
136 | - }, | |
137 | - showPhone(){ | |
138 | - this.nextStatus = false | |
139 | - }, | |
140 | - onSubmit() { | |
141 | - const passReg=/^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/ | |
142 | - if(this.password=='' &&this.rePassword==''){ | |
143 | - uni.showToast({ | |
144 | - title: '请输入密码~', | |
145 | - icon: 'none' | |
146 | - }); | |
147 | - return; | |
148 | - }else if (!passReg.test(this.password)&&!passReg.test(this.rePassword)) { | |
149 | - uni.showToast({ | |
150 | - title: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~', | |
151 | - icon: 'none', | |
152 | - duration: 3000 | |
153 | - }); | |
154 | - return; | |
155 | - } | |
156 | - if(this.password!==this.rePassword) return uni.$u.toast('两次输入密码不一致'); | |
157 | - let httpData={ | |
158 | - password: this.password, | |
159 | - phoneNumber: this.phone, | |
160 | - userId: this.vCode | |
161 | - } | |
162 | - uni.$u.http.post(`/yt/noauth/reset/${this.phone}`, httpData).then(res => { | |
163 | - uni.showToast({ | |
164 | - title: '重置密码成功~', | |
165 | - icon: 'none' | |
166 | - }).then(res=>{ | |
167 | - uni.reLaunch({ | |
168 | - url: '/pages/personal/personal' | |
169 | - }); | |
170 | - /** | |
171 | - * 有些时候不起作用 | |
172 | - */ | |
173 | - // uni.navigateBack({ | |
174 | - // delta:2 | |
175 | - // }) | |
176 | - }) | |
177 | - }); | |
178 | - }, | |
179 | - showPasswordModeF() { | |
180 | - this.showPasswordF = !this.showPasswordF; | |
181 | - }, | |
182 | - showPasswordModeS() { | |
183 | - this.showPasswordS = !this.showPasswordS; | |
184 | - }, | |
185 | - } | |
186 | - } | |
187 | -</script> | |
188 | - | |
189 | -<style lang="scss" scoped> | |
190 | - @import './static/findPassword.scss'; | |
1 | +<template> | |
2 | + <view class="find-password-page"> | |
3 | + <public-module></public-module> | |
4 | + <view class="top u-flex"> | |
5 | + <view @click="showPhone" :style="{ color: !nextStatus ? '#0079fe' : '' }" class="item">1.验证手机号码</view> | |
6 | + <view :style="{ color: !nextStatus ? '' : '#0079fe' }" class="item">2.设置新密码</view> | |
7 | + </view> | |
8 | + <view v-if="!nextStatus" style="margin-top: 40rpx;" class="f__login"> | |
9 | + <view class="loginPhone"> | |
10 | + <view class="form-row"><u-input v-model="phone" type="number" placeholder="请输入手机号码" border="bottom" /></view> | |
11 | + <view class="form-row"> | |
12 | + <u-input type="number" v-model="vCode" placeholder="请输入验证码" border="bottom"> | |
13 | + <template slot="suffix" @click="getVcode"> | |
14 | + <view class="getvcode">{{ codeText }}</view> | |
15 | + </template> | |
16 | + </u-input> | |
17 | + </view> | |
18 | + <button class="submit" size="default" @click="onNextSubmit"><text style="color:#fff">下一步</text></button> | |
19 | + </view> | |
20 | + </view> | |
21 | + <view v-else style="margin-top: 40rpx;" class="f__login"> | |
22 | + <view class="loginPhone"> | |
23 | + <view class="form-row u-flex"> | |
24 | + <u-input v-model="password" :password="showPasswordF" placeholder="请设置6-20位新的登录密码" border="bottom"> | |
25 | + <template slot="suffix" @click="showPasswordModeF"> | |
26 | + <view style="padding:20rpx"><u-icon :name="showPasswordF ? '/static/eye-hide.png' : '/static/eye.png'"></u-icon></view> | |
27 | + </template> | |
28 | + </u-input> | |
29 | + </view> | |
30 | + <view class="form-row u-flex"> | |
31 | + <u-input v-model="rePassword" :password="showPasswordS" placeholder="请再次输入新的登录密码" border="bottom"> | |
32 | + <template slot="suffix" @click="showPasswordModeS"> | |
33 | + <view style="padding:20rpx"><u-icon :name="showPasswordS ? '/static/eye-hide.png' : '/static/eye.png'"></u-icon></view> | |
34 | + </template> | |
35 | + </u-input> | |
36 | + </view> | |
37 | + <button class="submit" size="default" @click="onSubmit"><text style="color:#fff">确定</text></button> | |
38 | + </view> | |
39 | + </view> | |
40 | + </view> | |
41 | +</template> | |
42 | + | |
43 | +<script> | |
44 | +var clear; | |
45 | +export default { | |
46 | + data() { | |
47 | + return { | |
48 | + readonly: false, | |
49 | + codeText: '发送验证码', | |
50 | + phone: '', //号码 | |
51 | + vCode: '', //验证码 | |
52 | + nextStatus: false, | |
53 | + password: '', | |
54 | + rePassword: '', | |
55 | + showPasswordF: true, | |
56 | + showPasswordS: true | |
57 | + }; | |
58 | + }, | |
59 | + methods: { | |
60 | + //验证码按钮文字状态 | |
61 | + getCodeState() { | |
62 | + const _this = this; | |
63 | + this.readonly = true; | |
64 | + this.codeText = '60s后重新获取'; | |
65 | + var s = 60; | |
66 | + clear = setInterval(() => { | |
67 | + s--; | |
68 | + _this.codeText = s + 's后重新获取'; | |
69 | + if (s <= 0) { | |
70 | + clearInterval(clear); | |
71 | + _this.codeText = '发送验证码'; | |
72 | + _this.readonly = false; | |
73 | + } | |
74 | + }, 1000); | |
75 | + }, | |
76 | + //获取验证码 | |
77 | + getVcode() { | |
78 | + if (this.readonly) { | |
79 | + uni.showToast({ | |
80 | + title: '验证码已发送~', | |
81 | + icon: 'none' | |
82 | + }); | |
83 | + return; | |
84 | + } | |
85 | + if (this.phone == '') { | |
86 | + uni.showToast({ | |
87 | + title: '请输入手机号~', | |
88 | + icon: 'none' | |
89 | + }); | |
90 | + return; | |
91 | + } | |
92 | + const phoneRegular = /^1\d{10}$/; | |
93 | + if (!phoneRegular.test(this.phone)) { | |
94 | + uni.showToast({ | |
95 | + title: '手机号格式不正确~', | |
96 | + icon: 'none' | |
97 | + }); | |
98 | + return; | |
99 | + } | |
100 | + let httpData = {}; | |
101 | + // 获取验证码接口 | |
102 | + uni.$u.http | |
103 | + .post(`/yt/noauth/resetCode/${this.phone}`) | |
104 | + .then(res => { | |
105 | + this.getCodeState(); //开始倒计时 | |
106 | + }) | |
107 | + .catch(err => { | |
108 | + uni.showToast({ | |
109 | + title: err.data.msg, | |
110 | + icon: 'none' | |
111 | + }); | |
112 | + }); | |
113 | + }, | |
114 | + onNextSubmit() { | |
115 | + const phoneRegular = /^1\d{10}$/; | |
116 | + if (this.phone == '') { | |
117 | + uni.showToast({ | |
118 | + title: '请输入手机号码~', | |
119 | + icon: 'none' | |
120 | + }); | |
121 | + return; | |
122 | + } else if (!phoneRegular.test(this.phone)) { | |
123 | + uni.showToast({ | |
124 | + title: '手机号格式不正确~', | |
125 | + icon: 'none' | |
126 | + }); | |
127 | + return; | |
128 | + } | |
129 | + if (this.vCode == '') { | |
130 | + uni.showToast({ | |
131 | + title: '请输入验证码~', | |
132 | + icon: 'none' | |
133 | + }); | |
134 | + return; | |
135 | + } else if (!/^\d{6}$/.test(this.vCode)) { | |
136 | + uni.showToast({ | |
137 | + title: '验证码格式不正确~', | |
138 | + icon: 'none' | |
139 | + }); | |
140 | + return; | |
141 | + } | |
142 | + this.nextStatus = true; | |
143 | + }, | |
144 | + showPhone() { | |
145 | + this.nextStatus = false; | |
146 | + }, | |
147 | + onSubmit() { | |
148 | + const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/; | |
149 | + if (this.password == '' && this.rePassword == '') { | |
150 | + uni.showToast({ | |
151 | + title: '请输入密码~', | |
152 | + icon: 'none' | |
153 | + }); | |
154 | + return; | |
155 | + } else if (!passReg.test(this.password) && !passReg.test(this.rePassword)) { | |
156 | + uni.showToast({ | |
157 | + title: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~', | |
158 | + icon: 'none', | |
159 | + duration: 3000 | |
160 | + }); | |
161 | + return; | |
162 | + } | |
163 | + if (this.password !== this.rePassword) return uni.$u.toast('两次输入密码不一致'); | |
164 | + let httpData = { | |
165 | + password: this.password, | |
166 | + phoneNumber: this.phone, | |
167 | + userId: this.vCode | |
168 | + }; | |
169 | + uni.$u.http | |
170 | + .post(`/yt/noauth/reset/${this.phone}`, httpData) | |
171 | + .then(res => { | |
172 | + uni | |
173 | + .showToast({ | |
174 | + title: '重置密码成功~', | |
175 | + icon: 'none' | |
176 | + }) | |
177 | + .then(res => { | |
178 | + uni.reLaunch({ | |
179 | + url: '/pages/personal/personal' | |
180 | + }); | |
181 | + }); | |
182 | + }) | |
183 | + .catch(err => { | |
184 | + uni.showToast({ | |
185 | + title: err.data.msg, | |
186 | + icon: 'none' | |
187 | + }); | |
188 | + console.log(err.data.msg); | |
189 | + }); | |
190 | + }, | |
191 | + showPasswordModeF() { | |
192 | + this.showPasswordF = !this.showPasswordF; | |
193 | + }, | |
194 | + showPasswordModeS() { | |
195 | + this.showPasswordS = !this.showPasswordS; | |
196 | + } | |
197 | + } | |
198 | +}; | |
199 | +</script> | |
200 | + | |
201 | +<style lang="scss" scoped> | |
202 | +@import './static/findPassword.scss'; | |
191 | 203 | </style> | ... | ... |
1 | -.code-page { | |
2 | - min-height: 100vh; | |
3 | - background-color: #fff; | |
4 | - width: 750rpx; | |
5 | - background: url(/static/login.png) no-repeat; | |
6 | -} | |
7 | -.f__login { | |
8 | - padding: 48rpx 32rpx; | |
9 | - border-radius: 18rpx 18rpx 0 0; | |
10 | - z-index: 99; | |
11 | - position: relative; | |
12 | -} | |
13 | - | |
14 | -.loginPhone { | |
15 | - .phone-main { | |
16 | - .text { | |
17 | - font-size: 22px; | |
18 | - color: #3a4759; | |
19 | - position: relative; | |
20 | - z-index: 9999; | |
21 | - font-family: PingFangSC-Semibold, PingFang SC; | |
22 | - font-weight: 600; | |
23 | - } | |
24 | - } | |
25 | - .form-row { | |
26 | - position: relative; | |
27 | - // border-bottom: 1rpx solid #e8e8e8; | |
28 | - margin-top: 30rpx; | |
29 | - .input { | |
30 | - font-size: 34rpx; | |
31 | - line-height: 102rpx; | |
32 | - height: 94rpx; | |
33 | - width: 100%; | |
34 | - box-sizing: border-box; | |
35 | - font-size: 30rpx; | |
36 | - padding: 0; | |
37 | - font-weight: bold; | |
38 | - } | |
39 | - | |
40 | - .getvcode { | |
41 | - font-family: PingFangSC-Regular, PingFang SC; | |
42 | - font-weight: 400; | |
43 | - font-size: 15px; | |
44 | - height: 80rpx; | |
45 | - color: #6299ff; | |
46 | - line-height: 80rpx; | |
47 | - min-width: 188rpx; | |
48 | - text-align: center; | |
49 | - border-radius: 8rpx; | |
50 | - position: absolute; | |
51 | - top: 50%; | |
52 | - transform: translateY(-50%); | |
53 | - right: 0; | |
54 | - z-index: 11; | |
55 | - } | |
56 | - } | |
57 | - | |
58 | - .submit { | |
59 | - margin-top: 60rpx; | |
60 | - width: 100%; | |
61 | - position: relative; | |
62 | - background: linear-gradient(90deg, #5dc2fc 0%, #377dff 100%); | |
63 | - border-radius: 46px; | |
64 | - .text { | |
65 | - color: #ffffff; | |
66 | - } | |
67 | - } | |
68 | - .account-style { | |
69 | - flex-direction: row; | |
70 | - margin-top: 48rpx; | |
71 | - justify-content: space-between; | |
72 | - .content { | |
73 | - color: #999999; | |
74 | - font-size: 13px; | |
75 | - } | |
76 | - } | |
1 | +.code-page { | |
2 | + min-height: 100vh; | |
3 | + background-color: #fff; | |
4 | + width: 750rpx; | |
5 | + background: url(/static/login.png) no-repeat; | |
6 | +} | |
7 | +.f__login { | |
8 | + padding: 48rpx 32rpx; | |
9 | + border-radius: 18rpx 18rpx 0 0; | |
10 | + z-index: 99; | |
11 | + position: relative; | |
12 | +} | |
13 | + | |
14 | +.loginPhone { | |
15 | + .phone-main { | |
16 | + .text { | |
17 | + font-size: 22px; | |
18 | + color: #3a4759; | |
19 | + position: relative; | |
20 | + z-index: 9999; | |
21 | + font-family: PingFangSC-Semibold, PingFang SC; | |
22 | + font-weight: 600; | |
23 | + } | |
24 | + } | |
25 | + .form-row { | |
26 | + margin-top: 30rpx; | |
27 | + .getvcode { | |
28 | + font-family: PingFangSC-Regular, PingFang SC; | |
29 | + font-weight: 400; | |
30 | + font-size: 14px; | |
31 | + color: #6299ff; | |
32 | + } | |
33 | + } | |
34 | + | |
35 | + .submit { | |
36 | + margin-top: 60rpx; | |
37 | + width: 100%; | |
38 | + position: relative; | |
39 | + background: linear-gradient(90deg, #5dc2fc 0%, #377dff 100%); | |
40 | + border-radius: 46px; | |
41 | + .text { | |
42 | + color: #ffffff; | |
43 | + } | |
44 | + } | |
45 | + .account-style { | |
46 | + flex-direction: row; | |
47 | + margin-top: 48rpx; | |
48 | + justify-content: space-between; | |
49 | + .content { | |
50 | + color: #999999; | |
51 | + font-size: 13px; | |
52 | + } | |
53 | + } | |
77 | 54 | } | ... | ... |
1 | -.find-password-page { | |
2 | - min-height: 100vh; | |
3 | - background-color: #fff; | |
4 | -} | |
5 | -.top { | |
6 | - width: 750rpx; | |
7 | - height: 100rpx; | |
8 | - border: 0.1px solid #f7f9ff; | |
9 | - justify-content: space-between; | |
10 | - flex-direction: row; | |
11 | - align-items: center; | |
12 | - | |
13 | - .item { | |
14 | - width: 375rpx; | |
15 | - height: 100rpx; | |
16 | - border: 0.1px solid #f7f9ff; | |
17 | - text-align: center; | |
18 | - line-height: 90rpx; | |
19 | - } | |
20 | -} | |
21 | - | |
22 | -.f__login { | |
23 | - padding: 0 30rpx; | |
24 | - | |
25 | - .loginPhone { | |
26 | - .form-row { | |
27 | - position: relative; | |
28 | - justify-content: space-between; | |
29 | - .v-input { | |
30 | - width: 620rpx; | |
31 | - } | |
32 | - .v-password { | |
33 | - position: absolute; | |
34 | - right: 18rpx; | |
35 | - z-index: 66666; | |
36 | - } | |
37 | - .input { | |
38 | - font-size: 34rpx; | |
39 | - line-height: 102rpx; | |
40 | - height: 94rpx; | |
41 | - width: 100%; | |
42 | - box-sizing: border-box; | |
43 | - font-size: 30rpx; | |
44 | - font-weight: bold; | |
45 | - } | |
46 | - | |
47 | - .getvcode { | |
48 | - font-size: 26rpx; | |
49 | - height: 80rpx; | |
50 | - color: #6299ff; | |
51 | - line-height: 80rpx; | |
52 | - min-width: 188rpx; | |
53 | - text-align: center; | |
54 | - border-radius: 8rpx; | |
55 | - position: absolute; | |
56 | - top: 50%; | |
57 | - transform: translateY(-50%); | |
58 | - right: 0; | |
59 | - z-index: 11; | |
60 | - &.forhidden { | |
61 | - } | |
62 | - } | |
63 | - } | |
64 | - | |
65 | - .submit { | |
66 | - margin-top: 60rpx; | |
67 | - width: 100%; | |
68 | - background: #377dff; | |
69 | - border-radius: 48px; | |
70 | - } | |
71 | - } | |
1 | +.find-password-page { | |
2 | + min-height: 100vh; | |
3 | + background-color: #fff; | |
4 | +} | |
5 | +.top { | |
6 | + width: 750rpx; | |
7 | + height: 100rpx; | |
8 | + border: 0.1px solid #f7f9ff; | |
9 | + justify-content: space-between; | |
10 | + flex-direction: row; | |
11 | + align-items: center; | |
12 | + | |
13 | + .item { | |
14 | + width: 375rpx; | |
15 | + height: 100rpx; | |
16 | + border: 0.1px solid #f7f9ff; | |
17 | + text-align: center; | |
18 | + line-height: 90rpx; | |
19 | + } | |
20 | +} | |
21 | + | |
22 | +.f__login { | |
23 | + padding: 0 30rpx; | |
24 | + .loginPhone { | |
25 | + .form-row { | |
26 | + margin-top: 30rpx; | |
27 | + .getvcode { | |
28 | + font-family: PingFangSC-Regular, PingFang SC; | |
29 | + font-weight: 400; | |
30 | + font-size: 14px; | |
31 | + color: #6299ff; | |
32 | + } | |
33 | + } | |
34 | + | |
35 | + .submit { | |
36 | + margin-top: 60rpx; | |
37 | + width: 100%; | |
38 | + background: #377dff; | |
39 | + border-radius: 48px; | |
40 | + } | |
41 | + } | |
72 | 42 | } | ... | ... |
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | <view class="form-row u-flex"> |
18 | 18 | <u-input v-model="loginForm.password" :password="showPassword" placeholder="请输入登录密码" border="bottom"> |
19 | 19 | <template slot="suffix" @click="showPasswordMode"> |
20 | - <view style="padding:20rpx"><u-icon :name="showPassword ? '/static/eye-hide.png' : '/static/eye.png'"></u-icon></view> | |
20 | + <view style="padding:10rpx"><u-icon :name="showPassword ? '/static/eye-hide.png' : '/static/eye.png'"></u-icon></view> | |
21 | 21 | </template> |
22 | 22 | </u-input> |
23 | 23 | </view> |
... | ... | @@ -57,7 +57,7 @@ export default { |
57 | 57 | |
58 | 58 | password: '' |
59 | 59 | }, |
60 | - showPassword: false, | |
60 | + showPassword: true, | |
61 | 61 | code: '', |
62 | 62 | openid: '' |
63 | 63 | }; | ... | ... |
1 | -.login-page { | |
2 | - min-height: 100vh; | |
3 | - width: 750rpx; | |
4 | - background: url(/static/login.png) no-repeat; | |
5 | - .login-main { | |
6 | - flex-direction: column; | |
7 | - .content { | |
8 | - height: 250rpx; | |
9 | - margin-top: 90rpx; | |
10 | - margin-left: -107rpx; | |
11 | - position: relative; | |
12 | - top: 50rpx; | |
13 | - left: -15rpx; | |
14 | - .hello { | |
15 | - font-size: 30px; | |
16 | - color: #3a4759; | |
17 | - z-index: 9999; | |
18 | - position: relative; | |
19 | - } | |
20 | - .hello-welcome { | |
21 | - position: relative; | |
22 | - font-size: 30px; | |
23 | - color: #3a4759; | |
24 | - z-index: 9999; | |
25 | - } | |
26 | - } | |
27 | - } | |
28 | -} | |
29 | - | |
30 | -.f__login { | |
31 | - padding: 8rpx 32rpx; | |
32 | - border-radius: 18rpx 18rpx 0 0; | |
33 | - z-index: 99; | |
34 | - position: relative; | |
35 | -} | |
36 | - | |
37 | -.loginPhone { | |
38 | - .form-row { | |
39 | - position: relative; | |
40 | - justify-content: space-between; | |
41 | - // margin-top: 60rpx; | |
42 | - .v-input { | |
43 | - width: 690rpx; | |
44 | - border-bottom: 1px solid #e5e5e5; | |
45 | - } | |
46 | - .v-password { | |
47 | - position: absolute; | |
48 | - right: 0rpx; | |
49 | - z-index: 66666; | |
50 | - } | |
51 | - .input { | |
52 | - font-size: 34rpx; | |
53 | - line-height: 102rpx; | |
54 | - height: 114rpx; | |
55 | - width: 100%; | |
56 | - box-sizing: border-box; | |
57 | - font-size: 30rpx; | |
58 | - padding: 0; | |
59 | - font-weight: bold; | |
60 | - } | |
61 | - } | |
62 | - | |
63 | - .submit { | |
64 | - margin-top: 60rpx; | |
65 | - background: linear-gradient(90deg, #5dc2fc 0%, #377dff 100%); | |
66 | - width: 100%; | |
67 | - border-radius: 46px; | |
68 | - .text { | |
69 | - color: #ffffff; | |
70 | - } | |
71 | - } | |
72 | - .row-item { | |
73 | - flex-direction: row; | |
74 | - margin-top: 60rpx; | |
75 | - justify-content: space-between; | |
76 | - .row-phone { | |
77 | - color: #999999; | |
78 | - font-size: 13px; | |
79 | - } | |
80 | - .row-reset { | |
81 | - color: #999999; | |
82 | - font-size: 13px; | |
83 | - position: relative; | |
84 | - } | |
85 | - } | |
86 | - .link-login { | |
87 | - justify-content: center; | |
88 | - flex-direction: column; | |
89 | - margin-top: 370rpx; | |
90 | - /* #ifdef APP-PLUS */ | |
91 | - margin-top: 250rpx; | |
92 | - /* #endif */ | |
93 | - .link-text { | |
94 | - color: #999999; | |
95 | - font-size: 13px; | |
96 | - } | |
97 | - .link-image { | |
98 | - .image { | |
99 | - width: 75rpx; | |
100 | - height: 75rpx; | |
101 | - } | |
102 | - } | |
103 | - } | |
1 | +.login-page { | |
2 | + min-height: 100vh; | |
3 | + width: 750rpx; | |
4 | + background: url(/static/login.png) no-repeat; | |
5 | + .login-main { | |
6 | + flex-direction: column; | |
7 | + .content { | |
8 | + height: 250rpx; | |
9 | + margin-top: 90rpx; | |
10 | + margin-left: -107rpx; | |
11 | + position: relative; | |
12 | + top: 50rpx; | |
13 | + left: -15rpx; | |
14 | + .hello { | |
15 | + font-size: 30px; | |
16 | + color: #3a4759; | |
17 | + z-index: 9999; | |
18 | + position: relative; | |
19 | + } | |
20 | + .hello-welcome { | |
21 | + position: relative; | |
22 | + font-size: 30px; | |
23 | + color: #3a4759; | |
24 | + z-index: 9999; | |
25 | + } | |
26 | + } | |
27 | + } | |
28 | +} | |
29 | + | |
30 | +.f__login { | |
31 | + padding: 8rpx 32rpx; | |
32 | + border-radius: 18rpx 18rpx 0 0; | |
33 | + z-index: 99; | |
34 | + position: relative; | |
35 | +} | |
36 | + | |
37 | +.loginPhone { | |
38 | + .form-row { | |
39 | + justify-content: space-between; | |
40 | + margin-top: 30rpx; | |
41 | + } | |
42 | + | |
43 | + .submit { | |
44 | + margin-top: 60rpx; | |
45 | + background: linear-gradient(90deg, #5dc2fc 0%, #377dff 100%); | |
46 | + width: 100%; | |
47 | + border-radius: 46px; | |
48 | + .text { | |
49 | + color: #ffffff; | |
50 | + } | |
51 | + } | |
52 | + .row-item { | |
53 | + flex-direction: row; | |
54 | + margin-top: 60rpx; | |
55 | + justify-content: space-between; | |
56 | + .row-phone { | |
57 | + color: #999999; | |
58 | + font-size: 13px; | |
59 | + } | |
60 | + .row-reset { | |
61 | + color: #999999; | |
62 | + font-size: 13px; | |
63 | + position: relative; | |
64 | + } | |
65 | + } | |
66 | + .link-login { | |
67 | + justify-content: center; | |
68 | + flex-direction: column; | |
69 | + margin-top: 370rpx; | |
70 | + /* #ifdef APP-PLUS */ | |
71 | + margin-top: 250rpx; | |
72 | + /* #endif */ | |
73 | + .link-text { | |
74 | + color: #999999; | |
75 | + font-size: 13px; | |
76 | + } | |
77 | + .link-image { | |
78 | + .image { | |
79 | + width: 75rpx; | |
80 | + height: 75rpx; | |
81 | + } | |
82 | + } | |
83 | + } | |
104 | 84 | } | ... | ... |