chore(components): diy组件部分添加点击事件句柄重新处理

This commit is contained in:
2025-10-30 18:09:57 +08:00
parent fc232ad938
commit 55ebc174b9
15 changed files with 180 additions and 70 deletions

View File

@@ -6,7 +6,7 @@
</view> </view>
<view class="ul-wrap"> <view class="ul-wrap">
<view class="li-item" v-for="(item, index) in list" :key="index"> <view class="li-item" v-for="(item, index) in list" :key="index">
<image class="brand-pic" :src="$util.img(item.image_url)" mode="aspectFit" @click="toDetail(item)" @error="imgError(index)" :style="itemCss"/> <image class="brand-pic" :src="$util.img(item.image_url)" mode="aspectFit" @click="handlerClick(item)" @tap="handlerClick(item)" @error="imgError(index)" :style="itemCss"/>
</view> </view>
</view> </view>
</view> </view>
@@ -19,6 +19,8 @@
import uniGrid from '@/components/uni-grid/uni-grid.vue'; import uniGrid from '@/components/uni-grid/uni-grid.vue';
import uniGridItem from '@/components/uni-grid-item/uni-grid-item.vue'; import uniGridItem from '@/components/uni-grid-item/uni-grid-item.vue';
import DiyMinx from './minx.js'
export default { export default {
name: 'diy-goods-brand', name: 'diy-goods-brand',
props: { props: {
@@ -47,6 +49,7 @@
created() { created() {
this.getBrandList(); this.getBrandList();
}, },
mixins: [DiyMinx],
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
@@ -113,7 +116,13 @@
}, },
imgError(index) { imgError(index) {
if (this.list[index]) this.list[index].image_url = this.$util.getDefaultImage().goods; if (this.list[index]) this.list[index].image_url = this.$util.getDefaultImage().goods;
} },
async handlerClick(item) {
await this.__$emitEvent({eventName: 'goods-brand-tap', data: item, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
this.toDetail(item);
}})
},
} }
}; };
</script> </script>

View File

@@ -2,7 +2,7 @@
<x-skeleton data-component-name="diy-goods-list" :type="skeletonType" :loading="loading" :configs="skeletonConfig"> <x-skeleton data-component-name="diy-goods-list" :type="skeletonType" :loading="loading" :configs="skeletonConfig">
<view :class="['goods-list', goodsValue.template, goodsValue.style]" :style="goodsListWarpCss"> <view :class="['goods-list', goodsValue.template, goodsValue.style]" :style="goodsListWarpCss">
<template v-if="goodsValue.template != 'horizontal-slide'"> <template v-if="goodsValue.template != 'horizontal-slide'">
<view class="goods-item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[goodsValue.ornament.type]" :style="goodsItemCss"> <view class="goods-item" v-for="(item, index) in list" :key="index" @click="handlerClick(item)" @tap="handlerClick(item)" :class="[goodsValue.ornament.type]" :style="goodsItemCss">
<view class="goods-img-wrap"> <view class="goods-img-wrap">
<image class="goods-img" :src="$util.img(item.goods_image, { size: goodsValue.template == 'large-mode' ? 'big' : 'mid' })" mode="widthFix" @error="imgError(index)" :style="{ borderRadius: goodsValue.imgAroundRadius * 2 + 'rpx' }"/> <image class="goods-img" :src="$util.img(item.goods_image, { size: goodsValue.template == 'large-mode' ? 'big' : 'mid' })" mode="widthFix" @error="imgError(index)" :style="{ borderRadius: goodsValue.imgAroundRadius * 2 + 'rpx' }"/>
<view class="sell-out" v-if="item.stock <= 0"> <view class="sell-out" v-if="item.stock <= 0">
@@ -99,7 +99,7 @@
</view> </view>
</template> </template>
<scroll-view v-if="goodsValue.template == 'horizontal-slide' && goodsValue.slideMode == 'scroll'" class="scroll" :scroll-x="true"> <scroll-view v-if="goodsValue.template == 'horizontal-slide' && goodsValue.slideMode == 'scroll'" class="scroll" :scroll-x="true">
<view class="goods-item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[goodsValue.ornament.type]" :style="goodsItemCss"> <view class="goods-item" v-for="(item, index) in list" :key="index" @click="handlerClick(item)" @tap="handlerClick(item)" :class="[goodsValue.ornament.type]" :style="goodsItemCss">
<view class="goods-img-wrap"> <view class="goods-img-wrap">
<image class="goods-img" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imgError(index)" :lazy-load="true"/> <image class="goods-img" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imgError(index)" :lazy-load="true"/>
<view class="sell-out" v-if="item.stock <= 0"> <view class="sell-out" v-if="item.stock <= 0">
@@ -149,7 +149,7 @@
</scroll-view> </scroll-view>
<swiper v-if="goodsValue.template == 'horizontal-slide' && goodsValue.slideMode == 'slide'" :autoplay="false" class="swiper" :style="{ height: swiperHeight }"> <swiper v-if="goodsValue.template == 'horizontal-slide' && goodsValue.slideMode == 'slide'" :autoplay="false" class="swiper" :style="{ height: swiperHeight }">
<swiper-item v-for="(pageItem, pageIndex) in page" :key="pageIndex" :class="['swiper-item', (list.length && [list[pageIndex].length / 3] >= 1) && 'flex-between']"> <swiper-item v-for="(pageItem, pageIndex) in page" :key="pageIndex" :class="['swiper-item', (list.length && [list[pageIndex].length / 3] >= 1) && 'flex-between']">
<view class="goods-item" v-for="(dataItem, dataIndex) in list[pageIndex]" :key="dataIndex" @click="toDetail(dataItem)" :class="[goodsValue.ornament.type]" :style="goodsItemCss"> <view class="goods-item" v-for="(dataItem, dataIndex) in list[pageIndex]" :key="dataIndex" @click="handlerClick(dataItem)" @tap="handlerClick(dataItem)" :class="[goodsValue.ornament.type]" :style="goodsItemCss">
<view class="goods-img-wrap"> <view class="goods-img-wrap">
<image class="goods-img" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(dataItem.goods_image, { size: 'mid' })" mode="widthFix" @error="imgError(dataIndex)" :lazy-load="true"/> <image class="goods-img" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(dataItem.goods_image, { size: 'mid' })" mode="widthFix" @error="imgError(dataIndex)" :lazy-load="true"/>
<view class="sell-out" v-if="dataItem.stock <= 0"> <view class="sell-out" v-if="dataItem.stock <= 0">
@@ -210,6 +210,7 @@
<script> <script>
import nsGoodsSkuIndex from '@/components/ns-goods-sku/ns-goods-sku-index.vue'; import nsGoodsSkuIndex from '@/components/ns-goods-sku/ns-goods-sku-index.vue';
import DiyMinx from './minx.js'
export default { export default {
name: 'diy-goods-list', name: 'diy-goods-list',
components: { components: {
@@ -241,6 +242,7 @@
this.initSkeleton(); this.initSkeleton();
this.getGoodsList(); this.getGoodsList();
}, },
mixins: [DiyMinx],
watch: { watch: {
'globalStoreInfo.store_id': { 'globalStoreInfo.store_id': {
handler(nval, oval) { handler(nval, oval) {
@@ -525,6 +527,13 @@
.toString() .toString()
.substr(3, len) + Date.now() .substr(3, len) + Date.now()
).toString(36); ).toString(36);
},
async handlerClick(item) {
await this.__$emitEvent({eventName: 'goods-list-tap', data: item, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
this.toDetail(item);
}})
} }
} }
}; };

