From 275b6c4986343c3e4230e1ad28ce9548b017d584 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 05 二月 2026 14:06:07 +0800
Subject: [PATCH] 代码初始化

---
 web/pages/index/index.vue |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/web/pages/index/index.vue b/web/pages/index/index.vue
index 3f023c0..b71fd03 100644
--- a/web/pages/index/index.vue
+++ b/web/pages/index/index.vue
@@ -1,5 +1,5 @@
 <template>
-	<view class="content">
+	<view class="content" v-if="validPath">
 		<view class="banner">
 			<image src="/static/banner.png" mode="widthFix"></image>
 		</view>
@@ -38,6 +38,10 @@
 		</view>
 		<view class="btn" @click="sendSave">鍘绘敮浠�</view>
 	</view>
+	<view class="box" v-else>
+		<image src="/static/ic_payfail.png" mode="widthFix" class="icon"></image> 
+		<view class="title" >璇蜂娇鐢ㄥ井淇℃垨鑰呮敮浠樺疂搴旂敤鎵爜鎵撳紑</view> 
+	</view>
 </template>
 
 <script>
@@ -46,6 +50,7 @@
 		data() {
 			return {
 				flag:'name',
+				validPath : true,
 				form: {
 					type: 0,
 					name: '',
@@ -59,9 +64,26 @@
 		},
 		mounted() {
 			this.loading=false
+			this.validPath = this.isWeChatBrowser() || this.isAlipayBrowser()
 			this.form.userId = this.fetchParams("userId",window.location.href)
 		},
 		methods: {
+			// 鍒ゆ柇鏄惁鍦ㄥ井淇℃祻瑙堝櫒涓墦寮�
+			isWeChatBrowser() {
+			  // #ifdef H5
+			  const userAgent = navigator.userAgent.toLowerCase();
+			  return userAgent.indexOf('micromessenger') !== -1;
+			  // #endif
+			  return false;
+			},
+			// 鍒ゆ柇鏄惁鍦ㄦ敮浠樺疂娴忚鍣ㄤ腑鎵撳紑
+			isAlipayBrowser() {
+			  // #ifdef H5
+			  const userAgent = navigator.userAgent.toLowerCase();
+			  return userAgent.indexOf('alipayclient') !== -1;
+			  // #endif
+			  return false;
+			},
 			toSuccess() {
 				uni.navigateTo({
 					url: '/pages/success/success'
@@ -78,7 +100,7 @@
 			},
 			async sendSave() {
 				if(this.loading){
-					return
+					// return
 				}
 				this.loading=true
 				var that = this
@@ -92,6 +114,13 @@
 				if(!this.form.phone){
 					uni.showToast({
 						'title': '璇疯緭鍏ユ墜鏈哄彿',icon:'none'
+					})
+					this.loading=false
+					return
+				}
+				if(this.form.phone.length != 11){
+					uni.showToast({
+						'title': '璇疯緭鍏ユ纭殑11浣嶆墜鏈哄彿',icon:'none'
 					})
 					this.loading=false
 					return
@@ -133,7 +162,7 @@
 					   demo_form.submit() 
 					   
 					// this.toSuccess()
-				}
+				} 
 				this.loading=false
 			},
 		}
@@ -141,6 +170,25 @@
 </script>
 
 <style lang="scss" scoped>
+	.box {
+		width: 100%;
+		padding: 0 40rpx;
+		box-sizing: border-box;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		flex-direction: column;
+		.icon {
+			width: 180rpx;
+			height: 180rpx;
+			margin-top: 54rpx;
+		}
+		.title { 
+			font-size: 32rpx;
+			color: #222222;
+			margin-top: 32rpx;
+		}
+	}
 	.content {
 		width: 100%;
 		padding: 20rpx 30rpx;
@@ -223,7 +271,7 @@
 						width: 100%;
 						font-weight: 400;
 						font-size: 28rpx;
-						color: #999999;
+						//color: #999999;
 						text-align: right;
 					}
 				}

--
Gitblit v1.9.3