Merge branch 'downey' of https://gitee.com/downeyin/yudao-mall-uniapp into develop
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { baseUrl, apiPath } from '@/sheep/config';
|
||||
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
|
||||
|
||||
const FileApi = {
|
||||
// 上传文件
|
||||
@@ -15,8 +15,8 @@ const FileApi = {
|
||||
name: 'file',
|
||||
header: {
|
||||
// Accept: 'text/json',
|
||||
Accept : '*/*',
|
||||
'tenant-id' :'1',
|
||||
Accept: '*/*',
|
||||
'tenant-id': tenantId,
|
||||
// Authorization: 'Bearer test247',
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
|
||||
@@ -4,13 +4,10 @@ export default {
|
||||
// 微信相关
|
||||
wechat: {
|
||||
// 小程序订阅消息
|
||||
subscribeTemplate: (params) =>
|
||||
subscribeTemplate: () =>
|
||||
request({
|
||||
url: 'third/wechat/subscribeTemplate',
|
||||
url: '/member/social-user/get-subscribe-template',
|
||||
method: 'GET',
|
||||
params: {
|
||||
platform: 'miniProgram',
|
||||
},
|
||||
custom: {
|
||||
showError: false,
|
||||
showLoading: false,
|
||||
|
||||
@@ -11,10 +11,13 @@ console.log(`[芋道商城 ${version}] http://doc.iocoder.cn`);
|
||||
|
||||
export const apiPath = import.meta.env.SHOPRO_API_PATH;
|
||||
export const staticUrl = import.meta.env.SHOPRO_STATIC_URL;
|
||||
export const tenantId = import.meta.env.SHOPRO_TENANT_ID;
|
||||
export const websocketPath = import.meta.env.SHOPRO_WEBSOCKET_PATH;
|
||||
|
||||
export default {
|
||||
baseUrl,
|
||||
apiPath,
|
||||
staticUrl,
|
||||
websocketPath
|
||||
tenantId,
|
||||
websocketPath,
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import third from '@/sheep/api/migration/third'
|
||||
import third from '@/sheep/api/migration/third';
|
||||
import AuthUtil from '@/sheep/api/member/auth';
|
||||
import SocialApi from '@/sheep/api/member/social';
|
||||
import UserApi from '@/sheep/api/member/user';
|
||||
@@ -128,14 +128,14 @@ async function getInfo() {
|
||||
const checkUpdate = async (silence = true) => {
|
||||
if (uni.canIUse('getUpdateManager')) {
|
||||
const updateManager = uni.getUpdateManager();
|
||||
updateManager.onCheckForUpdate(function (res) {
|
||||
updateManager.onCheckForUpdate(function(res) {
|
||||
// 请求完新版本信息的回调
|
||||
if (res.hasUpdate) {
|
||||
updateManager.onUpdateReady(function () {
|
||||
updateManager.onUpdateReady(function() {
|
||||
uni.showModal({
|
||||
title: '更新提示',
|
||||
content: '新版本已经准备好,是否重启应用?',
|
||||
success: function (res) {
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate();
|
||||
@@ -143,7 +143,7 @@ const checkUpdate = async (silence = true) => {
|
||||
},
|
||||
});
|
||||
});
|
||||
updateManager.onUpdateFailed(function () {
|
||||
updateManager.onUpdateFailed(function() {
|
||||
// 新的版本下载失败
|
||||
// uni.showModal({
|
||||
// title: '已经有新版本了哟~',
|
||||
@@ -164,8 +164,8 @@ const checkUpdate = async (silence = true) => {
|
||||
|
||||
// 获取订阅消息模板
|
||||
async function getSubscribeTemplate() {
|
||||
const { error, data } = await third.wechat.subscribeTemplate();
|
||||
if (error === 0) {
|
||||
const { code, data } = await third.wechat.subscribeTemplate();
|
||||
if (code === 0) {
|
||||
subscribeEventList = data;
|
||||
}
|
||||
}
|
||||
@@ -174,11 +174,17 @@ async function getSubscribeTemplate() {
|
||||
function subscribeMessage(event) {
|
||||
let tmplIds = [];
|
||||
if (typeof event === 'string') {
|
||||
tmplIds.push(subscribeEventList[event]);
|
||||
const temp = subscribeEventList.find(item => item.title.includes(event));
|
||||
if (temp) {
|
||||
tmplIds.push(temp.priTmplId);
|
||||
}
|
||||
}
|
||||
if (typeof event === 'object') {
|
||||
event.forEach((item) => {
|
||||
if (typeof subscribeEventList[item] !== 'undefined') tmplIds.push(subscribeEventList[item]);
|
||||
event.forEach((e) => {
|
||||
const temp = subscribeEventList.find(item => item.title.includes(e));
|
||||
if (temp) {
|
||||
tmplIds.push(temp.priTmplId);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (tmplIds.length === 0) return;
|
||||
@@ -201,5 +207,5 @@ export default {
|
||||
getInfo,
|
||||
getOpenid,
|
||||
subscribeMessage,
|
||||
checkUpdate
|
||||
checkUpdate,
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import Request from 'luch-request';
|
||||
import { baseUrl, apiPath } from '@/sheep/config';
|
||||
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
|
||||
import $store from '@/sheep/store';
|
||||
import $platform from '@/sheep/platform';
|
||||
import {
|
||||
@@ -96,8 +96,8 @@ http.interceptors.request.use(
|
||||
config.header['Authorization'] = token;
|
||||
}
|
||||
// TODO 芋艿:特殊处理
|
||||
config.header['Accept'] = '*/*'
|
||||
config.header['tenant-id'] = '1';
|
||||
config.header['Accept'] = '*/*';
|
||||
config.header['tenant-id'] = tenantId;
|
||||
config.header['terminal'] = '20';
|
||||
// config.header['Authorization'] = 'Bearer test247';
|
||||
return config;
|
||||
@@ -299,4 +299,4 @@ const request = (config) => {
|
||||
return http.middleware(config);
|
||||
};
|
||||
|
||||
export default request;
|
||||
export default request;
|
||||
|
||||
@@ -56,6 +56,13 @@ export const TimeStatusEnum = {
|
||||
END: '已结束',
|
||||
}
|
||||
|
||||
// TODO 订阅模版枚举
|
||||
export const SubscribeTemplate = {
|
||||
ORDER_AFTERSALE_CHANGE: "售后进度通知",
|
||||
MONEY_CHANGE: "充值成功通知"
|
||||
}
|
||||
|
||||
|
||||
export const getTimeStatusEnum = (startTime, endTime) => {
|
||||
const now = dayjs();
|
||||
if (now.isBefore(startTime)) {
|
||||
|
||||
Reference in New Issue
Block a user