From d5253e32029fafdb6d5e4baef3d04774cb0eb153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E6=98=9F=E6=98=9F?= <605893810@qq.com> Date: Tue, 25 Aug 2026 15:36:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=A6=96=E9=A1=B5=E6=94=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hbuilderx/launch.json | 2 +- common.scss | 4 +- .../qiaobao-assistant/qiaobao-assistant.vue | 16 - manifest.json | 428 +++++++++--------- pages/home/home.vue | 409 +++++++++++------ pages/login_package/login/login.vue | 19 +- .../fill_express/fill_express.vue | 2 +- pages/mine_package/mine_order/mine_order.vue | 35 +- .../mine_order_info/mine_order_info.vue | 14 +- .../mine_privacy_agreement.vue | 415 ++++++++--------- .../mine_user_agreement.vue | 6 +- pages/other_package/coupon/coupon.vue | 13 +- pages/sort/sort.vue | 16 +- .../hashmall-customer-service.vue | 187 +++++++- .../kefu-message-item/kefu-message-item.vue | 92 ++-- 15 files changed, 1014 insertions(+), 644 deletions(-) diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index 4d24a42..bf94ead 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -4,7 +4,7 @@ { "customPlaygroundType" : "local", "packageName" : "com.trustbridge.mm", - "playground" : "standard", + "playground" : "custom", "type" : "uni-app:app-android" }, { diff --git a/common.scss b/common.scss index 5ff813f..75e6896 100644 --- a/common.scss +++ b/common.scss @@ -655,7 +655,7 @@ .sort_comm_warp { background: #ffffff; padding: 20rpx; - height: 170rpx; + // height: 170rpx; border-radius: 20rpx; box-sizing: border-box; display: flex; @@ -666,7 +666,7 @@ .sort_item_comm { flex: 1; text-align: center; - margin-bottom: 20rpx; + // margin-bottom: 20rpx; } .sort_item_title_comm { diff --git a/components/qiaobao-assistant/qiaobao-assistant.vue b/components/qiaobao-assistant/qiaobao-assistant.vue index 481e5c0..956feaf 100644 --- a/components/qiaobao-assistant/qiaobao-assistant.vue +++ b/components/qiaobao-assistant/qiaobao-assistant.vue @@ -162,11 +162,6 @@ export default { // #endif }, beforeUnmount() { - if (this.panelVisible) { - try { - uni.showTabBar({ animation: false }); - } catch (e) {} - } uni.$off("qiaobao-visibility-change", this.handleVisibilityChange); // #ifdef H5 window.removeEventListener("mousemove", this.handleMouseDragMove); @@ -382,17 +377,11 @@ export default { this.showBubble = false; this.panelVisible = true; this.action = "blink"; - try { - uni.hideTabBar({ animation: false }); - } catch (e) {} this.$emit("open", this.currentPageKey); }, closeHelp() { this.panelVisible = false; this.action = "idle"; - try { - uni.showTabBar({ animation: false }); - } catch (e) {} this.$emit("close", this.currentPageKey); }, openHideMenu() { @@ -417,11 +406,6 @@ export default { collapseToEdge(edge = getQiaobaoDockEdge()) { this.collapsedEdge = edge === "left" ? "left" : "right"; this.collapsed = true; - if (this.panelVisible) { - try { - uni.showTabBar({ animation: false }); - } catch (e) {} - } this.panelVisible = false; this.showBubble = false; this.action = "idle"; diff --git a/manifest.json b/manifest.json index 3795555..c0b6bb8 100644 --- a/manifest.json +++ b/manifest.json @@ -1,212 +1,216 @@ -{ - "name": "信任桥", - "appid": "__UNI__4910728", - "description": "信任桥优品是一款集线上商城、线下联盟商家的DAO聚合商城;通过“有趣”“有利”“有希望”的卖货玩法,吸引消费者、推广者、商家、投资人参与生态,共同打造共创共享的全球产业生态。", - "versionName": "1.0.3", - "versionCode": 170, - "transformPx": false, - /* 5+App特有相关 */ - "app-plus": { - "name": "哈希优品", - "usingComponents": true, - "nvueStyleCompiler": "uni-app", - "compilerVersion": 3, - "ios": { - "deploymentTarget": "13.0" - }, - "splashscreen": { - "alwaysShowBeforeRender": true, - "waiting": true, - "delay": 0, - "duration": 0, - "autoclose": false - }, - /* 模块配置 */ - "modules": { - "Payment": {}, - "Camera": {}, - "OAuth": {}, - "Share": {} - }, - /* 应用发布信息 */ - "distribute": { - /* android打包配置 */ - "android": { - "schemes": ["trustbridgeapp"], - "permissions": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ], - "abiFilters": ["armeabi-v7a", "arm64-v8a"], - "targetSdkVersion": 30, - "minSdkVersion": 21 - }, - /* ios打包配置 */ - "ios": { - "dSYMs": false, - "idfa": false, - "urltypes": [{ - "urlidentifier": "com.trustbridgeapp.mm", - "urlschemes": ["trustbridgeapp"] - }], - "associatedDomains": ["applinks:ulink.trustbridgeapp.com"], - "capabilities": { - "entitlements": { - "com.apple.developer.associated-domains": ["applinks:app.tbmall.xin"] - } - }, - "privacyDescription": { - "NSPhotoLibraryUsageDescription": "App需要您的同意才能访问相册,以便您选择本地图片上传头像或发布商品评价。例如:当您修改个人头像或发布带图评价时,需要从相册选择图片。", - "NSPhotoLibraryAddUsageDescription": "App需要您的同意才能添加图片到相册,以便您保存商品海报或图片到本地。例如:当您点击保存商品分享海报时,需要写入相册权限。", - "NSCameraUsageDescription": "App需要您的同意才能访问相机,以便您拍摄图片上传头像或发布商品评价。例如:当您修改个人头像或发布带图评价时,需要使用相机拍摄照片。" - } - }, - /* SDK配置 */ - "sdkConfigs": { - "payment": { - "alipay": { - "__platform__": ["ios", "android"] - }, - "weixin": { - "__platform__": ["ios", "android"], - "appid": "wx7a5902cd556d9396", - "UniversalLinks": "https://app.tbmall.xin/uni-universallinks/__UNI__4910728/" - } - }, - "oauth": { - "weixin": { - "appid": "wx7a5902cd556d9396", - "UniversalLinks": "https://app.tbmall.xin/uni-universallinks/__UNI__4910728/" - }, - "apple": {} - }, - "share": { - "weixin": { - "appid": "wx7a5902cd556d9396", - "UniversalLinks": "https://app.tbmall.xin/uni-universallinks/__UNI__4910728/" - } - } - }, - "icons": { - "android": { - "hdpi": "unpackage/res/icons/72x72.png", - "xhdpi": "unpackage/res/icons/96x96.png", - "xxhdpi": "unpackage/res/icons/144x144.png", - "xxxhdpi": "unpackage/res/icons/192x192.png" - }, - "ios": { - "appstore": "unpackage/res/icons/1024x1024.png", - "ipad": { - "app": "unpackage/res/icons/76x76.png", - "app@2x": "unpackage/res/icons/152x152.png", - "notification": "unpackage/res/icons/20x20.png", - "notification@2x": "unpackage/res/icons/40x40.png", - "proapp@2x": "unpackage/res/icons/167x167.png", - "settings": "unpackage/res/icons/29x29.png", - "settings@2x": "unpackage/res/icons/58x58.png", - "spotlight": "unpackage/res/icons/40x40.png", - "spotlight@2x": "unpackage/res/icons/80x80.png" - }, - "iphone": { - "app@2x": "unpackage/res/icons/120x120.png", - "app@3x": "unpackage/res/icons/180x180.png", - "notification@2x": "unpackage/res/icons/40x40.png", - "notification@3x": "unpackage/res/icons/60x60.png", - "settings@2x": "unpackage/res/icons/58x58.png", - "settings@3x": "unpackage/res/icons/87x87.png", - "spotlight@2x": "unpackage/res/icons/80x80.png", - "spotlight@3x": "unpackage/res/icons/120x120.png" - } - } - }, - "splashscreen": { - "useOriginalMsgbox": true, - "iosStyle": "common", - "androidStyle": "common" - } - }, - /*忽略版本提示*/ - "compatible": { - "ignoreVersion": true - }, - "nativePlugins": { - "Hyy-Alipay": { - "__plugin_info__": { - "name": "【免费开源】支付宝,授权,授权登录", - "description": "用过支付宝原生sdk,原生授权登录,更安全,有问题请联系作者", - "platforms": "Android", - "url": "https://ext.dcloud.net.cn/plugin?id=11931", - "android_package_name": "", - "ios_bundle_id": "", - "isCloud": true, - "bought": 1, - "pid": "11931", - "parameters": {} - } - } - } - }, - /* 快应用特有相关 */ - "quickapp": {}, - /* 小程序特有相关 */ - "mp-weixin": { - "appid": "wx376a16a88befe265", - "lazyCodeLoading": "requiredComponents", - "setting": { - "urlCheck": false, - "minified": true, - "uglifyFileName": true, - "es6": true, - "postcss": true, - "sourcemap": false - }, - "usingComponents": true, - "optimization": { - "subPackages": true - } - }, - "mp-alipay": { - "usingComponents": true - }, - "mp-baidu": { - "usingComponents": true - }, - "mp-toutiao": { - "usingComponents": true - }, - "uniStatistics": { - "enable": false - }, - "vueVersion": "3", - "_spaceID": "mp-16f2830d-655c-4ed2-9763-d0258ba65ad9", - "h5": { - "router": { - "mode": "hash", - "base": "" - }, - "devServer": { - "port": 5173, - "proxy": { - "/proxy-api": { - "target": "https://api.o.tbmall.xin", - "changeOrigin": true, - "pathRewrite": { - "^/proxy-api": "" - } - } - } - } - } -} \ No newline at end of file +{ + "name" : "信任桥", + "appid" : "__UNI__4910728", + "description" : "信任桥优品是一款集线上商城、线下联盟商家的DAO聚合商城;通过“有趣”“有利”“有希望”的卖货玩法,吸引消费者、推广者、商家、投资人参与生态,共同打造共创共享的全球产业生态。", + "versionName" : "1.0.3", + "versionCode" : 170, + "transformPx" : false, + /* 5+App特有相关 */ + "app-plus" : { + "name" : "哈希优品", + "usingComponents" : true, + "nvueStyleCompiler" : "uni-app", + "compilerVersion" : 3, + "ios" : { + "deploymentTarget" : "13.0" + }, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "delay" : 0, + "duration" : 0, + "autoclose" : false + }, + /* 模块配置 */ + "modules" : { + "Payment" : {}, + "Camera" : {}, + "OAuth" : {}, + "Share" : {}, + "Audio" : {}, + "Record" : {} + }, + /* 应用发布信息 */ + "distribute" : { + /* android打包配置 */ + "android" : { + "schemes" : [ "trustbridgeapp" ], + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ], + "targetSdkVersion" : 30, + "minSdkVersion" : 21 + }, + /* ios打包配置 */ + "ios" : { + "dSYMs" : false, + "idfa" : false, + "urltypes" : [ + { + "urlidentifier" : "com.trustbridgeapp.mm", + "urlschemes" : [ "trustbridgeapp" ] + } + ], + "associatedDomains" : [ "applinks:ulink.trustbridgeapp.com" ], + "capabilities" : { + "entitlements" : { + "com.apple.developer.associated-domains" : [ "applinks:app.tbmall.xin" ] + } + }, + "privacyDescription" : { + "NSPhotoLibraryUsageDescription" : "App需要您的同意才能访问相册,以便您选择本地图片上传头像或发布商品评价。例如:当您修改个人头像或发布带图评价时,需要从相册选择图片。", + "NSPhotoLibraryAddUsageDescription" : "App需要您的同意才能添加图片到相册,以便您保存商品海报或图片到本地。例如:当您点击保存商品分享海报时,需要写入相册权限。", + "NSCameraUsageDescription" : "App需要您的同意才能访问相机,以便您拍摄图片上传头像或发布商品评价。例如:当您修改个人头像或发布带图评价时,需要使用相机拍摄照片。" + } + }, + /* SDK配置 */ + "sdkConfigs" : { + "payment" : { + "alipay" : { + "__platform__" : [ "ios", "android" ] + }, + "weixin" : { + "__platform__" : [ "ios", "android" ], + "appid" : "wx7a5902cd556d9396", + "UniversalLinks" : "https://app.tbmall.xin/uni-universallinks/__UNI__4910728/" + } + }, + "oauth" : { + "weixin" : { + "appid" : "wx7a5902cd556d9396", + "UniversalLinks" : "https://app.tbmall.xin/uni-universallinks/__UNI__4910728/" + }, + "apple" : {} + }, + "share" : { + "weixin" : { + "appid" : "wx7a5902cd556d9396", + "UniversalLinks" : "https://app.tbmall.xin/uni-universallinks/__UNI__4910728/" + } + } + }, + "icons" : { + "android" : { + "hdpi" : "unpackage/res/icons/72x72.png", + "xhdpi" : "unpackage/res/icons/96x96.png", + "xxhdpi" : "unpackage/res/icons/144x144.png", + "xxxhdpi" : "unpackage/res/icons/192x192.png" + }, + "ios" : { + "appstore" : "unpackage/res/icons/1024x1024.png", + "ipad" : { + "app" : "unpackage/res/icons/76x76.png", + "app@2x" : "unpackage/res/icons/152x152.png", + "notification" : "unpackage/res/icons/20x20.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "proapp@2x" : "unpackage/res/icons/167x167.png", + "settings" : "unpackage/res/icons/29x29.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "spotlight" : "unpackage/res/icons/40x40.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png" + }, + "iphone" : { + "app@2x" : "unpackage/res/icons/120x120.png", + "app@3x" : "unpackage/res/icons/180x180.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "notification@3x" : "unpackage/res/icons/60x60.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "settings@3x" : "unpackage/res/icons/87x87.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png", + "spotlight@3x" : "unpackage/res/icons/120x120.png" + } + } + }, + "splashscreen" : { + "useOriginalMsgbox" : true, + "iosStyle" : "common", + "androidStyle" : "common" + } + }, + /*忽略版本提示*/ + "compatible" : { + "ignoreVersion" : true + }, + "nativePlugins" : { + "Hyy-Alipay" : { + "__plugin_info__" : { + "name" : "【免费开源】支付宝,授权,授权登录", + "description" : "用过支付宝原生sdk,原生授权登录,更安全,有问题请联系作者", + "platforms" : "Android", + "url" : "https://ext.dcloud.net.cn/plugin?id=11931", + "android_package_name" : "", + "ios_bundle_id" : "", + "isCloud" : true, + "bought" : 1, + "pid" : "11931", + "parameters" : {} + } + } + } + }, + /* 快应用特有相关 */ + "quickapp" : {}, + /* 小程序特有相关 */ + "mp-weixin" : { + "appid" : "wx376a16a88befe265", + "lazyCodeLoading" : "requiredComponents", + "setting" : { + "urlCheck" : false, + "minified" : true, + "uglifyFileName" : true, + "es6" : true, + "postcss" : true, + "sourcemap" : false + }, + "usingComponents" : true, + "optimization" : { + "subPackages" : true + } + }, + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics" : { + "enable" : false + }, + "vueVersion" : "3", + "_spaceID" : "mp-16f2830d-655c-4ed2-9763-d0258ba65ad9", + "h5" : { + "router" : { + "mode" : "hash", + "base" : "" + }, + "devServer" : { + "port" : 5173, + "proxy" : { + "/proxy-api" : { + "target" : "https://api.o.tbmall.xin", + "changeOrigin" : true, + "pathRewrite" : { + "^/proxy-api" : "" + } + } + } + } + } +} diff --git a/pages/home/home.vue b/pages/home/home.vue index 5d11266..699873f 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -1,78 +1,86 @@ + + + + diff --git a/pages/mine_package/mine_user_agreement/mine_user_agreement.vue b/pages/mine_package/mine_user_agreement/mine_user_agreement.vue index 7cb1315..86077b8 100644 --- a/pages/mine_package/mine_user_agreement/mine_user_agreement.vue +++ b/pages/mine_package/mine_user_agreement/mine_user_agreement.vue @@ -78,13 +78,13 @@         6.2.一旦您在信任桥平台的账户被终止,您使用信任桥平台服务的权利即告终止。信任桥不因终止本协议对您承担任何责任,包括终止您的用户账户和删除您的用户内容;信任桥也没有义务向您或第三方提供您使用信任桥平台服务所形成的信息资料。
        七、知识产权声明
        7.1【知识产权保护】信任桥是本软件的知识产权权利人。本软件的一切著作权、商标权、专利权、商业秘密等知识产权,以及与本软件相关的所有信息内容(包括但不限于文字、图片、音频、视频、图表、界面设计、版面框架、有关数据或电子文档等)均受您所在当地法律法规和相应的国际条约保护,信任桥享有上述知识产权。您使用信任桥帐号及信任桥平台服务的行为应符合相关协议关于知识产权的约定。
-         7.2【知识产权许可】您在使用信任桥平台服务时利用信任桥帐号发表上传的文字、图片等原创信息的知识产权归您所有但是您确认您对该等信息的发表、上传行为视同为对信任桥非独占地、永久地、不可撤销地授予该等信息相关全部知识产权的使用、复制等权利,并且您同意信任桥可转授权上述权利。
+         7.2【知识产权许可】您对利用本平台发表、上传的文字、图片等原创信息依法享有知识产权。为运营本平台并向您提供服务之目的,您授予信任桥一项附条件、可撤销的、非独占的使用权,以复制、使用、展示您所发布的内容。本授权在您主动删除相关内容或注销账号后自动终止。信任桥如需将您的内容用于平台运营之外的其他商业目的,或进行转授权,应另行获得您的书面同意。
        7.3【知识产权归属】除非经过信任桥的在先书面同意,您未获得权利使用信任桥的任何知识产权。您保证、陈述并承诺您尊重信任桥的知识产权。您不会以自己名义或促使第三方,也不会同意或放任任何第三方,为了其任何营销、广告、促销或其他目的,在任何法域、以任何方式申请与信任桥或信任桥关联公司商标相似的商标、域名、无线网站、互联网搜索词或任何商号、服务标志。如出现上述情况,您须将所有相关权利转让给信任桥,费用由您承担。您保证、陈述并承诺,不会使用以下名称(包括但不限于“信任桥”)、上述品牌的附属标志及图案(包括但不限于等)作为企业、商户、服务或产品名称的一部分,亦不会使用与信任桥商标或近似商标的知识产权。如因您违反本条款约定而给信任桥造成损失的,该损失全部由您承担。
        7.4【侵权处理】您在信任桥发布的信息不得侵犯任何第三人的知识产权,未经具有相关所有权人之事先书面同意,您不得以任何方式上传、发布、修改、传播或复制任何受著作权保护的材料、商标或属于其他人的专有信息。如您认为信任桥平台上的商品或其他信息侵犯了您的知识产权,请按照信任桥平台上公布的知识产权保护规则及流程处理。
        八、通知
        您在注册成为信任桥用户,并接受信任桥平台服务时,您应该向信任桥提供真实有效的联系方式(包括联系电话等),对于联系方式发生变更的,您有义务及时更新有关信息,并保持可被联系的状态。信任桥向您浏览界面推送的弹窗等通知形式,也作为向您发出的有效通知。信任桥将向您的上述联系方式的其中之一或其中若干向您送达各类通知,而此类通知的内容可能对您的权利义务产生重大的有利或不利影响,请您务必及时关注。您应当保证所提供的联系方式是准确、有效的,并进行实时更新。如果因提供的联系方式不确切,或不及时告知变更后的联系方式,使通知无法送达或未及时送达,由您自行承担由此可能产生的法律后果。
        九、适用法律及争议解决
-         9.1本协议应适用中华人民共和国法律。您因使用信任桥平台服务所产生及与信任桥平台服务有关的争议,由信任桥与您协商解决。协商不成时,任何一方均可向上海市青浦区有管辖权的人民法院提起诉讼。
+         9.1本协议应适用中华人民共和国法律。您因使用信任桥平台服务所产生及与信任桥平台服务有关的争议,由信任桥与您协商解决。协商不成时,任何一方均可向被告住所地有管辖权的人民法院提起诉讼。
        9.2本协议中的某些条款因故无法适用,则本协议的其他条款继续适用且无法适用的条款将会被修改,以便其能够依法适用。
        9.3未明示授权的其他权利仍由信任桥保留,您在行使这些权利时须另外取得信任桥的书面许可。信任桥如果未行使前述任何权利,并不构成对该权利的放弃。
        十、其他
@@ -94,7 +94,7 @@         10.4.本协议条款无论因何种原因部分无效或不可执行,其余条款仍有效,对双方具有约束力。
        开发者:信任桥
- + diff --git a/pages/other_package/coupon/coupon.vue b/pages/other_package/coupon/coupon.vue index d73afb5..2372ebd 100644 --- a/pages/other_package/coupon/coupon.vue +++ b/pages/other_package/coupon/coupon.vue @@ -20,7 +20,7 @@ {{ item.name || item.title }} - - {{ tag }} + + {{ tag }} @@ -692,7 +690,7 @@ page { /* 左侧边栏 */ .left_sidebar_scroll { - width: 180rpx; + width: 160rpx; height: 100%; flex-shrink: 0; background-color: #f7f7f7; @@ -838,7 +836,6 @@ page { .product_title { font-size: 28rpx; - font-weight: bold; color: #1a1a1a; line-height: 38rpx; max-height: 76rpx; @@ -891,7 +888,8 @@ page { } .price_val { - font-size: 38rpx; + font-size: 36rpx; + font-weight: normal; } } diff --git a/uni_modules/hashmall-customer-service/components/hashmall-customer-service/hashmall-customer-service.vue b/uni_modules/hashmall-customer-service/components/hashmall-customer-service/hashmall-customer-service.vue index dfdc53b..953d737 100644 --- a/uni_modules/hashmall-customer-service/components/hashmall-customer-service/hashmall-customer-service.vue +++ b/uni_modules/hashmall-customer-service/components/hashmall-customer-service/hashmall-customer-service.vue @@ -918,6 +918,187 @@ export default { await this.pickAndUploadImage() }, + checkMicrophoneAuthorized() { + // #ifdef H5 + return true + // #endif + + // #ifdef MP-WEIXIN + return new Promise((resolve) => { + uni.getSetting({ + success: (res) => { + resolve(res.authSetting['scope.record'] === true) + }, + fail: () => resolve(false) + }) + }) + // #endif + + // #ifdef APP-PLUS + return new Promise((resolve) => { + const platform = uni.getSystemInfoSync().platform + if (platform === 'android') { + try { + const main = plus.android.runtimeMainActivity() + const PackageManager = plus.android.importClass('android.content.pm.PackageManager') + const permission = main.checkSelfPermission('android.permission.RECORD_AUDIO') + resolve(permission === PackageManager.PERMISSION_GRANTED) + } catch (e) { + resolve(false) + } + } else if (platform === 'ios') { + try { + const avSession = plus.ios.importClass('AVAudioSession') + const audioSession = avSession.sharedInstance() + const permissionStatus = audioSession.recordPermission() + resolve(permissionStatus === 1970168948) + } catch (e) { + resolve(false) + } + } else { + resolve(true) + } + }) + // #endif + }, + + async requestMicrophonePermission() { + // #ifdef H5 + if (typeof navigator !== 'undefined' && navigator.mediaDevices && typeof navigator.mediaDevices.getUserMedia === 'function') { + try { + const stream = await navigator.mediaDevices.getUserMedia({ audio: true }) + stream.getTracks().forEach(track => track.stop()) + return true + } catch (e) { + uni.showModal({ + title: '麦克风权限提示', + content: '请允许浏览器访问麦克风以使用语音录制功能。', + showCancel: false + }) + return false + } + } + return true + // #endif + + // #ifdef MP-WEIXIN + return new Promise((resolve) => { + uni.getSetting({ + success: (res) => { + const recordAuth = res.authSetting['scope.record'] + if (recordAuth === true) { + resolve(true) + } else if (recordAuth === false) { + uni.showModal({ + title: '麦克风权限未开启', + content: '需要访问您的麦克风发送语音消息,请前往设置开启权限。', + confirmText: '去设置', + success: (modalRes) => { + if (modalRes.confirm) { + uni.openSetting() + } + resolve(false) + } + }) + } else { + uni.authorize({ + scope: 'scope.record', + success: () => resolve(true), + fail: () => { + uni.showModal({ + title: '授权提示', + content: '麦克风授权失败,无法使用语音功能。', + showCancel: false + }) + resolve(false) + } + }) + } + }, + fail: () => resolve(true) + }) + }) + // #endif + + // #ifdef APP-PLUS + return new Promise((resolve) => { + const platform = uni.getSystemInfoSync().platform + if (platform === 'android') { + try { + plus.android.requestPermissions( + ['android.permission.RECORD_AUDIO'], + (result) => { + if (result.granted && result.granted.length > 0) { + resolve(true) + } else { + uni.showModal({ + title: '麦克风权限未开启', + content: 'App 需要您的同意才能访问麦克风以发送语音消息。', + confirmText: '去设置', + success: (modalRes) => { + if (modalRes.confirm) { + const Intent = plus.android.importClass('android.content.Intent') + const Settings = plus.android.importClass('android.provider.Settings') + const Uri = plus.android.importClass('android.net.Uri') + const main = plus.android.runtimeMainActivity() + const intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) + const uri = Uri.fromParts('package', main.getPackageName(), null) + intent.setData(uri) + main.startActivity(intent) + } + resolve(false) + } + }) + } + }, + (error) => { + console.error('requestPermissions error:', error) + resolve(true) + } + ) + } catch (e) { + resolve(true) + } + } else if (platform === 'ios') { + try { + const avSession = plus.ios.importClass('AVAudioSession') + const audioSession = avSession.sharedInstance() + const permissionStatus = audioSession.recordPermission() + if (permissionStatus === 1970168948) { // AVAudioSessionRecordPermissionGranted + resolve(true) + } else if (permissionStatus === 1970168947) { // AVAudioSessionRecordPermissionDenied + uni.showModal({ + title: '麦克风权限未开启', + content: 'App 需要您的同意才能访问麦克风,请前往设置开启麦克风权限。', + confirmText: '去设置', + success: (modalRes) => { + if (modalRes.confirm) { + const UIApplication = plus.ios.importClass('UIApplication') + const NSURL = plus.ios.importClass('NSURL') + const app = UIApplication.sharedApplication() + const settingsUrl = NSURL.URLWithString('app-settings:') + if (app.canOpenURL(settingsUrl)) { + app.openURL(settingsUrl) + } + } + resolve(false) + } + }) + } else { // Undetermined + audioSession.requestRecordPermission((granted) => { + resolve(granted) + }) + } + } catch (e) { + resolve(true) + } + } else { + resolve(true) + } + }) + // #endif + }, + toggleVoiceMode() { if (this.uploadingAttachment) return if (this.recording) this.cancelVoiceRecording() @@ -939,8 +1120,10 @@ export default { this.voiceGestureActive = true this.recordingCancelled = false this.voiceStartY = this.voiceEventY(event) - await this.startVoiceRecording() - if (!this.voiceGestureActive && this.recording) this.cancelVoiceRecording() + const ok = await this.startVoiceRecording() + if (!ok || (!this.voiceGestureActive && this.recording)) { + this.cancelVoiceRecording() + } }, handleVoicePressMove(event) { diff --git a/uni_modules/hashmall-customer-service/components/kefu-message-item/kefu-message-item.vue b/uni_modules/hashmall-customer-service/components/kefu-message-item/kefu-message-item.vue index 0a22910..05afb38 100644 --- a/uni_modules/hashmall-customer-service/components/kefu-message-item/kefu-message-item.vue +++ b/uni_modules/hashmall-customer-service/components/kefu-message-item/kefu-message-item.vue @@ -28,13 +28,15 @@ /> {{ attachment.transcript }}