feat(期刊): 细化期刊功能

dev
zjb 8 months ago
parent e0fb15e66d
commit 40b00e0698

@ -48,13 +48,23 @@ export default {
});
},
/**
* 创建人
* @returns
* 更新
* @param {*} id
* @param {*} data
* @returns
*/
createrList() {
update(id, data) {
return request({
url: `/luoo-music/cms/journal/${id}`,
method: "put",
data: data
});
},
add(data) {
return request({
url: "/tag/tag/creator/list",
method: "get"
url: `/luoo-music/cms/journal/add`,
method: "post",
data: data
});
}
};

@ -0,0 +1,15 @@
/*
* @Description:
* @version: v1
* @Author: zhangjiabao
* @Date: 2024-01-19 23:38:16
*/
import request from "@/utils/request";
export default {
getList(volid) {
return request({
url: `/luoo-comment/comment/findByVolid/${volid}`,
method: "get"
});
}
};

@ -100,5 +100,11 @@ export default {
url: "/luoo-tag/tag/name",
method: "get"
});
},
queryHierarchical() {
return request({
url: "/luoo-tag/tag/hierarchical",
method: "get"
});
}
};

@ -16,13 +16,17 @@
<span>VOL.{{ data.number }} {{ data.name }}</span>
</el-form-item>
<el-form-item prop="tag" label="期刊标签">
<span v-for="item in data.tag" :key="item + ''">{{ item }}</span>
<span>{{ getTagNameById(data.tag) }}</span>
</el-form-item>
<el-form-item prop="author" label="期刊作者">
<span>{{ data.userId }}</span>
<el-form-item prop="userId" label="期刊作者">
<span>{{ getAuthorNameById(data.userId) }}</span>
</el-form-item>
<el-form-item prop="image" label="上传封面">
<span>封面</span>
<el-form-item prop="image" label="期刊封面">
<img
style="width: 170px;height: 120px;"
v-if="data.coverPhoto"
:src="data.coverPhoto"
/>
</el-form-item>
<el-form-item label="期刊音乐"></el-form-item>
</el-form>
@ -38,7 +42,15 @@
element-loading-text="加载中"
:header-cell-style="{ background: '#f5f7fa', color: '#606266' }"
>
<el-table-column prop="picture" label="专辑封面"></el-table-column>
<el-table-column prop="picture" label="专辑封面" width="100px">
<template slot-scope="slot">
<img
style="width: 50;height: 50px;"
v-if="slot.row.picture"
:src="slot.row.picture"
/>
</template>
</el-table-column>
<el-table-column prop="name" label="歌曲名称"></el-table-column>
<el-table-column prop="artist" label="歌手/乐队"></el-table-column>
<el-table-column prop="album" label="所属专辑"></el-table-column>
@ -53,11 +65,35 @@
<el-form-item label="期刊文案">
<span>{{ data.summary }}</span>
</el-form-item>
<el-form-item label="评论记录">
<el-card
style="margin-top: 5px;background-color: rgba(249, 249, 249, 0.4980392156862745);"
shadow="hover"
v-for="c in commentList"
:key="c['_id']"
>
<span
style="font-family:'微软雅黑', sans-serif;font-weight:400;font-size:14px;color:#666666;"
>{{ c["nickname"] }}</span
>
<span
style="font-family:'微软雅黑', sans-serif;font-weight:400;font-size:12px;color:#999999;"
>{{ c["publishtime"] }}</span
>
<span style="float: right;"
><i class="el-icon-thumb"></i><span>{{ c["thumbup"] }}</span></span
>
<br />
<span class="comment">{{ c["content"] }}</span>
</el-card>
</el-form-item>
</el-form>
</div>
</template>
<script>
import commentApi from "@/api/comment";
export default {
name: "ArticleDetail",
props: {
@ -76,15 +112,112 @@ export default {
remoteTagList: {
type: Array,
default: []
},
publisher: {
type: Array,
default: []
}
},
data() {
return {};
return {
commentList: []
};
},
filters: {},
created() {},
created() {
this.fetchComment();
},
components: {},
mounted() {},
methods: {}
methods: {
fetchComment() {
// this.$message.success(this.data.number)
// commentApi.getList(this.data.number).then(res => {
// console.log(res)
// })
let res = {
code: 0,
data: [
{
_id: "1",
articleid: "",
comment: 0,
content: "wowowowowowow",
nickname: "nickname1",
parentid: "",
publishtime: "2023-01-01",
share: 0,
state: "",
thumbup: 333,
userid: "123",
visits: 0
},
{
_id: "2",
articleid: "",
comment: 0,
content: "ninininininin",
nickname: "nickname2",
parentid: "",
publishtime: "2023-01-01",
share: 0,
state: "",
thumbup: 12,
userid: "123",
visits: 0
}
],
message: ""
};
this.commentList = res.data;
},
// ************************* *************************
getAuthorNameById(userId) {
for (let index in this.publisher) {
let item = this.publisher[index];
if (item.id === userId) {
return item.name;
}
return "";
}
},
getTagNameById(tagIdList) {
let tagList = [];
for (let tagIdIndex in tagIdList) {
let tagId = tagIdList[tagIdIndex];
for (let index in this.remoteTagList) {
let item = this.remoteTagList[index];
if (item.value === tagId) {
tagList.push(item.label);
}
if (!item.children) {
continue;
}
for (let subIndex in item.children) {
let subItem = item.children[subIndex];
if (subItem.value === tagId) {
tagList.push(subItem.label);
}
}
}
}
let name = "";
for (let index in tagList) {
name = name + "#" + tagList[index] + " ";
}
return name;
}
}
};
</script>
<style scoped>
.comment {
font-family: "微软雅黑", sans-serif;
font-weight: 400;
font-style: normal;
color: #999999;
text-align: left;
line-height: 22px;
}
</style>

@ -7,19 +7,22 @@
<template>
<div>
<el-form
ref="modifyDialogForm"
:model="data"
:rules="rules"
style="width: 800px;margin: 0 auto;"
label-position="left"
label-suffix=":"
label-width="100px"
>
<el-form-item prop="volid" label="期刊编号">
<el-form-item prop="number" label="期刊编号">
<el-input
v-model="data.number"
size="small"
placeholder="期刊编号"
></el-input>
</el-form-item>
<el-form-item prop="title" label="期刊标题">
<el-form-item prop="name" label="期刊标题">
<el-input
v-model="data.name"
size="small"
@ -31,19 +34,28 @@
placeholder="请选择"
:options="remoteTagList"
:props="{ multiple: true }"
size="small"
v-model="selectTag"
@change="handleTagSelectChange"
filterable
></el-cascader>
</el-form-item>
<el-form-item prop="author" label="期刊作者">
<el-input
v-model="data.userId"
size="small"
placeholder="不填写则默认为发布者"
></el-input>
<el-form-item prop="userId" label="期刊作者">
<el-select placeholder="选择发布人" size="small" v-model="data.userId">
<el-option
v-for="item in publisher"
:label="item.name"
:value="item.id"
:key="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item prop="image" label="上传封面">
<el-form-item prop="coverPhoto" label="上传封面">
<img
style="width: 170px;height: 120px;"
v-if="data.coverPhoto"
:src="data.coverPhoto"
/>
<el-upload
action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview"
@ -65,22 +77,18 @@
</div>
</el-upload>
</el-form-item>
<el-form-item label="期刊音乐">
<el-form-item label="期刊音乐" prop="songs">
<el-row>
<el-col :span="6"
><el-button plain size="middle" type="primary" icon="el-icon-plus"
<el-col :span="4"
><el-button plain size="small" type="primary" icon="el-icon-plus"
>上传歌曲</el-button
></el-col
>
<el-col :span="6"
><el-button
plain
size="middle"
type="primary"
icon="el-icon-zoom-in"
<el-col :span="4"
><el-button plain size="small" type="primary" icon="el-icon-zoom-in"
>曲库添加</el-button
></el-col
>
>
</el-col>
</el-row>
</el-form-item>
</el-form>
@ -101,12 +109,20 @@
<i class="el-icon-rank"></i>
</template>
</el-table-column>
<el-table-column prop="picture" label="专辑封面"></el-table-column>
<el-table-column prop="picture" label="专辑封面" width="100px">
<template slot-scope="slot">
<img
style="width: 50;height: 50px;"
v-if="slot.row.picture"
:src="slot.row.picture"
/>
</template>
</el-table-column>
<el-table-column prop="name" label="歌曲名称"></el-table-column>
<el-table-column prop="artist" label="歌手/乐队"></el-table-column>
<el-table-column prop="album" label="所属专辑"></el-table-column>
<el-table-column prop="duration" label="时长"></el-table-column>
<el-table-column label="操作" fixed="right" width="300">
<el-table-column label="操作" width="300">
<template slot-scope="scope">
<el-button plain icon="el-icon-edit" type="primary" size="mini"
>编辑</el-button
@ -202,6 +218,10 @@ export default {
remoteTagList: {
type: Array,
default: []
},
publisher: {
type: Array,
default: []
}
},
data() {
@ -221,7 +241,20 @@ export default {
// size: 500, // Kb, 1M = 1024Kb
// accept: 'multipart/form-data, image/png, image/gif, image/jpeg, image/bmp, image/x-icon,image/jpg' //
editorOption: {},
rules: {}
rules: {
number: [
{ required: true, message: "请输入期刊编号", trigger: "blur" }
],
name: [{ required: true, message: "请输入期刊标题", trigger: "blur" }],
tag: [{ required: true, message: "请选择期刊标签", trigger: "change" }],
userId: [
{ required: true, message: "请选择期刊作者", trigger: "blur" }
],
coverPhoto: [
{ required: true, message: "请上传封面", trigger: "change" }
],
songs: [{ required: true, message: "请选择音乐", trigger: "change" }]
}
};
},
filters: {},

@ -124,12 +124,16 @@
</el-table-column>
<el-table-column label="期刊编号">
<template slot-scope="scope">
<span>VOL</span>
<span>VOL.</span>
<span>{{ scope.row.number }}</span>
</template>
</el-table-column>
<el-table-column label="期刊标题" prop="name"></el-table-column>
<el-table-column label="风格标签" prop="tag"></el-table-column>
<el-table-column label="风格标签">
<template slot-scope="scope">
<span>{{ getTagNameById(scope.row.tag) }}</span>
</template>
</el-table-column>
<el-table-column label="歌曲数" prop="songCount"></el-table-column>
<el-table-column
label="播放次数"
@ -141,7 +145,11 @@
prop="commentCount"
v-if="activateTab === 1"
></el-table-column>
<el-table-column label="期刊作者" prop="userId"></el-table-column>
<el-table-column label="期刊作者">
<template slot-scope="scope">
<span>{{ getAuthorNameById(scope.row.userId) }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime"></el-table-column>
<el-table-column
label="待发布时间"
@ -188,8 +196,8 @@
v-model="scope.row.state"
active-color="#13ce66"
@change="handleTableRowStatusChange($event, scope.row)"
:active-value="1"
:inactive-value="0"
:active-value="'1'"
:inactive-value="'0'"
></el-switch>
</template>
</el-table-column>
@ -217,12 +225,32 @@
top="60px"
:before-close="handleModifyDialogBeforeClose"
>
<div style="height: 70vh;overflow: auto;padding-left:20px;padding-right:20px">
<ArticleModify v-if="modifyDialog.visible && (modifyDialog.type===0 || modifyDialog.type===1)" :data="modifyDialog.data" :remoteTagList="queryForm.remoteData.superFilterTags"></ArticleModify>
<ArticleDetail v-if="modifyDialog.visible && (modifyDialog.type===2)" :data="modifyDialog.data" :remoteTagList="queryForm.remoteData.superFilterTags"></ArticleDetail>
<div
style="height: 70vh;overflow: auto;padding-left:20px;padding-right:20px"
>
<ArticleModify
ref="modifyDialog"
v-if="
modifyDialog.visible &&
(modifyDialog.type === 0 || modifyDialog.type === 1)
"
:data="modifyDialog.data"
:remoteTagList="queryForm.remoteData.superFilterTags"
:publisher="queryForm.remoteData.publisher"
></ArticleModify>
<ArticleDetail
v-if="modifyDialog.visible && modifyDialog.type === 2"
:data="modifyDialog.data"
:remoteTagList="queryForm.remoteData.superFilterTags"
:publisher="queryForm.remoteData.publisher"
></ArticleDetail>
</div>
<span slot="footer" class="dialog-footer">
<el-button v-if="(modifyDialog.type===0 || modifyDialog.type===1)" size="small" type="primary" @click="handleDialogSubmit"
<el-button
v-if="modifyDialog.type === 0 || modifyDialog.type === 1"
size="small"
type="primary"
@click="handleDialogSubmit"
>确定</el-button
>
<el-button size="small" @click="handleDialogCancel"></el-button>
@ -245,9 +273,10 @@
<script>
import articleApi from "@/api/article";
import tagApi from "@/api/tag";
import SuperFilterTagDrawer from "./superFilterTagDrawer.vue";
import ArticleModify from "./articleModify.vue";
import ArticleDetail from "./articleDetail.vue"
import ArticleDetail from "./articleDetail.vue";
export default {
name: "Article",
@ -350,11 +379,11 @@ export default {
rows: [
{
commentCount: 0,
coverPhoto: "coverPhoto",
coverPhoto: "https://luoow.wxwenku.com/999/cover_min.jpg",
createTime: "2023-01-01",
id: "1",
name: "期刊名称",
number: "1001",
number: "742",
playCount: 1,
pubTime: "2023-01-01",
songCount: 1,
@ -367,7 +396,7 @@ export default {
journal: [1, 2, 3],
lyric: "lllll llll lll",
name: "双节棍",
picture: "/pic/pic",
picture: "https://luoow.wxwenku.com/999/cover_min.jpg",
size: "1.3m",
state: "1",
tags: [3, 5, 11],
@ -380,55 +409,108 @@ export default {
status: "1",
summary: "领军 \n 灵精了",
tag: [3, 5, 11],
userId: "1"
userId: "1627863701048659968"
}
],
total: 0
},
message: ""
};
this.table.data = res.data.rows;
this.table.page.total = res.data.total;
this.table.loading = false;
setTimeout(() => {
this.table.data = res.data.rows;
this.table.page.total = res.data.total;
this.table.loading = false;
}, 1000);
},
/**
* 创建人下拉框
*/
fetchCreaterList() {
// articleApi.createrList().then(res => {
// if (res.code === 200) {
// this.queryForm.remoteData.publisher = res.data;
// }
// });
this.queryForm.remoteData.publisher = [
{ id: 1, name: "落在低处" },
{ id: 2, name: "左岸以西" }
];
tagApi.createrList().then(res => {
if (res.code === 200) {
this.queryForm.remoteData.publisher = res.data;
} else {
this.queryForm.remoteData.publisher = [];
}
});
},
/**
* 高级筛选tag
*/
fetchSuperFilterTags() {
this.queryForm.remoteData.superFilterTags = [
// tagApi.queryHierarchical().then(res => {
// console.log(res)
// })
let res = [
{
value: 1,
label: "语言类型",
id: 1,
nameCh: "语言类型",
children: [
{ value: 3, label: "中文" },
{ value: 4, label: "日文" },
{ value: 5, label: "英文" }
{ id: 3, nameCh: "中文" },
{ id: 4, nameCh: "日文" },
{ id: 5, nameCh: "英文" }
]
},
{
value: 10,
label: "期刊标签",
id: 10,
nameCh: "期刊标签",
children: [
{ value: 11, label: "民谣" },
{ value: 12, label: "摇滚" }
{ id: 11, nameCh: "民谣" },
{ id: 12, nameCh: "摇滚" }
]
}
];
let newList = [];
for (let index in res) {
let item = res[index];
let newItem = { value: item.id, label: item.nameCh, children: [] };
for (let childrenIndex in item.children) {
let childrenItem = item.children[childrenIndex];
newItem.children.push({
value: childrenItem.id,
label: childrenItem.nameCh
});
}
newList.push(newItem);
}
this.queryForm.remoteData.superFilterTags = newList;
},
// ************************* *************************
getAuthorNameById(userId) {
for (let index in this.queryForm.remoteData.publisher) {
let item = this.queryForm.remoteData.publisher[index];
if (item.id === userId) {
return item.name;
}
return "";
}
},
getTagNameById(tagIdList) {
let tagList = [];
for (let tagIdIndex in tagIdList) {
let tagId = tagIdList[tagIdIndex];
for (let index in this.queryForm.remoteData.superFilterTags) {
let item = this.queryForm.remoteData.superFilterTags[index];
if (item.value === tagId) {
tagList.push(item.label);
}
if (!item.children) {
continue;
}
for (let subIndex in item.children) {
let subItem = item.children[subIndex];
if (subItem.value === tagId) {
tagList.push(subItem.label);
}
}
}
}
let name = "";
for (let index in tagList) {
name = name + "#" + tagList[index] + " ";
}
return name;
},
// ************************* *************************
/**
@ -461,9 +543,9 @@ export default {
* 高级筛选中的查询按钮
*/
handleSuperFilterTagQuery(val) {
let tags = []
for(let i in val) {
tags.push(val[i].value)
let tags = [];
for (let i in val) {
tags.push(val[i].value);
}
let queryParam = {
name: null,
@ -546,53 +628,47 @@ export default {
* 弹窗确定按扭点击事件
*/
handleDialogSubmit() {
this.$refs.modifyDialogForm.validate(valid => {
debugger;
this.$refs.modifyDialog.$refs.modifyDialogForm.validate(valid => {
if (valid) {
//
if (this.modifyDialog.type === 0) {
// tagApi.create(this.modifyDialog.form.data).then(res => {
// if (res.code === 200) {
// this.$message.success(res.message);
// this.modifyDialog.visible = false;
// this.table.page.current = 1;
// //
// this.handleResetClick();
// this.fetchData(this.queryForm.data);
// } else {
// this.$message.error(res.message);
// }
// });
this.$message.success("新增");
console.log(this.$refs.modifyDialog.data);
articleApi.add(this.$refs.modifyDialog.data).then(res => {
if (res.code === 200) {
this.$message.success(res.message);
this.modifyDialog.visible = false;
this.table.page.current = 1;
//
this.handleResetClick();
this.fetchData(this.queryForm.lastQuery);
} else {
this.$message.error(res.message);
}
});
console.log("编辑");
return;
}
//
if (this.modifyDialog.type === 1) {
// tagApi.update(this.modifyDialog.form.data).then(res => {
// if (res.code === 200) {
// this.$message.success(res.message);
// this.modifyDialog.visible = false;
// this.fetchData(this.queryForm.lastQuery);
// } else {
// this.$message.error(res.message);
// }
// });
this.$message.success("编辑");
return;
}
//
if (this.modifyDialog.type === 2) {
// tagApi.create(this.modifyDialog.form.data).then(res => {
// if (res.code === 200) {
// this.$message.success(res.message);
// this.modifyDialog.visible = false;
// this.fetchData(this.queryForm.lastQuery);
// } else {
// this.$message.error(res.message);
// }
// });
this.$message.success("详情");
console.log(this.$refs.modifyDialog.data);
articleApi
.update(
this.$refs.modifyDialog.data.id,
this.$refs.modifyDialog.data
)
.then(res => {
if (res.code === 200) {
this.$message.success(res.message);
this.modifyDialog.visible = false;
this.fetchData(this.queryForm.lastQuery);
} else {
this.$message.error(res.message);
}
});
console.log("编辑");
return;
}
} else {

Loading…
Cancel
Save