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 @@
-
- *
- 所在区域
-
-
-
- {{ form.qy.name }}
-
-
- 请选择所在区域
-
-
-
-
-
-
-
-
- *
- 行业类型
-
-
-
- {{ form.hy.name }}
-
-
- 请选择行业类型
+
+
+ {{ item.label }}
-
+
-
-
-
-
-
-
-
@@ -92,54 +36,25 @@ export default {
data() {
return {
data: [],
- form: {
- qy: '',
- hy: '',
- st: '',
- wr: ''
- },
- dictMap: {},
- // 选择器
- picker: {
- show: false,
- // 做表单中键的缓存用
- key: null,
- defaultIndex: [0],
- data: []
- }
+ hy: []
}
},
- onLoad(res) {
- this.getDict()
+ async onLoad(res) {
+ await this.getDict()
if (res.tags) {
- this.form = JSON.parse(res.tags)
+ this.hy = JSON.parse(res.tags)
}
},
methods: {
async getDict() {
try {
- const tags = await getTagData(['qy', 'hy', 'st', 'wr'].join(','))
- const dict = await getDictBatchByType({
- type: ['enterprises_area'].join(',')
+ const tags = await getTagData(['hy'].join(','))
+ this.data = tags.data[0].children.map(i => {
+ return {
+ label: i.tagName,
+ value: i.id
+ }
})
- if (tags.code === 0 && tags.data) {
- let tagMap = {}
- tags.data.forEach(t => {
- // 将子项处理成选择器需要的格式
- const children = t.children.map(child => ({
- name: child.tagName,
- value: child.id.toString()
- }))
- tagMap[t.tagCode] = children
- })
- tagMap.qy = dict.data.enterprises_area.map(i => {
- return {
- name: i.label,
- value: i.value
- }
- })
- this.dictMap = tagMap
- }
} catch (error) {
uni.showToast({
title: '获取数据失败',
@@ -147,65 +62,22 @@ export default {
})
}
},
-
- /**
- * 选择器确认回调
- * @param {Object} e
- */
- confirmPicker(e) {
- const { value } = e
- // 修改保存选中值的方式
- this.form[this.picker.key] = {
- name: value[0].name,
- id: value[0].value
- }
- this.closePicker()
- },
-
- /**
- * 关闭选择器
- */
- closePicker() {
- this.picker = {
- show: false,
- key: '',
- data: []
- }
- },
- showPicker(type) {
- this.picker.data = [this.dictMap[type] || []]
- this.picker.key = type
- this.picker.show = true
- if (this.form[type]) {
- const index = this.dictMap[type].findIndex(
- i => i.value == this.form[type].id
- )
- this.picker.defaultIndex = index > -1 ? [index] : [0]
+ select(item) {
+ if (this.hy.map(i => i.value).indexOf(item.value) > -1) {
+ this.hy = this.hy.filter(i => i.value != item.value)
+ } else {
+ this.hy.push(item)
}
},
submit() {
- // 校验所有字段是否已填写
- if (!this.form.qy || !this.form.hy) {
- const emptyFields = []
- if (!this.form.qy) emptyFields.push('所在区域')
- if (!this.form.hy) emptyFields.push('行业类型')
- // if (!this.form.st) emptyFields.push('所属生态')
- // if (!this.form.wr) emptyFields.push('污染类型')
-
+ if (this.hy.length == 0) {
uni.showToast({
- title: `请选择${emptyFields.join('、')}`,
+ title: '至少选择一个行业标签',
icon: 'none'
})
return
}
-
- // 构造提交的数据格式
- const submitData = {
- qy: this.form.qy,
- hy: this.form.hy
- }
- console.log(submitData)
- uni.$emit('enterpriseTag', submitData)
+ uni.$emit('enterpriseTag', this.hy)
uni.navigateBack()
}
}
@@ -223,32 +95,20 @@ export default {
max-height: 100vh;
padding-bottom: 12vh;
}
-.input-value {
- flex: 1;
- text-align: right;
- white-space: nowrap;
- text-overflow: ellipsis;
-}
.block {
display: flex;
- flex-flow: row nowrap;
+ flex-flow: column nowrap;
background-color: #fff;
- padding: 12px;
- border-radius: 8px;
- justify-content: space-between;
- align-items: center;
- gap: 12px;
- .value {
- flex: 1;
+ .row {
+ padding: 32rpx;
+ border-bottom: 1px solid #f1f1f4;
display: flex;
- flex-flow: row nowrap;
justify-content: space-between;
- gap: 4px;
- .input-value {
- flex: 1;
- text-align: right;
- white-space: nowrap;
- text-overflow: ellipsis;
+ &:last-child {
+ border-bottom: none;
+ }
+ .label {
+ color: #071437;
}
}
}
diff --git a/sub/invite/index.vue b/sub/invite/index.vue
index 6059437..e6ad92e 100644
--- a/sub/invite/index.vue
+++ b/sub/invite/index.vue
@@ -28,18 +28,15 @@
- {{ enterprise.address }}
-
-
-
-
{{
- $dict.echoDicValue(
+ `${$dict.echoDicValue(
dictMap.enterprises_area,
enterprise.region
- )
+ )} | ${enterprise.address}`
}}
-
+
+
+
-
+
{{ detail.enterprise.enterprisesName }}
- {{ detail.enterprise.address }}
-
-
-
-
{{
- $dict.echoDicValue(
+ `${$dict.echoDicValue(
dictMap.enterprises_area,
detail.enterprise.region
- )
- }}
-
-
- {{
- $dict.echoDicValue(
- dictMap.enterprises_type,
- detail.enterprise.type
- )
+ )} | ${detail.enterprise.address}`
}}
-
+
+
+