Forráskód Böngészése

添加 验证项目金额 是否为正整数的逻辑

MS-CIAZDCOIXVRW\Administrator 3 éve
szülő
commit
c290771dc2

+ 8 - 0
pages/index/index.vue

@@ -223,6 +223,7 @@
 	const handleValidate = () => {
 	const handleValidate = () => {
 		const reName = /^[\u4e00-\u9fa5]{2,4}$/
 		const reName = /^[\u4e00-\u9fa5]{2,4}$/
 		const rePhone = /^[1][3,4,5,7,8,9][0-9]{9}$/
 		const rePhone = /^[1][3,4,5,7,8,9][0-9]{9}$/
+		const reProjectAmount =/^\+?[1-9][0-9]*$/
 	
 	
 		if (name.value == '') {
 		if (name.value == '') {
 			uni.showToast({
 			uni.showToast({
@@ -280,6 +281,13 @@
 			})
 			})
 			return false
 			return false
 		}
 		}
+		if (!reProjectAmount.test(projectAmount.value)) {
+			uni.showToast({
+				title: '项目金额请输入正整数',
+				icon: 'none'
+			})
+			return false
+		}
 		if (biddingTime.value == '') {
 		if (biddingTime.value == '') {
 			uni.showToast({
 			uni.showToast({
 				title: '请选择预计投标时间',
 				title: '请选择预计投标时间',

+ 8 - 0
unpackage/dist/dev/mp-weixin/pages/index/index.js

@@ -140,6 +140,7 @@ const _sfc_main = {
     const handleValidate = () => {
     const handleValidate = () => {
       const reName = /^[\u4e00-\u9fa5]{2,4}$/;
       const reName = /^[\u4e00-\u9fa5]{2,4}$/;
       const rePhone = /^[1][3,4,5,7,8,9][0-9]{9}$/;
       const rePhone = /^[1][3,4,5,7,8,9][0-9]{9}$/;
+      const reProjectAmount = /^\+?[1-9][0-9]*$/;
       if (name.value == "") {
       if (name.value == "") {
         common_vendor.index.showToast({
         common_vendor.index.showToast({
           title: "请输入姓名",
           title: "请输入姓名",
@@ -196,6 +197,13 @@ const _sfc_main = {
         });
         });
         return false;
         return false;
       }
       }
+      if (!reProjectAmount.test(projectAmount.value)) {
+        common_vendor.index.showToast({
+          title: "项目金额请输入正整数",
+          icon: "none"
+        });
+        return false;
+      }
       if (biddingTime.value == "") {
       if (biddingTime.value == "") {
         common_vendor.index.showToast({
         common_vendor.index.showToast({
           title: "请选择预计投标时间",
           title: "请选择预计投标时间",