Explorar o código

【Add】页面分享后台管理

liuxiangxin hai 5 meses
pai
achega
fe804fae84

+ 11 - 0
App.vue

@@ -3,6 +3,9 @@
 		data() {
 			return {
 				getOn:true,
+				globalData:{
+					shareList:[],
+				}
 			}
 		},
 		onLaunch: function(param) {
@@ -29,6 +32,14 @@
 					}
 				});
 			}
+			// 判断数据
+			this.$http.request('/api/share_message/get_list').then((callback)=>{
+				if( callback.code == 'success' ){
+					// 赋值
+					getApp().globalData.shareList = callback.data;
+				}
+			});
+			
 		},
 		onHide: function() {
 			console.log('App Hide');

+ 17 - 3
pages/car/index.vue

@@ -72,10 +72,24 @@
 			// #endif
 		},
 		onShareAppMessage(obj) {
-			return {
-			  title: '十二月 药优惠 得积分 兑豪礼',
-			  path: '/pages/index/index'
+			// 获取分享信息
+			let shareList 	= getApp().globalData.shareList;
+			// 获取分享信息
+			let shareObj	= {
+								title: '药优惠 得积分 兑豪礼',
+								path: '/pages/index/index',
+								imageUrl:'',
+							};
+			// 循环列表
+			for ( let i in shareList ) {
+				if( shareList[i].pages == 'pages/car/index' ) {
+					shareObj.path  = shareList[i].path ? shareList[i].path : shareObj.path ;
+					shareObj.title  = shareList[i].title ? shareList[i].title : shareObj.title ;
+					shareObj.imageUrl  = shareList[i].image_url ? shareList[i].image_url : shareObj.imageUrl ;
+				}
 			}
+			// 返回分享信息
+			return shareObj;
 		},
 		onShow() {
 			// 登录提示

+ 17 - 3
pages/index/index.vue

@@ -75,10 +75,24 @@
 			// #endif
 		},
 		onShareAppMessage(obj) {
-			return {
-			  title: '十二月 药优惠 得积分 兑豪礼',
-			  path: '/pages/index/index'
+			// 获取分享信息
+			let shareList 	= getApp().globalData.shareList;
+			// 获取分享信息
+			let shareObj	= {
+								title: '药优惠 得积分 兑豪礼',
+								path: '/pages/index/index',
+								imageUrl:'',
+							};
+			// 循环列表
+			for ( let i in shareList ) {
+				if( shareList[i].pages == 'pages/index/index' ) {
+					shareObj.path  = shareList[i].path ? shareList[i].path : shareObj.path ;
+					shareObj.title  = shareList[i].title ? shareList[i].title : shareObj.title ;
+					shareObj.imageUrl  = shareList[i].image_url ? shareList[i].image_url : shareObj.imageUrl ;
+				}
 			}
+			// 返回分享信息
+			return shareObj;
 		},
 		onShow() {
 			// 是否显示价格

+ 2 - 2
pages/product/index.vue

@@ -358,8 +358,8 @@
 		},
 		onShareAppMessage(obj) {
 			return {
-			  title: this.productInfo.name,
-			  path: '/pages/index/index'
+				title: this.productInfo.name,
+				path: '/pages/product/index?product_id=' + this.productInfo.id
 			}
 		},
 		onShow() {

+ 17 - 3
pages/score/clockin.vue

@@ -96,10 +96,24 @@
 			// #endif
 		},
 		onShareAppMessage(obj) {
-			return {
-				title: '十二月 药优惠 得积分 兑豪礼',
-				path: '/pages/index/index'
+			// 获取分享信息
+			let shareList 	= getApp().globalData.shareList;
+			// 获取分享信息
+			let shareObj	= {
+								title: '药优惠 得积分 兑豪礼',
+								path: '/pages/score/clockin',
+								imageUrl:'',
+							};
+			// 循环列表
+			for ( let i in shareList ) {
+				if( shareList[i].pages == 'pages/score/clockin' ) {
+					shareObj.path  = shareList[i].path ? shareList[i].path : shareObj.path ;
+					shareObj.title  = shareList[i].title ? shareList[i].title : shareObj.title ;
+					shareObj.imageUrl  = shareList[i].image_url ? shareList[i].image_url : shareObj.imageUrl ;
+				}
 			}
+			// 返回分享信息
+			return shareObj;
 		},
 		onShow() {
 			// 登录提示

+ 17 - 3
pages/score/index.vue

@@ -52,10 +52,24 @@
 			// #endif
 		},
 		onShareAppMessage(obj) {
-			return {
-			  title: '12月 药优惠 得积分 兑豪礼',
-			  path: '/pages/index/index'
+			// 获取分享信息
+			let shareList 	= getApp().globalData.shareList;
+			// 获取分享信息
+			let shareObj	= {
+								title: '药优惠 得积分 兑豪礼',
+								path: '/pages/score/index',
+								imageUrl:'',
+							};
+			// 循环列表
+			for ( let i in shareList ) {
+				if( shareList[i].pages == 'pages/score/index' ) {
+					shareObj.path  = shareList[i].path ? shareList[i].path : shareObj.path ;
+					shareObj.title  = shareList[i].title ? shareList[i].title : shareObj.title ;
+					shareObj.imageUrl  = shareList[i].image_url ? shareList[i].image_url : shareObj.imageUrl ;
+				}
 			}
+			// 返回分享信息
+			return shareObj;
 		},
 		onShow() {
 			// 没有数据的话,或者请求中,不允许刷新

+ 17 - 3
pages/score/lottery.vue

@@ -129,10 +129,24 @@
 			// #endif
 		},
 		onShareAppMessage(obj) {
-			return {
-				title: '得积分 抽大奖',
-				path: '/pages/score/lottery',
+			// 获取分享信息
+			let shareList 	= getApp().globalData.shareList;
+			// 获取分享信息
+			let shareObj	= {
+								title: '药优惠 得积分 兑豪礼',
+								path: '/pages/score/lottery',
+								imageUrl:'',
+							};
+			// 循环列表
+			for ( let i in shareList ) {
+				if( shareList[i].pages == 'pages/score/lottery' ) {
+					shareObj.path  = shareList[i].path ? shareList[i].path : shareObj.path ;
+					shareObj.title  = shareList[i].title ? shareList[i].title : shareObj.title ;
+					shareObj.imageUrl  = shareList[i].image_url ? shareList[i].image_url : shareObj.imageUrl ;
+				}
 			}
+			// 返回分享信息
+			return shareObj;
 		},
 		onShow() {
 			// 没有数据的话,或者请求中,不允许刷新

+ 2 - 2
pages/score/product.vue

@@ -147,8 +147,8 @@
 		},
 		onShareAppMessage(obj) {
 			return {
-			  title: '十二月 药优惠 得积分 兑豪礼',
-			  path: '/pages/index/index'
+				title: this.productInfo.name,
+				path: '/pages/score/product?id=' + this.productInfo.id
 			}
 		},
 		onShow() {

+ 17 - 3
pages/user/index.vue

@@ -58,10 +58,24 @@
 			// #endif
 		},
 		onShareAppMessage(obj) {
-			return {
-			  title: '十二月 药优惠 得积分 兑豪礼',
-			  path: '/pages/index/index'
+			// 获取分享信息
+			let shareList 	= getApp().globalData.shareList;
+			// 获取分享信息
+			let shareObj	= {
+								title: '药优惠 得积分 兑豪礼',
+								path: '/pages/score/lottery',
+								imageUrl:'',
+							};
+			// 循环列表
+			for ( let i in shareList ) {
+				if( shareList[i].pages == 'pages/user/index' ) {
+					shareObj.path  = shareList[i].path ? shareList[i].path : shareObj.path ;
+					shareObj.title  = shareList[i].title ? shareList[i].title : shareObj.title ;
+					shareObj.imageUrl  = shareList[i].image_url ? shareList[i].image_url : shareObj.imageUrl ;
+				}
 			}
+			// 返回分享信息
+			return shareObj;
 		},
 		onShow() {
 			// 登录提示