【代码优化】SYSTEM:微信小程序的订阅
parent
ececc6f67c
commit
7f5970d741
|
@ -184,7 +184,7 @@
|
||||||
"versionCode": 100
|
"versionCode": 100
|
||||||
},
|
},
|
||||||
"mp-weixin": {
|
"mp-weixin": {
|
||||||
"appid": "wx63c280fe3248a3e7",
|
"appid": "wx66186af0759f47c9",
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false,
|
"urlCheck": false,
|
||||||
"minified": true,
|
"minified": true,
|
||||||
|
@ -236,4 +236,4 @@
|
||||||
"_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639",
|
"_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639",
|
||||||
"locale": "zh-Hans",
|
"locale": "zh-Hans",
|
||||||
"fallbackLocale": "zh-Hans"
|
"fallbackLocale": "zh-Hans"
|
||||||
}
|
}
|
|
@ -146,7 +146,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function onOrder() {
|
function onOrder() {
|
||||||
// TODO 芋艿:待测试
|
|
||||||
if (state.orderType === 'recharge') {
|
if (state.orderType === 'recharge') {
|
||||||
sheep.$router.redirect('/pages/pay/recharge-log');
|
sheep.$router.redirect('/pages/pay/recharge-log');
|
||||||
} else {
|
} else {
|
||||||
|
@ -154,12 +153,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 芋艿:待测试
|
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
const showSubscribeBtn = ref(false) // 默认隐藏
|
const showSubscribeBtn = ref(false) // 默认隐藏
|
||||||
const SUBSCRIBE_BTN_STATUS_STORAGE_KEY = "subscribe_btn_status"
|
const SUBSCRIBE_BTN_STATUS_STORAGE_KEY = "subscribe_btn_status"
|
||||||
function subscribeMessage() {
|
function subscribeMessage() {
|
||||||
let event = [WxaSubscribeTemplate.TRADE_ORDER_DELIVERY];
|
if (state.orderType !== 'goods') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const event = [WxaSubscribeTemplate.TRADE_ORDER_DELIVERY];
|
||||||
if (state.tradeOrder.type === 3) {
|
if (state.tradeOrder.type === 3) {
|
||||||
event.push(WxaSubscribeTemplate.PROMOTION_COMBINATION_SUCCESS);
|
event.push(WxaSubscribeTemplate.PROMOTION_COMBINATION_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,28 @@ const SocialApi = {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 获取订阅消息模板列表
|
||||||
|
getSubscribeTemplateList: () =>
|
||||||
|
request({
|
||||||
|
url: '/member/social-user/get-subscribe-template-list',
|
||||||
|
method: 'GET',
|
||||||
|
custom: {
|
||||||
|
showError: false,
|
||||||
|
showLoading: false,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
// 获取微信小程序码
|
||||||
|
getWxaQrcode: async (path, query) => {
|
||||||
|
return await request({
|
||||||
|
url: '/member/social-user/wxa-qrcode',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
scene: query,
|
||||||
|
path,
|
||||||
|
checkPath: false, // TODO 开发环境暂不检查 path 是否存在
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SocialApi;
|
export default SocialApi;
|
|
@ -1,34 +1,6 @@
|
||||||
import request from '@/sheep/request';
|
import request from '@/sheep/request';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// 微信相关
|
|
||||||
wechat: {
|
|
||||||
// 小程序订阅消息
|
|
||||||
getSubscribeTemplateList: () =>
|
|
||||||
request({
|
|
||||||
url: '/member/social-user/get-subscribe-template-list',
|
|
||||||
method: 'GET',
|
|
||||||
custom: {
|
|
||||||
showError: false,
|
|
||||||
showLoading: false,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
|
|
||||||
// 获取微信小程序码
|
|
||||||
// TODO @puhui999:这个接口,挪到 /Users/yunai/Java/yudao-mall-uniapp/sheep/api/member/social.js
|
|
||||||
getWxacode: async (path, query) => {
|
|
||||||
return await request({
|
|
||||||
url: '/member/social-user/wxa-qrcode',
|
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
scene: query,
|
|
||||||
path,
|
|
||||||
checkPath: false, // TODO 开发环境暂不检查 path 是否存在
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// 苹果相关
|
// 苹果相关
|
||||||
apple: {
|
apple: {
|
||||||
// 第三方登录
|
// 第三方登录
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import user from './user';
|
import user from './user';
|
||||||
import goods from './goods';
|
import goods from './goods';
|
||||||
import groupon from './groupon';
|
import groupon from './groupon';
|
||||||
import third from '@/sheep/api/migration/third';
|
import SocialApi from '@/sheep/api/member/social';
|
||||||
|
|
||||||
export function getPosterData(options) {
|
export function getPosterData(options) {
|
||||||
switch (options.shareInfo.poster.type) {
|
switch (options.shareInfo.poster.type) {
|
||||||
|
@ -34,6 +34,6 @@ export function formatImageUrlProtocol(url) {
|
||||||
|
|
||||||
// 获得微信小程序码 (Base64 image)
|
// 获得微信小程序码 (Base64 image)
|
||||||
export async function getWxaQrcode(path, query) {
|
export async function getWxaQrcode(path, query) {
|
||||||
const res = await third.wechat.getWxacode(path, query);
|
const res = await SocialApi.getWxaQrcode(path, query);
|
||||||
return 'data:image/png;base64,' + res.data;
|
return 'data:image/png;base64,' + res.data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import third from '@/sheep/api/migration/third';
|
|
||||||
import AuthUtil from '@/sheep/api/member/auth';
|
import AuthUtil from '@/sheep/api/member/auth';
|
||||||
import SocialApi from '@/sheep/api/member/social';
|
import SocialApi from '@/sheep/api/member/social';
|
||||||
import UserApi from '@/sheep/api/member/user';
|
import UserApi from '@/sheep/api/member/user';
|
||||||
|
@ -164,7 +163,7 @@ const checkUpdate = async (silence = true) => {
|
||||||
|
|
||||||
// 获取订阅消息模板
|
// 获取订阅消息模板
|
||||||
async function getSubscribeTemplate() {
|
async function getSubscribeTemplate() {
|
||||||
const { code, data } = await third.wechat.getSubscribeTemplateList();
|
const { code, data } = await SocialApi.getSubscribeTemplateList();
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
subscribeEventList = data;
|
subscribeEventList = data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue