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 - - - 正常 - 正常 - - - - + + + + + + + + + + + + +