Merge branch 'feat/camcard' of http://git.aigc-quickapp.com/Uniapp/lucky_shop into feat/camcard
This commit is contained in:
@@ -115,7 +115,12 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//媒体
|
//媒体
|
||||||
if (this.goodsSkuDetail.video_url) this.switchMedia = "video";
|
// 媒体显示顺序以后台商品「高级设置 → 媒体显示顺序」media_order 为准
|
||||||
|
// (1=主图在前 2=视频在前); 真正渲染媒体区的是 goods-detail-view 组件,
|
||||||
|
// 组件内部按同一规则切换, 这里保持一致避免两处规则打架
|
||||||
|
if (this.goodsSkuDetail.video_url) {
|
||||||
|
this.switchMedia = (Number(this.goodsSkuDetail.media_order) === 2) ? "video" : "img";
|
||||||
|
}
|
||||||
|
|
||||||
if (!Array.isArray(this.goodsSkuDetail.sku_images)) {
|
if (!Array.isArray(this.goodsSkuDetail.sku_images)) {
|
||||||
if (this.goodsSkuDetail.sku_images) this.goodsSkuDetail.sku_images = this.goodsSkuDetail.sku_images.split(",");
|
if (this.goodsSkuDetail.sku_images) this.goodsSkuDetail.sku_images = this.goodsSkuDetail.sku_images.split(",");
|
||||||
|
|||||||
@@ -156,6 +156,16 @@ export default {
|
|||||||
uni.showToast({ title: '自定义路径需以 / 开头', icon: 'none' });
|
uni.showToast({ title: '自定义路径需以 / 开头', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (v.linkMode === 'link') {
|
||||||
|
// 平台统一「选择链接」: link 是个对象({name,title,wap_url,page_key,page_params}),
|
||||||
|
// 走 $util.diyRedirectTo 由平台统一处理(内部页/外链/小程序/拨号 等)
|
||||||
|
const link = v.link && typeof v.link === 'object' ? v.link : null;
|
||||||
|
if (!link || !link.name) {
|
||||||
|
uni.showToast({ title: '请先选择链接', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$util.diyRedirectTo(link);
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
url = '/pages_tool/card/list';
|
url = '/pages_tool/card/list';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,6 +229,16 @@ export default {
|
|||||||
uni.showToast({ title: '自定义路径需以 / 开头', icon: 'none' });
|
uni.showToast({ title: '自定义路径需以 / 开头', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (mode === 'link') {
|
||||||
|
// 平台统一「选择链接」: moreLink 是个对象({name,title,wap_url,page_key,page_params}),
|
||||||
|
// 走 $util.diyRedirectTo 由平台统一处理(内部页/外链/小程序/拨号 等)
|
||||||
|
const link = this.v.moreLink && typeof this.v.moreLink === 'object' ? this.v.moreLink : null;
|
||||||
|
if (!link || !link.name) {
|
||||||
|
uni.showToast({ title: '请先选择链接', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$util.diyRedirectTo(link);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
this.$util.redirectTo(url);
|
this.$util.redirectTo(url);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -98,9 +98,9 @@
|
|||||||
<text v-if="showQrTip" class="qr-tip" :style="labelStyle">{{ qrTip || '扫码查看完整名片' }}</text>
|
<text v-if="showQrTip" class="qr-tip" :style="labelStyle">{{ qrTip || '扫码查看完整名片' }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 查看完整名片 -->
|
<!-- 发送名片 -->
|
||||||
<view v-if="showDetailBtn" class="mini-detail" :style="detailBtnStyle" hover-class="btn-press" @tap.stop="onDetail">
|
<view v-if="showDetailBtn" class="mini-detail" :style="detailBtnStyle" hover-class="btn-press" @tap.stop="onDetail">
|
||||||
<text class="detail-text">{{ detailBtnText || '查看完整名片' }}</text>
|
<text class="detail-text">{{ detailBtnText || '发送名片' }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 发名片(对齐名片详情页: 主题色大按钮; 点击跳原生转发中转页拉起微信转发面板) -->
|
<!-- 发名片(对齐名片详情页: 主题色大按钮; 点击跳原生转发中转页拉起微信转发面板) -->
|
||||||
|
|||||||
@@ -105,6 +105,24 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* 应用后台「高级设置 → 媒体显示顺序」(media_order)
|
||||||
|
* 1 = 主图在前(默认) 2 = 视频在前
|
||||||
|
* 商品没有视频时一律主图在前
|
||||||
|
*/
|
||||||
|
applyMediaOrder() {
|
||||||
|
const detail = this.goodsSkuDetail || {};
|
||||||
|
if (!detail.video_url) {
|
||||||
|
this.switchMedia = 'img';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.switchMedia = Number(detail.media_order) === 2 ? 'video' : 'img';
|
||||||
|
},
|
||||||
|
// 手动切换图片/视频
|
||||||
|
switchMediaTab(key) {
|
||||||
|
this.switchMedia = key;
|
||||||
|
if (key === 'img' && this.videoContext) this.videoContext.pause();
|
||||||
|
},
|
||||||
init(params) {
|
init(params) {
|
||||||
this.skuId = params.sku_id;
|
this.skuId = params.sku_id;
|
||||||
this.goodsId = params.goods_id;
|
this.goodsId = params.goods_id;
|
||||||
@@ -136,6 +154,9 @@ export default {
|
|||||||
|
|
||||||
this.videoContext = uni.createVideoContext('goodsVideo');
|
this.videoContext = uni.createVideoContext('goodsVideo');
|
||||||
|
|
||||||
|
// 媒体显示顺序: 以后台商品「高级设置 → 媒体显示顺序」为准
|
||||||
|
this.applyMediaOrder();
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
this.goodsSyncToGoodsCircle();
|
this.goodsSyncToGoodsCircle();
|
||||||
// #endif
|
// #endif
|
||||||
|
|||||||
@@ -65,10 +65,11 @@
|
|||||||
|
|
||||||
<!-- 切换视频、图片 -->
|
<!-- 切换视频、图片 -->
|
||||||
<view class="media-mode" v-if="goodsSkuDetail.video_url != ''">
|
<view class="media-mode" v-if="goodsSkuDetail.video_url != ''">
|
||||||
<text :class="{ 'color-base-bg': switchMedia == 'video' }" @click="switchMedia = 'video'">{{
|
<text v-for="tab in mediaTabs" :key="tab.key"
|
||||||
$lang('goods.detail.video') }}</text>
|
:class="{ 'color-base-bg': switchMedia == tab.key }"
|
||||||
<text :class="{ 'color-base-bg': switchMedia == 'img' }"
|
@click="switchMediaTab(tab.key)">{{
|
||||||
@click="(switchMedia = 'img'), videoContext.pause()">{{ $lang('goods.detail.image') }}</text>
|
tab.key == 'video' ? $lang('goods.detail.video') : $lang('goods.detail.image')
|
||||||
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -684,6 +685,24 @@ export default {
|
|||||||
// 用于「未拿到任何数据时不显示真实内容」, 避免加载失败/异常时切到空详情页
|
// 用于「未拿到任何数据时不显示真实内容」, 避免加载失败/异常时切到空详情页
|
||||||
hasRealData() {
|
hasRealData() {
|
||||||
return this.goodsSkuDetail && Number(this.goodsSkuDetail.goods_id) > 0;
|
return this.goodsSkuDetail && Number(this.goodsSkuDetail.goods_id) > 0;
|
||||||
|
},
|
||||||
|
// 媒体顺序的变更标识: 只在「媒体显示顺序 / 视频地址」变化时重新应用
|
||||||
|
// 用它而不是直接 watch goodsSkuDetail(深度监听), 是为了避免用户手动切到
|
||||||
|
// 「视频」后被详情数据的任意一次深层变更打回「主图」
|
||||||
|
mediaOrderKey() {
|
||||||
|
const detail = this.goodsSkuDetail || {};
|
||||||
|
return (detail.media_order || 1) + '|' + (detail.video_url || '');
|
||||||
|
},
|
||||||
|
// 底部「图片 / 视频」切换按钮的排列, 与后台设置的媒体显示顺序保持一致
|
||||||
|
mediaTabs() {
|
||||||
|
const detail = this.goodsSkuDetail || {};
|
||||||
|
const tabs = [{ key: 'img' }, { key: 'video' }];
|
||||||
|
return Number(detail.media_order) === 2 ? tabs.reverse() : tabs;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
mediaOrderKey() {
|
||||||
|
this.applyMediaOrder();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mixins: [scroll, detail]
|
mixins: [scroll, detail]
|
||||||
|
|||||||
Reference in New Issue
Block a user