فهرست منبع

分享的标题添加上去

wangn 5 سال پیش
والد
کامیت
68151f68dd
2فایلهای تغییر یافته به همراه17 افزوده شده و 3 حذف شده
  1. 12 3
      hdApp/src/admin/share/index.vue
  2. 5 0
      hdApp/src/api/ghs/index.js

+ 12 - 3
hdApp/src/admin/share/index.vue

@@ -6,15 +6,17 @@
 <template>
   <div class="app-content">
 			<button type="default" open-type="share">点击分享</button>
-			参数展示:{{JSON.stringify(shareInfo)}}
+			参数展示:{{JSON.stringify(shareInfo.shopId)}}
   </div>
 </template>
 <script>
+import { ghsInfo } from "@/api/ghs/index";
 export default {
   name: 'Share',
   data () {
     return {
 					shareInfo:'',
+          title: ''
     }
   },
 	onShareAppMessage(res) {
@@ -23,14 +25,21 @@ export default {
 			console.log(res.target)
 		}
 		return {
-			title: '自定义分享标题',
-			path: `/pagesPurchase/ghsProduct?shopId=${shopId}&id=${id}&name=${name}`
+			title: this.title,
+			path: `/pagesPurchase/ghsProduct?shopId=${shareInfo.shopId}&id=${shareInfo.id}&name=${shareInfo.name}`
 		}
 	},
   onLoad () {
 			if(uni.getStorageSync('extraData')){
 				this.shareInfo = uni.getStorageSync('extraData').referrerInfo.extraData;
 			}
+      ghsInfo({shopId: this.shareInfo.shopId}).then(res => {
+        console.log(res)
+        uni.setNavigationBarTitle({
+          title:res.data.name
+        })
+        this.title = res.data.name
+      }).catch(err => {console.log(err)})
   },
   methods: {
   }

+ 5 - 0
hdApp/src/api/ghs/index.js

@@ -9,3 +9,8 @@ export const getList = data => {
 export const getGhsDataApi = data => {
 	return https.get('/ghs/detail', data)
 }
+
+export const ghsInfo = data => {
+	return https.get('/ghs/info', data)
+}
+