diff --git a/java-mall-app-shop-admin/.hbuilderx/launch.json b/java-mall-app-shop-admin/.hbuilderx/launch.json index fd7e778..131b491 100644 --- a/java-mall-app-shop-admin/.hbuilderx/launch.json +++ b/java-mall-app-shop-admin/.hbuilderx/launch.json @@ -20,7 +20,7 @@ "type" : "uniCloud" }, { - "playground" : "standard", + "playground" : "custom", "type" : "uni-app:app-android" }, { diff --git a/java-mall-app-shop-admin/App.vue b/java-mall-app-shop-admin/App.vue index 05f6264..d62fcec 100644 --- a/java-mall-app-shop-admin/App.vue +++ b/java-mall-app-shop-admin/App.vue @@ -23,7 +23,6 @@ export default { if (hasAgreed) { this.onAPPUpdate(); } - this.initAppOrderPush(); // #endif }, @@ -74,33 +73,6 @@ export default { success: (res) => { var push_clientid = res.cid; console.log("客户端推送标识cid:", push_clientid); - uni.showToast({ - title: push_clientid, - icon: "success", - duration: 1000, - }); - - console.log(push_clientid); - - uni.setClipboardData({ - data: push_clientid, // 需要复制的内容 - success: () => { - // 成功提示框显示 1 秒钟 - // uni.showToast({ - // title: "复制成功", - // icon: "success", - // duration: 1000, - // }); - }, - fail: () => { - // 失败提示框显示 1 秒钟 - uni.showToast({ - title: "复制失败,请重试", - icon: "none", - duration: 1000, - }); - }, - }); }, fail(err) { console.log(err); @@ -113,9 +85,15 @@ export default { if (res.data) { const app = getApp(); if (!app.globalData.isAppActive) { - // 创建通知 - uni.setStorageSync("pendingPushData", res.data); - uni.createPushMessage(res.data); + //监听系统通知栏消息点击事件 + if (res.type == "click") { + this.handlePushClick(res.data.payload); + } else { + this.handlePushSound(res.data); + uni.setStorageSync("pendingPushData", res.data); + // 创建通知 + uni.createPushMessage(res.data); + } } else { console.log("应用已打开,直接处理消息"); // 可以在这里直接更新 UI @@ -125,7 +103,126 @@ export default { }); const _self = this; - //监听系统通知栏消息点击事件 + }, + // 新增方法 - 处理通知栏点击 + handlePushClick(payload) { + console.log("处理通知栏点击:", payload); + + console.log(payload.category); + + // 根据payload内容跳转页面 + switch (payload.category) { + case "mchOnLineOrderList": + uni.setStorageSync("currentTab2", 0); + uni.switchTab({ + url: "/pages/order/order", + }); + + break; + case "mchAbnormalOrderList": + uni.setStorageSync("currentTab2", 1); + uni.switchTab({ + url: "/pages/order/order", + }); + break; + case "mchRetrunOrderList": + uni.setStorageSync("currentTab2", 2); + uni.switchTab({ + url: "/pages/order/order", + }); + break; + default: + uni.switchTab({ + url: "/pages/order/order", + }); + } + + // 清除存储的推送数据 + uni.removeStorageSync("pendingPushData"); + }, + // 新增方法 - 处理推送声音 + // 修改handlePushSound方法 + handlePushSound(pushData) { + console.log(pushData.payload); + try { + // 获取category决定使用哪种声音 + const category = pushData.payload.category; + + var AUDIO = uni.createInnerAudioContext(); + + // 设置音频源 + let soundFile = ""; + switch (category) { + case "mchOnLineOrderList": + AUDIO.src = "/static/mp3/jinxingzhong.MP3"; + AUDIO.play(); + break; + case "mchAbnormalOrderList": + AUDIO.src = "/static/mp3/yichang.MP3"; + AUDIO.play(); + break; + case "mchRetrunOrderList": + AUDIO.src = "/static/mp3/tuihuo.MP3"; + AUDIO.play(); + break; + } + + // 处理播放错误 + AUDIO.onError((res) => { + console.error("播放声音失败:", res); + }); + + // 多次会调用播放新的文件时,提前销毁实例,可避免-99错误 + // 处理播放完成 + AUDIO.onEnded(() => { + AUDIO.pause(); + AUDIO.destroy(); + AUDIO = null; + }); + + // Android平台原生播放备选方案 + // #ifdef APP-PLUS && ANDROID + if (plus.os.name === "Android") { + this.playNativeAndroidSound(soundFile); + } + // #endif + } catch (e) { + console.error("播放推送声音失败:", e); + } + }, + // Android原生播放方法 + playNativeAndroidSound(soundFile) { + try { + const main = plus.android.runtimeMainActivity(); + const MediaPlayer = plus.android.importClass( + "android.media.MediaPlayer" + ); + + // 移除路径中的'/static'前缀,因为Android assets中不需要 + const androidAssetPath = soundFile.replace(/^\/static\//, ""); + + const mediaPlayer = new MediaPlayer(); + const assetFileDescriptor = main + .getAssets() + .openFd("www/" + androidAssetPath); + + mediaPlayer.setDataSource( + assetFileDescriptor.getFileDescriptor(), + assetFileDescriptor.getStartOffset(), + assetFileDescriptor.getLength() + ); + + mediaPlayer.prepare(); + mediaPlayer.start(); + + mediaPlayer.setOnCompletionListener( + new plus.android.Proxy(function () { + mediaPlayer.release(); + }) + ); + } catch (e) { + console.error("Android原生播放失败:", e); + } }, }, }; diff --git a/java-mall-app-shop-admin/api/complaint.js b/java-mall-app-shop-admin/api/complaint.js new file mode 100644 index 0000000..00096ac --- /dev/null +++ b/java-mall-app-shop-admin/api/complaint.js @@ -0,0 +1,31 @@ +import http from "../utils/http"; +import config from "../config/config"; + +/** + * 提交聊天举报 + * @author Seven + * @data 2025-3-28 + * @param { + * snsUserReport: + * { + * "reportedUserId":"1000067", + * "reportedNickname":"微信用户", + * "reporterPhone":"18278596806", + * "reportCategory":"1", + * "reportContent":"经常被骚扰" + * } + * + * files: 867ce8b9452246a18be865786efa923d.jpeg + * } + * @returns { } + * @see https://mall.gpxscs.cn/admin/shop/shop-order-base/mch/order/list + */ + +export function GetSubmitReport(params) { + return http({ + url: "/sns/snsUserReport/submitReport", + method: "post", + data: params, + baseURL: config.apiMobile, + }); +} diff --git a/java-mall-app-shop-admin/manifest.json b/java-mall-app-shop-admin/manifest.json index d6f31f0..46d6dad 100644 --- a/java-mall-app-shop-admin/manifest.json +++ b/java-mall-app-shop-admin/manifest.json @@ -1,173 +1,172 @@ { - "name" : "小发同城", - "appid" : "__UNI__95F809F", - "package" : "com.xiaofa.shopAdmin", - "description" : "", - "versionName" : "1.0.1", - "versionCode" : 101, - "transformPx" : false, - /* 5+App特有相关 */ - "app-plus" : { - "usingComponents" : true, - "nvueStyleCompiler" : "uni-app", - "compilerVersion" : 3, - "splashscreen" : { - "alwaysShowBeforeRender" : true, - "waiting" : true, - "autoclose" : true, - "delay" : 0 + "name": "小发同城", + "appid": "__UNI__95F809F", + "package": "com.xiaofa.shopAdmin", + "description": "", + "versionName": "1.0.0", + "versionCode": 100, + "transformPx": false, + /* 5+App特有相关 */ + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + /* 模块配置 */ + "modules": { + "Maps": {}, + "Camera": {}, + "Record": {}, + "VideoPlayer": {}, + "UIWebview": {}, + "Push": {} + }, + /* 应用发布信息 */ + "distribute": { + /* android打包配置 */ + "android": { + "targetSdkVersion": 30, + "minSdkVersion": 21, + "compileSdkVersion": 30, + "permissions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /* ios打包配置 */ + "ios": { + "privacyDescription": { + "NSPhotoLibraryAddUsageDescription": "此App会在上传头像图片服务中访问您的相机权限", + "NSPhotoLibraryUsageDescription": "此App会在上传头像图片服务中访问您的相机权限", + "NSCameraUsageDescription": "此App会在上传头像图片服务中访问您的相机权限", + "NSMicrophoneUsageDescription": "此APP会在使用声音识别服务中使用您的麦克风权限", + "NSLocationWhenInUseUsageDescription": "此App会在使用导航服务中使用您的定位权限", + "NSLocationAlwaysUsageDescription": "此App会在使用导航服务中使用您的定位权限", + "NSLocationAlwaysAndWhenInUseUsageDescription": "此App会在使用导航服务中使用您的定位权限" }, - /* 模块配置 */ - "modules" : { - "Maps" : {}, - "Camera" : {}, - "Record" : {}, - "VideoPlayer" : {}, - "UIWebview" : {}, - "Push" : {} - }, - /* 应用发布信息 */ - "distribute" : { - /* android打包配置 */ - "android" : { - "targetSdkVersion" : 30, - "minSdkVersion" : 21, - "compileSdkVersion" : 30, - "permissions" : [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] - }, - /* ios打包配置 */ - "ios" : { - "privacyDescription" : { - "NSPhotoLibraryAddUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限", - "NSPhotoLibraryUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限", - "NSCameraUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限", - "NSMicrophoneUsageDescription" : "此APP会在使用声音识别服务中使用您的麦克风权限", - "NSLocationWhenInUseUsageDescription" : "此App会在使用导航服务中使用您的定位权限", - "NSLocationAlwaysUsageDescription" : "此App会在使用导航服务中使用您的定位权限", - "NSLocationAlwaysAndWhenInUseUsageDescription" : "此App会在使用导航服务中使用您的定位权限" - }, - "dSYMs" : false - }, - /* SDK配置 */ - "sdkConfigs" : { - "maps" : {}, - "push" : { - "unipush" : { - "version" : "2", - "offline" : false, - "appid" : "rQxaGAKl7t83KlTubAaKC3", - "appkey" : "QSElTn6ttq5nmrIZtFhCT" - } - } - }, - "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" : { - "androidStyle" : "default", - "useOriginalMsgbox" : true - } - }, - "uniStatistics" : { - "enable" : true + "dSYMs": false, + "UIBackgroundModes": "audio" + }, + /* SDK配置 */ + "sdkConfigs": { + "maps": {}, + "push": { + "unipush": { + "version": "2", + "offline": false, + "appid": "rQxaGAKl7t83KlTubAaKC3", + "appkey": "QSElTn6ttq5nmrIZtFhCT" + } } - }, - /* 快应用特有相关 */ - "quickapp" : {}, - /* 小程序特有相关 */ - "mp-weixin" : { - "appid" : "", - "setting" : { - "urlCheck" : false + }, + "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" }, - "usingComponents" : true - }, - "h5" : { - // "devServer" : { - // "https" : true, - // "host" : "127.0.0.1", - // "port" : 8080, - // "disableHostCheck" : true, - // "proxy" : { - // "/place/v2/suggestion" : { - // "target" : "https://api.map.baidu.com", - // "changeOrigin" : true, - // "secure" : false - // }, - // "/admin/shop/shop-base-product-category/list" : { - // "target" : "https://mall.gpxscs.cn", - // "changeOrigin" : true - // } - // } - // }, - "title" : "小发商城商家中心", - "template" : "index.html", - "router" : { - "mode" : "history", - "base" : "/mchapp/" + "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": { + "androidStyle": "default", + "useOriginalMsgbox": true + } }, - "mp-alipay" : { - "usingComponents" : true + "uniStatistics": { + "enable": true + } + }, + /* 快应用特有相关 */ + "quickapp": {}, + /* 小程序特有相关 */ + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false }, - "mp-baidu" : { - "usingComponents" : true - }, - "mp-toutiao" : { - "usingComponents" : true - }, - "uniStatistics" : { - "enable" : false, - "version" : "2" - }, - "vueVersion" : "2", - "fallbackLocale" : "zh-Hans" + "usingComponents": true + }, + "h5": { + // "devServer" : { + // "https" : true, + // "host" : "127.0.0.1", + // "port" : 8080, + // "disableHostCheck" : true, + // "proxy" : { + // "/place/v2/suggestion" : { + // "target" : "https://api.map.baidu.com", + // "changeOrigin" : true, + // "secure" : false + // }, + // "/admin/shop/shop-base-product-category/list" : { + // "target" : "https://mall.gpxscs.cn", + // "changeOrigin" : true + // } + // } + // }, + "title": "小发商城商家中心", + "template": "index.html", + "router": { + "mode": "history", + "base": "/mchapp/" + } + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "uniStatistics": { + "enable": false, + "version": "2" + }, + "vueVersion": "2", + "fallbackLocale": "zh-Hans" } /* 5+App特有相关 */ - diff --git a/java-mall-app-shop-admin/pages.json b/java-mall-app-shop-admin/pages.json index 0a4c367..99321ec 100644 --- a/java-mall-app-shop-admin/pages.json +++ b/java-mall-app-shop-admin/pages.json @@ -92,7 +92,7 @@ "navigationStyle": "custom" } }, - { + { "path": "pages/order/orderInfo", "style": { "navigationBarTitleText": "订单详情" @@ -116,6 +116,12 @@ "navigationBarTitleText": "聊天设置" } }, + { + "path": "pages/IM/complaint", + "style": { + "navigationBarTitleText": "聊天设置" + } + }, { "path": "pages/viewCenter/viewCenter", "style": { diff --git a/java-mall-app-shop-admin/pages/IM/IMmsgContent.vue b/java-mall-app-shop-admin/pages/IM/IMmsgContent.vue index dad1a7e..6083561 100644 --- a/java-mall-app-shop-admin/pages/IM/IMmsgContent.vue +++ b/java-mall-app-shop-admin/pages/IM/IMmsgContent.vue @@ -6,11 +6,13 @@ { 'disable-scroll': showVoiceMask }, ]" > - + + +