Browse Source

分享按钮

luxf 1 week ago
parent
commit
ed53b1bd10

+ 60 - 0
components/common/u-share-action-sheet/index.vue

@@ -0,0 +1,60 @@
+<template>
+	<van-action-sheet
+	  :show="show"
+	  :actions="actions"
+		cancel-text="取消"
+		:close-on-click-overlay="true"
+		@select="onSelect"
+	  @cancel="onCancel"
+	/>
+</template>
+
+<script>
+	import VanActionSheet from '@/wxcomponents/vant/action-sheet/index'
+	
+	export default {
+		options: {
+			styleIsolation: 'shared'
+		},
+		components: {
+			VanActionSheet
+		},
+		props: {
+			shareInfo: null,
+			show: Boolean
+		},
+		computed: {
+		},
+		watch: {
+		},
+		data() {
+			return {
+				actions: [
+					
+				// 	{
+				// 	name: '生成海报',
+				// 	value: 'download'
+				// }, 
+				
+				{
+					name: '分享好友',
+					openType: 'share'
+				}]
+			}
+		},
+		created() {},
+		mounted() {},
+		methods: {
+			onSelect(e) {
+				if (e.value === 'download') {
+					this.showAlertDialog('功能未上线')
+				}
+			},
+			onCancel(e) {
+				this.$emit('update:show', false)
+			}
+		}
+	}
+</script>
+<style lang="scss">
+</style>

+ 1 - 1
pages.json

@@ -3,7 +3,7 @@
 		{
 			"path": "pages/index/index",
 			"style": {
-				"navigationBarTitleText": "uni-app"
+				"navigationBarTitleText": "慕尼黑上海电子生产设备展"
 			}
 		},
 		{ "path": "pages/news/index" },

+ 9 - 9
pages/exhibitor/components/exhibit-item.vue

@@ -18,7 +18,7 @@
 			<view class="exhibitor-views">浏览:30911</view>
 			<view class="exhibitor-action">
 				<view>
-					<button open-type="share" @click.stop="onShare(item)" :plain="true">
+					<button @click.stop="onShare(item)" :plain="true">
 						<view>
 							<view class="iconfont icon-zhuanfa"></view>
 							<view>分享</view>