View File

@@ -2,7 +2,7 @@
<view data-component-name="diy-img-ads" class="single-graph"> <view data-component-name="diy-img-ads" class="single-graph">
<view :style="imgAdsMarginWarp" class="swiper-box"> <view :style="imgAdsMarginWarp" class="swiper-box">
<block v-if="imgAdsValue.list.length == 1"> <block v-if="imgAdsValue.list.length == 1">
<view class="simple-graph-wrap" :style="imgAdsSwiper" @click="$util.diyRedirectTo(imgAdsValue.list[0].link)"> <view class="simple-graph-wrap" :style="imgAdsSwiper" @click="handlerClick(imgAdsValue.list[0].link)" @tap="handlerClick(imgAdsValue.list[0].link)">
<image :style="{ height: imgAdsValue.list[0].imgHeight }" :src="$util.img(imgAdsValue.list[0].imageUrl)" mode="widthFix" :show-menu-by-longpress="true"/> <image :style="{ height: imgAdsValue.list[0].imgHeight }" :src="$util.img(imgAdsValue.list[0].imageUrl)" mode="widthFix" :show-menu-by-longpress="true"/>
</view> </view>
</block> </block>
@@ -13,7 +13,7 @@
}" :autoplay="true" :interval="imgAdsValue.interval" circular="true" :indicator-dots="isDots" }" :autoplay="true" :interval="imgAdsValue.interval" circular="true" :indicator-dots="isDots"
indicator-color="rgba(130, 130, 130, .5)" :indicator-active-color="imgAdsValue.indicatorColor" indicator-color="rgba(130, 130, 130, .5)" :indicator-active-color="imgAdsValue.indicatorColor"
@change="swiperChange"> @change="swiperChange">
<swiper-item class="swiper-item" :style="imgAdsSwiper" v-for="(item, index) in imgAdsValue.list" :key="index" v-if="item.imageUrl" @click="$util.diyRedirectTo(item.link)"> <swiper-item class="swiper-item" :style="imgAdsSwiper" v-for="(item, index) in imgAdsValue.list" :key="index" v-if="item.imageUrl" @click="handlerClick(item.link)" @tap="handlerClick(item.link)">
<view class="item" :style="imgAdsSwiper + 'height: ' + item.imgHeight"> <view class="item" :style="imgAdsSwiper + 'height: ' + item.imgHeight">
<image :src="$util.img(item.imageUrl)" :mode="item.imageMode || 'scaleToFill'" :show-menu-by-longpress="true"/> <image :src="$util.img(item.imageUrl)" :mode="item.imageMode || 'scaleToFill'" :show-menu-by-longpress="true"/>
</view> </view>
@@ -34,6 +34,8 @@
</template> </template>
<script> <script>
// 图片广告
import DiyMinx from './minx.js'
export default { export default {
name: 'diy-img-ads', name: 'diy-img-ads',
props: { props: {
@@ -55,6 +57,7 @@
created() { created() {
this.calcSingleRow(); this.calcSingleRow();
}, },
mixins: [DiyMinx],
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
@@ -131,7 +134,13 @@
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
this.isDots = false; this.isDots = false;
// #endif // #endif
} },
async handlerClick(link) {
await this.__$emitEvent({eventName: 'img-ads-tap', data: link, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
this.$util.diyRedirectTo(link);
}})
},
} }
}; };
</script> </script>

