Quellcode durchsuchen

添加分享封面

wenjie vor 2 Monaten
Ursprung
Commit
533ef8d88f

+ 7 - 0
api/common.js

@@ -283,3 +283,10 @@ export function refreshVip(data) {
 	})
 }
 
+// 获取分享配置
+export function getShareInfo(data) {
+  return request({
+      url: '/zswl-cloud-shop/shareInfo/get',
+      data
+  })
+}

+ 26 - 4
detail/goodsDetail/index.vue

@@ -167,9 +167,17 @@
 <script>
 	import {detail,valid} from '@/api/goods.js'
 	import {search} from '@/api/shop.js'
+	import {
+		getShareInfo
+	} from '@/api/common.js'
 	export default {
 		data() {
 			return {
+				shareInfo:{
+					shareDescribe:'慧研学惠生活',
+					shareImg:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/XHBjBiMRhVYG8f1a30bbbd80c2346197b81470444c9a.png/1.png',
+					shareTitle:'慧研学惠生活',
+				},
 				show:false,
 				id:0,
 				loading:false,
@@ -337,10 +345,22 @@
 						this.getDistance()
 					}
 				})
+			},
+			getShareInfo(){
+				getShareInfo({id:1}).then(res=>{
+					if(res.state == 'Success'){
+						this.shareInfo = {
+							shareDescribe:res.content.shareDescribe,
+							shareImg:res.content.shareImg,
+							shareTitle:res.content.shareTitle,
+						}
+					}
+				})
 			}
 			
 		},
 		onLoad(option) {
+			this.getShareInfo()
 			this.id = option.id
 			console.log(111111,option);
 			// this.shopInfo = uni.getStorageSync('shopInfo')? JSON.parse(uni.getStorageSync('shopInfo')) :{logoPath:'',}
@@ -359,14 +379,16 @@
 		},
 		onShareTimeline() {
 		  return {
-		    title: "慧研学惠生活-"+this.info.goodsName,
-		    query: "id="+this.id,
+		    title: this.shareInfo.shareDescribe,
+		    query: "id=1",
+		    imageUrl: this.shareInfo.shareImg,
 		  };
 		},
 		onShareAppMessage() {
 		  return {
-		    title: "慧研学惠生活-"+this.info.goodsName,
-		    path: "/detail/goodsDetail/index?id="+this.id,
+		    title: this.shareInfo.shareDescribe,
+		    path: "/detail/goodsDetail/index",
+			imageUrl: this.shareInfo.shareImg,
 		  };
 		},
 		

+ 26 - 4
hotel/hotelDetail.vue

@@ -270,9 +270,17 @@
 <script>
 	import {getHotelDetail,getRoomList} from '@/api/hotel.js'
 	import {transformFromWGSToGCJ} from '@/utils/tool.js'
+	import {
+		getShareInfo
+	} from '@/api/common.js'
 	export default {
 		data() {
 			return {
+				shareInfo:{
+					shareDescribe:'慧研学惠生活',
+					shareImg:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/XHBjBiMRhVYG8f1a30bbbd80c2346197b81470444c9a.png/1.png',
+					shareTitle:'慧研学惠生活',
+				},
 				background: false,
 				status:'noMore',
 				loading : true,
@@ -551,6 +559,17 @@
 						}
 					}
 				})
