MS-CIAZDCOIXVRW\Administrator il y a 3 ans
Parent
commit
0c7dcd0dc8

+ 7 - 2
manifest.json

@@ -50,11 +50,16 @@
     /* 快应用特有相关 */
     "mp-weixin" : {
         /* 小程序特有相关 */
-        "appid" : "",
+        "appid" : "wxd6f090391d410534",
         "setting" : {
             "urlCheck" : false
         },
-        "usingComponents" : true
+        "usingComponents" : true,
+        "permission" : {
+            "scope.userLocation" : {
+                "desc" : "获取您的当前位置"
+            }
+        }
     },
     "vueVersion" : "3"
 }

+ 20 - 45
pages/authorization/authorization.vue

@@ -12,52 +12,28 @@
 </template>
 
 <script setup>
-	// import {
-	// 	ref
-	// } from 'vue'
+	import {
+		ref
+	} from 'vue'
+	import {
+		myRequest
+	} from '../../util/api.js'
 
-	// const code = ref('')
+	const code = ref('')
 
-	// // 获取code方法
-	// const login = () => {
-	// 	uni.login({
-	// 		provider: 'weixin',
-	// 		success: res => {
-	// 			code.value = res.code
-	// 			console.log(code.value);
-	// 			// getData()
-	// 		}
-	// 	});
-	// }
-
-	// // 通过code获取openId 和 session_key
-	// const getData = () => {
-	// 	console.log(123);
-	// 	uni.request({
-	// 		url: 'https://api.weixin.qq.com/sns/jscode2session',
-	// 		method: 'GET',
-	// 		data: {
-	// 			appid: 'xxx', //你的小程序的APPID  
-	// 			secret: 'xxx', //你的小程序的secret,  
-	// 			js_code: code.value, //wx.login 登录成功后的code  
-	// 			grant_type: 'authorization_code',
-	// 		},
-	// 		success: (res) => {
-	// 			// this.openId = cts.data.openid //openid 用户唯一标识  
-	// 			// this.unionid = cts.data.unionid //unionid 开放平台唯一标识   当公众号和小程序同时登录过才会有
-	// 			// this.session_key = cts.data.session_key //session_key  会话密钥  
-	// 			// console.log(this.openId, this.session_key)
-	// 			console.log(res)
-	// 		}
-	// 	})
-	// }
-
-
-	// const getPhoneNumber = (e) => {
-	// 	console.log(e);
-	// }
-
-	// login()
+	const getPhoneNumber = async (e) => {
+		console.log(e);
+		code.value = e.detail.code
+		if (code.value) {
+			const res = await myRequest({
+				url: "/wx/getPhone",
+				data: {
+					code: code.value
+				}
+			})
+			console.log(res);
+		}
+	}
 </script>
 
 <style lang="scss" scoped>
@@ -71,7 +47,6 @@
 			width: 150rpx;
 			height: 150rpx;
 			border-radius: 20rpx;
-			background-color: skyblue;
 
 			.img {
 				width: 100%;

+ 16 - 1
unpackage/dist/dev/mp-weixin/pages/authorization/authorization.js

@@ -1,11 +1,26 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
+const util_api = require("../../util/api.js");
 const _sfc_main = {
   __name: "authorization",
   setup(__props) {
+    const code = common_vendor.ref("");
+    const getPhoneNumber = async (e) => {
+      console.log(e);
+      code.value = e.detail.code;
+      if (code.value) {
+        const res = await util_api.myRequest({
+          url: "/wx/getPhone",
+          data: {
+            code: code.value
+          }
+        });
+        console.log(res);
+      }
+    };
     return (_ctx, _cache) => {
       return {
-        a: common_vendor.o((...args) => _ctx.getPhoneNumber && _ctx.getPhoneNumber(...args))
+        a: common_vendor.o(getPhoneNumber)
       };
     };
   }

+ 0 - 1
unpackage/dist/dev/mp-weixin/pages/authorization/authorization.wxss

@@ -10,7 +10,6 @@
   width: 150rpx;
   height: 150rpx;
   border-radius: 20rpx;
-  background-color: skyblue;
 }
 .content .logo .img.data-v-2e3c7ef5 {
   width: 100%;

+ 18 - 1
unpackage/dist/dev/mp-weixin/project.config.json

@@ -21,7 +21,24 @@
     "libVersion": "2.30.2",
     "appid": "wxd6f090391d410534",
     "projectname": "agent-registration",
-    "condition": {},
+    "condition": {
+        "search": {
+            "current": -1,
+            "list": []
+        },
+        "conversation": {
+            "current": -1,
+            "list": []
+        },
+        "game": {
+            "current": -1,
+            "list": []
+        },
+        "miniprogram": {
+            "current": -1,
+            "list": []
+        }
+    },
     "editorSetting": {
         "tabIndent": "insertSpaces",
         "tabSize": 4

+ 13 - 0
unpackage/dist/dev/mp-weixin/project.private.config.json

@@ -3,5 +3,18 @@
     "projectname": "agent-registration",
     "setting": {
         "compileHotReLoad": true
+    },
+    "condition": {
+        "miniprogram": {
+            "list": [
+                {
+                    "name": "",
+                    "pathName": "pages/authorization/authorization",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
+                }
+            ]
+        }
     }
 }

+ 1 - 1
unpackage/dist/dev/mp-weixin/util/api.js

@@ -1,6 +1,6 @@
 "use strict";
 const common_vendor = require("../common/vendor.js");
-const BASE_URL = "http://192.168.161.34:8888/reporting";
+const BASE_URL = "https://chtech.ncjti.edu.cn/gradiate-school/reporting";
 const myRequest = (options) => {
   common_vendor.index.showLoading({
     title: "加载中",

+ 1 - 1
util/api.js

@@ -1,7 +1,7 @@
 // 线上地址
 // const BASE_URL = "https://chtech.ncjti.edu.cn/campusclock"
 // 本地地址
-const BASE_URL = "http://192.168.161.34:8888/reporting"
+const BASE_URL = "https://chtech.ncjti.edu.cn/gradiate-school/reporting"
 export const myRequest = (options) => {
 	uni.showLoading({
 		title: "加载中",