diff --git a/pages.json b/pages.json index 829e7d8..0048a2e 100644 --- a/pages.json +++ b/pages.json @@ -246,7 +246,7 @@ { "path": "invite/enterpriseTags", "style": { - "navigationBarTitleText": "环保标签" + "navigationBarTitleText": "行业类别(可多选)" } }, { diff --git a/pages/enterprise.vue b/pages/enterprise.vue index 50f3923..a967c7d 100644 --- a/pages/enterprise.vue +++ b/pages/enterprise.vue @@ -90,19 +90,19 @@ style="margin-bottom: 16rpx; margin-top: 4rpx" > - - {{ enterprise.address }} - - - - + {{ - $dict.echoDicValue( + `${$dict.echoDicValue( dictMap.enterprises_area, enterprise.region - ) + )} | ${enterprise.address}` }} - + + + - {{ detail.address }} + {{ + `${$dict.echoDicValue( + dictMap.enterprises_area, + detail.region + )} | ${detail.address}` + }} - - {{ $dict.echoDicValue(dictMap.enterprises_area, detail.region) }} - + + + * + 所属区域 + + + + {{ $dict.echoDicValue(dictMap.enterprises_area, form.region) }} + + + 请选择所属区域 + + + + + * 企业地址 - + + {{ form.address }} + + + 请选择企业地址 + + + + * + 行业类别 + + + + {{ form.hy.map(i => i.label).join('、') }} + + + 请选择企业标签 + + + + + * @@ -50,7 +80,7 @@ {{ form.introduction }} - + 请输入企业介绍 @@ -70,7 +100,7 @@ * 企业照片 - 最多可传3张 + 最多可传3张 - - - * - 企业标签 - - - - {{ - Object.values(form.tags) - .map(tag => tag.name) - .join('、') - }} - - - 请选择企业标签 - - - - - * @@ -225,6 +235,20 @@ + + + + @@ -255,15 +279,25 @@ export default { tags: {}, environmentalContactPhone: '', contactName: '', - id: '' + id: '', + region: '', + hy: [] + }, + // 选择器 + picker: { + show: false, + // 做表单中键的缓存用 + key: null, + defaultIndex: [0], + data: [] }, dictMap: {}, prove: [], inviteId: '' } }, - onLoad(res) { - this.getDict() + async onLoad(res) { + await this.getDict() this.inviteId = res.inviteId if (res.id) { this.form.id = res.id @@ -279,11 +313,9 @@ export default { this.form.introduction = data.introduce }) uni.$on('enterpriseTag', data => { - this.form.tags = data + this.form.hy = data }) uni.$on('prove', data => { - console.log('资质', this.prove) - console.log('资质返回', data) if (this.form.id != '') { this.getProve() } else { @@ -334,26 +366,22 @@ export default { async init() { const enterprise = await getEnterPrise(this.form.id) this.form = enterprise.data - this.form.photo = enterprise.data.files - const tag = {} - enterprise.data.tagObjList.forEach(t => { - tag[t.tagCode] = { - name: t.tagName, + this.form.photo = enterprise.data.files.map(i => { + return { + ...i, + status: 'success', + message: '' + } + }) + this.form.hy = enterprise.data.tagObjList.map(t => { + return { + label: t.tagName, value: t.id } }) - tag.qy = { - name: this.$dict.echoDicValue( - this.dictMap.enterprises_area, - enterprise.data.region - ), - value: enterprise.data.region - } - this.form.tags = tag this.getProve() }, async getProve() { - console.log('getProve', this.prove) const load = this.$util.loading() const prove = await getProveList({ enterpriseId: this.form.id }) load.close() @@ -375,6 +403,14 @@ export default { this.dictMap = { ...dict.data } + this.picker.data = [ + dict.data.enterprises_area.map(i => { + return { + name: i.label, + value: i.value + } + }) + ] }, chooseAddress() { uni.chooseLocation({ @@ -392,7 +428,7 @@ export default { goTags() { uni.navigateTo({ url: `/sub/invite/enterpriseTags?tags=${JSON.stringify( - this.form.tags + this.form.hy )}` }) }, @@ -426,6 +462,7 @@ export default { }) ).then(res => { this.form.photo = res + this.$forceUpdate() uni.hideLoading() }) }, @@ -435,6 +472,7 @@ export default { */ delEnterprisePhoto(e) { this.form.photo.splice(e.index, 1) + this.$forceUpdate() }, addProve() { uni.navigateTo({ @@ -450,8 +488,7 @@ export default { const valide = await this.verifyForm() if (!valide) return const data = { ...this.form } - data.region = data.tags.qy.id - data.tagIds = [data.tags.hy.id, data.tags.st.id, data.tags.wr.id] + data.tagIds = this.form.hy.map(i => i.value) data.fileIds = data.photo.map(i => i.id) data.userId = this.inviteId data.qualis = this.prove.map(i => { @@ -489,7 +526,6 @@ export default { gpsLocation: '请选择企业地址', introduction: '请填写企业介绍', photo: '最少上传一张企业照片', - tags: '请选择企业标签', prove: '请填写企业资质', environmentalContactPhone: '请输入企业负责人', contactName: '请输入负责人电话' @@ -517,6 +553,22 @@ export default { return false } return true + }, + /** + * 选择器确认回调 + * @param {Object} e + */ + confirmPicker(e) { + const { value } = e + // 修改保存选中值的方式 + this.form.region = value[0].value + this.closePicker() + }, + /** + * 关闭选择器 + */ + closePicker() { + this.picker.show = false } } } diff --git a/sub/invite/enterpriseIntroduce.vue b/sub/invite/enterpriseIntroduce.vue index f8a38fb..c099edf 100644 --- a/sub/invite/enterpriseIntroduce.vue +++ b/sub/invite/enterpriseIntroduce.vue @@ -31,9 +31,7 @@ height: '360rpx' }" > - - {{ introduce.length }}/500 - + {{ introduce.length }}/500 @@ -57,15 +55,14 @@ export default { methods: { // 聚焦输入框 focusInput() { - console.log(this.$refs) - if (this.$refs.easyInput) { - this.textAreaFocus = false // 先重置焦点状态 + if (this.$refs.easyInput) { + this.textAreaFocus = false // 先重置焦点状态 this.$nextTick(() => { - this.textAreaFocus = true // 在下一个时序重新设置焦点 - }) - } else { - console.warn('输入框组件未注册') - } + this.textAreaFocus = true // 在下一个时序重新设置焦点 + }) + } else { + console.warn('输入框组件未注册') + } }, submit() { if (!this.introduce) { diff --git a/sub/invite/enterpriseTags.vue b/sub/invite/enterpriseTags.vue index 698dfe6..a3dda79 100644 --- a/sub/invite/enterpriseTags.vue +++ b/sub/invite/enterpriseTags.vue @@ -1,83 +1,27 @@