jiazhipeng 11 months ago
parent
commit
503bd82984
  1. 82
      subPackages/user/infoFilling.vue

82
subPackages/user/infoFilling.vue

@ -12,7 +12,7 @@
</view> </view>
<view class="lingo-container" v-else-if="valueType=='lingo_ids'"> <view class="lingo-container" v-else-if="valueType=='lingo_ids'">
<view class="userinfo-item"> <view class="userinfo-item" @click="changeSelection({arr:lingoIds, })">
<span>语言能力</span> <span>语言能力</span>
<view v-if="inputValueStr" class="text-overflow" >{{inputValueStr}}</view> <view v-if="inputValueStr" class="text-overflow" >{{inputValueStr}}</view>
<view v-else class="empty-value" >请选择</view> <view v-else class="empty-value" >请选择</view>
@ -170,20 +170,47 @@
popSubmit () { popSubmit () {
let tempSelect = JSON.parse(JSON.stringify(this.selection)) let tempSelect = JSON.parse(JSON.stringify(this.selection))
let valueHave = tempSelect.arr.filter(x=>tempSelect.value.includes(x.id)) if (['scenic_ids'].includes(this.valueType)) {
this.selectionItem.value = tempSelect.value let valueHave = tempSelect.arr.filter(x=>tempSelect.value.includes(x.id))
this.selectionItem.valueStr = valueHave.map(x=>x.name).join(',') this.selectionItem.value = tempSelect.value
this.selectionItem.valueStr = valueHave.map(x=>x.name).join(',')
} else if (['lingo_ids'].includes(this.valueType)) {
this.inputValue = tempSelect.value
this.inputValueStr = tempSelect.valueStr
}
this.$refs.popup.close() this.$refs.popup.close()
}, },
uploadImg() { uploadImg() {
let url = this.NEWAPIURL+'/api/api/Common/upload'
let merchants_token =''
if (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo')).token) merchants_token = JSON.parse(uni.getStorageSync('userInfo')).token
uni.chooseImage({ uni.chooseImage({
count:1,
success: (res) => { success: (res) => {
for(let i =0 ;i<res.tempFilePaths.length;i++) { // for(let i =0 ;i<res.tempFilePaths.length;i++) {
let param = {img:res.tempFilePaths[i], tempFile:res.tempFiles[i] } // let param = {img:res.tempFilePaths[i], tempFile:res.tempFiles[i] }
this.fileList.push(param) // this.fileList.push(param)
} // }
console.log(this.fileList) // console.log(this.fileList)
const tempFilePaths = res.tempFilePaths;
const uploadTask = uni.uploadFile({
url: url,
filePath: tempFilePaths[0],
name: 'file',
header: {
'merchants_token': merchants_token || ''
},
success: (uploadFileRes) => {
console.log(uploadFileRes.data);
},
fail:()=> {
uni.showToast({
title:'上传失败',
icon:'none'
})
}
});
}, },
fail:()=> { fail:()=> {
@ -197,25 +224,26 @@
// //
handleSubmitData() { handleSubmitData() {
let data = [] //
if (this.valueType == 'lingo_ids') { if (["scenic_ids"].includes(this.valueType)) {
data = this.lingoIds let data = []
} if (this.valueType == 'lingo_ids') {
if (this.valueType == 'scenic_ids') { data = this.lingoIds
data = this.scenicIds
}
let value = []
data.forEach(v=>{
if(Array.isArray(v.value) && v.value.length>0) {
value.push(v)
} }
}) if (this.valueType == 'scenic_ids') {
data = this.scenicIds
this.inputValue = value.map(v=>v.value.join(',')).join(',') }
this.inputValueStr = value.map(v=>v.valueStr).join(',') let value = []
console.log(this.inputValue,this.inputValueStr) data.forEach(v=>{
if(Array.isArray(v.value) && v.value.length>0) {
value.push(v)
}
})
this.inputValue = value.map(v=>v.value.join(',')).join(',')
this.inputValueStr = value.map(v=>v.valueStr).join(',')
console.log(this.inputValue,this.inputValueStr)
}
}, },
submit() { submit() {

Loading…
Cancel
Save