wmaple 1 year ago
parent
commit
8205ff3771
6 changed files with 49 additions and 10 deletions
  1. 16 0
      .hbuilderx/launch.json
  2. 2 2
      config/request.js
  3. 7 7
      pages.json
  4. 3 0
      pages/fac.vue
  5. 13 1
      pages/login.vue
  6. 8 0
      pages/redirect.vue

+ 16 - 0
.hbuilderx/launch.json

@@ -0,0 +1,16 @@
+{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
+  // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
+    "version": "0.0",
+    "configurations": [{
+     	"app-plus" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"default" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"type" : "uniCloud"
+     }
+    ]
+}

+ 2 - 2
config/request.js

@@ -5,8 +5,8 @@ module.exports = (vm) => {
 	// 初始化请求配置
 	uni.$u.http.setConfig((config) => {
 		/* config 为默认全局配置*/
-		// config.baseURL = 'http://192.168.0.153:8589/api'; /* 根域名 */
-		config.baseURL = 'http://119.45.192.122:1222/api/api'; /* 根域名 */
+		config.baseURL = 'http://192.168.0.153:8589/api'; /* 根域名 */
+		// config.baseURL = 'http://119.45.192.122:1222/api/api'; /* 根域名 */
 		// config.baseURL = 'http://frp.songlanyun.com:8801/prod-api/';
 		// config.baseURL ="http://csadi.songlanyun.com/prod-api/"
 		return config

+ 7 - 7
pages.json

@@ -3,6 +3,13 @@
     "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
   },
   "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+  {
+    "path": "pages/login",
+    "style": {
+      "navigationBarTitleText": "登录",
+      "navigationStyle": "custom"
+    }
+  },
     {
       "path": "pages/fac",
       "style": {
@@ -15,13 +22,6 @@
         "navigationBarTitleText": "人脸"
       }
     },
-    {
-      "path": "pages/login",
-      "style": {
-        "navigationBarTitleText": "登录",
-        "navigationStyle": "custom"
-      }
-    },
     {
       "path": "pages/redirect",
       "style": {

+ 3 - 0
pages/fac.vue

@@ -21,6 +21,9 @@
         }
       }
     },
+    onLoad(options) {
+      console.log('options===>', options)
+    },
     methods: {
       toFac() {
         if (!this.form.realName) {

+ 13 - 1
pages/login.vue

@@ -21,6 +21,14 @@
 			<view class="">
 				头像{{userInfo.head_photo}}
 			</view>
+      <block v-if="userInfo.current_ent">
+        <view class="">
+        	企业名称{{userInfo.current_ent.ent_name}}
+        </view>
+        <view class="">
+        	统一社会信用代码{{userInfo.current_ent.credit_code}}
+        </view>
+      </block>
 		</view>
 	</view>
 </template>
@@ -41,15 +49,17 @@
 			}
 		},
 		onLoad(options) {
-
+      console.log('options===>', options)
 			this.yigeauth = options.yigeauth === 'true' ? true : false
 			/**
 			 * 判断是否需要授权
 			 */
 			if (this.yigeauth) {
+        console.log(1111111)
 				// 需要授权
 				this.getYigeauth()
 			} else if (options.yigeopenid) {
+        console.log(222222)
 				// 如果已经授权,并且返回了 openid,则通过 openid 去获取用户信息
 				this.getUerByOpenId(options.yigeopenid)
 			}
@@ -67,6 +77,7 @@
 			 */
 			getYigeauth() {
 				this.$http.get('/auth/build_auth').then(res => {
+          console.log(res, 3333333333)
 					try {
 						uniWeb.webView.postMessage({
 							data: res.data
@@ -81,6 +92,7 @@
 				this.$http.post('/auth/getUserByOpenId', {
 					yigeOpenId: yigeopenid
 				}).then(res => {
+          console.log(res, 4444444444)
 					if (res.code == 200) {
 						// 获取用户信息
 						this.userInfo = res.data

+ 8 - 0
pages/redirect.vue

@@ -19,6 +19,14 @@
       <view class="">
         头像{{userInfo.head_photo}}
       </view>
+      <block v-if="userInfo.current_ent">
+        <view class="">
+        	企业名称{{userInfo.current_ent.ent_name}}
+        </view>
+        <view class="">
+        	统一社会信用代码{{userInfo.current_ent.credit_code}}
+        </view>
+      </block>
     </view>
   </view>
 </template>