22 Commits
Author SHA1 Message Date
YunaiV d91d8eb2db V2.4.1 发布~ 2025-02-09 12:41:51 +08:00
YunaiV 3c403c424a Merge branch 'develop' of https://gitee.com/yudaocode/yudao-mall-uniapp 2025-01-24 20:19:33 +08:00
芋道源码 730025128a !135 fix 了一些问题
Merge pull request !135 from puhui999/dev
2025-01-23 04:30:59 +00:00
puhui999 5275b64e60 【缺陷修复】商城主题对齐后端。修复主题切换不生效的问题。 2025-01-22 17:32:45 +08:00
puhui999 ca85a34e49 【功能完善】分销团队佣金分转元 2025-01-22 11:48:01 +08:00
puhui999 d46cfd3943 【功能完善】TabBar 角标完善 2025-01-22 10:56:33 +08:00
puhui999 a382a1a876 【缺陷修复】decryptSpm 移除 activity_id 解析,统一为 id 2025-01-22 10:19:42 +08:00
puhui999 7fc548e161 【升级】mp-html from 2.4.1 to 2.5.0 2025-01-20 17:58:34 +08:00
YunaiV ea28ca6875 【功能修复】App.vue 延迟 200 毫秒,避免 {errMsg: 'hideTabBar:fail not TabBar page'}(来自 cursor 修复建议) 2025-01-19 08:25:15 +08:00
芋道源码 11e83df02f !134 缺陷修复
Merge pull request !134 from puhui999/dev
2025-01-17 12:19:26 +00:00
puhui999 039f05ce23 【代码优化】特殊:处理分销用户绑定失败的提示 2025-01-10 16:20:58 +08:00
puhui999 c1f2117e48 【代码优化】分销邀请 2025-01-09 15:37:18 +08:00
puhui999 5cc6d99891 【代码优化】分享优化 2025-01-09 15:14:46 +08:00
puhui999 a2ba10f796 【缺陷修复】su-tabbar-item 选中或未选中标签属性名称和父组件 su-tabbar 保持一致 2025-01-07 17:21:34 +08:00
puhui999 9ce6e63ee9 【缺陷修复】绑定推广员 2025-01-07 16:43:15 +08:00
puhui999 94f8883bd8 【缺陷修复】分享信息覆盖了海报信息导致小程序码获取失败的问题 2025-01-07 16:30:07 +08:00
puhui999 53899380c3 【缺陷修复】s-layout 组件中使用 onMounted 监听页面加载,解决 H5 中分享信息获取失败的问题 2025-01-07 16:08:57 +08:00
YunaiV bc0e731fc3 【功能修复】商品分类界面,有 categoryId 匹配不对的问题 2025-01-04 09:10:58 +08:00
YunaiV 515b8bb00f 【功能修复】申请售后的图片从 images 修复为 applyPicUrls 2025-01-04 09:00:52 +08:00
YunaiV 9f7015090d 【功能修复】s-layout 部分属性缺失时,首页无法展示的问题 2025-01-04 08:53:55 +08:00
芋道源码 139ec62e9a !133 fix bug category里右侧列表到底刷新功能
Merge pull request !133 from 壁虎在家/master
2025-01-04 00:42:19 +00:00
18602180658 4b9ef94741 fix bug: 子组件内不应该用页面的onReachBottom。导致小程序下无效 2025-01-01 02:25:48 +08:00
31 changed files with 330 additions and 171 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
# 版本号
SHOPRO_VERSION=v2.4.0
SHOPRO_VERSION=v2.4.1
# 后端接口 - 正式环境(通过 process.env.NODE_ENV 非 development)
SHOPRO_BASE_URL=http://api-dashboard.yudao.iocoder.cn
+7 -9
View File
@@ -3,33 +3,31 @@
import { ShoproInit } from './sheep';
onLaunch(() => {
// 隐藏原生导航栏 使用自定义底部导航
uni.hideTabBar();
// 延时隐藏原生导航栏
setTimeout(() => {
uni.hideTabBar();
}, 200);
// 加载Shopro底层依赖
ShoproInit();
});
onError((err) => {
console.log('AppOnError:', err);
});
onShow((options) => {
// #ifdef APP-PLUS
// 获取urlSchemes参数
const args = plus.runtime.arguments;
if (args) {
}
}
// 获取剪贴板
uni.getClipboardData({
success: (res) => { },
success: (res) => {},
});
// #endif
// #ifdef MP-WEIXIN
// 确认收货回调结果
console.log(options,'options');
console.log(options, 'options');
// #endif
});
</script>
+1 -1
View File
@@ -2,7 +2,7 @@
"id": "shopro",
"name": "shopro",
"displayName": "芋道商城",
"version": "2.4.0",
"version": "2.4.1",
"description": "芋道商城,一套代码,同时发行到iOS、Android、H5、微信小程序多个平台,请使用手机扫码快速体验强大功能",
"scripts": {
"prettier": "prettier --write \"{pages,sheep}/**/*.{js,json,tsx,css,less,scss,vue,html,md}\""
+2 -1
View File
@@ -209,6 +209,7 @@
import { isEmpty } from 'lodash-es';
import CombinationApi from '@/sheep/api/promotion/combination';
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 statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
@@ -234,7 +235,7 @@
image: sheep.$url.cdn(state.data.headRecord.picUrl),
desc: state.data.goods?.subtitle,
params: {
page: '5',
page: SharePageEnum.GROUPON_DETAIL.value,
query: state.data.headRecord.id,
},
},
+1 -1
View File
@@ -5,7 +5,7 @@
navbar="inner"
>
<!-- 覆盖头部导航栏背景颜色 -->
<div class="page-bg" :style="{ height: sys_navBar + 'px' }"></div>
<view class="page-bg" :style="{ height: sys_navBar + 'px' }"></view>
<!-- 聊天区域 -->
<MessageList ref="messageListRef">
<template #bottom>
+3 -1
View File
@@ -23,11 +23,13 @@
import commissionMenu from './components/commission-menu.vue';
import commissionAuth from './components/commission-auth.vue';
import sheep from '@/sheep';
import { SharePageEnum } from '@/sheep/util/const';
/** 分销邀请 */
const shareInfo = computed(() => {
return sheep.$platform.share.getShareInfo({
params: {
page: '6',
page: SharePageEnum.HOME.value, // 用户通邀请进入到首页
},
}, {
type: 'user',
+2 -1
View File
@@ -166,7 +166,7 @@
>单</view
>
<view>
<text class="num">{{ item.brokeragePrice || 0 }}</text
<text class="num">{{ fen2yuan(item.brokeragePrice) || 0 }}</text
>元
</view>
</view>
@@ -259,6 +259,7 @@
import _ from 'lodash-es';
import { onPageScroll } from '@dcloudio/uni-app';
import BrokerageApi from '@/sheep/api/trade/brokerage';
import { fen2yuan } from '../../sheep/hooks/useGoods';
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
// const agentInfo = computed(() => sheep.$store('user').agentInfo);
+2 -1
View File
@@ -159,6 +159,7 @@
import { useDurationTime, formatGoodsSwiper, fen2yuan } from '@/sheep/hooks/useGoods';
import CombinationApi from '@/sheep/api/promotion/combination';
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 btnBg = sheep.$url.css('/static/img/shop/goods/groupon-btn.png');
@@ -239,7 +240,7 @@
title: state.activity.name,
image: sheep.$url.cdn(state.goodsInfo.picUrl),
params: {
page: '3',
page: SharePageEnum.GROUPON.value,
query: state.activity.id,
},
},
+2 -1
View File
@@ -234,6 +234,7 @@
import countDown from '@/sheep/components/countDown/index.vue';
import OrderApi from '@/sheep/api/trade/order';
import activity from '@/sheep/api/promotion/activity';
import { SharePageEnum } from '@/sheep/util/const';
const bgColor = {
bgColor: '#E93323',
@@ -318,7 +319,7 @@
image: sheep.$url.cdn(state.goodsInfo.picUrl),
desc: state.goodsInfo.introduction,
params: {
page: '2',
page: SharePageEnum.GOODS.value,
query: state.goodsInfo.id,
},
},
+2 -3
View File
@@ -129,7 +129,7 @@
import detailCommentCard from './components/detail/detail-comment-card.vue';
import detailContentCard from './components/detail/detail-content-card.vue';
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';
const headerBg = sheep.$url.css('/static/img/shop/goods/score-bg.png');
@@ -180,8 +180,7 @@
title: activity.value.name,
image: sheep.$url.cdn(state.goodsInfo.picUrl),
params: {
// TODO @puhui:page 相关,要不搞个枚举,然后都弄过去;
page: '6',
page: SharePageEnum.POINT.value,
query: activity.value.id,
},
},
+2 -2
View File
@@ -151,7 +151,7 @@
import detailProgress from './components/detail/detail-progress.vue';
import SeckillApi from '@/sheep/api/promotion/seckill';
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 btnBg = sheep.$url.css('/static/img/shop/goods/seckill-btn.png');
@@ -206,7 +206,7 @@
title: activity.value.name,
image: sheep.$url.cdn(state.goodsInfo.picUrl),
params: {
page: '4',
page: SharePageEnum.SECKILL.value,
query: activity.value.id,
},
},
+5 -4
View File
@@ -23,6 +23,7 @@
scroll-y
:style="[{ height: pageHeight + 'px' }]"
v-if="state.categoryList?.length"
@scrolltolower="handleScrollToLower"
>
<image
v-if="state.categoryList[state.activeMenu].picUrl"
@@ -61,7 +62,7 @@
import sheep from '@/sheep';
import CategoryApi from '@/sheep/api/product/category';
import SpuApi from '@/sheep/api/product/spu';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import { onLoad } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import _ from 'lodash-es';
import { handleTree } from '@/sheep/util';
@@ -135,14 +136,14 @@
await getList();
// 首页点击分类的处理:查找满足条件的分类
const foundCategory = state.categoryList.find(category => category.id === params.id);
const foundCategory = state.categoryList.find((category) => category.id === Number(params.id));
// 如果找到则调用 onMenu 自动勾选相应分类,否则调用 onMenu(0) 勾选第一个分类
onMenu(foundCategory ? state.categoryList.indexOf(foundCategory) : 0);
});
onReachBottom(() => {
function handleScrollToLower() {
loadMore();
});
}
</script>
<style lang="scss" scoped>
+2 -2
View File
@@ -67,7 +67,7 @@
<!-- TODO 芋艿:上传的测试 -->
<view class="upload-img">
<s-uploader
v-model:url="formData.images"
v-model:url="formData.applyPicUrls"
fileMediatype="image"
limit="9"
mode="grid"
@@ -155,7 +155,7 @@
way: '',
applyReason: '',
applyDescription: '',
images: [],
applyPicUrls: [],
});
const rules = reactive({});
+9 -8
View File
@@ -1,7 +1,7 @@
<template>
<view
class="page-app"
:class="['theme-' + sys.mode, 'main-' + sys.theme, 'font-' + sys.fontSize]"
:class="['theme-' + sys?.mode, 'main-' + sys?.theme, 'font-' + sys?.fontSize]"
>
<view class="page-main" :style="[bgMain]">
<!-- 顶部导航栏-情况1:默认通用顶部导航栏 -->
@@ -27,7 +27,7 @@
<su-inner-navbar v-if="navbar === 'inner'" :title="title" />
<view
v-if="navbar === 'inner'"
:style="[{ paddingTop: sheep.$platform.navbar + 'px' }]"
:style="[{ paddingTop: sheep?.$platform?.navbar + 'px' }]"
></view>
<!-- 顶部导航栏-情况4:装修组件导航栏-沉浸式 -->
@@ -60,11 +60,11 @@
/**
* 模板组件 - 提供页面公共组件,属性,方法
*/
import { computed } from 'vue';
import { computed, onMounted } from 'vue';
import sheep from '@/sheep';
import { isEmpty } from 'lodash-es';
// #ifdef MP-WEIXIN
import { onShareAppMessage, onShareTimeline, onShow } from '@dcloudio/uni-app';
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
// #endif
const props = defineProps({
@@ -198,7 +198,7 @@
onShareAppMessage(() => {
return {
title: shareInfo.value.title,
path: shareInfo.value.path,
path: shareInfo.value.forward.path,
imageUrl: shareInfo.value.image,
};
});
@@ -206,17 +206,18 @@
onShareTimeline(() => {
return {
title: shareInfo.value.title,
query: shareInfo.value.path,
query: shareInfo.value.forward.path,
imageUrl: shareInfo.value.image,
};
});
// #endif
onShow(() => {
// 组件中使用 onMounted 监听页面加载,不是页面组件不使用 onShow
onMounted(()=>{
if (!isEmpty(shareInfo.value)) {
sheep.$platform.share.updateShareInfo(shareInfo.value);
}
});
})
</script>
<style lang="scss" scoped>
@@ -92,7 +92,6 @@
showAuthModal();
return;
}
console.log(props.shareInfo);
unref(SharePosterRef).getPoster();
state.showPosterModal = true;
};
+4
View File
@@ -15,6 +15,9 @@
:key="item.text"
:text="item.text"
:name="item.url"
:badge="item.badge"
:dot="item.dot"
:badgeStyle="tabbar.badgeStyle"
:isCenter="getTabbarCenter(index)"
:centerImage="sheep.$url.cdn(item.iconUrl)"
@tap="sheep.$router.go(item.url)"
@@ -33,6 +36,7 @@
<script setup>
import { computed, unref } from 'vue';
import sheep from '@/sheep';
import SuTabbar from '@/sheep/ui/su-tabbar/su-tabbar.vue';
const tabbar = computed(() => {
return sheep.$store('app').template.basic?.tabbar;
+31 -33
View File
@@ -3,6 +3,8 @@ import $platform from '@/sheep/platform';
import $router from '@/sheep/router';
import $url from '@/sheep/url';
import BrokerageApi from '@/sheep/api/trade/brokerage';
import { SharePageEnum } from '@/sheep/util/const';
// #ifdef H5
import $wxsdk from '@/sheep/libs/sdk-h5-weixin';
// #endif
@@ -35,7 +37,11 @@ const getShareInfo = (
link: '', // 分享Url+参数
query: '', // 分享参数
poster, // 海报所需数据
forward: {} // 转发所需参数
};
shareInfo.title = scene.title;
shareInfo.image = $url.cdn(scene.image);
shareInfo.desc = scene.desc;
const app = $store('app');
const shareConfig = app.platform.share;
@@ -49,16 +55,9 @@ const getShareInfo = (
// 配置页面地址带参数
shareInfo.path = buildSpmPath();
// 配置转发参数
// 配置页面转发参数
if (shareConfig.methods.includes('forward')) {
if (shareConfig.forwardInfo.title === '' || shareConfig.forwardInfo.image === '') {
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);
shareInfo.forward.path = buildSpmPath(query);
}
return shareInfo;
@@ -78,7 +77,7 @@ const buildSpmQuery = (params) => {
shareId = user.userInfo.id;
}
}
let page = '1'; // 页面类型: 1=首页(默认),2=商品,3=拼团商品,4=秒杀商品,5=邀请参团,6=分销邀请...按需扩展
let page = SharePageEnum.HOME.value; // 页面类型,默认首页
if (typeof params.page !== 'undefined') {
page = params.page;
}
@@ -99,6 +98,7 @@ const buildSpmQuery = (params) => {
const buildSpmPath = (query) => {
// 默认是主页,页面 page,例如 pages/index/index,根路径前不要填加 /,
// 不能携带参数(参数请放在scene字段里),如果不填写这个字段,默认跳主页面。scancode_time为系统保留参数,不允许配置
// 页面分享时参数使用 ? 拼接
return typeof query === 'undefined' ? `pages/index/index` : `pages/index/index?${query}`;
};
@@ -122,46 +122,43 @@ const decryptSpm = (spm) => {
let query;
shareParams.shareId = shareParamsArray[0];
switch (shareParamsArray[1]) {
case '1':
case SharePageEnum.HOME.value:
// 默认首页不跳转
shareParams.page = '/pages/index/index';
shareParams.page = SharePageEnum.HOME.page;
break;
case '2':
case SharePageEnum.GOODS.value:
// 普通商品
shareParams.page = '/pages/goods/index';
shareParams.page = SharePageEnum.GOODS.page;
shareParams.query = {
id: shareParamsArray[2],
id: shareParamsArray[2], // 设置活动编号
};
break;
case '3':
case SharePageEnum.GROUPON.value:
// 拼团商品
shareParams.page = '/pages/goods/groupon';
query = shareParamsArray[2].split(',');
shareParams.page = SharePageEnum.GROUPON.page;
shareParams.query = {
id: query[0],
activity_id: query[1],
id: shareParamsArray[2], // 设置活动编号
};
break;
case '4':
case SharePageEnum.SECKILL.value:
// 秒杀商品
shareParams.page = '/pages/goods/seckill';
query = shareParamsArray[2].split(',');
shareParams.page = SharePageEnum.SECKILL.page;
shareParams.query = {
id: query[0],
id: shareParamsArray[2], // 设置活动编号
};
break;
case '5':
case SharePageEnum.GROUPON_DETAIL.value:
// 参与拼团
shareParams.page = '/pages/activity/groupon/detail';
shareParams.page = SharePageEnum.GROUPON_DETAIL.page;
shareParams.query = {
id: shareParamsArray[2],
id: shareParamsArray[2], // 设置活动编号
};
break;
case '6':
case SharePageEnum.POINT.value:
// 积分商品
shareParams.page = '/pages/goods/point';
shareParams.page = SharePageEnum.POINT.page;
shareParams.query = {
id: shareParamsArray[2],
id: shareParamsArray[2], // 设置活动编号
};
break;
}
@@ -176,7 +173,7 @@ const decryptSpm = (spm) => {
}
}
if (shareParams.page !== '/pages/index/index') {
if (shareParams.page !== SharePageEnum.HOME.page) {
$router.go(shareParams.page, shareParams.query);
}
return shareParams;
@@ -189,9 +186,10 @@ const bindBrokerageUser = async (val = undefined) => {
if (!shareId) {
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');
}
} catch (e) {
+11 -10
View File
@@ -80,13 +80,13 @@ http.interceptors.request.use(
if (config.custom.showLoading) {
LoadingInstance.count++;
LoadingInstance.count === 1 &&
uni.showLoading({
title: config.custom.loadingMsg,
mask: true,
fail: () => {
uni.hideLoading();
},
});
uni.showLoading({
title: config.custom.loadingMsg,
mask: true,
fail: () => {
uni.hideLoading();
},
});
}
// 增加 token 令牌、terminal 终端、tenant 租户的请求头
@@ -124,9 +124,10 @@ http.interceptors.response.use(
if (response.data.code === 401) {
return refreshToken(response.config);
}
// 错误提示
if (response.config.custom.showError) {
// 特殊:处理分销用户绑定失败的提示
if ((response.data.code + '').includes('1011007')) {
console.error(`分销用户绑定失败,原因:${response.data.msg}`);
} else if (response.config.custom.showError) { // 错误提示
uni.showToast({
title: response.data.msg || '服务器开小差啦,请稍后再试~',
icon: 'none',
+30 -29
View File
@@ -1,39 +1,40 @@
@import './mixins';
//颜色 ,渐变背景60%
$yellow: #ffc300; //ss-黄
$orange: #ff6000; //ss-橘
$red: #ff3000; //ss-红
$pink: #e03997;
$mauve: #b745cb;
$purple: #652abf; //rgba(101, 42, 191, 1); // ss-紫
$blue: #0081ff;
$cyan: #37c0fe;
$green: #2aae67; //ss-绿
$olive: #8dc63f;
$grey: #8799a3;
$brown: #a5673f;
$black: #484848; //ss-黑
$golden: #e9b461; //ss-金
$red: #d10019; // 中国红
$orange: #f37b1d; // 桔橙
$gold: #fbbd08; // 明黄
$green: #8dc63f; // 橄榄绿
$cyan: #1cbbb4; // 天青
$blue: #0081ff; // 海蓝
$purple: #6739b6; // 姹紫
$brightRed: #e54d42; // 嫣红
$forestGreen: #39b54a; // 森绿
$mauve: #9c26b0; // 木槿
$pink: #e03997; // 桃粉
$brown: #a5673f; // 棕褐
$grey: #8799a3; // 玄灰
$gray: #aaaaaa; // 草灰
$black: #333333; // 墨黑
$colors: ();
$colors: map-merge(
(
'yellow': $yellow,
'orange': $orange,
'red': $red,
'pink': $pink,
'mauve': $mauve,
'purple': $purple,
'violet': $purple,
'blue': $blue,
'cyan': $cyan,
'green': $green,
'olive': $olive,
'grey': $grey,
'brown': $brown,
'black': $black,
'golden': $golden,
'red':$red,
'orange':$orange,
'gold':$gold,
'green':$green,
'cyan':$cyan,
'blue':$blue,
'purple':$purple,
'brightRed':$brightRed,
'forestGreen':$forestGreen,
'mauve':$mauve,
'pink':$pink,
'brown':$brown,
'grey':$grey,
'gray':$gray,
'black':$black,
),
$colors
);
+8
View File
@@ -128,6 +128,14 @@ const adaptTemplate = async (appTemplate, templateId) => {
const tabBar = diyTemplate?.property?.tabBar;
if (tabBar) {
appTemplate.basic.tabbar = tabBar;
// TODO 商城装修没有对 tabBar 进行角标配置,测试角标需打开以下注释
// appTemplate.basic.tabbar.items.forEach((tabBar) => {
// tabBar.dot = false
// tabBar.badge = 100
// })
// appTemplate.basic.tabbar.badgeStyle = {
// backgroundColor: '#882222',
// }
if (tabBar?.theme) {
appTemplate.basic.theme = tabBar?.theme;
}
+34 -31
View File
@@ -6,31 +6,31 @@
</view>
<template v-else>
<view class="u-tabbar-item__icon">
<image
v-if="icon"
:name="icon"
:color="isActive ? parentData.activeColor : parentData.color"
:size="20"
></image>
<block v-else>
<slot v-if="isActive" name="active-icon" />
<slot v-else name="inactive-icon" />
</block>
<!-- <u-badge
absolute
:offset="[0, dot ? '34rpx' : badge > 9 ? '14rpx' : '20rpx']"
:customStyle="badgeStyle"
:isDot="dot"
:value="badge || (dot ? 1 : null)"
:show="dot || badge > 0"
></u-badge> -->
<uni-badge
absolute="rightTop"
size="small"
:text="badge || (dot ? 1 : null)"
:customStyle="badgeStyle"
:isDot="dot"
>
<image
v-if="icon"
:name="icon"
:color="isActive ? parentData.activeColor : parentData.inactiveColor"
:size="20"
></image>
<block v-else>
<slot v-if="isActive" name="active-icon" />
<slot v-else name="inactive-icon" />
</block>
</uni-badge>
</view>
<slot name="text">
<text
class="u-tabbar-item__text"
:style="{
color: isActive ? parentData.activeColor : parentData.color,
color: isActive ? parentData.activeColor : parentData.inactiveColor,
}"
>
{{ text }}
@@ -44,16 +44,17 @@
/**
* TabbarItem 底部导航栏子组件
* @description 此组件提供了自定义tabbar的能力。
* @property {String | Number} name item标签的名称,作为与u-tabbar的value参数匹配的标识符
* @property {String} icon uView内置图标或者绝对路径的图片
* @property {String | Number} badge 右上角的角标提示信息
* @property {Boolean} dot 是否显示圆点,将会覆盖badge参数(默认 false )
* @property {String} text 描述文本
* @property {Object | String} badgeStyle 控制徽标的位置,对象或者字符串形式,可以设置top和right属性(默认 'top: 6px;right:2px;' )
* @property {Object} customStyle 定义需要用到的外部样式
* @property {String | Number} name item标签的名称,作为与u-tabbar的value参数匹配的标识符
* @property {String} icon uView内置图标或者绝对路径的图片
* @property {String | Number} badge 右上角的角标提示信息
* @property {Boolean} dot 是否显示圆点,将会覆盖badge参数(默认 false )
* @property {String} text 描述文本
* @property {Object | String} badgeStyle 控制徽标的位置,对象或者字符串形式,可以设置top和right属性(默认 'top: 6px;right:2px;' )
* @property {Object} customStyle 定义需要用到的外部样式
*
*/
import { deepMerge, addStyle, sleep, $parent } from '@/sheep/helper';
import { $parent, addStyle } from '@/sheep/helper';
export default {
name: 'su-tabbar-item',
props: {
@@ -102,8 +103,8 @@
},
// 控制徽标的位置,对象或者字符串形式,可以设置top和right属性
badgeStyle: {
type: [Object, String],
default: '',
type: Object,
default: ()=>{},
},
isCenter: {
type: Boolean,
@@ -120,8 +121,8 @@
addStyle,
parentData: {
value: null,
activeColor: '',
color: '',
activeColor: '', // 选中标签的颜色
inactiveColor: '', // 未选中标签的颜色
},
parent: {},
};
@@ -202,6 +203,7 @@
height: 25px;
}
}
.u-tabbar-item {
display: flex;
flex-direction: column;
@@ -230,5 +232,6 @@
:host {
flex: 1;
}
/* #endif */
</style>
+36
View File
@@ -134,3 +134,39 @@ export const getTimeStatusEnum = (startTime, endTime) => {
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'
}
}
+4 -1
View File
@@ -186,6 +186,9 @@
可通过 [issue](https://github.com/jin-yufeng/mp-html/issues/new/choose) 、插件问答或发送邮件到 [mp_html@126.com](mailto:mp_html@126.com) 提问,不建议在评论区提问(不方便回复)
提问请严格按照 [issue 模板](https://github.com/jin-yufeng/mp-html/issues/new/choose) ,描述清楚使用环境、`html` 内容或可复现的 `demo` 项目以及复现方式,对于 **描述不清**、**无法复现** 或重复的问题将不予回复
欢迎加入 `QQ` 交流群:`699734691`
欢迎加入 `QQ` 交流群:
群1(已满):`699734691`
群2(已满):`778239129`
群3:`960265313`
查看 [问题反馈](https://jin-yufeng.gitee.io/mp-html/#/question/feedback) 了解更多
+29
View File
@@ -1,3 +1,32 @@
## v2.5.0(2024-04-22)
1. `U` `play` 事件增加返回 `src` 等信息 [详细](https://github.com/jin-yufeng/mp-html/issues/526)
2. `U` `preview-img` 属性支持设置为 `all` 开启 `base64` 图片预览 [详细](https://github.com/jin-yufeng/mp-html/issues/536)
3. `U` `editable` 插件增加简易模式(点击文字直接编辑)
4. `U` `latex` 插件支持块级公式 [详细](https://github.com/jin-yufeng/mp-html/issues/582)
5. `F` 修复了表格部分情况下背景丢失的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/587)
6. `F` 修复了部分 `svg` 无法显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/591)
7. `F` 修复了 `h5` 和 `app` 端部分情况下样式无法识别的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/518)
8. `F` 修复了 `latex` 插件部分情况下显示不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/580)
9. `F` 修复了 `editable` 插件表格无法删除的问题
10. `F` 修复了 `editable` 插件 `vue3` `h5` 端点击图片报错的问题
11. `F` 修复了 `editable` 插件点击表格没有菜单栏的问题
## v2.4.3(2024-01-21)
1. `A` 增加 [card](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#card) 插件 [详细](https://github.com/jin-yufeng/mp-html/pull/533) by [@whoooami](https://github.com/whoooami)
2. `F` 修复了 `svg` 中包含 `foreignobject` 可能不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/523)
3. `F` 修复了合并单元格的表格部分情况下显示不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/561)
4. `F` 修复了 `img` 标签设置 `object-fit` 无效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/567)
5. `F` 修复了 `latex` 插件公式会换行的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/540)
6. `F` 修复了 `editable` 和 `audio` 插件共用时点击 `audio` 无法编辑的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/529) by [@whoooami](https://github.com/whoooami)
7. `F` 修复了微信小程序部分情况下图片会报错 `replace of undefined` 的问题
8. `F` 修复了快手小程序图片不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/571)
## v2.4.2(2023-05-14)
1. `A` `editable` 插件支持修改文字颜色 [详细](https://github.com/jin-yufeng/mp-html/issues/254)
2. `F` 修复了 `svg` 中有 `style` 不生效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/505)
3. `F` 修复了使用旧版编译器可能报错 `Bad attr nodes` 的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/472)
4. `F` 修复了 `app` 端可能出现无法读取 `lazyLoad` 的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/513)
5. `F` 修复了 `editable` 插件在点击换图时未拼接 `domain` 的问题 [详细](https://github.com/jin-yufeng/mp-html/pull/497) by [@TwoKe945](https://github.com/TwoKe945)
6. `F` 修复了 `latex` 插件部分情况下不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/515)
7. `F` 修复了 `editable` 插件点击音视频时其他标签框不消失的问题
## v2.4.1(2022-12-25)
1. `F` 修复了没有图片时 `ready` 事件可能不触发的问题
2. `F` 修复了加载过程中可能出现 `Root label not found` 错误的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/470)
@@ -12,7 +12,7 @@
<script>
/**
* mp-html v2.4.1
* mp-html v2.5.0
* @description 富文本组件
* @tutorial https://github.com/jin-yufeng/mp-html
* @property {String} container-style 容器的样式
@@ -10,13 +10,16 @@
<!-- #endif -->
<!-- #ifndef H5 || (APP-PLUS && VUE2) -->
<!-- 表格中的图片,使用 rich-text 防止大小不正确 -->
<rich-text v-if="n.name==='img'&&n.t" :style="'display:'+n.t" :nodes="'<img class=\'_img\' style=\''+n.attrs.style+'\' src=\''+n.attrs.src+'\'>'" :data-i="i" @tap.stop="imgTap" />
<rich-text v-if="n.name==='img'&&n.t" :style="'display:'+n.t" :nodes="[{attrs:{style:n.attrs.style||'',src:n.attrs.src},name:'img'}]" :data-i="i" @tap.stop="imgTap" />
<!-- #endif -->
<!-- #ifndef H5 || APP-PLUS -->
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;height:1px;'+n.attrs.style" :src="n.attrs.src" :mode="!n.h?'widthFix':(!n.w?'heightFix':'')" :lazy-load="opts[0]" :webp="n.webp" :show-menu-by-longpress="opts[3]&&!n.attrs.ignore" :image-menu-prevent="!opts[3]||n.attrs.ignore" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
<!-- #ifndef H5 || APP-PLUS || MP-KUAISHOU -->
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;height:1px;'+n.attrs.style" :src="n.attrs.src" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))" :lazy-load="opts[0]" :webp="n.webp" :show-menu-by-longpress="opts[3]&&!n.attrs.ignore" :image-menu-prevent="!opts[3]||n.attrs.ignore" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
<!-- #endif -->
<!-- #ifdef MP-KUAISHOU -->
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+n.attrs.style" :src="n.attrs.src" :lazy-load="opts[0]" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap"></image>
<!-- #endif -->
<!-- #ifdef APP-PLUS && VUE3 -->
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':'')" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||''))" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
<!-- #endif -->
<!-- 文本 -->
<!-- #ifdef MP-WEIXIN -->
@@ -67,7 +70,7 @@
<rich-text v-else-if="!n.c&&!handler.isInline(n.name, n.attrs.style)" :id="n.attrs.id" :style="n.f" :user-select="opts[4]" :nodes="[n]" />
<!-- #endif -->
<!-- #ifndef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
<rich-text v-else-if="!n.c" :id="n.attrs.id" :style="n.f+';display:inline'" :preview="false" :selectable="opts[4]" :user-select="opts[4]" :nodes="[n]" />
<rich-text v-else-if="!n.c" :id="n.attrs.id" :style="'display:inline;'+n.f" :preview="false" :selectable="opts[4]" :user-select="opts[4]" :nodes="[n]" />
<!-- #endif -->
<!-- 继续递归 -->
<view v-else-if="n.c===2" :id="n.attrs.id" :class="'_block _'+n.name+' '+n.attrs.class" :style="n.f+';'+n.attrs.style">
@@ -184,7 +187,15 @@ export default {
* @param {Event} e
*/
play (e) {
this.root.$emit('play')
const i = e.currentTarget.dataset.i
const node = this.childs[i]
this.root.$emit('play', {
source: node.name,
attrs: {
...node.attrs,
src: node.src[this.ctrl[i] || 0]
}
})
// #ifndef APP-PLUS
if (this.root.pauseVideo) {
let flag = false
@@ -299,7 +310,7 @@ export default {
* @description 检查是否所有图片加载完毕
*/
checkReady () {
if (!this.root.lazyLoad) {
if (this.root && !this.root.lazyLoad) {
this.root._unloadimgs -= 1
if (!this.root._unloadimgs) {
setTimeout(() => {
@@ -71,7 +71,8 @@ const config = {
viewbox: 'viewBox',
attributename: 'attributeName',
repeatcount: 'repeatCount',
repeatdur: 'repeatDur'
repeatdur: 'repeatDur',
foreignobject: 'foreignObject'
}
}
const tagSelector={}
@@ -321,6 +322,7 @@ Parser.prototype.onTagName = function (name) {
this.tagName = this.xml ? name : name.toLowerCase()
if (this.tagName === 'svg') {
this.xml = (this.xml || 0) + 1 // svg 标签内大小写敏感
config.ignoreTags.style = undefined // svg 标签内 style 可用
}
}
@@ -331,6 +333,12 @@ Parser.prototype.onTagName = function (name) {
*/
Parser.prototype.onAttrName = function (name) {
name = this.xml ? name : name.toLowerCase()
// #ifdef (VUE3 && (H5 || APP-PLUS)) || APP-PLUS-NVUE
if (name.includes('?') || name.includes(';')) {
this.attrName = undefined
return
}
// #endif
if (name.substr(0, 5) === 'data-') {
if (name === 'data-src' && !this.attrs.src) {
// data-src 自动转为 src
@@ -457,7 +465,7 @@ Parser.prototype.onOpenTag = function (selfClose) {
node.webp = 'T'
}
// data url 图片如果没有设置 original-src 默认为不可预览的小图片
if (attrs.src.includes('data:') && !attrs['original-src']) {
if (attrs.src.includes('data:') && this.options.previewImg !== 'all' && !attrs['original-src']) {
attrs.ignore = 'T'
}
if (!attrs.ignore || node.webp || attrs.src.includes('cloud://')) {
@@ -551,6 +559,13 @@ Parser.prototype.onOpenTag = function (selfClose) {
if (!isNaN(parseInt(styleObj.height)) && (!styleObj.height.includes('%') || (parent && (parent.attrs.style || '').includes('height')))) {
node.h = 'T'
}
if (node.w && node.h && styleObj['object-fit']) {
if (styleObj['object-fit'] === 'contain') {
node.m = 'aspectFit'
} else if (styleObj['object-fit'] === 'cover') {
node.m = 'aspectFill'
}
}
} else if (node.name === 'svg') {
siblings.push(node)
this.stack.push(node)
@@ -677,11 +692,19 @@ Parser.prototype.popNode = function () {
return
}
const name = config.svgDict[node.name] || node.name
if (name === 'foreignObject') {
for (const child of (node.children || [])) {
if (child.attrs && !child.attrs.xmlns) {
child.attrs.xmlns = 'http://www.w3.org/1999/xhtml'
break
}
}
}
src += '<' + name
for (const item in node.attrs) {
const val = node.attrs[item]
if (val) {
src += ` ${config.svgDict[item] || item}="${val}"`
src += ` ${config.svgDict[item] || item}="${val.replace(/"/g, '')}"`
}
}
if (!node.children) {
@@ -703,6 +726,7 @@ Parser.prototype.popNode = function () {
node.children = undefined
// #endif
this.xml = false
config.ignoreTags.style = true
return
}
@@ -839,6 +863,10 @@ Parser.prototype.popNode = function () {
if (node.flag && node.c) {
// 有 colspan 或 rowspan 且含有链接的表格通过 grid 布局实现
styleObj.display = 'grid'
if (styleObj['border-collapse'] === 'collapse') {
styleObj['border-collapse'] = undefined
spacing = 0
}
if (spacing) {
styleObj['grid-gap'] = spacing + 'px'
styleObj.padding = spacing + 'px'
@@ -856,6 +884,23 @@ Parser.prototype.popNode = function () {
for (let i = 0; i < nodes.length; i++) {
if (nodes[i].name === 'tr') {
trList.push(nodes[i])
} else if (nodes[i].name === 'colgroup') {
let colI = 1
for (const col of (nodes[i].children || [])) {
if (col.name === 'col') {
const style = col.attrs.style || ''
const start = style.indexOf('width') ? style.indexOf(';width') : 0
// 提取出宽度
if (start !== -1) {
let end = style.indexOf(';', start + 6)
if (end === -1) {
end = style.length
}
width[colI] = style.substring(start ? start + 7 : 6, end)
}
colI += 1
}
}
} else {
traversal(nodes[i].children || [])
}
@@ -982,11 +1027,26 @@ Parser.prototype.popNode = function () {
node.children = [table]
attrs = table.attrs
}
} else if ((node.name === 'tbody' || node.name === 'tr') && node.flag && node.c) {
node.flag = undefined;
(function traversal (nodes) {
for (let i = 0; i < nodes.length; i++) {
if (nodes[i].name === 'td') {
// 颜色样式设置给单元格避免丢失
for (const style of ['color', 'background', 'background-color']) {
if (styleObj[style]) {
nodes[i].attrs.style = style + ':' + styleObj[style] + ';' + (nodes[i].attrs.style || '')
}
}
} else {
traversal(nodes[i].children || [])
}
}
})(children)
} else if ((node.name === 'td' || node.name === 'th') && (attrs.colspan || attrs.rowspan)) {
for (let i = this.stack.length; i--;) {
if (this.stack[i].name === 'table') {
if (this.stack[i].name === 'table' || this.stack[i].name === 'tbody' || this.stack[i].name === 'tr') {
this.stack[i].flag = 1 // 指示含有合并单元格
break
}
}
} else if (node.name === 'ruby') {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "mp-html",
"displayName": "mp-html 富文本组件【全端支持,支持编辑、latex等扩展】",
"version": "v2.4.1",
"version": "v2.5.0",
"description": "一个强大的富文本组件,高效轻量,功能丰富",
"keywords": [
"富文本",
+4
View File
@@ -1,3 +1,7 @@
## 1.2.2(2023-01-28)
- 修复 运行/打包 控制台警告问题
## 1.2.1(2022-09-05)
- 修复 当 text 超过 max-num 时,badge 的宽度计算是根据 text 的长度计算,更改为 css 计算实际展示宽度,详见:[https://ask.dcloud.net.cn/question/150473](https://ask.dcloud.net.cn/question/150473)
## 1.2.0(2021-11-19)
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-badge](https://uniapp.dcloud.io/component/uniui/uni-badge)
@@ -1,7 +1,7 @@
<template>
<view class="uni-badge--x">
<slot />
<text v-if="text" :class="classNames" :style="[badgeWidth, positionStyle, customStyle, dotStyle]"
<text v-if="text" :class="classNames" :style="[positionStyle, customStyle, dotStyle]"
class="uni-badge" @click="onClick()">{{displayValue}}</text>
</view>
</template>
@@ -21,7 +21,7 @@
* @value error 红色
* @property {String} inverted = [true|false] 是否无需背景颜色
* @property {Number} maxNum 展示封顶的数字值,超过 99 显示 99+
* @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上
* @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上
* @value rightTop 右上
* @value rightBottom 右下
* @value leftTop 左上
@@ -130,16 +130,13 @@
const match = whiteList[this.absolute]
return match ? match : whiteList['rightTop']
},
badgeWidth() {
return {
width: `${this.width}px`
}
},
dotStyle() {
if (!this.isDot) return {}
return {
width: '10px',
minWidth: '0',
height: '10px',
padding: '0',
borderRadius: '10px'
}
},
@@ -160,7 +157,7 @@
};
</script>
<style lang="scss" scoped>
<style lang="scss" >
$uni-primary: #2979ff !default;
$uni-success: #4cd964 !default;
$uni-warning: #f0ad4e !default;
@@ -195,10 +192,13 @@
display: flex;
overflow: hidden;
box-sizing: border-box;
font-feature-settings: "tnum";
min-width: 20px;
/* #endif */
justify-content: center;
flex-direction: row;
height: 20px;
padding: 0 4px;
line-height: 18px;
color: #fff;
border-radius: 100px;
+5 -8
View File
@@ -1,7 +1,7 @@
{
"id": "uni-badge",
"displayName": "uni-badge 数字角标",
"version": "1.2.0",
"version": "1.2.2",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [
"",
@@ -18,11 +18,7 @@
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
@@ -39,10 +35,11 @@
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": [],
"dependencies": ["uni-scss"],
"encrypt": [],
"platforms": {
"cloud": {