feat: 商城app 和中台通讯

This commit is contained in:
2025-11-04 01:14:33 +08:00
parent 350d1c410e
commit 9be1126016
5 changed files with 780 additions and 599 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
{ {
"customPlaygroundType" : "local", "customPlaygroundType" : "local",
"packageName" : "com.trustbridge.mm", "packageName" : "com.trustbridge.mm",
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
}, },
{ {
+116 -55
View File
@@ -8,7 +8,8 @@
"^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue" "^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue"
} }
}, },
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages "pages": [
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{ {
"path": "pages/home/home", "path": "pages/home/home",
"style": { "style": {
@@ -67,14 +68,23 @@
} }
} }
], ],
"subPackages": [{ "subPackages": [
{
"root": "pages/mine_package", "root": "pages/mine_package",
"pages": [{ "pages": [
{
"path": "mild-shopping/mild-shopping",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "mine_bank_card/mine_bank_card", "path": "mine_bank_card/mine_bank_card",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_bank_add/mine_bank_add", "path": "mine_bank_add/mine_bank_add",
"style": { "style": {
"navigationBarTitleText": "%bankCard.add.title%", "navigationBarTitleText": "%bankCard.add.title%",
@@ -83,42 +93,50 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "default" // 默认样式,会显示返回图标 "navigationStyle": "default" // 默认样式,会显示返回图标
} }
}, { },
{
"path": "mine_address/mine_address", "path": "mine_address/mine_address",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_address_add/mine_address_add", "path": "mine_address_add/mine_address_add",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_authentication/mine_authentication", "path": "mine_authentication/mine_authentication",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_authentication_ok/mine_authentication_ok", "path": "mine_authentication_ok/mine_authentication_ok",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_purse/mine_purse", "path": "mine_purse/mine_purse",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_order/mine_order", "path": "mine_order/mine_order",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_order_info/mine_order_info", "path": "mine_order_info/mine_order_info",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_purse_bonus/mine_purse_bonus", "path": "mine_purse_bonus/mine_purse_bonus",
"style": { "style": {
"navigationBarTitleText": "%purse.bonus.title%", "navigationBarTitleText": "%purse.bonus.title%",
@@ -127,7 +145,8 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "default" // 默认样式,会显示返回图标 "navigationStyle": "default" // 默认样式,会显示返回图标
} }
}, { },
{
"path": "mine_winning_record/mine_winning_record", "path": "mine_winning_record/mine_winning_record",
"style": { "style": {
"navigationBarTitleText": "%mine.winning.record.title%", "navigationBarTitleText": "%mine.winning.record.title%",
@@ -136,27 +155,32 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "default" // 默认样式,会显示返回图标 "navigationStyle": "default" // 默认样式,会显示返回图标
} }
}, { },
{
"path": "mine_transaction_password/mine_transaction_password", "path": "mine_transaction_password/mine_transaction_password",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, { },
{
"path": "mine_purse_recharge/mine_purse_recharge", "path": "mine_purse_recharge/mine_purse_recharge",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, { },
{
"path": "mine_purse_exchange/mine_purse_exchange", "path": "mine_purse_exchange/mine_purse_exchange",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, { },
{
"path": "mine_product_agreement/mine_product_agreement", "path": "mine_product_agreement/mine_product_agreement",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_about_us/mine_about_us", "path": "mine_about_us/mine_about_us",
"style": { "style": {
"navigationBarTitleText": "%mine.about.us.title%", "navigationBarTitleText": "%mine.about.us.title%",
@@ -165,42 +189,50 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "default" // 默认样式,会显示返回图标 "navigationStyle": "default" // 默认样式,会显示返回图标
} }
}, { },
{
"path": "mine_privacy_agreement/mine_privacy_agreement", "path": "mine_privacy_agreement/mine_privacy_agreement",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_user_agreement/mine_user_agreement", "path": "mine_user_agreement/mine_user_agreement",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_collection_alipay/mine_collection_alipay", "path": "mine_collection_alipay/mine_collection_alipay",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, { },
{
"path": "mine_purse_log/mine_purse_log", "path": "mine_purse_log/mine_purse_log",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_my_team_list/mine_my_team_list", "path": "mine_my_team_list/mine_my_team_list",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_purse_bonus_withdraw/mine_purse_bonus_withdraw", "path": "mine_purse_bonus_withdraw/mine_purse_bonus_withdraw",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_purse_bonus_withdraw_log/mine_purse_bonus_withdraw_log", "path": "mine_purse_bonus_withdraw_log/mine_purse_bonus_withdraw_log",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_settings/mine_settings", "path": "mine_settings/mine_settings",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -211,7 +243,8 @@
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "mine_coupon/mine_coupon", "path": "mine_coupon/mine_coupon",
"style": { "style": {
"navigationBarTitleText": "%mine.coupon.title%", "navigationBarTitleText": "%mine.coupon.title%",
@@ -222,27 +255,34 @@
} }
} }
] ]
}, { },
{
"root": "pages/order_package", "root": "pages/order_package",
"pages": [{ "pages": [
{
"path": "order_submit/order_submit", "path": "order_submit/order_submit",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "order_submit_ok/order_submit_ok", "path": "order_submit_ok/order_submit_ok",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "order_submit_error/order_submit_error", "path": "order_submit_error/order_submit_error",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}] }
}, { ]
},
{
"root": "pages/rwa_package", "root": "pages/rwa_package",
"pages": [{ "pages": [
{
"path": "rwa/rwa", "path": "rwa/rwa",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -405,7 +445,8 @@
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "rwa_binding/rwa_binding", "path": "rwa_binding/rwa_binding",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -424,68 +465,83 @@
} }
} }
] ]
}, { },
{
"root": "pages/login_package", "root": "pages/login_package",
"pages": [{ "pages": [
{
"path": "accelerate/accelerate", "path": "accelerate/accelerate",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "news_info/news_info", "path": "news_info/news_info",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, { },
{
"path": "preference/preference", "path": "preference/preference",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "welcome/welcome", "path": "welcome/welcome",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "login/login", "path": "login/login",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},{ },
{
"path": "bind-phone/bind-phone", "path": "bind-phone/bind-phone",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "register/register", "path": "register/register",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "news/news", "path": "news/news",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}] }
}, { ]
},
{
"root": "pages/other_package", "root": "pages/other_package",
"pages": [{ "pages": [
{
"path": "payment_processing/payment_processing", "path": "payment_processing/payment_processing",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "pointsRedemption/pointsRedemption", "path": "pointsRedemption/pointsRedemption",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, { },
{
"path": "productInfo/productInfo", "path": "productInfo/productInfo",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "search/search", "path": "search/search",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -496,7 +552,8 @@
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, { },
{
"path": "nine-grid/nine-grid", "path": "nine-grid/nine-grid",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
@@ -539,14 +596,16 @@
} }
} }
] ]
}], }
],
"tabBar": { "tabBar": {
"color": "#666", "color": "#666",
"selectedColor": "#7934F6", "selectedColor": "#7934F6",
"borderStyle": "black", "borderStyle": "black",
// "backgroundColor": "#F8F8F8", // "backgroundColor": "#F8F8F8",
// "custom": true, // "custom": true,
"list": [{ "list": [
{
"pagePath": "pages/home/home", "pagePath": "pages/home/home",
"text": "%index.home%", "text": "%index.home%",
"iconPath": "/static/column/home.png", "iconPath": "/static/column/home.png",
@@ -569,7 +628,8 @@
"text": "%index.shopping.cart%", "text": "%index.shopping.cart%",
"iconPath": "/static/column/shopping.png", "iconPath": "/static/column/shopping.png",
"selectedIconPath": "/static/column/shopping_sel.png" "selectedIconPath": "/static/column/shopping_sel.png"
}, { },
{
"pagePath": "pages/mine/mine", "pagePath": "pages/mine/mine",
"text": "%index.mine%", "text": "%index.mine%",
"iconPath": "/static/column/mine.png", "iconPath": "/static/column/mine.png",
@@ -585,7 +645,8 @@
} }
} }
}, },
"condition" : { //模式配置,仅开发期间生效 "condition": {
//模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项) "current": 0, //当前激活的模式(list 的索引项)
"list": [ "list": [
{ {
+4 -1
View File
@@ -526,7 +526,10 @@ export default {
}, },
jumpToTrustBridge() { jumpToTrustBridge() {
// 跳转到指定的信任桥地址 // 跳转到指定的信任桥地址
plus.runtime.openURL("http://agent.outer.tbmall.xin:6880/"); console.log("跳转到指定的信任桥地址")
uni.navigateTo({
url:'/pages/mine_package/mild-shopping/mild-shopping'
})
}, },
/** /**
* 跳转到工具 * 跳转到工具
@@ -0,0 +1,117 @@
<template>
<view class="mild-shopping">
<web-view
ref="webview"
:webview-styles="webviewStyles"
:src="webviewUrl"
@message="handlePostMessage"
@onPostMessage="handlePostMessage"
></web-view></view>
</template>
<script>
import { TOKEN_NAME, USER_DATA, getStorageFun } from "@/utils/auth.js";
// 全局变量
let wv; // 计划创建的webview
export default {
data() {
return {
webviewStyles: {
progress: {
color: "#333333",
},
},
wvNode: null,
webviewUrl:'http://agent.outer.tbmall.xin:6880/'
// webviewUrl: "http://192.168.0.101:8000/",
};
},
onShow() {
// #ifdef APP-PLUS
this.initWebview();
// #endif
},
methods: {
/**
* 初始化webview
*/
initWebview() {
const currentWebview = this.$scope.$getAppWebview();
setTimeout(() => {
wv = currentWebview.children()[0];
console.log(
"TOKEN_NAME-1",
getStorageFun(TOKEN_NAME),
getStorageFun(USER_DATA)
);
if (wv) {
// this.evalJSWithLog("onBridgeShowApp", {
// token: 'WnJyYmV5SmhiR2NpT2lKSVV6STFOaUo5LmV5SjFjMlZ5U1dRaU9qRTNNallzSW0xamFFbGtJam94TURBeUxDSnBjM01pT2lKb2MyMHRabkp2Ym5SbGJtUWlMQ0owSWpveE56WXlNVGczTURreE1qYzRmUS5Caml4VU8yS1ZoUHBmeHdjRDRPWE4tSmw5T1lBZnBlc3hCRUN6UUFzQUpzRkp2em4',
// userId: '1726',
// name: '陈俊兴',
// });
this.evalJSWithLog("onBridgeShowApp", {
token: getStorageFun(TOKEN_NAME),
userId: getStorageFun(USER_DATA).userId,
name: getStorageFun(USER_DATA).name,
});
}
}, 300);
// 支付成功,小程序跳回app
},
/**
* 处理来自webview的消息
*/
handlePostMessage(val) {
console.log("收到消息", val, val.detail.data);
const detail = val.detail.data[0];
const type = detail?.type;
console.log("收到消息-1", type);
// 使用策略模式处理不同类型消息
const handlers = {
/** 一键登录 **/
back: () => this.back(detail),
/** 默认 */
default: () => {
if (detail.userInfo) {
this.handleChatMessage(detail, type);
} else {
console.log("未知类型:", type);
}
},
};
(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",
});
},
},
};
</script>
<style lang="scss" scoped>
.mild-shopping{
padding-top: var(--status-bar-height);
}
</style>
+2 -2
View File
@@ -2,9 +2,9 @@
// export const BASE_URL="https://frontend.jdns360.com/api"; // 正式环境 // export const BASE_URL="https://frontend.jdns360.com/api"; // 正式环境
// export const BASE_URL="http://cl55un59859.vicp.fun:24346"; // 测试环境 // export const BASE_URL="http://cl55un59859.vicp.fun:24346"; // 测试环境
export const BASE_URL = "https://api.tbmall.xin"; //生产 // export const BASE_URL = "https://api.tbmall.xin"; //生产
// export const BASE_URL ='http://api.hm.a-d.work:6880' // 测试 // export const BASE_URL ='http://api.hm.a-d.work:6880' // 测试
// export const BASE_URL ='http://api.outer.tbmall.xin:6880' // 本地测试 export const BASE_URL ='http://api.outer.tbmall.xin:6880' // 本地测试