feat:中台复制

This commit is contained in:
2026-04-23 14:17:18 +08:00
parent f2e0bdcf5b
commit e812029064
@@ -50,7 +50,7 @@ export default {
console.log( console.log(
"TOKEN_NAME-1", "TOKEN_NAME-1",
getStorageFun(TOKEN_NAME), getStorageFun(TOKEN_NAME),
getStorageFun(USER_DATA) getStorageFun(USER_DATA),
); );
if (wv) { if (wv) {
// this.evalJSWithLog("onBridgeShowApp", { // this.evalJSWithLog("onBridgeShowApp", {
@@ -81,7 +81,7 @@ export default {
const handlers = { const handlers = {
/** 一键登录 **/ /** 一键登录 **/
back: () => this.back(detail), back: () => this.back(detail),
uniFunction: () => this.uniFunction(detail),
/** 默认 */ /** 默认 */
default: () => { default: () => {
if (detail.userInfo) { if (detail.userInfo) {
@@ -95,22 +95,43 @@ export default {
(handlers[type] || handlers["default"])(); (handlers[type] || handlers["default"])();
}, },
evalJSWithLog(callBackName, data) {
if (!wv) return;
const params = JSON.stringify(data);
console.log(`调用 evalJS: ${callBackName}(${params})`);
wv.evalJS(`${callBackName}(${params})`);
},
/**
* 开始录音
*/
back() { back() {
uni.switchTab({ uni.switchTab({
url: "/pages/mine/mine", url: "/pages/mine/mine",
}); });
}, },
// uni 方法
uniFunction({ name, params, success, fail, complete }) {
uni[name]({
...params,
success: (res) => {
if (success) {
this.evalJSWithLog(success, res);
}
},
fail: () => {
if (fail) {
this.evalJSWithLog(fail);
}
},
complete: () => {
if (complete) {
this.evalJSWithLog(complete);
}
},
});
},
/**
* 调用webview中的JS方法并记录日志
*/
evalJSWithLog(callBackName, data) {
if (!wv) return;
const params = JSON.stringify(data);
console.log(`调用 evalJS: ${callBackName}(${params})`);
wv.evalJS(`${callBackName}(${params})`);
},
}, },
}; };
</script> </script>