Browse Source

限制项目名称最多为32个字符

xiaoxin 2 years ago
parent
commit
9cc1328cf5
2 changed files with 4 additions and 3 deletions
  1. 2 2
      pages/index/index.vue
  2. 2 1
      unpackage/dist/dev/mp-weixin/pages/index/index.js

+ 2 - 2
pages/index/index.vue

@@ -30,7 +30,7 @@
 			<view class="form_item">
 				<span class="icon">*</span>
 				项目名称
-				<uni-easyinput placeholder="请输入项目名称" v-model="projectName"></uni-easyinput>
+				<uni-easyinput placeholder="请输入项目名称" :maxlength="32" v-model="projectName"></uni-easyinput>
 			</view>
 
 			<view class="form_item">
@@ -397,7 +397,7 @@ const handleSubmit = () => {
 // 验证表格信息是否符合规范
 const handleValidate = () => {
 	const reName = /^[\u4e00-\u9fa5]{2,4}$/
-	const rePhone = /^[1][3,4,5,7,8,9][0-9]{9}$/
+	const rePhone = /^1[3-9]\d{9}$/
 	const reProjectAmount = /^[+]?([0-9]+(?:[.][0-9]*)?|\.[0-9]+)$/
 
 	if (name.value == '') {

+ 2 - 1
unpackage/dist/dev/mp-weixin/pages/index/index.js

@@ -244,7 +244,7 @@ const _sfc_main = {
     };
     const handleValidate = () => {
       const reName = /^[\u4e00-\u9fa5]{2,4}$/;
-      const rePhone = /^[1][3,4,5,7,8,9][0-9]{9}$/;
+      const rePhone = /^1[3-9]\d{9}$/;
       const reProjectAmount = /^[+]?([0-9]+(?:[.][0-9]*)?|\.[0-9]+)$/;
       if (name.value == "") {
         common_vendor.index.showToast({
@@ -474,6 +474,7 @@ const _sfc_main = {
         i: common_vendor.o(($event) => projectName.value = $event),
         j: common_vendor.p({
           placeholder: "请输入项目名称",
+          maxlength: 32,
           modelValue: projectName.value
         }),
         k: common_vendor.o(($event) => projectAmount.value = $event),