guhongwei 2 éve
szülő
commit
0cde0e3641
5 módosított fájl, 84 hozzáadás és 40 törlés
  1. 12 6
      pages.json
  2. 1 1
      pages/login/index.vue
  3. 1 0
      pages/my/index.vue
  4. 70 33
      pagesMy/apply/add.vue
  5. 0 0
      pagesOther/other/agree.vue

+ 12 - 6
pages.json

@@ -12,12 +12,6 @@
 				"navigationBarTitleText": "系统登录"
 				"navigationBarTitleText": "系统登录"
 			}
 			}
 		},
 		},
-		{
-			"path": "pages/other/agree",
-			"style": {
-				"navigationBarTitleText": "用户协议"
-			}
-		},
 		{
 		{
 			"path": "pages/home/index",
 			"path": "pages/home/index",
 			"style": {
 			"style": {
@@ -401,6 +395,18 @@
 					}
 					}
 				}
 				}
 			]
 			]
+		},
+		{
+			"root": "pagesOther",
+			"pages": [
+				{
+					"path": "other/agree",
+					"style": {
+						"navigationBarTitleText": "用户协议",
+						"enablePullDownRefresh": false
+					}
+				}
+			]
 		}
 		}
 	],
 	],
 	"globalStyle": {
 	"globalStyle": {

+ 1 - 1
pages/login/index.vue

@@ -673,7 +673,7 @@
 			toAgree() {
 			toAgree() {
 				const that = this;
 				const that = this;
 				uni.navigateTo({
 				uni.navigateTo({
-					url: `/pages/other/agree`
+					url: `/pagesOther/other/agree`
 				})
 				})
 			},
 			},
 		},
 		},

+ 1 - 0
pages/my/index.vue

@@ -165,6 +165,7 @@
 								}
 								}
 							}
 							}
 						}
 						}
+						console.log(user);
 						if (user.is_leader == '0') {
 						if (user.is_leader == '0') {
 							config.my_menu = config.my_menu.filter((i) => {
 							config.my_menu = config.my_menu.filter((i) => {
 								return i.route != 'pagesMy/apply/add';
 								return i.route != 'pagesMy/apply/add';

+ 70 - 33
pagesMy/apply/add.vue

@@ -12,17 +12,17 @@
 					<uni-forms-item label="手机号" required name="phone">
 					<uni-forms-item label="手机号" required name="phone">
 						<uni-easyinput type="text" v-model="form.phone" placeholder="请输入手机号" />
 						<uni-easyinput type="text" v-model="form.phone" placeholder="请输入手机号" />
 					</uni-forms-item>
 					</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-data-checkbox v-model="affirm" multiple :localdata="affirmList" @change="affirmChange" />
 					</uni-forms-item>
 					</uni-forms-item>
 				</uni-forms>
 				</uni-forms>
 				<view class="btn">
 				<view class="btn">
-					<button type="primary" @click="onSubmit('form')" size="mini">提交</button>
+					<button type="primary" @click="onSubmit('form')" size="mini"
+						:disabled="is_affirm=='0'?true:false">提交</button>
 					<button type="primary" @click="toApply" size="mini">申请记录</button>
 					<button type="primary" @click="toApply" size="mini">申请记录</button>
 				</view>
 				</view>
 				<view class="config">
 				<view class="config">
-					<rich-text :nodes="config&&config.leader_rule"></rich-text>
+					<rich-text :nodes="config&&config.leader&&config.leader.rule"></rich-text>
 				</view>
 				</view>
 			</view>
 			</view>
 		</view>
 		</view>
@@ -56,28 +56,17 @@
 							errorMessage: '请填写手机号码',
 							errorMessage: '请填写手机号码',
 						}]
 						}]
 					},
 					},
-					is_affirm: {
-						rules: [{
-							required: true,
-							errorMessage: '请确认团长申请',
-						}]
-					},
+
 				},
 				},