View File

@@ -1,6 +1,6 @@
<template> <template>
<x-skeleton data-component-name="diy-live" type="banner" :loading="loading" :configs="skeletonConfig"> <x-skeleton data-component-name="diy-live" type="banner" :loading="loading" :configs="skeletonConfig">
<view class="live-wrap" @click="entryRoom(liveInfo.roomid)" v-if="liveInfo"> <view class="live-wrap" @click="handlerClick(liveInfo.roomid)" @tap="handlerClick(liveInfo.roomid)" v-if="liveInfo">
<view class="banner-wrap"> <view class="banner-wrap">
<image :src="liveInfo.banner != '' ? $util.img(liveInfo.banner) : $util.img('public/uniapp/live/live_default_banner.png')" <image :src="liveInfo.banner != '' ? $util.img(liveInfo.banner) : $util.img('public/uniapp/live/live_default_banner.png')"
mode="widthFix" @error="liveInfo.banner = $util.img('public/uniapp/live/live_default_banner.png')"/> mode="widthFix" @error="liveInfo.banner = $util.img('public/uniapp/live/live_default_banner.png')"/>
@@ -32,6 +32,7 @@
<script> <script>
// 直播 // 直播
import DiyMinx from './minx.js'
export default { export default {
components: {}, components: {},
name: 'diy-live', name: 'diy-live',
@@ -59,6 +60,7 @@
created() { created() {
this.getLiveInfo(); this.getLiveInfo();
}, },
mixins: [DiyMinx],
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
@@ -136,7 +138,13 @@
} }
} }
}); });
} },
async handlerClick(roomid) {
await this.__$emitEvent({eventName: 'live-tap', data: roomid, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
this.entryRoom(roomid);
}})
},
} }
}; };
</script> </script>

View File

@@ -1,7 +1,7 @@
<template> <template>
<view data-component-name="diy-many-goods-list" class="many-goods-list"> <view data-component-name="diy-many-goods-list" class="many-goods-list">
<scroll-view scroll-x="true" class="many-goods-list-head" :scroll-into-view="'a' + cateIndex" :style="manyWrapCss"> <scroll-view scroll-x="true" class="many-goods-list-head" :scroll-into-view="'a' + cateIndex" :style="manyWrapCss">
<view v-for="(item, index) in value.list" class="scroll-item" :class="{ active: index == cateIndex }" :id="'a' + index" :key="index" @click="changeCateIndex(item, index)"> <view v-for="(item, index) in value.list" class="scroll-item" :class="{ active: index == cateIndex }" :id="'a' + index" :key="index" @click="handlerClick({item,index})" @tap="handlerClick({item,index})">
<view class="split-line" v-if="index > 0"></view> <view class="split-line" v-if="index > 0"></view>
<view class="cate"> <view class="cate">
<view class="name" :style="{ color : value.headStyle.titleColor }">{{ item.title }}</view> <view class="name" :style="{ color : value.headStyle.titleColor }">{{ item.title }}</view>
@@ -16,6 +16,7 @@
</template> </template>
<script> <script>
import DiyMinx from './minx.js'
export default { export default {
name: 'diy-many-goods-list', name: 'diy-many-goods-list',
props: { props: {
@@ -50,6 +51,7 @@
created() { created() {
this.changeCateIndex(this.value.list[0], 0, true); this.changeCateIndex(this.value.list[0], 0, true);
}, },
mixins: [DiyMinx],
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
@@ -166,7 +168,13 @@
if (isFirst) return; if (isFirst) return;
this.$refs.diyGoodsList.goodsValue = this.goodsValue; this.$refs.diyGoodsList.goodsValue = this.goodsValue;
this.$refs.diyGoodsList.getGoodsList(); this.$refs.diyGoodsList.getGoodsList();
} },
async handlerClick({item,index}) {
await this.__$emitEvent({eventName: 'many-goods-list-tap', data: {item,index}, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
this.changeCateIndex(item, index, false);
}})
},
} }
}; };
</script> </script>

