|
|
@ -15,6 +15,9 @@ |
|
|
|
<u-form-item label="年龄" prop="age"> |
|
|
|
<u--input v-model="form.age" class="se-bgc-f5" placeholder="请输入年龄"></u--input> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="地址" prop="address"> |
|
|
|
<u--input v-model="form.address" class="se-bgc-f5" placeholder="请输入地址"></u--input> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="性别" prop="sex" @click="handleSexChange"> |
|
|
|
<u--input @click="handleSexChange" readonly v-model="form.sex" placeholder="请选择性别" |
|
|
|
border="none"></u--input> |
|
|
@ -32,7 +35,7 @@ |
|
|
|
</view> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="个人介绍" prop="introduce"> |
|
|
|
<u--textarea v-model="form.introduce" count class="se-bgc-f5" |
|
|
|
<u--textarea v-model="form.introduce" count maxlength="300" class="se-bgc-f5" |
|
|
|
placeholder="请选择个人介绍"></u--textarea> |
|
|
|
</u-form-item> |
|
|
|
</view> |
|
|
@ -48,8 +51,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="se-py-20 se-w-p-100"> |
|
|
|
<u-upload :fileList="form.idCardFile" @afterRead="afterRead" @delete="deletePic" |
|
|
|
name="1" multiple :maxCount="10"></u-upload> |
|
|
|
<u-upload :fileList="form.idCardFile" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="10"></u-upload> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</u-form-item> |
|
|
@ -68,25 +70,24 @@ |
|
|
|
</view> |
|
|
|
</u--form> |
|
|
|
<!-- 性别 --> |
|
|
|
<u-action-sheet :show="showSex" :actions="sexList" title="请选择性别" @close="showSex = false" @select="sexSelect"> |
|
|
|
</u-action-sheet> |
|
|
|
<u-action-sheet :show="showSex" :actions="sexList" title="请选择性别" @close="showSex = false" @select="sexSelect"></u-action-sheet> |
|
|
|
<!-- 种类 --> |
|
|
|
<u-action-sheet :show="showType" :actions="typeList" title="请选择种类" @close="showType = false" |
|
|
|
@select="typeSelect"> |
|
|
|
</u-action-sheet> |
|
|
|
<u-action-sheet :show="showType" :actions="typeList" title="请选择种类" @close="showType = false" @select="typeSelect"></u-action-sheet> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { |
|
|
|
role, |
|
|
|
industryList |
|
|
|
industryList, |
|
|
|
updateRole |
|
|
|
} from "@/common/api.js" |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
showSex: false, |
|
|
|
sexList: [{ |
|
|
|
sexList: [ |
|
|
|
{ |
|
|
|
name: '男', |
|
|
|
}, |
|
|
|
{ |
|
|
@ -97,23 +98,20 @@ |
|
|
|
typeList: [], |
|
|
|
fileList: [], |
|
|
|
form: { |
|
|
|
name: '张三', |
|
|
|
id:"", |
|
|
|
name: '', |
|
|
|
password: '', |
|
|
|
mobile: '13189698114', |
|
|
|
age: '23', |
|
|
|
sex: '男', |
|
|
|
industryId: '1865037318519398402', |
|
|
|
industryName: "餐饮", |
|
|
|
mobile: '', |
|
|
|
address:"", |
|
|
|
age: '', |
|
|
|
sex: '', |
|
|
|
industryId: '', |
|
|
|
industryName: "", |
|
|
|
salary: '', |
|
|
|
salaryMin: '1800', |
|
|
|
salaryMax: '2400', |
|
|
|
introduce: '张三的个人简介', |
|
|
|
idCard: '', |
|
|
|
idCardFile: [ |
|
|
|
{ |
|
|
|
url:"https://tennis-oss.xzaiyp.top/2024-12-22/7af6b40f-96f9-4656-9eff-98dce2223699.png" |
|
|
|
} |
|
|
|
] |
|
|
|
salaryMin: '', |
|
|
|
salaryMax: '', |
|
|
|
introduce: '', |
|
|
|
idCardFile: [] |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
name: [{ |
|
|
@ -128,6 +126,14 @@ |
|
|
|
message: '请选择行业', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
}], |
|
|
|
address:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请选择地址', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
} |
|
|
|
], |
|
|
|
// password: [{ |
|
|
|
// type: 'string', |
|
|
|
// required: true, |
|
|
@ -216,7 +222,39 @@ |
|
|
|
immediate: true |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
let worker = uni.getStorageSync("worker") |
|
|
|
if(worker){ |
|
|
|
this.form.id = worker.id |
|
|
|
this.form.name = worker.userName |
|
|
|
this.form.mobile = worker.phone |
|
|
|
this.form.age = worker.age |
|
|
|
this.form.sex = worker.sex==1?'男':'女' |
|
|
|
this.form.introduce = worker.detail |
|
|
|
this.form.address = worker.address |
|
|
|
this.form.industryId = worker.industryId |
|
|
|
this.form.industryName = worker.industryName |
|
|
|
this.form.salaryMin = worker.moneyMin |
|
|
|
this.form.salaryMax = worker.moneyMax |
|
|
|
this.form.idCardFile = this.stringToKeyValueArray(worker.idCard) |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
stringToKeyValueArray(str, delimiter1 = ',') { |
|
|
|
if(str){ |
|
|
|
let arro = str.split(delimiter1); |
|
|
|
let arr = []; |
|
|
|
arro.forEach(items=>{ |
|
|
|
let obj = {}; |
|
|
|
obj["url"] = items |
|
|
|
arr.push(obj) |
|
|
|
}) |
|
|
|
console.info(arr) |
|
|
|
return arr |
|
|
|
}else{ |
|
|
|
return [] |
|
|
|
} |
|
|
|
}, |
|
|
|
handleIndChange() { |
|
|
|
this.showType = true |
|
|
|
}, |
|
|
@ -245,9 +283,11 @@ |
|
|
|
onRole() { |
|
|
|
let that = this |
|
|
|
let params = { |
|
|
|
id: that.form.id, |
|
|
|
userName: that.form.name, |
|
|
|
industryId: that.form.industryId, |
|
|
|
industryName: that.form.industryName, |
|
|
|
address:that.form.address, |
|
|
|
age: that.form.age, |
|
|
|
gender: that.form.sex=="男"?1:2, |
|
|
|
moneyMin: that.form.salaryMin, |
|
|
@ -256,21 +296,33 @@ |
|
|
|
detail: that.form.introduce, |
|
|
|
idCard: that.form.idCardFile.map(item => item.url).join(','), |
|
|
|
} |
|
|
|
role(params).then(response => { |
|
|
|
uni.$u.toast("提交成功,等待申请") |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.switchTab({ |
|
|
|
url:"/pages/home/index" |
|
|
|
}) |
|
|
|
},1500) |
|
|
|
}).catch(error => { |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.switchTab({ |
|
|
|
url:"/pages/home/index" |
|
|
|
}) |
|
|
|
},1500) |
|
|
|
}) |
|
|
|
|
|
|
|
if(this.form.id){ |
|
|
|
updateRole(params).then(response=>{ |
|
|
|
uni.$u.toast("保存成功!") |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.navigateBack({ |
|
|
|
delta:1 |
|
|
|
}) |
|
|
|
},1500) |
|
|
|
}).catch(error=>{ |
|
|
|
|
|
|
|
}) |
|
|
|
}else{ |
|
|
|
role(params).then(response => { |
|
|
|
uni.$u.toast("提交成功,等待申请") |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.switchTab({ |
|
|
|
url:"/pages/home/index" |
|
|
|
}) |
|
|
|
},1500) |
|
|
|
}).catch(error => { |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.switchTab({ |
|
|
|
url:"/pages/home/index" |
|
|
|
}) |
|
|
|
},1500) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
submit() { |
|
|
|
this.$refs.uForm.validate().then(res => { |
|
|
|