diff --git a/src/api/index.js b/src/api/index.js index 229d331..ff32b19 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,13 +1,13 @@ import Setting from '@/setting' -const { huoranApi, apiBaseURL: host } = Setting +const { apiBaseURL: host } = Setting export default { logins: `/iasf/sys/user/login`, verification: `${host}/iasf/sys/getVerify`, upload: `${host}/iasf/sysFiles/upload`, - courseDiscipline: `${huoranApi}/nakadai/nakadai/subject/courseDiscipline`, - courseProfessionalClass: `${huoranApi}/nakadai/nakadai/subject/courseProfessionalClass`, - courseProfessional: `${huoranApi}/nakadai/nakadai/subject/courseProfessional`, + courseDiscipline: `/iasf/subject/courseDiscipline`, + courseProfessionalClass: `/iasf/subject/courseProfessionalClass`, + courseProfessional: `/iasf/subject/courseProfessional`, listByPage: `/iasf/sysFiles/listByPage`, delFile: `/iasf/sysFiles/delete`, updateFile: `/iasf/sysFiles/update`, diff --git a/src/pages/article/add/index.vue b/src/pages/article/add/index.vue index f0c4b8a..f689bf8 100644 --- a/src/pages/article/add/index.vue +++ b/src/pages/article/add/index.vue @@ -839,6 +839,7 @@ export default { data.map(e => { result.find(n => n.style === e.style) || result.push(e) }) + result.pop() // 不显示产品、课程详情,产品课程详情在/add/product里添加 this.detailStyle = result }).catch(err => { }) }, diff --git a/src/pages/article/add/product.vue b/src/pages/article/add/product.vue index fdef88b..92f4a10 100644 --- a/src/pages/article/add/product.vue +++ b/src/pages/article/add/product.vue @@ -67,7 +67,7 @@ + :value="item.professionalId"> @@ -305,8 +305,8 @@ export default { ]), getModelData: { get () { - const data = this.classifications.find(item => item.id === this.form.classificationTagId) - return data ? data.id : '' + const data = this.classifications.find(item => item.categoryId === this.form.classificationTagId) + return data ? data.categoryId : '' }, set (newVal) { this.form.classificationTagId = newVal @@ -368,26 +368,33 @@ export default { name: this.$route.query.id ? '编辑' : '新增' } ]) - this.form.id ? this.getData() : this.getColumn() + this.form.id && this.getData() this.getSubject() + this.getClassification() this.getLabel() - // this.getTemplate() }, methods: { // 获取文章详情 getData () { this.$post(`${this.api.productDetailsFind}?id=${this.form.id}`).then(({ data }) => { data.categoryId = data.categoryId ? data.categoryId.split(',').map(e => +e) : [] + if (data.classificationTagId) data.classificationTagId = +data.classificationTagId this.originalName = data.name - let lableData = [] - data.categoryId.forEach(item => { - this.categories.forEach(options => { - if (item == options.id) { - lableData.push(item) - } - }) + // let lableData = [] + // data.categoryId.forEach(item => { + // this.categories.forEach(options => { + // if (item == options.id) { + // lableData.push(item) + // } + // }) + // }) + // data.categoryId = lableData + this.getColumn() + data.subjectSpecialtyList && data.subjectSpecialtyList.map(e => { + e.subjectCategoryId !== 1 && this.getProfessionalClassData(e) + e.professionalCategoryId !== 1 && this.getProfessionalData(e) }) - data.categoryId = lableData + console.log("🚀 ~ this.$post ~ data:", data) this.form = data }).catch(err => { }) }, @@ -401,7 +408,6 @@ export default { form.articleTemplate = (data.typeId === 1 || data.typeId === 4) ? data.detailStyleId : 78 } - this.getClassification() this.$nextTick(() => { this.updateTime = 0 }) @@ -427,8 +433,8 @@ export default { }, // 获取学科类别 async getSubject () { - const { list } = await this.$get(this.api.courseDiscipline) - this.subjectList = list + const { data } = await this.$get(this.api.courseDiscipline) + this.subjectList = data this.form.subjectSpecialtyList.forEach(e => { e.subjectCategoryId === 1 && this.getProfessionalClass(e) }) @@ -444,10 +450,10 @@ export default { this.getProfessionalClassData(item) }, async getProfessionalClassData (item) { - const { list } = await this.$get(this.api.courseProfessionalClass, { + const { data } = await this.$get(this.api.courseProfessionalClass, { disciplineId: item.subjectCategoryId }) - item.professionalClassList = list + this.$set(item, 'professionalClassList', data) this.form.subjectSpecialtyList.forEach(e => { e.professionalCategoryId === 1 && this.getProfessional(e) }) @@ -462,33 +468,23 @@ export default { this.getProfessionalData(item) }, async getProfessionalData (item) { - const { list } = await this.$get(this.api.courseProfessional, { + const { data } = await this.$get(this.api.courseProfessional, { professionalClassId: item.professionalCategoryId }) - item.professionalList = list + this.$set(item, 'professionalList', data) }, - // 获取所有模板 - getTemplate () { - this.$post(this.api.individualTemplateDetailsStyle).then(({ data }) => { - const result = [] - data.map(e => { - result.find(n => n.style === e.style) || result.push(e) - }) - this.detailStyle = result - }).catch(err => { }) - }, - // 获取所属分类 + // 获取分类 getClassification () { this.$post(`${this.api.categoryList}?siteId=${this.site.id}&type=0`).then(({ data }) => { this.classifications = data }).catch(err => { }) }, - // 显示所属分类弹框 + // 显示分类弹框 setClass () { this.classVisible = true }, - // 新增所属分类 + // 新增分类 addClass () { this.classifications.push({ edit: true, @@ -496,11 +492,11 @@ export default { name: '' }) }, - // 编辑所属分类 + // 编辑分类 editClass (row) { this.$set(row, 'edit', 1) }, - // 删除所属分类 + // 删除分类 delClass (row, i) { if (row.categoryId) { this.$confirm('确定要删除吗?', '提示', { @@ -515,7 +511,7 @@ export default { this.classifications.splice(i, 1) } }, - // 提交所属分类 + // 提交分类 submitClass (row, showMsg = 1) { if (!row.name) return Util.errorMsg('请输入分类') // this.$post(`${this.api.checkClassif}?name=${row.name}&siteId=${this.site.id}&classificationTagId=${row.id}`).then(res => { @@ -558,11 +554,11 @@ export default { this.categories = data }).catch(err => { }) }, - // 显示标签弹框 + // 显示类型 setLabel () { this.labelVisible = true }, - // 新增标签 + // 新增类型 addLabel () { this.categories.push({ edit: true, @@ -570,11 +566,11 @@ export default { name: '' }) }, - // 编辑标签 + // 编辑类型 editLabel (row) { this.$set(row, 'edit', 1) }, - // 删除标签 + // 删除类型 delLabel (row, i) { if (row.categoryId) { this.$confirm('确定要删除吗?', '提示', { @@ -589,7 +585,7 @@ export default { this.categories.splice(i, 1) } }, - // 提交标签 + // 提交类型 submitLabel (row, showMsg = 1) { if (!row.name) return Util.errorMsg('请输入类型') // this.$post(`${this.api.checkLabel}?name=${row.name}&siteId=${this.site.id}&labelId=${row.id}`).then(res => { @@ -606,7 +602,7 @@ export default { }).catch(res => { }) // }).catch(res => { }) }, - // 关闭所属分类 + // 关闭类型 closeLabel () { const list = this.categories if (list.find(e => e.edit && e.name)) { @@ -791,7 +787,6 @@ export default { delete e.professionalClassList delete e.professionalList }) - form.publishStatus = publishStatus this.submiting = true form.editorId = +this.$store.state.user.userId diff --git a/src/pages/article/list/index.vue b/src/pages/article/list/index.vue index b580ab7..b967f1e 100644 --- a/src/pages/article/list/index.vue +++ b/src/pages/article/list/index.vue @@ -387,7 +387,7 @@ export default { if (!this.columns.length) return util.errorMsg('请添加栏目') const node = this.$refs.column.getCurrentNode() this.setColumn(node) - this.$router.push(`${this.isCourseProduct ? 'addProduct' : 'add'}?columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`) + this.$router.push(`${node.templateId === 12 || node.listStyleId === 73 ? 'addProduct' : 'add'}?columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`) }, // 排序回调 sortChange (column) {