chore(组件): components-diy 必须使用easyncom系统,不然在微信上无法渲染

This commit is contained in:
2026-01-05 09:29:19 +08:00
parent 311efe1ecd
commit b24f77be1a
49 changed files with 1462 additions and 1547 deletions

View File

@@ -111,9 +111,8 @@ export default {
}
},
onShow() {
this.init();
async onShow() {
await this.init();
},
onHide() {
if (this.storeTimeOut) {

View File

@@ -35,7 +35,7 @@ export const adaptSubpackageUrl = (url) => {
'/pages/goods/': '/pages_goods/',
'/pages/contact/': '/pages_tool/contact/',
'/pages/member/': '/pages_tool/member/',
'/pages/vr': '/pages_tool/vr/'
'/pages/vr': '/pages_tool/vr/',
};
// 构建正则表达式
@@ -58,7 +58,20 @@ export const adaptSubpackageUrl = (url) => {
});
}
return replacePrefix(url);
const currentUrl = replacePrefix(url);
// 分包子包导致的路径变化,需要根据前后关系修复
const subPackagesMap = {
'/pages_tool/member/index': '/pages_tool/member/basic/index',
}
// 修复url
if (subPackagesMap[currentUrl]) {
return subPackagesMap[currentUrl];
}
return currentUrl;
}
/**

View File

@@ -47,6 +47,9 @@ export default {
type: Object
}
},
components: {
XSkeleton: () => import('@/uni_modules/x-skeleton/components/x-skeleton/x-skeleton.vue'),
},
mixins: [DiyMinx],
data() {
return {

View File

@@ -293,6 +293,9 @@ export default {
default: false
}
},
components: {
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
},
mixins: [DiyMinx],
data() {
return {

View File

@@ -251,6 +251,11 @@
<diy-icon :value="item"></diy-icon>
</template>
<template v-if="item.componentName == 'Group'">
<!-- 组件组 -->
<diy-group :diyData="item"></diy-group>
</template>
<!-- 自定义扩展组件 -->
<diy-comp-extend :value="item"></diy-comp-extend>
</view>
@@ -261,20 +266,24 @@
// 组件组展示
import DiyMinx from './minx.js'
export default {
components: {},
name: 'DiyGroup',
mixins: [DiyMinx],
props: {
diyData: {
type: Object
type: Object,
default: () => ({})
},
scrollTop: {
type: [String, Number],
default: '0'
},
haveTopCategory: {
type: Boolean
type: Boolean,
default: false
},
followOfficialAccount: {
type: Object
type: Object,
default: () => ({})
},
},
mixins: [DiyMinx],
@@ -284,25 +293,28 @@ export default {
};
},
created() {
this.diyGlobalData = JSON.parse(JSON.stringify(this.diyData));
this.diyGlobalData = JSON.parse(JSON.stringify(this.diyData || {}));
},
computed: {
topNavColor() {
var color = '';
if (this.diyData.global.topNavBg) {
if (this.diyData.global && this.diyData.global.topNavBg) {
color = 'transparent';
if (this.scrollTop > 20) {
if (this.scrollTop > 20 && this.diyData.global.topNavColor) {
color = this.diyData.global.topNavColor;
} else {
color = 'transparent';
}
} else {
} else if (this.diyData.global && this.diyData.global.topNavColor) {
color = this.diyData.global.topNavColor;
}
return color;
},
// 修改属性样式
setPagestyle() {
if (!this.diyGlobalData || !this.diyGlobalData.value || !Array.isArray(this.diyGlobalData.value)) {
return [];
}
this.diyGlobalData.value.forEach((item, index) => {
item.pageStyle = '';
// 给每个组件增加位置属性,用于定位,搜索、分类导航等定位
@@ -314,12 +326,12 @@ export default {
return false;
}
item.pageStyle += 'background-color:' + item.pageBgColor + ';';
item.pageStyle += 'background-color:' + (item.pageBgColor || '') + ';';
if (item.margin) {
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 2 + 'rpx' + ';';
item.pageStyle += 'padding-right:' + item.margin.both * 2 + 'rpx' + ';';
item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';';
item.pageStyle += 'padding-top:' + (item.margin.top || 0) * 2 + 'rpx' + ';';
item.pageStyle += 'padding-bottom:' + (item.margin.bottom || 0) * 2 + 'rpx' + ';';
item.pageStyle += 'padding-right:' + (item.margin.both || 0) * 2 + 'rpx' + ';';
item.pageStyle += 'padding-left:' + (item.margin.both || 0) * 2 + 'rpx' + ';';
}
});
@@ -327,20 +339,35 @@ export default {
},
// 过滤组件的渲染
diyDataArray() {
let data = [],
showModuleData = this.$store.state.diyGroupShowModule ? JSON.parse(this.$store.state
.diyGroupShowModule) : '';
let data = [];
let showModuleData = [];
// 安全获取store中的模块显示数据
try {
if (this.$store && this.$store.state && this.$store.state.diyGroupShowModule) {
showModuleData = JSON.parse(this.$store.state.diyGroupShowModule);
// 确保showModuleData是数组
if (!Array.isArray(showModuleData)) {
showModuleData = [];
}
}
} catch (e) {
showModuleData = [];
}
const diyDataArr = this.setPagestyle;
if (showModuleData.length) {
if (showModuleData.includes('null')) return [];
let diyDataArr = this.setPagestyle;
diyDataArr.forEach((item, index) => {
if (showModuleData.includes(item.componentName)) {
if (item && item.componentName && showModuleData.includes(item.componentName)) {
data.push(item);
}
});
} else data = this.setPagestyle;
} else {
data = diyDataArr;
}
return data;
}
},

View File

@@ -51,7 +51,7 @@
// 文章
import DiyMinx from './minx.js'
export default {
name: 'diy-article',
name: 'diy-merch-list',
props: {
value: {
type: Object

View File

@@ -86,9 +86,9 @@
},
components: {
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsChatGoods: () => import('@/pages_tool/components/ns-chat/ns-chat-goods.vue'),
nsChatOrder: () => import('@/pages_tool/components/ns-chat/ns-chat-order.vue'),
nsChatReceiveGoods: () => import('@/pages_tool/components/ns-chat/ns-chat-receiveGoods.vue'),
nsChatGoods: () => import('@/components/ns-chat/ns-chat-goods.vue'),
nsChatOrder: () => import('@/components/ns-chat/ns-chat-order.vue'),
nsChatReceiveGoods: () => import('@/components/ns-chat/ns-chat-receiveGoods.vue')
},
data() {
return {

View File

@@ -1,10 +1,10 @@
@font-face {font-family: "iconfont";
src: url('~@/pages_tool/components/sx-rate/sx-rate/iconfont.eot?t=1574760464482'); /* IE9 */
src: url('~@/pages_tool/components/sx-rate/sx-rate/iconfont.eot?t=1574760464482#iefix') format('embedded-opentype'), /* IE6-IE8 */
src: url('~@/components/sx-rate/sx-rate/iconfont.eot?t=1574760464482'); /* IE9 */
src: url('~@/components/sx-rate/sx-rate/iconfont.eot?t=1574760464482#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAK8AAsAAAAABnAAAAJwAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCCcAp8gQgBNgIkAwgLBgAEIAWEbQcuG6wFyA4lTcHACOEZBUg8fL/2O3f3fTHEkoh28SSayCSxkkgQG6Uz3UvYITu9Qr5K0Vh6Ij6f+8CXKzVBHDvWa6d0lSfK57mc3gQ6kGt8oBz3ojUG9QLqxYEU6B4YRVYqecPYBS7hMYG6QWF0dlOycoGxxFoViFuxkALGuYAksXRVKNccTOJdSTV7zbSAt/D78Y8XxmRKOavq5CZZAOK+7u2svLVode0TggR0vIQc84BEXNQmjugJxumpJ/SNAvsqD77ui8K3i71aBPvrrNIm6IfSe5K58ltNZ3BbU40Blkf9OmKsIW/Un1qddc4dcSma3ArIX7PPXdlxK5l2zJ+aD6TXnQqmu330wqpeWkYN/OnNm/0trU+YvqNR4UN99f+x/tApIFTfR7u39X4gKPnb9pOX5RAQB6DYyc/zOKCD4OUp6KiiPeqnapbAp56NdegrdhLo5wKq+3UG/0fWcyDpCsuWJVVWO5oZO29bXR0FwJ4uV2ONvTeTCVW9I1wVAylyVeNkYudR0rCOsqoN1M1JPd7QDdMTqYZZXQChwwYybT6Q63BIJvYSJX1eUNYReqi7CrsLGyZDbJqIEUWQAPLroJhWKhjHQUyj8mwkrJJROKsI+XyENeIw5LI4xXQqUiA8xxZNtZBHCAMZrJTDFPAcksmUUIWVEkQTlogQVQSbzdS9iUUr5cDUDgyhEIgAxFcHEqMpKTD+eMK09PlsiFAVGQpu6atJ5kMwDfHsEBcLpweZqlX06ruXVzSqCfEQBANiYEpyUAqYh8jIKEGq+nkSCI1gEY2IqURg28OYvlrW+nr5152AOsuUhV2fSy+EwgAAAA==') format('woff2'),
url('~@/pages_tool/components/sx-rate/sx-rate/iconfont.woff?t=1574760464482') format('woff'),
url('~@/pages_tool/components/sx-rate/sx-rate/iconfont.ttf?t=1574760464482') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('~@/pages_tool/components/sx-rate/sx-rate/iconfont.svg?t=1574760464482#iconfont') format('svg'); /* iOS 4.1- */
url('~@/components/sx-rate/sx-rate/iconfont.woff?t=1574760464482') format('woff'),
url('~@/components/sx-rate/sx-rate/iconfont.ttf?t=1574760464482') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('~@/components/sx-rate/sx-rate/iconfont.svg?t=1574760464482#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -42,7 +42,7 @@
export default {
name: 'UniNavBar',
components: {
uniStatusBar: () => import('@/pages_tool/components/uni-status-bar/uni-status-bar.vue'),
uniStatusBar: () => import('@/components/uni-status-bar/uni-status-bar.vue'),
uniIcons: () => import('@/components/uni-icons/uni-icons.vue'),
},
props: {

View File

@@ -344,11 +344,7 @@
}
]
},
{
//******************工具模块主分包(公共组件)******************
"root": "pages_tool",
"pages": []
},
{
//******************会员模块-基础信息子分包******************
"root": "pages_tool/member/basic",

View File

@@ -14,7 +14,7 @@
</view>
</view>
<view class="dite-button" @click="officialAccountsOpen">{{ isEnEnv ? 'Follow Official Account' : '关注公众号'
}}</view>
}}</view>
</view>
<!-- <view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch" :style="{ backgroundImage: bgImg }">
@@ -156,15 +156,17 @@ import indexJs from './public/js/index.js';
export default {
components: {
hoverNav: () => import('@/components/hover-nav/hover-nav.vue'),
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'),
toTop: () => import('@/components/toTop/toTop.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
// #ifdef MP-WEIXIN
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
// #endif
},
mixins: [diyJs, scroll, indexJs]
mixins: [diyJs, scroll, indexJs],
};
</script>
@@ -211,12 +213,8 @@ export default {
font-size: 60rpx;
}
</style>
<style scoped>
.swiper /deep/ .uni-swiper-dots-horizontal {
left: 40%;
bottom: 40px
}
<style scoped>
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
background: none !important;
}
@@ -224,8 +222,15 @@ export default {
.choose-store>>>.goodslist-uni-popup-box {
width: 80%;
}
</style>
/deep/.diy-index-page .uni-popup .uni-popup__wrapper-box {
<style lang="scss" scoped>
.swiper /deep/ .uni-swiper-dots-horizontal {
left: 40%;
bottom: 40px
}
/deep/ .diy-index-page .uni-popup .uni-popup__wrapper-box {
border-radius: 0;
}

View File

@@ -37,7 +37,7 @@
export default {
components: {
nsAdv: () => import('@/pages_tool/components/ns-adv/ns-adv.vue'),
nsAdv: () => import('@/components/ns-adv/ns-adv.vue'),
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),

View File

@@ -1,120 +0,0 @@
<template>
<view v-if="advList.length" :class="['container-box',className]">
<swiper :indicator-dots="advList.length > 1" indicator-active-color="#ffffff" :autoplay="true" :interval="3000" :duration="1000" v-if="advList.length > 1" @change="changeSwiper" :current="currentIndex" :style="{ height: swiperHeight + 'px' }" class="item-wrap">
<swiper-item v-for="(item, index) in advList" :key="index" @click="jumppage(item.adv_url)">
<view class="image-box">
<image :src="$util.img(item.adv_image)" mode="widthFix" :id="'content-wrap' + index"/>
</view>
</swiper-item>
</swiper>
<view v-else class="container-box item-wrap">
<image :src="$util.img(advList[0]['adv_image'])" mode="widthFix" lazy-load="true" @load="imageLoad" @click="jumppage(advList[0].adv_url)"/>
</view>
</view>
</template>
<script>
export default {
name: 'ns-advert',
props: {
keyword: {
type: String
},
className: {
type: String
}
},
data() {
return {
advList: [],
isImage: false,
//滑块的高度(单位px)
swiperHeight: 150,
//当前索引
currentIndex: 0,
};
},
created() {
this.getAdvList();
},
methods: {
//获取广告位
getAdvList() {
var item = {
adv_image: '',
adv_url: ''
};
this.$api.sendRequest({
url: '/api/adv/detail',
data: {
keyword: this.keyword
},
success: res => {
if (res.code == 0) {
var data = res.data.adv_list;
for (var index in data) {
if (data[index].adv_url) data[index].adv_url = JSON.parse(data[index].adv_url);
}
this.advList = res.data.adv_list;
//动态设置swiper的高度
this.$nextTick(() => {
this.setSwiperHeight();
});
}
}
});
},
jumppage(e) {
this.$util.diyRedirectTo(e);
},
imageLoad(data) {
this.isImage = true;
},
//手动切换题目
changeSwiper(e) {
this.currentIndex = e.detail.current;
//动态设置swiper的高度使用nextTick延时设置
this.$nextTick(() => {
this.setSwiperHeight();
});
},
//动态设置swiper的高度
setSwiperHeight() {
if (this.advList.length > 1) {
setTimeout(() => {
let element = "#content-wrap" + this.currentIndex;
let query = uni.createSelectorQuery().in(this);
query.select(element).boundingClientRect();
query.exec((res) => {
if (res && res[0]) {
this.swiperHeight = res[0].height;
}
});
}, 10);
}
},
}
};
</script>
<style lang="scss">
.container-box {
width: 100%;
.item-wrap {
border-radius: 10rpx;
.image-box {
border-radius: 10rpx;
}
image {
width: 100%;
height: auto;
border-radius: 10rpx;
will-change: transform;
}
}
}
</style>

View File

@@ -162,7 +162,6 @@ export default {
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
toTop: () => import('@/components/toTop/toTop.vue'),
hoverNav: () => import('@/components/hover-nav/hover-nav.vue'),
diyBottomNav: () => import('@/components-diy/diy-bottom-nav.vue'),
},
mixins: [scroll],
data() {

View File

@@ -54,7 +54,7 @@ export default {
}
},
components: {
nsAdv: () => import('@/pages_tool/components/ns-adv/ns-adv.vue'),
nsAdv: () => import('@/components/ns-adv/ns-adv.vue'),
nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),

View File

@@ -28,7 +28,7 @@ export default {
components: {
uniGrid: () => import('@/components/uni-grid/uni-grid.vue'),
uniGridItem: () => import('@/components/uni-grid-item/uni-grid-item.vue'),
nsAdv: () => import('@/pages_tool/components/ns-adv/ns-adv.vue'),
nsAdv: () => import('@/components/ns-adv/ns-adv.vue'),
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),

View File

@@ -61,10 +61,6 @@ import microPageJs from './public/js/diy.js';
export default {
components: {
diyIndexPage: () => import('@/components-diy/diy-index-page.vue'),
diyGroup: () => import('@/components-diy/diy-group.vue'),
diyBottomNav: () => import('@/components-diy/diy-bottom-nav.vue'),
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'),

View File

@@ -63,7 +63,7 @@
import validate from 'common/js/validate.js';
export default {
components: {
mypOne: () => import('@/pages_tool/components/myp-one/myp-one.vue'),
mypOne: () => import('@/components/myp-one/myp-one.vue'),
},
data() {
return {

View File

@@ -80,9 +80,6 @@ import indexJs from '../public/js/index.js';
export default {
components: {
diyGroup: () => import('@/components-diy/diy-group.vue'),
diyBottomNav: () => import('@/components-diy/diy-bottom-nav.vue'),
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'),

View File

@@ -112,7 +112,7 @@ import info from '../public/js/info.js';
export default {
components: {
uniNavBar: () => import('@/pages_tool/components/uni-nav-bar/uni-nav-bar.vue'),
uniNavBar: () => import('@/components/uni-nav-bar/uni-nav-bar.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
},
data() {

View File

@@ -179,7 +179,7 @@ import auth from '@/common/js/auth.js';
export default {
components: {
uniNavBar: () => import('@/pages_tool/components/uni-nav-bar/uni-nav-bar.vue'),
uniNavBar: () => import('@/components/uni-nav-bar/uni-nav-bar.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
pickRegions: () => import('@/components/pick-regions/pick-regions.vue'),
},

View File

@@ -33,7 +33,7 @@
export default {
components: {
imgCropping: () => import('@/pages_tool/components/img-cropping/cropping.vue'),
imgCropping: () => import('@/components/img-cropping/cropping.vue'),
},
data() {
return {

View File

@@ -21,7 +21,7 @@
export default {
components: {
mypOne: () => import('@/pages_tool/components/myp-one/myp-one.vue'),
mypOne: () => import('@/components/myp-one/myp-one.vue')
},
data() {
return {

View File

@@ -184,7 +184,7 @@
import scroll from '@/common/js/scroll-view.js';
export default {
components: {
nsProgress: () => import('@/pages_tool/components/ns-progress/ns-progress.vue'),
nsProgress: () => import('@/components/ns-progress/ns-progress.vue'),
toTop: () => import('@/components/toTop/toTop.vue'),
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),

View File

@@ -48,7 +48,7 @@ import scroll from '@/common/js/scroll-view.js';
export default {
components: {
nsProgress: () => import('@/pages_tool/components/ns-progress/ns-progress.vue'),
nsProgress: () => import('@/components/ns-progress/ns-progress.vue'),
toTop: () => import('@/components/toTop/toTop.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
},

View File

@@ -84,7 +84,7 @@
import evaluate from './public/js/evaluate.js';
export default {
components: {
sxRate: () => import('@/pages_tool/components/sx-rate/index.vue'),
sxRate: () => import('@/components/sx-rate/index.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
},
mixins: [evaluate],

View File

@@ -8,9 +8,6 @@
<script>
export default {
components: {
diyBottomNav: () => import('@/components-diy/diy-bottom-nav.vue'),
},
data() {
return {
src: ''