Commit ec2d266866bf4a9969aa41033c7557cc21fb32cd
Merge branch 'fix/visual-board-app-url' into 'main_dev'
fix: 修复打包app时跳转看板详情会出现网址情况 See merge request yunteng/thingskit-app!126
Showing
8 changed files
with
5 additions
and
137 deletions
@@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
74 | const values = deviceIdKeys.reduce((acc, curr) => { | 74 | const values = deviceIdKeys.reduce((acc, curr) => { |
75 | const items = details[curr]?.triggerData | 75 | const items = details[curr]?.triggerData |
76 | if(items?.key && items?.logicValue && items.realValue){ | 76 | if(items?.key && items?.logicValue && items.realValue){ |
77 | - acc.push(`触发属性:${items.key ||'暂无数据'} 触发条件:${findLogin(items)+items.logicValue || '暂无数据'} 触发值:${items?.realValue || '暂无数据'} `) | 77 | + acc.push(`触发属性:${items.key ||'暂无数据'}, 触发条件:${findLogin(items)+items.logicValue || '暂无数据'}, 触发值:${items?.realValue || '暂无数据'} `) |
78 | } | 78 | } |
79 | return acc | 79 | return acc |
80 | }, []) | 80 | }, []) |
pages/index/components/config/help.js
renamed from
pages/index/components/configuration/help.js
pages/index/components/config/weapp.atob.js
renamed from
pages/index/components/configuration/weapp.atob.js
@@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
35 | import api from '@/api/index.js' | 35 | import api from '@/api/index.js' |
36 | import { | 36 | import { |
37 | createScadaPageLink | 37 | createScadaPageLink |
38 | - } from './help'; | 38 | + } from '../config/help.js'; |
39 | 39 | ||
40 | export default { | 40 | export default { |
41 | mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) | 41 | mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) |
@@ -15,8 +15,9 @@ | @@ -15,8 +15,9 @@ | ||
15 | } | 15 | } |
16 | }, | 16 | }, |
17 | async onLoad(e){ | 17 | async onLoad(e){ |
18 | + // 隐藏原生的tabbar | ||
19 | + uni.hideTabBar(); | ||
18 | const url = await this.createShareUrl({id:e.id}) | 20 | const url = await this.createShareUrl({id:e.id}) |
19 | - console.log(url,'url') | ||
20 | this.visualBoardUrl = url | 21 | this.visualBoardUrl = url |
21 | }, | 22 | }, |
22 | methods:{ | 23 | methods:{ |
pages/index/components/visualBoard/help.js
deleted
100644 → 0
1 | -import config from '../../../../config/baseUrl.js' | ||
2 | -import { | ||
3 | - atob, | ||
4 | - btoa | ||
5 | -} from './weapp.atob.js' | ||
6 | -const getRandomString = () => Number(Math.random().toString().substring(2)).toString(36); | ||
7 | - | ||
8 | -export const ScadaModeEnum = { | ||
9 | - PRIVATE_VIEW: 'PRIVATE_VIEW', | ||
10 | - PUBLIC_VIEW: 'PUBLIC_VIEW', | ||
11 | -} | ||
12 | - | ||
13 | -export const encode = (record) => { | ||
14 | - let hash = JSON.stringify(record); | ||
15 | - const mixinString = getRandomString() | ||
16 | - .slice(0, 10) | ||
17 | - .padEnd(10, getRandomString()) | ||
18 | - .split('') | ||
19 | - .map((item) => (Math.random() > 0.5 ? item.toUpperCase() : item)) | ||
20 | - .join(''); | ||
21 | - hash = btoa(hash); | ||
22 | - hash = hash.substring(0, 6) + mixinString + hash.substring(6); | ||
23 | - hash = btoa(hash); | ||
24 | - return hash; | ||
25 | -}; | ||
26 | - | ||
27 | - | ||
28 | -export const createScadaPageLink = ( | ||
29 | - record, | ||
30 | - mode = ScadaModeEnum.PRIVATE_VIEW, | ||
31 | - open = false | ||
32 | -) => { | ||
33 | - const userInfo = uni.getStorageSync('userInfo') | ||
34 | - const params = { | ||
35 | - configurationId: record?.id, | ||
36 | - organizationId: record?.organizationId, | ||
37 | - mode: record?.viewType === ScadaModeEnum.PRIVATE_VIEW ? 'lightbox' : 'share', | ||
38 | - platform: record?.platform, | ||
39 | - userId: userInfo.userId | ||
40 | - }; | ||
41 | - | ||
42 | - if (record?.viewType === ScadaModeEnum.PUBLIC_VIEW) { | ||
43 | - params.publicId = record.publicId; | ||
44 | - } | ||
45 | - | ||
46 | - const hash = encode(params); | ||
47 | - | ||
48 | - const href = `${config.baseDrawioUrl}#${hash}` | ||
49 | - | ||
50 | - return href | ||
51 | -}; |
@@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
35 | import api from '@/api/index.js' | 35 | import api from '@/api/index.js' |
36 | import { | 36 | import { |
37 | createScadaPageLink | 37 | createScadaPageLink |
38 | - } from './help'; | 38 | + } from '../config/help.js'; |
39 | 39 | ||
40 | export default { | 40 | export default { |
41 | mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) | 41 | mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) |
pages/index/components/visualBoard/weapp.atob.js
deleted
100644 → 0
1 | -var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; | ||
2 | -var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/; | ||
3 | -export const btoa = function(string) { | ||
4 | - string = String(string); | ||
5 | - var bitmap, a, b, c, result = "", | ||
6 | - i = 0, | ||
7 | - rest = string.length % 3; | ||
8 | - for (; i < string.length;) { | ||
9 | - if ((a = string.charCodeAt(i++)) > 255 || | ||
10 | - (b = string.charCodeAt(i++)) > 255 || | ||
11 | - (c = string.charCodeAt(i++)) > 255) | ||
12 | - throw new TypeError( | ||
13 | - "Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range." | ||
14 | - ); | ||
15 | - bitmap = (a << 16) | (b << 8) | c; | ||
16 | - result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + | ||
17 | - b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63); | ||
18 | - } | ||
19 | - return rest ? result.slice(0, rest - 3) + "===".substring(rest) : result; | ||
20 | -}; | ||
21 | - | ||
22 | -export const atob = function(string) { | ||
23 | - string = String(string).replace(/[\t\n\f\r ]+/g, ""); | ||
24 | - if (!b64re.test(string)) | ||
25 | - throw new TypeError( | ||
26 | - "Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."); | ||
27 | - string += "==".slice(2 - (string.length & 3)); | ||
28 | - var bitmap, result = "", | ||
29 | - r1, r2, i = 0; | ||
30 | - for (; i < string.length;) { | ||
31 | - bitmap = b64.indexOf(string.charAt(i++)) << 18 | b64.indexOf(string.charAt(i++)) << 12 | | ||
32 | - (r1 = b64.indexOf(string.charAt(i++))) << 6 | (r2 = b64.indexOf(string.charAt(i++))); | ||
33 | - result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : | ||
34 | - r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : | ||
35 | - String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255); | ||
36 | - } | ||
37 | - return result; | ||
38 | -}; | ||
39 | - | ||
40 | -function b64DecodeUnicode(str) { | ||
41 | - return decodeURIComponent(exports.weAtob(str).replace(/(.)/g, function(p) { | ||
42 | - var code = p.charCodeAt(0).toString(16).toUpperCase(); | ||
43 | - if (code.length < 2) { | ||
44 | - code = "0" + code; | ||
45 | - } | ||
46 | - return "%" + code; | ||
47 | - })); | ||
48 | -} | ||
49 | - | ||
50 | -function base64_url_decode(str) { | ||
51 | - var output = str.replace(/-/g, "+").replace(/_/g, "/"); | ||
52 | - switch (output.length % 4) { | ||
53 | - case 0: | ||
54 | - break; | ||
55 | - case 2: | ||
56 | - output += "=="; | ||
57 | - break; | ||
58 | - case 3: | ||
59 | - output += "="; | ||
60 | - break; | ||
61 | - default: | ||
62 | - throw "Illegal base64url string!"; | ||
63 | - } | ||
64 | - try { | ||
65 | - return b64DecodeUnicode(output); | ||
66 | - } catch (err) { | ||
67 | - return exports.weAtob(output); | ||
68 | - } | ||
69 | -} | ||
70 | - | ||
71 | -function weappJwtDecode(token, options) { | ||
72 | - if (typeof token !== "string") { | ||
73 | - throw ("Invalid token specified"); | ||
74 | - } | ||
75 | - options = options || {}; | ||
76 | - var pos = options.header === true ? 0 : 1; | ||
77 | - try { | ||
78 | - return JSON.parse(base64_url_decode(token.split(".")[pos])); | ||
79 | - } catch (e) { | ||
80 | - throw ("Invalid token specified: " + e.message); | ||
81 | - } | ||
82 | -} |