|
@@ -5,32 +5,31 @@
|
|
|
<!-- 过滤条件栏目 -->
|
|
|
<div>
|
|
|
<div class="filter-condition-box">
|
|
|
- <span>所属类别:</span>
|
|
|
+ <span>文章类型:</span>
|
|
|
<ul>
|
|
|
<li
|
|
|
:class="{
|
|
|
- checkedExamQuestionType:
|
|
|
- checkedExamQuestionType === item.code,
|
|
|
+ checkedExamQuestionType: articleArticleType === item.id,
|
|
|
}"
|
|
|
- v-for="(item, index) in examQuestionType"
|
|
|
+ v-for="(item, index) in articleTypeList"
|
|
|
:key="index"
|
|
|
- @click="handleExamQuestionTypeFun(item)"
|
|
|
+ @click="handleArticleTypeParent(item)"
|
|
|
>
|
|
|
{{ item.name }}
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<div class="filter-condition-box a-card-margin-top">
|
|
|
- <span>所属类型:</span>
|
|
|
+ <span>所属子类:</span>
|
|
|
<ul>
|
|
|
<li
|
|
|
:class="{
|
|
|
checkedExamQuestionType:
|
|
|
- checkedExamQuestionTypeCondition === item.code,
|
|
|
+ checkedArticleTypeChildren === item.id,
|
|
|
}"
|
|
|
- v-for="(item, index) in examQuestionTypeCondition"
|
|
|
+ v-for="(item, index) in articleTypeChildrenList"
|
|
|
:key="index"
|
|
|
- @click="handleExamQuestionTypeConditionFun(item)"
|
|
|
+ @click="handleArticleTypeChildren(item)"
|
|
|
>
|
|
|
{{ item.name }}
|
|
|
</li>
|
|
@@ -47,7 +46,7 @@
|
|
|
<a-select-option
|
|
|
v-for="(item, index) in engineeringWorkList"
|
|
|
:key="index"
|
|
|
- :value="item.code"
|
|
|
+ :value="item.id"
|
|
|
>{{ item.name }}</a-select-option
|
|
|
>
|
|
|
</a-select>
|
|
@@ -74,26 +73,26 @@
|
|
|
<!-- 收藏 -->
|
|
|
<div class="article-list-item-info-label">
|
|
|
<icon-font type="ali-icon-shoucang-" />
|
|
|
- <span class="article-list-item-info-labeltxt">{{
|
|
|
- item.collectCount
|
|
|
- }}</span>
|
|
|
+ <span class="article-list-item-info-labeltxt">
|
|
|
+ {{ item.likesCount || 0 }}
|
|
|
+ </span>
|
|
|
</div>
|
|
|
<div class="article-list-item-info-line"></div>
|
|
|
- <!-- 点赞 -->
|
|
|
+ <!-- 阅读 -->
|
|
|
<div class="article-list-item-info-label">
|
|
|
- <icon-font type="ali-icon-dianzan" />
|
|
|
- <span class="article-list-item-info-labeltxt">{{
|
|
|
- item.likeCount
|
|
|
- }}</span>
|
|
|
+ <icon-font type="ali-icon-yuedu" />
|
|
|
+ <span class="article-list-item-info-labeltxt">
|
|
|
+ {{ item.readerCount || 0 }}
|
|
|
+ </span>
|
|
|
</div>
|
|
|
- <div class="article-list-item-info-line"></div>
|
|
|
+ <!-- <div class="article-list-item-info-line"></div> -->
|
|
|
<!-- 评论 -->
|
|
|
- <div class="article-list-item-info-label">
|
|
|
+ <!-- <div class="article-list-item-info-label">
|
|
|
<icon-font type="ali-icon-yipinglun" />
|
|
|
- <span class="article-list-item-info-labeltxt">{{
|
|
|
- item.commentCount
|
|
|
- }}</span>
|
|
|
- </div>
|
|
|
+ <span class="article-list-item-info-labeltxt">
|
|
|
+ {{ item.readerCount || 0 }}
|
|
|
+ </span>
|
|
|
+ </div> -->
|
|
|
<!-- 工种 -->
|
|
|
<div class="article-list-item-info-engineeringWork">
|
|
|
{{ item.engineeringWork | formateEngineeringWorkTypeFun }}
|
|
@@ -123,12 +122,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {
|
|
|
- ENGINEERING_WORK_LIST,
|
|
|
- EXAM_QUESTION_TYPE,
|
|
|
- EXAM_QUESTION_TYPE_CONDITION,
|
|
|
-} from '@/common/Constant';
|
|
|
-import { ARTICLELIST } from '@/common/resData';
|
|
|
+import { mapGetters } from 'vuex';
|
|
|
+import { formatePathParams } from '@/filters';
|
|
|
export default {
|
|
|
name: 'articleCreate',
|
|
|
props: {},
|
|
@@ -136,10 +131,10 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false, // 是否展示加载动画
|
|
|
- examQuestionType: [], // 试题类别列表
|
|
|
- checkedExamQuestionType: '', // 所选试题类别
|
|
|
- examQuestionTypeCondition: [], // 试题类型列表
|
|
|
- checkedExamQuestionTypeCondition: '', // 所选试题类型
|
|
|
+ articleTypeList: [], // 文章类型列表
|
|
|
+ articleArticleType: '', // 所选文章类型
|
|
|
+ articleTypeChildrenList: [], // 所属子类
|
|
|
+ checkedArticleTypeChildren: '', // 所选试题类型
|
|
|
engineeringWorkList: [], // 工种数据列表
|
|
|
engineeringWorkChooseValue: '', // 所选工种
|
|
|
articleList: [], // 文章列表数据
|
|
@@ -156,102 +151,142 @@ export default {
|
|
|
mounted() {},
|
|
|
beforeDestroy() {},
|
|
|
watch: {},
|
|
|
- computed: {},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters([
|
|
|
+ 'screenHeight',
|
|
|
+ 'GET_ENGINEERING_WORK_LIST',
|
|
|
+ 'GET_EXAM_QUESTION_TYPE_CONDITION_PARENT',
|
|
|
+ ]),
|
|
|
+ },
|
|
|
methods: {
|
|
|
//初始化数据
|
|
|
initDataFun() {
|
|
|
- // 试题类别
|
|
|
- this.examQuestionType = [
|
|
|
- { name: '全部', code: '' },
|
|
|
- ...EXAM_QUESTION_TYPE,
|
|
|
- ];
|
|
|
- this.checkedExamQuestionType = this.examQuestionType[0].code;
|
|
|
- // 试题类型
|
|
|
- this.examQuestionTypeCondition = [
|
|
|
- { name: '全部', code: '' },
|
|
|
- ...EXAM_QUESTION_TYPE_CONDITION,
|
|
|
- ];
|
|
|
- this.checkedExamQuestionTypeCondition = this.examQuestionTypeCondition[0].code;
|
|
|
+ this.getArticleTypeFun(); // 查询:文章分类-父类
|
|
|
// 工种类别
|
|
|
this.engineeringWorkList = [
|
|
|
- { name: '全部', code: '' },
|
|
|
- ...ENGINEERING_WORK_LIST,
|
|
|
+ { name: '全部', id: '' },
|
|
|
+ ...this.GET_ENGINEERING_WORK_LIST,
|
|
|
];
|
|
|
- this.engineeringWorkChooseValue = this.engineeringWorkList[0].code;
|
|
|
- this.getArticleListFun();
|
|
|
+ this.engineeringWorkChooseValue = this.engineeringWorkList[0].id;
|
|
|
+ this.getArticleListFun(); // 查询:文章列表数据
|
|
|
+ },
|
|
|
+ // 查询:文章分类-父类
|
|
|
+ getArticleTypeFun() {
|
|
|
+ this.$_http.get(this.$_API.INTERFACE_GET_CATEGORIES).then((res) => {
|
|
|
+ this.articleTypeList = [{ name: '全部', id: '' }, ...res.data];
|
|
|
+ this.articleArticleType = this.articleTypeList[0].id;
|
|
|
+ this.articleTypeChildrenList = [{ name: '全部', id: '' }];
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 查询:文章分类-子类
|
|
|
+ getArticleTypeChildrenFun() {
|
|
|
+ if (!this.articleArticleType) {
|
|
|
+ this.articleTypeChildrenList = [{ name: '全部', id: '' }];
|
|
|
+ this.checkedArticleTypeChildren = this.articleTypeChildrenList[0].id;
|
|
|
+ this.initPagination(); // 初始化分页参数
|
|
|
+ this.getArticleListFun(); // 查询:文章列表数据
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let params = { categoryId: this.articleArticleType };
|
|
|
+ this.$_http
|
|
|
+ .get(
|
|
|
+ formatePathParams(
|
|
|
+ this.$_API.INTERFACE_GET_CATEGORIES_CATEGROYID,
|
|
|
+ params
|
|
|
+ )
|
|
|
+ )
|
|
|
+ .then((res) => {
|
|
|
+ this.articleTypeChildrenList = [
|
|
|
+ { name: '全部', id: '' },
|
|
|
+ ...res.data,
|
|
|
+ ];
|
|
|
+ this.checkedArticleTypeChildren = this.articleTypeChildrenList[0].id;
|
|
|
+ this.loading = false;
|
|
|
+ this.initPagination(); // 初始化分页参数
|
|
|
+ this.getArticleListFun(); // 查询:文章列表数据
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
},
|
|
|
// 查询:文章列表数据
|
|
|
getArticleListFun() {
|
|
|
this.loading = true;
|
|
|
- this.articleList = ARTICLELIST.data;
|
|
|
- this.pagination.total = this.articleList.length;
|
|
|
- setTimeout(() => {
|
|
|
- this.loading = false;
|
|
|
- }, 1500);
|
|
|
- // let params = {
|
|
|
- // questionType: this.checkedExamQuestionType,
|
|
|
- // questionTypeCondition: this.checkedExamQuestionTypeCondition,
|
|
|
- // engineeringWork: this.engineeringWorkChooseValue,
|
|
|
- // page: this.pagination.current,
|
|
|
- // size: this.pagination.pageSize,
|
|
|
- // };
|
|
|
- // this.$_http
|
|
|
- // .get(this.$_API.INTERFACE_GET_ARTICLE_LIST, { params })
|
|
|
- // .then((res) => {
|
|
|
- // console.log(res);
|
|
|
- // this.articleList = res.data;
|
|
|
- // this.pagination.total = res.pagination.total;
|
|
|
- // this.loading = false;
|
|
|
- // })
|
|
|
- // .catch((err) => {
|
|
|
- // console.log(err);
|
|
|
- // this.loading = false;
|
|
|
- // });
|
|
|
+ let params = {
|
|
|
+ categoryId: this.articleArticleType, // 文章类型-父类ID
|
|
|
+ categoryIdChildren: this.checkedArticleTypeChildren, // 文章类型-子类ID
|
|
|
+ engineerType: this.engineeringWorkChooseValue, // 工种ID
|
|
|
+ page: this.pagination.current - 1,
|
|
|
+ size: this.pagination.pageSize,
|
|
|
+ };
|
|
|
+ this.$_http
|
|
|
+ .get(this.$_API.INTERFACE_GET_ARTICLE_LIST, { params })
|
|
|
+ .then((res) => {
|
|
|
+ this.articleList = res.data.content;
|
|
|
+ this.pagination.total = res.data.totalElements;
|
|
|
+ this.loading = false;
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
},
|
|
|
- // 操作:选择某个试题类别
|
|
|
- handleExamQuestionTypeFun(item) {
|
|
|
- if (this.checkedExamQuestionType === item.code) {
|
|
|
+ // 操作:选择某个文章类型-父类
|
|
|
+ handleArticleTypeParent(item) {
|
|
|
+ if (this.articleArticleType === item.id) {
|
|
|
return;
|
|
|
}
|
|
|
- this.checkedExamQuestionType = item.code;
|
|
|
- this.getArticleListFun(); // 查询:文章列表数据
|
|
|
+ this.articleArticleType = item.id;
|
|
|
+ this.getArticleTypeChildrenFun(); // 查询:文章分类-子类
|
|
|
},
|
|
|
- // 操作:选择某个试题类型
|
|
|
- handleExamQuestionTypeConditionFun(item) {
|
|
|
- if (this.checkedExamQuestionTypeCondition === item.code) {
|
|
|
+ // 初始化分页参数
|
|
|
+ initPagination() {
|
|
|
+ this.pagination.current = 1;
|
|
|
+ this.pagination.pageSize = 7;
|
|
|
+ this.pagination.total = 0;
|
|
|
+ },
|
|
|
+ // 操作:选择某个文章类型-子类
|
|
|
+ handleArticleTypeChildren(item) {
|
|
|
+ if (this.checkedArticleTypeChildren === item.id) {
|
|
|
return;
|
|
|
}
|
|
|
- this.checkedExamQuestionTypeCondition = item.code;
|
|
|
+ this.checkedArticleTypeChildren = item.id;
|
|
|
+ this.initPagination(); // 初始化分页参数
|
|
|
this.getArticleListFun(); // 查询:文章列表数据
|
|
|
},
|
|
|
// 操作:选择了某个工种
|
|
|
handleChangeEngineeringWorkValue() {
|
|
|
+ this.initPagination(); // 初始化分页参数
|
|
|
this.getArticleListFun(); // 查询:文章列表数据
|
|
|
},
|
|
|
// 操作:删除文章
|
|
|
handleDeleteArticleItem(item) {
|
|
|
- console.log('点击了删除文章', item);
|
|
|
- // let that = this;
|
|
|
+ let that = this;
|
|
|
this.$confirm({
|
|
|
title: '删除文章',
|
|
|
- content: `确认删除文章(${item.name})吗?`,
|
|
|
+ content: `确认删除文章 ${item.name} 吗?`,
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk() {
|
|
|
- // this.loading = true;
|
|
|
- // let params = {
|
|
|
- // id: item.id,
|
|
|
- // };
|
|
|
- // that.$_http
|
|
|
- // .post(that.$_API.INTERFACE_POST_ARTICLE_DELETE, params)
|
|
|
- // .then((res) => {
|
|
|
- // console.log(res);
|
|
|
- // this.loading = false;
|
|
|
- // })
|
|
|
- // .catch((err) => {
|
|
|
- // console.log(err);
|
|
|
- // this.loading = false;
|
|
|
- // });
|
|
|
+ that.loading = true;
|
|
|
+ let params = {
|
|
|
+ materialId: item.id,
|
|
|
+ };
|
|
|
+ that.$_http
|
|
|
+ .delete(
|
|
|
+ formatePathParams(
|
|
|
+ that.$_API.INTERFACE_POST_ARTICLE_DELETE,
|
|
|
+ params
|
|
|
+ )
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ that.$message.success('删除文章成功');
|
|
|
+ that.loading = false;
|
|
|
+ this.initPagination(); // 初始化分页参数
|
|
|
+ this.getArticleListFun(); // 查询:文章列表数据
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ that.loading = false;
|
|
|
+ });
|
|
|
},
|
|
|
onCancel() {},
|
|
|
});
|
|
@@ -319,6 +354,8 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .articleArticleType {
|
|
|
+ }
|
|
|
.article-list-item-paddingTop {
|
|
|
padding-top: @paddingMarginVal;
|
|
|
}
|