Quellcode durchsuchen

Signed-off-by: liuboyan <632697560@qq.com>
bug

liuboyan vor 4 Jahren
Ursprung
Commit
59ff95b64d
4 geänderte Dateien mit 26 neuen und 7 gelöschten Zeilen
  1. 2 0
      config/api.js
  2. 1 1
      pages.json
  3. 12 2
      pages/login/index.vue
  4. 11 4
      pages/user/index.vue

+ 2 - 0
config/api.js

@@ -9,6 +9,8 @@ module.exports = {
 	changeWxInfo: API_BASE + '/v2/student/login/changeWxInfo',
 	//  根据经纬度获取位置
 	getAddressInfo: API_BASE + '/v2/location/pointToAddress',
+	//  获取订阅模板
+	getTemplate: API_BASE + '/v2/student/myCenter/getTemplate',
 	
 	
 	//  获取首页轮播图列表

+ 1 - 1
pages.json

@@ -19,7 +19,7 @@
 		"style": {
 			"navigationBarTitleText": "个人"
 		}
-	}, {
+	}, {
 		"path": "pages/login/index",
 		"style": {}
 	}],

+ 12 - 2
pages/login/index.vue

@@ -49,7 +49,14 @@
 				}
 			}
 		},
-		onLoad() {},
+		onLoad(options) {
+			if (options.shareParams) {
+				uni.setStorageSync({
+					key: 'shareParams',
+					data: options.shareParams
+				})
+			}
+		},
 		methods: {
 			login() {
 				if (!this.account || !this.password) {
@@ -133,7 +140,10 @@
 			},
 			// 发请求获取个人数据
 			getUserInfo(wxLoginData) {
-				NET.request(API.wxLogin, wxLoginData, 'POST').then(res => {
+				NET.request(API.wxLogin, {
+					...wxLoginData,
+					shareParams: uni.getStorageSync('shareParams')
+				}, 'POST').then(res => {
 					uni.setStorage({
 						key: 'token',
 						data: res.data.token

+ 11 - 4
pages/user/index.vue

@@ -113,7 +113,8 @@
 						icon: API.getServerImg + 'yuyue.png'
 					},
 				],
-				studentList: []
+				studentList: [],
+				templateList: []
 			}
 		},
 		onShow() {
@@ -139,6 +140,14 @@
 					type: 'warning',
 				})
 			})
+			NET.request(API.getTemplate, {}, 'POST').then(res => {
+				this.templateList = res.data || []
+			}).catch(error => {
+				this.$refs.uTips.show({
+					title: error.message,
+					type: 'warning',
+				})
+			})
 		},
 		methods: {
 			//  跳转开通会员
@@ -153,9 +162,7 @@
 			goToHandle(site) {
 				if (site.path == 'sendMessage') {
 					wx.requestSubscribeMessage({
-						tmplIds: ['tVb_KMiqovKWBk6BMmiZAy0taSlMx-pNIL62k0jf7k4', '3y7b65I9HW9sI7JDAKa_OAu3KwlL_Kgjb8_AFsHMSa8',
-							'TryB3hO6Evw4Nz-qMF7yf1SFgqij-dqsUShJvVrLaoQ'
-						],
+						tmplIds: this.templateList,
 						success: (res) => {},
 						fail: (error) => {
 							// this.$refs.uTips.show({