Browse Source

commit -m 增加分享朋友圈

zhengjinyi 1 year ago
parent
commit
cf653566dd

+ 29 - 0
mixins/shareMixin.js

@@ -0,0 +1,29 @@
+import Vue from 'vue'
+const shareMixin = {
+	data() {
+	    return {
+			 staticUrl: this.global.staticUrl,	
+		}
+	},	
+    onShareAppMessage(res) {
+    	//分享转发
+    	if (res.from === 'button') {
+    		// 来自页面内转发按钮
+    	} 
+    	return {
+    		title: '联合丽格集采商城',
+    		path: 'pages/tabBar/home/index',
+    		imageUrl: `${this.staticUrl}icon_share_home@2x.png`
+    	}
+    },
+    // 分享朋友圈
+    onShareTimeline() {
+        return {
+            title: '联合丽格集采商城',
+            path: 'pages/tabBar/home/index',
+    		imageUrl: `${this.staticUrl}icon_share_home@2x.png`
+        }
+    }
+}
+
+export default shareMixin

+ 4 - 2
pages/goods/active-product.vue

@@ -14,8 +14,10 @@
 </template>
 
 <script>
-    import ProGood from './components/procurement_good.vue'
-    export default {
+import ProGood from './components/procurement_good.vue'
+import shareMixin from '@/mixins/shareMixin.js'
+export default {
+	mixins: [ shareMixin ], 
         components: {
             ProGood,
         },

+ 10 - 2
pages/goods/components/procurement_good.vue

@@ -8,7 +8,7 @@
                 {{storeInfo.name | sliceText(18)}}
             </view>
             <view class="pro-price" v-if='hasLogin'>
-                ¥{{storeInfo.price}}
+                ¥{{ storeInfo.price | NumFormat }}
             </view>
             <view class="product-price-none" v-else>
                 <uni-grader :grade="Number(storeInfo.priceGrade)"></uni-grader>
@@ -38,7 +38,15 @@
                     return value + '...'
                 }
                 return text
-            }
+            },
+			NumFormat(value) {
+				//处理金额
+				if(value){
+					return Number(value).toFixed(2)
+				}else{
+					return '0.00'
+				}
+			}
         },
         computed: {
         	...mapState(['hasLogin'])

+ 4 - 3
pages/goods/good-activity.vue

@@ -12,7 +12,7 @@
             borderRadius="10rpx"
             :isLoading="true"
             :loadingType="5"
-        ></tui-skeleton>
+        />
         <view v-else>
             <view class="img_big" v-if="active.activeType == '2'" @click="activeProducts">
                 <image style="width: 100%;height: 100%;" :src="active.activeImageVos[0].image" mode="aspectFill"></image>
@@ -29,14 +29,15 @@
 
 <script>
 import jumpMixins from '@/mixins/jumpMixins.js'
-import SpecialItem from './components/cm-special.vue'
+import SpecialItem from './components/cm-special.vue' 
 import ProGood from './components/procurement_good.vue'
+import shareMixin from '@/mixins/shareMixin.js'
 export default {
+	mixins: [ shareMixin,jumpMixins ], 
     components: {
         SpecialItem,
         ProGood
     },
-    mixins: [jumpMixins],
     data() {
         return {
             skeletonShow: true,

+ 7 - 12
pages/goods/good-floor.vue

@@ -43,8 +43,9 @@
 import { mapState, mapMutations } from 'vuex'
 import modalLayer from '@/components/modal-layer'
 import uniGrader from '@/components/uni-grade/uni-grade.vue'
-
+import shareMixin from '@/mixins/shareMixin.js'
 export default {
+	mixins: [ shareMixin ], 
 	components: {
 		modalLayer,
 		uniGrader
@@ -59,10 +60,15 @@ export default {
 			loadding: false,
 			pullUpOn: true,
 			pullFlag: true,
+			pathTitle:'',
+			pathId:''
 		}
 	},
 	onLoad(option) {
+		this.pathId = option.id
+		this.pathTitle = option.title
 		this.mallOrganizeProducts(option.id)
+		uni.setNavigationBarTitle({ title: option.title })
 	},
 	filters: {
 		NumFormat: function(text) {
@@ -105,17 +111,6 @@ export default {
 			this.getOnReachBottomData()
 		}
 	},
-	onShareAppMessage(res) {
-		//分享转发
-		if (res.from === 'button') {
-			// 来自页面内转发按钮
-		}
-		return {
-			title: '采美超级会员,巨量优惠享不停',
-			path: '/pages/user/member/member-product',
-			imageUrl: 'https://static.caimei365.com/app/img/icon/icon-member-share@2x.png'
-		}
-	},
 	onShow() {}
 }
 </script>

+ 8 - 0
pages/goods/product.vue

@@ -517,6 +517,14 @@ export default {
 			imageUrl: `${this.productImage[0]}`
 		}
 	},
+	// 分享朋友圈
+	onShareTimeline() {
+	    return {
+			title: `${this.product.name}`,
+			path: `pages/goods/product?type=share&id=${this.productId}`,
+			imageUrl: `${this.productImage[0]}`
+	    }
+	},
 	onShow() {
 		wxLogin.wxLoginAuthorize()
 		// 是否开启图片预览 true 不刷新调用接口 false刷新调用接口

+ 6 - 4
pages/login/bindwechat.vue

@@ -69,10 +69,12 @@
 </template>
 
 <script>
-	import { mapState,mapMutations } from 'vuex'
-	import authorize from '@/common/config/authorize.js' 
-	import wxLogin from '@/common/config/wxLogin.js'
-	export default{
+import { mapState,mapMutations } from 'vuex'
+import authorize from '@/common/config/authorize.js' 
+import wxLogin from '@/common/config/wxLogin.js'
+import shareMixin from '@/mixins/shareMixin.js'
+export default {
+	mixins: [ shareMixin ], 
 		data() {
 			return{
 				userIdentity:'',

+ 2 - 1
pages/login/login-code.vue

@@ -32,8 +32,9 @@ import authorize from '@/common/config/authorize.js'
 import wxLogin from '@/common/config/wxLogin.js'
 import { mapState, mapMutations } from 'vuex'
 import keyInput from '@/components/uni-keyinput/uni-keyinput'
-
+import shareMixin from '@/mixins/shareMixin.js'
 export default {
+	mixins: [ shareMixin ], 
 	components: {
 		keyInput
 	},

+ 2 - 0
pages/login/login.vue

@@ -106,7 +106,9 @@
 import { mapState, mapMutations } from 'vuex'
 import authorize from '@/common/config/authorize.js'
 import wxLogin from '@/common/config/wxLogin.js'
+import shareMixin from '@/mixins/shareMixin.js'
 export default {
+	mixins: [ shareMixin ], 
 	data() {
 		return {
 			staticUrl:this.global.staticUrl,

+ 2 - 0
pages/login/register-unid.vue

@@ -138,7 +138,9 @@ import { mapState, mapMutations } from 'vuex'
 import wxLogin from '@/common/config/wxLogin.js'
 import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue'
 import { uploadFileImage } from '@/services/public.js'
+import shareMixin from '@/mixins/shareMixin.js'
 export default {
+	mixins: [ shareMixin ], 
 	components: {
 		mpvueCityPicker
 	},

+ 2 - 0
pages/login/register.vue

@@ -223,7 +223,9 @@ import { mapState, mapMutations } from 'vuex'
 import wxLogin from '@/common/config/wxLogin.js'
 import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue'
 import { uploadFileImage } from '@/services/public.js'
+import shareMixin from '@/mixins/shareMixin.js'
 export default {
+	mixins: [ shareMixin ], 
 	components: {
 		mpvueCityPicker
 	},

+ 1 - 1
pages/tabBar/home/components/floors.vue

@@ -72,7 +72,7 @@
 		},
 		methods:{
 			handleFloor(floor){
-				this.$api.navigateTo(`/pages/goods/good-floor?id=${floor.id}`)
+				this.$api.navigateTo(`/pages/goods/good-floor?title=${floor.topic}&id=${floor.id}`)
 			},
 			productDetail(productId) {
 				// 跳转商品详情

+ 9 - 21
pages/tabBar/home/index.vue

@@ -7,19 +7,19 @@
 			borderRadius="10rpx"
 			:isLoading="true"
 			:loadingType="5"
-		></tui-skeleton>
+		/>
 		<view class="container-home tui-skeleton">
 			<!-- 轮播 -->
-			<banner :list="bannerList" v-if="skeletonShow"></banner>
+			<banner :list="bannerList" v-if="skeletonShow" />
 			<!-- 金刚区菜单 -->
-			<navbars :list="mainmenu" v-if="skeletonShow"></navbars>
+			<navbars :list="mainmenu" v-if="skeletonShow" />
 			<!-- 活动模块 -->
-			<hotmode :mallTheme="mallTheme" v-if="skeletonShow"></hotmode>
+			<hotmode :mallTheme="mallTheme" v-if="skeletonShow" />
 			<!-- 楼层模块 -->
-			<floors :list="floorList" v-if="skeletonShow"></floors>
+			<floors :list="floorList" v-if="skeletonShow" />
 		</view>
 		<!-- 侧边 -->
-		<scroll-top :isScrollTop="isScrollTop" :bottom="50"></scroll-top>
+		<scroll-top :isScrollTop="isScrollTop" :bottom="50" />
 	</view>
 </template>
 
@@ -30,8 +30,9 @@ import navbars from './components/navbars.vue'
 import hotmode from './components/hotmode.vue'
 import floors from './components/floors.vue'
 import homeMiXins from './index.js'
+import shareMixin from '@/mixins/shareMixin.js'
 export default {
-	mixins: [ homeMiXins ], 
+	mixins: [homeMiXins, shareMixin],
 	components: {
 		banner,
 		navbars,
@@ -52,22 +53,10 @@ export default {
 		this.mallOrganizeHome()
 		uni.stopPullDownRefresh()
 	},
-	onShareAppMessage(res) {
-		//分享转发
-		if (res.from === 'button') {
-			// 来自页面内转发按钮
-		} 
-		return {
-			title: '联合丽格集采商城',
-			path: 'pages/tabBar/home/index',
-			imageUrl: `${this.staticUrl}icon_share_home@2x.png`
-		}
-	},
 	onShow() {
 		this.authApplets()
 	},
-	onHide() {
-	}
+	onHide() {}
 }
 </script>
 
@@ -80,5 +69,4 @@ page {
 	height: auto;
 	background-color: #f7f7f7;
 }
-
 </style>

+ 11 - 0
pages/user/collection/collection.vue

@@ -406,6 +406,17 @@ export default {
 			uni.stopPullDownRefresh()
 		}, 200)
 	},
+	onShareAppMessage(res) {
+		//分享转发
+		if (res.from === 'button') {
+			// 来自页面内转发按钮
+		} 
+		return {
+			title: '联合丽格集采商城',
+			path: 'pages/tabBar/home/index',
+			imageUrl: `${this.staticUrl}icon_share_home@2x.png`
+		}
+	},
 	onShow() {}
 }
 </script>

+ 11 - 0
pages/user/operator/form.vue

@@ -85,6 +85,17 @@ export default {
 			}
 		}
 	},
+	onShareAppMessage(res) {
+		//分享转发
+		if (res.from === 'button') {
+			// 来自页面内转发按钮
+		} 
+		return {
+			title: '联合丽格集采商城',
+			path: 'pages/tabBar/home/index',
+			imageUrl: `${this.staticUrl}icon_share_home@2x.png`
+		}
+	},
 	onShow() {
 		
 	}

+ 11 - 0
pages/user/operator/list.vue

@@ -356,6 +356,17 @@ export default {
 			this.getOnReachBottomData()
 		}
 	},
+	onShareAppMessage(res) {
+		//分享转发
+		if (res.from === 'button') {
+			// 来自页面内转发按钮
+		} 
+		return {
+			title: '联合丽格集采商城',
+			path: 'pages/tabBar/home/index',
+			imageUrl: `${this.staticUrl}icon_share_home@2x.png`
+		}
+	},
 	onShow() {
 		this.infoClucbUser()
 	}