+			},
+			getShareInfo(){
+				getShareInfo({id:1}).then(res=>{
+					if(res.state == 'Success'){
+						this.shareInfo = {
+							shareDescribe:res.content.shareDescribe,
+							shareImg:res.content.shareImg,
+							shareTitle:res.content.shareTitle,
+						}
+					}
+				})
 			}
 		},
 		onPageScroll(e) {
@@ -561,6 +580,7 @@
 			}
 		},
 		onLoad(options) {
+			this.getShareInfo()
 			this.query.hotelId = options.id
 			this.day = options.day || 1
 			if(options.checkInDate){
@@ -575,14 +595,16 @@
 		},
 		onShareTimeline() {
 		  return {
-		    title: "慧研学惠生活-"+this.info.chineseName,
-		    query: "id="+this.id,
+		    title: this.shareInfo.shareDescribe,
+		    query: "id=1",
+		    imageUrl: this.shareInfo.shareImg,
 		  };
 		},
 		onShareAppMessage() {
 		  return {
-		    title: "慧研学惠生活-"+this.info.chineseName,
-		    path: "/pages/signUp/index?id="+this.id,
+		    title: this.shareInfo.shareDescribe,
+		    path: "/hotel/hotelDetail?"+this.query.hotelId,
+			imageUrl: this.shareInfo.shareImg,
 		  };
 		},
 		

+ 12 - 12
pages/activity/index.vue

@@ -184,18 +184,18 @@ export default {
 	onLoad() {
 		// this.activityList()
 	},
-	onShareTimeline() {
-		return {
-			title: "慧研学惠生活",
-			query: "id=1",
-		};
-	},
-	onShareAppMessage() {
-		return {
-			title: "慧研学惠生活",
-			path: "/pages/activity/index",
-		};
-	},
+	// onShareTimeline() {
+	// 	return {
+	// 		title: "慧研学惠生活",
+	// 		query: "id=1",
+	// 	};
+	// },
+	// onShareAppMessage() {
+	// 	return {
+	// 		title: "慧研学惠生活",
+	// 		path: "/pages/activity/index",
+	// 	};
+	// },
 	created() {
 		//获取手机系统信息 -- 状态栏高度
 		let {

+ 23 - 4
pages/index/index.vue

@@ -172,7 +172,8 @@
 		queryFromLocation,
 		getDistrict,
 		getCityList,
-		refreshVip
+		refreshVip,
+		getShareInfo
 	} from '@/api/common.js'
 	import {cityList} from '@/api/movie.js'
 	// import {getCityList,refreshVip} from '@/api/common'
@@ -183,6 +184,11 @@
 	export default {
 		data() {
 			return {
+				shareInfo:{
+					shareDescribe:'慧研学惠生活',
+					shareImg:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/XHBjBiMRhVYG8f1a30bbbd80c2346197b81470444c9a.png/1.png',
+					shareTitle:'慧研学惠生活',
+				},
 				showGetVip:false,
 				background:false,
 				loading: false,
@@ -627,6 +633,17 @@
 						}
 					})
 				})
+			},
+			getShareInfo(){
+				getShareInfo({id:1}).then(res=>{
+					if(res.state == 'Success'){
+						this.shareInfo = {
+							shareDescribe:res.content.shareDescribe,
+							shareImg:res.content.shareImg,
+							shareTitle:res.content.shareTitle,
+						}
+					}
+				})
 			}
 		},
 		onPageScroll(e) {
@@ -637,6 +654,7 @@
 				}
 		},
 		onShow() {
+			this.getShareInfo()
 			this.$GetVip()
 			if (uni.getStorageSync('token')&&!uni.getStorageSync('userInfo')) {
 				this.getUserDetail()
@@ -717,15 +735,16 @@
 		},
 		onShareTimeline() {
 		  return {
-		    title: "慧研学惠生活",
+		    title: this.shareInfo.shareDescribe,
 		    query: "id=1",
-		    imageUrl: "https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/XHBjBiMRhVYG8f1a30bbbd80c2346197b81470444c9a.png/1.png",
+		    imageUrl: this.shareInfo.shareImg,
 		  };
 		},
 		onShareAppMessage() {
 		  return {
-		    title: "慧研学惠生活",
+		    title: this.shareInfo.shareDescribe,
 		    path: "/pages/index/index",
+			imageUrl: this.shareInfo.shareImg,
 		  };
 		},
 		onPullDownRefresh() {

+ 33 - 3
signUp/index.vue

@@ -65,9 +65,17 @@
 
 <script>
 	import {getActivityDetail} from '@/api/activity.js'
+	import {
+		getShareInfo
+	} from '@/api/common.js'
 	export default {
 		data() {
 			return {
+				shareInfo:{
+					shareDescribe:'慧研学惠生活',
+					shareImg:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/XHBjBiMRhVYG8f1a30bbbd80c2346197b81470444c9a.png/1.png',
+					shareTitle:'慧研学惠生活',
+				},
 				id:0,
 				info: {},
 				isEnd:false
@@ -136,22 +144,44 @@
 						}
 					}
 				})
+			},
+			getShareInfo(){
+				getShareInfo({id:1}).then(res=>{
+					if(res.state == 'Success'){
+						this.shareInfo = {
+							shareDescribe:res.content.shareDescribe,
+							shareImg:res.content.shareImg,
+							shareTitle:res.content.shareTitle,
+						}
+					}
+				})
 			}
 		},
 		onLoad(options) {
+			this.getShareInfo()
 			this.id = decodeURIComponent(options.scene)
 			this.getActivityDetail(this.id)
 		},
 		onShareTimeline() {
+		  // return {
+		  //   title: "慧研学惠生活-"+this.info.activityName,
+		  //   query: "scene="+this.id,
+		  // };
 		  return {
-		    title: "慧研学惠生活-"+this.info.activityName,
-		    query: "scene="+this.id,
+		    title: this.shareInfo.shareDescribe,
+		    query: "id=1",
+		    imageUrl: this.shareInfo.shareImg,
 		  };
 		},
 		onShareAppMessage() {
+		  // return {
+		  //   title: "慧研学惠生活-"+this.info.activityName,
+		  //   path: "/signUp/index?scene="+this.id,
+		  // };
 		  return {
-		    title: "慧研学惠生活-"+this.info.activityName,
+		    title: this.shareInfo.shareDescribe,
 		    path: "/signUp/index?scene="+this.id,
+		  	imageUrl: this.shareInfo.shareImg,
 		  };
 		},
 		