View File

@@ -10,7 +10,7 @@
:longitude="item.lng" :longitude="item.lng"
:latitude="item.lat" :latitude="item.lat"
show-location> show-location>
<cover-view style="position:absolute;right:10px;bottom:30rpx;z-index:99999;background:#4390FF;padding:5px 10px;wxcs_style_padding:10rpx 20rpx;border-radius:8rpx;color: #fff;" @click="tomap(item)"> <cover-view style="position:absolute;right:10px;bottom:30rpx;z-index:99999;background:#4390FF;padding:5px 10px;wxcs_style_padding:10rpx 20rpx;border-radius:8rpx;color: #fff;" @click="handlerClick(item)" @tap="handlerClick(item)">
<cover-view style="font-size:24rpx">一键导航</cover-view> <cover-view style="font-size:24rpx">一键导航</cover-view>
</cover-view> </cover-view>
</map> </map>
@@ -20,6 +20,8 @@
</template> </template>
<script> <script>
// 地图
import DiyMinx from './minx.js'
export default { export default {
name: 'diy-map', name: 'diy-map',
props: { props: {
@@ -35,6 +37,7 @@
}, },
created() { created() {
}, },
mixins: [DiyMinx],
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
@@ -68,6 +71,12 @@
longitude: parseFloat(item.lng), longitude: parseFloat(item.lng),
name:"一键导航", name:"一键导航",
}) })
},
async handlerClick(item) {
await this.__$emitEvent({eventName: 'map-tap', data: item, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
this.tomap(item);
}})
} }
} }
}; };

View File

@@ -3,7 +3,7 @@
<x-skeleton type="list" :loading="loading" :configs="skeletonConfig" v-if="value.ornament.type == 'default'"> <x-skeleton type="list" :loading="loading" :configs="skeletonConfig" v-if="value.ornament.type == 'default'">
<view class="merch-wrap" :style="warpCss"> <view class="merch-wrap" :style="warpCss">
<view :class="['list-wrap', value.style]" :style="warpCss"> <view :class="['list-wrap', value.style]" :style="warpCss">
<view :class="['item', value.ornament.type]" v-for="(item, index) in list" :key="index" :style="itemCss" @click="toDetail(item)"> <view :class="['item', value.ornament.type]" v-for="(item, index) in list" :key="index" :style="itemCss" @click="handlerClick(item)" @tap="handlerClick(item)">
<view class="merch-img"> <view class="merch-img">
<image class="cover-img" :src="$util.img(item.merch_image)" mode="widthFix" @error="imgError(index)" /> <image class="cover-img" :src="$util.img(item.merch_image)" mode="widthFix" @error="imgError(index)" />
</view> </view>
@@ -22,7 +22,7 @@
<view class="uni-scroll-view-content"> <view class="uni-scroll-view-content">
<!-- #endif --> <!-- #endif -->
<view class="merch-nav-item graphic" v-for="(item, index) in list" :key="index" :style="{ width: 100 / 4 + '%' }" @click="toDetail(item)"> <view class="merch-nav-item graphic" v-for="(item, index) in list" :key="index" :style="{ width: 100 / 4 + '%' }" @click="handlerClick(item)" @tap="handlerClick(item)">
<view class="graphic-img" v-if="value.mode != 'text'" :style="{ fontSize: value.imageSize * 2 + 'rpx', width: value.imageSize * 2 + 'rpx', height: value.imageSize * 2 + 'rpx' }"> <view class="graphic-img" v-if="value.mode != 'text'" :style="{ fontSize: value.imageSize * 2 + 'rpx', width: value.imageSize * 2 + 'rpx', height: value.imageSize * 2 + 'rpx' }">
<image <image
:src="$util.img(item.merch_image) || $util.img('public/uniapp/default_img/goods.png')" :src="$util.img(item.merch_image) || $util.img('public/uniapp/default_img/goods.png')"
@@ -46,6 +46,7 @@
<script> <script>
// 文章 // 文章
import DiyMinx from './minx.js'
export default { export default {
name: 'diy-article', name: 'diy-article',
props: { props: {
@@ -98,6 +99,7 @@
created() { created() {
this.getList(); this.getList();
}, },
mixins: [DiyMinx],
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function (nval) { componentRefresh: function (nval) {
@@ -167,6 +169,12 @@
}, },
imgError(index) { imgError(index) {
if (this.list[index]) this.list[index].merch_image = this.$util.getDefaultImage().article; if (this.list[index]) this.list[index].merch_image = this.$util.getDefaultImage().article;
},
async handlerClick(item) {
await this.__$emitEvent({eventName: 'merch-list-tap', data: item, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
this.toDetail(item);
}})
} }
} }
}; };

