feat(mini): 下单/提现/报名前补订阅消息授权(提升微信服务通知到达率)
- 新增 common/subscribe.js:页面预加载模板ID + 点击动作中同步请求授权(避免 await 丢失手势上下文) - 下单支付前请求订单状态/核销码模板;提现前请求到账模板;组局报名确认后请求报名模板 - 自动过滤 tmpl_ 占位模板;授权失败不阻塞业务 - 新增回归护栏 subscribe-authorization.spec.ts(80 套件/615 用例全绿)
这个提交包含在:
@@ -423,6 +423,7 @@ import {
|
||||
import { ICONS } from '@/common/icons.js';
|
||||
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
|
||||
import { ensureLoginOrRedirect } from '@/common/role.js';
|
||||
import { preloadSubscribeTemplates, requestSubscribeFor } from '@/common/subscribe.js';
|
||||
|
||||
const currentUserId = computed(() => {
|
||||
try {
|
||||
@@ -465,6 +466,7 @@ onMounted(() => {
|
||||
currentThemeKey.value = getCurrentThemeKey();
|
||||
applyThemeToNativeUI(currentThemeKey.value);
|
||||
uni.$on('theme-change', onThemeChanged);
|
||||
preloadSubscribeTemplates();
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
@@ -846,6 +848,8 @@ const handleJoin = () => {
|
||||
confirmColor: '#6366F1',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
// 报名前请求一次性订阅授权(组局报名通知)
|
||||
requestSubscribeFor('activity');
|
||||
uni.showLoading({ title: '正在报名生成核销码...' });
|
||||
let code = '8392';
|
||||
try {
|
||||
|
||||
@@ -240,6 +240,7 @@
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { createOrder, payOrder as payOrderApi, requestWechatPayment, getCompanionDetail, getUserProfile, getMarketingCoupons } from '@/common/api.js';
|
||||
import { preloadSubscribeTemplates, requestSubscribeFor } from '@/common/subscribe.js';
|
||||
import { ICONS } from '@/common/icons.js';
|
||||
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
|
||||
import { ensureLoginOrRedirect } from '@/common/role.js';
|
||||
@@ -260,6 +261,7 @@ onMounted(() => {
|
||||
applyThemeToNativeUI(currentThemeKey.value);
|
||||
uni.$on('theme-change', onThemeChanged);
|
||||
loadUserWallet();
|
||||
preloadSubscribeTemplates();
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
@@ -463,6 +465,8 @@ const handlePay = async () => {
|
||||
if (!ensureLoginOrRedirect('/pages/order/create')) {
|
||||
return;
|
||||
}
|
||||
// 下单/支付前请求一次性订阅授权(订单状态 + 核销码通知)
|
||||
requestSubscribeFor('order');
|
||||
if (payMethod.value === 'BALANCE' && Number(userBalance.value) < finalTotal.value) {
|
||||
selectBalancePay();
|
||||
return;
|
||||
|
||||
@@ -184,6 +184,7 @@ import { onShow } from '@dcloudio/uni-app';
|
||||
import { ICONS } from '@/common/icons.js';
|
||||
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
|
||||
import { getNavBarInfo } from '@/common/nav.js';
|
||||
import { preloadSubscribeTemplates, requestSubscribeFor } from '@/common/subscribe.js';
|
||||
import {
|
||||
getUserProfile,
|
||||
withdrawCommission,
|
||||
@@ -342,6 +343,8 @@ const handleSubmitWithdraw = async () => {
|
||||
|
||||
isSubmitting.value = true;
|
||||
uni.showLoading({ title: '正在提交申请...' });
|
||||
// 提现前请求一次性订阅授权(提现到账通知)
|
||||
requestSubscribeFor('withdraw');
|
||||
|
||||
try {
|
||||
const payload = {
|
||||
@@ -389,6 +392,7 @@ onMounted(() => {
|
||||
currentThemeKey.value = getCurrentThemeKey();
|
||||
applyThemeToNativeUI(currentThemeKey.value);
|
||||
loadPageData();
|
||||
preloadSubscribeTemplates();
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
|
||||
在新工单中引用
屏蔽一个用户