feat: 兼容处理
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { onShow } from "@dcloudio/uni-app";
|
import { onShow } from "@dcloudio/uni-app";
|
||||||
|
|
||||||
const showPrivacy = ref(true);
|
const showPrivacy = ref(false);
|
||||||
const privacyContractName = ref("隐私保护指引");
|
const privacyContractName = ref("隐私保护指引");
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
@@ -41,9 +41,9 @@ onShow(() => {
|
|||||||
wx.getPrivacySetting({
|
wx.getPrivacySetting({
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log("cj隐私配置", res);
|
console.log("cj隐私配置", res);
|
||||||
if (res.errMsg == "getPrivacySetting:ok" && res.needAuthorization) {
|
if (res.errMsg == "getPrivacySetting:ok") {
|
||||||
privacyContractName.value = res.privacyContractName;
|
privacyContractName.value = res.privacyContractName;
|
||||||
showPrivacy.value = res.needAuthorization;
|
showPrivacy.value = !!res.needAuthorization;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -54,6 +54,7 @@ onShow(() => {
|
|||||||
uni.getPrivacySetting({
|
uni.getPrivacySetting({
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
showPrivacy.value = !!res.needAuthorization;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// #endif
|
// #endif
|
||||||
|
|||||||
@@ -298,6 +298,7 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
|
|||||||
// 在发起微信支付前关闭 loading(避免与原生支付 UI 冲突)
|
// 在发起微信支付前关闭 loading(避免与原生支付 UI 冲突)
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
// 调用微信支付
|
// 调用微信支付
|
||||||
uni.requestPayment({
|
uni.requestPayment({
|
||||||
provider: "wxpay",
|
provider: "wxpay",
|
||||||
@@ -322,6 +323,15 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
|
|||||||
uni.showToast({ title: "支付失败,请重试", icon: "none" });
|
uni.showToast({ title: "支付失败,请重试", icon: "none" });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "支付功能开发中",
|
||||||
|
showCancel: false,
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
}, 1000);
|
}, 1000);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ const handleButtonClick = DebounceUtils.createDebounce(async (orderData) => {
|
|||||||
// 在发起微信支付前关闭 loading(避免与原生支付 UI 冲突)
|
// 在发起微信支付前关闭 loading(避免与原生支付 UI 冲突)
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
// 调用微信支付
|
// 调用微信支付
|
||||||
uni.requestPayment({
|
uni.requestPayment({
|
||||||
provider: "wxpay",
|
provider: "wxpay",
|
||||||
@@ -133,6 +134,15 @@ const handleButtonClick = DebounceUtils.createDebounce(async (orderData) => {
|
|||||||
uni.showToast({ title: "支付失败,请重试", icon: "none" });
|
uni.showToast({ title: "支付失败,请重试", icon: "none" });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "支付功能开发中",
|
||||||
|
showCancel: false,
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("操作失败:", error);
|
console.error("操作失败:", error);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export const updateManager = () => {
|
export const updateManager = () => {
|
||||||
|
// #ifdef MP-WEIXIN || MP-TOUTIAO
|
||||||
const updateManager = uni.getUpdateManager();
|
const updateManager = uni.getUpdateManager();
|
||||||
|
|
||||||
// 当向小程序后台请求完新版本信息,会进行回调
|
// 当向小程序后台请求完新版本信息,会进行回调
|
||||||
@@ -22,4 +23,5 @@ export const updateManager = () => {
|
|||||||
|
|
||||||
// 当新版本下载失败,会进行回调
|
// 当新版本下载失败,会进行回调
|
||||||
updateManager.onUpdateFailed(() => {});
|
updateManager.onUpdateFailed(() => {});
|
||||||
|
// #endif
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user