From e812029064639674fd93b53810bd8fea67f1e39f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E5=BD=A6=E7=A5=96?= <605893810@qq.com> Date: Thu, 23 Apr 2026 14:17:18 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=B8=AD=E5=8F=B0=E5=A4=8D?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mild-shopping/mild-shopping.vue | 45 ++++++++++++++----- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/pages/mine_package/mild-shopping/mild-shopping.vue b/pages/mine_package/mild-shopping/mild-shopping.vue index c8491c4..64b6963 100644 --- a/pages/mine_package/mild-shopping/mild-shopping.vue +++ b/pages/mine_package/mild-shopping/mild-shopping.vue @@ -50,7 +50,7 @@ export default { console.log( "TOKEN_NAME-1", getStorageFun(TOKEN_NAME), - getStorageFun(USER_DATA) + getStorageFun(USER_DATA), ); if (wv) { // this.evalJSWithLog("onBridgeShowApp", { @@ -81,7 +81,7 @@ export default { const handlers = { /** 一键登录 **/ back: () => this.back(detail), - + uniFunction: () => this.uniFunction(detail), /** 默认 */ default: () => { if (detail.userInfo) { @@ -95,22 +95,43 @@ export 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() { uni.switchTab({ 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})`); + }, }, };