View File

@@ -7,7 +7,7 @@
</view> </view>
<scroll-view class="diy-notes-box" scroll-x="true" show-scrollbar="true"> <scroll-view class="diy-notes-box" scroll-x="true" show-scrollbar="true">
<view class="notes-box-item" v-for="(item, i) in dataList" :key="i" @click="toDetail(item.note_id)" <view class="notes-box-item" v-for="(item, i) in dataList" :key="i" @click="handlerClick(item)" @tap="handlerClick(item)"
:style="notesItemStyle"> :style="notesItemStyle">
<view class="notes-item" v-if="item.status == 1"> <view class="notes-item" v-if="item.status == 1">
<view class="notes-item-con"> <view class="notes-item-con">
@@ -46,6 +46,7 @@
</template> </template>
<script> <script>
import DiyMinx from './minx.js'
export default { export default {
name: 'diy-notes', name: 'diy-notes',
props: { props: {
@@ -70,6 +71,7 @@
created() { created() {
this.getDataList(); this.getDataList();
}, },
mixins: [DiyMinx],
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
@@ -179,6 +181,12 @@
imageError(index) { imageError(index) {
this.dataList[index].img = this.$util.getDefaultImage().goods; this.dataList[index].img = this.$util.getDefaultImage().goods;
this.$forceUpdate(); this.$forceUpdate();
},
async handlerClick(item) {
await this.__$emitEvent({eventName: 'notes-tap', data: item, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
this.toDetail(item.note_id);
}})
} }
} }
}; };

View File

@@ -72,7 +72,7 @@
}, },
async handlerClick(item) { async handlerClick(item) {
await this.__$emitEvent({eventName: 'pictureTap', data: item, promiseCallback: (event, handler, awaitedResult) => { await this.__$emitEvent({eventName: 'picture-tap', data: item, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return; if (!awaitedResult) return;
if (item.link.wap_url) { if (item.link.wap_url) {
this.redirectTo(item.link); this.redirectTo(item.link);

View File

@@ -2,7 +2,7 @@
<x-skeleton data-component-name="diy-presale" :type="skeletonType" :loading="loading" :configs="skeletonConfig"> <x-skeleton data-component-name="diy-presale" :type="skeletonType" :loading="loading" :configs="skeletonConfig">
<view class="diy-presale" v-if="list.length" :class="[value.template, value.style]" :style="warpCss"> <view class="diy-presale" v-if="list.length" :class="[value.template, value.style]" :style="warpCss">
<template v-if="value.template == 'row1-of1'"> <template v-if="value.template == 'row1-of1'">
<view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss"> <view class="item" v-for="(item, index) in list" :key="index" @click="handlerClick(item)" @tap="handlerClick(item)" :class="[value.ornament.type]" :style="goodsItemCss">
<view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }"> <view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }">
<image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)"/> <image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)"/>
</view> </view>
@@ -33,7 +33,7 @@
</template> </template>
<template v-if="value.template == 'horizontal-slide'"> <template v-if="value.template == 'horizontal-slide'">
<scroll-view v-if="value.slideMode == 'scroll'" class="scroll" :scroll-x="true" :show-scrollbar="false"> <scroll-view v-if="value.slideMode == 'scroll'" class="scroll" :scroll-x="true" :show-scrollbar="false">
<view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss"> <view class="item" v-for="(item, index) in list" :key="index" @click="handlerClick(item)" @tap="handlerClick(item)" :class="[value.ornament.type]" :style="goodsItemCss">
<view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }"> <view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }">
<image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)"/> <image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(index)"/>
</view> </view>
@@ -58,7 +58,7 @@
<swiper v-if="value.slideMode == 'slide'" :autoplay="false" class="swiper" :style="{ height: swiperHeight }"> <swiper v-if="value.slideMode == 'slide'" :autoplay="false" class="swiper" :style="{ height: swiperHeight }">
<swiper-item v-for="(pageItem, pageIndex) in page" :key="pageIndex" :class="['swiper-item', (list.length && [list[pageIndex].length / 3] >= 1) && 'flex-between']"> <swiper-item v-for="(pageItem, pageIndex) in page" :key="pageIndex" :class="['swiper-item', (list.length && [list[pageIndex].length / 3] >= 1) && 'flex-between']">
<view class="item" v-for="(item, dataIndex) in list[pageIndex]" :key="dataIndex" @click="toDetail(item)" :class="[value.ornament.type]" :style="goodsItemCss"> <view class="item" v-for="(item, dataIndex) in list[pageIndex]" :key="dataIndex" @click="handlerClick(item)" @tap="handlerClick(item)":class="[value.ornament.type]" :style="goodsItemCss">
<view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }"> <view class="img-wrap" :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }">
<image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(dataIndex)"/> <image :style="{ borderRadius: value.imgAroundRadius * 2 + 'rpx' }" :src="$util.img(item.goods_image, { size: 'mid' })" mode="widthFix" @error="imageError(dataIndex)"/>
</view> </view>
@@ -87,6 +87,7 @@
</template> </template>
<script> <script>
import DiyMinx from './minx.js'
export default { export default {
name: 'diy-presale', name: 'diy-presale',
props: { props: {
@@ -107,6 +108,7 @@
this.initSkeleton(); this.initSkeleton();
this.getData(); this.getData();
}, },
mixins: [DiyMinx],
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) { componentRefresh: function(nval) {
@@ -236,6 +238,12 @@
let price = data.price; let price = data.price;
if (data.member_price && parseFloat(data.member_price) < parseFloat(price)) price = data.member_price; if (data.member_price && parseFloat(data.member_price) < parseFloat(price)) price = data.member_price;
return price; return price;
},
async handlerClick(item) {
await this.__$emitEvent({eventName: 'presale-tap', data: item, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
this.toDetail(item);
}})
} }
} }
}; };

