Преглед на файлове

推文详情页面添加分享功能

xiaoxin преди 2 години
родител
ревизия
47c38ed9aa
променени са 1 файла, в които са добавени 20 реда и са изтрити 3 реда
  1. 20 3
      pages/tweetDetail/tweetDetail.vue

+ 20 - 3
pages/tweetDetail/tweetDetail.vue

@@ -278,12 +278,29 @@ export default {
 			isFullScreen: false
 			isFullScreen: false
 		}
 		}
 	},
 	},
+	mounted() {
+		// 开启转发功能
+		uni.showShareMenu({
+			withShareTicket: true,
+			menus: ['shareAppMessage', 'shareTimeline']
+		})
+	},
+	onShow() {
+		let flag = uni.getStorageSync('openid')
+		let tokenId = uni.getStorageSync('tokenId')
+		if (tokenId && flag) {
+			this.userId = uni.getStorageSync('userInfo').id
+			this.getTweetInfo()
+			this.getBindTweet()
+		} else {
+			uni.navigateTo({
+				url: '/pages/login/login'
+			})
+		}
+	},
 	onLoad(options) {
 	onLoad(options) {
-		this.userId = uni.getStorageSync('userInfo').id
 		this.tweetId = options.id
 		this.tweetId = options.id
 		this.townId = options.townId
 		this.townId = options.townId
-		this.getTweetInfo()
-		this.getBindTweet()
 		uni.$on('getReset', this.getReset)
 		uni.$on('getReset', this.getReset)
 	},
 	},
 	onReachBottom() {
 	onReachBottom() {