MS-CIAZDCOIXVRW\Administrator 3 vuotta sitten
vanhempi
commit
8a9337741c

+ 1 - 1
manifest.json

@@ -50,7 +50,7 @@
     /* 快应用特有相关 */
     "mp-weixin" : {
         /* 小程序特有相关 */
-        "appid" : "wxd6f090391d410534",
+        "appid" : "wx2fc3f45732fae5d3",
         "setting" : {
             "urlCheck" : false
         },

+ 15 - 4
pages/authorization/authorization.vue

@@ -1,12 +1,12 @@
 <template>
 	<view class="content">
 		<view class="logo">
-			<img class="img" src="../../static/ceshi.jpg">
+			<img class="img" src="../../static/logo.png">
 		</view>
 
 		<button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
 			<img class="img" src="../../static/weixin.svg">
-			<span>微信一键登录</span>
+			<span>微信一键授权</span>
 		</button>
 	</view>
 </template>
@@ -22,7 +22,6 @@
 	const code = ref('')
 
 	const getPhoneNumber = async (e) => {
-		console.log(e);
 		code.value = e.detail.code
 		if (code.value) {
 			const res = await myRequest({
@@ -31,7 +30,18 @@
 					code: code.value
 				}
 			})
-			console.log(res);
+			// console.log(res);
+			if (res.success && res.code == 1) {
+				uni.setStorageSync('wxPhone', res.data)
+				uni.redirectTo({
+					url:"/pages/index/index"
+				})
+			} else {
+				uni.showToast({
+					title: res.message,
+					icon:'none'
+				})
+			}
 		}
 	}
 </script>
@@ -47,6 +57,7 @@
 			width: 150rpx;
 			height: 150rpx;
 			border-radius: 20rpx;
+			box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
 
 			.img {
 				width: 100%;

+ 29 - 6
pages/index/index.vue

@@ -42,10 +42,10 @@
 	const name = ref(uni.getStorageSync('form_name') || '')
 	const phone = ref(uni.getStorageSync('form_phone') || '')
 	const company = ref(uni.getStorageSync('form_company') || '')
-	const content = ref('')
-	const wxPhone = ref(9876)
+	const content = ref(uni.getStorageSync('form_content') || '')
+	const wxPhone = ref(uni.getStorageSync('wxPhone') || '')
 
-	const handleSubmit =  () => {
+	const handleSubmit = () => {
 		const reName = /^[\u4e00-\u9fa5]{2,4}$/
 		const rePhone = /^[1][3,4,5,7,8,9][0-9]{9}$/
 
@@ -91,7 +91,32 @@
 			})
 			return
 		}
+		
+		uni.setStorageSync('form_name', name.value);
+		uni.setStorageSync('form_phone', phone.value);
+		uni.setStorageSync('form_company', company.value);
+		uni.setStorageSync('form_content', content.value);
+		if (!wxPhone.value) {
+			uni.showModal({
+				title: '提示',
+				content: '本次操作需要获取您的手机号码',
+				success: (res)=> {
+					if (res.confirm) {
+						
+						uni.navigateTo({
+							url:"/pages/authorization/authorization"
+						})
+					} else if (res.cancel) {
+						
+					}
+				}
+			});
+		} else {
+			submit()
+		}
+	}
 
