wangfei 6 年前
父节点
当前提交
fb79c7a61d
共有 1 个文件被更改,包括 36 次插入1 次删除
  1. 36
    1
      src/views/vote/signup.vue

+ 36
- 1
src/views/vote/signup.vue 查看文件

@@ -30,7 +30,7 @@
30 30
         <span class="desc">联系方式</span>
31 31
       </div>
32 32
       <div class="inputbox cinput">
33
-        <input placeholder="输入手机号" v-model="postData.phone">
33
+        <input placeholder="输入手机号" maxlength="11" v-model="postData.phone">
34 34
       </div>
35 35
 
36 36
       <div class="inputbox cinput">
@@ -48,6 +48,7 @@
48 48
 
49 49
 <script>
50 50
 import { createNamespacedHelpers } from "vuex";
51
+import { Toast } from 'vant';
51 52
 const {
52 53
   mapState: mapVoteState,
53 54
   mapActions: mapVoteActions
@@ -132,6 +133,40 @@ export default {
132 133
       this.messagenum = this.postData.message.length;
133 134
     },
134 135
     SubmitBtn() {
136
+      if(this.postData.photo == ""){
137
+        Toast.fail({
138
+          duration: 2000, // 持续展示 toast
139
+          forbidClick: true, // 禁用背景点击
140
+          message: "请先上传您的全家福!"
141
+        })
142
+        return false
143
+      }
144
+      if(this.postData.name == ""){
145
+        Toast.fail({
146
+          duration: 2000, // 持续展示 toast
147
+          forbidClick: true, // 禁用背景点击
148
+          message: "请输入您的姓名!"
149
+        })
150
+        return false
151
+      }
152
+      if(this.postData.phone == ""){
153
+        Toast.fail({
154
+          duration: 2000, // 持续展示 toast
155
+          forbidClick: true, // 禁用背景点击
156
+          message: "请输入您的联系方式!"
157
+        })
158
+        return false
159
+      }
160
+      var myreg=/^[1][0-9]{10}$/;
161
+      if (!myreg.test(this.postData.phone)) {
162
+        Toast.fail({
163
+          duration: 2000, // 持续展示 toast
164
+          forbidClick: true, // 禁用背景点击
165
+          message: "手机号格式不正确!"
166
+        })
167
+        return false
168
+      }
169
+
135 170
       this.voteMember({
136 171
         actid: this.actid,
137 172
         openid: this.user,