View File

@@ -8,7 +8,8 @@
class="quick-nav-item" class="quick-nav-item"
v-for="(item, index) in value.list" v-for="(item, index) in value.list"
:key="index" :key="index"
@click="redirectTo(item.link)" @click="handlerClick(item)"
@tap="handlerClick(item)"
:style="{ background: 'linear-gradient(to right,' + item.bgColorStart ? item.bgColorStart : '' + ',' + item.bgColorEnd ? item.bgColorEnd : '' + ')' }" :style="{ background: 'linear-gradient(to right,' + item.bgColorStart ? item.bgColorStart : '' + ',' + item.bgColorEnd ? item.bgColorEnd : '' + ')' }"
> >
<view class="quick-img" v-if="item.imageUrl || item.icon"> <view class="quick-img" v-if="item.imageUrl || item.icon">
@@ -27,48 +28,56 @@
</template> </template>
<script> <script>
export default { import DiyMinx from './minx.js'
name: 'diy-quick-nav', export default {
props: { name: 'diy-quick-nav',
value: { props: {
type: Object value: {
} type: Object
},
data() {
return {};
},
created() {},
watch: {
// 组件刷新监听
componentRefresh: function(nval) {}
},
computed: {
componentStyle() {
var css = '';
css += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') {
css += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
css += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
css += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
css += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
css += 'box-shadow:' + (this.value.ornament.type == 'shadow' ? '0 0 10rpx ' + this.value.ornament.color : '') + ';'; },
css += 'border:' + (this.value.ornament.type == 'stroke' ? '2rpx solid ' + this.value.ornament.color : '') + ';'; data() {
return css; return {};
} },
}, created() {},
methods: { mixins: [DiyMinx],
redirectTo(link) { watch: {
if (link.wap_url) { // 组件刷新监听
if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) { componentRefresh: function(nval) {}
this.$refs.login.open(link.wap_url); },
return; computed: {
componentStyle() {
var css = '';
css += 'background-color:' + this.value.componentBgColor + ';';
if (this.value.componentAngle == 'round') {
css += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
css += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
css += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
css += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
} }
css += 'box-shadow:' + (this.value.ornament.type == 'shadow' ? '0 0 10rpx ' + this.value.ornament.color : '') + ';';
css += 'border:' + (this.value.ornament.type == 'stroke' ? '2rpx solid ' + this.value.ornament.color : '') + ';';
return css;
}
},
methods: {
redirectTo(link) {
if (link.wap_url) {
if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) {
this.$refs.login.open(link.wap_url);
return;
}
}
this.$util.diyRedirectTo(link);
},
async handlerClick(item) {
await this.__$emitEvent({eventName: 'quick-nav-tap', data: item, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
this.redirectTo(item.link);
}})
} }
this.$util.diyRedirectTo(link);
} }
} };
};
</script> </script>
<style> <style>
.quick-nav >>> .uni-scroll-view-content { .quick-nav >>> .uni-scroll-view-content {

View File

@@ -1,12 +1,13 @@
<template> <template>
<view data-component-name="diy-rich-text" class="rich-text-box" :style="richTextWarpCss"> <view data-component-name="diy-rich-text" class="rich-text-box" :style="richTextWarpCss">
<rich-text :nodes="html"></rich-text> <rich-text :nodes="html" @click="handlerClick" @tap="handlerClick"></rich-text>
</view> </view>
</template> </template>
<script> <script>
// 富文本 // 富文本
import htmlParser from '@/common/js/html-parser'; import htmlParser from '@/common/js/html-parser';
import DiyMinx from './minx.js'
export default { export default {
name: 'diy-rich-text', name: 'diy-rich-text',
props: { props: {
@@ -22,6 +23,7 @@ export default {
created() { created() {
this.html = htmlParser(this.value.html); this.html = htmlParser(this.value.html);
}, },
mixins: [DiyMinx],
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
@@ -40,7 +42,13 @@ export default {
} }
}, },
mounted() {}, mounted() {},
methods: {} methods: {
async handlerClick(item) {
await this.__$emitEvent({eventName: 'rich-text-tap', data: item, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
}})
}
}
}; };
</script> </script>

View File

@@ -8,7 +8,7 @@
<!-- 1左2右 --> <!-- 1左2右 -->
<template v-if="value.mode == 'row1-lt-of2-rt'"> <template v-if="value.mode == 'row1-lt-of2-rt'">
<view class="template-left"> <view class="template-left">
<view :class="['item', value.mode]" @click="$util.diyRedirectTo(value.list[0].link)" :style="{ marginRight: value.imageGap * 2 + 'rpx', width: list[0].imgWidth, height: list[0].imgHeight + 'px' }"> <view :class="['item', value.mode]" @click="handlerClick(value.list[0].link)" @tap="handlerClick(value.list[0].link)" :style="{ marginRight: value.imageGap * 2 + 'rpx', width: list[0].imgWidth, height: list[0].imgHeight + 'px' }">
<image :src="$util.img(value.list[0].imageUrl)" :mode="list[0].imageMode || 'scaleToFill'" :style="list[0].pageItemStyle" :show-menu-by-longpress="true"/> <image :src="$util.img(value.list[0].imageUrl)" :mode="list[0].imageMode || 'scaleToFill'" :style="list[0].pageItemStyle" :show-menu-by-longpress="true"/>
</view> </view>
</view> </view>
@@ -16,7 +16,7 @@
<view class="template-right"> <view class="template-right">
<template v-for="(item, index) in list"> <template v-for="(item, index) in list">
<template v-if="index > 0"> <template v-if="index > 0">
<view :key="index" :class="['item', value.mode]" @click="$util.diyRedirectTo(item.link)" :style="{ marginBottom: value.imageGap * 2 + 'rpx', width: item.imgWidth, height: item.imgHeight + 'px' }"> <view :key="index" :class="['item', value.mode]" @click="handlerClick(item.link)" @tap="handlerClick(item.link)" :style="{ marginBottom: value.imageGap * 2 + 'rpx', width: item.imgWidth, height: item.imgHeight + 'px' }">
<image :src="$util.img(item.imageUrl)" :mode="item.imageMode || 'scaleToFill'" :style="item.pageItemStyle" :show-menu-by-longpress="true"/> <image :src="$util.img(item.imageUrl)" :mode="item.imageMode || 'scaleToFill'" :style="item.pageItemStyle" :show-menu-by-longpress="true"/>
</view> </view>
</template> </template>
@@ -27,19 +27,19 @@
<!-- 1左3右 --> <!-- 1左3右 -->
<template v-else-if="value.mode == 'row1-lt-of1-tp-of2-bm'"> <template v-else-if="value.mode == 'row1-lt-of1-tp-of2-bm'">
<view class="template-left"> <view class="template-left">
<view :class="['item', value.mode]" :style="{ marginRight: value.imageGap * 2 + 'rpx', width: list[0].imgWidth, height: list[0].imgHeight + 'px' }" @click="$util.diyRedirectTo(value.list[0].link)"> <view :class="['item', value.mode]" :style="{ marginRight: value.imageGap * 2 + 'rpx', width: list[0].imgWidth, height: list[0].imgHeight + 'px' }" @click="handlerClick(value.list[0].link)" @tap="handlerClick(value.list[0].link)">
<image :src="$util.img(value.list[0].imageUrl)" :mode="list[0].imageMode || 'scaleToFill'" :style="list[0].pageItemStyle" :show-menu-by-longpress="true"/> <image :src="$util.img(value.list[0].imageUrl)" :mode="list[0].imageMode || 'scaleToFill'" :style="list[0].pageItemStyle" :show-menu-by-longpress="true"/>
</view> </view>
</view> </view>
<view class="template-right"> <view class="template-right">
<view :class="['item', value.mode]" :style="{ marginBottom: value.imageGap * 2 + 'rpx', width: list[1].imgWidth, height: list[1].imgHeight + 'px' }" @click="$util.diyRedirectTo(value.list[1].link)"> <view :class="['item', value.mode]" :style="{ marginBottom: value.imageGap * 2 + 'rpx', width: list[1].imgWidth, height: list[1].imgHeight + 'px' }" @click="handlerClick(value.list[1].link)" @tap="handlerClick(value.list[1].link)">
<image :src="$util.img(value.list[1].imageUrl)" :mode="list[1].imageMode || 'scaleToFill'" :style="list[1].pageItemStyle" :show-menu-by-longpress="true"/> <image :src="$util.img(value.list[1].imageUrl)" :mode="list[1].imageMode || 'scaleToFill'" :style="list[1].pageItemStyle" :show-menu-by-longpress="true"/>
</view> </view>
<view class="template-bottom"> <view class="template-bottom">
<template v-for="(item, index) in list"> <template v-for="(item, index) in list">
<template v-if="index > 1"> <template v-if="index > 1">
<view :key="index" :class="['item', value.mode]" @click="$util.diyRedirectTo(item.link)" <view :key="index" :class="['item', value.mode]" @click="handlerClick(item.link)" @tap="handlerClick(item.link)"
:style="{ :style="{
marginRight: value.imageGap * 2 + 'rpx', marginRight: value.imageGap * 2 + 'rpx',
width: item.imgWidth, width: item.imgWidth,
@@ -55,7 +55,7 @@
<template v-else> <template v-else>
<view :class="['item', value.mode]" v-for="(item, index) in list" :key="index" <view :class="['item', value.mode]" v-for="(item, index) in list" :key="index"
@click="$util.diyRedirectTo(item.link)" @click="handlerClick(item.link)" @tap="handlerClick(item.link)"
:style="{ marginRight: value.imageGap * 2 + 'rpx', marginBottom: value.imageGap * 2 + 'rpx', width: item.widthStyle, height: item.imgHeight + 'px' }"> :style="{ marginRight: value.imageGap * 2 + 'rpx', marginBottom: value.imageGap * 2 + 'rpx', width: item.widthStyle, height: item.imgHeight + 'px' }">
<image :src="$util.img(item.imageUrl)" :mode="item.imageMode || 'scaleToFill'" :style="item.pageItemStyle" :show-menu-by-longpress="true"/> <image :src="$util.img(item.imageUrl)" :mode="item.imageMode || 'scaleToFill'" :style="item.pageItemStyle" :show-menu-by-longpress="true"/>
</view> </view>
@@ -67,6 +67,7 @@
<script> <script>
// 魔方、橱窗 // 魔方、橱窗
import htmlParser from '@/common/js/html-parser'; import htmlParser from '@/common/js/html-parser';
import DiyMinx from './minx.js'
export default { export default {
name: 'diy-rubik-cube', name: 'diy-rubik-cube',
props: { props: {
@@ -115,6 +116,7 @@
} }
} }
}, },
mixins: [DiyMinx],
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
@@ -356,6 +358,13 @@
obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;'; obj += 'border-bottom-right-radius:' + this.value.bottomElementAroundRadius * 2 + 'rpx;';
}); });
return obj; return obj;
},
async handlerClick(link) {
await this.__$emitEvent({eventName: 'rubik-cube-tap', data: link, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
this.$util.diyRedirectTo(link);
}})
} }
} }
}; };

