chore(组件): components-diy 必须使用easyncom系统,不然在微信上无法渲染
This commit is contained in:
@@ -111,9 +111,8 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
onShow() {
|
async onShow() {
|
||||||
|
await this.init();
|
||||||
this.init();
|
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
if (this.storeTimeOut) {
|
if (this.storeTimeOut) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export const adaptSubpackageUrl = (url) => {
|
|||||||
'/pages/goods/': '/pages_goods/',
|
'/pages/goods/': '/pages_goods/',
|
||||||
'/pages/contact/': '/pages_tool/contact/',
|
'/pages/contact/': '/pages_tool/contact/',
|
||||||
'/pages/member/': '/pages_tool/member/',
|
'/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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ export default {
|
|||||||
type: Object
|
type: Object
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
XSkeleton: () => import('@/uni_modules/x-skeleton/components/x-skeleton/x-skeleton.vue'),
|
||||||
|
},
|
||||||
mixins: [DiyMinx],
|
mixins: [DiyMinx],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -293,6 +293,9 @@ export default {
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
||||||
|
},
|
||||||
mixins: [DiyMinx],
|
mixins: [DiyMinx],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -251,6 +251,11 @@
|
|||||||
<diy-icon :value="item"></diy-icon>
|
<diy-icon :value="item"></diy-icon>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-if="item.componentName == 'Group'">
|
||||||
|
<!-- 组件组 -->
|
||||||
|
<diy-group :diyData="item"></diy-group>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- 自定义扩展组件 -->
|
<!-- 自定义扩展组件 -->
|
||||||
<diy-comp-extend :value="item"></diy-comp-extend>
|
<diy-comp-extend :value="item"></diy-comp-extend>
|
||||||
</view>
|
</view>
|
||||||
@@ -261,20 +266,24 @@
|
|||||||
// 组件组展示
|
// 组件组展示
|
||||||
import DiyMinx from './minx.js'
|
import DiyMinx from './minx.js'
|
||||||
export default {
|
export default {
|
||||||
components: {},
|
name: 'DiyGroup',
|
||||||
|
mixins: [DiyMinx],
|
||||||
props: {
|
props: {
|
||||||
diyData: {
|
diyData: {
|
||||||
type: Object
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
},
|
},
|
||||||
scrollTop: {
|
scrollTop: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: '0'
|
default: '0'
|
||||||
},
|
},
|
||||||
haveTopCategory: {
|
haveTopCategory: {
|
||||||
type: Boolean
|
type: Boolean,
|
||||||
|
default: false
|
||||||
},
|
},
|
||||||
followOfficialAccount: {
|
followOfficialAccount: {
|
||||||
type: Object
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mixins: [DiyMinx],
|
mixins: [DiyMinx],
|
||||||
@@ -284,25 +293,28 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.diyGlobalData = JSON.parse(JSON.stringify(this.diyData));
|
this.diyGlobalData = JSON.parse(JSON.stringify(this.diyData || {}));
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
topNavColor() {
|
topNavColor() {
|
||||||
var color = '';
|
var color = '';
|
||||||
if (this.diyData.global.topNavBg) {
|
if (this.diyData.global && this.diyData.global.topNavBg) {
|
||||||
color = 'transparent';
|
color = 'transparent';
|
||||||
if (this.scrollTop > 20) {
|
if (this.scrollTop > 20 && this.diyData.global.topNavColor) {
|
||||||
color = this.diyData.global.topNavColor;
|
color = this.diyData.global.topNavColor;
|
||||||
} else {
|
} else {
|
||||||
color = 'transparent';
|
color = 'transparent';
|
||||||
}
|
}
|
||||||
} else {
|
} else if (this.diyData.global && this.diyData.global.topNavColor) {
|
||||||
color = this.diyData.global.topNavColor;
|
color = this.diyData.global.topNavColor;
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
},
|
},
|
||||||
// 修改属性样式
|
// 修改属性样式
|
||||||
setPagestyle() {
|
setPagestyle() {
|
||||||
|
if (!this.diyGlobalData || !this.diyGlobalData.value || !Array.isArray(this.diyGlobalData.value)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
this.diyGlobalData.value.forEach((item, index) => {
|
this.diyGlobalData.value.forEach((item, index) => {
|
||||||
item.pageStyle = '';
|
item.pageStyle = '';
|
||||||
// 给每个组件增加位置属性,用于定位,搜索、分类导航等定位
|
// 给每个组件增加位置属性,用于定位,搜索、分类导航等定位
|
||||||
@@ -314,12 +326,12 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.pageStyle += 'background-color:' + item.pageBgColor + ';';
|
item.pageStyle += 'background-color:' + (item.pageBgColor || '') + ';';
|
||||||
if (item.margin) {
|
if (item.margin) {
|
||||||
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-top:' + (item.margin.top || 0) * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-bottom:' + (item.margin.bottom || 0) * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-right:' + item.margin.both * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-right:' + (item.margin.both || 0) * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-left:' + (item.margin.both || 0) * 2 + 'rpx' + ';';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -327,20 +339,35 @@ export default {
|
|||||||
},
|
},
|
||||||
// 过滤组件的渲染
|
// 过滤组件的渲染
|
||||||
diyDataArray() {
|
diyDataArray() {
|
||||||
let data = [],
|
let data = [];
|
||||||
showModuleData = this.$store.state.diyGroupShowModule ? JSON.parse(this.$store.state
|
let showModuleData = [];
|
||||||
.diyGroupShowModule) : '';
|
|
||||||
|
// 安全获取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.length) {
|
||||||
if (showModuleData.includes('null')) return [];
|
if (showModuleData.includes('null')) return [];
|
||||||
|
|
||||||
let diyDataArr = this.setPagestyle;
|
|
||||||
diyDataArr.forEach((item, index) => {
|
diyDataArr.forEach((item, index) => {
|
||||||
if (showModuleData.includes(item.componentName)) {
|
if (item && item.componentName && showModuleData.includes(item.componentName)) {
|
||||||
data.push(item);
|
data.push(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else data = this.setPagestyle;
|
} else {
|
||||||
|
data = diyDataArr;
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
// 文章
|
// 文章
|
||||||
import DiyMinx from './minx.js'
|
import DiyMinx from './minx.js'
|
||||||
export default {
|
export default {
|
||||||
name: 'diy-article',
|
name: 'diy-merch-list',
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: Object
|
type: Object
|
||||||
|
|||||||
@@ -86,9 +86,9 @@
|
|||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
|
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
|
||||||
nsChatGoods: () => import('@/pages_tool/components/ns-chat/ns-chat-goods.vue'),
|
nsChatGoods: () => import('@/components/ns-chat/ns-chat-goods.vue'),
|
||||||
nsChatOrder: () => import('@/pages_tool/components/ns-chat/ns-chat-order.vue'),
|
nsChatOrder: () => import('@/components/ns-chat/ns-chat-order.vue'),
|
||||||
nsChatReceiveGoods: () => import('@/pages_tool/components/ns-chat/ns-chat-receiveGoods.vue'),
|
nsChatReceiveGoods: () => import('@/components/ns-chat/ns-chat-receiveGoods.vue')
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
@font-face {font-family: "iconfont";
|
@font-face {font-family: "iconfont";
|
||||||
src: url('~@/pages_tool/components/sx-rate/sx-rate/iconfont.eot?t=1574760464482'); /* IE9 */
|
src: url('~@/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#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('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('~@/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('~@/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.svg?t=1574760464482#iconfont') format('svg'); /* iOS 4.1- */
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconfont {
|
.iconfont {
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -42,7 +42,7 @@
|
|||||||
export default {
|
export default {
|
||||||
name: 'UniNavBar',
|
name: 'UniNavBar',
|
||||||
components: {
|
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'),
|
uniIcons: () => import('@/components/uni-icons/uni-icons.vue'),
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@@ -344,11 +344,7 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
//******************工具模块主分包(公共组件)******************
|
|
||||||
"root": "pages_tool",
|
|
||||||
"pages": []
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
//******************会员模块-基础信息子分包******************
|
//******************会员模块-基础信息子分包******************
|
||||||
"root": "pages_tool/member/basic",
|
"root": "pages_tool/member/basic",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="dite-button" @click="officialAccountsOpen">{{ isEnEnv ? 'Follow Official Account' : '关注公众号'
|
<view class="dite-button" @click="officialAccountsOpen">{{ isEnEnv ? 'Follow Official Account' : '关注公众号'
|
||||||
}}</view>
|
}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- <view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch" :style="{ backgroundImage: bgImg }">
|
<!-- <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 {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
hoverNav: () => import('@/components/hover-nav/hover-nav.vue'),
|
||||||
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
|
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
|
||||||
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
|
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
|
||||||
|
nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'),
|
||||||
toTop: () => import('@/components/toTop/toTop.vue'),
|
toTop: () => import('@/components/toTop/toTop.vue'),
|
||||||
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
|
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
mixins: [diyJs, scroll, indexJs]
|
mixins: [diyJs, scroll, indexJs],
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -211,12 +213,8 @@ export default {
|
|||||||
font-size: 60rpx;
|
font-size: 60rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</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 {
|
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
}
|
}
|
||||||
@@ -224,8 +222,15 @@ export default {
|
|||||||
.choose-store>>>.goodslist-uni-popup-box {
|
.choose-store>>>.goodslist-uni-popup-box {
|
||||||
width: 80%;
|
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;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
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'),
|
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
|
||||||
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
||||||
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -162,7 +162,6 @@ export default {
|
|||||||
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
|
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
|
||||||
toTop: () => import('@/components/toTop/toTop.vue'),
|
toTop: () => import('@/components/toTop/toTop.vue'),
|
||||||
hoverNav: () => import('@/components/hover-nav/hover-nav.vue'),
|
hoverNav: () => import('@/components/hover-nav/hover-nav.vue'),
|
||||||
diyBottomNav: () => import('@/components-diy/diy-bottom-nav.vue'),
|
|
||||||
},
|
},
|
||||||
mixins: [scroll],
|
mixins: [scroll],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
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'),
|
nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'),
|
||||||
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
||||||
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
|
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
uniGrid: () => import('@/components/uni-grid/uni-grid.vue'),
|
uniGrid: () => import('@/components/uni-grid/uni-grid.vue'),
|
||||||
uniGridItem: () => import('@/components/uni-grid-item/uni-grid-item.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'),
|
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
|
||||||
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
||||||
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
||||||
|
|||||||
@@ -61,10 +61,6 @@ import microPageJs from './public/js/diy.js';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
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'),
|
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
|
||||||
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
|
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
|
||||||
nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'),
|
nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'),
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
import validate from 'common/js/validate.js';
|
import validate from 'common/js/validate.js';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
mypOne: () => import('@/pages_tool/components/myp-one/myp-one.vue'),
|
mypOne: () => import('@/components/myp-one/myp-one.vue'),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -80,9 +80,6 @@ import indexJs from '../public/js/index.js';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
diyGroup: () => import('@/components-diy/diy-group.vue'),
|
|
||||||
diyBottomNav: () => import('@/components-diy/diy-bottom-nav.vue'),
|
|
||||||
|
|
||||||
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
|
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
|
||||||
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
|
nsNavbar: () => import('@/components/ns-navbar/ns-navbar.vue'),
|
||||||
nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'),
|
nsCopyright: () => import('@/components/ns-copyright/ns-copyright.vue'),
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ import info from '../public/js/info.js';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
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'),
|
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ import auth from '@/common/js/auth.js';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
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'),
|
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
|
||||||
pickRegions: () => import('@/components/pick-regions/pick-regions.vue'),
|
pickRegions: () => import('@/components/pick-regions/pick-regions.vue'),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
imgCropping: () => import('@/pages_tool/components/img-cropping/cropping.vue'),
|
imgCropping: () => import('@/components/img-cropping/cropping.vue'),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
mypOne: () => import('@/pages_tool/components/myp-one/myp-one.vue'),
|
mypOne: () => import('@/components/myp-one/myp-one.vue')
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -184,7 +184,7 @@
|
|||||||
import scroll from '@/common/js/scroll-view.js';
|
import scroll from '@/common/js/scroll-view.js';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
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'),
|
toTop: () => import('@/components/toTop/toTop.vue'),
|
||||||
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
|
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
|
||||||
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import scroll from '@/common/js/scroll-view.js';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
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'),
|
toTop: () => import('@/components/toTop/toTop.vue'),
|
||||||
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
import evaluate from './public/js/evaluate.js';
|
import evaluate from './public/js/evaluate.js';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
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'),
|
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
|
||||||
},
|
},
|
||||||
mixins: [evaluate],
|
mixins: [evaluate],
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
components: {
|
|
||||||
diyBottomNav: () => import('@/components-diy/diy-bottom-nav.vue'),
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
src: ''
|
src: ''
|
||||||
|
|||||||
Reference in New Issue
Block a user