diff --git a/App.vue b/App.vue index 65781a9..e337690 100644 --- a/App.vue +++ b/App.vue @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/pages/enterprise.vue b/pages/enterprise.vue index d7989dd..c4eac07 100644 --- a/pages/enterprise.vue +++ b/pages/enterprise.vue @@ -1,27 +1,140 @@ + + diff --git a/sub/enterprise/detail.vue b/sub/enterprise/detail.vue new file mode 100644 index 0000000..9cd935a --- /dev/null +++ b/sub/enterprise/detail.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/sub/enterprise/edit.vue b/sub/enterprise/edit.vue index 672b411..68581e1 100644 --- a/sub/enterprise/edit.vue +++ b/sub/enterprise/edit.vue @@ -128,8 +128,8 @@ {{ $dict.echoDicValue(dictMap.enterprise_qua, prove.qualificationName.toString()) }} - {{ $util.formatDate(prove.expiryDate, 'YYYY年M月D日') }}- {{ $util.formatDate(prove.handleDate, 'YYYY年M月D日') }} + {{ $util.formatDate(prove.expiryDate, 'YYYY年M月D日') }} @@ -165,6 +165,7 @@ import { createProve, getProveList, updateProve } from '@/api/enterprise/prove.j export default { data() { return { + // 邀请人id invateId: undefined, // 企业基本信息 info: { @@ -208,15 +209,21 @@ export default { } } }, + // 字典 dictMap: {}, + // 选择器 picker: { show: false, + // 做表单中键的缓存用 key: null, data: [] }, + // 日历控件 calendar: { + // 做表单中键的缓存用 key: null }, + // 进度条 step: { options: [ { @@ -231,7 +238,8 @@ export default { // 资质相关 prove: { list: [], - isEdit: false, + // 切换资质表单与列表的开关 + isEdit: true, loading: false, form: { enterpriseId: '', @@ -256,6 +264,10 @@ export default { this.initProveList() }, methods: { + /** + * 选择图片并上传 + * @param {Object} e + */ async addEnterprisePhoto(e) { this.info.form.photo = e.file.map(p => { return { @@ -264,6 +276,7 @@ export default { message: '上传中' } }) + // 使用promise.all()方法上传到后端做统一接收 await Promise.all( this.info.form.photo.map(async (p, i) => { const res = await uploadFile({ name: `file`, filePath: p.url }) @@ -277,29 +290,51 @@ export default { this.info.form.photo = res }) }, + /** + * 删除图片 + * @param {Object} e + */ delEnterprisePhoto(e) { this.info.form.photo.splice(e.index, 1) }, + /** + * 弹出选择器 + * @param {String} type 字典类型 + * @param {String} key 表单中需要赋值的健 + */ showPicker(type, key) { + // 取出字典中type对应的列表并赋值给选择器的列表 this.picker.data.push(this.dictMap[type]) this.picker.key = key this.picker.show = true }, + /** + * 获取字典 + */ async getDict() { const dict = await getDictBatchByType({ type: ['enterprises_type', 'enterprise_qua'].join(',') }) this.dictMap = { ...dict.data } }, + /** + * 选择器确认回调 + * @param {Object} e + */ confirmPicker(e) { const { value } = e if (this.step.active == 1) { + // 若是步骤索引为1 则向资质表单赋值 this.prove.form[this.picker.key] = value[0].value } else { + // 若是步骤索引为0 则向企业基本信息表单赋值 this.info.form[this.picker.key] = value[0].value } this.closePicker() }, + /** + * 关闭选择器 + */ closePicker() { this.picker = { show: false, @@ -307,55 +342,93 @@ export default { data: [] } }, + /** + * 显示日历 + * @param {Object} key 表单中需要赋值的键 + */ showCalendar(key) { this.$refs.calendarRef.open() this.calendar = { key } }, + /** + * 日历选中之后的回调 + * @param {Object} e + */ confirmCalendar(e) { if (this.step.active == 1) { + // 若是步骤索引为1 则向资质表单赋值 this.prove.form[this.calendar.key] = e.fulldate } else { + // 若是步骤索引为0 则向企业基本信息表单赋值 this.info.form[this.calendar.key] = e.fulldate } this.closeCalendar() }, + /** + * 关闭日历 + */ closeCalendar() { this.calendar = { key: null } }, + /** + * 企业基本信息表单提交事件 + */ submitInfo() { this.$refs.infoFormRef.validate().then(async res => { this.handlerInfoApi() }) }, + /** + * 触发创建企业接口 + */ async handlerInfoApi() { const data = this.info.form data.fileIds = this.info.form.photo.map(p => p.file_id) data.userId = this.invateId let enterprise if (this.info.form.id) { + // 修改企业 } else { enterprise = await createEnterPrise(data) + //新增企业时需要将返回的id存到表单中,作为资质上传、修改的关联id this.info.form.id = enterprise.data + uni.showToast({ + icon: 'success', + title: '操作成功' + }) + // 将步骤显示到下一个 this.step.active = 1 } this.initProveList() }, + /** + * 添加资质 + */ addProve() { this.prove.isEdit = true }, + /** + * 提交资质 + */ submitProve() { this.handlerProveApi() }, + /** + * 初始化资质列表 + */ async initProveList() { this.prove.loading = true const res = await getProveList({ pageSize: -1, enterpriseId: this.info.form.id }) this.prove.list = res.data.list this.prove.loading = false }, + /** + * 触发资质新增、修改的接口 + */ async handlerProveApi() { let prove const data = this.prove.form @@ -366,14 +439,34 @@ export default { prove = await createProve(data) } this.prove.isEdit = false + uni.showToast({ + icon: 'success', + title: '操作成功' + }) + this.prove.form = { + enterpriseId: '', + id: '', + qualificationName: '', + expiryDate: '', + qualificationDescription: '', + handleDate: '', + enterpriseAuth: '' + } this.initProveList() }, + /** + * 编辑资质 + * @param {Object} prove 列表中的资质实例对象 + */ editProve(prove) { this.prove.form = prove this.prove.form.handleDate = this.$util.formatDate(prove.handleDate, 'YYYY-MM-DD') this.prove.form.expiryDate = this.$util.formatDate(prove.expiryDate, 'YYYY-MM-DD') this.prove.isEdit = true }, + /** + * 完成事件 + */ handlerDone() { uni.navigateTo({ url: '/sub/common/waiting' diff --git a/sub/owner/edit.vue b/sub/owner/edit.vue index 4682f7e..d9ff510 100644 --- a/sub/owner/edit.vue +++ b/sub/owner/edit.vue @@ -75,10 +75,12 @@ - - + + + + { - this.form.avatar = res.data + this.form.avatar = res.data.url }) }, validateForm() { @@ -210,12 +212,21 @@ export default { return true }, submit() { + uni.showLoading({ + mask: true, + title: '提交中...' + }) if (!this.validateForm()) return updateUserProfile(this.form).then(res => { - console.log(res) + uni.hideLoading() + uni.showToast({ + title: '操作成功', + icon: 'success', + duration: 500 + }) + this.init() }) }, - confirmPicker(e) { const { value } = e this.form[this.picker.key] = value[0].value @@ -235,26 +246,40 @@ export default { + diff --git a/uni_modules/s-components/s-header/index.vue b/uni_modules/s-components/s-header/index.vue index c9c1fba..8ce6332 100644 --- a/uni_modules/s-components/s-header/index.vue +++ b/uni_modules/s-components/s-header/index.vue @@ -6,7 +6,10 @@ - {{ title }} + + + {{ title }} + @@ -66,4 +69,4 @@ export default { } } } - \ No newline at end of file + diff --git a/uni_modules/s-components/s-tabber/index.vue b/uni_modules/s-components/s-tabber/index.vue index de5d4f4..33e8928 100644 --- a/uni_modules/s-components/s-tabber/index.vue +++ b/uni_modules/s-components/s-tabber/index.vue @@ -7,7 +7,12 @@ :key="index" @click="changeTab(tab)" > - + {{ tab.name }} @@ -48,6 +53,7 @@ export default { name: '', path: '/pages/chat', icon: '/static/images/tabbers/chat.png', + selectIcon: '/static/images/tabbers/chat-select.png', type: 'middle', code: 2 }, @@ -92,7 +98,7 @@ export default { box-shadow: 0 -1px 2px 1px $cs-shadow-color; } .noTab { - background-color: #fff; + // background-color: #fff; } .fit-content { height: 20px; diff --git a/utils/dict.js b/utils/dict.js index 0e10f93..71fda0e 100644 --- a/utils/dict.js +++ b/utils/dict.js @@ -4,6 +4,7 @@ * @param {Object} value */ export function echoDicValue(dict, value) { + if (!dict) return '' return dict.find(d => d.value == value).label || '' }