Ver Fonte

Merge branch 'lyy' of ymy/bc_wx_applet into master

lyy há 1 ano atrás
pai
commit
42f4f384b3
3 ficheiros alterados com 34 adições e 20 exclusões
  1. 6 5
      main.js
  2. 15 6
      pages.json
  3. 13 9
      pages/login/login.vue

+ 6 - 5
main.js

@@ -63,11 +63,12 @@ Vue.prototype.$request = function(method, url, data, isJSON, hideLoading, showEr
 			method,
 			data,
 			header: {
-			  'Content-Type': isJSON ? 'application/json' : 'application/x-www-form-urlencoded',
-			  'Authorization': 'Bearer ' + token,
-			  'clientId': '8871d05eacc4406083d3bb0a085b6999',
-			  // 'tenantId': Vue.prototype.tenantId 或者 'tenantId': `${tenantId}`
-			  // application/x-www-form-urlencoded application/json
+				'Content-Type': isJSON ? 'application/json' : 'application/x-www-form-urlencoded',
+				'Authorization': 'Bearer ' + token,
+				'clientId': 'e5cd7e4891bf95d1d19206ce24a7b32e',
+				//"isEncrypt": false,
+				// 'tenantId': Vue.prototype.tenantId 或者 'tenantId': `${tenantId}`
+				// application/x-www-form-urlencoded application/json
 			},
 			success: (res) => {
 				console.log('resres', res)

+ 15 - 6
pages.json

@@ -1,5 +1,19 @@
 {
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+		{
+			"path" : "pages/login/login",
+			"style" : 
+			{
+				"navigationBarTitleText" : "登录"
+			}
+		},
+		
+		{
+			"path": "pages/index/index",
+			"style": {
+				"navigationBarTitleText": "首页"
+			}
+		},
 		{
 			"path" : "pages/classify/classify",
 			"style" : 
@@ -103,12 +117,7 @@
 				"enablePullDownRefresh" : false
 			}
 		},
-		{
-			"path": "pages/index/index",
-			"style": {
-				"navigationBarTitleText": "首页"
-			}
-		},
+		
 		{
 			"path": "pages/index/home",
 			"style": {

+ 13 - 9
pages/login/login.vue

@@ -158,16 +158,20 @@
 								// 发送code到开发者服务器换取用户信息
 								const result = await this.$request('post', '/auth/miniLogin', {
 									tenantId: '000000',
-									// clientId: '8871d05eacc4406083d3bb0a085b6999',
+									// clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e',
 									code: loginRes.code
 								})
-								console.log('登录成功:', result);
+								// headers: {
+								// 	isToken: false,
+								// 	repeatSubmit: false
+								// },
+									console.log('登录成功:', result);
 								if (result && result.data !== false) {
 									// 保存token
-									uni.setStorageSync("token", result.data.accessToken);
-									uni.setStorageSync("openId", result.data.openId);
-									uni.setStorageSync("tenantId", result.data.tenantId);
-									uni.setStorageSync("appUserId", result.data.appUserId);
+									uni.setStorageSync("token", result.data.access_token);
+									uni.setStorageSync("openId", result.data.open_id);
+									//uni.setStorageSync("tenantId", result.data.tenantId);
+									uni.setStorageSync("appUserId", result.data.app_user_id);
 									// 跳转到下一个页面
 									uni.navigateTo({
 										url: `/pages/diningList/diningList`
@@ -180,12 +184,12 @@
 								console.log('id', id)
 
 								const userInfo = {
-									"id": id,
+									"userId": id,
 									"nickName": res.userInfo.nickName,
-									"profilePhoto": res.userInfo.avatarUrl,
+									"profilePhoto": res.userInfo.avatarUrl
 								}
 								console.log('userInfo', userInfo)
-								this.$request('post', '/system/appUser/editAppUser',
+								this.$request('post', '/system/user/editSysUser',
 									userInfo, true)
 							},
 							fail: (error) => {