perfect.vue
6.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<template>
<view>
<view class="pd30">
<uni-steps :options="list1" :active="active" />
<view>
<uni-forms ref="baseForm" :modelValue="baseFormData" label-width="100">
<uni-forms-item label="所属协会" required><uni-easyinput v-model="baseFormData.name"
:disabled="!editIng" placeholder="所属协会" /></uni-forms-item>
<uni-forms-item label="机构名称" required><uni-easyinput v-model="baseFormData.name"
:disabled="!editIng" placeholder="机构名称" /></uni-forms-item>
<uni-forms-item label="单位类型" required>
<uni-data-select :disabled="!editIng" v-model="baseFormData.type"
:localdata="typeList"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="联系人" required>
<uni-easyinput v-model="baseFormData.contactPerson" :disabled="!editIng"
placeholder="请输入联系人姓名" />
</uni-forms-item>
<uni-forms-item label="联系方式" required>
<uni-easyinput v-model="baseFormData.contactTelno" :disabled="!editIng" placeholder="请输入联系方式" />
</uni-forms-item>
<uni-forms-item label="所在地区" required>
<uni-data-picker v-if="editIng" class="fixUniFormItemStyle" :clear-icon="!editIng"
v-model="regionArr" @change="onchangeRegionId" :localdata="regionsList"
popup-title="请选择所在地区"></uni-data-picker>
<uni-easyinput v-model="baseFormData.regionStr" v-else disabled />
</uni-forms-item>
<uni-forms-item label="详细地址" required><uni-easyinput v-model="baseFormData.address"
:disabled="!editIng" placeholder="请输入详细地址" /></uni-forms-item>
</uni-forms>
<view class="fixedBottom">
<button class="btn-red" @click="saveMyteam()">下一步</button>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref
} from 'vue';
import * as api from '@/common/api.js';
import {
onLoad,
onShow
} from '@dcloudio/uni-app';
import {
tagList,
typeList,
comList
} from '@/static/js/data';
import config from '@/config.js'
const app = getApp();
const baseFormData = ref({
});
const dataList = ref([]);
const memberList = ref([]);
const regionArr = ref();
const regionsList = ref([]);
const ranksList = ref([]);
const current = ref(0);
const groupId = ref(0);
const currIndex = ref(null);
const cptId = ref();
const signType = ref();
const editIng = ref(true);
const isSign = ref(false);
const query = ref({
type: 0
});
const active = ref(0)
const list1 = ref([{
title: '完善信息'
}, {
title: '会员认证'
}])
onLoad(option => {
console.log(option)
getRegionsList();
getDetail()
});
function getDetail(){
api.getMyOwnMemberInfo().then(res=>{
if (!res.data.memberInfo) res.data.memberInfo = {}
baseFormData.value = res.data.memberInfo
baseFormData.value.coordinates1 = []
authenticationStatusa.value = res.data.authenticationStatus
if (baseFormData.value.siteProvinceId)baseFormData.value.coordinates1.push(baseFormData.value.siteProvinceId)
if (baseFormData.value.siteCityId) baseFormData.value.coordinates1.push(baseFormData.value.siteCityId)
if (baseFormData.value.siteRegionId) baseFormData.value.coordinates1.push(baseFormData.value.siteRegionId)
})
}
function getRegionsList() {
api.regionsList().then(res => {
regionsList.value = res.data;
});
}
function onchangeRegionId(e) {
console.log(e.detail.value)
baseFormData.value.regionId = regionArr.value
}
function saveMyteam() {
// 验证必填项
if (baseFormData.value.imgUrl == '') {
uni.showToast({
title: '请上传logo',
duration: 2000,
icon: 'none'
})
return
}
if (baseFormData.value.name == '') {
uni.showToast({
title: '请填写团体名称',
duration: 2000,
icon: 'none'
})
return
}
if (baseFormData.value.abreviations == '') {
uni.showToast({
title: '请填写简称',
duration: 2000,
icon: 'none'
})
return
}
if (baseFormData.value.type == '') {
uni.showToast({
title: '请选择参赛队类型',
duration: 2000,
icon: 'none'
})
return
}
// if(baseFormData.value.type=='3'&&!baseFormData.value.ctype){
// uni.showToast({
// title: '请选择企业性质',
// duration: 2000,
// icon:'none'
// })
// return
// }
if (baseFormData.value.contactPerson == '') {
uni.showToast({
title: '请填写联系人',
duration: 2000,
icon: 'none'
})
return
}
if (baseFormData.value.contactTelno == '') {
uni.showToast({
title: '请填写联系方式',
duration: 2000,
icon: 'none'
})
return
}
var pattern = /^1[3456789]\d{9}$/;
if (!pattern.test(baseFormData.value.contactTelno)) {
uni.showToast({
title: '请输入正确的手机号',
duration: 2000,
icon: 'none'
})
return
}
if (baseFormData.value.regionId == '') {
uni.showToast({
title: '选择所在地区',
duration: 2000,
icon: 'none'
})
return
}
if (baseFormData.value.address == '') {
uni.showToast({
title: '请填写详细地址',
duration: 2000,
icon: 'none'
})
return
}
for (let n in participantsInfoArr.value) {
if (participantsInfoArr.value[n].status == 0 && (!participantsInfoArr.value[n].value)) {
uni.showToast({
title: '请完善必填字段',
duration: 2000,
icon: 'none'
})
return
}
}
match.saveMyGroup(baseFormData.value).then(res => {
groupId.value = res.data
if (participantsInfoArr.value && participantsInfoArr.value.length > 0) {
// 保存补充信息
const obj = {
cptId: cptId.value,
groupId: groupId.value,
groupInfo: JSON.stringify(participantsInfoArr.value)
}
match.saveMyGroupExtraInfo(obj).then(res => {
})
}
if (!signType.value) {
uni.showToast({
title: '保存成功',
icon: 'none',
duration: 2000
});
editIng.value = false;
} else if (signType.value == 1) {
// 团队
if (coachOrLeaderFlag.value == "1") {
uni.navigateTo({
url: `/pages_match/match/choose_coach?matchId=${cptId.value}&groupId=${groupId.value}&signType=${signType.value}`
});
} else {
// 选运动员
uni.navigateTo({
url: `/pages_match/match/choose_sportman?matchId=${cptId.value}&groupId=${groupId.value}&signType=${signType.value}`
});
}
} else if (signType.value == 2) {
// 队伍
uni.navigateTo({
url: `/pages_match/match/add_rank?matchId=${cptId.value}&groupId=${groupId.value}&signType=${signType.value}`
});
}
});
}
</script>
<style lang="scss">
</style>