Showing
27 changed files
with
696 additions
and
645 deletions
1 | <script> | 1 | <script> |
2 | import base from '@/config/baseUrl'; | 2 | import base from '@/config/baseUrl'; |
3 | import store from '@/store'; | 3 | import store from '@/store'; |
4 | -// #ifdef APP-PLUS | ||
5 | -import APPUpdate from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate'; | ||
6 | -// #endif | ||
7 | 4 | ||
8 | import { mpUpData, scene } from '@/config/common'; | 5 | import { mpUpData, scene } from '@/config/common'; |
9 | export default { | 6 | export default { |
@@ -16,9 +13,6 @@ export default { | @@ -16,9 +13,6 @@ export default { | ||
16 | store.commit('setCacheData'); | 13 | store.commit('setCacheData'); |
17 | //获取二维码信息 | 14 | //获取二维码信息 |
18 | scene(e); | 15 | scene(e); |
19 | - // #ifdef APP-PLUS | ||
20 | - APPUpdate(); //检测app更新 | ||
21 | - // #endif | ||
22 | }, | 16 | }, |
23 | onShow(e) { | 17 | onShow(e) { |
24 | // #ifdef MP | 18 | // #ifdef MP |
@@ -70,8 +70,12 @@ | @@ -70,8 +70,12 @@ | ||
70 | <view><u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea></view> | 70 | <view><u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea></view> |
71 | </view> | 71 | </view> |
72 | <!-- #endif --> | 72 | <!-- #endif --> |
73 | - <view v-if="list.status !== 'CLEARED_ACK'" style="margin-top: 44rpx;display: flex;align-items: center;justify-content: center;"> | ||
74 | - <view class="u-flex" style="width: 400rpx"><u-button @click="handleSubmit" type="primary" shape="circle" text="处理"></u-button></view> | 73 | + <view style="margin-top: 44rpx;display: flex;align-items: center;justify-content: space-between;"> |
74 | + <view v-if="list.status !== 'CLEARED_ACK' && list.status !== 'ACTIVE_ACK'" class="u-flex" style="width: 260rpx"> | ||
75 | + <u-button @click="handleSubmit" type="primary" shape="circle" text="处理"></u-button> | ||
76 | + </view> | ||
77 | + <view style="width: 30rpx;"></view> | ||
78 | + <view v-if="list.status == 'ACTIVE_ACK'" class="u-flex" style="width: 260rpx"><u-button @click="handleRemove" type="error" shape="circle" text="清除"></u-button></view> | ||
75 | </view> | 79 | </view> |
76 | </view> | 80 | </view> |
77 | </template> | 81 | </template> |
@@ -95,6 +99,7 @@ export default { | @@ -95,6 +99,7 @@ export default { | ||
95 | uni.hideTabBar(); | 99 | uni.hideTabBar(); |
96 | }, | 100 | }, |
97 | methods: { | 101 | methods: { |
102 | + //处理 | ||
98 | handleSubmit() { | 103 | handleSubmit() { |
99 | if (this.formModel.result == '') return uni.$u.toast('请输入处理结果'); | 104 | if (this.formModel.result == '') return uni.$u.toast('请输入处理结果'); |
100 | else | 105 | else |
@@ -121,6 +126,31 @@ export default { | @@ -121,6 +126,31 @@ export default { | ||
121 | uni.$u.toast(e.data?.message); | 126 | uni.$u.toast(e.data?.message); |
122 | }); | 127 | }); |
123 | }, | 128 | }, |
129 | + //清除 | ||
130 | + handleRemove() { | ||
131 | + uni.$u.http | ||
132 | + .post(`/alarm/${this.list.id}/clear`) | ||
133 | + .then(res => { | ||
134 | + if (res == '') { | ||
135 | + uni.showToast({ | ||
136 | + title: '清除成功~', | ||
137 | + icon: 'none' | ||
138 | + }); | ||
139 | + let pages = getCurrentPages(); //获取所有页面栈实例列表 | ||
140 | + let nowPage = pages[pages.length - 1]; //当前页页面实例 | ||
141 | + let prevPage = pages[pages.length - 2]; //上一页页面实例 | ||
142 | + prevPage.$vm.detailStatus = true; | ||
143 | + setTimeout(() => { | ||
144 | + uni.navigateBack({ | ||
145 | + delta: 1 | ||
146 | + }); | ||
147 | + }, 500); | ||
148 | + } | ||
149 | + }) | ||
150 | + .catch(e => { | ||
151 | + uni.$u.toast(e.data?.message); | ||
152 | + }); | ||
153 | + }, | ||
124 | formatDetailText(e) { | 154 | formatDetailText(e) { |
125 | //去除字符串双引号 | 155 | //去除字符串双引号 |
126 | const jsonStr = JSON.stringify(e); | 156 | const jsonStr = JSON.stringify(e); |
1 | .alarm-detail-page { | 1 | .alarm-detail-page { |
2 | padding: 30rpx; | 2 | padding: 30rpx; |
3 | } | 3 | } |
4 | -.alarm-detail-column { | ||
5 | - border-radius: 20px; | 4 | +.alarm- { |
5 | + border-radius: 10px; | ||
6 | width: 688rpx; | 6 | width: 688rpx; |
7 | height: 573rpx; | 7 | height: 573rpx; |
8 | background-color: #ffffff; | 8 | background-color: #ffffff; |
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | } | 54 | } |
55 | .hanle-main { | 55 | .hanle-main { |
56 | margin-top: 30rpx; | 56 | margin-top: 30rpx; |
57 | - border-radius: 20px; | 57 | + border-radius: 10px; |
58 | width: 688rpx; | 58 | width: 688rpx; |
59 | height: 273rpx; | 59 | height: 273rpx; |
60 | background-color: #ffffff; | 60 | background-color: #ffffff; |
@@ -128,30 +128,7 @@ export const judgeLogin = (callback) => { | @@ -128,30 +128,7 @@ export const judgeLogin = (callback) => { | ||
128 | } | 128 | } |
129 | if (!storeUserInfo.isToken) { | 129 | if (!storeUserInfo.isToken) { |
130 | // #ifdef MP | 130 | // #ifdef MP |
131 | - return uni.$u.toast('请登录') | ||
132 | - // uni.$showModal({ | ||
133 | - // title: "登录提示", | ||
134 | - // confirmVal: '去登录', | ||
135 | - // cancelVal: '再逛会', | ||
136 | - // content: '此时此刻需要您登录喔~', | ||
137 | - // }).then(res => { | ||
138 | - // uni.navigateTo({ | ||
139 | - // url: "/pages/personal/login" | ||
140 | - // }); | ||
141 | - // }).catch(res => {}) | ||
142 | - // store.commit('setLoginPopupShow', true); | ||
143 | - // #endif | ||
144 | - // #ifdef APP-PLUS | ||
145 | - uni.$showModal({ | ||
146 | - title: "登录提示", | ||
147 | - confirmVal: '去登录', | ||
148 | - cancelVal: '再逛会', | ||
149 | - content: '此时此刻需要您登录喔~', | ||
150 | - }).then(res => { | ||
151 | - uni.navigateTo({ | ||
152 | - url: "/pages/personal/login" | ||
153 | - }); | ||
154 | - }).catch(res => {}) | 131 | + return |
155 | // #endif | 132 | // #endif |
156 | // #ifdef H5 | 133 | // #ifdef H5 |
157 | h5Login(); | 134 | h5Login(); |
@@ -31,6 +31,11 @@ uni.$u.http.setConfig((config) => { | @@ -31,6 +31,11 @@ uni.$u.http.setConfig((config) => { | ||
31 | // 请求拦截 | 31 | // 请求拦截 |
32 | uni.$u.http.interceptors.request.use( | 32 | uni.$u.http.interceptors.request.use( |
33 | (config) => { | 33 | (config) => { |
34 | + if (store.state.userInfo.isThirdLogin) { | ||
35 | + uni.switchTab({ | ||
36 | + url: "../pages/personal/personal", | ||
37 | + }); | ||
38 | + } | ||
34 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} | 39 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} |
35 | config.data = config.data || {}; | 40 | config.data = config.data || {}; |
36 | // 根据custom参数中配置的是否需要token,添加对应的请求头 | 41 | // 根据custom参数中配置的是否需要token,添加对应的请求头 |
@@ -71,7 +76,6 @@ uni.$u.http.interceptors.response.use( | @@ -71,7 +76,6 @@ uni.$u.http.interceptors.response.use( | ||
71 | } else {} | 76 | } else {} |
72 | }, | 77 | }, |
73 | (response) => { | 78 | (response) => { |
74 | - console.log('Response error', response) | ||
75 | // 关闭加载动画 | 79 | // 关闭加载动画 |
76 | store.commit("setLoadingShow", false); | 80 | store.commit("setLoadingShow", false); |
77 | let show = true; | 81 | let show = true; |
@@ -82,12 +86,19 @@ uni.$u.http.interceptors.response.use( | @@ -82,12 +86,19 @@ uni.$u.http.interceptors.response.use( | ||
82 | } else if (message == "request:fail timeout") { | 86 | } else if (message == "request:fail timeout") { |
83 | errorData = "请求超时:请检查网络"; | 87 | errorData = "请求超时:请检查网络"; |
84 | } else if (response.data.status == 401) { | 88 | } else if (response.data.status == 401) { |
85 | - uni.reLaunch({ | ||
86 | - url: "/publicLoginSubPage/public/login", | ||
87 | - }); | ||
88 | - // 清空登录信息 | ||
89 | - store.commit("emptyUserInfo"); | ||
90 | - show = false; | 89 | + if (!store.state.userInfo.isThirdLogin) { |
90 | + uni.reLaunch({ | ||
91 | + url: "/publicLoginSubPage/public/login", | ||
92 | + }); | ||
93 | + // 清空登录信息 | ||
94 | + store.commit("emptyUserInfo"); | ||
95 | + show = false; | ||
96 | + } else { | ||
97 | + uni.switchTab({ | ||
98 | + url: "../pages/personal/personal", | ||
99 | + }); | ||
100 | + show = false; | ||
101 | + } | ||
91 | } else { | 102 | } else { |
92 | errorData = message || ""; | 103 | errorData = message || ""; |
93 | } | 104 | } |
@@ -30,7 +30,12 @@ | @@ -30,7 +30,12 @@ | ||
30 | <!-- 吸顶组件 --> | 30 | <!-- 吸顶组件 --> |
31 | <!-- 自带分页组件 --> | 31 | <!-- 自带分页组件 --> |
32 | <mescroll-body ref="mescrollRef" :up="upOption" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"> | 32 | <mescroll-body ref="mescrollRef" :up="upOption" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"> |
33 | - <view class="device-list"> | 33 | + <!-- 无数据图片 --> |
34 | + <view v-if="list.length == 0" style="position: relative;top: 100rpx;flex-direction: column;" class="u-flex"> | ||
35 | + <view><image style="width: 280rpx;height: 250rpx;" src="../../static/empty.png"></image></view> | ||
36 | + <view style="text-align: center;"><text style="font-size: 12px;color: gray;">~ 空空如也 ~</text></view> | ||
37 | + </view> | ||
38 | + <view v-else class="device-list"> | ||
34 | <view @click="openAlertDetail(item)" class="list-item" v-for="(item, index) in list" :key="index"> | 39 | <view @click="openAlertDetail(item)" class="list-item" v-for="(item, index) in list" :key="index"> |
35 | <view class="u-flex item"> | 40 | <view class="u-flex item"> |
36 | <view class="item-text text-clip"> | 41 | <view class="item-text text-clip"> |
@@ -164,7 +169,7 @@ | @@ -164,7 +169,7 @@ | ||
164 | <view class="u-flex popup-alarm-child"> | 169 | <view class="u-flex popup-alarm-child"> |
165 | <view class="home-text-muted">选择日期</view> | 170 | <view class="home-text-muted">选择日期</view> |
166 | <view style="width: 623rpx;margin-left: 5rpx;margin-right: 70rpx;margin-top: 35rpx;"> | 171 | <view style="width: 623rpx;margin-left: 5rpx;margin-right: 70rpx;margin-top: 35rpx;"> |
167 | - <uni-datetime-picker v-model="range" type="daterange" /> | 172 | + <uni-datetime-picker v-model="range" type="datetimerange" rangeSeparator="至" /> |
168 | </view> | 173 | </view> |
169 | </view> | 174 | </view> |
170 | </view> | 175 | </view> |
@@ -197,7 +202,7 @@ export default { | @@ -197,7 +202,7 @@ export default { | ||
197 | }, | 202 | }, |
198 | data() { | 203 | data() { |
199 | return { | 204 | return { |
200 | - range: ['', ''], | 205 | + range: [], |
201 | alertStatusVal: '', | 206 | alertStatusVal: '', |
202 | deviceTypeVal: '', | 207 | deviceTypeVal: '', |
203 | alertLevelVal: '', | 208 | alertLevelVal: '', |
@@ -297,7 +302,7 @@ export default { | @@ -297,7 +302,7 @@ export default { | ||
297 | this.selectTimeVal = e.value; | 302 | this.selectTimeVal = e.value; |
298 | let curTime = new Date(); | 303 | let curTime = new Date(); |
299 | const formatS = curTime.getTime(); | 304 | const formatS = curTime.getTime(); |
300 | - let addMinute = new Date(curTime.setMinutes(curTime.getMinutes() + this.selectTimeVal)); | 305 | + let addMinute = new Date(curTime.setMinutes(curTime.getMinutes() - this.selectTimeVal)); |
301 | const formatE = addMinute.getTime(); | 306 | const formatE = addMinute.getTime(); |
302 | this.timeData.getTimeGapS = formatS; | 307 | this.timeData.getTimeGapS = formatS; |
303 | this.timeData.getTimeGapE = formatE; | 308 | this.timeData.getTimeGapE = formatE; |
@@ -318,8 +323,8 @@ export default { | @@ -318,8 +323,8 @@ export default { | ||
318 | this.startTimeArea = ''; | 323 | this.startTimeArea = ''; |
319 | this.endTimeArea = ''; | 324 | this.endTimeArea = ''; |
320 | } else { | 325 | } else { |
321 | - this.startTimeArea = this.timeData.getTimeGapS; | ||
322 | - this.endTimeArea = this.timeData.getTimeGapE; | 326 | + this.startTimeArea = this.timeData.getTimeGapE; |
327 | + this.endTimeArea = this.timeData.getTimeGapS; | ||
323 | } | 328 | } |
324 | this.loadData( | 329 | this.loadData( |
325 | 1, | 330 | 1, |
@@ -378,7 +383,7 @@ export default { | @@ -378,7 +383,7 @@ export default { | ||
378 | topBack() { | 383 | topBack() { |
379 | uni.pageScrollTo({ | 384 | uni.pageScrollTo({ |
380 | scrollTop: 0, // 滚动到页面的目标位置 这个是滚动到顶部, 0 | 385 | scrollTop: 0, // 滚动到页面的目标位置 这个是滚动到顶部, 0 |
381 | - duration: 300 // 滚动动画的时长 | 386 | + duration: 10 // 滚动动画的时长 |
382 | }); | 387 | }); |
383 | }, | 388 | }, |
384 | /*下拉刷新的回调 */ | 389 | /*下拉刷新的回调 */ |
@@ -451,7 +456,6 @@ export default { | @@ -451,7 +456,6 @@ export default { | ||
451 | } | 456 | } |
452 | }) | 457 | }) |
453 | .catch(e => { | 458 | .catch(e => { |
454 | - uni.$u.toast(e.data?.message); | ||
455 | //联网失败, 结束加载 | 459 | //联网失败, 结束加载 |
456 | that.mescroll.endErr(); | 460 | that.mescroll.endErr(); |
457 | }); | 461 | }); |
@@ -41,9 +41,7 @@ export default { | @@ -41,9 +41,7 @@ export default { | ||
41 | this.tree = list; | 41 | this.tree = list; |
42 | } | 42 | } |
43 | }) | 43 | }) |
44 | - .catch(e => { | ||
45 | - uni.$u.toast(e.data.message); | ||
46 | - }); | 44 | + .catch(e => {}); |
47 | }, | 45 | }, |
48 | confirm(val) { | 46 | confirm(val) { |
49 | this.id = val[0].id; | 47 | this.id = val[0].id; |
@@ -125,14 +125,18 @@ | @@ -125,14 +125,18 @@ | ||
125 | justify-content: space-between; | 125 | justify-content: space-between; |
126 | 126 | ||
127 | .item { | 127 | .item { |
128 | - margin: 30rpx; | ||
129 | justify-content: flex-start; | 128 | justify-content: flex-start; |
130 | flex-direction: column; | 129 | flex-direction: column; |
131 | align-items: center; | 130 | align-items: center; |
131 | + height: 211rpx; | ||
132 | + margin-top: 8rpx; | ||
133 | + margin-left: 37rpx; | ||
132 | 134 | ||
133 | .item-text { | 135 | .item-text { |
134 | width: 400rpx; | 136 | width: 400rpx; |
135 | text-align: left; | 137 | text-align: left; |
138 | + margin-top: 13rpx; | ||
139 | + line-height: 40rpx; | ||
136 | 140 | ||
137 | .text { | 141 | .text { |
138 | color: #666666; | 142 | color: #666666; |
@@ -152,7 +156,8 @@ | @@ -152,7 +156,8 @@ | ||
152 | 156 | ||
153 | .item-right { | 157 | .item-right { |
154 | flex-direction: row; | 158 | flex-direction: row; |
155 | - margin-top: -15rpx; | 159 | + margin-top: -3rpx; |
160 | + margin-right: 25rpx; | ||
156 | 161 | ||
157 | .right-image { | 162 | .right-image { |
158 | width: 30rpx; | 163 | width: 30rpx; |
@@ -5,12 +5,12 @@ | @@ -5,12 +5,12 @@ | ||
5 | <view class="org-sty"> | 5 | <view class="org-sty"> |
6 | <view @click="openOrg" class="org-item"> | 6 | <view @click="openOrg" class="org-item"> |
7 | <view class="u-flex org-contact"><text class="text">组织关系</text></view> | 7 | <view class="u-flex org-contact"><text class="text">组织关系</text></view> |
8 | - <view class="u-flex org-device"> | 8 | + <view @click="openOrg" class="u-flex org-device"> |
9 | <image class="device-image" src="../../../static/org.png"></image> | 9 | <image class="device-image" src="../../../static/org.png"></image> |
10 | - <text class="device-text">设备数:{{ deviceTotal }}</text> | 10 | + <text class="device-text">摄像头数:{{ cameraTotal }}</text> |
11 | </view> | 11 | </view> |
12 | </view> | 12 | </view> |
13 | - <view class="org-item"><image class="image" src="../../../static/arrow-right.png"></image></view> | 13 | + <view @click="openOrg" class="org-item"><image class="image" src="../../../static/arrow-right.png"></image></view> |
14 | </view> | 14 | </view> |
15 | <view style="height: 150rpx;"></view> | 15 | <view style="height: 150rpx;"></view> |
16 | <!-- 自带分页组件 --> | 16 | <!-- 自带分页组件 --> |
@@ -54,7 +54,7 @@ export default { | @@ -54,7 +54,7 @@ export default { | ||
54 | auto: false // 不自动加载 | 54 | auto: false // 不自动加载 |
55 | }, | 55 | }, |
56 | current: 0, | 56 | current: 0, |
57 | - deviceTotal: 0, | 57 | + cameraTotal: 0, |
58 | list: [], | 58 | list: [], |
59 | ordId: '' | 59 | ordId: '' |
60 | }; | 60 | }; |
@@ -72,7 +72,7 @@ export default { | @@ -72,7 +72,7 @@ export default { | ||
72 | onLoad() { | 72 | onLoad() { |
73 | // 隐藏原生的tabbar | 73 | // 隐藏原生的tabbar |
74 | uni.hideTabBar(); | 74 | uni.hideTabBar(); |
75 | - this.getDeviceTotalData(); | 75 | + this.getcameraTotalData(); |
76 | }, | 76 | }, |
77 | methods: { | 77 | methods: { |
78 | /*下拉刷新的回调 */ | 78 | /*下拉刷新的回调 */ |
@@ -98,6 +98,7 @@ export default { | @@ -98,6 +98,7 @@ export default { | ||
98 | .then(res => { | 98 | .then(res => { |
99 | uni.stopPullDownRefresh(); | 99 | uni.stopPullDownRefresh(); |
100 | this.mescroll.endByPage(res.items.length, res.total); | 100 | this.mescroll.endByPage(res.items.length, res.total); |
101 | + this.cameraTotal = res.total; | ||
101 | if (pageNo == 1) { | 102 | if (pageNo == 1) { |
102 | this.list = res.items; | 103 | this.list = res.items; |
103 | } else { | 104 | } else { |
@@ -105,7 +106,6 @@ export default { | @@ -105,7 +106,6 @@ export default { | ||
105 | } | 106 | } |
106 | }) | 107 | }) |
107 | .catch(e => { | 108 | .catch(e => { |
108 | - uni.$u.toast(e.data?.message); | ||
109 | //联网失败, 结束加载 | 109 | //联网失败, 结束加载 |
110 | this.mescroll.endErr(); | 110 | this.mescroll.endErr(); |
111 | }); | 111 | }); |
@@ -113,22 +113,6 @@ export default { | @@ -113,22 +113,6 @@ export default { | ||
113 | hideImageUrl(item, index) { | 113 | hideImageUrl(item, index) { |
114 | this.current = index; | 114 | this.current = index; |
115 | }, | 115 | }, |
116 | - getDeviceTotalData() { | ||
117 | - let httpData = { | ||
118 | - page: 1, | ||
119 | - pageSize: 10 | ||
120 | - }; | ||
121 | - uni.$u.http | ||
122 | - .get('/yt/device', { params: httpData, custom: { load: false } }) | ||
123 | - .then(res => { | ||
124 | - if (res) { | ||
125 | - this.deviceTotal = res.total; | ||
126 | - } | ||
127 | - }) | ||
128 | - .catch(e => { | ||
129 | - uni.$u.toast(e.data?.message); | ||
130 | - }); | ||
131 | - }, | ||
132 | openCameraDetail(e) { | 116 | openCameraDetail(e) { |
133 | console.log(e); | 117 | console.log(e); |
134 | }, | 118 | }, |
@@ -41,9 +41,7 @@ export default { | @@ -41,9 +41,7 @@ export default { | ||
41 | this.tree = list; | 41 | this.tree = list; |
42 | } | 42 | } |
43 | }) | 43 | }) |
44 | - .catch(e => { | ||
45 | - uni.$u.toast(e.data.message); | ||
46 | - }); | 44 | + .catch(e => {}); |
47 | }, | 45 | }, |
48 | confirm(val) { | 46 | confirm(val) { |
49 | this.id = val[0].id; | 47 | this.id = val[0].id; |
@@ -144,9 +144,9 @@ export default { | @@ -144,9 +144,9 @@ export default { | ||
144 | }); | 144 | }); |
145 | }, | 145 | }, |
146 | openOrgStatus() { | 146 | openOrgStatus() { |
147 | - uni.navigateTo({ | ||
148 | - url: 'configuration/configuration' | ||
149 | - }); | 147 | + // uni.navigateTo({ |
148 | + // url: 'configuration/configuration' | ||
149 | + // }); | ||
150 | }, | 150 | }, |
151 | //告警状态查询 | 151 | //告警状态查询 |
152 | navigatorAlarmStatus(e) { | 152 | navigatorAlarmStatus(e) { |
@@ -67,11 +67,11 @@ | @@ -67,11 +67,11 @@ | ||
67 | width: 330rpx; | 67 | width: 330rpx; |
68 | height: 200rpx; | 68 | height: 200rpx; |
69 | background-color: #fff; | 69 | background-color: #fff; |
70 | - border-radius: 20px; | 70 | + border-radius: 10px; |
71 | margin-left: 25rpx; | 71 | margin-left: 25rpx; |
72 | margin-right: 21rpx; | 72 | margin-right: 21rpx; |
73 | .video { | 73 | .video { |
74 | - border-radius: 20px; | 74 | + border-radius: 10px; |
75 | width: 330rpx; | 75 | width: 330rpx; |
76 | height: 200rpx; | 76 | height: 200rpx; |
77 | } | 77 | } |
@@ -92,7 +92,7 @@ | @@ -92,7 +92,7 @@ | ||
92 | .image { | 92 | .image { |
93 | width: 330rpx; | 93 | width: 330rpx; |
94 | height: 200rpx; | 94 | height: 200rpx; |
95 | - border-radius: 20px; | 95 | + border-radius: 10px; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | } | 98 | } |
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | background-color: #fff; | 20 | background-color: #fff; |
21 | border: 0.01rpx solid #fff; | 21 | border: 0.01rpx solid #fff; |
22 | padding: 40rpx; | 22 | padding: 40rpx; |
23 | - border-radius: 20px; | 23 | + border-radius: 10px; |
24 | .item-center { | 24 | .item-center { |
25 | width: 290rpx; | 25 | width: 290rpx; |
26 | height: 150rpx; | 26 | height: 150rpx; |
@@ -80,7 +80,7 @@ | @@ -80,7 +80,7 @@ | ||
80 | justify-content: space-between; | 80 | justify-content: space-between; |
81 | align-items: flex-start; | 81 | align-items: flex-start; |
82 | flex-direction: column; | 82 | flex-direction: column; |
83 | - border-radius: 20px; | 83 | + border-radius: 10px; |
84 | .item-child-top { | 84 | .item-child-top { |
85 | justify-content: space-between; | 85 | justify-content: space-between; |
86 | padding: 30rpx; | 86 | padding: 30rpx; |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> | 8 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> |
9 | <block v-if="userInfo.isToken || userInfo.isThirdLogin"> | 9 | <block v-if="userInfo.isToken || userInfo.isThirdLogin"> |
10 | <view @click="openPersonalInfo" class="u-m-r-20"> | 10 | <view @click="openPersonalInfo" class="u-m-r-20"> |
11 | - <image class="avatar" mode="aspectFill" :src="userInfo.avatar == '' ? '/static/logo.png' : userInfo.avatar"></image> | 11 | + <image class="avatar" mode="aspectFill" :src="!userInfo.avatar ? '../../static/logo.png' : userInfo.avatar || thirdObj.avatarUrl"></image> |
12 | </view> | 12 | </view> |
13 | <view class="u-flex-1"> | 13 | <view class="u-flex-1"> |
14 | <view class="nickName u-flex"> | 14 | <view class="nickName u-flex"> |
@@ -154,17 +154,19 @@ export default { | @@ -154,17 +154,19 @@ export default { | ||
154 | appUserKey: '', | 154 | appUserKey: '', |
155 | appUserSecret: '' | 155 | appUserSecret: '' |
156 | }, | 156 | }, |
157 | - thirdObj: {} | 157 | + thirdObj: {}, |
158 | + getOpenId: '' | ||
158 | }; | 159 | }; |
159 | }, | 160 | }, |
160 | onLoad(e) { | 161 | onLoad(e) { |
161 | // 隐藏原生的tabbar | 162 | // 隐藏原生的tabbar |
162 | uni.hideTabBar(); | 163 | uni.hideTabBar(); |
163 | - if (e.obj != null) { | ||
164 | - const params = JSON.parse(decodeURIComponent(e.obj)); | ||
165 | - this.thirdObj = params; | ||
166 | - } | ||
167 | - console.log('UserInfo', this.userInfo); | 164 | + // if (e.obj != null) { |
165 | + // const params = JSON.parse(decodeURIComponent(e.obj)); | ||
166 | + // // uni.$u.toast('eee', params.avatarUrl); | ||
167 | + // this.thirdObj = params; | ||
168 | + // } | ||
169 | + this.getOpenId = getApp().globalData.openId; | ||
168 | }, | 170 | }, |
169 | computed: { | 171 | computed: { |
170 | ...mapState(['userInfo']) | 172 | ...mapState(['userInfo']) |
@@ -232,7 +234,7 @@ export default { | @@ -232,7 +234,7 @@ export default { | ||
232 | loginMethod: 'ACCOUNT', | 234 | loginMethod: 'ACCOUNT', |
233 | ...this.bindAccountObj, | 235 | ...this.bindAccountObj, |
234 | platformName: 'WECHAT', | 236 | platformName: 'WECHAT', |
235 | - ...this.thirdObj | 237 | + thirdUserId: this.getOpenId |
236 | }; | 238 | }; |
237 | uni.$u.http | 239 | uni.$u.http |
238 | .post('/yt/third/bind', postData) | 240 | .post('/yt/third/bind', postData) |
@@ -260,8 +262,8 @@ export default { | @@ -260,8 +262,8 @@ export default { | ||
260 | } | 262 | } |
261 | }) | 263 | }) |
262 | .catch(e => { | 264 | .catch(e => { |
263 | - uni.$u.toast(e.data?.msg || e.data?.message); | ||
264 | - this.show = false; | 265 | + uni.$u.toast(e.data?.msg); |
266 | + this.show = true; | ||
265 | }); | 267 | }); |
266 | } else { | 268 | } else { |
267 | const phoneRegular = /^1\d{10}$/; | 269 | const phoneRegular = /^1\d{10}$/; |
@@ -295,7 +297,7 @@ export default { | @@ -295,7 +297,7 @@ export default { | ||
295 | loginMethod: 'PHONE', | 297 | loginMethod: 'PHONE', |
296 | ...this.bindPhoneObj, | 298 | ...this.bindPhoneObj, |
297 | platformName: 'WECHAT', | 299 | platformName: 'WECHAT', |
298 | - ...this.thirdObj | 300 | + thirdUserId: this.getOpenId |
299 | }; | 301 | }; |
300 | uni.$u.http | 302 | uni.$u.http |
301 | .post('/yt/third/bind', postData) | 303 | .post('/yt/third/bind', postData) |
@@ -321,8 +323,8 @@ export default { | @@ -321,8 +323,8 @@ export default { | ||
321 | this.saveUserInfo(); | 323 | this.saveUserInfo(); |
322 | }) | 324 | }) |
323 | .catch(e => { | 325 | .catch(e => { |
324 | - uni.$u.toast(e.data?.msg || e.data?.message); | ||
325 | - this.show = false; | 326 | + uni.$u.toast(e.data?.msg); |
327 | + this.show = true; | ||
326 | }); | 328 | }); |
327 | } | 329 | } |
328 | }, | 330 | }, |
@@ -11,8 +11,10 @@ | @@ -11,8 +11,10 @@ | ||
11 | width: 50px; | 11 | width: 50px; |
12 | height: 50px; | 12 | height: 50px; |
13 | border-radius: 25px; | 13 | border-radius: 25px; |
14 | - background-color: #ccc; | 14 | + background: #d8d8d8; |
15 | justify-content: center; | 15 | justify-content: center; |
16 | + border: 2px solid #ffffff; | ||
17 | + box-shadow: 0px 14px 26px 0px rgba(4, 7, 26, 0.2); | ||
16 | } | 18 | } |
17 | .click-login { | 19 | .click-login { |
18 | font-size: 18px; | 20 | font-size: 18px; |
1 | import Vue from 'vue'; | 1 | import Vue from 'vue'; |
2 | import moment from 'moment'; | 2 | import moment from 'moment'; |
3 | -// #ifdef APP-PLUS | ||
4 | -import {judgePermission} from './permission' | ||
5 | -// #endif | ||
6 | const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'; | 3 | const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'; |
7 | //金额过滤 | 4 | //金额过滤 |
8 | Vue.filter('money', function(val) { | 5 | Vue.filter('money', function(val) { |
@@ -26,68 +23,68 @@ Vue.filter('money', function(val) { | @@ -26,68 +23,68 @@ Vue.filter('money', function(val) { | ||
26 | }); | 23 | }); |
27 | //手机号中间4位为* | 24 | //手机号中间4位为* |
28 | Vue.filter('phone', function(val) { | 25 | Vue.filter('phone', function(val) { |
29 | - var tel = val; | ||
30 | - tel = "" + tel; | ||
31 | - var telShort = tel.replace(tel.substring(3, 7), "****") | ||
32 | - return telShort | 26 | + var tel = val; |
27 | + tel = "" + tel; | ||
28 | + var telShort = tel.replace(tel.substring(3, 7), "****") | ||
29 | + return telShort | ||
33 | }) | 30 | }) |
34 | //获取系统信息、判断ipX安全距离 | 31 | //获取系统信息、判断ipX安全距离 |
35 | export const getTabbarHeight = function() { | 32 | export const getTabbarHeight = function() { |
36 | - var systemInfo = uni.getSystemInfoSync() | ||
37 | - var data = { | ||
38 | - ...systemInfo, | ||
39 | - tabbarH: 50,//tabbar高度--单位px | ||
40 | - tabbarPaddingB: 0,//tabbar底部安全距离高度--单位px | ||
41 | - device: systemInfo.system.indexOf('iOS') != -1?'iOS':'Android', //苹果或者安卓设备 | ||
42 | - } | ||
43 | - let modelArr = ['10,3','10,6','X', 'XR', 'XS', '11', '12', '13', '14', '15', '16']; | ||
44 | - let model = systemInfo.model; | ||
45 | - model && modelArr.forEach(item => { | ||
46 | - //适配iphoneX以上的底部,给tabbar一定高度的padding-bottom | ||
47 | - if(model.indexOf(item) != -1 && (model.indexOf('iPhone') != -1 || model.indexOf('iphone') != -1)) { | ||
48 | - data.tabbarH = 70 | ||
49 | - data.tabbarPaddingB = 20 | ||
50 | - } | ||
51 | - }) | ||
52 | - return data; | 33 | + var systemInfo = uni.getSystemInfoSync() |
34 | + var data = { | ||
35 | + ...systemInfo, | ||
36 | + tabbarH: 50, //tabbar高度--单位px | ||
37 | + tabbarPaddingB: 0, //tabbar底部安全距离高度--单位px | ||
38 | + device: systemInfo.system.indexOf('iOS') != -1 ? 'iOS' : 'Android', //苹果或者安卓设备 | ||
39 | + } | ||
40 | + let modelArr = ['10,3', '10,6', 'X', 'XR', 'XS', '11', '12', '13', '14', '15', '16']; | ||
41 | + let model = systemInfo.model; | ||
42 | + model && modelArr.forEach(item => { | ||
43 | + //适配iphoneX以上的底部,给tabbar一定高度的padding-bottom | ||
44 | + if (model.indexOf(item) != -1 && (model.indexOf('iPhone') != -1 || model.indexOf('iphone') != -1)) { | ||
45 | + data.tabbarH = 70 | ||
46 | + data.tabbarPaddingB = 20 | ||
47 | + } | ||
48 | + }) | ||
49 | + return data; | ||
53 | } | 50 | } |
54 | 51 | ||
55 | //计算两点距离 | 52 | //计算两点距离 |
56 | -export const commonDistance = function(lat1, lng1, lat2, lng2) { | ||
57 | - var f = ((lat1 + lat2) / 2) * Math.PI / 180.0; | ||
58 | - var g = ((lat1 - lat2) / 2) * Math.PI / 180.0; | ||
59 | - var l = ((lng1 - lng2) / 2) * Math.PI / 180.0; | ||
60 | - var sg = Math.sin(g); | ||
61 | - var sl = Math.sin(l); | ||
62 | - var sf = Math.sin(f); | ||
63 | - var s, c, w, r, d, h1, h2; | ||
64 | - var a = 6378137.0; //地球的直径 | ||
65 | - var fl = 1 / 298.257; | ||
66 | - sg = sg * sg; | ||
67 | - sl = sl * sl; | ||
68 | - sf = sf * sf; | ||
69 | - s = sg * (1 - sl) + (1 - sf) * sl; | ||
70 | - c = (1 - sg) * (1 - sl) + sf * sl; | ||
71 | - w = Math.atan(Math.sqrt(s / c)); | ||
72 | - r = Math.sqrt(s * c) / w; | ||
73 | - d = 2 * w * a; | ||
74 | - h1 = (3 * r - 1) / 2 / c; | ||
75 | - h2 = (3 * r + 1) / 2 / s; | ||
76 | - var num = d * (1 + fl * (h1 * sf * (1 - sg) - h2 * (1 - sf) * sg)) | ||
77 | - // 换算单位 | ||
78 | - if (num == undefined) { | ||
79 | - num = "0.0 m" | ||
80 | - }; | ||
81 | - if (num < 1000) { | ||
82 | - num = (Math.round(num)).toFixed(1) + "m" | ||
83 | - } else if (num > 1000) { | ||
84 | - num = (Math.round(num / 100) / 10).toFixed(1) + "km" | ||
85 | - } | ||
86 | - return num | 53 | +export const commonDistance = function(lat1, lng1, lat2, lng2) { |
54 | + var f = ((lat1 + lat2) / 2) * Math.PI / 180.0; | ||
55 | + var g = ((lat1 - lat2) / 2) * Math.PI / 180.0; | ||
56 | + var l = ((lng1 - lng2) / 2) * Math.PI / 180.0; | ||
57 | + var sg = Math.sin(g); | ||
58 | + var sl = Math.sin(l); | ||
59 | + var sf = Math.sin(f); | ||
60 | + var s, c, w, r, d, h1, h2; | ||
61 | + var a = 6378137.0; //地球的直径 | ||
62 | + var fl = 1 / 298.257; | ||
63 | + sg = sg * sg; | ||
64 | + sl = sl * sl; | ||
65 | + sf = sf * sf; | ||
66 | + s = sg * (1 - sl) + (1 - sf) * sl; | ||
67 | + c = (1 - sg) * (1 - sl) + sf * sl; | ||
68 | + w = Math.atan(Math.sqrt(s / c)); | ||
69 | + r = Math.sqrt(s * c) / w; | ||
70 | + d = 2 * w * a; | ||
71 | + h1 = (3 * r - 1) / 2 / c; | ||
72 | + h2 = (3 * r + 1) / 2 / s; | ||
73 | + var num = d * (1 + fl * (h1 * sf * (1 - sg) - h2 * (1 - sf) * sg)) | ||
74 | + // 换算单位 | ||
75 | + if (num == undefined) { | ||
76 | + num = "0.0 m" | ||
77 | + }; | ||
78 | + if (num < 1000) { | ||
79 | + num = (Math.round(num)).toFixed(1) + "m" | ||
80 | + } else if (num > 1000) { | ||
81 | + num = (Math.round(num / 100) / 10).toFixed(1) + "km" | ||
82 | + } | ||
83 | + return num | ||
87 | } | 84 | } |
88 | // px转upx | 85 | // px转upx |
89 | -export const px2upx = function(n){ | ||
90 | - return n/(uni.upx2px(n)/n); | 86 | +export const px2upx = function(n) { |
87 | + return n / (uni.upx2px(n) / n); | ||
91 | } | 88 | } |
92 | 89 | ||
93 | // 判断两时间段之间活动状态、判断活动还有多长时间开始、多长时间结束----添加定时器运行此方法可倒计时 | 90 | // 判断两时间段之间活动状态、判断活动还有多长时间开始、多长时间结束----添加定时器运行此方法可倒计时 |
@@ -95,53 +92,59 @@ export const px2upx = function(n){ | @@ -95,53 +92,59 @@ export const px2upx = function(n){ | ||
95 | // var closeTime = new Date(item.closeTime.replace(/-/g, '/')).getTime(); //转时间戳 | 92 | // var closeTime = new Date(item.closeTime.replace(/-/g, '/')).getTime(); //转时间戳 |
96 | // var djs = this.djsTime(startTime, closeTime); | 93 | // var djs = this.djsTime(startTime, closeTime); |
97 | export const djsTime = function(startTime, endTime) { | 94 | export const djsTime = function(startTime, endTime) { |
98 | - var bbb = new Date().getTime(), | ||
99 | - leftTime = startTime - bbb, | ||
100 | - rightTime = endTime - bbb, | ||
101 | - djsTime = '', | ||
102 | - speed = 0, | ||
103 | - activityStatus = 0, //活动状态 1:未开始 2:进行中 3:已结束 | ||
104 | - dd,hh,mm,ss; | ||
105 | - if (leftTime > 0) { //还未开始 | ||
106 | - activityStatus = 1 | ||
107 | - dd = Math.floor(leftTime / 1000 / 60 / 60 / 24); | ||
108 | - hh = Math.floor((leftTime / 1000 / 60 / 60) % 24) < 10 ? '0' + Math.floor((leftTime / 1000 / 60 / 60) % 24) : Math.floor((leftTime / 1000 / 60 / 60) % 24); | ||
109 | - mm = Math.floor((leftTime / 1000 / 60) % 60) < 10 ? '0' + Math.floor((leftTime / 1000 / 60) % 60) : Math.floor((leftTime / 1000 / 60) % 60); | ||
110 | - ss = Math.floor((leftTime / 1000) % 60) < 10 ? '0' + Math.floor((leftTime / 1000) % 60) : Math.floor((leftTime / 1000) % 60); | ||
111 | - if (dd != 0) { | ||
112 | - djsTime = dd + "天 " + hh + ":" + mm + ":" + ss; | ||
113 | - } else { | ||
114 | - djsTime = hh + ":" + mm + ":" + ss; | ||
115 | - } | ||
116 | - } else if (leftTime <= 0) { | ||
117 | - if (rightTime > 0) { //进行中 | ||
118 | - activityStatus = 2; | ||
119 | - speed = (1 - rightTime / (endTime - startTime)) * 100; | ||
120 | - dd = Math.floor(rightTime / 1000 / 60 / 60 / 24); | ||
121 | - hh = Math.floor((rightTime / 1000 / 60 / 60) % 24) < 10 ? '0' + Math.floor((rightTime / 1000 / 60 / 60) % 24) : Math.floor((rightTime / 1000 / 60 / 60) % 24); | ||
122 | - mm = Math.floor((rightTime / 1000 / 60) % 60) < 10 ? '0' + Math.floor((rightTime / 1000 / 60) % 60) : Math.floor((rightTime / 1000 / 60) % 60); | ||
123 | - ss = Math.floor((rightTime / 1000) % 60) < 10 ? '0' + Math.floor((rightTime / 1000) % 60) : Math.floor((rightTime / 1000) % 60); | ||
124 | - if (dd != 0) { | ||
125 | - djsTime = dd + "天 " + hh + ":" + mm + ":" + ss; | ||
126 | - } else { | ||
127 | - djsTime = hh + ":" + mm + ":" + ss; | ||
128 | - } | ||
129 | - } else { //已结束 | ||
130 | - speed = 100; | ||
131 | - djsTime = '已结束'; | ||
132 | - activityStatus = 3; | ||
133 | - } | ||
134 | - } | ||
135 | - var item = { | ||
136 | - djsTime: djsTime, //距离当前时间差 | ||
137 | - activityStatus: activityStatus, //活动状态 1:未开始 2:进行中 3:已结束 | ||
138 | - speed: speed, //进度(单位%) | ||
139 | - dd: dd, //天 | ||
140 | - hh: hh, //小时 | ||
141 | - mm: mm, //分 | ||
142 | - ss: ss, //秒 | ||
143 | - } | ||
144 | - return item; | 95 | + var bbb = new Date().getTime(), |
96 | + leftTime = startTime - bbb, | ||
97 | + rightTime = endTime - bbb, | ||
98 | + djsTime = '', | ||
99 | + speed = 0, | ||
100 | + activityStatus = 0, //活动状态 1:未开始 2:进行中 3:已结束 | ||
101 | + dd, hh, mm, ss; | ||
102 | + if (leftTime > 0) { //还未开始 | ||
103 | + activityStatus = 1 | ||
104 | + dd = Math.floor(leftTime / 1000 / 60 / 60 / 24); | ||
105 | + hh = Math.floor((leftTime / 1000 / 60 / 60) % 24) < 10 ? '0' + Math.floor((leftTime / 1000 / 60 / 60) % | ||
106 | + 24) : Math.floor((leftTime / 1000 / 60 / 60) % 24); | ||
107 | + mm = Math.floor((leftTime / 1000 / 60) % 60) < 10 ? '0' + Math.floor((leftTime / 1000 / 60) % 60) : Math | ||
108 | + .floor((leftTime / 1000 / 60) % 60); | ||
109 | + ss = Math.floor((leftTime / 1000) % 60) < 10 ? '0' + Math.floor((leftTime / 1000) % 60) : Math.floor(( | ||
110 | + leftTime / 1000) % 60); | ||
111 | + if (dd != 0) { | ||
112 | + djsTime = dd + "天 " + hh + ":" + mm + ":" + ss; | ||
113 | + } else { | ||
114 | + djsTime = hh + ":" + mm + ":" + ss; | ||
115 | + } | ||
116 | + } else if (leftTime <= 0) { | ||
117 | + if (rightTime > 0) { //进行中 | ||
118 | + activityStatus = 2; | ||
119 | + speed = (1 - rightTime / (endTime - startTime)) * 100; | ||
120 | + dd = Math.floor(rightTime / 1000 / 60 / 60 / 24); | ||
121 | + hh = Math.floor((rightTime / 1000 / 60 / 60) % 24) < 10 ? '0' + Math.floor((rightTime / 1000 / 60 / | ||
122 | + 60) % 24) : Math.floor((rightTime / 1000 / 60 / 60) % 24); | ||
123 | + mm = Math.floor((rightTime / 1000 / 60) % 60) < 10 ? '0' + Math.floor((rightTime / 1000 / 60) % 60) : | ||
124 | + Math.floor((rightTime / 1000 / 60) % 60); | ||
125 | + ss = Math.floor((rightTime / 1000) % 60) < 10 ? '0' + Math.floor((rightTime / 1000) % 60) : Math.floor(( | ||
126 | + rightTime / 1000) % 60); | ||
127 | + if (dd != 0) { | ||
128 | + djsTime = dd + "天 " + hh + ":" + mm + ":" + ss; | ||
129 | + } else { | ||
130 | + djsTime = hh + ":" + mm + ":" + ss; | ||
131 | + } | ||
132 | + } else { //已结束 | ||
133 | + speed = 100; | ||
134 | + djsTime = '已结束'; | ||
135 | + activityStatus = 3; | ||
136 | + } | ||
137 | + } | ||
138 | + var item = { | ||
139 | + djsTime: djsTime, //距离当前时间差 | ||
140 | + activityStatus: activityStatus, //活动状态 1:未开始 2:进行中 3:已结束 | ||
141 | + speed: speed, //进度(单位%) | ||
142 | + dd: dd, //天 | ||
143 | + hh: hh, //小时 | ||
144 | + mm: mm, //分 | ||
145 | + ss: ss, //秒 | ||
146 | + } | ||
147 | + return item; | ||
145 | } | 148 | } |
146 | 149 | ||
147 | // 小程序获取定位权限判断 | 150 | // 小程序获取定位权限判断 |
@@ -151,14 +154,14 @@ function getMpLocation(successCallback, errCallback, isOpenSetting) { | @@ -151,14 +154,14 @@ function getMpLocation(successCallback, errCallback, isOpenSetting) { | ||
151 | success: res => { | 154 | success: res => { |
152 | if (res.authSetting['scope.userLocation'] || !isOpenSetting) { | 155 | if (res.authSetting['scope.userLocation'] || !isOpenSetting) { |
153 | uni.getLocation({ | 156 | uni.getLocation({ |
154 | - // #ifndef MP-ALIPAY | ||
155 | - type: 'gcj02', | ||
156 | - // #endif | ||
157 | - success(res){ | ||
158 | - console.log('successCallback') | 157 | + // #ifndef MP-ALIPAY |
158 | + type: 'gcj02', | ||
159 | + // #endif | ||
160 | + success(res) { | ||
161 | + console.log('successCallback') | ||
159 | successCallback(res); | 162 | successCallback(res); |
160 | }, | 163 | }, |
161 | - fail(err){ | 164 | + fail(err) { |
162 | console.log("位置信息错误", err); | 165 | console.log("位置信息错误", err); |
163 | errCallback("位置信息获取失败"); | 166 | errCallback("位置信息获取失败"); |
164 | } | 167 | } |
@@ -200,40 +203,24 @@ export const getAppLatLon = function(successCallback, errCallback, isOpenSetting | @@ -200,40 +203,24 @@ export const getAppLatLon = function(successCallback, errCallback, isOpenSetting | ||
200 | getMpLocation(successCallback, errCallback, isOpenSetting); | 203 | getMpLocation(successCallback, errCallback, isOpenSetting); |
201 | } | 204 | } |
202 | // #endif | 205 | // #endif |
203 | - // #ifdef MP-ALIPAY | ||
204 | - getMpLocation(successCallback, errCallback, false); | ||
205 | - // #endif | ||
206 | - // #ifdef H5 | ||
207 | - uni.getLocation({ | ||
208 | - type: 'gcj02', | ||
209 | - success(res){ | ||
210 | - console.log('successCallback') | ||
211 | - successCallback(res); | ||
212 | - }, | ||
213 | - fail(err){ | ||
214 | - console.log("位置信息错误", err); | ||
215 | - errCallback("位置信息获取失败"); | ||
216 | - } | ||
217 | - }); | ||
218 | - // #endif | ||
219 | - // #ifdef APP-PLUS | ||
220 | - judgePermission("location", function(result) { | ||
221 | - if (result == 1) { | ||
222 | - uni.getLocation({ | ||
223 | - type: 'gcj02', | ||
224 | - success: res => { | ||
225 | - successCallback(res); | ||
226 | - }, | ||
227 | - fail: (err) => { | ||
228 | - console.log("位置信息错误", err); | ||
229 | - errCallback("位置信息获取失败"); | ||
230 | - } | ||
231 | - }); | 206 | + // #ifdef MP-ALIPAY |
207 | + getMpLocation(successCallback, errCallback, false); | ||
208 | + // #endif | ||
209 | + // #ifdef H5 | ||
210 | + uni.getLocation({ | ||
211 | + type: 'gcj02', | ||
212 | + success(res) { | ||
213 | + console.log('successCallback') | ||
214 | + successCallback(res); | ||
215 | + }, | ||
216 | + fail(err) { | ||
217 | + console.log("位置信息错误", err); | ||
218 | + errCallback("位置信息获取失败"); | ||
232 | } | 219 | } |
233 | }); | 220 | }); |
234 | // #endif | 221 | // #endif |
235 | } | 222 | } |
236 | 223 | ||
237 | export function formatToDate(date = undefined, format = DATE_TIME_FORMAT) { | 224 | export function formatToDate(date = undefined, format = DATE_TIME_FORMAT) { |
238 | - return moment(date).format(format); | ||
239 | -} | ||
225 | + return moment(date).format(format); | ||
226 | +} |
@@ -3,12 +3,12 @@ | @@ -3,12 +3,12 @@ | ||
3 | <!-- 公共组件-每个页面必须引入 --> | 3 | <!-- 公共组件-每个页面必须引入 --> |
4 | <public-module></public-module> | 4 | <public-module></public-module> |
5 | <view @click="upAvatar" class="u-flex set-main"> | 5 | <view @click="upAvatar" class="u-flex set-main"> |
6 | - <view class="main-image"><image class="image" :src="avatar || '/static/logo.png'"></image></view> | 6 | + <view class="main-image"><image class="image" :src="avatar || '../../static/logo.png'"></image></view> |
7 | <view class="main-right-image"><image class="image" src="../../static/arrow-right.png"></image></view> | 7 | <view class="main-right-image"><image class="image" src="../../static/arrow-right.png"></image></view> |
8 | </view> | 8 | </view> |
9 | <view class="u-m-t-20 basic-text"><text class="text">基本资料</text></view> | 9 | <view class="u-m-t-20 basic-text"><text class="text">基本资料</text></view> |
10 | <view class="basic-main"> | 10 | <view class="basic-main"> |
11 | - <u--form labelPosition="left" :model="myInfoModel" :rules="rules" ref="myInfoFormRef"> | 11 | + <u--form labelPosition="left" :model="myInfoModel"> |
12 | <u-form-item labelWidth="80px" label="真实姓名" prop="userInfo.realName" borderBottom ref="item1"> | 12 | <u-form-item labelWidth="80px" label="真实姓名" prop="userInfo.realName" borderBottom ref="item1"> |
13 | <u--input placeholder="请输入真实姓名" v-model="myInfoModel.userInfo.realName" border="none"></u--input> | 13 | <u--input placeholder="请输入真实姓名" v-model="myInfoModel.userInfo.realName" border="none"></u--input> |
14 | </u-form-item> | 14 | </u-form-item> |
@@ -46,8 +46,12 @@ | @@ -46,8 +46,12 @@ | ||
46 | </u--form> | 46 | </u--form> |
47 | </view> | 47 | </view> |
48 | <view class="basic-bottom u-flex"> | 48 | <view class="basic-bottom u-flex"> |
49 | - <view class="item" v-if="info.data.isToken"><button class="submit" size="default" @click="clearAccountFunc" :style="{ background: InfoColor }">解绑</button></view> | ||
50 | - <view class="item" style="margin-right: 60rpx;"><button class="submit" size="default" @click="onSubmitFunc" :style="{ background: PrimaryColor }">确认</button></view> | 49 | + <view class="item" v-if="info.data.isThirdLogin"> |
50 | + <button class="submit" size="default" @click="clearAccountFunc" :style="{ background: InfoColor }"><text class="un-bind-text">解绑</text></button> | ||
51 | + </view> | ||
52 | + <view class="item" style="margin-right: 60rpx;" :style="[{ position: info.data.isThirdLogin ? '' : 'relative' }, { right: info.data.isThirdLogin ? '' : '-190rpx' }]"> | ||
53 | + <button class="submit" size="default" @click="onSubmitFunc" :style="{ background: PrimaryColor }"><text class="un-bind-text">确认</text></button> | ||
54 | + </view> | ||
51 | </view> | 55 | </view> |
52 | <!-- #ifdef MP --> | 56 | <!-- #ifdef MP --> |
53 | <view class="u-m-t-40"><text style="visibility: hidden;">#</text></view> | 57 | <view class="u-m-t-40"><text style="visibility: hidden;">#</text></view> |
@@ -67,12 +71,16 @@ | @@ -67,12 +71,16 @@ | ||
67 | </template> | 71 | </template> |
68 | 72 | ||
69 | <script> | 73 | <script> |
74 | +import { mapMutations } from 'vuex'; | ||
75 | +import baseUrl from '@/config/baseUrl.js'; | ||
76 | +import { mapState } from 'vuex'; | ||
77 | + | ||
70 | export default { | 78 | export default { |
71 | data() { | 79 | data() { |
72 | return { | 80 | return { |
73 | showBind: false, | 81 | showBind: false, |
74 | PrimaryColor: '#377DFF', //主题色 | 82 | PrimaryColor: '#377DFF', //主题色 |
75 | - InfoColor: '#E3E4E5', //主题色 | 83 | + InfoColor: '#00C9A7', //主题色 |
76 | myInfoModel: { | 84 | myInfoModel: { |
77 | userInfo: { | 85 | userInfo: { |
78 | realName: '', | 86 | realName: '', |
@@ -86,56 +94,9 @@ export default { | @@ -86,56 +94,9 @@ export default { | ||
86 | dateTime: Number(new Date()), | 94 | dateTime: Number(new Date()), |
87 | avatar: '', | 95 | avatar: '', |
88 | id: '', | 96 | id: '', |
89 | - rules: { | ||
90 | - 'userInfo.realName': [ | ||
91 | - { | ||
92 | - type: 'string', | ||
93 | - required: true, | ||
94 | - message: '请填写姓名', | ||
95 | - trigger: ['blur', 'change'] | ||
96 | - }, | ||
97 | - { | ||
98 | - validator: (rule, value, callback) => { | ||
99 | - return uni.$u.test.chinese(value); | ||
100 | - }, | ||
101 | - message: '姓名必须为中文', | ||
102 | - trigger: ['change', 'blur'] | ||
103 | - } | ||
104 | - ], | ||
105 | - 'userInfo.phoneNumber': [ | ||
106 | - { | ||
107 | - type: 'string', | ||
108 | - required: true, | ||
109 | - message: '请填写手机号码', | ||
110 | - trigger: ['blur', 'change'] | ||
111 | - }, | ||
112 | - { | ||
113 | - // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明 | ||
114 | - validator: (rule, value, callback) => { | ||
115 | - return uni.$u.test.mobile(value); | ||
116 | - }, | ||
117 | - message: '手机必须为数字', | ||
118 | - trigger: ['change', 'blur'] | ||
119 | - } | ||
120 | - ], | ||
121 | - 'userInfo.email': [ | ||
122 | - { | ||
123 | - type: 'string', | ||
124 | - required: true, | ||
125 | - message: '请填写邮箱', | ||
126 | - trigger: ['blur', 'change'] | ||
127 | - }, | ||
128 | - { | ||
129 | - validator: (rule, value, callback) => { | ||
130 | - return uni.$u.test.email(value); | ||
131 | - }, | ||
132 | - message: '邮箱必须带有@', | ||
133 | - trigger: ['change', 'blur'] | ||
134 | - } | ||
135 | - ] | ||
136 | - }, | ||
137 | info: {}, | 97 | info: {}, |
138 | - openIds: '' | 98 | + openIds: '', |
99 | + isUpdatePersonOrLoginInfo: false | ||
139 | }; | 100 | }; |
140 | }, | 101 | }, |
141 | onLoad(e) { | 102 | onLoad(e) { |
@@ -147,21 +108,23 @@ export default { | @@ -147,21 +108,23 @@ export default { | ||
147 | this.myInfoModel.userInfo.username = params.data.username; | 108 | this.myInfoModel.userInfo.username = params.data.username; |
148 | this.myInfoModel.userInfo.email = params.data.email; | 109 | this.myInfoModel.userInfo.email = params.data.email; |
149 | this.myInfoModel.userInfo.accountExpireTime = params.data.accountExpireTime; | 110 | this.myInfoModel.userInfo.accountExpireTime = params.data.accountExpireTime; |
150 | - this.avatar = params.data.avatar == undefined ? '../../static/avatar-test.png' : params.data.avatar; | 111 | + this.avatar = params.data.avatar == undefined ? '../../static/logo.png' : params.data.avatar; |
151 | this.id = params.data.userId; | 112 | this.id = params.data.userId; |
152 | } | 113 | } |
153 | }, | 114 | }, |
154 | onShow() { | 115 | onShow() { |
155 | let getOpenId = getApp().globalData.openId; | 116 | let getOpenId = getApp().globalData.openId; |
156 | - console.log('获取全局openId', getOpenId); | ||
157 | if (getOpenId) { | 117 | if (getOpenId) { |
158 | this.openIds = getOpenId; | 118 | this.openIds = getOpenId; |
159 | } | 119 | } |
160 | }, | 120 | }, |
121 | + computed: { | ||
122 | + ...mapState(['userInfo']) | ||
123 | + }, | ||
161 | methods: { | 124 | methods: { |
125 | + ...mapMutations(['setUserInfo']), | ||
162 | confrimBind(e) { | 126 | confrimBind(e) { |
163 | if (e) { | 127 | if (e) { |
164 | - console.log('Bind', e.third?.thirdUserId); | ||
165 | //解绑 | 128 | //解绑 |
166 | let httpData = { | 129 | let httpData = { |
167 | appUserId: e.data?.userId, | 130 | appUserId: e.data?.userId, |
@@ -186,8 +149,13 @@ export default { | @@ -186,8 +149,13 @@ export default { | ||
186 | this.showBind = true; | 149 | this.showBind = true; |
187 | }, | 150 | }, |
188 | // 修改头像 | 151 | // 修改头像 |
189 | - upAvatar() { | ||
190 | - var that = this; | 152 | + async upAvatar() { |
153 | + let token; | ||
154 | + token = this.userInfo.isToken || uni.getStorageSync('userInfo').isToken || undefined; | ||
155 | + // #ifdef H5 | ||
156 | + token = window.sessionStorage.getItem('userInfo').isToken; | ||
157 | + // #endif | ||
158 | + if (!token) return uni.$u.toast('请登录后上传图片'); | ||
191 | uni.chooseImage({ | 159 | uni.chooseImage({ |
192 | count: 1, | 160 | count: 1, |
193 | sourceType: ['camera', 'album'], | 161 | sourceType: ['camera', 'album'], |
@@ -216,52 +184,50 @@ export default { | @@ -216,52 +184,50 @@ export default { | ||
216 | }); | 184 | }); |
217 | return; | 185 | return; |
218 | } | 186 | } |
219 | - uni.$u.http | ||
220 | - .upload('/yt/oss/upload', { | ||
221 | - filePath: tempFilePaths[0], | ||
222 | - name: 'file' | ||
223 | - }) | ||
224 | - .then(res => { | ||
225 | - if (res) { | ||
226 | - that.avatar = res.fileStaticUri; | ||
227 | - return uni.$u.toast('头像上传成功'); | ||
228 | - } | ||
229 | - }); | 187 | + uni.uploadFile({ |
188 | + url: `${baseUrl.baseUrl}/yt/oss/upload`, | ||
189 | + filePath: tempFilePaths[0], | ||
190 | + name: 'file', | ||
191 | + header: { | ||
192 | + 'content-type': 'multipart/form-data', | ||
193 | + Authorization: 'Bearer ' + token | ||
194 | + }, | ||
195 | + formData: {}, | ||
196 | + success: res => { | ||
197 | + let objImage = JSON.parse(res.data); | ||
198 | + this.avatar = objImage.fileStaticUri; | ||
199 | + uni.$u.toast('头像上传成功'); | ||
200 | + } | ||
201 | + }); | ||
230 | } | 202 | } |
231 | }); | 203 | }); |
232 | }, | 204 | }, |
233 | onSubmitFunc() { | 205 | onSubmitFunc() { |
234 | - this.$refs.myInfoFormRef | ||
235 | - .validate() | 206 | + let httpData = { |
207 | + avatar: this.avatar, | ||
208 | + email: this.myInfoModel.userInfo.email, | ||
209 | + id: this.id, | ||
210 | + phoneNumber: this.myInfoModel.userInfo.phoneNumber, | ||
211 | + realName: this.myInfoModel.userInfo.realName | ||
212 | + }; | ||
213 | + uni.$u.http | ||
214 | + .put('/yt/user/center', httpData) | ||
236 | .then(res => { | 215 | .then(res => { |
237 | - let httpData = { | ||
238 | - avatar: this.avatar, | ||
239 | - email: this.myInfoModel.userInfo.email, | ||
240 | - id: this.id, | ||
241 | - phoneNumber: this.myInfoModel.userInfo.phoneNumber, | ||
242 | - realName: this.myInfoModel.userInfo.realName | ||
243 | - }; | ||
244 | - uni.$u.http | ||
245 | - .put('/yt/user/center', httpData) | ||
246 | - .then(res => { | ||
247 | - if (res) { | ||
248 | - uni.showToast({ | ||
249 | - title: '更新个人资料成功~', | ||
250 | - icon: 'none' | ||
251 | - }); | ||
252 | - setTimeout(() => { | ||
253 | - uni.navigateBack({ | ||
254 | - delta: 1 | ||
255 | - }); | ||
256 | - }, 500); | ||
257 | - } | ||
258 | - }) | ||
259 | - .catch(e => { | ||
260 | - uni.$u.toast(e.data.message); | 216 | + if (res) { |
217 | + this.setUserInfo(res); | ||
218 | + uni.showToast({ | ||
219 | + title: '更新个人资料成功~', | ||
220 | + icon: 'none' | ||
261 | }); | 221 | }); |
222 | + setTimeout(() => { | ||
223 | + uni.navigateBack({ | ||
224 | + delta: 1 | ||
225 | + }); | ||
226 | + }, 500); | ||
227 | + } | ||
262 | }) | 228 | }) |
263 | - .catch(errors => { | ||
264 | - uni.$u.toast('校验失败'); | 229 | + .catch(e => { |
230 | + uni.$u.toast(e.data.message); | ||
265 | }); | 231 | }); |
266 | }, | 232 | }, |
267 | dateClose() { | 233 | dateClose() { |
1 | <template> | 1 | <template> |
2 | - <view class="login-page"> | ||
3 | - <!-- 公共组件-每个页面必须引入 --> | ||
4 | - <public-module></public-module> | ||
5 | - <view class="u-flex login-main"> | ||
6 | - <view class="content"> | ||
7 | - <view class="hello login-text-muted">您好,</view> | ||
8 | - <view class="hello-welcome login-text-muted">欢迎来到ThingsKit!</view> | ||
9 | - <view class="circleStyle"></view> | ||
10 | - </view> | ||
11 | - </view> | ||
12 | - <view class="f__login"> | ||
13 | - <view class="loginPhone"> | ||
14 | - <view class="form-row u-flex"> | ||
15 | - <view class="v-input"><input type="text" v-model="loginForm.username" maxlength="32" placeholder="请输入登录账号" /></view> | ||
16 | - <u-icon></u-icon> | ||
17 | - </view> | ||
18 | - <view class="form-row u-flex"> | ||
19 | - <view class="v-input"><input type="text" v-model="loginForm.password" maxlength="32" placeholder="请输入登录密码" :password="!showPassword" /></view> | ||
20 | - <view class="v-password" @click="showPasswordMode"><u-icon color="#9a9a9a" size="25" :name="showPassword ? 'eye-fill' : 'eye-off'"></u-icon></view> | ||
21 | - <u-icon></u-icon> | ||
22 | - </view> | ||
23 | - <button class="submit" size="default" @click="onSubmitFunc"><text class="text">登录</text></button> | ||
24 | - <view class="u-flex row-item"> | ||
25 | - <view class="row-phone login-text-gray" @click="openCodeFunc">手机验证码登录</view> | ||
26 | - <view class="row-reset login-text-gray" @click="findPassrordFunc">忘记密码</view> | ||
27 | - </view> | ||
28 | - <view class="u-flex link-login"> | ||
29 | - <view class="link-text login-text-gray">第三方账号登录</view> | ||
30 | - <view style="height:20rpx"></view> | ||
31 | - <view @click="onAuthorization" class="link-image"><image class="image" src="../../static/weixin.png" mode="aspectFill"></image></view> | ||
32 | - <view class="circleStyleBottom"></view> | ||
33 | - </view> | ||
34 | - </view> | ||
35 | - </view> | ||
36 | - </view> | 2 | + <view class="login-page"> |
3 | + <!-- 公共组件-每个页面必须引入 --> | ||
4 | + | ||
5 | + <public-module></public-module> | ||
6 | + | ||
7 | + <view class="u-flex login-main"> | ||
8 | + <view class="content"> | ||
9 | + <view class="hello login-text-muted">您好,</view> | ||
10 | + | ||
11 | + <view class="hello-welcome login-text-muted">欢迎来到ThingsKit!</view> | ||
12 | + </view> | ||
13 | + </view> | ||
14 | + | ||
15 | + <view class="f__login"> | ||
16 | + <view class="loginPhone"> | ||
17 | + <view class="form-row u-flex"> | ||
18 | + <view class="v-input" | ||
19 | + ><input | ||
20 | + type="text" | ||
21 | + v-model="loginForm.username" | ||
22 | + maxlength="32" | ||
23 | + placeholder="请输入登录账号" | ||
24 | + /></view> | ||
25 | + | ||
26 | + <u-icon></u-icon> | ||
27 | + </view> | ||
28 | + | ||
29 | + <view class="form-row u-flex"> | ||
30 | + <view class="v-input" | ||
31 | + ><input | ||
32 | + type="text" | ||
33 | + v-model="loginForm.password" | ||
34 | + maxlength="32" | ||
35 | + placeholder="请输入登录密码" | ||
36 | + :password="!showPassword" | ||
37 | + /></view> | ||
38 | + | ||
39 | + <view class="v-password" @click="showPasswordMode"> | ||
40 | + <u-icon | ||
41 | + color="#9a9a9a" | ||
42 | + width="18" | ||
43 | + height="15" | ||
44 | + :name="showPassword ? '/static/eye.png' : '/static/eye-hide.png'" | ||
45 | + ></u-icon> | ||
46 | + </view> | ||
47 | + | ||
48 | + <u-icon></u-icon> | ||
49 | + </view> | ||
50 | + | ||
51 | + <button class="submit" size="default" @click="onSubmitFunc"> | ||
52 | + <text class="text">登录</text> | ||
53 | + </button> | ||
54 | + | ||
55 | + <view class="u-flex row-item"> | ||
56 | + <view class="row-phone login-text-gray" @click="openCodeFunc" | ||
57 | + >手机验证码登录</view | ||
58 | + > | ||
59 | + | ||
60 | + <view class="row-reset login-text-gray" @click="findPassrordFunc" | ||
61 | + >忘记密码</view | ||
62 | + > | ||
63 | + </view> | ||
64 | + | ||
65 | + <view class="u-flex link-login"> | ||
66 | + <view class="link-text login-text-gray">第三方账号登录</view> | ||
67 | + | ||
68 | + <view style="height: 20rpx"></view> | ||
69 | + | ||
70 | + <button class="link-image" @tap="onWenxinAuthorization"> | ||
71 | + <image | ||
72 | + class="image" | ||
73 | + src="../../static/weixin.png" | ||
74 | + mode="aspectFill" | ||
75 | + ></image> | ||
76 | + </button> | ||
77 | + </view> | ||
78 | + </view> | ||
79 | + </view> | ||
80 | + </view> | ||
37 | </template> | 81 | </template> |
38 | 82 | ||
39 | <script> | 83 | <script> |
40 | -import { mapMutations, mapActions } from 'vuex'; | ||
41 | -import { loginApp } from '@/config/login'; | ||
42 | -import baseUrl from '@/config/baseUrl.js'; | ||
43 | -import WXBizDataCrypt from '@/config/WXBizDataCrypt.js'; | ||
44 | -import { appId, appSecrect } from '@/config/constant.js'; | 84 | +import { mapMutations, mapActions } from "vuex"; |
85 | + | ||
86 | +import { loginApp } from "@/config/login"; | ||
87 | + | ||
88 | +import baseUrl from "@/config/baseUrl.js"; | ||
89 | + | ||
90 | +import WXBizDataCrypt from "@/config/WXBizDataCrypt.js"; | ||
91 | + | ||
92 | +import { appId, appSecrect } from "@/config/constant.js"; | ||
45 | 93 | ||
46 | export default { | 94 | export default { |
47 | - data() { | ||
48 | - return { | ||
49 | - loginForm: { | ||
50 | - username: '', | ||
51 | - password: '' | ||
52 | - }, | ||
53 | - showPassword: false, | ||
54 | - code: '', | ||
55 | - openid: '', | ||
56 | - session_key: '' | ||
57 | - }; | ||
58 | - }, | ||
59 | - onLoad() { | ||
60 | - //#ifdef MP-WEIXIN | ||
61 | - wx.login({ | ||
62 | - success: res => { | ||
63 | - if (res.code) { | ||
64 | - this.code = res.code; | ||
65 | - wx.request({ | ||
66 | - url: `https://api.weixin.qq.com/sns/jscode2session?appid=${appId}&secret=${appSecrect}&js_code=${this.code}&grant_type=authorization_code`, | ||
67 | - method: 'GET', | ||
68 | - success: res => { | ||
69 | - if (res.statusCode == 200) { | ||
70 | - this.openid = res.data.openid; | ||
71 | - this.session_key = res.data.session_key; | ||
72 | - //设置全局变量openId | ||
73 | - getApp().globalData.openId = res.data.openid; | ||
74 | - } | ||
75 | - }, | ||
76 | - complete: e => { | ||
77 | - if (e.data.errcode != null) { | ||
78 | - return; | ||
79 | - // return uni.$u.toast('获取用户唯一id失败'); | ||
80 | - } | ||
81 | - } | ||
82 | - }); | ||
83 | - } else { | ||
84 | - } | ||
85 | - } | ||
86 | - }); | ||
87 | - //#endif | ||
88 | - }, | ||
89 | - methods: { | ||
90 | - ...mapMutations(['setUserInfo']), | ||
91 | - ...mapActions(['updateBadgeTotal']), | ||
92 | - //微信授权登录 | ||
93 | - //#ifdef MP-WEIXIN | ||
94 | - onAuthorization() { | ||
95 | - /** | ||
96 | - * 注意:通过wx.getUserProfile并不能获取用户的openid,openid是唯一识别用户的标识, | ||
97 | - * 所以最好在用户授权登录时就获取。调用wx.login()获取 | ||
98 | - */ | ||
99 | - wx.getUserProfile({ | ||
100 | - desc: '获取用户授权信息', | ||
101 | - success: res => { | ||
102 | - if (res) { | ||
103 | - //微信官方自带解密(node.js实现) | ||
104 | - let pc = new WXBizDataCrypt(appId, this.session_key); | ||
105 | - let data = pc.decryptData(res.encryptedData, res.iv); | ||
106 | - let obj = { | ||
107 | - avatarUrl: data.avatarUrl, | ||
108 | - nickName: data.nickName, | ||
109 | - thirdUserId: this.openid | ||
110 | - }; | ||
111 | - //判断是否需要绑定 | ||
112 | - uni.$u.http | ||
113 | - .get(`/yt/third/login/${this.openid}`) | ||
114 | - .then(res => { | ||
115 | - if (res.token == '' || res.token == null) { | ||
116 | - //需要绑定,跳转我的页面进行绑定,显示绑定按钮 | ||
117 | - uni.reLaunch({ | ||
118 | - url: '../../pages/personal/personal' | ||
119 | - }); | ||
120 | - let userInfo = { | ||
121 | - isThirdLogin: true //token用于判断是否登录 | ||
122 | - }; | ||
123 | - this.setUserInfo(userInfo); | ||
124 | - } else { | ||
125 | - // 不需要绑定 | ||
126 | - // 储存登录信息 | ||
127 | - let resObj = { | ||
128 | - refreshToken: res.refreshToken, | ||
129 | - isToken: res.token | ||
130 | - }; | ||
131 | - let userInfo = { | ||
132 | - ...resObj, | ||
133 | - token: true //token用于判断是否登录 | ||
134 | - }; | ||
135 | - if (userInfo.token) { | ||
136 | - this.setUserInfo(userInfo); | ||
137 | - } | ||
138 | - uni.showToast({ | ||
139 | - title: '第三方账号登录成功~', | ||
140 | - icon: 'none' | ||
141 | - }); | ||
142 | - this.saveUserInfo(); | ||
143 | - this.getAlarmTotalData(); | ||
144 | - uni.reLaunch({ | ||
145 | - url: '../../pages/personal/personal' | ||
146 | - }); | ||
147 | - } | ||
148 | - }) | ||
149 | - .catch(e => { | ||
150 | - uni.$u.toast(e.data?.message); | ||
151 | - }); | ||
152 | - /** | ||
153 | - * 有些时候uni.navigatorBack({})没有返回到上级页面 | ||
154 | - * 才使用uni.reLaunch()进行跳转 | ||
155 | - */ | ||
156 | - // #ifdef MP | ||
157 | - setTimeout(() => { | ||
158 | - uni.reLaunch({ | ||
159 | - url: '../../pages/personal/personal?obj=' + encodeURIComponent(JSON.stringify(obj)) | ||
160 | - }); | ||
161 | - }, 500); | ||
162 | - // #endif | ||
163 | - } | ||
164 | - } | ||
165 | - }); | ||
166 | - }, | ||
167 | - //#endif | ||
168 | - saveUserInfo() { | ||
169 | - //储存个人信息 | ||
170 | - uni.$u.http.get('/yt/user/me/info').then(res => { | ||
171 | - if (res) { | ||
172 | - this.setUserInfo(res); | ||
173 | - } | ||
174 | - }); | ||
175 | - }, | ||
176 | - async getAlarmTotalData() { | ||
177 | - const res = await uni.$u.http.get('/yt/homepage/app'); | ||
178 | - if (res) { | ||
179 | - //异步实时更新告警徽标数 | ||
180 | - this.updateBadgeTotal(res.totalAlarm.activedAlarm); | ||
181 | - } | ||
182 | - }, | ||
183 | - onSubmitFunc() { | ||
184 | - if (this.loginForm.username == '') { | ||
185 | - return uni.$u.toast('请输入登录账号~'); | ||
186 | - } | ||
187 | - const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/; | ||
188 | - if (this.loginForm.password == '') { | ||
189 | - uni.showToast({ | ||
190 | - title: '请输入登录密码~', | ||
191 | - icon: 'none' | ||
192 | - }); | ||
193 | - return; | ||
194 | - } else if (!passReg.test(this.loginForm.password)) { | ||
195 | - uni.showToast({ | ||
196 | - title: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~', | ||
197 | - icon: 'none', | ||
198 | - duration: 3000 | ||
199 | - }); | ||
200 | - return; | ||
201 | - } | ||
202 | - uni.$u.http | ||
203 | - .post('/auth/login', this.loginForm) | ||
204 | - .then(res => { | ||
205 | - if (res) { | ||
206 | - // 储存登录信息 | ||
207 | - let resObj = { | ||
208 | - refreshToken: res.refreshToken, | ||
209 | - isToken: res.token | ||
210 | - }; | ||
211 | - let userInfo = { | ||
212 | - ...resObj, | ||
213 | - token: true, //token用于判断是否登录 | ||
214 | - isThirdLogin: false | ||
215 | - }; | ||
216 | - if (userInfo.token) { | ||
217 | - this.setUserInfo(userInfo); | ||
218 | - } | ||
219 | - uni | ||
220 | - .showToast({ | ||
221 | - title: '登录成功~', | ||
222 | - icon: 'none' | ||
223 | - }) | ||
224 | - .then(async res => { | ||
225 | - this.saveUserInfo(); | ||
226 | - await this.getAlarmTotalData(); | ||
227 | - // #ifdef APP-PLUS||MP | ||
228 | - uni.reLaunch({ | ||
229 | - url: '/pages/personal/personal' | ||
230 | - }); | ||
231 | - // #endif | ||
232 | - }); | ||
233 | - } | ||
234 | - }) | ||
235 | - .catch(e => { | ||
236 | - uni.$u.toast(e.data?.message); | ||
237 | - }); | ||
238 | - }, | ||
239 | - saveUserInfo() { | ||
240 | - //储存个人信息 | ||
241 | - uni.$u.http.get('/yt/user/me/info').then(res => { | ||
242 | - if (res) { | ||
243 | - this.setUserInfo(res); | ||
244 | - } | ||
245 | - }); | ||
246 | - }, | ||
247 | - openCodeFunc() { | ||
248 | - uni.navigateTo({ | ||
249 | - url: '../other/code' | ||
250 | - }); | ||
251 | - }, | ||
252 | - findPassrordFunc() { | ||
253 | - uni.navigateTo({ | ||
254 | - url: '../other/findPassword' | ||
255 | - }); | ||
256 | - }, | ||
257 | - showPasswordMode() { | ||
258 | - this.showPassword = !this.showPassword; | ||
259 | - } | ||
260 | - } | 95 | + data() { |
96 | + return { | ||
97 | + loginForm: { | ||
98 | + username: "", | ||
99 | + | ||
100 | + password: "", | ||
101 | + }, | ||
102 | + | ||
103 | + showPassword: false, | ||
104 | + | ||
105 | + code: "", | ||
106 | + | ||
107 | + openid: "", | ||
108 | + }; | ||
109 | + }, | ||
110 | + | ||
111 | + onLoad() { | ||
112 | + wx.login({ | ||
113 | + success: (res) => { | ||
114 | + if (res.code) { | ||
115 | + this.code = res.code; | ||
116 | + | ||
117 | + //这里获取openid | ||
118 | + } else { | ||
119 | + return; | ||
120 | + } | ||
121 | + }, | ||
122 | + }); | ||
123 | + }, | ||
124 | + | ||
125 | + methods: { | ||
126 | + ...mapMutations(["setUserInfo"]), | ||
127 | + | ||
128 | + ...mapActions(["updateBadgeTotal"]), | ||
129 | + | ||
130 | + //微信授权登录 | ||
131 | + | ||
132 | + //#ifdef MP-WEIXIN | ||
133 | + | ||
134 | + onWenxinAuthorization() { | ||
135 | + wx.getUserProfile({ | ||
136 | + desc: "微信第三方授权", | ||
137 | + | ||
138 | + success: (reswenxin) => { | ||
139 | + console.log("res=======>", reswenxin); | ||
140 | + | ||
141 | + if ( | ||
142 | + reswenxin.errMsg === "getUserProfile:ok" && | ||
143 | + reswenxin.encryptedData | ||
144 | + ) { | ||
145 | + console.log("获取code", this.code); | ||
146 | + | ||
147 | + //获取用户信息 | ||
148 | + | ||
149 | + let obj = { | ||
150 | + avatarUrl: reswenxin.userInfo.avatarUrl, | ||
151 | + | ||
152 | + thirdUserId: this.openid, | ||
153 | + }; | ||
154 | + | ||
155 | + //判断是否需要绑定 | ||
156 | + | ||
157 | + uni.$u.http | ||
158 | + | ||
159 | + .get(`/yt/third/login/${this.code}`) | ||
160 | + | ||
161 | + .then((res) => { | ||
162 | + console.log("Res", res); | ||
163 | + | ||
164 | + //设置全局变量openId | ||
165 | + | ||
166 | + // getApp().globalData.openId = res.data.openid; | ||
167 | + | ||
168 | + if ( | ||
169 | + res.token == "" || | ||
170 | + (res.token == null && res.refreshToken) | ||
171 | + ) { | ||
172 | + //需要绑定 | ||
173 | + | ||
174 | + let userInfo = { | ||
175 | + isThirdLogin: true, //用于判断是否是第三方登录并且需要绑定账号 | ||
176 | + | ||
177 | + avatar: obj.avatarUrl, | ||
178 | + }; | ||
179 | + | ||
180 | + this.setUserInfo(userInfo); | ||
181 | + | ||
182 | + //设置全局变量openId | ||
183 | + | ||
184 | + getApp().globalData.openId = res.refreshToken; | ||
185 | + | ||
186 | + uni.reLaunch({ | ||
187 | + url: "../../pages/personal/personal", | ||
188 | + }); | ||
189 | + } else { | ||
190 | + // 不需要绑定,直接第三方登录使用 | ||
191 | + | ||
192 | + let resObj = { | ||
193 | + refreshToken: res.refreshToken, | ||
194 | + | ||
195 | + isToken: res.token, | ||
196 | + }; | ||
197 | + | ||
198 | + let userInfo = { | ||
199 | + ...resObj, | ||
200 | + | ||
201 | + token: true, //token用于判断是否登录 | ||
202 | + | ||
203 | + isThirdLoginAndNoDind: true, //用于判断是否是第三方登录并且不需要绑定账号 | ||
204 | + }; | ||
205 | + | ||
206 | + if (userInfo.token) { | ||
207 | + this.setUserInfo(userInfo); | ||
208 | + } | ||
209 | + | ||
210 | + uni.showToast({ | ||
211 | + title: "第三方账号登录成功~", | ||
212 | + | ||
213 | + icon: "none", | ||
214 | + }); | ||
215 | + | ||
216 | + this.saveUserInfo(); | ||
217 | + | ||
218 | + this.getAlarmTotalData(); | ||
219 | + | ||
220 | + uni.reLaunch({ | ||
221 | + url: "../../pages/personal/personal", | ||
222 | + }); | ||
223 | + } | ||
224 | + }) | ||
225 | + | ||
226 | + .catch((e) => { | ||
227 | + uni.$u.toast(e.data?.message); | ||
228 | + }); | ||
229 | + } | ||
230 | + }, | ||
231 | + | ||
232 | + fail: (res) => { | ||
233 | + //拒绝授权 | ||
234 | + | ||
235 | + return; | ||
236 | + }, | ||
237 | + }); | ||
238 | + }, | ||
239 | + | ||
240 | + //#endif | ||
241 | + | ||
242 | + saveUserInfo() { | ||
243 | + //储存个人信息 | ||
244 | + | ||
245 | + uni.$u.http.get("/yt/user/me/info").then((res) => { | ||
246 | + if (res) { | ||
247 | + this.setUserInfo(res); | ||
248 | + } | ||
249 | + }); | ||
250 | + }, | ||
251 | + | ||
252 | + async getAlarmTotalData() { | ||
253 | + const res = await uni.$u.http.get("/yt/homepage/app"); | ||
254 | + if (res) { | ||
255 | + //异步实时更新告警徽标数 | ||
256 | + this.updateBadgeTotal(res.totalAlarm.activedAlarm); | ||
257 | + } | ||
258 | + }, | ||
259 | + | ||
260 | + onSubmitFunc() { | ||
261 | + if (this.loginForm.username == "") { | ||
262 | + return uni.$u.toast("请输入登录账号~"); | ||
263 | + } | ||
264 | + const passReg = | ||
265 | + /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/; | ||
266 | + | ||
267 | + if (this.loginForm.password == "") { | ||
268 | + uni.showToast({ | ||
269 | + title: "请输入登录密码~", | ||
270 | + | ||
271 | + icon: "none", | ||
272 | + }); | ||
273 | + return; | ||
274 | + } else if (!passReg.test(this.loginForm.password)) { | ||
275 | + uni.showToast({ | ||
276 | + title: | ||
277 | + "密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~", | ||
278 | + | ||
279 | + icon: "none", | ||
280 | + | ||
281 | + duration: 3000, | ||
282 | + }); | ||
283 | + | ||
284 | + return; | ||
285 | + } | ||
286 | + uni.$u.http | ||
287 | + .post("/auth/login", this.loginForm) | ||
288 | + | ||
289 | + .then((res) => { | ||
290 | + if (res) { | ||
291 | + // 储存登录信息 | ||
292 | + | ||
293 | + let resObj = { | ||
294 | + refreshToken: res.refreshToken, | ||
295 | + | ||
296 | + isToken: res.token, | ||
297 | + }; | ||
298 | + | ||
299 | + let userInfo = { | ||
300 | + ...resObj, | ||
301 | + | ||
302 | + token: true, //token用于判断是否登录 | ||
303 | + | ||
304 | + isThirdLogin: false, | ||
305 | + }; | ||
306 | + | ||
307 | + if (userInfo.token) { | ||
308 | + this.setUserInfo(userInfo); | ||
309 | + } | ||
310 | + | ||
311 | + uni | ||
312 | + .showToast({ | ||
313 | + title: "登录成功~", | ||
314 | + | ||
315 | + icon: "none", | ||
316 | + }) | ||
317 | + .then((res) => { | ||
318 | + /** | ||
319 | + | ||
320 | + * 有些时候不起作用 | ||
321 | + | ||
322 | + */ | ||
323 | + | ||
324 | + // uni.navigateBack({ | ||
325 | + | ||
326 | + // delta: 1 | ||
327 | + | ||
328 | + // }); | ||
329 | + | ||
330 | + // #ifdef APP-PLUS||MP | ||
331 | + | ||
332 | + uni.reLaunch({ | ||
333 | + url: "/pages/personal/personal", | ||
334 | + }); | ||
335 | + | ||
336 | + // #endif | ||
337 | + }); | ||
338 | + | ||
339 | + this.saveUserInfo(); | ||
340 | + | ||
341 | + this.getAlarmTotalData(); | ||
342 | + } | ||
343 | + }) | ||
344 | + | ||
345 | + .catch((e) => { | ||
346 | + uni.$u.toast(e.data?.message); | ||
347 | + }); | ||
348 | + }, | ||
349 | + | ||
350 | + openCodeFunc() { | ||
351 | + uni.navigateTo({ | ||
352 | + url: "../other/code", | ||
353 | + }); | ||
354 | + }, | ||
355 | + | ||
356 | + findPassrordFunc() { | ||
357 | + uni.navigateTo({ | ||
358 | + url: "../other/findPassword", | ||
359 | + }); | ||
360 | + }, | ||
361 | + | ||
362 | + showPasswordMode() { | ||
363 | + this.showPassword = !this.showPassword; | ||
364 | + }, | ||
365 | + }, | ||
261 | }; | 366 | }; |
262 | </script> | 367 | </script> |
263 | 368 | ||
264 | <style lang="scss" scoped> | 369 | <style lang="scss" scoped> |
265 | -@import './static/login.scss'; | ||
266 | -</style> | 370 | +@import "./static/login.scss"; |
371 | + | ||
372 | +/deep/ button { | ||
373 | + background: rgba(0, 0, 0, 0); | ||
374 | +} | ||
375 | +</style> |
1 | .login-page { | 1 | .login-page { |
2 | min-height: 100vh; | 2 | min-height: 100vh; |
3 | - background-color: #fff; | 3 | + width: 750rpx; |
4 | + background: url(/static/login.png) no-repeat; | ||
4 | .login-main { | 5 | .login-main { |
5 | flex-direction: column; | 6 | flex-direction: column; |
6 | .content { | 7 | .content { |
7 | height: 250rpx; | 8 | height: 250rpx; |
8 | margin-top: 90rpx; | 9 | margin-top: 90rpx; |
9 | margin-left: -107rpx; | 10 | margin-left: -107rpx; |
11 | + position: relative; | ||
12 | + top: 50rpx; | ||
13 | + left: -15rpx; | ||
10 | .hello { | 14 | .hello { |
11 | font-size: 30px; | 15 | font-size: 30px; |
12 | color: #3a4759; | 16 | color: #3a4759; |
@@ -21,16 +25,6 @@ | @@ -21,16 +25,6 @@ | ||
21 | } | 25 | } |
22 | } | 26 | } |
23 | } | 27 | } |
24 | - .circleStyle { | ||
25 | - position: absolute; | ||
26 | - width: 145rpx; | ||
27 | - height: 300rpx; | ||
28 | - left: -31rpx; | ||
29 | - top: 10rpx; | ||
30 | - border-radius: 0 100rpx 100rpx 0/0 150rpx 150rpx 0; | ||
31 | - background-color: #f0f2f5; | ||
32 | - opacity: 0.5; | ||
33 | - } | ||
34 | } | 28 | } |
35 | 29 | ||
36 | .f__login { | 30 | .f__login { |
@@ -47,7 +41,7 @@ | @@ -47,7 +41,7 @@ | ||
47 | margin-top: 60rpx; | 41 | margin-top: 60rpx; |
48 | .v-input { | 42 | .v-input { |
49 | width: 690rpx; | 43 | width: 690rpx; |
50 | - border-bottom: 2px solid #e5e5e5; | 44 | + border-bottom: 1px solid #e5e5e5; |
51 | } | 45 | } |
52 | .v-password { | 46 | .v-password { |
53 | position: absolute; | 47 | position: absolute; |
@@ -107,19 +101,4 @@ | @@ -107,19 +101,4 @@ | ||
107 | } | 101 | } |
108 | } | 102 | } |
109 | } | 103 | } |
110 | - .circleStyleBottom { | ||
111 | - position: absolute; | ||
112 | - width: 145rpx; | ||
113 | - height: 300rpx; | ||
114 | - right: -31rpx; | ||
115 | - top: 404rpx; | ||
116 | - //#ifndef MP | ||
117 | - top: 504rpx; | ||
118 | - //#endif | ||
119 | - border-radius: 0 100rpx 100rpx 0/0 150rpx 150rpx 0; | ||
120 | - background: linear-gradient(241deg, #00c9a7 0%, rgba(0, 223, 252, 0.5) 100%); | ||
121 | - opacity: 0.1; | ||
122 | - transform: rotate(180deg); | ||
123 | - z-index: -9999; | ||
124 | - } | ||
125 | } | 104 | } |
static/eye-hide.png
0 → 100644
822 Bytes
static/eye.png
0 → 100644
976 Bytes
static/login.png
0 → 100644
13 KB
@@ -14,6 +14,7 @@ export const mutations = { | @@ -14,6 +14,7 @@ export const mutations = { | ||
14 | // #endif | 14 | // #endif |
15 | // #ifndef H5 | 15 | // #ifndef H5 |
16 | uni.setStorageSync('userInfo', state.userInfo); | 16 | uni.setStorageSync('userInfo', state.userInfo); |
17 | + wx.setStorageSync('userInfo', state.userInfo); | ||
17 | // #endif | 18 | // #endif |
18 | } | 19 | } |
19 | }, | 20 | }, |
@@ -25,10 +26,11 @@ export const mutations = { | @@ -25,10 +26,11 @@ export const mutations = { | ||
25 | // #endif | 26 | // #endif |
26 | // #ifndef H5 | 27 | // #ifndef H5 |
27 | uni.removeStorageSync("userInfo"); | 28 | uni.removeStorageSync("userInfo"); |
29 | + uni.removeStorageSync('storagePre'); | ||
28 | // #endif | 30 | // #endif |
29 | - }, | ||
30 | - setBadgeInfo(state,payload){ | ||
31 | - state.badgeInfo = payload; | 31 | + }, |
32 | + setBadgeInfo(state,payload){ | ||
33 | + state.badgeInfo = payload; | ||
32 | } | 34 | } |
33 | }; | 35 | }; |
34 | export const actions = { | 36 | export const actions = { |
@@ -36,7 +38,7 @@ export const actions = { | @@ -36,7 +38,7 @@ export const actions = { | ||
36 | updateBadgeTotal({ | 38 | updateBadgeTotal({ |
37 | state, | 39 | state, |
38 | commit | 40 | commit |
39 | - }, data) { | 41 | + }, data) { |
40 | commit('setBadgeInfo',data) | 42 | commit('setBadgeInfo',data) |
41 | console.log('Change total', data,state); | 43 | console.log('Change total', data,state); |
42 | } | 44 | } |
@@ -64,7 +64,7 @@ button { | @@ -64,7 +64,7 @@ button { | ||
64 | .text-bold { | 64 | .text-bold { |
65 | color: #333333; | 65 | color: #333333; |
66 | font-family: PingFangSC-Medium, PingFang SC; | 66 | font-family: PingFangSC-Medium, PingFang SC; |
67 | - font-weight: 500; | 67 | + font-weight: bold; |
68 | font-size: 15px; | 68 | font-size: 15px; |
69 | } | 69 | } |
70 | //(设备、告警,适用设备详情基础信息文本(右边的值的文本))第二个文本 | 70 | //(设备、告警,适用设备详情基础信息文本(右边的值的文本))第二个文本 |
@@ -132,7 +132,7 @@ button { | @@ -132,7 +132,7 @@ button { | ||
132 | .home-text-total { | 132 | .home-text-total { |
133 | font-size: 17px; | 133 | font-size: 17px; |
134 | font-family: PingFangSC-Regular, PingFang SC; | 134 | font-family: PingFangSC-Regular, PingFang SC; |
135 | - font-weight: 500; | 135 | + font-weight: bold; |
136 | color: #333333; | 136 | color: #333333; |
137 | } | 137 | } |
138 | .home-text-total-bottom { | 138 | .home-text-total-bottom { |
@@ -185,6 +185,13 @@ button { | @@ -185,6 +185,13 @@ button { | ||
185 | font-weight: 400; | 185 | font-weight: 400; |
186 | color: #333333 !important; | 186 | color: #333333 !important; |
187 | } | 187 | } |
188 | +.un-bind-text { | ||
189 | + font-size: 16px; | ||
190 | + font-family: PingFangSC-Regular, PingFang SC; | ||
191 | + font-weight: 400; | ||
192 | + // color: #333333; | ||
193 | + color: #ffffff; | ||
194 | +} | ||
188 | // 定义flex等分 | 195 | // 定义flex等分 |
189 | @for $i from 0 through 12 { | 196 | @for $i from 0 through 12 { |
190 | .u-flex-#{$i} { | 197 | .u-flex-#{$i} { |
@@ -13,9 +13,9 @@ | @@ -13,9 +13,9 @@ | ||
13 | </u-list> | 13 | </u-list> |
14 | <view class="bottom-text"> | 14 | <view class="bottom-text"> |
15 | <view class="u-flex column"> | 15 | <view class="u-flex column"> |
16 | - <text class="text">{{ notifyList.title }}</text> | 16 | + <text class="text" style="font-weight: bold;">{{ notifyList.title }}</text> |
17 | </view> | 17 | </view> |
18 | - <view style="margin-top: 20rpx;"> | 18 | + <view style="margin-top: 21rpx;"> |
19 | <!-- 富文本解析 --> | 19 | <!-- 富文本解析 --> |
20 | <u-parse :content="notifyList.content"></u-parse> | 20 | <u-parse :content="notifyList.content"></u-parse> |
21 | <!-- 富文本解析 --> | 21 | <!-- 富文本解析 --> |
@@ -2,9 +2,11 @@ | @@ -2,9 +2,11 @@ | ||
2 | <view class="notify-page"> | 2 | <view class="notify-page"> |
3 | <!-- 公共组件-每个页面必须引入 --> | 3 | <!-- 公共组件-每个页面必须引入 --> |
4 | <public-module></public-module> | 4 | <public-module></public-module> |
5 | - <view @click="openTypeClick" style="width: 700rpx;position: fixed;top: 0;z-index: 1;"> | ||
6 | - <u--input suffixIcon="arrow-down" shape="circle" disabled v-model="model1.userInfo.type" placeholder="请选择类型" border="surround"></u--input> | ||
7 | - <u-action-sheet :show="showType" :actions="actions" title="请选择类型" @close="showType = false" @select="typeSelect"></u-action-sheet> | 5 | + <view style="width: 750rpx;height:53rpx;background-color: #f8f9fa;position:fixed;top:0;z-index: 99999;"> |
6 | + <view @click="openTypeClick" style="background-color: #f8f9fa;width: 700rpx;position: relative;top: 10rpx;"> | ||
7 | + <u--input suffixIcon="arrow-down" shape="circle" disabled v-model="model1.userInfo.type" placeholder="请选择类型" border="surround"></u--input> | ||
8 | + <u-action-sheet :show="showType" :actions="actions" title="请选择类型" @close="showType = false" @select="typeSelect"></u-action-sheet> | ||
9 | + </view> | ||
8 | </view> | 10 | </view> |
9 | <view style="height: 76rpx;"></view> | 11 | <view style="height: 76rpx;"></view> |
10 | <view class="notify-main"> | 12 | <view class="notify-main"> |
@@ -82,7 +84,8 @@ export default { | @@ -82,7 +84,8 @@ export default { | ||
82 | onShow() { | 84 | onShow() { |
83 | this.pre = uni.getStorageSync('storagePre'); | 85 | this.pre = uni.getStorageSync('storagePre'); |
84 | if (this.pre) { | 86 | if (this.pre) { |
85 | - this.loadData(1); | 87 | + this.page.num = 1; |
88 | + this.loadData(this.page.num); | ||
86 | } | 89 | } |
87 | }, | 90 | }, |
88 | onHide() { | 91 | onHide() { |
@@ -97,25 +100,19 @@ export default { | @@ -97,25 +100,19 @@ export default { | ||
97 | uni.hideKeyboard(); | 100 | uni.hideKeyboard(); |
98 | }, | 101 | }, |
99 | typeSelect(e) { | 102 | typeSelect(e) { |
100 | - this.topBack(); | ||
101 | this.isJudgeNextPage = e.value; | 103 | this.isJudgeNextPage = e.value; |
102 | this.page.num = 1; | 104 | this.page.num = 1; |
103 | this.model1.userInfo.type = e.name; | 105 | this.model1.userInfo.type = e.name; |
104 | this.loadData(1, this.isJudgeNextPage == '' ? null : this.isJudgeNextPage); | 106 | this.loadData(1, this.isJudgeNextPage == '' ? null : this.isJudgeNextPage); |
105 | }, | 107 | }, |
106 | - //筛选数据让它回到顶部 | ||
107 | - topBack() { | ||
108 | - uni.pageScrollTo({ | ||
109 | - scrollTop: 0, // 滚动到页面的目标位置 这个是滚动到顶部, 0 | ||
110 | - duration: 300 // 滚动动画的时长 | ||
111 | - }); | ||
112 | - }, | ||
113 | /*下拉刷新的回调 */ | 108 | /*下拉刷新的回调 */ |
114 | downCallback() { | 109 | downCallback() { |
115 | //联网加载数据 | 110 | //联网加载数据 |
116 | this.list.length = 0; | 111 | this.list.length = 0; |
117 | this.page.num = 1; | 112 | this.page.num = 1; |
118 | this.loadData(1); | 113 | this.loadData(1); |
114 | + this.isJudgeNextPage = ''; | ||
115 | + this.model1.userInfo.type = ''; | ||
119 | }, | 116 | }, |
120 | /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */ | 117 | /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */ |
121 | upCallback() { | 118 | upCallback() { |