View File

@@ -290,7 +290,7 @@ export default {
}, },
methods: { methods: {
async handlerClick(link) { async handlerClick(link) {
await this.__$emitEvent({eventName: 'textTap', data: link, promiseCallback: (event, handler, awaitedResult) => { await this.__$emitEvent({eventName: 'text-tap', data: link, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return; if (!awaitedResult) return;
$util.diyRedirectTo(link); $util.diyRedirectTo(link);
}}) }})

View File

@@ -1,9 +1,10 @@
<template> <template>
<video data-component-name="diy-video" class="diy-video" :src="$util.img(value.videoUrl)" :poster="$util.img(value.imageUrl)" :style="videoWarpCss" objectFit="cover"></video> <video data-component-name="diy-video" class="diy-video" :src="$util.img(value.videoUrl)" :poster="$util.img(value.imageUrl)" :style="videoWarpCss" objectFit="cover" @click="handlerClick(value.videoUrl)" @tap="handlerClick(value.videoUrl)"></video>
</template> </template>
<script> <script>
// 视频 // 视频
import DiyMinx from './minx.js'
export default { export default {
name: 'diy-video', name: 'diy-video',
props: { props: {
@@ -15,6 +16,7 @@
return {}; return {};
}, },
created() {}, created() {},
mixins: [DiyMinx],
watch: { watch: {
// 组件刷新监听 // 组件刷新监听
componentRefresh: function(nval) {} componentRefresh: function(nval) {}
@@ -31,7 +33,13 @@
return obj; return obj;
} }
}, },
methods: {} methods: {
async handlerClick(videoUrl) {
await this.__$emitEvent({eventName: 'video-tap', data: videoUrl, promiseCallback: (event, handler, awaitedResult) => {
if (!awaitedResult) return;
}})
}
}
}; };
</script> </script>