-				// 是否确认
-				affirmList: [ //
-					{
-						text: '是',
-						value: 0
-					}, {
-						text: '否',
-						value: 1
-					}
-				]
+				affirmList: [],
+				affirm: [],
+				is_affirm: 0
 			};
 			};
 		},
 		},
 		onLoad: function(e) {
 		onLoad: function(e) {
 			const that = this;
 			const that = this;
 			that.watchLogin();
 			that.watchLogin();
+			that.searchConfig();
 		},
 		},
 		methods: {
 		methods: {
 			watchLogin() {
 			watchLogin() {
@@ -93,27 +82,50 @@
 								phone: user.phone
 								phone: user.phone
 							})
 							})
 						}
 						}
-						// 系统设置
-						let config = await that.$api(`/config`, 'GET', {});
-						if (config.errcode == '0') {
-							if (config.data.leader_rule) config.data.leader_rule = config.data.leader_rule.replace(/\<img/gi,
-								'<img class="rich-img"');
-								that.$set(that, `config`, config.data);
+					},
+					fail: (err) => {}
+				})
+			},
+			searchConfig() {
+				const that = this;
+				uni.getStorage({
+					key: 'config',
+					success: async (res) => {
+						let data = res.data;
+						if (data.leader && data.leader.rule) data.leader.rule = data.leader.rule.replace(
+							/\<img/gi,
+							'<img class="rich-img"');
+						that.$set(that, `config`, data);
+						// 整理复选框
+						if (data.leader && data.leader.explain) {
+							let list = [ //
+								{
+									text: data.leader.explain,
+									value: 0
+								}
+							]
+							that.$set(that, `affirmList`, list)
 						}
 						}
 					},
 					},
 					fail: (err) => {}
 					fail: (err) => {}
 				})
 				})
 			},
 			},
-
+			// 选择
+			affirmChange(e) {
+				const that = this;
+				const length = e.detail.value.length;
+				that.$set(that, `is_affirm`, length)
+			},
 			// 提交保存
 			// 提交保存
 			onSubmit(ref) {
 			onSubmit(ref) {
 				const that = this;
 				const that = this;
 				that.$refs[ref].validate().then(async params => {
 				that.$refs[ref].validate().then(async params => {
-					if (params.is_affirm == '1') {
+					let is_data = await that.getData();
+					if (is_data) {
 						uni.showToast({
 						uni.showToast({
-							title: '请确认团长申请',
-							icon: 'none'
-						})
+							title: `已有申请数据正在审核中,不可重复申请`,
+							icon: 'none',
+						});
 					} else {
 					} else {
 						const arr = await that.$api(`/userleader`, 'POST', that.form);
 						const arr = await that.$api(`/userleader`, 'POST', that.form);
 						if (arr.errcode == '0') {
 						if (arr.errcode == '0') {
@@ -128,8 +140,28 @@
 							})
 							})
 						}
 						}
 					}
 					}
+
 				})
 				})
 			},
 			},
+			async getData() {
+				const that = this;
+				let res = await that.$api('/userleader', 'GET', {
+					user_id: that.form.user_id,
+				})
+				if (res.errcode == '0') {
+					if (res.total > 0) {
+						let data = res.data.find(i => i.status == '0');
+						if (data) {
+							return true
+						} else {
+							return false
+						}
+
+					} else {
+						return false
+					}
+				}
+			},
 			// 团长记录
 			// 团长记录
 			toApply() {
 			toApply() {
 				uni.navigateTo({
 				uni.navigateTo({
@@ -178,7 +210,8 @@
 				}
 				}
 
 
 			}
 			}
-			.config{
+
+			.config {
 				.rich-img {
 				.rich-img {
 					width: 100% !important;
 					width: 100% !important;
 					display: block;
 					display: block;
@@ -192,4 +225,8 @@
 		display: flex;
 		display: flex;
 		flex-direction: row;
 		flex-direction: row;
 	}
 	}
+
+	.uni-data-checklist .checklist-group .checklist-box .checklist-content {
+		width: 91vw;
+	}
 </style>
 </style>

pages/other/agree.vue → pagesOther/other/agree.vue