+	const submit = () => {
 		uni.showModal({
 			title: '提示',
 			content: '确认提交吗',
@@ -114,10 +139,8 @@
 							title: '提交成功',
 							duration: 3000
 						})
-						uni.setStorageSync('form_name', name.value);
-						uni.setStorageSync('form_phone', phone.value);
-						uni.setStorageSync('form_company', company.value);
 						content.value = ''
+						uni.setStorageSync('form_content','')
 					} else {
 						uni.showToast({
 							title: res.message,

BIN
static/ceshi.jpg


BIN
static/logo.png


+ 5 - 0
unpackage/dist/dev/mp-weixin/app.json

@@ -9,5 +9,10 @@
     "navigationBarBackgroundColor": "#F8F8F8",
     "backgroundColor": "#F8F8F8"
   },
+  "permission": {
+    "scope.userLocation": {
+      "desc": "获取您的当前位置"
+    }
+  },
   "usingComponents": {}
 }

+ 11 - 2
unpackage/dist/dev/mp-weixin/pages/authorization/authorization.js

@@ -6,7 +6,6 @@ const _sfc_main = {
   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({
@@ -15,7 +14,17 @@ const _sfc_main = {
             code: code.value
           }
         });
-        console.log(res);
+        if (res.success && res.code == 1) {
+          common_vendor.index.setStorageSync("wxPhone", res.data);
+          common_vendor.index.redirectTo({
+            url: "/pages/index/index"
+          });
+        } else {
+          common_vendor.index.showToast({
+            title: res.message,
+            icon: "none"
+          });
+        }
       }
     };
     return (_ctx, _cache) => {

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

@@ -1 +1 @@
-<view class="content data-v-2e3c7ef5"><view class="logo data-v-2e3c7ef5"><image class="img data-v-2e3c7ef5" src="/static/ceshi.jpg"></image></view><button class="button data-v-2e3c7ef5" open-type="getPhoneNumber" bindgetphonenumber="{{a}}"><image class="img data-v-2e3c7ef5" src="/static/weixin.svg"></image><label class="data-v-2e3c7ef5">微信一键登录</label></button></view>
+<view class="content data-v-2e3c7ef5"><view class="logo data-v-2e3c7ef5"><image class="img data-v-2e3c7ef5" src="/static/logo.png"></image></view><button class="button data-v-2e3c7ef5" open-type="getPhoneNumber" bindgetphonenumber="{{a}}"><image class="img data-v-2e3c7ef5" src="/static/weixin.svg"></image><label class="data-v-2e3c7ef5">微信一键授权</label></button></view>

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

@@ -10,6 +10,7 @@
   width: 150rpx;
   height: 150rpx;
   border-radius: 20rpx;
+  box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
 }
 .content .logo .img.data-v-2e3c7ef5 {
   width: 100%;

+ 25 - 5
unpackage/dist/dev/mp-weixin/pages/index/index.js

@@ -15,8 +15,8 @@ const _sfc_main = {
     const name = common_vendor.ref(common_vendor.index.getStorageSync("form_name") || "");
     const phone = common_vendor.ref(common_vendor.index.getStorageSync("form_phone") || "");
     const company = common_vendor.ref(common_vendor.index.getStorageSync("form_company") || "");
-    const content = common_vendor.ref("");
-    const wxPhone = common_vendor.ref(9876);
+    const content = common_vendor.ref(common_vendor.index.getStorageSync("form_content") || "");
+    const wxPhone = common_vendor.ref(common_vendor.index.getStorageSync("wxPhone") || "");
     const handleSubmit = () => {
       const reName = /^[\u4e00-\u9fa5]{2,4}$/;
       const rePhone = /^[1][3,4,5,7,8,9][0-9]{9}$/;
@@ -62,6 +62,28 @@ const _sfc_main = {
         });
         return;
       }
+      common_vendor.index.setStorageSync("form_name", name.value);
+      common_vendor.index.setStorageSync("form_phone", phone.value);
+      common_vendor.index.setStorageSync("form_company", company.value);
+      common_vendor.index.setStorageSync("form_content", content.value);
+      if (!wxPhone.value) {
+        common_vendor.index.showModal({
+          title: "提示",
+          content: "本次操作需要获取您的手机号码",
+          success: (res) => {
+            if (res.confirm) {
+              common_vendor.index.navigateTo({
+                url: "/pages/authorization/authorization"
+              });
+            } else if (res.cancel)
+              ;
+          }
+        });
+      } else {
+        submit();
+      }
+    };
+    const submit = () => {
       common_vendor.index.showModal({
         title: "提示",
         content: "确认提交吗",
@@ -83,10 +105,8 @@ const _sfc_main = {
                 title: "提交成功",
                 duration: 3e3
               });
-              common_vendor.index.setStorageSync("form_name", name.value);
-              common_vendor.index.setStorageSync("form_phone", phone.value);
-              common_vendor.index.setStorageSync("form_company", company.value);
               content.value = "";
+              common_vendor.index.setStorageSync("form_content", "");
             } else {
               common_vendor.index.showToast({
                 title: res2.message,

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

@@ -19,7 +19,7 @@
     },
     "compileType": "miniprogram",
     "libVersion": "2.30.2",
-    "appid": "wxd6f090391d410534",
+    "appid": "wx2fc3f45732fae5d3",
     "projectname": "agent-registration",
     "condition": {
         "search": {

BIN
unpackage/dist/dev/mp-weixin/static/ceshi.jpg


BIN
unpackage/dist/dev/mp-weixin/static/logo.png


+ 1 - 0
util/api.js

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