diff --git a/common/api/feedback.js b/common/api/feedback.js index efd739c..5a7be9f 100644 --- a/common/api/feedback.js +++ b/common/api/feedback.js @@ -41,7 +41,7 @@ export function queryFeedBackPage(params) { url: '/feedback/queryFeedBackPage', method: 'post', data: { - currentPage: 1, + pageNum: 1, pageSize: 20, status: '', type: '', diff --git a/common/api/project.js b/common/api/project.js index 306b989..88af111 100644 --- a/common/api/project.js +++ b/common/api/project.js @@ -31,7 +31,7 @@ export function queryTopologyDiagramPage(params) { method: 'post', data: Object.assign( { - currentPage: 1, + pageNum: 1, pageSize: 999, projectId: '', searchValue: '', diff --git a/common/api/user.js b/common/api/user.js index 273021a..70bd936 100644 --- a/common/api/user.js +++ b/common/api/user.js @@ -1,70 +1,105 @@ import request from '../js/request' - /** * 发送验证码 * @param {*} params.type 0:登录 1:注册 3:忘记密码 4:更换手机号第二步获取验证码 5:更换手机号第一步获取验证码 - * @returns + * @returns */ -export function apiGetYms (params) { +export function apiGetYms(params) { return request({ - url: '/shiningCloud/user/authCode', + url: '/user-boot/appUser/authCode', data: { phone: params.phone, devCode: uni.getStorageSync('cidAES'), - type: params.type + type: params.type, }, - method: 'POST' + method: 'POST', }) } /** * 登录 * @param {*} params.type 0:ysm 1:pwd - * @returns + * @returns */ -export function apiLogin (params) { - console.log(uni.getStorageSync('cidAES')); +export function apiLogin(params) { + console.log(uni.getStorageSync('cidAES')) return request({ url: '/shiningCloud/user/login', data: { phone: params.phone, devCode: uni.getStorageSync('cidAES'), key: params.key.trim(), - type: params.type + type: params.type, }, - method: 'POST' + method: 'POST', + }) +} + +/** + * 验证码登录 + * @param {*} params.type 0:ysm 1:pwd + * @returns + */ +export function apiYsmLogin(params) { + uni.setStorageSync('token', 'Basic bmpjbmFwcDpuamNucHFz') + return request({ + url: '/pas-auth/oauth/token', + data: { + grant_type: 'sms_code', + phone: params.phone, + smsCode: params.smsCode.trim(), + }, + method: 'POST', }) } /** * 注册 - * @param {*} params - * @returns + * @param {*} params + * @returns */ -export function apiRegister (params) { +export function apiRegister(params) { return request({ - url: '/shiningCloud/user/register', + url: '/user-boot/appUser/register', data: { phone: params.phone, devCode: uni.getStorageSync('cidAES'), code: params.code.trim(), }, - method: 'POST' + method: 'POST', }) } + +/** + * app用户注册完自动登录 + * @param params + * @returns {*} + */ +export function autoLogin(phone) { + return request({ + url: '/user-boot/appUser/autoLogin', + data: { + phone: phone, + devCode: uni.getStorageSync('cidAES'), + }, + method: 'POST', + }) +} + // 第一次登录设置密码 -export function apiSetPsd (params) { +export function apiSetPsd(params) { return request({ url: '/shiningCloud/user/setPsd', data: { userId: uni.getStorageSync('userInfo').userId, devCode: uni.getStorageSync('cidAES'), - password: params.password.trim() + password: params.password.trim(), }, - method: 'POST' + method: 'POST', }) } + // 重置密码 export function apiReSetPsd(params) { return request({ @@ -73,34 +108,35 @@ export function apiReSetPsd(params) { phone: params.phone, code: params.code.trim(), devCode: uni.getStorageSync('cidAES'), - password: params.password.trim() + password: params.password.trim(), }, - method: 'POST' + method: 'POST', }) } // 更换手机号第一步 -export function apiComfirmCode (params) { +export function apiComfirmCode(params) { return request({ url: '/shiningCloud/user/comfirmCode', data: { devCode: uni.getStorageSync('cidAES'), phone: params.phone, - code: params.code.trim() + code: params.code.trim(), }, - method: 'POST' + method: 'POST', }) } + // 重新绑定手机号 -export function apiRebindPhone (params) { +export function apiRebindPhone(params) { return request({ url: '/shiningCloud/user/rebindPhone', data: { devCode: uni.getStorageSync('cidAES'), userId: uni.getStorageSync('userInfo').userId, phoneNew: params.phone, - code: params.code.trim() + code: params.code.trim(), }, - method: 'POST' + method: 'POST', }) -} \ No newline at end of file +} diff --git a/common/js/list.js b/common/js/list.js index 019938a..a8ba012 100644 --- a/common/js/list.js +++ b/common/js/list.js @@ -27,14 +27,14 @@ export default { 'Content-Type': 'application/json;charset=UTF-8', }, params: { - currentPage: 1, + pageNum: 1, pageSize: 20, }, reload() { this.data = []; this.status = 'loading'; this.empty = false; - this.params.currentPage = 1; + this.params.pageNum = 1; this.next(); }, callBack: null, @@ -50,7 +50,7 @@ export default { console.warn(res); let resultData = res.data?.list || res.data?.records || []; - if (this.params.currentPage == 1) { + if (this.params.pageNum == 1) { this.data = resultData; if (resultData.length == 0 || resultData == 0) { this.empty = true; @@ -68,11 +68,11 @@ export default { } } - if (this.params.currentPage == 1) { + if (this.params.pageNum == 1) { this.firstCallBack && this.firstCallBack(); } this.loadedCallback && this.loadedCallback(); - this.params.currentPage++; + this.params.pageNum++; this.total = res.total; this.loading = false; }); diff --git a/common/js/request.js b/common/js/request.js index 8bc3289..2d59c56 100644 --- a/common/js/request.js +++ b/common/js/request.js @@ -1,68 +1,62 @@ -import config from './config'; -let arr = []; +import config from './config' + +let arr = [] export default (options = {}) => { if (options.data == undefined) { - options.data = {}; + options.data = {} } // 防止接口重复点击 if (arr.indexOf(options.url) === -1) { - arr.push(options.url); + arr.push(options.url) } else { return new Promise((resolve, reject) => { reject({ code: -1, msg: '请勿重复提交', - }); - }); + }) + }) } return new Promise((reslove, reject) => { uni.request({ - url: - options.url.indexOf('http') === -1 - ? config.domain + options.url - : options.url, + url: options.url.indexOf('http') === -1 ? config.domain + options.url : options.url, data: { ...options.data, - userId: uni.getStorageSync('userInfo').id, }, header: { // 'Content-Type': 'application/json;charset=UTF-8', - "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", - Authorization: '12', + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', + Authorization: uni.getStorageSync('token'), ...options.header, }, method: options.method || 'GET', success: async (res) => { - console.log(res); + console.log(res) if (arr.indexOf(options.url) > -1) { - arr.splice(arr.indexOf(options.url), 1); + arr.splice(arr.indexOf(options.url), 1) } - if ( - res.data.resultCode !== 10000 && - res.data.code !== 'A0000' - ) { - errHandler(res.data); - reject(res.data); + if (res.data.resultCode !== 10000 && res.data.code !== 'A0000') { + errHandler(res.data) + reject(res.data) } else { - reslove(res.data); + reslove(res.data) } }, fail: (err) => { if (arr.indexOf(options.url) > -1) { - arr.splice(arr.indexOf(options.url), 1); + arr.splice(arr.indexOf(options.url), 1) } - reject(err); + reject(err) uni.showToast({ icon: 'none', title: '网络异常,请稍后再试', - }); + }) uni.reLaunch({ url: '/pages/user/login', - }); + }) }, - }); - }); -}; + }) + }) +} /** * 错误处理 @@ -72,17 +66,17 @@ function errHandler(res) { switch (res.resultCode) { case '401': // #ifdef MP - uni.removeStorageSync('Cookie'); - uni.clearStorageSync(); + uni.removeStorageSync('Cookie') + uni.clearStorageSync() // #endif - uni.reLaunch({ url: '/pages/user/login' }); - break; + uni.reLaunch({ url: '/pages/user/login' }) + break default: uni.showToast({ - title: res.msg || '服务端未知错误', + title: res.message || res.msg || '服务端未知错误', duration: 2000, icon: 'none', - }); - break; + }) + break } } diff --git a/common/js/util.js b/common/js/util.js index 7f39edc..b45d2db 100644 --- a/common/js/util.js +++ b/common/js/util.js @@ -197,6 +197,14 @@ const prePage = () => { return prePage } +const loginSuccess = (data) => { + uni.setStorageSync('userInfo', data) + uni.setStorageSync('token', data.token_type + ' ' + data.access_token) + uni.reLaunch({ + url: '/pages/user/login', + }) +} + export default { validatePhoneNumber, toast, @@ -206,4 +214,5 @@ export default { getUserLocation, loadConfig, prePage, + loginSuccess, } diff --git a/manifest.json b/manifest.json index 1975617..5a4c517 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "灿能物联", "appid" : "__UNI__88BC25B", "description" : "", - "versionName" : "1.0.1", - "versionCode" : "100", + "versionName" : "1.0.2", + "versionCode" : 101, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { @@ -132,7 +132,7 @@ "/api" : { "https" : true, // "target" : "https://china.indpecker.com", - "target" : "http://192.168.1.115:10210", + "target" : "http://192.168.1.115:10215", "changOrigin" : true, "pathRewrite" : { "/api" : "" diff --git a/package.json b/package.json index 2778257..bc8e6a1 100644 --- a/package.json +++ b/package.json @@ -3,5 +3,9 @@ "html2canvas": "^1.4.1", "mqtt": "3.0.0", "pinyin-pro": "^3.13.2" + }, + "devDependencies": { + "@types/html5plus": "^1.0.2", + "@types/uni-app": "^1.4.4" } } diff --git a/pages/device/APF/detail.vue b/pages/device/APF/detail.vue index dfb5df2..398735d 100644 --- a/pages/device/APF/detail.vue +++ b/pages/device/APF/detail.vue @@ -5,7 +5,7 @@ - 负载THDI(%) diff --git a/pages/device/DVR/detail.vue b/pages/device/DVR/detail.vue index 4500898..9eec58a 100644 --- a/pages/device/DVR/detail.vue +++ b/pages/device/DVR/detail.vue @@ -4,7 +4,7 @@ - + @@ -119,6 +121,30 @@ export default { e.tempFiles[0].path ).then((res) => { console.log(res) + if (res.length > 1) { + const result = JSON.parse(res[1].data) + console.log(result) + if (result.code === 'A0000') { + this.topologyDiagramPage.push({ + name: result.name, + extname: 'img', + url: result.filePath, + ...result, + }) + } else { + this.$refs.filePicker.clearFiles(this.topologyDiagramPage.length - 1) + uni.showToast({ + title: result.message, + icon: 'none', + }) + } + } else { + uni.showToast({ + title: '上传失败', + icon: 'none', + }) + this.$refs.filePicker.clearFiles(this.topologyDiagramPage.length - 1) + } }) }, deleteTopologyDiagramPage(e) { diff --git a/pages/project/new.vue b/pages/project/new.vue index 129beda..3e027af 100644 --- a/pages/project/new.vue +++ b/pages/project/new.vue @@ -176,6 +176,7 @@ export default { let data = JSON.parse(JSON.stringify(this.formData)) delete data.files addAppProject(data, arr).then((res) => { + console.warn(res); if (res.length === 1) { this.$util.toast(res[0].message) diff --git a/pages/user/login.vue b/pages/user/login.vue index 3620a8c..09ac1b7 100644 --- a/pages/user/login.vue +++ b/pages/user/login.vue @@ -9,7 +9,7 @@ @@ -39,13 +43,13 @@ @@ -55,9 +59,9 @@ - \ No newline at end of file + diff --git a/pages/user/register.vue b/pages/user/register.vue index 1b35337..7441c5c 100644 --- a/pages/user/register.vue +++ b/pages/user/register.vue @@ -5,21 +5,24 @@ @@ -43,10 +46,11 @@