Showing
23 changed files
with
827 additions
and
1134 deletions
@@ -39,7 +39,7 @@ function getUserInfo(successCallback,errorCallback) { | @@ -39,7 +39,7 @@ function getUserInfo(successCallback,errorCallback) { | ||
39 | }); | 39 | }); |
40 | // #ifdef MP-WEIXIN | 40 | // #ifdef MP-WEIXIN |
41 | uni.getUserProfile({ | 41 | uni.getUserProfile({ |
42 | - desc: '用于完善会员资料', | 42 | + desc: '用于完善个人资料', |
43 | success: function(res) { | 43 | success: function(res) { |
44 | uni.hideLoading() | 44 | uni.hideLoading() |
45 | var offUserInfo = res.userInfo | 45 | var offUserInfo = res.userInfo |
@@ -113,20 +113,6 @@ export default { | @@ -113,20 +113,6 @@ export default { | ||
113 | }, | 113 | }, |
114 | onLoad() {}, | 114 | onLoad() {}, |
115 | created() { | 115 | created() { |
116 | - let httpData = { | ||
117 | - page: 1, | ||
118 | - pageSize: 10, | ||
119 | - entityType: 'DEVICE', | ||
120 | - entityId: '' | ||
121 | - }; | ||
122 | - uni.$u.http | ||
123 | - .get('/yt/alarm', { params: httpData }) | ||
124 | - .then(res => { | ||
125 | - this.list[2].badge = res.total; | ||
126 | - }) | ||
127 | - .catch(e => { | ||
128 | - uni.$u.toast(e.data.message); | ||
129 | - }); | ||
130 | //获取页面路径 | 116 | //获取页面路径 |
131 | let currentPages = getCurrentPages(); | 117 | let currentPages = getCurrentPages(); |
132 | let page = currentPages[currentPages.length - 1]; | 118 | let page = currentPages[currentPages.length - 1]; |
@@ -139,7 +125,24 @@ export default { | @@ -139,7 +125,24 @@ export default { | ||
139 | }); | 125 | }); |
140 | }, | 126 | }, |
141 | methods: { | 127 | methods: { |
128 | + loadData() { | ||
129 | + let httpData = { | ||
130 | + page: 1, | ||
131 | + pageSize: 10 | ||
132 | + }; | ||
133 | + uni.$u.http | ||
134 | + .get('/yt/alarm', { params: httpData }) | ||
135 | + .then(res => { | ||
136 | + this.list[2].badge = res.total; | ||
137 | + }) | ||
138 | + .catch(e => { | ||
139 | + uni.$u.toast(e.data?.message); | ||
140 | + }); | ||
141 | + }, | ||
142 | onTabbar(index) { | 142 | onTabbar(index) { |
143 | + if (index !== 5) { | ||
144 | + this.loadData(); | ||
145 | + } | ||
143 | if (this.path !== this.list[index].url) { | 146 | if (this.path !== this.list[index].url) { |
144 | uni.switchTab({ | 147 | uni.switchTab({ |
145 | url: '/' + this.list[index].url | 148 | url: '/' + this.list[index].url |
1 | import store from '@/store'; | 1 | import store from '@/store'; |
2 | import base from "@/config/baseUrl"; | 2 | import base from "@/config/baseUrl"; |
3 | import QQMapWX from '@/plugins/qqmap-wx-jssdk.js'; | 3 | import QQMapWX from '@/plugins/qqmap-wx-jssdk.js'; |
4 | -import { getAppLatLon} from '@/plugins/utils'; | 4 | +import { |
5 | + getAppLatLon | ||
6 | +} from '@/plugins/utils'; | ||
5 | 7 | ||
6 | //檢查小程序更新 | 8 | //檢查小程序更新 |
7 | -function mpUpData(callback){ | ||
8 | - if (uni.getUpdateManager) { | ||
9 | - const updateManager = uni.getUpdateManager(); | ||
10 | - updateManager.onCheckForUpdate(function(res) { | ||
11 | - // 请求完新版本信息的回调 | ||
12 | - // console.log(res.hasUpdate); | ||
13 | - // if(!res.hasUpdate){ | ||
14 | - // uni.showToast({ | ||
15 | - // title: '当前没有新版发布~', | ||
16 | - // duration: 2000 | ||
17 | - // }); | ||
18 | - // } | ||
19 | - let info = { | ||
20 | - type: 1, | ||
21 | - data: res | ||
22 | - } | ||
23 | - callback && callback(info) | ||
24 | - }); | ||
25 | - updateManager.onUpdateReady(function(res) { | ||
26 | - uni.showModal({ | ||
27 | - title: "更新提示", | ||
28 | - content: "检测到新版本,是否下载新版本并重启小程序?", | ||
29 | - success(res) { | ||
30 | - if (res.confirm) { | ||
31 | - // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 | ||
32 | - updateManager.applyUpdate(); | ||
33 | - } | ||
34 | - } | ||
35 | - }); | ||
36 | - }); | ||
37 | - updateManager.onUpdateFailed(function(res) { | ||
38 | - // 新的版本下载失败 | ||
39 | - uni.showModal({ | ||
40 | - title: "已经有新版本了哟~", | ||
41 | - content: "新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~", | ||
42 | - showCancel: false | ||
43 | - }); | ||
44 | - }); | ||
45 | - }else { | ||
46 | - // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示 | ||
47 | - // uni.showModal({ | ||
48 | - // title: '提示', | ||
49 | - // content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' | ||
50 | - // }) | ||
51 | - let info = { | ||
52 | - type: 2 | ||
53 | - } | ||
54 | - callback && callback(info) | ||
55 | - } | 9 | +function mpUpData(callback) { |
10 | + if (uni.getUpdateManager) { | ||
11 | + const updateManager = uni.getUpdateManager(); | ||
12 | + updateManager.onCheckForUpdate(function(res) { | ||
13 | + // 请求完新版本信息的回调 | ||
14 | + // console.log(res.hasUpdate); | ||
15 | + // if(!res.hasUpdate){ | ||
16 | + // uni.showToast({ | ||
17 | + // title: '当前没有新版发布~', | ||
18 | + // duration: 2000 | ||
19 | + // }); | ||
20 | + // } | ||
21 | + let info = { | ||
22 | + type: 1, | ||
23 | + data: res | ||
24 | + } | ||
25 | + callback && callback(info) | ||
26 | + }); | ||
27 | + updateManager.onUpdateReady(function(res) { | ||
28 | + uni.showModal({ | ||
29 | + title: "更新提示", | ||
30 | + content: "检测到新版本,是否下载新版本并重启小程序?", | ||
31 | + success(res) { | ||
32 | + if (res.confirm) { | ||
33 | + // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 | ||
34 | + updateManager.applyUpdate(); | ||
35 | + } | ||
36 | + } | ||
37 | + }); | ||
38 | + }); | ||
39 | + updateManager.onUpdateFailed(function(res) { | ||
40 | + // 新的版本下载失败 | ||
41 | + uni.showModal({ | ||
42 | + title: "已经有新版本了哟~", | ||
43 | + content: "新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~", | ||
44 | + showCancel: false | ||
45 | + }); | ||
46 | + }); | ||
47 | + } else { | ||
48 | + // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示 | ||
49 | + // uni.showModal({ | ||
50 | + // title: '提示', | ||
51 | + // content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' | ||
52 | + // }) | ||
53 | + let info = { | ||
54 | + type: 2 | ||
55 | + } | ||
56 | + callback && callback(info) | ||
57 | + } | ||
56 | } | 58 | } |
57 | 59 | ||
58 | // App计算缓存 | 60 | // App计算缓存 |
59 | -function formatSize(callback){ | ||
60 | - let fileSizeString = "0B"; | ||
61 | - plus.cache.calculate(function(size) { | ||
62 | - let sizeCache = parseInt(size); | ||
63 | - if (sizeCache == 0) { | ||
64 | - fileSizeString = "0B"; | ||
65 | - } else if (sizeCache < 1024) { | ||
66 | - fileSizeString = sizeCache + "B"; | ||
67 | - } else if (sizeCache < 1048576) { | ||
68 | - fileSizeString = (sizeCache / 1024).toFixed(2) + "KB"; | ||
69 | - } else if (sizeCache < 1073741824) { | ||
70 | - fileSizeString = (sizeCache / 1048576).toFixed(2) + "MB"; | ||
71 | - } else { | ||
72 | - fileSizeString = (sizeCache / 1073741824).toFixed(2) + "GB"; | ||
73 | - } | ||
74 | - callback && callback(fileSizeString) | ||
75 | - }); | 61 | +function formatSize(callback) { |
62 | + let fileSizeString = "0B"; | ||
63 | + plus.cache.calculate(function(size) { | ||
64 | + let sizeCache = parseInt(size); | ||
65 | + if (sizeCache == 0) { | ||
66 | + fileSizeString = "0B"; | ||
67 | + } else if (sizeCache < 1024) { | ||
68 | + fileSizeString = sizeCache + "B"; | ||
69 | + } else if (sizeCache < 1048576) { | ||
70 | + fileSizeString = (sizeCache / 1024).toFixed(2) + "KB"; | ||
71 | + } else if (sizeCache < 1073741824) { | ||
72 | + fileSizeString = (sizeCache / 1048576).toFixed(2) + "MB"; | ||
73 | + } else { | ||
74 | + fileSizeString = (sizeCache / 1073741824).toFixed(2) + "GB"; | ||
75 | + } | ||
76 | + callback && callback(fileSizeString) | ||
77 | + }); | ||
76 | } | 78 | } |
77 | /* | 79 | /* |
78 | * App清理缓存 | 80 | * App清理缓存 |
79 | * fileSizeString:当前缓存 | 81 | * fileSizeString:当前缓存 |
80 | */ | 82 | */ |
81 | -function clearCache(fileSizeString){ | ||
82 | - if(fileSizeString == '0B'){ | ||
83 | - uni.showToast({ | ||
84 | - title: '暂无缓存~', | ||
85 | - duration: 2000, | ||
86 | - icon: 'none' | ||
87 | - }); | ||
88 | - return | ||
89 | - } | ||
90 | - return new Promise((resolve, reject) => { | ||
91 | - let os = plus.os.name; | ||
92 | - if (os == 'Android') { | ||
93 | - let main = plus.android.runtimeMainActivity(); | ||
94 | - let sdRoot = main.getCacheDir(); | ||
95 | - let files = plus.android.invoke(sdRoot, "listFiles"); | ||
96 | - let len = files.length; | ||
97 | - for (let i = 0; i < len; i++) { | ||
98 | - let filePath = '' + files[i]; // 没有找到合适的方法获取路径,这样写可以转成文件路径 | ||
99 | - plus.io.resolveLocalFileSystemURL(filePath, function(entry) { | ||
100 | - if (entry.isDirectory) { | ||
101 | - entry.removeRecursively(function(entry) { //递归删除其下的所有文件及子目录 | ||
102 | - uni.showToast({ | ||
103 | - title: '缓存清理完成', | ||
104 | - duration: 2000 | ||
105 | - }); | ||
106 | - // 回调 | ||
107 | - resolve() | ||
108 | - }, function(e) { | ||
109 | - console.log(e.message) | ||
110 | - }); | ||
111 | - } else { | ||
112 | - entry.remove(); | ||
113 | - } | ||
114 | - }, function(e) { | ||
115 | - console.log('文件路径读取失败') | ||
116 | - }); | ||
117 | - } | ||
118 | - } else { // ios | ||
119 | - plus.cache.clear(function() { | ||
120 | - uni.showToast({ | ||
121 | - title: '缓存清理完成', | ||
122 | - duration: 2000 | ||
123 | - }); | ||
124 | - // 回调 | ||
125 | - resolve() | ||
126 | - }); | ||
127 | - } | ||
128 | - }); | 83 | +function clearCache(fileSizeString) { |
84 | + if (fileSizeString == '0B') { | ||
85 | + uni.showToast({ | ||
86 | + title: '暂无缓存~', | ||
87 | + duration: 2000, | ||
88 | + icon: 'none' | ||
89 | + }); | ||
90 | + return | ||
91 | + } | ||
92 | + return new Promise((resolve, reject) => { | ||
93 | + let os = plus.os.name; | ||
94 | + if (os == 'Android') { | ||
95 | + let main = plus.android.runtimeMainActivity(); | ||
96 | + let sdRoot = main.getCacheDir(); | ||
97 | + let files = plus.android.invoke(sdRoot, "listFiles"); | ||
98 | + let len = files.length; | ||
99 | + for (let i = 0; i < len; i++) { | ||
100 | + let filePath = '' + files[i]; // 没有找到合适的方法获取路径,这样写可以转成文件路径 | ||
101 | + plus.io.resolveLocalFileSystemURL(filePath, function(entry) { | ||
102 | + if (entry.isDirectory) { | ||
103 | + entry.removeRecursively(function(entry) { //递归删除其下的所有文件及子目录 | ||
104 | + uni.showToast({ | ||
105 | + title: '缓存清理完成', | ||
106 | + duration: 2000 | ||
107 | + }); | ||
108 | + // 回调 | ||
109 | + resolve() | ||
110 | + }, function(e) { | ||
111 | + console.log(e.message) | ||
112 | + }); | ||
113 | + } else { | ||
114 | + entry.remove(); | ||
115 | + } | ||
116 | + }, function(e) { | ||
117 | + console.log('文件路径读取失败') | ||
118 | + }); | ||
119 | + } | ||
120 | + } else { // ios | ||
121 | + plus.cache.clear(function() { | ||
122 | + uni.showToast({ | ||
123 | + title: '缓存清理完成', | ||
124 | + duration: 2000 | ||
125 | + }); | ||
126 | + // 回调 | ||
127 | + resolve() | ||
128 | + }); | ||
129 | + } | ||
130 | + }); | ||
129 | } | 131 | } |
130 | 132 | ||
131 | //e 扫码参数 | 133 | //e 扫码参数 |
132 | //flag uni.scanCode方法点击扫码的参数没有q,为true转换参数 | 134 | //flag uni.scanCode方法点击扫码的参数没有q,为true转换参数 |
133 | -function scene(e,callback,flag=false){ | ||
134 | - store.commit("setChatScenesInfo", {});//先请空 | ||
135 | - console.log(e,'scene') | ||
136 | - var qrCodeValue = '' | ||
137 | - // #ifndef MP-ALIPAY | ||
138 | - if(flag){ | ||
139 | - e.query = {q:e.result} | ||
140 | - console.log(e,'scene-转换后') | ||
141 | - } | ||
142 | - if(e.query.q){ | ||
143 | - let scene = decodeURIComponent(e.query.q).split("?")[1]; | ||
144 | - scene = scene.split("&"); | ||
145 | - let data = { | ||
146 | - //场景值 | ||
147 | - scene: e.scene, | ||
148 | - }; | ||
149 | - scene.forEach(item => { | ||
150 | - let arr = item.split("="); | ||
151 | - if (arr.length == 2) { | ||
152 | - data[arr[0]] = arr[1]; | ||
153 | - } | ||
154 | - }); | ||
155 | - store.commit("setChatScenesInfo", Object.assign(e.query, data)); | ||
156 | - console.log(store.state.chatScenesInfo,'scene--解码参数') | ||
157 | - }else{ | ||
158 | - store.commit("setChatScenesInfo", Object.assign(e.query, {path:e.path})); | ||
159 | - } | ||
160 | - // #endif | ||
161 | - // #ifdef MP-ALIPAY | ||
162 | - var AliqrCode = {} | ||
163 | - if(flag){ | ||
164 | - e.query = {qrCode:e.result} | ||
165 | - console.log(e,'scene-转换后') | ||
166 | - } | ||
167 | - if (e.query && e.query.qrCode) { | ||
168 | - AliqrCode.q = e.query.qrCode; | ||
169 | - } else if (e.query && !e.query.qrCode) { | ||
170 | - AliqrCode = e.query; | ||
171 | - } | ||
172 | - if (AliqrCode.q) { | ||
173 | - var queryParam = AliqrCode.q.split("?")[1] //二维码清除域名 | ||
174 | - var scene = queryParam.split("&"); | ||
175 | - let data = {}; | ||
176 | - scene.forEach(item => { | ||
177 | - let arr = item.split("="); | ||
178 | - if (arr.length == 2) { | ||
179 | - data[arr[0]] = arr[1]; | ||
180 | - } | ||
181 | - }); | ||
182 | - store.commit("setChatScenesInfo", Object.assign(AliqrCode, data)); | ||
183 | - console.log(store.state.chatScenesInfo,'scene--支付宝小程序解码参数') | ||
184 | - }else{ | ||
185 | - store.commit("setChatScenesInfo", Object.assign(AliqrCode, {path:e.path})); | ||
186 | - } | ||
187 | - // #endif | ||
188 | - callback && callback() | 135 | +function scene(e, callback, flag = false) { |
136 | + store.commit("setChatScenesInfo", {}); //先请空 | ||
137 | + console.log(e, 'scene') | ||
138 | + var qrCodeValue = '' | ||
139 | + // #ifndef MP-ALIPAY | ||
140 | + if (flag) { | ||
141 | + e.query = { | ||
142 | + q: e.result | ||
143 | + } | ||
144 | + console.log(e, 'scene-转换后') | ||
145 | + } | ||
146 | + if (e.query.q) { | ||
147 | + let scene = decodeURIComponent(e.query.q).split("?")[1]; | ||
148 | + scene = scene.split("&"); | ||
149 | + let data = { | ||
150 | + //场景值 | ||
151 | + scene: e.scene, | ||
152 | + }; | ||
153 | + scene.forEach(item => { | ||
154 | + let arr = item.split("="); | ||
155 | + if (arr.length == 2) { | ||
156 | + data[arr[0]] = arr[1]; | ||
157 | + } | ||
158 | + }); | ||
159 | + store.commit("setChatScenesInfo", Object.assign(e.query, data)); | ||
160 | + console.log(store.state.chatScenesInfo, 'scene--解码参数') | ||
161 | + } else { | ||
162 | + store.commit("setChatScenesInfo", Object.assign(e.query, { | ||
163 | + path: e.path | ||
164 | + })); | ||
165 | + } | ||
166 | + // #endif | ||
167 | + // #ifdef MP-ALIPAY | ||
168 | + var AliqrCode = {} | ||
169 | + if (flag) { | ||
170 | + e.query = { | ||
171 | + qrCode: e.result | ||
172 | + } | ||
173 | + console.log(e, 'scene-转换后') | ||
174 | + } | ||
175 | + if (e.query && e.query.qrCode) { | ||
176 | + AliqrCode.q = e.query.qrCode; | ||
177 | + } else if (e.query && !e.query.qrCode) { | ||
178 | + AliqrCode = e.query; | ||
179 | + } | ||
180 | + if (AliqrCode.q) { | ||
181 | + var queryParam = AliqrCode.q.split("?")[1] //二维码清除域名 | ||
182 | + var scene = queryParam.split("&"); | ||
183 | + let data = {}; | ||
184 | + scene.forEach(item => { | ||
185 | + let arr = item.split("="); | ||
186 | + if (arr.length == 2) { | ||
187 | + data[arr[0]] = arr[1]; | ||
188 | + } | ||
189 | + }); | ||
190 | + store.commit("setChatScenesInfo", Object.assign(AliqrCode, data)); | ||
191 | + console.log(store.state.chatScenesInfo, 'scene--支付宝小程序解码参数') | ||
192 | + } else { | ||
193 | + store.commit("setChatScenesInfo", Object.assign(AliqrCode, { | ||
194 | + path: e.path | ||
195 | + })); | ||
196 | + } | ||
197 | + // #endif | ||
198 | + callback && callback() | ||
189 | } | 199 | } |
190 | 200 | ||
191 | /* | 201 | /* |
@@ -194,92 +204,120 @@ function scene(e,callback,flag=false){ | @@ -194,92 +204,120 @@ function scene(e,callback,flag=false){ | ||
194 | * errCallback:失败回调 | 204 | * errCallback:失败回调 |
195 | * isOpenSetting:是否检验授权 默认不检验 | 205 | * isOpenSetting:是否检验授权 默认不检验 |
196 | */ | 206 | */ |
197 | -function loGetLocation(successCallback, errCallback, isOpenSetting=false){ | ||
198 | - var that = this | ||
199 | - getAppLatLon(item=>{ | ||
200 | - if(base.mapData?.key){ | ||
201 | - var latitude = item.latitude; // 纬度,浮点数,范围为90 ~ -90 | ||
202 | - var longitude = item.longitude; // 经度,浮点数,范围为180 ~ -180 | ||
203 | - var qqmapsdk = new QQMapWX({ | ||
204 | - key: base.mapData?.key, // 您的key---秘钥key值可通过https://lbs.qq.com/qqmap_wx_jssdk/index.html申请 | ||
205 | - // #ifdef H5 | ||
206 | - vm: that | ||
207 | - // #endif | ||
208 | - }); | ||
209 | - // 地址逆解析可获取省市区等信息 | ||
210 | - qqmapsdk.reverseGeocoder({ | ||
211 | - location: { latitude: latitude, longitude: longitude }, | ||
212 | - sig: base.mapData?.sk, | ||
213 | - success: function(res) { | ||
214 | - store.commit('setLocateInformation',res.result) | ||
215 | - successCallback && successCallback(res.result) | ||
216 | - },fail: function(err) { | ||
217 | - item.location = { | ||
218 | - lat:latitude, | ||
219 | - lng:longitude, | ||
220 | - } | ||
221 | - store.commit('setLocateInformation',item) | ||
222 | - successCallback && successCallback(item) | ||
223 | - } | ||
224 | - }); | ||
225 | - }else{ | ||
226 | - item.location = { | ||
227 | - lat:item.latitude, | ||
228 | - lng:item.longitude, | ||
229 | - } | ||
230 | - store.commit('setLocateInformation',item) | ||
231 | - successCallback && successCallback(item) | ||
232 | - } | ||
233 | - },err=>{ | ||
234 | - store.commit('setLocateInformation',{}) | ||
235 | - errCallback && errCallback(err) | ||
236 | - },isOpenSetting) | 207 | +function loGetLocation(successCallback, errCallback, isOpenSetting = false) { |
208 | + var that = this | ||
209 | + getAppLatLon(item => { | ||
210 | + if (base.mapData?.key) { | ||
211 | + var latitude = item.latitude; // 纬度,浮点数,范围为90 ~ -90 | ||
212 | + var longitude = item.longitude; // 经度,浮点数,范围为180 ~ -180 | ||
213 | + var qqmapsdk = new QQMapWX({ | ||
214 | + key: base.mapData | ||
215 | + ?.key, // 您的key---秘钥key值可通过https://lbs.qq.com/qqmap_wx_jssdk/index.html申请 | ||
216 | + // #ifdef H5 | ||
217 | + vm: that | ||
218 | + // #endif | ||
219 | + }); | ||
220 | + // 地址逆解析可获取省市区等信息 | ||
221 | + qqmapsdk.reverseGeocoder({ | ||
222 | + location: { | ||
223 | + latitude: latitude, | ||
224 | + longitude: longitude | ||
225 | + }, | ||
226 | + sig: base.mapData?.sk, | ||
227 | + success: function(res) { | ||
228 | + store.commit('setLocateInformation', res.result) | ||
229 | + successCallback && successCallback(res.result) | ||
230 | + }, | ||
231 | + fail: function(err) { | ||
232 | + item.location = { | ||
233 | + lat: latitude, | ||
234 | + lng: longitude, | ||
235 | + } | ||
236 | + store.commit('setLocateInformation', item) | ||
237 | + successCallback && successCallback(item) | ||
238 | + } | ||
239 | + }); | ||
240 | + } else { | ||
241 | + item.location = { | ||
242 | + lat: item.latitude, | ||
243 | + lng: item.longitude, | ||
244 | + } | ||
245 | + store.commit('setLocateInformation', item) | ||
246 | + successCallback && successCallback(item) | ||
247 | + } | ||
248 | + }, err => { | ||
249 | + store.commit('setLocateInformation', {}) | ||
250 | + errCallback && errCallback(err) | ||
251 | + }, isOpenSetting) | ||
237 | } | 252 | } |
238 | // 选择地址 | 253 | // 选择地址 |
239 | function choiseRegion(callback) { | 254 | function choiseRegion(callback) { |
240 | - var that = this; | ||
241 | - uni.chooseLocation({ | ||
242 | - success: function(res) { | ||
243 | - callback && callback(res) | ||
244 | - }, | ||
245 | - fail: function() { | ||
246 | - uni.getSetting({ | ||
247 | - success: function(res) { | ||
248 | - if (res.authSetting['scope.userLocation']) { | ||
249 | - uni.showModal({ | ||
250 | - title: '是否授权当前位置', | ||
251 | - content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用', | ||
252 | - success: function(tip) { | ||
253 | - if (tip.confirm) { | ||
254 | - uni.openSetting({ | ||
255 | - success: function(data) { | ||
256 | - if (data.authSetting["scope.userLocation"] === true) { | ||
257 | - that.$u.toast('授权成功~'); | ||
258 | - //授权成功之后,再调用chooseLocation选择地方 | ||
259 | - that.choiseRegion() | ||
260 | - } else { | ||
261 | - that.$u.toast('授权失败~'); | ||
262 | - } | ||
263 | - } | ||
264 | - }) | ||
265 | - } | ||
266 | - } | ||
267 | - }) | ||
268 | - } | ||
269 | - }, | ||
270 | - fail: function(res) { | ||
271 | - that.$u.toast('调用授权窗口失败~'); | ||
272 | - } | ||
273 | - }) | ||
274 | - } | ||
275 | - }) | 255 | + var that = this; |
256 | + uni.chooseLocation({ | ||
257 | + success: function(res) { | ||
258 | + callback && callback(res) | ||
259 | + }, | ||
260 | + fail: function() { | ||
261 | + uni.getSetting({ | ||
262 | + success: function(res) { | ||
263 | + if (res.authSetting['scope.userLocation']) { | ||
264 | + uni.showModal({ | ||
265 | + title: '是否授权当前位置', | ||
266 | + content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用', | ||
267 | + success: function(tip) { | ||
268 | + if (tip.confirm) { | ||
269 | + uni.openSetting({ | ||
270 | + success: function(data) { | ||
271 | + if (data.authSetting[ | ||
272 | + "scope.userLocation" | ||
273 | + ] === true) { | ||
274 | + that.$u.toast('授权成功~'); | ||
275 | + //授权成功之后,再调用chooseLocation选择地方 | ||
276 | + that.choiseRegion() | ||
277 | + } else { | ||
278 | + that.$u.toast('授权失败~'); | ||
279 | + } | ||
280 | + } | ||
281 | + }) | ||
282 | + } | ||
283 | + } | ||
284 | + }) | ||
285 | + } | ||
286 | + }, | ||
287 | + fail: function(res) { | ||
288 | + that.$u.toast('调用授权窗口失败~'); | ||
289 | + } | ||
290 | + }) | ||
291 | + } | ||
292 | + }) | ||
276 | } | 293 | } |
277 | 294 | ||
295 | + | ||
296 | +function transOrgFunc(arr) { | ||
297 | + arr.forEach((item) => { | ||
298 | + if (item.name) { | ||
299 | + item.name = item.name; | ||
300 | + } | ||
301 | + if (item.id) { | ||
302 | + item.value = item.id; | ||
303 | + item.checked = false | ||
304 | + item.id = item.id | ||
305 | + } | ||
306 | + if (item.children) { | ||
307 | + if (item.children.length) { | ||
308 | + transOrgFunc(item.children); | ||
309 | + } | ||
310 | + } | ||
311 | + }); | ||
312 | + return arr | ||
313 | +}; | ||
314 | + | ||
278 | export { | 315 | export { |
279 | - mpUpData, //小程序更新 | ||
280 | - formatSize, //App计算缓存 | ||
281 | - clearCache, //App清理缓存 | ||
282 | - scene, //扫码信息 | ||
283 | - loGetLocation, //获取定位信息 | ||
284 | - choiseRegion, //选择地址 | ||
285 | -} | ||
316 | + mpUpData, //小程序更新 | ||
317 | + formatSize, //App计算缓存 | ||
318 | + clearCache, //App清理缓存 | ||
319 | + scene, //扫码信息 | ||
320 | + loGetLocation, //获取定位信息 | ||
321 | + choiseRegion, //选择地址 | ||
322 | + transOrgFunc //转化树组件 | ||
323 | +} |
config/constant.js
0 → 100644
1 | import store from '@/store'; | 1 | import store from '@/store'; |
2 | -import { h5Login } from '@/config/h5Utils'; | 2 | +import { |
3 | + h5Login | ||
4 | +} from '@/config/h5Utils'; | ||
3 | // APP--授权登录 | 5 | // APP--授权登录 |
4 | // type授权登录平台 'qq'、'weixin'、'apple' | 6 | // type授权登录平台 'qq'、'weixin'、'apple' |
5 | -export const loginApp = (type,successCallback,errorCallback) => { | ||
6 | - uni.login({ | ||
7 | - provider: type, | ||
8 | - success: function(loginRes) { | ||
9 | - // 获取用户信息 | ||
10 | - uni.getUserInfo({ | ||
11 | - provider: type, | ||
12 | - success: function(infoRes) { | ||
13 | - let data = {} | ||
14 | - if(type=='qq'){ | ||
15 | - data = { | ||
16 | - 'openid': loginRes.authResult.openid, | ||
17 | - 'nickname': infoRes.userInfo.nickname, | ||
18 | - 'gender': infoRes.userInfo.gender, | ||
19 | - 'province': infoRes.userInfo.province, | ||
20 | - 'city': infoRes.userInfo.city, | ||
21 | - 'figureurl': infoRes.userInfo.figureurl_qq | ||
22 | - } | ||
23 | - }else if(type=='weixin'){ | ||
24 | - data = { | ||
25 | - 'openid': loginRes.authResult.openid, | ||
26 | - 'nickname': infoRes.userInfo.nickName, | ||
27 | - 'sex': infoRes.userInfo.gender, | ||
28 | - 'province': infoRes.userInfo.province, | ||
29 | - 'city': infoRes.userInfo.city, | ||
30 | - 'country': infoRes.userInfo.country, | ||
31 | - 'headimgurl': infoRes.userInfo.avatarUrl, | ||
32 | - 'unionid': loginRes.authResult.unionid | ||
33 | - } | ||
34 | - }else if(type=='apple'){ | ||
35 | - data = { | ||
36 | - verifyType: 'password', | ||
37 | - personalPhone: '13888888888', | ||
38 | - personalPhoneCountryCode: '86', | ||
39 | - password:'123456' | ||
40 | - } | ||
41 | - } | ||
42 | - successCallback && successCallback(data) | ||
43 | - } | ||
44 | - }); | ||
45 | - },fail: function (err) { | ||
46 | - console.log(res, "失败") | ||
47 | - errorCallback && errorCallback(res) | ||
48 | - } | ||
49 | - }); | 7 | +export const loginApp = (type, successCallback, errorCallback) => { |
8 | + uni.login({ | ||
9 | + provider: type, | ||
10 | + success: function(loginRes) { | ||
11 | + // 获取用户信息 | ||
12 | + uni.getUserInfo({ | ||
13 | + provider: type, | ||
14 | + success: function(infoRes) { | ||
15 | + let data = {} | ||
16 | + if (type == 'qq') { | ||
17 | + data = { | ||
18 | + 'openid': loginRes.authResult.openid, | ||
19 | + 'nickname': infoRes.userInfo.nickname, | ||
20 | + 'gender': infoRes.userInfo.gender, | ||
21 | + 'province': infoRes.userInfo.province, | ||
22 | + 'city': infoRes.userInfo.city, | ||
23 | + 'figureurl': infoRes.userInfo.figureurl_qq | ||
24 | + } | ||
25 | + } else if (type == 'weixin') { | ||
26 | + data = { | ||
27 | + 'openid': loginRes.authResult.openid, | ||
28 | + 'nickname': infoRes.userInfo.nickName, | ||
29 | + 'sex': infoRes.userInfo.gender, | ||
30 | + 'province': infoRes.userInfo.province, | ||
31 | + 'city': infoRes.userInfo.city, | ||
32 | + 'country': infoRes.userInfo.country, | ||
33 | + 'headimgurl': infoRes.userInfo.avatarUrl, | ||
34 | + 'unionid': loginRes.authResult.unionid | ||
35 | + } | ||
36 | + } else if (type == 'apple') { | ||
37 | + data = { | ||
38 | + verifyType: 'password', | ||
39 | + personalPhone: '13888888888', | ||
40 | + personalPhoneCountryCode: '86', | ||
41 | + password: '123456' | ||
42 | + } | ||
43 | + } | ||
44 | + successCallback && successCallback(data) | ||
45 | + } | ||
46 | + }); | ||
47 | + }, | ||
48 | + fail: function(err) { | ||
49 | + console.log(res, "失败") | ||
50 | + errorCallback && errorCallback(res) | ||
51 | + } | ||
52 | + }); | ||
50 | } | 53 | } |
51 | // 微信/支付宝小程序---手机号授权登录时使用 | 54 | // 微信/支付宝小程序---手机号授权登录时使用 |
52 | // info: uni.login获取的参数 | 55 | // info: uni.login获取的参数 |
53 | export const getPhoneInfo = (info, successCallback, errCallback) => { | 56 | export const getPhoneInfo = (info, successCallback, errCallback) => { |
54 | - let httpData = {} | ||
55 | - // #ifdef MP-WEIXIN | ||
56 | - httpData = { | ||
57 | - code: info.code, //小程序code | ||
58 | - iv: info.iv, //小程序加密算法的初始向量 | ||
59 | - encryptedData: info.encryptedData, //包括敏感数据在内的完整用户信息的加密数据 | ||
60 | - }; | ||
61 | - // #endif | ||
62 | - // #ifdef MP-ALIPAY | 57 | + let httpData = {} |
58 | + // #ifdef MP-WEIXIN | ||
59 | + httpData = { | ||
60 | + code: info.code, //小程序code | ||
61 | + iv: info.iv, //小程序加密算法的初始向量 | ||
62 | + encryptedData: info.encryptedData, //包括敏感数据在内的完整用户信息的加密数据 | ||
63 | + }; | ||
64 | + // #endif | ||
65 | + // #ifdef MP-ALIPAY | ||
63 | httpData = { | 66 | httpData = { |
64 | code: '', //小程序code | 67 | code: '', //小程序code |
65 | iv: '', //小程序加密算法的初始向量 | 68 | iv: '', //小程序加密算法的初始向量 |
66 | encryptedData: info, //包括敏感数据在内的完整用户信息的加密数据 | 69 | encryptedData: info, //包括敏感数据在内的完整用户信息的加密数据 |
67 | }; | 70 | }; |
68 | - // #endif | ||
69 | - | ||
70 | - // 此时需要您的接口返回个人信息 | 71 | + // #endif |
72 | + | ||
73 | + // 此时需要您的接口返回个人信息 | ||
71 | // uni.$u.http.post('您的接口', httpData).then(res => { | 74 | // uni.$u.http.post('您的接口', httpData).then(res => { |
72 | - var loginInfo = { | ||
73 | - // userId: res.id, | ||
74 | - // sessionId: res.sessionId, | ||
75 | - // phoneNum: res.phoneNum, | ||
76 | - // userName: res.userName, | ||
77 | - // openId: res.openId, | ||
78 | - }; | ||
79 | - successCallback && successCallback(loginInfo) | ||
80 | - // }, err => { | ||
81 | - // errCallback && errCallback(err) | ||
82 | - // }); | 75 | + var loginInfo = { |
76 | + // userId: res.id, | ||
77 | + // sessionId: res.sessionId, | ||
78 | + // phoneNum: res.phoneNum, | ||
79 | + // userName: res.userName, | ||
80 | + // openId: res.openId, | ||
81 | + }; | ||
82 | + successCallback && successCallback(loginInfo) | ||
83 | + // }, err => { | ||
84 | + // errCallback && errCallback(err) | ||
85 | + // }); | ||
83 | } | 86 | } |
84 | // 微信/支付宝小程序---通用授权个人信息登录 | 87 | // 微信/支付宝小程序---通用授权个人信息登录 |
85 | -export const getUserInfo = (successCallback,errorCallback) => { | ||
86 | - uni.showLoading({ | ||
87 | - title: '正在申请授权', | ||
88 | - }); | ||
89 | - // #ifdef MP-WEIXIN | ||
90 | - uni.getUserProfile({ | ||
91 | - desc: '用于完善会员资料', | ||
92 | - success: function(res) { | ||
93 | - uni.hideLoading() | ||
94 | - var offUserInfo = res.userInfo | ||
95 | - successCallback && successCallback(offUserInfo) | ||
96 | - },fail: (res) => { | ||
97 | - uni.hideLoading() | ||
98 | - errorCallback && errorCallback(res) | ||
99 | - } | ||
100 | - }) | ||
101 | - // #endif | ||
102 | - // #ifdef MP-ALIPAY | ||
103 | - uni.getOpenUserInfo({ | ||
104 | - success: (res) => { | ||
105 | - uni.hideLoading() | ||
106 | - var offUserInfo = JSON.parse(res.response).response // 以下方的报文格式解析两层 response | ||
107 | - offUserInfo.avatarUrl = offUserInfo.avatar | ||
108 | - successCallback && successCallback(offUserInfo) | ||
109 | - },fail: (res) => { | ||
110 | - uni.hideLoading() | ||
111 | - console.log(res, "失败") | ||
112 | - errorCallback && errorCallback(res) | ||
113 | - } | ||
114 | - }) | ||
115 | - // #endif | 88 | +export const getUserInfo = (successCallback, errorCallback) => { |
89 | + uni.showLoading({ | ||
90 | + title: '正在申请授权', | ||
91 | + }); | ||
92 | + // #ifdef MP-WEIXIN | ||
93 | + uni.getUserProfile({ | ||
94 | + desc: '用于完善会员资料', | ||
95 | + success: function(res) { | ||
96 | + uni.hideLoading() | ||
97 | + var offUserInfo = res.userInfo | ||
98 | + successCallback && successCallback(offUserInfo) | ||
99 | + }, | ||
100 | + fail: (res) => { | ||
101 | + uni.hideLoading() | ||
102 | + errorCallback && errorCallback(res) | ||
103 | + } | ||
104 | + }) | ||
105 | + // #endif | ||
106 | + // #ifdef MP-ALIPAY | ||
107 | + uni.getOpenUserInfo({ | ||
108 | + success: (res) => { | ||
109 | + uni.hideLoading() | ||
110 | + var offUserInfo = JSON.parse(res.response).response // 以下方的报文格式解析两层 response | ||
111 | + offUserInfo.avatarUrl = offUserInfo.avatar | ||
112 | + successCallback && successCallback(offUserInfo) | ||
113 | + }, | ||
114 | + fail: (res) => { | ||
115 | + uni.hideLoading() | ||
116 | + console.log(res, "失败") | ||
117 | + errorCallback && errorCallback(res) | ||
118 | + } | ||
119 | + }) | ||
120 | + // #endif | ||
116 | } | 121 | } |
117 | 122 | ||
118 | //判断是否登录(所有端) | 123 | //判断是否登录(所有端) |
119 | export const judgeLogin = (callback) => { | 124 | export const judgeLogin = (callback) => { |
120 | - let storeUserInfo = store.state.userInfo; | ||
121 | - if (!storeUserInfo.userId){ // nvue页面读取不到vuex里面数据,将取缓存 | ||
122 | - storeUserInfo = uni.getStorageSync('userInfo') | ||
123 | - } | ||
124 | - if (!storeUserInfo.token) { | ||
125 | - // #ifdef MP | ||
126 | - store.commit('setLoginPopupShow', true); | ||
127 | - // #endif | ||
128 | - // #ifdef APP-PLUS | ||
129 | - uni.$showModal({ | ||
130 | - title: "登录提示", | ||
131 | - confirmVal:'去登录', | ||
132 | - cancelVal:'再逛会', | ||
133 | - content:'此时此刻需要您登录喔~', | ||
134 | - }).then(res=>{ | ||
135 | - uni.navigateTo({ | ||
136 | - url: "/pages/user/login" | ||
137 | - }); | ||
138 | - }).catch(res=>{}) | ||
139 | - // #endif | ||
140 | - // #ifdef H5 | ||
141 | - h5Login(); | ||
142 | - // #endif | ||
143 | - }else{ | ||
144 | - callback() | ||
145 | - } | ||
146 | -} | ||
125 | + let storeUserInfo = store.state.userInfo; | ||
126 | + if (!storeUserInfo.userId) { // nvue页面读取不到vuex里面数据,将取缓存 | ||
127 | + storeUserInfo = uni.getStorageSync('userInfo') | ||
128 | + } | ||
129 | + if (!storeUserInfo.isToken) { | ||
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 => {}) | ||
155 | + // #endif | ||
156 | + // #ifdef H5 | ||
157 | + h5Login(); | ||
158 | + // #endif | ||
159 | + } else { | ||
160 | + callback() | ||
161 | + } | ||
162 | +} |
@@ -7,14 +7,12 @@ import { | @@ -7,14 +7,12 @@ import { | ||
7 | // 初始化请求配置 | 7 | // 初始化请求配置 |
8 | uni.$u.http.setConfig((config) => { | 8 | uni.$u.http.setConfig((config) => { |
9 | let token | 9 | let token |
10 | + //#ifndef H5 | ||
10 | token = store.state.userInfo.isToken || (uni.getStorageSync('userInfo').isToken || undefined) | 11 | token = store.state.userInfo.isToken || (uni.getStorageSync('userInfo').isToken || undefined) |
11 | - //#ifdef MP | ||
12 | - token = store.state.userInfo.isToken || (wx.getStorageSync('userInfo').isToken || undefined) | ||
13 | //#endif | 12 | //#endif |
14 | // #ifdef H5 | 13 | // #ifdef H5 |
15 | - window.sessionStorage.getItem('userInfo'); | 14 | + window.sessionStorage.getItem('userInfo').isToken; |
16 | // #endif | 15 | // #endif |
17 | - console.log('Get Token',token); | ||
18 | if (!token) { | 16 | if (!token) { |
19 | uni.showToast({ | 17 | uni.showToast({ |
20 | title: '请先登录', | 18 | title: '请先登录', |
@@ -47,14 +45,12 @@ uni.$u.http.interceptors.request.use((config) => { // 蜿ッ菴ソ逕ィasync await 蛛壼シ | @@ -47,14 +45,12 @@ uni.$u.http.interceptors.request.use((config) => { // 蜿ッ菴ソ逕ィasync await 蛛壼シ | ||
47 | config.data = config.data || {} | 45 | config.data = config.data || {} |
48 | // 根据custom参数中配置的是否需要token,添加对应的请求头 | 46 | // 根据custom参数中配置的是否需要token,添加对应的请求头 |
49 | if (config?.custom?.auth) { | 47 | if (config?.custom?.auth) { |
50 | - config.header.token = store.state.userInfo.token | 48 | + config.header.Authorization = 'Bearer ' + store.state.userInfo.isToken |
51 | } | 49 | } |
52 | - // console.log("请求开始", config); | ||
53 | if (config?.custom?.load) { | 50 | if (config?.custom?.load) { |
54 | //打开加载动画 | 51 | //打开加载动画 |
55 | store.commit("setLoadingShow", true); | 52 | store.commit("setLoadingShow", true); |
56 | } | 53 | } |
57 | - | ||
58 | return config | 54 | return config |
59 | }, config => { // 可使用async await 做异步操作 | 55 | }, config => { // 可使用async await 做异步操作 |
60 | return Promise.reject(config) | 56 | return Promise.reject(config) |
@@ -100,13 +96,19 @@ uni.$u.http.interceptors.response.use((response) => { | @@ -100,13 +96,19 @@ uni.$u.http.interceptors.response.use((response) => { | ||
100 | store.commit("setLoadingShow", false); | 96 | store.commit("setLoadingShow", false); |
101 | // 对响应错误做点什么 (statusCode !== 200) | 97 | // 对响应错误做点什么 (statusCode !== 200) |
102 | let errorData = '请检查网络或服务器' | 98 | let errorData = '请检查网络或服务器' |
103 | - let message = response.data.message || response.errMsg | 99 | + let message = response.data?.message || response?.errMsg |
104 | if (message == "request:fail url not in domain list") { | 100 | if (message == "request:fail url not in domain list") { |
105 | errorData = '检查请求域名是否添加了域名白名单' | 101 | errorData = '检查请求域名是否添加了域名白名单' |
106 | } else if (message == 'request:fail timeout') { | 102 | } else if (message == 'request:fail timeout') { |
107 | errorData = '请求超时:请检查网络' | 103 | errorData = '请求超时:请检查网络' |
108 | } else if (message == 'Token has expired') { | 104 | } else if (message == 'Token has expired') { |
109 | errorData = 'Token失效,请重新登录' | 105 | errorData = 'Token失效,请重新登录' |
106 | + setTimeout(() => { | ||
107 | + uni.reLaunch({ | ||
108 | + url: '/pages/personal/login' | ||
109 | + }) | ||
110 | + }, 500) | ||
111 | + store.commit('emptyUserInfo') | ||
110 | } else { | 112 | } else { |
111 | errorData = message || '请检查网络或服务器' | 113 | errorData = message || '请检查网络或服务器' |
112 | } | 114 | } |
@@ -11,9 +11,7 @@ | @@ -11,9 +11,7 @@ | ||
11 | { | 11 | { |
12 | "path": "pages/device/device", | 12 | "path": "pages/device/device", |
13 | "style": { | 13 | "style": { |
14 | - "navigationBarTitleText": "设备", | ||
15 | - "backgroundColorTop": "gray", | ||
16 | - "backgroundColorBottom": "gray" | 14 | + "navigationBarTitleText": "设备" |
17 | } | 15 | } |
18 | }, | 16 | }, |
19 | { | 17 | { |
@@ -88,6 +86,12 @@ | @@ -88,6 +86,12 @@ | ||
88 | "navigationBarTitleText": "查看摄像头" | 86 | "navigationBarTitleText": "查看摄像头" |
89 | } | 87 | } |
90 | 88 | ||
89 | + }, | ||
90 | + { | ||
91 | + "path": "pages/index/camera/org/org", | ||
92 | + "style": { | ||
93 | + "navigationBarTitleText": "组织筛选" | ||
94 | + } | ||
91 | }, { | 95 | }, { |
92 | "path": "pages/index/orgStatus/orgStatus", | 96 | "path": "pages/index/orgStatus/orgStatus", |
93 | "style": { | 97 | "style": { |
@@ -11,18 +11,18 @@ | @@ -11,18 +11,18 @@ | ||
11 | </f-navbar> | 11 | </f-navbar> |
12 | <!-- 公共组件-每个页面必须引入 --> | 12 | <!-- 公共组件-每个页面必须引入 --> |
13 | <public-module></public-module> | 13 | <public-module></public-module> |
14 | - <view class="org-sty"> | 14 | + <view @click="openOrg" class="org-sty"> |
15 | <view class="org-item"> | 15 | <view class="org-item"> |
16 | <view class="u-flex" style="flex-direction: row;margin-top: 26rpx;margin-left: 15rpx;"> | 16 | <view class="u-flex" style="flex-direction: row;margin-top: 26rpx;margin-left: 15rpx;"> |
17 | <text style="color:#333333;font-size: 15px;margin-left: 14rpx;">组织关系</text> | 17 | <text style="color:#333333;font-size: 15px;margin-left: 14rpx;">组织关系</text> |
18 | </view> | 18 | </view> |
19 | <view style="margin-top: 5rpx;margin-left: 15rpx;flex-direction: row;" class="u-flex"> | 19 | <view style="margin-top: 5rpx;margin-left: 15rpx;flex-direction: row;" class="u-flex"> |
20 | <image style="margin-left: 14rpx;width: 30rpx;height: 30rpx;" src="../../static/org.png" mode=""></image> | 20 | <image style="margin-left: 14rpx;width: 30rpx;height: 30rpx;" src="../../static/org.png" mode=""></image> |
21 | - <text style="margin-left: 10rpx;color:#666666;font-size: 12px;">设备数:1234</text> | 21 | + <text style="margin-left: 10rpx;color:#666666;font-size: 12px;">告警数:{{ alertTotal }}</text> |
22 | </view> | 22 | </view> |
23 | </view> | 23 | </view> |
24 | <view class="org-item" style=""> | 24 | <view class="org-item" style=""> |
25 | - <image @click="openOrg" style="width: 6px;height: 10px;float: right; margin-right: 34rpx; margin-top: 58rpx;" src="../../static/right-arrow.png" mode=""></image> | 25 | + <image style="width: 6px;height: 10px;float: right; margin-right: 34rpx; margin-top: 58rpx;" src="../../static/right-arrow.png" mode=""></image> |
26 | </view> | 26 | </view> |
27 | </view> | 27 | </view> |
28 | <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"> | 28 | <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback"> |
@@ -217,6 +217,7 @@ | @@ -217,6 +217,7 @@ | ||
217 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; | 217 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; |
218 | import fNavbar from '@/components/module/f-navbar/f-navbar'; | 218 | import fNavbar from '@/components/module/f-navbar/f-navbar'; |
219 | import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; | 219 | import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; |
220 | +import { pageNumber, pageSize } from '@/config/constant.js'; | ||
220 | 221 | ||
221 | export default { | 222 | export default { |
222 | mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) | 223 | mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) |
@@ -398,12 +399,24 @@ export default { | @@ -398,12 +399,24 @@ export default { | ||
398 | bgColor: '#F6F6F6', | 399 | bgColor: '#F6F6F6', |
399 | textColor: '#F6F6F6' | 400 | textColor: '#F6F6F6' |
400 | } | 401 | } |
401 | - ] | 402 | + ], |
403 | + ordId: '', | ||
404 | + detailStatus: false, | ||
405 | + alertTotal: 0 | ||
402 | }; | 406 | }; |
403 | }, | 407 | }, |
404 | onShow() { | 408 | onShow() { |
405 | - console.log('Show'); | ||
406 | - this.loadData(1); | 409 | + if (this.detailStatus) { |
410 | + this.loadData(1); | ||
411 | + } | ||
412 | + if (this.ordId == '') { | ||
413 | + } else { | ||
414 | + this.loadData(1, null, null, null, null, null, this.ordId); | ||
415 | + } | ||
416 | + }, | ||
417 | + onHide() { | ||
418 | + this.ordId = ''; | ||
419 | + this.detailStatus = false; | ||
407 | }, | 420 | }, |
408 | onLoad(e) { | 421 | onLoad(e) { |
409 | // 隐藏原生的tabbar | 422 | // 隐藏原生的tabbar |
@@ -485,7 +498,7 @@ export default { | @@ -485,7 +498,7 @@ export default { | ||
485 | this.page.num += 1; | 498 | this.page.num += 1; |
486 | this.loadData(this.page.num); | 499 | this.loadData(this.page.num); |
487 | }, | 500 | }, |
488 | - loadData(pageNo, statusV, startTimeV, endTimeV, severityV, deviceTypeV) { | 501 | + loadData(pageNo, statusV, startTimeV, endTimeV, severityV, deviceTypeV, organizationV) { |
489 | let httpData = { | 502 | let httpData = { |
490 | page: pageNo, | 503 | page: pageNo, |
491 | pageSize: 10, | 504 | pageSize: 10, |
@@ -493,13 +506,15 @@ export default { | @@ -493,13 +506,15 @@ export default { | ||
493 | startTime: startTimeV, | 506 | startTime: startTimeV, |
494 | endTime: endTimeV, | 507 | endTime: endTimeV, |
495 | severity: severityV, | 508 | severity: severityV, |
496 | - deviceType: deviceTypeV | 509 | + deviceType: deviceTypeV, |
510 | + organizationId: organizationV | ||
497 | }; | 511 | }; |
498 | uni.$u.http | 512 | uni.$u.http |
499 | .get('/yt/alarm', { params: httpData, custom: { load: false } }) | 513 | .get('/yt/alarm', { params: httpData, custom: { load: false } }) |
500 | .then(res => { | 514 | .then(res => { |
501 | uni.stopPullDownRefresh(); | 515 | uni.stopPullDownRefresh(); |
502 | this.mescroll.endByPage(res.items.length, res.total); | 516 | this.mescroll.endByPage(res.items.length, res.total); |
517 | + this.alertTotal = res.total; | ||
503 | if (pageNo == 1) { | 518 | if (pageNo == 1) { |
504 | this.list = res.items; | 519 | this.list = res.items; |
505 | } else { | 520 | } else { |
@@ -8,7 +8,6 @@ | @@ -8,7 +8,6 @@ | ||
8 | class="u-flex" | 8 | class="u-flex" |
9 | style="flex-direction: row;justify-content: space-between;margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;" | 9 | style="flex-direction: row;justify-content: space-between;margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;" |
10 | > | 10 | > |
11 | - {{list}} | ||
12 | <text style="color:#333333;font-size: 15px;">{{ list.deviceName == null ? '暂无数据' : list.deviceName }}</text> | 11 | <text style="color:#333333;font-size: 15px;">{{ list.deviceName == null ? '暂无数据' : list.deviceName }}</text> |
13 | <image style="width: 30rpx;height: 30rpx;" src="../../static/alert-detail.png" mode=""></image> | 12 | <image style="width: 30rpx;height: 30rpx;" src="../../static/alert-detail.png" mode=""></image> |
14 | </view> | 13 | </view> |
@@ -16,13 +15,13 @@ | @@ -16,13 +15,13 @@ | ||
16 | <text style="color:#333333;font-size: 14px;">告警级别:</text> | 15 | <text style="color:#333333;font-size: 14px;">告警级别:</text> |
17 | <text style="color:#DE4437"> | 16 | <text style="color:#DE4437"> |
18 | {{ | 17 | {{ |
19 | - item.severity == 'CRITICAL' | 18 | + list.severity == 'CRITICAL' |
20 | ? '危险' | 19 | ? '危险' |
21 | - : item.severity == 'MAJOR' | 20 | + : list.severity == 'MAJOR' |
22 | ? '重要' | 21 | ? '重要' |
23 | - : item.severity == 'MINOR' | 22 | + : list.severity == 'MINOR' |
24 | ? '次要' | 23 | ? '次要' |
25 | - : item.severity == 'WARNING' | 24 | + : list.severity == 'WARNING' |
26 | ? '警告' | 25 | ? '警告' |
27 | : '不确定' | 26 | : '不确定' |
28 | }} | 27 | }} |
@@ -44,11 +43,11 @@ | @@ -44,11 +43,11 @@ | ||
44 | <text style="color:#333333;font-size: 15px;">告警状态:</text> | 43 | <text style="color:#333333;font-size: 15px;">告警状态:</text> |
45 | <text style="color:#DE4437;font-size: 14px;"> | 44 | <text style="color:#DE4437;font-size: 14px;"> |
46 | {{ | 45 | {{ |
47 | - item.status == 'CLEARED_UNACK' | 46 | + list.status == 'CLEARED_UNACK' |
48 | ? '清除未确认' | 47 | ? '清除未确认' |
49 | - : item.status == 'ACTIVE_UNACK' | 48 | + : list.status == 'ACTIVE_UNACK' |
50 | ? '激活未确认' | 49 | ? '激活未确认' |
51 | - : item.status == 'CLEARED_ACK' | 50 | + : list.status == 'CLEARED_ACK' |
52 | ? '清除已确认' | 51 | ? '清除已确认' |
53 | : '激活已确认' | 52 | : '激活已确认' |
54 | }} | 53 | }} |
@@ -56,14 +55,22 @@ | @@ -56,14 +55,22 @@ | ||
56 | </view> | 55 | </view> |
57 | </view> | 56 | </view> |
58 | </view> | 57 | </view> |
58 | + <!-- #ifdef MP --> | ||
59 | <view style="color:#333333,font-size:15px;margin-top: 20rpx;">处理结果</view> | 59 | <view style="color:#333333,font-size:15px;margin-top: 20rpx;">处理结果</view> |
60 | <view style="margin-top: 20rpx;;border-radius: 20px;width: 688rpx;height: 273rpx;background-color: #FFFFFF;"> | 60 | <view style="margin-top: 20rpx;;border-radius: 20px;width: 688rpx;height: 273rpx;background-color: #FFFFFF;"> |
61 | - <u--form labelPosition="left" :model="formModel" ref="form1"> | 61 | + <u--form :label-style="{ 'font-size': '0rpx' }" style="padding-left: 26rpx;" labelPosition="left" :model="formModel" ref="form1"> |
62 | <u-form-item label="." prop="result" ref="item3"> | 62 | <u-form-item label="." prop="result" ref="item3"> |
63 | - <u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea> | 63 | + <view style="margin-left: -60rpx;"><u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea></view> |
64 | </u-form-item> | 64 | </u-form-item> |
65 | </u--form> | 65 | </u--form> |
66 | </view> | 66 | </view> |
67 | + <!-- #endif --> | ||
68 | + <!-- #ifdef APP-PLUS --> | ||
69 | + <view style="color:#333333,font-size:15px;margin-top: 20rpx;">处理结果</view> | ||
70 | + <view style="margin-top: 20rpx;;border-radius: 20px;width: 688rpx;height: 273rpx;background-color: #FFFFFF;"> | ||
71 | + <view><u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea></view> | ||
72 | + </view> | ||
73 | + <!-- #endif --> | ||
67 | <view style="width: 500rpx;margin-left: 80rpx;margin-top: 44rpx;"><u-button @click="handleSubmit" type="primary" shape="circle" text="处理"></u-button></view> | 74 | <view style="width: 500rpx;margin-left: 80rpx;margin-top: 44rpx;"><u-button @click="handleSubmit" type="primary" shape="circle" text="处理"></u-button></view> |
68 | <f-tabbar></f-tabbar> | 75 | <f-tabbar></f-tabbar> |
69 | </view> | 76 | </view> |
@@ -98,15 +105,16 @@ export default { | @@ -98,15 +105,16 @@ export default { | ||
98 | .post(`/alarm/${this.list.id}/ack`) | 105 | .post(`/alarm/${this.list.id}/ack`) |
99 | .then(res => { | 106 | .then(res => { |
100 | uni.$u.toast('处理成功'); | 107 | uni.$u.toast('处理成功'); |
101 | - setTimeout(() => { | ||
102 | - uni.navigateBack({ | ||
103 | - delta: 1 | ||
104 | - }); | ||
105 | - }, 500); | 108 | + let pages = getCurrentPages(); //获取所有页面栈实例列表 |
109 | + let nowPage = pages[pages.length - 1]; //当前页页面实例 | ||
110 | + let prevPage = pages[pages.length - 2]; //上一页页面实例 | ||
111 | + prevPage.$vm.detailStatus = true; | ||
112 | + uni.navigateBack({ | ||
113 | + delta: 1 | ||
114 | + }); | ||
106 | }) | 115 | }) |
107 | .catch(e => { | 116 | .catch(e => { |
108 | - console.log(e); | ||
109 | - uni.$u.toast(e); | 117 | + uni.$u.toast(e.data?.message); |
110 | }); | 118 | }); |
111 | } | 119 | } |
112 | } | 120 | } |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <!-- 公共组件-每个页面必须引入 --> | 3 | <!-- 公共组件-每个页面必须引入 --> |
4 | <public-module></public-module> | 4 | <public-module></public-module> |
5 | <view> | 5 | <view> |
6 | - <luyj-tree search-placeholder="请输入搜索内容" :is-check="true" :search-if="true" v-slot:default="{ item }" :max="max" :trees="tree"> | 6 | + <luyj-tree @sendValue="confirm" :is-check="isCheck" search-placeholder="请输入搜索内容" :search-if="true" v-slot:default="{ item }" :max="max" :trees="tree"> |
7 | <view> | 7 | <view> |
8 | <view class="content-item"> | 8 | <view class="content-item"> |
9 | <view class="word">{{ item.name }}</view> | 9 | <view class="word">{{ item.name }}</view> |
@@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||
18 | <script> | 18 | <script> |
19 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; | 19 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; |
20 | import dataList from '@/config/mockOrg.js'; | 20 | import dataList from '@/config/mockOrg.js'; |
21 | +import { transOrgFunc } from '@/config/common.js'; | ||
21 | 22 | ||
22 | export default { | 23 | export default { |
23 | components: { | 24 | components: { |
@@ -25,13 +26,41 @@ export default { | @@ -25,13 +26,41 @@ export default { | ||
25 | }, | 26 | }, |
26 | data() { | 27 | data() { |
27 | return { | 28 | return { |
28 | - tree: dataList, | ||
29 | - max: 5 | 29 | + isCheck: true, // 是否可选 |
30 | + tree: [], | ||
31 | + max: 5, | ||
32 | + id: '' | ||
30 | }; | 33 | }; |
31 | }, | 34 | }, |
32 | onLoad(e) { | 35 | onLoad(e) { |
33 | // 隐藏原生的tabbar | 36 | // 隐藏原生的tabbar |
34 | uni.hideTabBar(); | 37 | uni.hideTabBar(); |
38 | + this.loadData(); | ||
39 | + }, | ||
40 | + methods: { | ||
41 | + loadData() { | ||
42 | + uni.$u.http | ||
43 | + .get('/yt/organization/me/list') | ||
44 | + .then(res => { | ||
45 | + if (res) { | ||
46 | + const list = transOrgFunc(res); | ||
47 | + this.tree = list; | ||
48 | + } | ||
49 | + }) | ||
50 | + .catch(e => { | ||
51 | + uni.$u.toast(e.data.message); | ||
52 | + }); | ||
53 | + }, | ||
54 | + confirm(val) { | ||
55 | + this.id = val[0].id; | ||
56 | + let pages = getCurrentPages(); //获取所有页面栈实例列表 | ||
57 | + let nowPage = pages[pages.length - 1]; //当前页页面实例 | ||
58 | + let prevPage = pages[pages.length - 2]; //上一页页面实例 | ||
59 | + prevPage.$vm.ordId = this.id; | ||
60 | + uni.navigateBack({ | ||
61 | + delta: 1 | ||
62 | + }); | ||
63 | + } | ||
35 | } | 64 | } |
36 | }; | 65 | }; |
37 | </script> | 66 | </script> |
@@ -3,29 +3,41 @@ | @@ -3,29 +3,41 @@ | ||
3 | <!-- 公共组件-每个页面必须引入 --> | 3 | <!-- 公共组件-每个页面必须引入 --> |
4 | <public-module></public-module> | 4 | <public-module></public-module> |
5 | <view class="org-sty"> | 5 | <view class="org-sty"> |
6 | - <view class="org-item"> | 6 | + <view @click="openOrg" class="org-item"> |
7 | <view class="u-flex" style="flex-direction: row;margin-top: 26rpx;margin-left: 15rpx;"> | 7 | <view class="u-flex" style="flex-direction: row;margin-top: 26rpx;margin-left: 15rpx;"> |
8 | <text style="color:#333333;font-size: 15px;margin-left: 14rpx;">组织关系</text> | 8 | <text style="color:#333333;font-size: 15px;margin-left: 14rpx;">组织关系</text> |
9 | </view> | 9 | </view> |
10 | <view style="margin-top: 5rpx;margin-left: 15rpx;flex-direction: row;" class="u-flex"> | 10 | <view style="margin-top: 5rpx;margin-left: 15rpx;flex-direction: row;" class="u-flex"> |
11 | <image style="margin-left: 14rpx;width: 30rpx;height: 30rpx;" src="../../../static/org.png" mode=""></image> | 11 | <image style="margin-left: 14rpx;width: 30rpx;height: 30rpx;" src="../../../static/org.png" mode=""></image> |
12 | - <text style="margin-left: 10rpx;color:#666666;font-size: 12px;">设备数:1234</text> | 12 | + <text style="margin-left: 10rpx;color:#666666;font-size: 12px;">设备数:{{ deviceTotal }}</text> |
13 | </view> | 13 | </view> |
14 | </view> | 14 | </view> |
15 | <view class="org-item" style=""> | 15 | <view class="org-item" style=""> |
16 | - <image @click="openOrg" style="width: 6px;height: 10px;float: right; margin-right: 34rpx; margin-top: 58rpx;" src="../../../static/right-arrow.png" mode=""></image> | 16 | + <image style="width: 6px;height: 10px;float: right; margin-right: 34rpx; margin-top: 58rpx;" src="../../../static/right-arrow.png" mode=""></image> |
17 | </view> | 17 | </view> |
18 | </view> | 18 | </view> |
19 | + <!-- <view class="camera-container"> | ||
20 | + <view class="container-item"> | ||
21 | + <view @click="openCameraDetail(item.url)" v-for="(item, index) in list" :key="index" class="item"> | ||
22 | + <video style="border-radius: 20px;width:300rpx ;height: 200rpx;" :src="item.url" controls></video> | ||
23 | + <view style="position: relative;top: 8rpx;text-align: center;"> | ||
24 | + <text style="color: #333333;font-size: 13px;">{{ item.name }}</text> | ||
25 | + </view> | ||
26 | + </view> | ||
27 | + </view> | ||
28 | + </view> --> | ||
29 | + | ||
19 | <view class="camera-container"> | 30 | <view class="camera-container"> |
20 | <view class="container-item"> | 31 | <view class="container-item"> |
21 | <view @click="openCameraDetail(item.url)" v-for="(item, index) in list" :key="index" class="item"> | 32 | <view @click="openCameraDetail(item.url)" v-for="(item, index) in list" :key="index" class="item"> |
22 | - <video style="border-radius: 20px;width:300rpx ;height: 200rpx;" object-fit="conver" :src="item.url" controls></video> | 33 | + <video style="border-radius: 20px;width:300rpx ;height: 200rpx;" :src="item.url" controls></video> |
23 | <view style="position: relative;top: 8rpx;text-align: center;"> | 34 | <view style="position: relative;top: 8rpx;text-align: center;"> |
24 | <text style="color: #333333;font-size: 13px;">{{ item.name }}</text> | 35 | <text style="color: #333333;font-size: 13px;">{{ item.name }}</text> |
25 | </view> | 36 | </view> |
26 | </view> | 37 | </view> |
27 | </view> | 38 | </view> |
28 | </view> | 39 | </view> |
40 | + <view style="height: 30rpx;"></view> | ||
29 | <f-tabbar></f-tabbar> | 41 | <f-tabbar></f-tabbar> |
30 | </view> | 42 | </view> |
31 | </template> | 43 | </template> |
@@ -39,6 +51,7 @@ export default { | @@ -39,6 +51,7 @@ export default { | ||
39 | }, | 51 | }, |
40 | data() { | 52 | data() { |
41 | return { | 53 | return { |
54 | + deviceTotal: 0, | ||
42 | list: [ | 55 | list: [ |
43 | { | 56 | { |
44 | url: 'http://113.204.115.250:83/openUrl/e5NZg76/live.m3u8', | 57 | url: 'http://113.204.115.250:83/openUrl/e5NZg76/live.m3u8', |
@@ -63,6 +76,18 @@ export default { | @@ -63,6 +76,18 @@ export default { | ||
63 | { | 76 | { |
64 | url: 'https://stream7.iqilu.com/10339/upload_transcode/202002/09/20200209104902N3v5Vpxuvb.mp4', | 77 | url: 'https://stream7.iqilu.com/10339/upload_transcode/202002/09/20200209104902N3v5Vpxuvb.mp4', |
65 | name: '摄像头6' | 78 | name: '摄像头6' |
79 | + }, | ||
80 | + { | ||
81 | + url: 'https://stream7.iqilu.com/10339/upload_transcode/202002/09/20200209104902N3v5Vpxuvb.mp4', | ||
82 | + name: '摄像头6' | ||
83 | + }, | ||
84 | + { | ||
85 | + url: 'https://stream7.iqilu.com/10339/upload_transcode/202002/09/20200209104902N3v5Vpxuvb.mp4', | ||
86 | + name: '摄像头6' | ||
87 | + }, | ||
88 | + { | ||
89 | + url: 'https://stream7.iqilu.com/10339/upload_transcode/202002/09/20200209104902N3v5Vpxuvb.mp4', | ||
90 | + name: '摄像头6' | ||
66 | } | 91 | } |
67 | ] | 92 | ] |
68 | }; | 93 | }; |
@@ -70,10 +95,32 @@ export default { | @@ -70,10 +95,32 @@ export default { | ||
70 | onLoad() { | 95 | onLoad() { |
71 | // 隐藏原生的tabbar | 96 | // 隐藏原生的tabbar |
72 | uni.hideTabBar(); | 97 | uni.hideTabBar(); |
98 | + this.getDeviceTotalData(); | ||
73 | }, | 99 | }, |
74 | methods: { | 100 | methods: { |
101 | + getDeviceTotalData() { | ||
102 | + let httpData = { | ||
103 | + page: 1, | ||
104 | + pageSize: 10 | ||
105 | + }; | ||
106 | + uni.$u.http | ||
107 | + .get('/yt/device', { params: httpData, custom: { load: false } }) | ||
108 | + .then(res => { | ||
109 | + if (res) { | ||
110 | + this.deviceTotal = res.total; | ||
111 | + } | ||
112 | + }) | ||
113 | + .catch(e => { | ||
114 | + uni.$u.toast(e.data?.message); | ||
115 | + }); | ||
116 | + }, | ||
75 | openCameraDetail(e) { | 117 | openCameraDetail(e) { |
76 | console.log(e); | 118 | console.log(e); |
119 | + }, | ||
120 | + openOrg() { | ||
121 | + uni.navigateTo({ | ||
122 | + url: './org/org' | ||
123 | + }); | ||
77 | } | 124 | } |
78 | } | 125 | } |
79 | }; | 126 | }; |
pages/index/camera/org/org.vue
0 → 100644
1 | +<template> | ||
2 | + <view class="org-content"> | ||
3 | + <!-- 公共组件-每个页面必须引入 --> | ||
4 | + <public-module></public-module> | ||
5 | + <view> | ||
6 | + <luyj-tree @sendValue="confirm" :is-check="isCheck" search-placeholder="请输入搜索内容" :search-if="true" v-slot:default="{ item }" :max="max" :trees="tree"> | ||
7 | + <view> | ||
8 | + <view class="content-item"> | ||
9 | + <view class="word">{{ item.name }}</view> | ||
10 | + </view> | ||
11 | + </view> | ||
12 | + </luyj-tree> | ||
13 | + </view> | ||
14 | + <f-tabbar></f-tabbar> | ||
15 | + </view> | ||
16 | +</template> | ||
17 | + | ||
18 | +<script> | ||
19 | +import fTabbar from '@/components/module/f-tabbar/f-tabbar'; | ||
20 | +import dataList from '@/config/mockOrg.js'; | ||
21 | +import { transOrgFunc } from '@/config/common.js'; | ||
22 | + | ||
23 | +export default { | ||
24 | + components: { | ||
25 | + fTabbar | ||
26 | + }, | ||
27 | + data() { | ||
28 | + return { | ||
29 | + isCheck: true, // 是否可选 | ||
30 | + tree: [], | ||
31 | + max: 5, | ||
32 | + id: '' | ||
33 | + }; | ||
34 | + }, | ||
35 | + onLoad(e) { | ||
36 | + // 隐藏原生的tabbar | ||
37 | + uni.hideTabBar(); | ||
38 | + this.loadData(); | ||
39 | + }, | ||
40 | + methods: { | ||
41 | + loadData() { | ||
42 | + uni.$u.http | ||
43 | + .get('/yt/organization/me/list') | ||
44 | + .then(res => { | ||
45 | + if (res) { | ||
46 | + const list = transOrgFunc(res); | ||
47 | + this.tree = list; | ||
48 | + } | ||
49 | + }) | ||
50 | + .catch(e => { | ||
51 | + uni.$u.toast(e.data.message); | ||
52 | + }); | ||
53 | + }, | ||
54 | + confirm(val) { | ||
55 | + this.id = val[0].id; | ||
56 | + let pages = getCurrentPages(); //获取所有页面栈实例列表 | ||
57 | + let nowPage = pages[pages.length - 1]; //当前页页面实例 | ||
58 | + let prevPage = pages[pages.length - 2]; //上一页页面实例 | ||
59 | + prevPage.$vm.ordId = this.id; | ||
60 | + uni.navigateBack({ | ||
61 | + delta: 1 | ||
62 | + }); | ||
63 | + } | ||
64 | + } | ||
65 | +}; | ||
66 | +</script> | ||
67 | + | ||
68 | +<style lang="scss" scoped> | ||
69 | +.org-content { | ||
70 | + padding: 0 10rpx; | ||
71 | +} | ||
72 | +</style> |
@@ -14,15 +14,21 @@ | @@ -14,15 +14,21 @@ | ||
14 | </view> | 14 | </view> |
15 | <view class="item-child u-flex" style="justify-content: space-between;align-items: center;"> | 15 | <view class="item-child u-flex" style="justify-content: space-between;align-items: center;"> |
16 | <view style="width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> | 16 | <view style="width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> |
17 | - <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"><text>2</text></view> | 17 | + <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"> |
18 | + <text>{{ deviceData.onLine }}</text> | ||
19 | + </view> | ||
18 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>在线</text></view> | 20 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>在线</text></view> |
19 | </view> | 21 | </view> |
20 | <view style="margin-left: 45rpx;width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> | 22 | <view style="margin-left: 45rpx;width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> |
21 | - <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"><text>52</text></view> | 23 | + <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"> |
24 | + <text>{{ deviceData.unLine }}</text> | ||
25 | + </view> | ||
22 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>离线</text></view> | 26 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>离线</text></view> |
23 | </view> | 27 | </view> |
24 | <view style="margin-left: 45rpx;width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> | 28 | <view style="margin-left: 45rpx;width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> |
25 | - <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"><text>299</text></view> | 29 | + <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"> |
30 | + <text>{{ deviceData.noActive }}</text> | ||
31 | + </view> | ||
26 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>未激活</text></view> | 32 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>未激活</text></view> |
27 | </view> | 33 | </view> |
28 | </view> | 34 | </view> |
@@ -34,15 +40,21 @@ | @@ -34,15 +40,21 @@ | ||
34 | </view> | 40 | </view> |
35 | <view class="item-child u-flex" style="justify-content: space-between;align-items: center;"> | 41 | <view class="item-child u-flex" style="justify-content: space-between;align-items: center;"> |
36 | <view style="width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> | 42 | <view style="width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> |
37 | - <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"><text>12</text></view> | 43 | + <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"> |
44 | + <text>{{ alertData.noHandle }}</text> | ||
45 | + </view> | ||
38 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>未处理</text></view> | 46 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>未处理</text></view> |
39 | </view> | 47 | </view> |
40 | <view style="margin-left: 45rpx;width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> | 48 | <view style="margin-left: 45rpx;width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> |
41 | - <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"><text>522</text></view> | 49 | + <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"> |
50 | + <text>{{ alertData.doneHandle }}</text> | ||
51 | + </view> | ||
42 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>已处理</text></view> | 52 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>已处理</text></view> |
43 | </view> | 53 | </view> |
44 | <view style="margin-left: 45rpx;width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> | 54 | <view style="margin-left: 45rpx;width: 200rpx;height: 150rpx;justify-content: space-between;flex-direction: column;" class="u-flex"> |
45 | - <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"><text>99</text></view> | 55 | + <view style="height: 70rpx;font-size:14px;color:#333333;font-weight:500"> |
56 | + <text>{{ alertData.errorReport }}</text> | ||
57 | + </view> | ||
46 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>误报</text></view> | 58 | <view style="position:relative;top:-40rpx;height: 60rpx;font-size:12px;color:#999999"><text>误报</text></view> |
47 | </view> | 59 | </view> |
48 | </view> | 60 | </view> |
@@ -97,21 +109,55 @@ export default { | @@ -97,21 +109,55 @@ export default { | ||
97 | }, | 109 | }, |
98 | data() { | 110 | data() { |
99 | return { | 111 | return { |
100 | - openCamera() { | ||
101 | - uni.navigateTo({ | ||
102 | - url: 'camera/camera' | ||
103 | - }); | 112 | + deviceData: { |
113 | + onLine: 0, | ||
114 | + unLine: 0, | ||
115 | + noActive: 0 | ||
104 | }, | 116 | }, |
105 | - openOrgStatus() { | ||
106 | - uni.navigateTo({ | ||
107 | - url: 'orgStatus/orgStatus' | ||
108 | - }); | 117 | + alertData: { |
118 | + noHandle: 0, | ||
119 | + doneHandle: 0, | ||
120 | + errorReport: 0 | ||
109 | } | 121 | } |
110 | }; | 122 | }; |
111 | }, | 123 | }, |
112 | onLoad() { | 124 | onLoad() { |
113 | // 隐藏原生的tabbar | 125 | // 隐藏原生的tabbar |
114 | uni.hideTabBar(); | 126 | uni.hideTabBar(); |
127 | + this.getDeviceTotalData(); | ||
128 | + }, | ||
129 | + methods: { | ||
130 | + getDeviceTotalData() { | ||
131 | + let httpData = { | ||
132 | + page: 1, | ||
133 | + pageSize: 10 | ||
134 | + }; | ||
135 | + uni.$u.http | ||
136 | + .get('/yt/homepage/left/top', { params: httpData, custom: { load: false } }) | ||
137 | + .then(res => { | ||
138 | + if (res) { | ||
139 | + this.deviceData.onLine = res.deviceInfo.onLine; | ||
140 | + this.deviceData.unLine = res.deviceInfo.offLine; | ||
141 | + this.deviceData.noActive = res.deviceInfo.inActive; | ||
142 | + this.alertData.noHandle = res.alarmInfo.todayAdd; | ||
143 | + this.alertData.doneHandle = res.alarmInfo.sumCount; | ||
144 | + this.alertData.errorReport = res.alarmInfo.todayAdd; | ||
145 | + } | ||
146 | + }) | ||
147 | + .catch(e => { | ||
148 | + uni.$u.toast(e.data?.message); | ||
149 | + }); | ||
150 | + }, | ||
151 | + openCamera() { | ||
152 | + uni.navigateTo({ | ||
153 | + url: 'camera/camera' | ||
154 | + }); | ||
155 | + }, | ||
156 | + openOrgStatus() { | ||
157 | + uni.navigateTo({ | ||
158 | + url: 'orgStatus/orgStatus' | ||
159 | + }); | ||
160 | + } | ||
115 | } | 161 | } |
116 | }; | 162 | }; |
117 | </script> | 163 | </script> |
pages/personal/1.vue
deleted
100644 → 0
1 | -<template> | ||
2 | - <view class="u-page"> | ||
3 | - <u-navbar | ||
4 | - title="表单" | ||
5 | - @leftClick="navigateBack" | ||
6 | - safeAreaInsetTop | ||
7 | - fixed | ||
8 | - placeholder | ||
9 | - ></u-navbar> | ||
10 | - <view class="u-demo-block"> | ||
11 | - <text class="u-demo-block__title">基础使用</text> | ||
12 | - <view class="u-demo-block__content"> | ||
13 | - <!-- 注意,如果需要兼容微信小程序,最好通过setRules方法设置rules规则 --> | ||
14 | - <u--form | ||
15 | - labelPosition="left" | ||
16 | - :model="model1" | ||
17 | - ref="form1" | ||
18 | - > | ||
19 | - <u-form-item | ||
20 | - label="姓名" | ||
21 | - prop="userInfo.name" | ||
22 | - borderBottom | ||
23 | - ref="item1" | ||
24 | - > | ||
25 | - <u--input | ||
26 | - v-model="model1.userInfo.name" | ||
27 | - border="none" | ||
28 | - placeholder="姓名,只能为中文" | ||
29 | - ></u--input> | ||
30 | - </u-form-item> | ||
31 | - <u-form-item | ||
32 | - label="性别" | ||
33 | - prop="userInfo.sex" | ||
34 | - borderBottom | ||
35 | - @click="showSex = true; hideKeyboard()" | ||
36 | - ref="item1" | ||
37 | - > | ||
38 | - <u--input | ||
39 | - v-model="model1.userInfo.sex" | ||
40 | - disabled | ||
41 | - disabledColor="#ffffff" | ||
42 | - placeholder="请选择性别" | ||
43 | - border="none" | ||
44 | - ></u--input> | ||
45 | - <u-icon | ||
46 | - slot="right" | ||
47 | - name="arrow-right" | ||
48 | - ></u-icon> | ||
49 | - </u-form-item> | ||
50 | - <u-form-item | ||
51 | - label="水果" | ||
52 | - prop="radiovalue1" | ||
53 | - borderBottom | ||
54 | - ref="item2" | ||
55 | - > | ||
56 | - <u-radio-group v-model="model1.radiovalue1"> | ||
57 | - <u-radio | ||
58 | - :customStyle="{marginRight: '16px'}" | ||
59 | - v-for="(item, index) in radiolist1" | ||
60 | - :key="index" | ||
61 | - :label="item.name" | ||
62 | - :name="item.name" | ||
63 | - > | ||
64 | - </u-radio> | ||
65 | - </u-radio-group> | ||
66 | - </u-form-item> | ||
67 | - <u-form-item | ||
68 | - label="兴趣爱好" | ||
69 | - prop="checkboxValue1" | ||
70 | - borderBottom | ||
71 | - labelWidth="80" | ||
72 | - ref="item3" | ||
73 | - > | ||
74 | - <u-checkbox-group | ||
75 | - v-model="model1.checkboxValue1" | ||
76 | - shape="square" | ||
77 | - @change="change" | ||
78 | - > | ||
79 | - <u-checkbox | ||
80 | - :customStyle="{marginRight: '16px'}" | ||
81 | - v-for="(item, index) in checkboxList1" | ||
82 | - :key="index" | ||
83 | - :label="item.name" | ||
84 | - :name="item.name" | ||
85 | - > | ||
86 | - </u-checkbox> | ||
87 | - </u-checkbox-group> | ||
88 | - </u-form-item> | ||
89 | - <u-form-item | ||
90 | - label="简介" | ||
91 | - prop="intro" | ||
92 | - borderBottom | ||
93 | - ref="item3" | ||
94 | - > | ||
95 | - <u--textarea | ||
96 | - placeholder="不低于3个字" | ||
97 | - v-model="model1.intro" | ||
98 | - count | ||
99 | - ></u--textarea> | ||
100 | - </u-form-item> | ||
101 | - <u-form-item | ||
102 | - label="住店时间" | ||
103 | - prop="hotel" | ||
104 | - labelWidth="80" | ||
105 | - borderBottom | ||
106 | - @click="showCalendar = true; hideKeyboard()" | ||
107 | - > | ||
108 | - <u--input | ||
109 | - v-model="model1.hotel" | ||
110 | - disabled | ||
111 | - disabledColor="#ffffff" | ||
112 | - placeholder="请选择住店和离店时间" | ||
113 | - border="none" | ||
114 | - ></u--input> | ||
115 | - <u-icon | ||
116 | - slot="right" | ||
117 | - name="arrow-right" | ||
118 | - ></u-icon> | ||
119 | - </u-form-item> | ||
120 | - <u-form-item | ||
121 | - label="验证码" | ||
122 | - prop="code" | ||
123 | - labelWidth="80" | ||
124 | - borderBottom | ||
125 | - > | ||
126 | - <u--input | ||
127 | - v-model="model1.code" | ||
128 | - border="none" | ||
129 | - placeholder="请填写验证码" | ||
130 | - ></u--input> | ||
131 | - <u-button | ||
132 | - slot="right" | ||
133 | - @tap="getCode" | ||
134 | - :text="tips" | ||
135 | - type="success" | ||
136 | - size="mini" | ||
137 | - :disabled="disabled1" | ||
138 | - ></u-button> | ||
139 | - </u-form-item> | ||
140 | - <u-form-item | ||
141 | - label="生日" | ||
142 | - prop="userInfo.birthday" | ||
143 | - borderBottom | ||
144 | - @click="showBirthday = true; hideKeyboard()" | ||
145 | - ref="item1" | ||
146 | - > | ||
147 | - <u--input | ||
148 | - v-model="model1.userInfo.birthday" | ||
149 | - disabled | ||
150 | - disabledColor="#ffffff" | ||
151 | - placeholder="请选择生日" | ||
152 | - border="none" | ||
153 | - ></u--input> | ||
154 | - <u-icon | ||
155 | - slot="right" | ||
156 | - name="arrow-right" | ||
157 | - ></u-icon> | ||
158 | - </u-form-item> | ||
159 | - </u--form> | ||
160 | - <u-button | ||
161 | - type="primary" | ||
162 | - text="提交" | ||
163 | - customStyle="margin-top: 50px" | ||
164 | - @click="submit" | ||
165 | - ></u-button> | ||
166 | - <u-button | ||
167 | - type="error" | ||
168 | - text="重置" | ||
169 | - customStyle="margin-top: 10px" | ||
170 | - @click="reset" | ||
171 | - ></u-button> | ||
172 | - <u-action-sheet | ||
173 | - :show="showSex" | ||
174 | - :actions="actions" | ||
175 | - title="请选择性别" | ||
176 | - description="如果选择保密会报错" | ||
177 | - @close="showSex = false" | ||
178 | - @select="sexSelect" | ||
179 | - > | ||
180 | - </u-action-sheet> | ||
181 | - <u-calendar | ||
182 | - :show="showCalendar" | ||
183 | - mode="range" | ||
184 | - @confirm="calendarConfirm" | ||
185 | - @close="calendarClose" | ||
186 | - startText="住店" | ||
187 | - endText="离店" | ||
188 | - confirmDisabledText="请选择离店日期" | ||
189 | - :formatter="formatter" | ||
190 | - ></u-calendar> | ||
191 | - <u-code | ||
192 | - ref="uCode" | ||
193 | - @change="codeChange" | ||
194 | - seconds="20" | ||
195 | - @start="disabled1 = true" | ||
196 | - @end="disabled1 = false" | ||
197 | - ></u-code> | ||
198 | - <u-datetime-picker | ||
199 | - :show="showBirthday" | ||
200 | - :value="birthday" | ||
201 | - mode="date" | ||
202 | - closeOnClickOverlay | ||
203 | - @confirm="birthdayConfirm" | ||
204 | - @cancel="birthdayClose" | ||
205 | - @close="birthdayClose" | ||
206 | - ></u-datetime-picker> | ||
207 | - </view> | ||
208 | - </view> | ||
209 | - </view> | ||
210 | -</template> | ||
211 | - | ||
212 | -<script> | ||
213 | - export default { | ||
214 | - data() { | ||
215 | - return { | ||
216 | - fileList1: [], | ||
217 | - disabled1: false, | ||
218 | - tips: '', | ||
219 | - value: '', | ||
220 | - showCalendar: false, | ||
221 | - showBirthday: false, | ||
222 | - model1: { | ||
223 | - userInfo: { | ||
224 | - name: '楼兰', | ||
225 | - sex: '', | ||
226 | - birthday: '' | ||
227 | - }, | ||
228 | - radiovalue1: '苹果', | ||
229 | - checkboxValue1: [], | ||
230 | - intro: '', | ||
231 | - code: '' | ||
232 | - }, | ||
233 | - showSex: false, | ||
234 | - birthday: Number(new Date()), | ||
235 | - actions: [{ | ||
236 | - name: '男', | ||
237 | - }, | ||
238 | - { | ||
239 | - name: '女', | ||
240 | - }, | ||
241 | - { | ||
242 | - name: '保密', | ||
243 | - }, | ||
244 | - ], | ||
245 | - rules: { | ||
246 | - 'userInfo.name': [{ | ||
247 | - type: 'string', | ||
248 | - required: true, | ||
249 | - message: '请填写姓名', | ||
250 | - trigger: ['blur', 'change'] | ||
251 | - }, { | ||
252 | - // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明 | ||
253 | - validator: (rule, value, callback) => { | ||
254 | - // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html | ||
255 | - return uni.$u.test.chinese(value); | ||
256 | - }, | ||
257 | - message: "姓名必须为中文", | ||
258 | - // 触发器可以同时用blur和change,二者之间用英文逗号隔开 | ||
259 | - trigger: ["change", "blur"], | ||
260 | - }], | ||
261 | - code: { | ||
262 | - type: 'string', | ||
263 | - required: true, | ||
264 | - len: 4, | ||
265 | - message: '请填写4位验证码', | ||
266 | - trigger: ['blur'] | ||
267 | - }, | ||
268 | - 'userInfo.sex': { | ||
269 | - type: 'string', | ||
270 | - max: 1, | ||
271 | - required: true, | ||
272 | - message: '请选择男或女', | ||
273 | - trigger: ['blur', 'change'] | ||
274 | - }, | ||
275 | - radiovalue1: { | ||
276 | - type: 'string', | ||
277 | - min: 1, | ||
278 | - max: 2, | ||
279 | - message: '橙子有毒', | ||
280 | - trigger: ['change'] | ||
281 | - }, | ||
282 | - checkboxValue1: { | ||
283 | - type: 'array', | ||
284 | - min: 2, | ||
285 | - required: true, | ||
286 | - message: '不能太宅,至少选两项', | ||
287 | - trigger: ['change'] | ||
288 | - }, | ||
289 | - intro: { | ||
290 | - type: 'string', | ||
291 | - min: 3, | ||
292 | - required: true, | ||
293 | - message: '不低于3个字', | ||
294 | - trigger: ['change'] | ||
295 | - }, | ||
296 | - hotel: { | ||
297 | - type: 'string', | ||
298 | - min: 2, | ||
299 | - required: true, | ||
300 | - message: '请选择住店时间', | ||
301 | - trigger: ['change'] | ||
302 | - }, | ||
303 | - 'userInfo.birthday': { | ||
304 | - type: 'string', | ||
305 | - required: true, | ||
306 | - message: '请选择生日', | ||
307 | - trigger: ['change'] | ||
308 | - }, | ||
309 | - }, | ||
310 | - radiolist1: [{ | ||
311 | - name: '苹果', | ||
312 | - disabled: false | ||
313 | - }, | ||
314 | - { | ||
315 | - name: '香蕉', | ||
316 | - disabled: false | ||
317 | - }, | ||
318 | - { | ||
319 | - name: '毒橙子', | ||
320 | - disabled: false | ||
321 | - } | ||
322 | - ], | ||
323 | - checkboxList1: [{ | ||
324 | - name: '羽毛球', | ||
325 | - disabled: false | ||
326 | - }, | ||
327 | - { | ||
328 | - name: '跑步', | ||
329 | - disabled: false | ||
330 | - }, | ||
331 | - { | ||
332 | - name: '爬山', | ||
333 | - disabled: false | ||
334 | - } | ||
335 | - ] | ||
336 | - } | ||
337 | - }, | ||
338 | - onReady() { | ||
339 | - // 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则 | ||
340 | - this.$refs.form1.setRules(this.rules) | ||
341 | - }, | ||
342 | - methods: { | ||
343 | - afterRead(event) { | ||
344 | - this.fileList1.push({ | ||
345 | - url: event.file, | ||
346 | - status: 'uploading', | ||
347 | - message: '上传中' | ||
348 | - }) | ||
349 | - }, | ||
350 | - groupChange(n) { | ||
351 | - // console.log('groupChange', n); | ||
352 | - }, | ||
353 | - radioChange(n) { | ||
354 | - // console.log('radioChange', n); | ||
355 | - }, | ||
356 | - navigateBack() { | ||
357 | - uni.navigateBack() | ||
358 | - }, | ||
359 | - sexSelect(e) { | ||
360 | - this.model1.userInfo.sex = e.name | ||
361 | - this.$refs.form1.validateField('userInfo.sex') | ||
362 | - }, | ||
363 | - change(e) { | ||
364 | - // console.log(e); | ||
365 | - }, | ||
366 | - formatter(day) { | ||
367 | - const d = new Date() | ||
368 | - let month = d.getMonth() + 1 | ||
369 | - const date = d.getDate() | ||
370 | - if (day.month == month && day.day == date + 3) { | ||
371 | - day.bottomInfo = '有优惠' | ||
372 | - day.dot = true | ||
373 | - } | ||
374 | - return day | ||
375 | - }, | ||
376 | - calendarConfirm(e) { | ||
377 | - this.showCalendar = false | ||
378 | - this.model1.hotel = `${e[0]} / ${e[e.length - 1]}` | ||
379 | - this.$refs.form1.validateField('hotel') | ||
380 | - }, | ||
381 | - codeChange(text) { | ||
382 | - this.tips = text; | ||
383 | - }, | ||
384 | - getCode() { | ||
385 | - if (this.$refs.uCode.canGetCode) { | ||
386 | - // 模拟向后端请求验证码 | ||
387 | - uni.showLoading({ | ||
388 | - title: '正在获取验证码' | ||
389 | - }) | ||
390 | - setTimeout(() => { | ||
391 | - uni.hideLoading(); | ||
392 | - // 这里此提示会被this.start()方法中的提示覆盖 | ||
393 | - uni.$u.toast('验证码已发送'); | ||
394 | - // 通知验证码组件内部开始倒计时 | ||
395 | - this.$refs.uCode.start(); | ||
396 | - }, 2000); | ||
397 | - } else { | ||
398 | - uni.$u.toast('倒计时结束后再发送'); | ||
399 | - } | ||
400 | - }, | ||
401 | - calendarClose() { | ||
402 | - this.showCalendar = false | ||
403 | - this.$refs.form1.validateField('hotel') | ||
404 | - }, | ||
405 | - birthdayClose() { | ||
406 | - this.showBirthday = false | ||
407 | - this.$refs.form1.validateField('userInfo.birthday') | ||
408 | - }, | ||
409 | - birthdayConfirm(e) { | ||
410 | - this.showBirthday = false | ||
411 | - this.model1.userInfo.birthday = uni.$u.timeFormat(e.value, 'yyyy-mm-dd') | ||
412 | - this.$refs.form1.validateField('userInfo.birthday') | ||
413 | - }, | ||
414 | - submit() { | ||
415 | - // 如果有错误,会在catch中返回报错信息数组,校验通过则在then中返回true | ||
416 | - this.$refs.form1.validate().then(res => { | ||
417 | - uni.$u.toast('校验通过') | ||
418 | - }).catch(errors => { | ||
419 | - uni.$u.toast('校验失败') | ||
420 | - }) | ||
421 | - }, | ||
422 | - reset() { | ||
423 | - const validateList = ['userInfo.name', 'userInfo.sex', 'radiovalue1', 'checkboxValue1', 'intro', | ||
424 | - 'hotel', 'code', 'userInfo.birthday'] | ||
425 | - this.$refs.form1.resetFields() | ||
426 | - this.$refs.form1.clearValidate() | ||
427 | - setTimeout(()=>{ | ||
428 | - this.$refs.form1.clearValidate(validateList) | ||
429 | - // 或者使用 this.$refs.form1.clearValidate() | ||
430 | - },10) | ||
431 | - }, | ||
432 | - hideKeyboard() { | ||
433 | - uni.hideKeyboard() | ||
434 | - } | ||
435 | - }, | ||
436 | - } | ||
437 | -</script> | ||
438 | - | ||
439 | -<style lang="scss"> | ||
440 | - | ||
441 | -</style> |
@@ -20,13 +20,12 @@ | @@ -20,13 +20,12 @@ | ||
20 | class="input" | 20 | class="input" |
21 | prefixIcon="lock-fill" | 21 | prefixIcon="lock-fill" |
22 | suffixIconStyle="color: #909399" | 22 | suffixIconStyle="color: #909399" |
23 | - :type="showPasswordOrText" | 23 | + :type="passwordText" |
24 | placeholder="请输入密码" | 24 | placeholder="请输入密码" |
25 | v-model="loginForm.password" | 25 | v-model="loginForm.password" |
26 | - @change="passwordChange" | ||
27 | > | 26 | > |
28 | <template slot="suffix"> | 27 | <template slot="suffix"> |
29 | - <u-icon @click="showPasswordMode" :name="showPasswordIcon"></u-icon> | 28 | + <u-icon @click="showPasswordMode" :name="showPassword ? showTextIcon : showPasswordIcon"></u-icon> |
30 | </template> | 29 | </template> |
31 | </u-input> | 30 | </u-input> |
32 | </view> | 31 | </view> |
@@ -35,7 +34,8 @@ | @@ -35,7 +34,8 @@ | ||
35 | <view style="color: #999999;font-size: 13px;" @click="openCodeFunc">手机验证码登录</view> | 34 | <view style="color: #999999;font-size: 13px;" @click="openCodeFunc">手机验证码登录</view> |
36 | <view style="color: #999999;font-size: 13px;position: relative;" @click="findPassrordFunc">忘记密码</view> | 35 | <view style="color: #999999;font-size: 13px;position: relative;" @click="findPassrordFunc">忘记密码</view> |
37 | </view> | 36 | </view> |
38 | - <view class="u-flex" style="justify-content: center;flex-direction: column;margin-top: 220rpx;"> | 37 | + <!-- <button class="button marginT" @click="onAuthorization" :style="{background:PrimaryColor}">微信授权登录</button> --> |
38 | + <view @click="onAuthorization" class="u-flex" style="justify-content: center;flex-direction: column;margin-top: 220rpx;"> | ||
39 | <view style="color:#999999;font-size: 13px;">第三方账号登录</view> | 39 | <view style="color:#999999;font-size: 13px;">第三方账号登录</view> |
40 | <view style="height:20rpx"></view> | 40 | <view style="height:20rpx"></view> |
41 | <view><image style="width: 75rpx;height: 75rpx;" src="../../static/weixin.png" mode="aspectFill"></image></view> | 41 | <view><image style="width: 75rpx;height: 75rpx;" src="../../static/weixin.png" mode="aspectFill"></image></view> |
@@ -47,22 +47,54 @@ | @@ -47,22 +47,54 @@ | ||
47 | </template> | 47 | </template> |
48 | 48 | ||
49 | <script> | 49 | <script> |
50 | -import { mapState, mapMutations } from 'vuex'; | 50 | +import { mapMutations } from 'vuex'; |
51 | +import { getUserInfo } from '@/components/module/f-login/f-login.js'; | ||
51 | 52 | ||
52 | export default { | 53 | export default { |
53 | data() { | 54 | data() { |
54 | return { | 55 | return { |
55 | showPasswordIcon: 'eye-off', | 56 | showPasswordIcon: 'eye-off', |
56 | - showPasswordOrText: 'password', | 57 | + showTextIcon: 'eye-fill', |
57 | loginForm: { | 58 | loginForm: { |
58 | username: '', | 59 | username: '', |
59 | password: '' | 60 | password: '' |
60 | - } | 61 | + }, |
62 | + showPassword: false, | ||
63 | + passwordText: 'password' | ||
61 | }; | 64 | }; |
62 | }, | 65 | }, |
63 | methods: { | 66 | methods: { |
64 | ...mapMutations(['setUserInfo']), | 67 | ...mapMutations(['setUserInfo']), |
65 | - passwordChange() {}, | 68 | + onAuthorization(e) { |
69 | + getUserInfo( | ||
70 | + info => { | ||
71 | + console.log(info, '授权信息'); | ||
72 | + let httpData = { | ||
73 | + code: this.code, | ||
74 | + nickName: info.nickName || '', //昵称 | ||
75 | + avatarUrl: info.avatarUrl || '', //头像 | ||
76 | + gender: info.gender || '' //性别 0:未知 1:男 2:女 | ||
77 | + }; | ||
78 | + // uni.$u.http.post('您的接口', httpData).then(res => { | ||
79 | + let userInfo = { | ||
80 | + // ...res, | ||
81 | + token: true //token用于判断是否登录 | ||
82 | + }; | ||
83 | + // this.setUserInfo(userInfo) | ||
84 | + // setTimeout(()=>{ | ||
85 | + // uni.showToast({ | ||
86 | + // title: '登录成功', | ||
87 | + // icon: 'none' | ||
88 | + // }); | ||
89 | + // this.closeLogin(); | ||
90 | + // },100) | ||
91 | + // }) | ||
92 | + }, | ||
93 | + err => { | ||
94 | + // this.closeLogin(); | ||
95 | + } | ||
96 | + ); | ||
97 | + }, | ||
66 | onSubmitFunc() { | 98 | onSubmitFunc() { |
67 | if (this.loginForm.username == '' || this.loginForm.password == '') { | 99 | if (this.loginForm.username == '' || this.loginForm.password == '') { |
68 | return uni.$u.toast('请输入用户名或密码'); | 100 | return uni.$u.toast('请输入用户名或密码'); |
@@ -92,7 +124,14 @@ export default { | @@ -92,7 +124,14 @@ export default { | ||
92 | uni.navigateBack({ | 124 | uni.navigateBack({ |
93 | delta: 1 | 125 | delta: 1 |
94 | }); | 126 | }); |
95 | - }, 1000); | 127 | + }, 500); |
128 | + //#ifndef MP | ||
129 | + setTimeout(() => { | ||
130 | + uni.navigateTo({ | ||
131 | + url: 'personal' | ||
132 | + }); | ||
133 | + }, 500); | ||
134 | + //#endif | ||
96 | } | 135 | } |
97 | }) | 136 | }) |
98 | .catch(e => { | 137 | .catch(e => { |
@@ -118,12 +157,11 @@ export default { | @@ -118,12 +157,11 @@ export default { | ||
118 | }); | 157 | }); |
119 | }, | 158 | }, |
120 | showPasswordMode() { | 159 | showPasswordMode() { |
121 | - if (this.loginForm.password.length !== 0) { | ||
122 | - this.showPasswordOrText = 'text'; | ||
123 | - this.showPasswordIcon = 'eye-fill'; | 160 | + this.showPassword = !this.showPassword; |
161 | + if (!this.showPassword) { | ||
162 | + this.passwordText = 'password'; | ||
124 | } else { | 163 | } else { |
125 | - this.showPasswordOrText = 'password'; | ||
126 | - this.showPasswordIcon = 'eye-off'; | 164 | + this.passwordText = 'text'; |
127 | } | 165 | } |
128 | } | 166 | } |
129 | } | 167 | } |
@@ -6,9 +6,9 @@ | @@ -6,9 +6,9 @@ | ||
6 | <!-- #ifdef MP --> | 6 | <!-- #ifdef MP --> |
7 | <!-- 登录 --> | 7 | <!-- 登录 --> |
8 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> | 8 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> |
9 | - <block v-if="userInfo.token"> | ||
10 | - <view class="u-m-r-20"><image class="avatar" mode="aspectFill" :src="userInfo.avatar || '/static/logo.png'"></image></view> | ||
11 | - <view class="u-flex-1" @click="onJump('/pages/personal/set')"> | 9 | + <block v-if="userInfo.isToken"> |
10 | + <view @click="openPersonalInfo" class="u-m-r-20"><image class="avatar" mode="aspectFill" :src="userInfo.avatar || '/static/logo.png'"></image></view> | ||
11 | + <view @click="openPersonalInfo" class="u-flex-1"> | ||
12 | <view class="nickName u-flex"> | 12 | <view class="nickName u-flex"> |
13 | <view class="name u-m-r-10" v-if="userInfo.realName">{{ userInfo.realName }}</view> | 13 | <view class="name u-m-r-10" v-if="userInfo.realName">{{ userInfo.realName }}</view> |
14 | </view> | 14 | </view> |
@@ -31,15 +31,15 @@ | @@ -31,15 +31,15 @@ | ||
31 | </view> | 31 | </view> |
32 | </view> | 32 | </view> |
33 | </block> | 33 | </block> |
34 | - <view><u-icon @click="openPersonalInfo" name="arrow-right" color="black" size="13"></u-icon></view> | 34 | + <view><u-icon name="arrow-right" color="black" size="13"></u-icon></view> |
35 | </view> | 35 | </view> |
36 | <!-- #endif --> | 36 | <!-- #endif --> |
37 | <!-- #ifndef MP --> | 37 | <!-- #ifndef MP --> |
38 | <!-- 登录 --> | 38 | <!-- 登录 --> |
39 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> | 39 | <view class="u-flex u-p-l-30 u-p-r-20 u-p-t-75 u-p-b-30"> |
40 | <block v-if="userInfo.isToken"> | 40 | <block v-if="userInfo.isToken"> |
41 | - <view class="u-m-r-20"><image class="avatar" mode="aspectFill" :src="userInfo.avatar"></image></view> | ||
42 | - <view class="u-flex-1" @click="onJump('/pages/user/set')"> | 41 | + <view @click="openPersonalInfo" class="u-m-r-20"><image class="avatar" mode="aspectFill" :src="userInfo.avatar"></image></view> |
42 | + <view @click="openPersonalInfo" class="u-flex-1"> | ||
43 | <view class="nickName">{{ userInfo.realName }}</view> | 43 | <view class="nickName">{{ userInfo.realName }}</view> |
44 | <view class="detail" v-if="userInfo.phoneNum">手机号:{{ userInfo.phoneNum | phone }}</view> | 44 | <view class="detail" v-if="userInfo.phoneNum">手机号:{{ userInfo.phoneNum | phone }}</view> |
45 | <view class="detail" v-else>手机号:未绑定</view> | 45 | <view class="detail" v-else>手机号:未绑定</view> |
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | <view @click="clickAccountFunc" style="color:black;" class="detail">绑定账号</view> | 54 | <view @click="clickAccountFunc" style="color:black;" class="detail">绑定账号</view> |
55 | </view> | 55 | </view> |
56 | </block> | 56 | </block> |
57 | - <view><u-icon @click="openPersonalInfo" name="arrow-right" color="black" size="13"></u-icon></view> | 57 | + <view><u-icon name="arrow-right" color="black" size="13"></u-icon></view> |
58 | </view> | 58 | </view> |
59 | <!-- #endif --> | 59 | <!-- #endif --> |
60 | </view> | 60 | </view> |
@@ -63,14 +63,18 @@ | @@ -63,14 +63,18 @@ | ||
63 | style="overflow-x: hidden;position: relative;top:-25rpx;z-index:54;background: #FFFFFF;;border-radius: 17px 17px 0px 0px;;height: 835rpx;width: 750rpx;flex-direction: column;justify-content: space-between;" | 63 | style="overflow-x: hidden;position: relative;top:-25rpx;z-index:54;background: #FFFFFF;;border-radius: 17px 17px 0px 0px;;height: 835rpx;width: 750rpx;flex-direction: column;justify-content: space-between;" |
64 | > | 64 | > |
65 | <view style="margin-top: 100rpx;"> | 65 | <view style="margin-top: 100rpx;"> |
66 | - <view @click="openSysNotify" class="u-flex" style="flex-direction: row;justify-content: space-between;align-content: space-between;"> | 66 | + <view @click="onTokenJump('../systemNotify/systemNotify')" class="u-flex" style="flex-direction: row;justify-content: space-between;align-content: space-between;"> |
67 | <view style="width: 125rpx;"><image style="width:35rpx;height: 35rpx;" src="../../static/sys-not.png" mode=""></image></view> | 67 | <view style="width: 125rpx;"><image style="width:35rpx;height: 35rpx;" src="../../static/sys-not.png" mode=""></image></view> |
68 | <view style="position: relative;left: -58rpx;width: 420rpx;"><text style="color: #333333;font-size: 15px;">系统通知</text></view> | 68 | <view style="position: relative;left: -58rpx;width: 420rpx;"><text style="color: #333333;font-size: 15px;">系统通知</text></view> |
69 | <view style="position: relative;right: -112rpx;width: 100rpx;"> | 69 | <view style="position: relative;right: -112rpx;width: 100rpx;"> |
70 | <image style="width: 13rpx;height: 17rpx;" src="../../static/arrow-right.png" mode=""></image> | 70 | <image style="width: 13rpx;height: 17rpx;" src="../../static/arrow-right.png" mode=""></image> |
71 | </view> | 71 | </view> |
72 | </view> | 72 | </view> |
73 | - <view @click="openFeedBack" class="u-flex" style="margin-top: 60rpx;flex-direction: row;justify-content: space-between;align-content: space-between;"> | 73 | + <view |
74 | + @click="onTokenJump('../feedback/feedback')" | ||
75 | + class="u-flex" | ||
76 | + style="margin-top: 60rpx;flex-direction: row;justify-content: space-between;align-content: space-between;" | ||
77 | + > | ||
74 | <view style="width: 125rpx;"><image style="width:35rpx;height: 35rpx;" src="../../static/find-sugg.png" mode=""></image></view> | 78 | <view style="width: 125rpx;"><image style="width:35rpx;height: 35rpx;" src="../../static/find-sugg.png" mode=""></image></view> |
75 | <view style="position: relative;left: -58rpx;width: 420rpx;"><text style="color: #333333;font-size: 15px;">意见反馈</text></view> | 79 | <view style="position: relative;left: -58rpx;width: 420rpx;"><text style="color: #333333;font-size: 15px;">意见反馈</text></view> |
76 | <view style="position: relative;right: -112rpx;width: 100rpx;"> | 80 | <view style="position: relative;right: -112rpx;width: 100rpx;"> |
@@ -86,7 +90,7 @@ | @@ -86,7 +90,7 @@ | ||
86 | <u-modal :showConfirmButton="false" :show="show" :title="title"> | 90 | <u-modal :showConfirmButton="false" :show="show" :title="title"> |
87 | <view v-if="!bindPhone" class="loginPhone"> | 91 | <view v-if="!bindPhone" class="loginPhone"> |
88 | <view class="form-row" style="background:#F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;"> | 92 | <view class="form-row" style="background:#F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;"> |
89 | - <u--input shape="circle" class="input" prefixIcon="account-fill" type="text" placeholder="登录账号" v-model="account"></u--input> | 93 | + <u--input shape="circle" class="input" prefixIcon="account-fill" type="text" placeholder="登录账号" v-model="account"></u--input> |
90 | </view> | 94 | </view> |
91 | <view class="form-row" style="margin-top: 20rpx;background: #F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;"> | 95 | <view class="form-row" style="margin-top: 20rpx;background: #F7F9FF;border-radius: 48px;width: 532rpx;height: 80rpx;"> |
92 | <u--input | 96 | <u--input |
@@ -207,16 +211,24 @@ export default { | @@ -207,16 +211,24 @@ export default { | ||
207 | }, | 211 | }, |
208 | methods: { | 212 | methods: { |
209 | ...mapMutations(['emptyUserInfo']), | 213 | ...mapMutations(['emptyUserInfo']), |
210 | - openSysNotify() { | ||
211 | - uni.navigateTo({ | ||
212 | - url: '../systemNotify/systemNotify' | ||
213 | - }); | ||
214 | - }, | ||
215 | - openFeedBack() { | ||
216 | - uni.navigateTo({ | ||
217 | - url: '../feedback/feedback' | 214 | + // 跳转前判断登录 |
215 | + onTokenJump(url) { | ||
216 | + this.judgeLogin(() => { | ||
217 | + uni.navigateTo({ | ||
218 | + url: url | ||
219 | + }); | ||
218 | }); | 220 | }); |
219 | }, | 221 | }, |
222 | + // openSysNotify() { | ||
223 | + // uni.navigateTo({ | ||
224 | + // url: '../systemNotify/systemNotify' | ||
225 | + // }); | ||
226 | + // }, | ||
227 | + // openFeedBack() { | ||
228 | + // uni.navigateTo({ | ||
229 | + // url: '../feedback/feedback' | ||
230 | + // }); | ||
231 | + // }, | ||
220 | onJump(url) { | 232 | onJump(url) { |
221 | uni.navigateTo({ | 233 | uni.navigateTo({ |
222 | url: url | 234 | url: url |
pages/personal/test.vue
deleted
100644 → 0
1 | -<template> | ||
2 | - <view class="u-page"> | ||
3 | - <view class="u-demo-block"> | ||
4 | - <text class="u-demo-block__title">基础使用</text> | ||
5 | - <view class="u-demo-block__content"> | ||
6 | - <u--input | ||
7 | - placeholder="请输入内容" | ||
8 | - border="surround" | ||
9 | - v-model="value" | ||
10 | - @change="change" | ||
11 | - ></u--input> | ||
12 | - </view> | ||
13 | - </view> | ||
14 | - <view class="u-demo-block"> | ||
15 | - <text class="u-demo-block__title">可清空内容</text> | ||
16 | - <view class="u-demo-block__content"> | ||
17 | - <u--input | ||
18 | - placeholder="请输入内容" | ||
19 | - border="surround" | ||
20 | - clearable | ||
21 | - ></u--input> | ||
22 | - </view> | ||
23 | - </view> | ||
24 | - <view class="u-demo-block"> | ||
25 | - <text class="u-demo-block__title">数字键盘</text> | ||
26 | - <view class="u-demo-block__content"> | ||
27 | - <u--input | ||
28 | - placeholder="请输入内容" | ||
29 | - border="surround" | ||
30 | - type="number" | ||
31 | - clearable | ||
32 | - ></u--input> | ||
33 | - </view> | ||
34 | - </view> | ||
35 | - <view class="u-demo-block"> | ||
36 | - <text class="u-demo-block__title">密码类型</text> | ||
37 | - <view class="u-demo-block__content"> | ||
38 | - <u--input | ||
39 | - placeholder="请输入内容" | ||
40 | - border="surround" | ||
41 | - password | ||
42 | - clearable | ||
43 | - ></u--input> | ||
44 | - </view> | ||
45 | - </view> | ||
46 | - <view class="u-demo-block"> | ||
47 | - <text class="u-demo-block__title">显示下划线</text> | ||
48 | - <view class="u-demo-block__content"> | ||
49 | - <u--input | ||
50 | - placeholder="请输入内容" | ||
51 | - border="bottom" | ||
52 | - clearable | ||
53 | - ></u--input> | ||
54 | - </view> | ||
55 | - </view> | ||
56 | - <view class="u-demo-block"> | ||
57 | - <text class="u-demo-block__title">禁用状态</text> | ||
58 | - <view class="u-demo-block__content"> | ||
59 | - <u--input | ||
60 | - placeholder="禁用状态" | ||
61 | - border="surround" | ||
62 | - disabled | ||
63 | - ></u--input> | ||
64 | - </view> | ||
65 | - </view> | ||
66 | - <view class="u-demo-block"> | ||
67 | - <text class="u-demo-block__title">圆形</text> | ||
68 | - <view class="u-demo-block__content"> | ||
69 | - <u--input | ||
70 | - placeholder="请输入内容" | ||
71 | - border="surround" | ||
72 | - shape="circle" | ||
73 | - ></u--input> | ||
74 | - </view> | ||
75 | - </view> | ||
76 | - <view class="u-demo-block"> | ||
77 | - <text class="u-demo-block__title">前后图标</text> | ||
78 | - <view class="u-demo-block__content"> | ||
79 | - <u--input | ||
80 | - placeholder="前置图标" | ||
81 | - prefixIcon="search" | ||
82 | - prefixIconStyle="font-size: 22px;color: #909399" | ||
83 | - ></u--input> | ||
84 | - </view> | ||
85 | - <view | ||
86 | - class="u-demo-block__content" | ||
87 | - style="margin-top: 15px;" | ||
88 | - > | ||
89 | - <u--input | ||
90 | - placeholder="后置图标" | ||
91 | - suffixIcon="map-fill" | ||
92 | - suffixIconStyle="color: #909399" | ||
93 | - ></u--input> | ||
94 | - </view> | ||
95 | - </view> | ||
96 | - <view class="u-demo-block"> | ||
97 | - <text class="u-demo-block__title">前后插槽</text> | ||
98 | - <view class="u-demo-block__content"> | ||
99 | - <!-- 注意:由于兼容性差异,如果需要使用前后插槽,nvue下需使用u--input,非nvue下需使用u-input --> | ||
100 | - <!-- #ifndef APP-NVUE --> | ||
101 | - <u-input placeholder="前置插槽"> | ||
102 | - <!-- #endif --> | ||
103 | - <!-- #ifdef APP-NVUE --> | ||
104 | - <u--input placeholder="前置插槽"> | ||
105 | - <!-- #endif --> | ||
106 | - <u--text | ||
107 | - text="http://" | ||
108 | - slot="prefix" | ||
109 | - margin="0 3px 0 0" | ||
110 | - type="tips" | ||
111 | - ></u--text> | ||
112 | - <!-- #ifndef APP-NVUE --> | ||
113 | - </u-input> | ||
114 | - <!-- #endif --> | ||
115 | - <!-- #ifdef APP-NVUE --> | ||
116 | - </u--input> | ||
117 | - <!-- #endif --> | ||
118 | - </view> | ||
119 | - <view | ||
120 | - class="u-demo-block__content" | ||
121 | - style="margin-top: 15px;" | ||
122 | - > | ||
123 | - <!-- 注意:由于兼容性差异,如果需要使用前后插槽,nvue下需使用u--input,非nvue下需使用u-input --> | ||
124 | - <!-- #ifndef APP-NVUE --> | ||
125 | - <u-input placeholder="后置插槽"> | ||
126 | - <!-- #endif --> | ||
127 | - <!-- #ifdef APP-NVUE --> | ||
128 | - <u--input placeholder="后置插槽"> | ||
129 | - <!-- #endif --> | ||
130 | - <template slot="suffix"> | ||
131 | - <u-code | ||
132 | - ref="uCode" | ||
133 | - @change="codeChange" | ||
134 | - seconds="20" | ||
135 | - changeText="X秒重新获取哈哈哈" | ||
136 | - ></u-code> | ||
137 | - <u-button | ||
138 | - @tap="getCode" | ||
139 | - :text="tips" | ||
140 | - type="success" | ||
141 | - size="mini" | ||
142 | - ></u-button> | ||
143 | - </template> | ||
144 | - <!-- #ifndef APP-NVUE --> | ||
145 | - </u-input> | ||
146 | - <!-- #endif --> | ||
147 | - <!-- #ifdef APP-NVUE --> | ||
148 | - </u--input> | ||
149 | - <!-- #endif --> | ||
150 | - </view> | ||
151 | - </view> | ||
152 | - <u-gap | ||
153 | - bgColor="#fff" | ||
154 | - height="50" | ||
155 | - ></u-gap> | ||
156 | - </view> | ||
157 | -</template> | ||
158 | - | ||
159 | -<script> | ||
160 | - export default { | ||
161 | - data() { | ||
162 | - return { | ||
163 | - tips: '', | ||
164 | - value: '' | ||
165 | - } | ||
166 | - }, | ||
167 | - watch: { | ||
168 | - value(newValue, oldValue) { | ||
169 | - // console.log('v-model', newValue); | ||
170 | - } | ||
171 | - }, | ||
172 | - methods: { | ||
173 | - codeChange(text) { | ||
174 | - this.tips = text; | ||
175 | - }, | ||
176 | - getCode() { | ||
177 | - if (this.$refs.uCode.canGetCode) { | ||
178 | - // 模拟向后端请求验证码 | ||
179 | - uni.showLoading({ | ||
180 | - title: '正在获取验证码' | ||
181 | - }) | ||
182 | - setTimeout(() => { | ||
183 | - uni.hideLoading(); | ||
184 | - // 这里此提示会被this.start()方法中的提示覆盖 | ||
185 | - uni.$u.toast('验证码已发送'); | ||
186 | - // 通知验证码组件内部开始倒计时 | ||
187 | - this.$refs.uCode.start(); | ||
188 | - }, 2000); | ||
189 | - } else { | ||
190 | - uni.$u.toast('倒计时结束后再发送'); | ||
191 | - } | ||
192 | - }, | ||
193 | - change(e) { | ||
194 | - console.log('change', e); | ||
195 | - } | ||
196 | - } | ||
197 | - } | ||
198 | -</script> | ||
199 | - | ||
200 | -<style lang="scss"> | ||
201 | - | ||
202 | -</style> |
@@ -92,12 +92,14 @@ export default { | @@ -92,12 +92,14 @@ export default { | ||
92 | onLoad(e) { | 92 | onLoad(e) { |
93 | // 隐藏原生的tabbar | 93 | // 隐藏原生的tabbar |
94 | uni.hideTabBar(); | 94 | uni.hideTabBar(); |
95 | - loadData(1); | ||
96 | }, | 95 | }, |
97 | methods: { | 96 | methods: { |
98 | typeSelect(e) { | 97 | typeSelect(e) { |
99 | this.model1.userInfo.type = e.name; | 98 | this.model1.userInfo.type = e.name; |
100 | this.loadData(1, e.value); | 99 | this.loadData(1, e.value); |
100 | + setTimeout(() => { | ||
101 | + uni.hideKeyboard(); | ||
102 | + }, 10); | ||
101 | }, | 103 | }, |
102 | hideKeyboard() { | 104 | hideKeyboard() { |
103 | uni.hideKeyboard(); | 105 | uni.hideKeyboard(); |
uni_modules/alert-detail.png
deleted
100644 → 0
107 Bytes
@@ -27,7 +27,7 @@ const GlobalOption = { | @@ -27,7 +27,7 @@ const GlobalOption = { | ||
27 | zh: { | 27 | zh: { |
28 | up: { | 28 | up: { |
29 | textLoading: '加载中 ...', // 加载中的提示文本 | 29 | textLoading: '加载中 ...', // 加载中的提示文本 |
30 | - textNoMore: '-- END --', // 没有更多数据的提示文本 | 30 | + textNoMore: '-- 我是有底线的 --', // 没有更多数据的提示文本 |
31 | empty: { | 31 | empty: { |
32 | tip: '~ 暂无相关数据 ~' // 空提示 | 32 | tip: '~ 暂无相关数据 ~' // 空提示 |
33 | } | 33 | } |
@@ -37,7 +37,7 @@ const GlobalOption = { | @@ -37,7 +37,7 @@ const GlobalOption = { | ||
37 | en: { | 37 | en: { |
38 | up: { | 38 | up: { |
39 | textLoading: 'loading ...', | 39 | textLoading: 'loading ...', |
40 | - textNoMore: '-- END --', | 40 | + textNoMore: '-- 我是有底线的 --', |
41 | empty: { | 41 | empty: { |
42 | tip: '~ absolutely empty ~' | 42 | tip: '~ absolutely empty ~' |
43 | } | 43 | } |
@@ -35,7 +35,7 @@ const GlobalOption = { | @@ -35,7 +35,7 @@ const GlobalOption = { | ||
35 | }, | 35 | }, |
36 | up: { | 36 | up: { |
37 | textLoading: '加载中 ...', // 加载中的提示文本 | 37 | textLoading: '加载中 ...', // 加载中的提示文本 |
38 | - textNoMore: '-- END --', // 没有更多数据的提示文本 | 38 | + textNoMore: '-- 我是有底线的 --', // 没有更多数据的提示文本 |
39 | empty: { | 39 | empty: { |
40 | tip: '~ 空空如也 ~' // 空提示 | 40 | tip: '~ 空空如也 ~' // 空提示 |
41 | } | 41 | } |
@@ -35,7 +35,7 @@ const GlobalOption = { | @@ -35,7 +35,7 @@ const GlobalOption = { | ||
35 | }, | 35 | }, |
36 | up: { | 36 | up: { |
37 | textLoading: '加载中 ...', // 加载中的提示文本 | 37 | textLoading: '加载中 ...', // 加载中的提示文本 |
38 | - textNoMore: '-- END --', // 没有更多数据的提示文本 | 38 | + textNoMore: '-- 我是有底线的 --', // 没有更多数据的提示文本 |
39 | empty: { | 39 | empty: { |
40 | tip: '~ 空空如也 ~' // 空提示 | 40 | tip: '~ 空空如也 ~' // 空提示 |
41 | } | 41 | } |
@@ -95,7 +95,7 @@ MeScroll.prototype.extendUpScroll = function(optUp) { | @@ -95,7 +95,7 @@ MeScroll.prototype.extendUpScroll = function(optUp) { | ||
95 | noMoreSize: 5, // 如果列表已无数据,可设置列表的总数量要大于等于5条才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看 | 95 | noMoreSize: 5, // 如果列表已无数据,可设置列表的总数量要大于等于5条才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看 |
96 | offset: 150, // 距底部多远时,触发upCallback,仅mescroll-uni生效 ( mescroll-body配置的是pages.json的 onReachBottomDistance ) | 96 | offset: 150, // 距底部多远时,触发upCallback,仅mescroll-uni生效 ( mescroll-body配置的是pages.json的 onReachBottomDistance ) |
97 | textLoading: '加载中 ...', // 加载中的提示文本 | 97 | textLoading: '加载中 ...', // 加载中的提示文本 |
98 | - textNoMore: '-- END --', // 没有更多数据的提示文本 | 98 | + textNoMore: '-- 我是有底线的 --', // 没有更多数据的提示文本 |
99 | bgColor: "transparent", // 背景颜色 (建议在pages.json中再设置一下backgroundColorBottom) | 99 | bgColor: "transparent", // 背景颜色 (建议在pages.json中再设置一下backgroundColorBottom) |
100 | textColor: "gray", // 文本颜色 (当bgColor配置了颜色,而textColor未配置时,则textColor会默认为白色) | 100 | textColor: "gray", // 文本颜色 (当bgColor配置了颜色,而textColor未配置时,则textColor会默认为白色) |
101 | inited: null, // 初始化完毕的回调 | 101 | inited: null, // 初始化完毕的回调 |