|
@@ -58,6 +58,7 @@
|
|
|
height: Math.random() * (260 - 180) + 180 + 'px',
|
|
|
borderRadius: '8px',
|
|
|
}"
|
|
|
+ v-if="props.value.cover_img_url"
|
|
|
>
|
|
|
<div
|
|
|
slot="placeholder"
|
|
@@ -88,9 +89,24 @@
|
|
|
</el-image>
|
|
|
<span class="name">{{ props.value.creator_name }}</span>
|
|
|
<div class="ding-box">
|
|
|
- <svg-icon icon-class="like-line" className="chat"></svg-icon>
|
|
|
+ <svg-icon
|
|
|
+ @click="handleLike(props.value)"
|
|
|
+ icon-class="like"
|
|
|
+ className="like-icon"
|
|
|
+ v-if="props.value.ding_opt === 1"
|
|
|
+ ></svg-icon>
|
|
|
+ <svg-icon
|
|
|
+ @click="handleLike(props.value)"
|
|
|
+ icon-class="like-line"
|
|
|
+ className="chat"
|
|
|
+ v-else
|
|
|
+ ></svg-icon>
|
|
|
<span>{{ props.value.ding_count }}</span>
|
|
|
- <svg-icon icon-class="chat-line" className="chat"></svg-icon>
|
|
|
+ <svg-icon
|
|
|
+ @click="lookDetail(props.value.id)"
|
|
|
+ icon-class="chat-line"
|
|
|
+ className="chat"
|
|
|
+ ></svg-icon>
|
|
|
<span>{{ props.value.comment_count }}</span>
|
|
|
</div>
|
|
|
<el-dropdown trigger="click" @command="handleChange">
|
|
@@ -113,6 +129,10 @@
|
|
|
<div slot="waterfall-over"></div>
|
|
|
</vue-waterfall-easy>
|
|
|
</div>
|
|
|
+ <div class="nodata" v-if="imgsArr.length === 0">
|
|
|
+ <img src="../../assets/nodata.png" />
|
|
|
+ <p>还没有发布内容</p>
|
|
|
+ </div>
|
|
|
<el-dialog
|
|
|
:visible.sync="publishFlag"
|
|
|
:show-close="false"
|
|
@@ -122,7 +142,11 @@
|
|
|
class="login-dialog publish-report-box"
|
|
|
v-if="publishFlag"
|
|
|
>
|
|
|
- <publish-report @closeDialog="closeDialog"></publish-report>
|
|
|
+ <publish-report
|
|
|
+ :editId="editId"
|
|
|
+ :info="reportInfo"
|
|
|
+ @closeDialog="closeDialog"
|
|
|
+ ></publish-report>
|
|
|
</el-dialog>
|
|
|
<el-dialog
|
|
|
:visible.sync="reportDetailFlag"
|
|
@@ -188,7 +212,7 @@ export default {
|
|
|
pageNumber: 1,
|
|
|
publishFlag: false, // 发布弹窗
|
|
|
searchInput: "",
|
|
|
- labelList: ["中英双语", "少儿必读", "3-6 岁"],
|
|
|
+ labelList: [],
|
|
|
labelActiveIndex: null,
|
|
|
reportDetailFlag: false,
|
|
|
reportInfo: null,
|
|
@@ -222,6 +246,7 @@ export default {
|
|
|
if (res.status === 1) {
|
|
|
this.labelList = res.tags;
|
|
|
this.imgsArr = this.imgsArr.concat(res.data.list);
|
|
|
+ if (this.imgsArr.length === 0) return;
|
|
|
if (this.pageNumber === res.data.total_page) {
|
|
|
this.$refs.waterfall.waterfallOver();
|
|
|
} else {
|
|
@@ -232,6 +257,8 @@ export default {
|
|
|
},
|
|
|
// 点击发布按钮
|
|
|
changePublist() {
|
|
|
+ this.editId = "";
|
|
|
+ this.reportInfo = null;
|
|
|
this.publishFlag = true;
|
|
|
},
|
|
|
// 点击label
|
|
@@ -248,7 +275,7 @@ export default {
|
|
|
this.getData(1);
|
|
|
},
|
|
|
// 查看详情
|
|
|
- lookDetail(id) {
|
|
|
+ lookDetail(id, flag) {
|
|
|
let MethodName = "/PaperServer/Client/Xjz/XjzArticleDetail";
|
|
|
let data = {
|
|
|
id: id,
|
|
@@ -256,21 +283,60 @@ export default {
|
|
|
getLogin(MethodName, data).then((res) => {
|
|
|
if (res.status === 1) {
|
|
|
this.reportInfo = res.data;
|
|
|
- this.reportDetailFlag = true;
|
|
|
+ if (flag) {
|
|
|
+ this.publishFlag = true;
|
|
|
+ } else {
|
|
|
+ this.reportDetailFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
closeDetail() {
|
|
|
this.reportDetailFlag = false;
|
|
|
},
|
|
|
- handleChange(com) {
|
|
|
+ async handleChange(com) {
|
|
|
const arr = com.split("&&&");
|
|
|
if (arr[0] === "edit") {
|
|
|
- console.log("edit");
|
|
|
+ await this.lookDetail(arr[1], true);
|
|
|
+ this.editId = arr[1];
|
|
|
} else {
|
|
|
- console.log("delete");
|
|
|
+ this.handleDel(arr[1]);
|
|
|
}
|
|
|
},
|
|
|
+ //删除小记者文章
|
|
|
+ handleDel(id) {
|
|
|
+ this.$confirm("确定删除吗?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ let MethodName = "/PaperServer/Client/Xjz/XjzArticleDel";
|
|
|
+ let data = {
|
|
|
+ id: id,
|
|
|
+ };
|
|
|
+ getLogin(MethodName, data).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.getData(1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 点赞/取消赞
|
|
|
+ handleLike(item) {
|
|
|
+ let MethodName = "/PaperServer/Client/Xjz/XjzArticleOptDing";
|
|
|
+ let data = {
|
|
|
+ bound_id: item.id,
|
|
|
+ ding_opt: item.ding_opt === 1 ? 0 : 1,
|
|
|
+ };
|
|
|
+ getLogin(MethodName, data).then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ item.ding_count =
|
|
|
+ item.ding_opt === 1 ? item.ding_count - 1 : item.ding_count + 1;
|
|
|
+ item.ding_opt = item.ding_opt === 1 ? 0 : 1;
|
|
|
+ this.$forceUpdate();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {},
|
|
@@ -479,21 +545,24 @@ export default {
|
|
|
text-align: left;
|
|
|
padding: 0 8px;
|
|
|
}
|
|
|
- > p {
|
|
|
- color: rgba(0, 0, 0, 0.65);
|
|
|
- font-size: 14px;
|
|
|
- font-weight: 400;
|
|
|
- line-height: 22px;
|
|
|
- word-break: break-word;
|
|
|
- display: -webkit-box;
|
|
|
- -webkit-box-orient: vertical;
|
|
|
- -webkit-line-clamp: 2;
|
|
|
- text-overflow: ellipsis;
|
|
|
- overflow: hidden;
|
|
|
- text-align: left;
|
|
|
- padding: 0 8px;
|
|
|
- margin: 0 0 8px 0;
|
|
|
+ > div {
|
|
|
+ > p {
|
|
|
+ color: rgba(0, 0, 0, 0.65);
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 22px;
|
|
|
+ word-break: break-word;
|
|
|
+ display: -webkit-box;
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
+ -webkit-line-clamp: 2;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ overflow: hidden;
|
|
|
+ text-align: left;
|
|
|
+ padding: 0 8px;
|
|
|
+ margin: 0 0 8px 0;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
.creator-info {
|
|
|
text-align: left;
|
|
|
padding: 0 8px;
|
|
@@ -520,6 +589,9 @@ export default {
|
|
|
&.chat {
|
|
|
color: rgba(0, 0, 0, 0.65);
|
|
|
}
|
|
|
+ &.like-icon {
|
|
|
+ color: #f62727;
|
|
|
+ }
|
|
|
}
|
|
|
span {
|
|
|
margin: 0 8px 0 3px;
|