guhongwei 2 年之前
父节点
当前提交
78ac6a0e7e
共有 1 个文件被更改,包括 45 次插入64 次删除
  1. 45 64
      pagesMy/apply/add.vue

+ 45 - 64
pagesMy/apply/add.vue

@@ -3,27 +3,23 @@
 		<view class="main">
 			<view class="one">
 				<uni-forms ref="form" :modelValue="form" :rules="rules" label-width="auto">
-					<uni-forms-item label="姓名" name="name">
+					<uni-forms-item label="姓名" required name="name">
 						<uni-easyinput type="text" v-model="form.name" placeholder="请输入真实姓名" />
 					</uni-forms-item>
-					<uni-forms-item label="身份证号" name="card">
+					<uni-forms-item label="身份证号" required name="card">
 						<uni-easyinput type="text" v-model="form.card" placeholder="请输入身份证号" />
 					</uni-forms-item>
-					<uni-forms-item label="手机号" name="phone">
+					<uni-forms-item label="手机号" required name="phone">
 						<uni-easyinput type="text" v-model="form.phone" placeholder="请输入手机号" />
 					</uni-forms-item>
+					<uni-forms-item label="确认" required name="is_affirm">
+						<uni-data-checkbox v-model="form.is_affirm" :localdata="affirmList"
+							style="position: relative;top: 7px;" />
+					</uni-forms-item>
 				</uni-forms>
 				<view class="btn">
 					<button type="primary" @click="onSubmit('form')" size="mini">提交</button>
 					<button type="primary" @click="toApply" size="mini">申请记录</button>
-					<view class="btn_3">
-						<checkbox-group @change="changeAgree">
-							<label>
-								<checkbox :checked="agree" />
-								<text>我已阅读“团长规则”</text>
-							</label>
-						</checkbox-group>
-					</view>
 				</view>
 				<view class="config">
 					<rich-text :nodes="config&&config.leader_rule"></rich-text>
@@ -38,8 +34,6 @@
 	export default {
 		data() {
 			return {
-				// 用戶协议
-				agree: true,
 				// 系统设置
 				config: {},
 				form: {},
@@ -50,37 +44,35 @@
 							errorMessage: '请填写真实姓名',
 						}]
 					},
+					card: {
+						rules: [{
+							required: true,
+							errorMessage: '请填写身份证',
+						}]
+					},
 					phone: {
 						rules: [{
 							required: true,
 							errorMessage: '请填写手机号码',
-						}, {
-							validateFunction: function(rule, value, data, callback) {
-								let iphoneReg = (
-									/^(13[0-9]|14[1579]|15[0-3,5-9]|16[6]|17[0123456789]|18[0-9]|19[89])\d{8}$/
-								); //手机号码
-								if (!iphoneReg.test(value)) {
-									callback('手机号码格式不正确,请重新填写')
-								}
-							}
 						}]
 					},
-					card: {
+					is_affirm: {
 						rules: [{
 							required: true,
-							errorMessage: '请填写身份证',
-						}, {
-							validateFunction: function(rule, value, data, callback) {
-								let iphoneReg = (
-									/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
-								); //
-								if (!iphoneReg.test(value)) {
-									callback('身份证格式不正确,请重新填写')
-								}
-							}
+							errorMessage: '请确认团长申请',
 						}]
 					},
 				},
+				// 是否确认
+				affirmList: [ //
+					{
+						text: '是',
+						value: 0
+					}, {
+						text: '否',
+						value: 1
+					}
+				]
 			};
 		},
 		onLoad: function(e) {
@@ -108,30 +100,17 @@
 					fail: (err) => {}
 				})
 			},
-			// 同意隐私协议
-			changeAgree() {
-				const that = this;
-				let agree = true;
-				if (that.agree) agree = false;
-				that.$set(that, `agree`, agree);
-			},
-			// 返回
-			back() {
-				uni.navigateBack({
-					delta: 1
-				})
-			},
-			// 团长记录
-			toApply() {
-				uni.navigateTo({
-					url: `/pagesMy/apply/index`
-				})
-			},
+
 			// 提交保存
 			onSubmit(ref) {
 				const that = this;
 				that.$refs[ref].validate().then(async params => {
-					if (that.agree) {
+					if (params.is_affirm == '1') {
+						uni.showToast({
+							title: '请确认团长申请',
+							icon: 'none'
+						})
+					} else {
 						const arr = await that.$api(`/userleader`, 'POST', that.form);
 						if (arr.errcode == '0') {
 							uni.showToast({
@@ -144,14 +123,21 @@
 								title: arr.errmsg,
 							})
 						}
-					} else {
-						uni.showToast({
-							title: '请阅读并同意用户协议和隐私政策',
-							icon: 'none'
-						})
 					}
 				})
-			}
+			},
+			// 团长记录
+			toApply() {
+				uni.navigateTo({
+					url: `/pagesMy/apply/index`
+				})
+			},
+			// 返回
+			back() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
 		},
 	}
 </script>
@@ -187,11 +173,6 @@
 					font-size: var(--font14Size);
 				}
 
-				.btn_3 {
-					width: 100vw;
-					text-align: center;
-					font-size: 12px;
-				}
 			}
 		}
 	}