设置界面更新
build / build (push) Successful in 1m8s

This commit is contained in:
chenxing
2026-10-08 10:08:22 +08:00
parent e2c937f424
commit 19e1bbc9d7
182 changed files with 11133 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
(function (global) {
/* ---------- 1. 默认 16 字节密钥 ---------- */
const DEFAULT_KEY_WA = CryptoJS.MD5("bsch2025"); // WordArray(16 byte)
class BschCryptoUtil {
#aesKey;
constructor(key) {
// 支持外部传入字符串或 WordArray,默认用隐藏后的 MD5
this.#aesKey = key != null ? key : DEFAULT_KEY_WA;
}
encrypt(data) {
const message = typeof data === "string" ? data : JSON.stringify(data);
const encrypted = CryptoJS.AES.encrypt(message, this.#aesKey, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7,
});
return encrypted.toString(); // Base64
}
decrypt(cipherText) {
if (!cipherText) throw new Error("cipherText is empty");
const decrypted = CryptoJS.AES.decrypt(cipherText, this.#aesKey, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7,
});
const plain = decrypted.toString(CryptoJS.enc.Utf8);
if (!plain) throw new Error("decrypt failed");
try {
return JSON.parse(plain);
} catch (_) {
return plain;
}
}
static encrypt(data, key) {
return new BschCryptoUtil(key).encrypt(data);
}
static decrypt(cipherText, key) {
return new BschCryptoUtil(key).decrypt(cipherText);
}
}
/* ---------- 6. 暴露到全局 ---------- */
global.BschCryptoUtil = BschCryptoUtil;
})(typeof window !== "undefined" ? window : this);
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
"use strict";function _instanceof(n,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](n):n instanceof e}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(a,n){if(!_instanceof(a,n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t)}function _classPrivateFieldInitSpec(e,t,a){_checkPrivateRedeclaration(e,t),t.set(e,a)}function _checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object");}function _classPrivateFieldGet(s,a){return s.get(_assertClassBrand(s,a))}function _classPrivateFieldSet(s,a,r){return s.set(_assertClassBrand(s,a),r),r}function _assertClassBrand(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object");}var _isDev=new WeakMap();var _appId=new WeakMap();var BschLoadUtil=function(){function BschLoadUtil(){_classCallCheck(this,BschLoadUtil);_classPrivateFieldInitSpec(this,_isDev,false);_classPrivateFieldInitSpec(this,_appId,null);if(!BschLoadUtil.instance){this.isSelf=window.self===window.top;_classPrivateFieldSet(_appId,this,this.uuid());this.ticket=null;this.roleInfo={roleId:null,schId:null,childId:null};BschLoadUtil.instance=this}return BschLoadUtil.instance}return _createClass(BschLoadUtil,[{key:"getTicket",value:function getTicket(){if(!_classPrivateFieldGet(_isDev,this)){var ticket=this.getUrlParam("ticket"),roleInfoStr=this.getUrlParam("role");var roleInfo=this.roleDecode(roleInfoStr);this.ticket=ticket;this.roleInfo=roleInfo}return{ticket:this.ticket,roleInfo:this.roleInfo}}},{key:"goBackDesktop",value:function goBackDesktop(){if(_classPrivateFieldGet(_isDev,this)){console.error("调试模式,无效操作!");return}parent.postMessage(JSON.stringify({id:_classPrivateFieldGet(_appId,this),code:1}),"*")}},{key:"reloadParent",value:function reloadParent(){if(_classPrivateFieldGet(_isDev,this)){console.error("调试模式,无效操作!");return}parent.postMessage(JSON.stringify({id:_classPrivateFieldGet(_appId,this),code:2}),"*")}},{key:"showUserInfo",value:function showUserInfo(){if(_classPrivateFieldGet(_isDev,this)){console.error("调试模式,无效操作!");return}parent.postMessage(JSON.stringify({id:_classPrivateFieldGet(_appId,this),code:3}),"*")}},{key:"roleDecode",value:function roleDecode(roleInfoStr){try{var str=window.atob(roleInfoStr);str=decodeURIComponent(str);var obj=JSON.parse(str);return obj}catch(error){console.error(error);return{id:null,ticket:"",roleInfo:{}}}}},{key:"setDevTicket",value:function setDevTicket(ticket,roleInfo){if(this.isSelf){this.ticket=ticket;this.roleInfo=roleInfo;_classPrivateFieldSet(_isDev,this,true)}}},{key:"getIsSelf",value:function getIsSelf(){if(_classPrivateFieldGet(_isDev,this))return false;else return this.isSelf}},{key:"getUrlParam",value:function getUrlParam(name){var reg=new RegExp("(^|&)"+name+"=([^&]*)(&|$)");var r=window.location.search.substr(1).match(reg);if(r!=null)return unescape(r[2]);else return null}},{key:"uuid",value:function uuid(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=="x"?r:r&0x3|0x8;return v.toString(16)})}}],[{key:"getInstance",value:function getInstance(){if(!this.instance){return this.instance=new BschLoadUtil()}return this.instance}}])}();
+1
View File
@@ -0,0 +1 @@
"use strict";function _instanceof(n,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](n):n instanceof e}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(a,n){if(!_instanceof(a,n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t)}function _classPrivateFieldInitSpec(e,t,a){_checkPrivateRedeclaration(e,t),t.set(e,a)}function _checkPrivateRedeclaration(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object");}function _classPrivateFieldGet(s,a){return s.get(_assertClassBrand(s,a))}function _classPrivateFieldSet(s,a,r){return s.set(_assertClassBrand(s,a),r),r}function _assertClassBrand(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object");}var _isDev=new WeakMap();var _appId=new WeakMap();var BschLoadUtil=function(){function BschLoadUtil(){_classCallCheck(this,BschLoadUtil);_classPrivateFieldInitSpec(this,_isDev,false);_classPrivateFieldInitSpec(this,_appId,null);if(!BschLoadUtil.instance){this.isSelf=window.self===window.top;_classPrivateFieldSet(_appId,this,this.uuid());this.ticket=null;this.roleInfo={userId:null,roleId:null,schId:null,childId:null};BschLoadUtil.instance=this}return BschLoadUtil.instance}return _createClass(BschLoadUtil,[{key:"getTicket",value:function getTicket(){if(!_classPrivateFieldGet(_isDev,this)){var ticket=this.getUrlParam("ticket"),roleInfoStr=this.getUrlParam("role");var roleInfo=this.roleDecode(roleInfoStr);this.ticket=ticket;this.roleInfo=roleInfo}return{ticket:this.ticket,roleInfo:this.roleInfo}}},{key:"goBackDesktop",value:function goBackDesktop(){if(_classPrivateFieldGet(_isDev,this)){console.error("调试模式,无效操作!");return}parent.postMessage(JSON.stringify({id:_classPrivateFieldGet(_appId,this),code:1}),"*")}},{key:"reloadParent",value:function reloadParent(){if(_classPrivateFieldGet(_isDev,this)){console.error("调试模式,无效操作!");return}parent.postMessage(JSON.stringify({id:_classPrivateFieldGet(_appId,this),code:2}),"*")}},{key:"showUserInfo",value:function showUserInfo(){if(_classPrivateFieldGet(_isDev,this)){console.error("调试模式,无效操作!");return}parent.postMessage(JSON.stringify({id:_classPrivateFieldGet(_appId,this),code:3}),"*")}},{key:"roleDecode",value:function roleDecode(roleInfoStr){try{var str=window.atob(roleInfoStr);str=decodeURIComponent(str);var obj=JSON.parse(str);return obj}catch(error){console.error(error);return{id:null,ticket:"",roleInfo:{}}}}},{key:"setDevTicket",value:function setDevTicket(ticket,roleInfo){if(this.isSelf){this.ticket=ticket;this.roleInfo=roleInfo;_classPrivateFieldSet(_isDev,this,true)}}},{key:"getIsSelf",value:function getIsSelf(){if(_classPrivateFieldGet(_isDev,this))return false;else return this.isSelf}},{key:"getUrlParam",value:function getUrlParam(name){var reg=new RegExp("(^|&)"+name+"=([^&]*)(&|$)");var r=window.location.search.substr(1).match(reg);if(r!=null)return unescape(r[2]);else return null}},{key:"uuid",value:function uuid(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=="x"?r:r&0x3|0x8;return v.toString(16)})}}],[{key:"getInstance",value:function getInstance(){if(!this.instance){return this.instance=new BschLoadUtil()}return this.instance}}])}();
+128
View File
@@ -0,0 +1,128 @@
/**
* 数字基座内嵌加载帮助类
*/
class BschLoadUtil {
#isDev = false;
#appId = null;
#headerInfo = {};
constructor() {
if (!BschLoadUtil.instance) {
this.isSelf = window.self === window.top;
this.ticket = null;
this.roleInfo = {
roleId: null,
schId: null,
childId: null,
};
BschLoadUtil.instance = this;
}
return BschLoadUtil.instance;
}
getTicket() {
if (this.#isDev) return Promise.resolve({ ticket: this.ticket, roleInfo: this.roleInfo });
else
return new Promise((resolve, reject) => {
window.addEventListener(
"message",
e => {
var { id, ticket, roleInfo, headerInfo } = this.roleDecode(e.data);
this.#appId = id;
this.#headerInfo = headerInfo;
this.ticket = ticket;
this.roleInfo = roleInfo;
resolve({ ticket, roleInfo });
},
false
);
});
}
replaceHeaderStyle(el) {
if (this.#headerInfo == null) return false;
const { appName, avatar, username } = this.#headerInfo;
let headerStr = `
<header class="header-container fix">
<h4 class="fl align-middle">${appName}</h4>
<div class="header-aside fr">
<img id="js_comp_user_phone" src="${avatar}" class="fl align-middle">
<a id="js_comp_user_name" class="name fl align-middle text-ellipsis" href="javascript:void(0);">${username}</a>
<div class="delimiter fl align-middle"></div>
<a href="javascript:;" id="js_comp_operate" class="logout fl align-middle" title="返回桌面">
<i class="iconfont icon-shouye"></i>
</a>
</div>
</header>
`;
const _this = this;
$(el).append(headerStr);
$(el)
.find("#js_comp_user_phone")
.click(() => _this.showUserInfo());
$(el)
.find("#js_comp_user_name")
.click(() => _this.showUserInfo());
$(el)
.find("#js_comp_operate")
.click(() => _this.goBackDesktop());
}
goBackDesktop() {
if (this.#isDev) {
console.error("调试模式,无效操作!");
return;
}
parent.postMessage(JSON.stringify({ id: this.#appId, code: 1 }), "*");
}
reloadParent() {
if (this.#isDev) {
console.error("调试模式,无效操作!");
return;
}
parent.postMessage(JSON.stringify({ id: this.#appId, code: 2 }), "*");
}
showUserInfo() {
if (this.#isDev) {
console.error("调试模式,无效操作!");
return;
}
parent.postMessage(JSON.stringify({ id: this.#appId, code: 3 }), "*");
}
roleDecode(roleInfoStr) {
try {
var str = window.atob(roleInfoStr);
str = decodeURIComponent(str);
var obj = JSON.parse(str);
return obj;
} catch (error) {
console.error(error);
return {
id: null,
ticket: "",
roleInfo: {},
};
}
}
setDevTicket(ticket, roleInfo) {
if (this.isSelf) {
this.ticket = ticket;
this.roleInfo = roleInfo;
this.#isDev = true;
}
}
getIsSelf() {
if (this.#isDev) return false;
else return this.isSelf;
}
static getInstance() {
if (!this.instance) {
return (this.instance = new BschLoadUtil());
}
return this.instance;
}
}
+106
View File
@@ -0,0 +1,106 @@
/**
* 数字基座内嵌加载帮助类
*/
class BschLoadUtil {
#isDev = false;
#appId = null;
constructor() {
if (!BschLoadUtil.instance) {
this.isSelf = window.self === window.top;
this.#appId = this.uuid();
this.ticket = null;
this.roleInfo = {
userId: null,
roleId: null,
schId: null,
childId: null,
};
BschLoadUtil.instance = this;
}
return BschLoadUtil.instance;
}
getTicket() {
if (!this.#isDev) {
const ticket = this.getUrlParam("ticket"),
roleInfoStr = this.getUrlParam("role");
var roleInfo = this.roleDecode(roleInfoStr);
this.ticket = ticket;
this.roleInfo = roleInfo;
}
return { ticket: this.ticket, roleInfo: this.roleInfo };
}
goBackDesktop() {
if (this.#isDev) {
console.error("调试模式,无效操作!");
return;
}
parent.postMessage(JSON.stringify({ id: this.#appId, code: 1 }), "*");
}
reloadParent() {
if (this.#isDev) {
console.error("调试模式,无效操作!");
return;
}
parent.postMessage(JSON.stringify({ id: this.#appId, code: 2 }), "*");
}
showUserInfo() {
if (this.#isDev) {
console.error("调试模式,无效操作!");
return;
}
parent.postMessage(JSON.stringify({ id: this.#appId, code: 3 }), "*");
}
roleDecode(roleInfoStr) {
try {
var str = window.atob(roleInfoStr);
str = decodeURIComponent(str);
var obj = JSON.parse(str);
return obj;
} catch (error) {
console.error(error);
return {
id: null,
ticket: "",
roleInfo: {},
};
}
}
setDevTicket(ticket, roleInfo) {
if (this.isSelf) {
this.ticket = ticket;
this.roleInfo = roleInfo;
this.#isDev = true;
}
}
getIsSelf() {
if (this.#isDev) return false;
else return this.isSelf;
}
getUrlParam(name) {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
let r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
else return null;
}
uuid() {
return "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function (c) {
let r = (Math.random() * 16) | 0,
v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}
static getInstance() {
if (!this.instance) {
return (this.instance = new BschLoadUtil());
}
return this.instance;
}
}
File diff suppressed because one or more lines are too long