|
@@ -312,56 +312,83 @@
|
|
</u-icon>
|
|
</u-icon>
|
|
</u-form-item>
|
|
</u-form-item>
|
|
<view>
|
|
<view>
|
|
- <view
|
|
|
|
- v-for="(item, index) in model1.userInfo.follows"
|
|
|
|
- :key="index"
|
|
|
|
|
|
+ <u-form-item
|
|
|
|
+ prop="userInfo.follows"
|
|
class="follower-item"
|
|
class="follower-item"
|
|
>
|
|
>
|
|
- <view style="display: flex;align-items: center;justify-content: flex-start;">
|
|
|
|
- {{ `随行人员${index + 1}` }}
|
|
|
|
- <u-icon name="minus-circle-fill" color="red" size="28" @click="()=>minusFollower(index)"
|
|
|
|
- style="margin-left: auto">
|
|
|
|
- </u-icon>
|
|
|
|
- </view>
|
|
|
|
- <u-form-item
|
|
|
|
- label="姓名"
|
|
|
|
- prop="item.usrName"
|
|
|
|
- >
|
|
|
|
- <u--input
|
|
|
|
- placeholder="输入姓名"
|
|
|
|
- v-model="item.usrName"
|
|
|
|
- border="none"
|
|
|
|
- ></u--input>
|
|
|
|
- </u-form-item>
|
|
|
|
- <u-form-item
|
|
|
|
- label="单位职务"
|
|
|
|
- prop="item.usrLevel"
|
|
|
|
|
|
+ <view v-for="(item, index) in model1.userInfo.follows"
|
|
|
|
+ :key="index"
|
|
>
|
|
>
|
|
- <u--input
|
|
|
|
- placeholder="输入单位职务"
|
|
|
|
- v-model="item.usrLevel"
|
|
|
|
|
|
+ <view style="display: flex;align-items: center;justify-content: flex-start;">
|
|
|
|
+ {{ `随行人员${index + 1}` }}
|
|
|
|
+ <u-icon name="minus-circle-fill" color="red" size="28" @click="()=>minusFollower(index)"
|
|
|
|
+ style="margin-left: auto">
|
|
|
|
+ </u-icon>
|
|
|
|
+ </view>
|
|
|
|
+ <u-form-item
|
|
|
|
+ label="姓名"
|
|
|
|
+ prop="item.usrName"
|
|
|
|
+ class="require"
|
|
|
|
+ >
|
|
|
|
+ <u--input
|
|
|
|
+ placeholder="输入姓名"
|
|
|
|
+ v-model="item.usrName"
|
|
|
|
+ @change="followsValidate"
|
|
|
|
+ @blur="followsValidate"
|
|
|
|
+ border="none"
|
|
|
|
+ ></u--input>
|
|
|
|
+ </u-form-item>
|
|
|
|
+ <view
|
|
|
|
+ v-if="followErrors[index] && followErrors[index].usrName"
|
|
|
|
+ style="font-size: 12px;line-height: 12px;color: #f56c6c;">
|
|
|
|
+ 请填写姓名
|
|
|
|
+ </view>
|
|
|
|
+ <u-form-item
|
|
|
|
+ label="单位职务"
|
|
|
|
+ prop="item.usrLevel"
|
|
|
|
+ class="require"
|
|
|
|
+ >
|
|
|
|
+ <u--input
|
|
|
|
+ placeholder="输入单位职务"
|
|
|
|
+ @change="followsValidate"
|
|
|
|
+ @blur="followsValidate"
|
|
|
|
+ v-model="item.usrLevel"
|
|
|
|
+ border="none"
|
|
|
|
+ ></u--input>
|
|
|
|
+ </u-form-item>
|
|
|
|
+ <view
|
|
|
|
+ v-if="followErrors[index] && followErrors[index].usrLevel"
|
|
|
|
+ style="font-size: 12px;line-height: 12px;color: #f56c6c;">请填写单位职务
|
|
|
|
+ </view>
|
|
|
|
+ <u-form-item
|
|
|
|
+ label="联系电话"
|
|
|
|
+ prop="item.tel"
|
|
border="none"
|
|
border="none"
|
|
- ></u--input>
|
|
|
|
- </u-form-item>
|
|
|
|
- <u-form-item
|
|
|
|
- label="联系电话"
|
|
|
|
- prop="item.tel"
|
|
|
|
- borderBottom
|
|
|
|
- >
|
|
|
|
- <u--input
|
|
|
|
- placeholder="输入联系电话"
|
|
|
|
- border="none"
|
|
|
|
- type="number"
|
|
|
|
- maxlength="11"
|
|
|
|
- v-model="item.tel"
|
|
|
|
- ></u--input>
|
|
|
|
- </u-form-item>
|
|
|
|
- </view>
|
|
|
|
|
|
+ class="require"
|
|
|
|
+ >
|
|
|
|
+ <u--input
|
|
|
|
+ placeholder="输入联系电话"
|
|
|
|
+ border="none"
|
|
|
|
+ type="number"
|
|
|
|
+ maxlength="11"
|
|
|
|
+ @change="followsValidate"
|
|
|
|
+ @blur="followsValidate"
|
|
|
|
+ v-model="item.tel"
|
|
|
|
+ ></u--input>
|
|
|
|
+ </u-form-item>
|
|
|
|
+ <view
|
|
|
|
+ v-if="followErrors[index] && followErrors[index].tel"
|
|
|
|
+ style="font-size: 12px;line-height: 12px;color: #f56c6c;">请填写正确的手机号
|
|
|
|
+ </view>
|
|
|
|
+ <u-line margin="20rpx 0" color="#d6d7d9"></u-line>
|
|
|
|
+ </view>
|
|
|
|
+ </u-form-item>
|
|
<view
|
|
<view
|
|
- style="color: #fb0000c7;margin-top: 10rpx;font-size: 24rpx"
|
|
|
|
|
|
+ style="color: #fb0000c7;margin-top: 10rpx;font-size: 24rpx"
|
|
>
|
|
>
|
|
* 温馨提示:请同步填写随行人员信息。
|
|
* 温馨提示:请同步填写随行人员信息。
|
|
</view>
|
|
</view>
|
|
|
|
+
|
|
</view>
|
|
</view>
|
|
</u--form>
|
|
</u--form>
|
|
<slot name="footer"></slot>
|
|
<slot name="footer"></slot>
|
|
@@ -431,6 +458,7 @@ export default {
|
|
comLabel: '',
|
|
comLabel: '',
|
|
tfcDic: [],
|
|
tfcDic: [],
|
|
backLabel: '',
|
|
backLabel: '',
|
|
|
|
+ followErrors: {},
|
|
model1: {
|
|
model1: {
|
|
userInfo: {
|
|
userInfo: {
|
|
usrName: '',
|
|
usrName: '',
|
|
@@ -453,6 +481,10 @@ export default {
|
|
this.setFormRules();
|
|
this.setFormRules();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ followsValidate(index) {
|
|
|
|
+ debugger
|
|
|
|
+ this.$refs.uForm.validateField('userInfo.follows');
|
|
|
|
+ },
|
|
initUser() {
|
|
initUser() {
|
|
const user = getUserInfo();
|
|
const user = getUserInfo();
|
|
if (user) {
|
|
if (user) {
|
|
@@ -461,8 +493,41 @@ export default {
|
|
this.init();
|
|
this.init();
|
|
},
|
|
},
|
|
setFormRules() {
|
|
setFormRules() {
|
|
|
|
+ const that = this;
|
|
//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
|
|
//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
|
|
- this.$refs.uForm.setRules(this.rules);
|
|
|
|
|
|
+ const rules = {
|
|
|
|
+ 'userInfo.follows': [
|
|
|
|
+ {
|
|
|
|
+ // 自定义验证函数,见上说明
|
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
|
+ debugger
|
|
|
|
+ const followMsg = {};
|
|
|
|
+ value.forEach((item, index) => {
|
|
|
|
+ const msgs = {};
|
|
|
|
+ if (!item.usrName) {
|
|
|
|
+ msgs.usrName = '姓名不能为空';
|
|
|
|
+ }
|
|
|
|
+ if (!uni.$u.test.mobile(item.tel)) {
|
|
|
|
+ msgs.tel = '手机号码不正确';
|
|
|
|
+ }
|
|
|
|
+ if (!item.usrLevel) {
|
|
|
|
+ msgs.usrLevel = '单位职务不能为空';
|
|
|
|
+ }
|
|
|
|
+ if (Object.keys(msgs).length > 0) {
|
|
|
|
+ followMsg[index] = msgs;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ that.followErrors = followMsg;
|
|
|
|
+ return Object.keys(followMsg).length < 1;
|
|
|
|
+ },
|
|
|
|
+ message: ' ',
|
|
|
|
+ // 触发器可以同时用blur和change
|
|
|
|
+ trigger: ['change', 'blur'],
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ ...this.rules,
|
|
|
|
+ };
|
|
|
|
+ this.$refs.uForm.setRules(rules);
|
|
},
|
|
},
|
|
getImageUrl,
|
|
getImageUrl,
|
|
addFollower() {
|
|
addFollower() {
|
|
@@ -485,6 +550,17 @@ export default {
|
|
this.model1.userInfo.themeId = item.value;
|
|
this.model1.userInfo.themeId = item.value;
|
|
this.$refs.uForm.clearValidate('userInfo.themeId');
|
|
this.$refs.uForm.clearValidate('userInfo.themeId');
|
|
},
|
|
},
|
|
|
|
+ validateUsername(rule, value, callback) {
|
|
|
|
+ console.log(value);
|
|
|
|
+ // 自定义验证规则,例如用户名必须包含"uview"
|
|
|
|
+ if (value.indexOf('uview') === -1) {
|
|
|
|
+ // 验证不通过,调用callback并传入错误信息
|
|
|
|
+ callback(new Error('用户名必须包含"uview"'));
|
|
|
|
+ } else {
|
|
|
|
+ // 验证通过,调用callback并不传入参数或者传入null
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
async init() {
|
|
async init() {
|
|
const {
|
|
const {
|
|
code: conferenceCode,
|
|
code: conferenceCode,
|