+ 34 - 4
study/studyGoodsDetail.vue

@@ -125,9 +125,17 @@
 <script>
 import { detail, getStudyAbout, goodsBuyStatistic } from '@/api/goods.js'
 import { subscribe } from "@/api/study"
+import {
+		getShareInfo
+	} from '@/api/common.js'
 export default {
 	data() {
 		return {
+			shareInfo:{
+				shareDescribe:'慧研学惠生活',
+				shareImg:'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/XHBjBiMRhVYG8f1a30bbbd80c2346197b81470444c9a.png/1.png',
+				shareTitle:'慧研学惠生活',
+			},
 			pageLoading: false,
 			active: 0,
 			tab: 1,
@@ -397,9 +405,21 @@ export default {
 			uni.navigateTo({
 				url: '/share/index?goodsId=' + this.goodsId
 			});
+		},
+		getShareInfo(){
+			getShareInfo({id:1}).then(res=>{
+				if(res.state == 'Success'){
+					this.shareInfo = {
+						shareDescribe:res.content.shareDescribe,
+						shareImg:res.content.shareImg,
+						shareTitle:res.content.shareTitle,
+					}
+				}
+			})
 		}
 	},
 	onLoad(option) {
+		this.getShareInfo()
 		try {
 			this.shopInfo = JSON.parse(uni.getStorageSync('shopInfo'))
 		} catch (error) {
@@ -409,15 +429,25 @@ export default {
 		this.detail(option.id)
 	},
 	onShareTimeline() {
+		// return {
+		// 	title: "慧研学惠生活-" + this.info.goodsName,
+		// 	query: "id=" + this.id,
+		// };
 		return {
-			title: "慧研学惠生活-" + this.info.goodsName,
-			query: "id=" + this.id,
+		  title: this.shareInfo.shareDescribe,
+		  query: "id=1",
+		  imageUrl: this.shareInfo.shareImg,
 		};
 	},
 	onShareAppMessage() {
+		// return {
+		// 	title: "慧研学惠生活-" + this.info.goodsName,
+		// 	path: "/study/studyGoodsDetail?id=" + this.id,
+		// };
 		return {
-			title: "慧研学惠生活-" + this.info.goodsName,
-			path: "/study/studyGoodsDetail?id=" + this.id,
+		  title: this.shareInfo.shareDescribe,
+		  path: "/study/studyGoodsDetail?id=" + this.id,
+					imageUrl: this.shareInfo.shareImg,
 		};
 	},
 }

+ 1 - 1
utils/config.js

@@ -1,4 +1,4 @@
-const env = 'production' // develop production
+const env = 'develop' // develop production
 
 // export const BASE_URL = env == 'production'?'https://api.zonelife.cn':'http://8.137.120.225:9006';
 export const BASE_URL = env == 'production'?'https://api.zonelife.cn':'https://api.dev.zonelife.cn';