update: 修复华为手机打电话问题
This commit is contained in:
parent
5829608f98
commit
23daffe0fb
@ -4,6 +4,9 @@
|
|||||||
"version" : "0.0",
|
"version" : "0.0",
|
||||||
"configurations" : [
|
"configurations" : [
|
||||||
{
|
{
|
||||||
|
"app" : {
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
"launchtype" : "remote"
|
"launchtype" : "remote"
|
||||||
},
|
},
|
||||||
@ -20,7 +23,8 @@
|
|||||||
"type" : "uniCloud"
|
"type" : "uniCloud"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"playground" : "custom",
|
"customPlaygroundType" : "device",
|
||||||
|
"playground" : "standard",
|
||||||
"type" : "uni-app:app-android"
|
"type" : "uni-app:app-android"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,172 +1,174 @@
|
|||||||
{
|
{
|
||||||
"name": "小发同城",
|
"name" : "小发同城",
|
||||||
"appid": "__UNI__95F809F",
|
"appid" : "__UNI__95F809F",
|
||||||
"package": "com.xiaofa.shopAdmin",
|
"package" : "com.xiaofa.shopAdmin",
|
||||||
"description": "",
|
"description" : "",
|
||||||
"versionName": "1.0.0",
|
"versionName" : "1.0.0",
|
||||||
"versionCode": 100,
|
"versionCode" : 100,
|
||||||
"transformPx": false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus": {
|
"app-plus" : {
|
||||||
"usingComponents": true,
|
"usingComponents" : true,
|
||||||
"nvueStyleCompiler": "uni-app",
|
"nvueStyleCompiler" : "uni-app",
|
||||||
"compilerVersion": 3,
|
"compilerVersion" : 3,
|
||||||
"splashscreen": {
|
"splashscreen" : {
|
||||||
"alwaysShowBeforeRender": true,
|
"alwaysShowBeforeRender" : true,
|
||||||
"waiting": true,
|
"waiting" : true,
|
||||||
"autoclose": true,
|
"autoclose" : true,
|
||||||
"delay": 0
|
"delay" : 0
|
||||||
},
|
|
||||||
/* 模块配置 */
|
|
||||||
"modules": {
|
|
||||||
"Maps": {},
|
|
||||||
"Camera": {},
|
|
||||||
"Record": {},
|
|
||||||
"VideoPlayer": {},
|
|
||||||
"UIWebview": {},
|
|
||||||
"Push": {}
|
|
||||||
},
|
|
||||||
/* 应用发布信息 */
|
|
||||||
"distribute": {
|
|
||||||
/* android打包配置 */
|
|
||||||
"android": {
|
|
||||||
"targetSdkVersion": 30,
|
|
||||||
"minSdkVersion": 21,
|
|
||||||
"compileSdkVersion": 30,
|
|
||||||
"permissions": [
|
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
|
||||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
/* ios打包配置 */
|
|
||||||
"ios": {
|
|
||||||
"privacyDescription": {
|
|
||||||
"NSPhotoLibraryAddUsageDescription": "此App会在上传头像图片服务中访问您的相机权限",
|
|
||||||
"NSPhotoLibraryUsageDescription": "此App会在上传头像图片服务中访问您的相机权限",
|
|
||||||
"NSCameraUsageDescription": "此App会在上传头像图片服务中访问您的相机权限",
|
|
||||||
"NSMicrophoneUsageDescription": "此APP会在使用声音识别服务中使用您的麦克风权限",
|
|
||||||
"NSLocationWhenInUseUsageDescription": "此App会在使用导航服务中使用您的定位权限",
|
|
||||||
"NSLocationAlwaysUsageDescription": "此App会在使用导航服务中使用您的定位权限",
|
|
||||||
"NSLocationAlwaysAndWhenInUseUsageDescription": "此App会在使用导航服务中使用您的定位权限"
|
|
||||||
},
|
},
|
||||||
"dSYMs": false,
|
/* 模块配置 */
|
||||||
"UIBackgroundModes": "audio"
|
"modules" : {
|
||||||
},
|
"Maps" : {},
|
||||||
/* SDK配置 */
|
"Camera" : {},
|
||||||
"sdkConfigs": {
|
"Record" : {},
|
||||||
"maps": {},
|
"VideoPlayer" : {},
|
||||||
"push": {
|
"UIWebview" : {},
|
||||||
"unipush": {
|
"Push" : {}
|
||||||
"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",
|
"distribute" : {
|
||||||
"ipad": {
|
/* android打包配置 */
|
||||||
"app": "unpackage/res/icons/76x76.png",
|
"android" : {
|
||||||
"app@2x": "unpackage/res/icons/152x152.png",
|
"targetSdkVersion" : 30,
|
||||||
"notification": "unpackage/res/icons/20x20.png",
|
"minSdkVersion" : 21,
|
||||||
"notification@2x": "unpackage/res/icons/40x40.png",
|
"compileSdkVersion" : 30,
|
||||||
"proapp@2x": "unpackage/res/icons/167x167.png",
|
"permissions" : [
|
||||||
"settings": "unpackage/res/icons/29x29.png",
|
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
|
||||||
"settings@2x": "unpackage/res/icons/58x58.png",
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
"spotlight": "unpackage/res/icons/40x40.png",
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
"spotlight@2x": "unpackage/res/icons/80x80.png"
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
},
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
"iphone": {
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
"app@2x": "unpackage/res/icons/120x120.png",
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
"app@3x": "unpackage/res/icons/180x180.png",
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
"notification@2x": "unpackage/res/icons/40x40.png",
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
"notification@3x": "unpackage/res/icons/60x60.png",
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
"settings@2x": "unpackage/res/icons/58x58.png",
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
"settings@3x": "unpackage/res/icons/87x87.png",
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
"spotlight@2x": "unpackage/res/icons/80x80.png",
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
"spotlight@3x": "unpackage/res/icons/120x120.png"
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
}
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
/* ios打包配置 */
|
||||||
|
"ios" : {
|
||||||
|
"privacyDescription" : {
|
||||||
|
"NSPhotoLibraryAddUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限",
|
||||||
|
"NSPhotoLibraryUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限",
|
||||||
|
"NSCameraUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限",
|
||||||
|
"NSMicrophoneUsageDescription" : "此APP会在使用声音识别服务中使用您的麦克风权限",
|
||||||
|
"NSLocationWhenInUseUsageDescription" : "此App会在使用导航服务中使用您的定位权限",
|
||||||
|
"NSLocationAlwaysUsageDescription" : "此App会在使用导航服务中使用您的定位权限",
|
||||||
|
"NSLocationAlwaysAndWhenInUseUsageDescription" : "此App会在使用导航服务中使用您的定位权限"
|
||||||
|
},
|
||||||
|
"dSYMs" : false,
|
||||||
|
"UIBackgroundModes" : "audio"
|
||||||
|
},
|
||||||
|
/* 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
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"splashscreen": {
|
|
||||||
"androidStyle": "default",
|
|
||||||
"useOriginalMsgbox": true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"uniStatistics": {
|
/* 快应用特有相关 */
|
||||||
"enable": true
|
"quickapp" : {},
|
||||||
}
|
/* 小程序特有相关 */
|
||||||
},
|
"mp-weixin" : {
|
||||||
/* 快应用特有相关 */
|
"appid" : "",
|
||||||
"quickapp": {},
|
"setting" : {
|
||||||
/* 小程序特有相关 */
|
"urlCheck" : false
|
||||||
"mp-weixin": {
|
},
|
||||||
"appid": "",
|
"usingComponents" : true
|
||||||
"setting": {
|
|
||||||
"urlCheck": false
|
|
||||||
},
|
},
|
||||||
"usingComponents": true
|
"h5" : {
|
||||||
},
|
// "devServer" : {
|
||||||
"h5": {
|
// "https" : true,
|
||||||
// "devServer" : {
|
// "host" : "127.0.0.1",
|
||||||
// "https" : true,
|
// "port" : 8080,
|
||||||
// "host" : "127.0.0.1",
|
// "disableHostCheck" : true,
|
||||||
// "port" : 8080,
|
// "proxy" : {
|
||||||
// "disableHostCheck" : true,
|
// "/place/v2/suggestion" : {
|
||||||
// "proxy" : {
|
// "target" : "https://api.map.baidu.com",
|
||||||
// "/place/v2/suggestion" : {
|
// "changeOrigin" : true,
|
||||||
// "target" : "https://api.map.baidu.com",
|
// "secure" : false
|
||||||
// "changeOrigin" : true,
|
// },
|
||||||
// "secure" : false
|
// "/admin/shop/shop-base-product-category/list" : {
|
||||||
// },
|
// "target" : "https://mall.gpxscs.cn",
|
||||||
// "/admin/shop/shop-base-product-category/list" : {
|
// "changeOrigin" : true
|
||||||
// "target" : "https://mall.gpxscs.cn",
|
// }
|
||||||
// "changeOrigin" : true
|
// }
|
||||||
// }
|
// },
|
||||||
// }
|
"title" : "小发商城商家中心",
|
||||||
// },
|
"template" : "index.html",
|
||||||
"title": "小发商城商家中心",
|
"router" : {
|
||||||
"template": "index.html",
|
"mode" : "history",
|
||||||
"router": {
|
"base" : "/mchapp/"
|
||||||
"mode": "history",
|
}
|
||||||
"base": "/mchapp/"
|
},
|
||||||
}
|
"mp-alipay" : {
|
||||||
},
|
"usingComponents" : true
|
||||||
"mp-alipay": {
|
},
|
||||||
"usingComponents": true
|
"mp-baidu" : {
|
||||||
},
|
"usingComponents" : true
|
||||||
"mp-baidu": {
|
},
|
||||||
"usingComponents": true
|
"mp-toutiao" : {
|
||||||
},
|
"usingComponents" : true
|
||||||
"mp-toutiao": {
|
},
|
||||||
"usingComponents": true
|
"uniStatistics" : {
|
||||||
},
|
"enable" : false,
|
||||||
"uniStatistics": {
|
"version" : "2"
|
||||||
"enable": false,
|
},
|
||||||
"version": "2"
|
"vueVersion" : "2",
|
||||||
},
|
"fallbackLocale" : "zh-Hans"
|
||||||
"vueVersion": "2",
|
|
||||||
"fallbackLocale": "zh-Hans"
|
|
||||||
}
|
}
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
|
|
||||||
|
|||||||
@ -465,6 +465,12 @@ import {
|
|||||||
GetInitiativeOrderRefund,
|
GetInitiativeOrderRefund,
|
||||||
GetOrderPicking,
|
GetOrderPicking,
|
||||||
} from "@/api/order";
|
} from "@/api/order";
|
||||||
|
|
||||||
|
import {
|
||||||
|
makePhoneCall,
|
||||||
|
} from "@/utils/callPhone";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
orderItem: {
|
orderItem: {
|
||||||
@ -656,24 +662,27 @@ export default {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
makePhone(phone) {
|
makePhone(phone) {
|
||||||
// #ifdef H5
|
console.log(makePhoneCall);
|
||||||
uni.showToast({
|
|
||||||
title: "H5环境不支持",
|
makePhoneCall(phone)
|
||||||
icon: "none",
|
// // #ifdef H5
|
||||||
});
|
// uni.showToast({
|
||||||
// #endif
|
// title: "H5环境不支持",
|
||||||
|
// icon: "none",
|
||||||
|
// });
|
||||||
|
// // #endif
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// // #ifdef APP-PLUS
|
||||||
uni.makePhoneCall({
|
// uni.makePhoneCall({
|
||||||
phoneNumber: phone,
|
// phoneNumber: phone,
|
||||||
success: function () {
|
// success: function () {
|
||||||
console.log("拨打电话成功");
|
// console.log("拨打电话成功");
|
||||||
},
|
// },
|
||||||
fail: function () {
|
// fail: function () {
|
||||||
console.log("拨打电话失败");
|
// console.log("拨打电话失败");
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
// #endif
|
// // #endif
|
||||||
},
|
},
|
||||||
copy(num, type) {
|
copy(num, type) {
|
||||||
uni.setClipboardData({
|
uni.setClipboardData({
|
||||||
|
|||||||
@ -280,6 +280,12 @@ import {
|
|||||||
} from "@/api/order";
|
} from "@/api/order";
|
||||||
import tuiRadio from "@/components/tui-radio/tui-radio.vue";
|
import tuiRadio from "@/components/tui-radio/tui-radio.vue";
|
||||||
import tuiRadioGroup from "@/components/tui-radio-group/tui-radio-group.vue";
|
import tuiRadioGroup from "@/components/tui-radio-group/tui-radio-group.vue";
|
||||||
|
|
||||||
|
import {
|
||||||
|
makePhoneCall,
|
||||||
|
} from "@/utils/callPhone";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
orderItem: {
|
orderItem: {
|
||||||
@ -468,24 +474,25 @@ export default {
|
|||||||
this.returnOrderType = type;
|
this.returnOrderType = type;
|
||||||
},
|
},
|
||||||
makePhone(phone) {
|
makePhone(phone) {
|
||||||
// #ifdef H5
|
makePhoneCall(phone)
|
||||||
uni.showToast({
|
// // #ifdef H5
|
||||||
title: "H5环境不支持",
|
// uni.showToast({
|
||||||
icon: "none",
|
// title: "H5环境不支持",
|
||||||
});
|
// icon: "none",
|
||||||
// #endif
|
// });
|
||||||
|
// // #endif
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// // #ifdef APP-PLUS
|
||||||
uni.makePhoneCall({
|
// uni.makePhoneCall({
|
||||||
phoneNumber: phone,
|
// phoneNumber: phone,
|
||||||
success: function () {
|
// success: function () {
|
||||||
console.log("拨打电话成功");
|
// console.log("拨打电话成功");
|
||||||
},
|
// },
|
||||||
fail: function () {
|
// fail: function () {
|
||||||
console.log("拨打电话失败");
|
// console.log("拨打电话失败");
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
// #endif
|
// // #endif
|
||||||
},
|
},
|
||||||
copy(num, type) {
|
copy(num, type) {
|
||||||
uni.setClipboardData({
|
uni.setClipboardData({
|
||||||
|
|||||||
90
java-mall-app-shop-admin/utils/callPhone.js
Normal file
90
java-mall-app-shop-admin/utils/callPhone.js
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
// 动态请求打电话权限(通用方法)
|
||||||
|
export function requestCallPermission() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (uni.getSystemInfoSync().platform !== 'android') {
|
||||||
|
// 非安卓设备直接返回(如iOS不需要此权限)
|
||||||
|
resolve(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
plus.android.requestPermissions(
|
||||||
|
["android.permission.CALL_PHONE"],
|
||||||
|
(result) => {
|
||||||
|
const granted = result.granted || [];
|
||||||
|
const deniedAlways = result.deniedAlways || [];
|
||||||
|
|
||||||
|
if (granted.includes("android.permission.CALL_PHONE")) {
|
||||||
|
resolve(true);
|
||||||
|
} else if (deniedAlways.length > 0) {
|
||||||
|
// 永久拒绝,引导至设置页
|
||||||
|
uni.showModal({
|
||||||
|
title: "权限不足",
|
||||||
|
content: "请在设置中开启电话权限以使用拨号功能",
|
||||||
|
confirmText: "去设置",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
plus.runtime.openURL("app-settings:");
|
||||||
|
}
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 临时拒绝,提示用户
|
||||||
|
uni.showToast({ title: "需要电话权限才能拨号", icon: "none" });
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
console.error("权限请求失败:", err);
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否为华为设备
|
||||||
|
export function isHuaweiDevice() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: (res) => {
|
||||||
|
const brand = (res.brand || '').toLowerCase();
|
||||||
|
resolve(brand.includes('huawei'));
|
||||||
|
},
|
||||||
|
fail: () => resolve(false)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 统一拨号入口(根据设备类型选择方式)
|
||||||
|
export async function makePhoneCall(phoneNumber) {
|
||||||
|
if (!phoneNumber) {
|
||||||
|
uni.showToast({ title: "请输入正确的手机号", icon: "none" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先请求权限
|
||||||
|
const hasPermission = await requestCallPermission();
|
||||||
|
if (!hasPermission) return;
|
||||||
|
|
||||||
|
// 判断设备类型
|
||||||
|
const isHuawei = await isHuaweiDevice();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (isHuawei) {
|
||||||
|
// 华为设备使用plus原生API,显示拨号界面(避免直接拨号失败)
|
||||||
|
plus.device.dial(phoneNumber, false);
|
||||||
|
} else {
|
||||||
|
// 其他设备使用uni标准API
|
||||||
|
uni.makePhoneCall({
|
||||||
|
phoneNumber: phoneNumber,
|
||||||
|
fail: (err) => {
|
||||||
|
console.error("拨号失败:", err);
|
||||||
|
uni.showToast({ title: "拨号失败,请重试", icon: "none" });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("拨号异常:", err);
|
||||||
|
uni.showToast({ title: "系统不支持该操作", icon: "none" });
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user