From 05b28a17e72584dfe06559b7cca61774a0e0c172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=B2=E4=B9=88=E4=BA=86?= Date: Wed, 30 Aug 2023 18:52:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=87=E6=8D=A2=E5=88=B0?= =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 7 ----- common/js/config.js | 5 ++- common/js/mqtt.js | 4 ++- common/js/util.js | 39 ++++++++++++++--------- manifest.json | 5 ++- package.json | 1 + pages/device/APF/comp/IO.vue | 26 +++++++-------- pages/device/APF/detail.vue | 54 ++++++++++++++++++++------------ pages/device/edit.vue | 7 ++++- pages/device/new.vue | 7 ++++- pages/message/feedbackDetail.vue | 2 +- pages/project/detail.vue | 5 ++- pages/project/new.vue | 9 ++++-- pages/user/head.vue | 12 +++---- pages/user/login.vue | 2 +- pnpm-lock.yaml | 6 ++++ 16 files changed, 116 insertions(+), 75 deletions(-) diff --git a/App.vue b/App.vue index 12782c1..521672e 100644 --- a/App.vue +++ b/App.vue @@ -27,13 +27,6 @@ export default { uni.setStorageSync(this.$cacheKey.dictData, res.data) }) - // 更新用户头像 - if (userInfo.headSculpture) { - getImageUrl(userInfo.headSculpture).then((res) => { - userInfo.avatar = res.data - uni.setStorageSync(this.$cacheKey.userInfo, userInfo) - }) - } }, onHide: function () { console.log('App Hide') diff --git a/common/js/config.js b/common/js/config.js index 0f3935a..ff0d068 100644 --- a/common/js/config.js +++ b/common/js/config.js @@ -5,7 +5,7 @@ const development = { } const production = { - domain: 'http://192.168.1.13:10215', + domain: 'https://pqmcn.com:8092/api', } const config = debug ? development : production @@ -18,4 +18,7 @@ if (process.env.NODE_ENV === 'development') { } // #endif +config.static = config.domain + '/system-boot/image/toStream?bgImage=' + + export default config diff --git a/common/js/mqtt.js b/common/js/mqtt.js index c4e548f..951f5ea 100644 --- a/common/js/mqtt.js +++ b/common/js/mqtt.js @@ -1,4 +1,6 @@ -export const MQTT_IP = '192.168.1.18:8083/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt +// export const MQTT_IP = '192.168.1.18:8083/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt +export const MQTT_IP = 'pqmcn.com:8085/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt + const MQTT_USERNAME = 't_user'//mqtt用户名 const MQTT_PASSWORD = 'njcnpqs'//密码 diff --git a/common/js/util.js b/common/js/util.js index 3ace6ae..53cb8cd 100644 --- a/common/js/util.js +++ b/common/js/util.js @@ -4,6 +4,8 @@ import {getImageUrl} from '@/common/api/basic' import {apiUpdatePush} from '@/common/api/user' import {queryDictDataCache} from '../api/dictionary.js' import cacheKey from './cacheKey.js' +import config from "@/common/js/config"; +import jsrsasign from 'jsrsasign' const toast = (title, duration = 1500, call, mask = false, icon = 'none') => { if (Boolean(title) === false) { @@ -209,28 +211,24 @@ const loginSuccess = (data, jump = true) => { console.log(data) uni.setStorageSync('access_token', data.token_type + ' ' + data.access_token) uni.setStorageSync('refresh_token', data.refresh_token) - let strings = data.access_token.split('.') //截取token,获取载体 - console.log(escape, atob) - var userInfo = JSON.parse(decodeURIComponent(escape(atob(strings[1].replace(/-/g, '+').replace(/_/g, '/'))))) + let userInfo = decodeToken(data.access_token) + console.log(userInfo) + // let strings = data.access_token.split('.') //截取token,获取载体 + // console.log(escape, atob) + // var userInfo = JSON.parse(decodeURIComponent(escape(atob(strings[1].replace(/-/g, '+').replace(/_/g, '/'))))) userInfo.authorities = userInfo.authorities[0] - uni.setStorageSync(cache.userInfo, userInfo) if (userInfo.headSculpture) { - getImageUrl(userInfo.headSculpture).then((res) => { - userInfo.avatar = res.data - uni.setStorageSync(cache.userInfo, userInfo) - apiUpdatePush() - resolve(userInfo) - }) - } else { - uni.setStorageSync(cache.userInfo, userInfo) - apiUpdatePush() - resolve(userInfo) + userInfo.avatar = config.static + userInfo.headSculpture } - console.log('reLaunch') + console.log(userInfo) + uni.setStorageSync(cache.userInfo, userInfo) + apiUpdatePush() + resolve(userInfo) if (jump) { queryDictDataCache().then((res) => { uni.setStorageSync(cacheKey.dictData, res.data) }) + console.log('reLaunch') uni.reLaunch({ url: '/pages/index/index', fail: (err) => { @@ -258,6 +256,17 @@ const refreshPrePage = (number = 1, time = 1500) => { } } +const decodeToken = (token) => { + let obj = null + if (token !== '') { + const payload = jsrsasign.KJUR.jws.JWS.parse(token) + if (payload.hasOwnProperty('payloadObj')) { + obj = payload.payloadObj + } + } + return obj +} + export default { validatePhoneNumber, toast, diff --git a/manifest.json b/manifest.json index c7648e0..63af642 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "灿能物联", "appid" : "__UNI__88BC25B", "description" : "", - "versionName" : "1.1.8", - "versionCode" : 118, + "versionName" : "1.2.2", + "versionCode" : 122, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { @@ -131,7 +131,6 @@ "proxy" : { "/api" : { "https" : true, - // "target" : "https://china.indpecker.com", "target" : "http://192.168.1.115:10215", "changOrigin" : true, "pathRewrite" : { diff --git a/package.json b/package.json index 672fd08..f4b0e82 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "crypto-js": "^4.1.1", "html2canvas": "^1.4.1", "image-tools": "^1.4.0", + "jsrsasign": "^10.8.6", "mqtt": "3.0.0", "pinyin-pro": "^3.13.2", "qs": "^6.11.2", diff --git a/pages/device/APF/comp/IO.vue b/pages/device/APF/comp/IO.vue index c1f2410..213ff61 100644 --- a/pages/device/APF/comp/IO.vue +++ b/pages/device/APF/comp/IO.vue @@ -13,19 +13,19 @@ 20.0 - - 干接点 - - 干接点1 - 干接点2 - - - 正常 - 正常 - - - - + + + + + + + + + + + + +