@jx3box/jx3box-common-ui 9.0.5 → 9.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/Header.vue +17 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "9.0.5",
3
+ "version": "9.0.6",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@jx3box/jx3box-comment-ui": "^1.9.9",
34
- "@jx3box/jx3box-common": "^8.4.8",
34
+ "@jx3box/jx3box-common": "^8.4.9",
35
35
  "@jx3box/jx3box-data": "^3.7.0",
36
36
  "@jx3box/jx3box-editor": "^2.2.16",
37
37
  "@jx3box/reporter": "^0.0.4",
package/src/Header.vue CHANGED
@@ -42,6 +42,7 @@ import nav from "./header/nav.vue";
42
42
  import user from "./header/user.vue";
43
43
  import Box from "../src/Box.vue";
44
44
  import { isMiniProgram, miniprogramHack } from "@jx3box/jx3box-common/js/utils";
45
+ import miniprogram from "@jx3box/jx3box-common/data/miniprogram.json";
45
46
  // import gameSwitch from "./header/gameSwitch.vue";
46
47
 
47
48
  export default {
@@ -66,10 +67,23 @@ export default {
66
67
  }
67
68
 
68
69
  if (isMiniProgram()) {
69
- document.documentElement.classList.add("wechat-miniprogram");
70
70
 
71
- // 微信小程序hack
72
- miniprogramHack();
71
+ const urlParams = new URLSearchParams(window.location.search);
72
+ const appid = urlParams.get("appid");
73
+ const item = miniprogram?.find((item) => item.appid === appid);
74
+
75
+ if (appid && item) {
76
+ document.documentElement.classList.add("env-miniprogram" + item.id);
77
+
78
+ window.JX3BOX_ENV = item.id?.toUpperCase() + "_MINIPROGRAM";
79
+ } else {
80
+ document.documentElement.classList.add("wechat-miniprogram");
81
+
82
+ window.JX3BOX_ENV = "MINIPROGRAM";
83
+
84
+ // 微信小程序hack
85
+ miniprogramHack();
86
+ }
73
87
  }
74
88
  },
75
89