@@ -65,15 +65,15 @@
 		created() {
 		},
 		methods: {
-			onShareAppMessage() {
-				const item = ops.target.dataset.item
-				return {
-					title: item.name || '分享展品',
-					path: `/pages/exhibitor/exhibit-detail`,
-					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70c02212.png'
-				};
-			},
 			onShare(item) {
+				const shareInfo = {
+					title: item.name || '汽车连接器 86W MLK 1,2 SD-HOLDER',
+					path: `/pages/exhibitor/exhibit-detail`,
+					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001000075/20241113/67343f1c494de.png?x-oss-process=image/resize,w_400'
+				}
+				this.$emit('share', {
+					detail: shareInfo
+				})
 			},
 			onClickExhibit(item) {
 				uni.navigateTo({

+ 10 - 10
pages/exhibitor/components/exhibitor-item.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="exhibitor-item" hover-class="active" @click="onClickExhibitor">
 		<view class="exhibitor-body">
-			<view class="exhibitor-logo"><image src="https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70c02212.png?x-oss-process=image/resize,w_200" mode="aspectFit" /></view>
+			<view class="exhibitor-logo"><image src="https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70c02212.png?x-oss-process=image/resize,w_400" mode="aspectFit" /></view>
 			<view class="exhibitor-name">
 				<view class="exhibitor-name-cn">科世达(上海)连接器有限公司</view>
 				<view class="exhibitor-name-en">Leopold Kostal GmbH & Co. KG</view>
@@ -15,7 +15,7 @@
 			<view class="exhibitor-views">浏览:30911</view>
 			<view class="exhibitor-action">
 				<view>
-					<button open-type="share" :plain="true" @click.stop="onShare(item)">
+					<button :plain="true" @click.stop="onShare(item)">
 						<view>
 							<view class="iconfont icon-zhuanfa"></view>
 							<view>分享</view>
@@ -62,15 +62,15 @@
 		created() {
 		},
 		methods: {
-			onShareAppMessage(ops) {
-				const item = ops.target.dataset.item
-				return {
-					title: item.name || '分享展商',
-					path: `/pages/exhibitor/exhibit-detail`,
-					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70c02212.png'
-				};
-			},
 			onShare(item) {
+				const shareInfo = {
+					title: item.name || '科世达(上海)连接器有限公司',
+					path: `/pages/exhibitor/exhibit-detail`,
+					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70c02212.png?x-oss-process=image/resize,w_400'
+				}
+				this.$emit('share', {
+					detail: shareInfo
+				})
 			},
 			onClickExhibitor() {
 				uni.navigateTo({

+ 17 - 5
pages/exhibitor/detail.vue

@@ -52,7 +52,7 @@
 							<view>人气:11192</view>
 						</view>
 						<view>
-							<button open-type="share" :plain="true">
+							<button open-type="share" :plain="true" @click.stop="onShare(item)">
 								<view>
 									<view class="iconfont icon-zhuanfa"></view>
 									<view>分享</view>
@@ -89,12 +89,14 @@
 				<view class="click-more"><van-button type="primary" @click="navigateTo('/pages/exhibitor/index')">点击查看更多展商信息</van-button></view>
 			</view>
 		</u-scroll-view>
+		<u-share-action-sheet :show.sync="showShare" :show-info="shareInfo" />
 	</view>
 </template>
 
 <script>
 	import NavBar from '@/components/layout/nav-bar'
 	import UScrollView from '@/components/common/u-scroll-view'
+	import UShareActionSheet from '@/components/common/u-share-action-sheet'
 	import UPanel from '@/components/common/u-panel'
 	import ExhibitRecommend from '@/pages/exhibitor/components/exhibit-recommend.vue'
 	import NewsRecommend from '@/pages/news/components/news-recommend.vue'
@@ -107,6 +109,7 @@
 		components: {
 			NavBar,
 			UScrollView,
+			UShareActionSheet,
 			UPanel,
 			ExhibitRecommend,
 			ActivityRecommend,
@@ -116,6 +119,8 @@
 		},
 		data() {
 			return {
+				showShare: false,
+				shareInfo: null,
 				exhibitor: {
 					favourited: true,
 					liked: false,
@@ -127,12 +132,19 @@
 			this.loadFontFace('Poppins')
 		},
 		methods: {
-			onShareAppMessage() {
+			onShareAppMessage(ops) {
+				const item = ops.target.dataset.item || {}
+				this.shareInfo = null
+				this.showShare = false
 				return {
-					title: '分享展商详情',
-					path: `/pages/exhibitor/exhibit-detail`,
-					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70c02212.png'
+					title: item.name || '科世达(上海)连接器有限公司',
+					path: `/pages/exhibitor/detail`,
+					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70c02212.png?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
 				}
+			},
+			onShare(item) {
+				this.shareInfo = item
+				this.showShare = true
 			}
 		}
 	}

+ 16 - 6
pages/exhibitor/exhibit-detail.vue

@@ -82,12 +82,14 @@
 				</u-panel>
 			</view>
 		</u-scroll-view>
+		<u-share-action-sheet :show.sync="showShare" :show-info="shareInfo" />
 	</view>
 </template>
 
 <script>
 	import NavBar from '@/components/layout/nav-bar'
 	import UScrollView from '@/components/common/u-scroll-view'
+	import UShareActionSheet from '@/components/common/u-share-action-sheet'
 	import UPanel from '@/components/common/u-panel'
 	
 	export default {
@@ -97,11 +99,14 @@
 		components: {
 			NavBar,
 			UScrollView,
+			UShareActionSheet,
 			UPanel
 		},
 		computed: {},
 		data() {
 			return {
+				showShare: false,
+				shareInfo: null,
 				exhibit: {
 					favourited: true,
 					liked: false,
@@ -113,17 +118,22 @@
 			this.loadFontFace('Poppins')
 		},
 		methods: {
-			onShareAppMessage() {
+			onShareAppMessage(ops) {
+				const item = ops.target.dataset.item || {}
+				this.shareInfo = null
+				this.showShare = false
 				return {
-					title: '分享展品详情',
+					title: item.name || '汽车连接器 86W MLK 1,2 SD-HOLDER',
 					path: `/pages/exhibitor/exhibit-detail`,
-					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70c02212.png'
+					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001000075/20241113/67343f1c494de.png?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
 				}
 			},
+			onShare(item) {
+				this.shareInfo = item
+				this.showShare = true
+			},
 			onClickDetail(e) {
-				uni.navigateTo({
-					url: '/pages/exhibitor/detail'
-				})
+				this.navigateTo('/pages/exhibitor/detail')
 			}
 		}
 	}

+ 44 - 21
pages/exhibitor/exhibit.vue

@@ -3,38 +3,40 @@
 		<nav-bar title="展品信息" @init="onInitNavbar"></nav-bar>
 		<u-scroll-view>
 			<view class="main-container">
-			<view class="exhibitor-filter">
-				<view>
-					<view class="exhibitor-filter-label">展馆号</view>
-					<u-dropdown-select ref="select1" v-model="categoryId" placeholder="选择展馆号" :options="categories" @dropdown="onSelectDropdown(1)" /> 
+				<view class="exhibitor-filter">
+					<view>
+						<view class="exhibitor-filter-label">展馆号</view>
+						<u-dropdown-select ref="select1" v-model="categoryId" placeholder="选择展馆号" :options="categories" @dropdown="onSelectDropdown(1)" /> 
+					</view>
+					<view>
+						<view class="exhibitor-filter-label">产品类别</view>
+						<u-dropdown-select ref="select2" v-model="categoryId" placeholder="选择产品类别" :options="categories" @dropdown="onSelectDropdown(2)" /> 
+					</view>
+					<view>
+						<view class="exhibitor-filter-label">应用领域</view>
+						<u-dropdown-select  ref="select3" v-model="categoryId" placeholder="选择应用领域" :options="categories" @dropdown="onSelectDropdown(3)" /> 
+					</view>
 				</view>
-				<view>
-					<view class="exhibitor-filter-label">产品类别</view>
-					<u-dropdown-select ref="select2" v-model="categoryId" placeholder="选择产品类别" :options="categories" @dropdown="onSelectDropdown(2)" /> 
+				<u-search v-model="searchKeyword" placeholder="搜索展商 / 展品名称 / 会议" @search="onSearch" />
+				<view class="ad-space">
+					<image src="https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70a6c76a.png?x-oss-process=image/resize,w_200" mode="aspectFill"/>
 				</view>
-				<view>
-					<view class="exhibitor-filter-label">应用领域</view>
-					<u-dropdown-select  ref="select3" v-model="categoryId" placeholder="选择应用领域" :options="categories" @dropdown="onSelectDropdown(3)" /> 
+				<van-empty v-if="exhibitList.length === 0" description="暂无数据" />
+				<view v-else class="exhibit-list exhibitor-list">
+					<template v-for="(item, index) in exhibitList">
+						<exhibit-item :item="item" :key="index" @share="onShare" />
+					</template>	
 				</view>
 			</view>
-			<u-search v-model="searchKeyword" placeholder="搜索展商 / 展品名称 / 会议" @search="onSearch" />
-			<view class="ad-space">
-				<image src="https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70a6c76a.png?x-oss-process=image/resize,w_200" mode="aspectFill"/>
-			</view>
-			<van-empty v-if="exhibitList.length === 0" description="暂无数据" />
-			<view v-else class="exhibit-list exhibitor-list">
-				<template v-for="(item, index) in exhibitList">
-					<exhibit-item :item="item" :key="index" />
-				</template>	
-			</view>
-		</view>
 		</u-scroll-view>
+		<u-share-action-sheet :show.sync="showShare" :show-info="shareInfo" />
 	</view>
 </template>
 
 <script>
 	import NavBar from '@/components/layout/nav-bar'
 	import UScrollView from '@/components/common/u-scroll-view'
+	import UShareActionSheet from '@/components/common/u-share-action-sheet'
 	import USearch from '@/components/common/u-search'
 	import UDropdownSelect from '@/components/common/u-dropdown-select'
 	import ExhibitItem from '@/pages/exhibitor/components/exhibit-item.vue'
@@ -48,6 +50,7 @@
 			UScrollView,
 			USearch,
 			UDropdownSelect,
+			UShareActionSheet,
 			ExhibitItem
 		},
 		computed: {
@@ -57,6 +60,8 @@
 				scrollviewHeight: 0,
 				searchKeyword: '',
 				exhibitList: [{ favourited: true }, { liked: true }, { voted: true }, {} ],
+				shareInfo: null,
+				showShare: false,
 				categories: [{
 					label: '表面贴装',
 					value: 1,
@@ -100,6 +105,24 @@
 		created() {
 		},
 		methods: {
+			onShare(e) {
+				this.shareInfo = e.detail
+				this.showShare = true
+			},
+			onShareAppMessage: function (res) {
+				if (res.from === 'button') {
+					if (this.shareInfo) {
+						return this.shareInfo
+					}
+				}
+				this.shareInfo = null
+				this.showShare = false
+				return {
+					title: '慕尼黑上海电子生产设备展',
+					path: '/pages/index/index',
+					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da5a7dd374.png?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
+				}
+			},
 			onSelectDropdown(index) {
 				['select1', 'select2', 'select3'].forEach(v => {
 					if (v !== 'select' + index) {

+ 2 - 2
pages/exhibitor/index.vue

@@ -24,7 +24,7 @@
 				<van-empty v-if="exhibitorList.length === 0" description="暂无数据" />
 				<view v-else class="exhibitor-list">
 					<template v-for="(item, index) in exhibitorList">
-						<exhibitor-item :item="item" :key="index" />
+						<exhibitor-item :item="item" :key="index" @share="(e) => $emit('share', e)" />
 					</template>	
 				</view>
 			</view>
@@ -53,7 +53,7 @@
 		data() {
 			return {
 				searchKeyword: '',
-				exhibitorList: [{ favourited: true }, { liked: true }, { voted: true }, {}, {}, {}],
+				exhibitorList: [{ favourited: true, name: '科世达(上海)连接器有限公司' }, { liked: true }, { voted: true }, {}, {}, {}],
 				categories: [{
 					label: '表面贴装',
 					value: 1,

+ 3 - 3
pages/index/home.vue

@@ -133,7 +133,7 @@
 				navIcons: [{
 					icon: 'icon-xiaochengxu-guanyuzhanhuiicon',
 					name: '关于展会',
-					link: ''
+					link: 'https://www.productronicachina.com.cn/zh-cn/productronica-china-2025'
 				}, {
 					icon: 'icon-xiaochengxu-zhanshangmingluicon',
 					name: '展商名录',
@@ -153,7 +153,7 @@
 				}, {
 					icon: 'icon-xiaochengxu-zhanguanpingmiantuicon',
 					name: '展馆平面图',
-					link: ''
+					link: 'https://www.productronicachina.com.cn/for-visitors-fairgrounds-map'
 				}, {
 					icon: 'icon-xiaochengxu-guanzhongzhinanicon',
 					name: '观众指南',
@@ -161,7 +161,7 @@
 				}, {
 					icon: 'icon-xiaochengxu-jiaotongzhinanicon',
 					name: '交通指南',
-					link: ''
+					link: 'https://www.productronicachina.com.cn/travel-stay-getting-there'
 				}],
 				images: [{
 					src: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da5a7dd374.png?x-oss-process=image/resize,w_750',

+ 27 - 4
pages/index/index.vue

@@ -1,16 +1,18 @@
 <template>
 	<view class="content">
-		<home v-if="tabbarActive === 'home'" @switch-tab="tabbarActive = 'exhibitor'"/>
-		<exhibitor v-if="tabbarActive === 'exhibitor'" />
+		<home v-if="tabbarActive === 'home'" @switch-tab="tabbarActive = 'exhibitor'" />
+		<exhibitor v-if="tabbarActive === 'exhibitor'" @share="onShare" />
 		<activity v-if="tabbarActive === 'activity'" />
 		<user v-if="tabbarActive === 'user'" />
 		<van-dialog id="van-dialog" />
 		<tab-bar :active.sync="tabbarActive"></tab-bar>
+		<u-share-action-sheet :show.sync="showShare" :show-info="shareInfo" />
 	</view>
 </template>
 
 <script>
 	import TabBar from '@/components/layout/tab-bar.vue'
+	import UShareActionSheet from '@/components/common/u-share-action-sheet'
 	import Home from '@/pages/index/home.vue'
 	import Exhibitor from '@/pages/exhibitor/index.vue'
 	import Activity from '@/pages/activity/index.vue'
@@ -25,17 +27,38 @@
 			Home,
 			Exhibitor,
 			Activity,
-			User
+			User,
+			UShareActionSheet
 		},
 		data() {
 			return {
-				tabbarActive: 'home'
+				tabbarActive: 'home',
+				showShare: false,
+				shareInfo: null
 			}
 		},
 		created() {
 			
 		},
 		methods: {
+			onShare(e) {
+				this.shareInfo = e.detail
+				this.showShare = true
+			},
+			onShareAppMessage: function (res) {
+				if (res.from === 'button') {
+					if (this.shareInfo) {
+						return this.shareInfo
+					}
+				}
+				this.shareInfo = null
+				this.showShare = false
+				return {
+					title: '慕尼黑上海电子生产设备展',
+					path: '/pages/index/index',
+					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da5a7dd374.png?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
+				}
+			},
 			onClickSearch() {
 
 			}

+ 1 - 1
pages/user/info-edit.vue

@@ -89,7 +89,7 @@
 			},
 			onSubmit(e) {
 				this.saveLoading = true
-				if (this.avatar.indexOf('http://tmp') === 0) {
+				if (this.avatar.indexOf('http://tmp') === 0 || this.avatar.indexOf('wxfile') === 0) {
 					uploadFile({
 						filePath: this.avatar,
 					}).then(res => {

+ 1 - 1
pages/user/login.vue

@@ -170,7 +170,7 @@
 				this.redirectTo(this.redirectUrl || '/pages/user/index')
 			},
 			onConfirmGetProfile(e) {
-				let pagePath = '/pages/user/info-edit?avatar=' + encodeURIComponent(e.avatarUrl)
+				let pagePath = '/pages/user/info-edit?avatar=' + encodeURIComponent(e.detail.avatarUrl)
 				if (this.redirectUrl) {
 					pagePath += '&redirect=' + encodeURIComponent(this.redirectUrl)
 				}