活动按钮状态流转

This commit is contained in:
2026-03-25 15:53:37 +08:00
commit 37346e790f
2762 changed files with 240282 additions and 0 deletions

View File

@@ -0,0 +1,197 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 产品详情 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="container" :style="{'--theme-color': themeColor}">
<!-- 标题栏 -->
<title-bar :showBack="true" title="产品详情"></title-bar>
<!-- 内容区 -->
<view class="container-main" v-if="loadEnd">
<view class="main-carousel">
<carousel :show-data="carouselList" height="750rpx" radius="0" right="32rpx" bottom="32rpx"></carousel>
</view>
<view class="main-info">
<view class="info-title">{{productInfo.name}}</view>
</view>
<view class="main-content">
<view class="content-title">产品详情</view>
<mp-html :content="productInfo.content" />
</view>
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
// #ifdef H5
import wx from 'weixin-js-sdk';
// #endif
import carousel from "@/pages/component/carousel/carousel.vue"
export default {
components: {
carousel,
},
data() {
return {
// 是否加载完成
loadEnd: false,
// 产品Id
productId: null,
// 产品详情
productInfo: {},
// 轮播图列表
carouselList: [],
}
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
}),
},
onLoad(option) {
this.productId = option.id
uni.showLoading({
title: "加载中"
})
this.getProductDetails(() => {
uni.hideLoading()
this.loadEnd = true
// #ifdef H5
this.initConfig()
// #endif
})
},
onShareAppMessage() {
return {
title: this.productInfo.name,
path: '/pages/member/product/details?id=' + this.productId,
imageUrl: this.carouselList[0].image,
}
},
onShareTimeline() {
return {
title: this.productInfo.name,
path: '/pages/member/product/details?id=' + this.productId,
imageUrl: this.carouselList[0].image,
}
},
methods: {
// 改变页面滚动状态
pageChange(state) {
this.pageShow = state
},
// #ifdef H5
// 微信公众号初始化方法
initConfig() {
this.$util.request("main.WeChatConfig", {
url: location.href.split('#')[0]
}).then(res => {
if (res.code == 1) {
wx.config({
debug: false,
appId: res.data.appId,
timestamp: Number(res.data.timestamp),
nonceStr: res.data.nonceStr,
signature: res.data.signature,
jsApiList: ["updateAppMessageShareData", "updateTimelineShareData", "wx-open-launch-weapp"],
openTagList: ["updateAppMessageShareData", "updateTimelineShareData", 'wx-open-launch-weapp'],
})
wx.ready(() => {
wx.updateAppMessageShareData({
title: this.productInfo.name,
desc: "",
link: window.location.href,
imgUrl: this.carouselList[0].image,
});
wx.updateTimelineShareData({
title: this.productInfo.name,
link: window.location.href,
imgUrl: this.carouselList[0].image,
});
});
} else {
uni.hideLoading()
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('通过config接口注入权限验证配置 ', error)
})
},
// #endif
// 获取产品详情
getProductDetails(fn) {
this.$util.request("member.product.details", {
id: this.productId
}).then(res => {
if (fn) fn()
if (res.code == 1) {
this.productInfo = res.data
this.carouselList = this.splitImages(res.data.images)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
if (fn) fn()
console.error('获取产品详情', error)
})
},
// 字符串转数组格式图片
splitImages(images) {
try {
if (images) return images.split(',');
else return []
} catch (error) {
return [];
}
},
}
}
</script>
<style lang="scss">
.container {
.container-main {
.main-info {
padding: 32rpx;
background: #FFF;
.info-title {
color: #5A5B6E;
font-size: 32rpx;
font-weight: 600;
line-height: 48rpx;
}
}
.main-content {
padding: 32rpx;
background: #FFF;
margin-top: 16rpx;
.content-title {
color: #5A5B6E;
font-size: 28rpx;
font-weight: 600;
line-height: 44rpx;
margin-bottom: 32rpx;
}
}
}
}
</style>