!134 缺陷修复

Merge pull request !134 from puhui999/dev
pull/135/MERGE
芋道源码 2025-01-17 12:19:26 +00:00 committed by Gitee
commit 11e83df02f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
12 changed files with 97 additions and 55 deletions

View File

@ -209,6 +209,7 @@
import { isEmpty } from 'lodash-es'; import { isEmpty } from 'lodash-es';
import CombinationApi from '@/sheep/api/promotion/combination'; import CombinationApi from '@/sheep/api/promotion/combination';
import SpuApi from '@/sheep/api/product/spu'; import SpuApi from '@/sheep/api/product/spu';
import { SharePageEnum } from '@/sheep/util/const';
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png'); const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2; const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
@ -234,7 +235,7 @@
image: sheep.$url.cdn(state.data.headRecord.picUrl), image: sheep.$url.cdn(state.data.headRecord.picUrl),
desc: state.data.goods?.subtitle, desc: state.data.goods?.subtitle,
params: { params: {
page: '5', page: SharePageEnum.GROUPON_DETAIL.value,
query: state.data.headRecord.id, query: state.data.headRecord.id,
}, },
}, },

View File

@ -23,11 +23,13 @@
import commissionMenu from './components/commission-menu.vue'; import commissionMenu from './components/commission-menu.vue';
import commissionAuth from './components/commission-auth.vue'; import commissionAuth from './components/commission-auth.vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
import { SharePageEnum } from '@/sheep/util/const';
/** 分销邀请 */
const shareInfo = computed(() => { const shareInfo = computed(() => {
return sheep.$platform.share.getShareInfo({ return sheep.$platform.share.getShareInfo({
params: { params: {
page: '6', page: SharePageEnum.HOME.value, //
}, },
}, { }, {
type: 'user', type: 'user',

View File

@ -159,6 +159,7 @@
import { useDurationTime, formatGoodsSwiper, fen2yuan } from '@/sheep/hooks/useGoods'; import { useDurationTime, formatGoodsSwiper, fen2yuan } from '@/sheep/hooks/useGoods';
import CombinationApi from '@/sheep/api/promotion/combination'; import CombinationApi from '@/sheep/api/promotion/combination';
import SpuApi from '@/sheep/api/product/spu'; import SpuApi from '@/sheep/api/product/spu';
import { SharePageEnum } from '@/sheep/util/const';
const headerBg = sheep.$url.css('/static/img/shop/goods/groupon-bg.png'); const headerBg = sheep.$url.css('/static/img/shop/goods/groupon-bg.png');
const btnBg = sheep.$url.css('/static/img/shop/goods/groupon-btn.png'); const btnBg = sheep.$url.css('/static/img/shop/goods/groupon-btn.png');
@ -239,7 +240,7 @@
title: state.activity.name, title: state.activity.name,
image: sheep.$url.cdn(state.goodsInfo.picUrl), image: sheep.$url.cdn(state.goodsInfo.picUrl),
params: { params: {
page: '3', page: SharePageEnum.GROUPON.value,
query: state.activity.id, query: state.activity.id,
}, },
}, },

View File

@ -234,6 +234,7 @@
import countDown from '@/sheep/components/countDown/index.vue'; import countDown from '@/sheep/components/countDown/index.vue';
import OrderApi from '@/sheep/api/trade/order'; import OrderApi from '@/sheep/api/trade/order';
import activity from '@/sheep/api/promotion/activity'; import activity from '@/sheep/api/promotion/activity';
import { SharePageEnum } from '@/sheep/util/const';
const bgColor = { const bgColor = {
bgColor: '#E93323', bgColor: '#E93323',
@ -318,7 +319,7 @@
image: sheep.$url.cdn(state.goodsInfo.picUrl), image: sheep.$url.cdn(state.goodsInfo.picUrl),
desc: state.goodsInfo.introduction, desc: state.goodsInfo.introduction,
params: { params: {
page: '2', page: SharePageEnum.GOODS.value,
query: state.goodsInfo.id, query: state.goodsInfo.id,
}, },
}, },

View File

@ -129,7 +129,7 @@
import detailCommentCard from './components/detail/detail-comment-card.vue'; import detailCommentCard from './components/detail/detail-comment-card.vue';
import detailContentCard from './components/detail/detail-content-card.vue'; import detailContentCard from './components/detail/detail-content-card.vue';
import SpuApi from '@/sheep/api/product/spu'; import SpuApi from '@/sheep/api/product/spu';
import { PromotionActivityTypeEnum } from '@/sheep/util/const'; import { PromotionActivityTypeEnum, SharePageEnum } from '@/sheep/util/const';
import PointApi from '@/sheep/api/promotion/point'; import PointApi from '@/sheep/api/promotion/point';
const headerBg = sheep.$url.css('/static/img/shop/goods/score-bg.png'); const headerBg = sheep.$url.css('/static/img/shop/goods/score-bg.png');
@ -180,8 +180,7 @@
title: activity.value.name, title: activity.value.name,
image: sheep.$url.cdn(state.goodsInfo.picUrl), image: sheep.$url.cdn(state.goodsInfo.picUrl),
params: { params: {
// TODO @puhuipage page: SharePageEnum.POINT.value,
page: '6',
query: activity.value.id, query: activity.value.id,
}, },
}, },

View File

@ -151,7 +151,7 @@
import detailProgress from './components/detail/detail-progress.vue'; import detailProgress from './components/detail/detail-progress.vue';
import SeckillApi from '@/sheep/api/promotion/seckill'; import SeckillApi from '@/sheep/api/promotion/seckill';
import SpuApi from '@/sheep/api/product/spu'; import SpuApi from '@/sheep/api/product/spu';
import { getTimeStatusEnum, TimeStatusEnum } from '@/sheep/util/const'; import { getTimeStatusEnum, SharePageEnum, TimeStatusEnum } from '@/sheep/util/const';
const headerBg = sheep.$url.css('/static/img/shop/goods/seckill-bg.png'); const headerBg = sheep.$url.css('/static/img/shop/goods/seckill-bg.png');
const btnBg = sheep.$url.css('/static/img/shop/goods/seckill-btn.png'); const btnBg = sheep.$url.css('/static/img/shop/goods/seckill-btn.png');
@ -206,7 +206,7 @@
title: activity.value.name, title: activity.value.name,
image: sheep.$url.cdn(state.goodsInfo.picUrl), image: sheep.$url.cdn(state.goodsInfo.picUrl),
params: { params: {
page: '4', page: SharePageEnum.SECKILL.value,
query: activity.value.id, query: activity.value.id,
}, },
}, },

View File

@ -60,11 +60,11 @@
/** /**
* 模板组件 - 提供页面公共组件属性方法 * 模板组件 - 提供页面公共组件属性方法
*/ */
import { computed } from 'vue'; import { computed, onMounted } from 'vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
import { isEmpty } from 'lodash-es'; import { isEmpty } from 'lodash-es';
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
import { onShareAppMessage, onShareTimeline, onShow } from '@dcloudio/uni-app'; import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
// #endif // #endif
const props = defineProps({ const props = defineProps({
@ -198,7 +198,7 @@
onShareAppMessage(() => { onShareAppMessage(() => {
return { return {
title: shareInfo.value.title, title: shareInfo.value.title,
path: shareInfo.value.path, path: shareInfo.value.forward.path,
imageUrl: shareInfo.value.image, imageUrl: shareInfo.value.image,
}; };
}); });
@ -206,17 +206,18 @@
onShareTimeline(() => { onShareTimeline(() => {
return { return {
title: shareInfo.value.title, title: shareInfo.value.title,
query: shareInfo.value.path, query: shareInfo.value.forward.path,
imageUrl: shareInfo.value.image, imageUrl: shareInfo.value.image,
}; };
}); });
// #endif // #endif
onShow(() => { // 使 onMounted 使 onShow
onMounted(()=>{
if (!isEmpty(shareInfo.value)) { if (!isEmpty(shareInfo.value)) {
sheep.$platform.share.updateShareInfo(shareInfo.value); sheep.$platform.share.updateShareInfo(shareInfo.value);
} }
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -92,7 +92,6 @@
showAuthModal(); showAuthModal();
return; return;
} }
console.log(props.shareInfo);
unref(SharePosterRef).getPoster(); unref(SharePosterRef).getPoster();
state.showPosterModal = true; state.showPosterModal = true;
}; };

View File

@ -3,6 +3,8 @@ import $platform from '@/sheep/platform';
import $router from '@/sheep/router'; import $router from '@/sheep/router';
import $url from '@/sheep/url'; import $url from '@/sheep/url';
import BrokerageApi from '@/sheep/api/trade/brokerage'; import BrokerageApi from '@/sheep/api/trade/brokerage';
import { SharePageEnum } from '@/sheep/util/const';
// #ifdef H5 // #ifdef H5
import $wxsdk from '@/sheep/libs/sdk-h5-weixin'; import $wxsdk from '@/sheep/libs/sdk-h5-weixin';
// #endif // #endif
@ -35,7 +37,11 @@ const getShareInfo = (
link: '', // 分享Url+参数 link: '', // 分享Url+参数
query: '', // 分享参数 query: '', // 分享参数
poster, // 海报所需数据 poster, // 海报所需数据
forward: {} // 转发所需参数
}; };
shareInfo.title = scene.title;
shareInfo.image = $url.cdn(scene.image);
shareInfo.desc = scene.desc;
const app = $store('app'); const app = $store('app');
const shareConfig = app.platform.share; const shareConfig = app.platform.share;
@ -49,16 +55,9 @@ const getShareInfo = (
// 配置页面地址带参数 // 配置页面地址带参数
shareInfo.path = buildSpmPath(); shareInfo.path = buildSpmPath();
// 配置转发参数 // 配置页面转发参数
if (shareConfig.methods.includes('forward')) { if (shareConfig.methods.includes('forward')) {
if (shareConfig.forwardInfo.title === '' || shareConfig.forwardInfo.image === '') { shareInfo.forward.path = buildSpmPath(query);
console.log('请在平台设置中配置默认转发信息');
}
// 设置自定义分享信息
shareInfo.title = scene.title || shareConfig.forwardInfo.title;
shareInfo.image = $url.cdn(scene.image || shareConfig.forwardInfo.image);
shareInfo.desc = scene.desc || shareConfig.forwardInfo.subtitle;
shareInfo.path = buildSpmPath(query);
} }
return shareInfo; return shareInfo;
@ -78,7 +77,7 @@ const buildSpmQuery = (params) => {
shareId = user.userInfo.id; shareId = user.userInfo.id;
} }
} }
let page = '1'; // 页面类型: 1=首页(默认),2=商品,3=拼团商品,4=秒杀商品,5=邀请参团,6=分销邀请...按需扩展 let page = SharePageEnum.HOME.value; // 页面类型,默认首页
if (typeof params.page !== 'undefined') { if (typeof params.page !== 'undefined') {
page = params.page; page = params.page;
} }
@ -99,6 +98,7 @@ const buildSpmQuery = (params) => {
const buildSpmPath = (query) => { const buildSpmPath = (query) => {
// 默认是主页,页面 page例如 pages/index/index根路径前不要填加 / // 默认是主页,页面 page例如 pages/index/index根路径前不要填加 /
// 不能携带参数参数请放在scene字段里如果不填写这个字段默认跳主页面。scancode_time为系统保留参数不允许配置 // 不能携带参数参数请放在scene字段里如果不填写这个字段默认跳主页面。scancode_time为系统保留参数不允许配置
// 页面分享时参数使用 ? 拼接
return typeof query === 'undefined' ? `pages/index/index` : `pages/index/index?${query}`; return typeof query === 'undefined' ? `pages/index/index` : `pages/index/index?${query}`;
}; };
@ -122,44 +122,44 @@ const decryptSpm = (spm) => {
let query; let query;
shareParams.shareId = shareParamsArray[0]; shareParams.shareId = shareParamsArray[0];
switch (shareParamsArray[1]) { switch (shareParamsArray[1]) {
case '1': case SharePageEnum.HOME.value:
// 默认首页不跳转 // 默认首页不跳转
shareParams.page = '/pages/index/index'; shareParams.page = SharePageEnum.HOME.page;
break; break;
case '2': case SharePageEnum.GOODS.value:
// 普通商品 // 普通商品
shareParams.page = '/pages/goods/index'; shareParams.page = SharePageEnum.GOODS.page;
shareParams.query = { shareParams.query = {
id: shareParamsArray[2], id: shareParamsArray[2],
}; };
break; break;
case '3': case SharePageEnum.GROUPON.value:
// 拼团商品 // 拼团商品
shareParams.page = '/pages/goods/groupon'; shareParams.page = SharePageEnum.GROUPON.page;
query = shareParamsArray[2].split(','); query = shareParamsArray[2].split(',');
shareParams.query = { shareParams.query = {
id: query[0], id: query[0],
activity_id: query[1], activity_id: query[1],
}; };
break; break;
case '4': case SharePageEnum.SECKILL.value:
// 秒杀商品 // 秒杀商品
shareParams.page = '/pages/goods/seckill'; shareParams.page = SharePageEnum.SECKILL.page;
query = shareParamsArray[2].split(','); query = shareParamsArray[2].split(',');
shareParams.query = { shareParams.query = {
id: query[0], id: query[0],
}; };
break; break;
case '5': case SharePageEnum.GROUPON_DETAIL.value:
// 参与拼团 // 参与拼团
shareParams.page = '/pages/activity/groupon/detail'; shareParams.page = SharePageEnum.GROUPON_DETAIL.page;
shareParams.query = { shareParams.query = {
id: shareParamsArray[2], id: shareParamsArray[2],
}; };
break; break;
case '6': case SharePageEnum.POINT.value:
// 积分商品 // 积分商品
shareParams.page = '/pages/goods/point'; shareParams.page = SharePageEnum.POINT.page;
shareParams.query = { shareParams.query = {
id: shareParamsArray[2], id: shareParamsArray[2],
}; };
@ -176,7 +176,7 @@ const decryptSpm = (spm) => {
} }
} }
if (shareParams.page !== '/pages/index/index') { if (shareParams.page !== SharePageEnum.HOME.page) {
$router.go(shareParams.page, shareParams.query); $router.go(shareParams.page, shareParams.query);
} }
return shareParams; return shareParams;
@ -189,9 +189,10 @@ const bindBrokerageUser = async (val = undefined) => {
if (!shareId) { if (!shareId) {
return; return;
} }
const { data, msg } = await BrokerageApi.bindBrokerageUser({ bindUserId: shareId }); // 绑定成功返回 true失败返回 false
const { data } = await BrokerageApi.bindBrokerageUser({ bindUserId: shareId });
// 绑定成功后清除缓存 // 绑定成功后清除缓存
if (!!data || msg.includes('不能绑定自己')) { if (data) {
uni.removeStorageSync('shareId'); uni.removeStorageSync('shareId');
} }
} catch (e) { } catch (e) {

View File

@ -80,13 +80,13 @@ http.interceptors.request.use(
if (config.custom.showLoading) { if (config.custom.showLoading) {
LoadingInstance.count++; LoadingInstance.count++;
LoadingInstance.count === 1 && LoadingInstance.count === 1 &&
uni.showLoading({ uni.showLoading({
title: config.custom.loadingMsg, title: config.custom.loadingMsg,
mask: true, mask: true,
fail: () => { fail: () => {
uni.hideLoading(); uni.hideLoading();
}, },
}); });
} }
// 增加 token 令牌、terminal 终端、tenant 租户的请求头 // 增加 token 令牌、terminal 终端、tenant 租户的请求头
@ -124,9 +124,10 @@ http.interceptors.response.use(
if (response.data.code === 401) { if (response.data.code === 401) {
return refreshToken(response.config); return refreshToken(response.config);
} }
// 特殊:处理分销用户绑定失败的提示
// 错误提示 if ((response.data.code + '').includes('1011007')) {
if (response.config.custom.showError) { console.error(`分销用户绑定失败,原因:${response.data.msg}`);
} else if (response.config.custom.showError) { // 错误提示
uni.showToast({ uni.showToast({
title: response.data.msg || '服务器开小差啦,请稍后再试~', title: response.data.msg || '服务器开小差啦,请稍后再试~',
icon: 'none', icon: 'none',

View File

@ -9,7 +9,7 @@
<image <image
v-if="icon" v-if="icon"
:name="icon" :name="icon"
:color="isActive ? parentData.activeColor : parentData.color" :color="isActive ? parentData.activeColor : parentData.inactiveColor"
:size="20" :size="20"
></image> ></image>
<block v-else> <block v-else>
@ -30,7 +30,7 @@
<text <text
class="u-tabbar-item__text" class="u-tabbar-item__text"
:style="{ :style="{
color: isActive ? parentData.activeColor : parentData.color, color: isActive ? parentData.activeColor : parentData.inactiveColor,
}" }"
> >
{{ text }} {{ text }}
@ -120,8 +120,8 @@
addStyle, addStyle,
parentData: { parentData: {
value: null, value: null,
activeColor: '', activeColor: '', //
color: '', inactiveColor: '', //
}, },
parent: {}, parent: {},
}; };

View File

@ -134,3 +134,39 @@ export const getTimeStatusEnum = (startTime, endTime) => {
return TimeStatusEnum.STARTED; return TimeStatusEnum.STARTED;
} }
}; };
/**
* 分享页枚举
* 按需扩展
* */
export const SharePageEnum = {
HOME: {
name: '首页',
page: '/pages/index/index',
value: '1'
},
GOODS: {
name: '普通商品页',
page: '/pages/goods/index',
value: '2'
},
GROUPON: {
name: '拼团商品页',
page: '/pages/goods/groupon',
value: '3'
},
SECKILL: {
name: '秒杀商品页',
page: '/pages/goods/seckill',
value: '4'
},
GROUPON_DETAIL: {
name: '参与拼团页',
page: '/pages/activity/groupon/detail',
value: '5'
},
POINT: {
name: '积分商品页',
page: '/pages/goods/point',
value: '6'
}
}