浏览代码

Merge branch 'master' of http://git.jihengcc.cn/liubaiyan/spark-student into master

bluebirds 4 年之前
父节点
当前提交
d5b9aca1b2
共有 7 个文件被更改,包括 44 次插入21 次删除
  1. 2 0
      config/api.js
  2. 3 5
      pages.json
  3. 5 5
      pages/index/index.vue
  4. 12 2
      pages/login/index.vue
  5. 15 8
      pages/user/index.vue
  6. 6 0
      pagesMain/openMember.vue
  7. 1 1
      utils/request.js

+ 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',
 	
 	
 	//  获取首页轮播图列表

+ 3 - 5
pages.json

@@ -21,9 +21,7 @@
 		}
 	}, {
 		"path": "pages/login/index",
-		"style": {
-			"navigationStyle": "custom"
-		}
+		"style": {}
 	}],
 	"subPackages": [{
 		"root": "pagesMember",
@@ -44,7 +42,7 @@
 			"style": {
 				"navigationBarTitleText": "添加信息"
 			}
-		},  {
+		}, {
 			"path": "subscribelSuccess",
 			"style": {
 				"navigationBarTitleText": "新增成功"
@@ -92,7 +90,7 @@
 			"style": {
 				"navigationBarTitleText": "分享有礼"
 			}
-		},  {
+		}, {
 			"path": "evaluateList",
 			"style": {
 				"navigationBarTitleText": "我的评价"

+ 5 - 5
pages/index/index.vue

@@ -108,11 +108,11 @@
 			});
 		},
 		onShow() {
-			if (!uni.getStorageSync('token')) {
-				uni.navigateTo({
-					url: '/pages/login/index'
-				});
-			}
+			// if (!uni.getStorageSync('token')) {
+			// 	uni.navigateTo({
+			// 		url: '/pages/login/index'
+			// 	});
+			// }
 		},
 		onPullDownRefresh() {
 			this.initialize()

+ 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

+ 15 - 8
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,15 +162,13 @@
 			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({
-								title: '订阅失败:' + error.errMsg,
-								type: 'warning',
-							})
+							// this.$refs.uTips.show({
+							// 	title: '订阅失败:' + error.errMsg,
+							// 	type: 'warning',
+							// })
 						},
 					})
 				} else {

+ 6 - 0
pagesMain/openMember.vue

@@ -148,6 +148,12 @@
 				this.memberInfo.typeValue = options.typeValue
 			}
 		},
+		onUnload(){
+			console.log('1111')
+		},
+		onBackPress(){
+			console.log('2222')
+		},
 		onShow() {
 			NET.request(API.getAllVenueList, uni.getStorageSync('locationData'), 'POST').then(res => {
 				this.venueList = res.data

+ 1 - 1
utils/request.js

@@ -24,7 +24,7 @@ const request = (url, data, method = 'GET') => {
 					let data = res.data
 					if (data.status == 30001) {
 						uni.removeStorageSync('token')
-						uni.navigateTo({
+						uni.reLaunch({
 							url: '/pages/login/index'
 						});
 						return false