290144e9
易尊强
第一次
|
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
|
<template>
<view class="page">
<!-- 反馈内容 -->
<view class="feedback-data">
<view class="titleall-box">
<view class="titleall-left">
<view class="titleall-left-line"></view>人才信息
</view>
</view>
<uni-forms ref="baseForm" :modelValue="baseFormData" :rules="rules">
<view class="example-body">
<uni-file-picker limit="1" @select="select" title="头像"></uni-file-picker>
</view>
<uni-forms-item label="姓名" required name="name" style="margin-top: 10rpx;">
<uni-easyinput v-model="baseFormData.name" placeholder="请输入姓名" />
</uni-forms-item>
<uni-forms-item label="年龄" required name="age">
<uni-easyinput v-model="baseFormData.age" placeholder="请输入年龄" />
</uni-forms-item>
<uni-forms-item label="性别" required>
<uni-data-checkbox v-model="baseFormData.sex" :localdata="sexs" @change="change" />
</uni-forms-item>
<uni-forms-item label="政治面貌" required name="policy">
<uni-easyinput v-model="baseFormData.policy" placeholder="请输入政治面貌" />
</uni-forms-item>
<uni-forms-item label="民族" required name="nation">
<uni-easyinput v-model="baseFormData.nation" placeholder="请输入民族" />
</uni-forms-item>
<uni-forms-item label="电话号码" required name="phone">
<uni-easyinput v-model="baseFormData.phone" placeholder="请输入电话号码" />
</uni-forms-item>
<uni-forms-item label="学历" required name="education">
<uni-easyinput v-model="baseFormData.education" placeholder="请输入学历" />
</uni-forms-item>
<uni-forms-item label="毕业院校" required name="school">
<uni-easyinput v-model="baseFormData.school" placeholder="请输入毕业院校" />
</uni-forms-item>
<uni-forms-item label="工作经历">
<uni-easyinput type="textarea" v-model="baseFormData.introduction" placeholder="请输入工作经历" />
</uni-forms-item>
</uni-forms>
</view>
<!-- 提交 -->
<view v-if="have" class="submit-btn" @click="postInfo('baseForm')">
<text>发布</text>
</view>
<view v-else class="submit-btn" @click="updateInfo('baseForm')">
<text>保存</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
// 基础表单数据
baseFormData: {
name: '',
age: '',
introduction: '',
sex: 2,
// 政治面貌
policy: '',
phone: '',
education: '',
school: '',
nation: '',
datetimesingle: 1627529992399,
},
sexValue: '',
filePath: [],
uploadPath: [],
// 单选数据源
sexs: [{
text: '男',
value: 0
}, {
text: '女',
value: 1
}, {
text: '保密',
value: 2
}],
// 校验规则
rules: {
name: {
rules: [{
required: true,
errorMessage: '姓名不能为空'
}]
},
age: {
rules: [{
required: true,
errorMessage: '年龄不能为空'
}, {
format: 'number',
errorMessage: '年龄只能输入数字'
}]
},
phone: {
rules: [{
required: true,
errorMessage: '电话号码不能为空'
}]
},
policy: {
rules: [{
required: true,
errorMessage: '不能为空'
}]
},
education: {
rules: [{
required: true,
errorMessage: '不能为空'
}]
},
school: {
rules: [{
required: true,
errorMessage: '不能为空'
}]
},
nation: {
rules: [{
required: true,
errorMessage: '不能为空'
}]
},
},
have:false,
isId:''
}
},
onLoad(options) {
console.log("options",options)
// console.log("options",JSON.stringify(options).data)
if(JSON.stringify(options) == "{}"){
this.have = true
console.log(this.have)
}else{
this.isId = JSON.parse(options.data)
console.log("Id",this.isId)
this.getDetail(this.isId)
}
},
methods: {
|
290144e9
易尊强
第一次
|
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
|
// 获取上传状态
select(e) {
console.log('选择文件:', e)
this.filePath = e.tempFilePaths
},
change(e) {
console.log("e:", e.detail.value);
console.log("sex:", this.baseFormData.sex)
},
// 发布信息
postInfo(ref) {
let that = this
this.uploadPath = []
if (this.filePath.length == 0) {
uni.showToast({
icon: "error",
title: "请上传头像"
})
return
}
this.$refs[ref].validate().then(res => {
console.log(res)
this.sexValue = this.sexs[this.baseFormData.sex].text
console.log('xinbie', this.sexValue)
uni.uploadFile({
url: "http://deyanggaoxin.fengshiyun.com/api/file/Uploader/1",
filePath: this.filePath[0],
name: 'file',
success: (res) => {
console.log(JSON.parse(res.data))
let data = JSON.parse(res.data).data
console.log(data)
this.uploadPath.push(data)
console.log(this.uploadPath)
// if (res.code == 200) {
// }
console.log('进入')
let info = {
name: that.baseFormData.name,
headImg: that.uploadPath,
gender: that.sexValue,
age: that.baseFormData.age,
nation: that.baseFormData.nation,
phoneNumber: that.baseFormData.phone,
education:that.baseFormData.education,
graduationInstitution:that.baseFormData.school,
workExperience:that.baseFormData.introduction,
politicalOutlook:that.baseFormData.policy
}
that.API.postRecommend(info).then(res=>{
console.log("成功上传",res)
if(res.code === 200){
uni.showToast({
icon:"success",
title:"发布成功!"
|
290144e9
易尊强
第一次
|
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
|
})
}
})
}
})
})
},
// 修改信息
updateInfo(ref) {
let that = this
this.uploadPath = []
if (this.filePath.length == 0) {
uni.showToast({
icon: "error",
title: "请上传头像"
})
return
}
this.$refs[ref].validate().then(res => {
console.log(res)
this.sexValue = this.sexs[this.baseFormData.sex].text
console.log('xinbie', this.sexValue)
uni.uploadFile({
url: "http://deyanggaoxin.fengshiyun.com/api/file/Uploader/1",
filePath: this.filePath[0],
name: 'file',
success: (res) => {
console.log(JSON.parse(res.data))
let data = JSON.parse(res.data).data
console.log(data)
this.uploadPath.push(data)
console.log(this.uploadPath)
// if (res.code == 200) {
// }
console.log('进入')
let info = {
name: that.baseFormData.name,
headImg: that.uploadPath,
gender: that.sexValue,
age: that.baseFormData.age,
nation: that.baseFormData.nation,
phoneNumber: that.baseFormData.phone,
education:that.baseFormData.education,
graduationInstitution:that.baseFormData.school,
workExperience:that.baseFormData.introduction,
politicalOutlook:that.baseFormData.policy,
id:that.isId
}
that.API.updateRecommendInfo(info).then(res=>{
console.log("修改成功",res)
if(res.code === 200){
uni.showToast({
icon:"success",
title:"修改成功!"
})
}
})
}
})
})
},
//获取详细信息
getDetail(id){
let that = this
this.API.getRecommendInfo(id).then(res=>{
console.log(res)
if(res.code === 200){
let detailData = res.data
that.baseFormData.name = detailData.name
that.baseFormData.age = detailData.age
that.baseFormData.nation = detailData.nation
that.baseFormData.phone = detailData.phoneNumber
that.baseFormData.education = detailData.education
that.baseFormData.school = detailData.graduationInstitution
that.baseFormData.introduction = detailData.workExperience
that.baseFormData.policy = detailData.politicalOutlook
}
})
},
}
}
</script>
<style lang="scss" scoped>
@import 'Feedback.scss'
</style>
|