py 2 роки тому
батько
коміт
8544e3c5a9
2 змінених файлів з 140 додано та 18 видалено
  1. 3 1
      api/alumni.js
  2. 137 17
      pages-my/my-publish.vue

+ 3 - 1
api/alumni.js

@@ -28,4 +28,6 @@ export const delRemark = (data) => request(newsUrl + 'del_remark', 'post', { ...
 export const alumnInfo = (data) => request(newsUrl + 'info', 'post', { ...data },false)
 
 // 自己发布的帖子
-export const alumnMyAlumni = (data) => request(newsUrl + 'my_alumni', 'post', { ...data },false)
+export const alumnMyAlumni = (data) => request(newsUrl + 'my_alumni', 'post', { ...data },false)
+// 删除帖子
+export const alumniDel = (data) => request(newsUrl + 'del', 'post', { ...data },false)

+ 137 - 17
pages-my/my-publish.vue

@@ -3,7 +3,7 @@
 		<Nav title="我的发布" titleColor="#333" bgckgroundBox='#fff'></Nav>
 		<scroll-view :scroll-y="true" class="scroll-view-css content-box box-sizing-border"
 			@scrolltolower="scrolltolower">
-			<view v-if="listData.length === 0" class="scroll-view-css">
+			<view v-if="listData.length <= 0" class="scroll-view-css">
 				<EnBlank :customSrc='true'>
 					<template v-slot:blankImg>
 						<image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
@@ -33,11 +33,11 @@
 					<view class="text-overflow-ellipsis-t fs-30 fc-3 mb-16">
 						{{item.content}}
 					</view>
-					<view class="item-img-box mb-20 align-items-center flex-wrap-wrap">
+					<!-- 	<view class="item-img-box mb-20 align-items-center flex-wrap-wrap">
 						<image class="b-rad-12" v-for="imgUrl in item.image" :src="imgUrl" mode="aspectFill"
 							:class="item.image.length==1?'item-img-one':item.image.length==2?'item-img-two':'item-img-three'">
 						</image>
-					</view>
+					</view> -->
 					<view class="align-items-center mb-40">
 						<view class="label-box align-items-center mr-20 b-rad-200 bgc-F2F2F2">
 							<image class="wz mr-8" src="@/static/img/my/wz.png" mode=""></image>
@@ -66,7 +66,7 @@
 								{{item.remark}}
 							</view>
 						</view>
-						<uni-icons color="#999999" type="trash" size="20"></uni-icons>
+						<uni-icons color="#999999" type="trash" size="20" @click.stop="alumniDelClick(item)"></uni-icons>
 					</view>
 				</view>
 			</view>
@@ -191,6 +191,10 @@
 		alumnMyAlumni,
 		setAlumniLike,
 		getRemarkList,
+		setCreateRemark,
+		alumniDel,
+		setRemarkLike,
+		delRemark
 	} from "@/api/alumni.js"
 	import tools from "@/service/tools";
 	export default {
@@ -222,6 +226,7 @@
 				},
 				isAJAX: false,
 				total: 0,
+				page: 1
 			};
 		},
 		onLoad(data) {},
@@ -231,6 +236,28 @@
 		methods: {
 			goToUrl() {
 
+			},
+			alumniDelClick(item) {
+				// 删除帖子
+				alumniDel({
+					news_id: item.news_id
+				}).then((res) => {
+					if (res.code == 1) {
+						tools.success(res.msg)
+						this.listData = []
+						this.page = 1;
+						this.alumnMyAlumni()
+					} else {
+						tools.error(res.msg)
+					}
+				})
+			},
+			// 加载更多评论
+			scrolltolowerList() {
+				if (this.remarkData.list.length < this.remarkData.total) {
+					this.remarkData.page += 1;
+					this.getMsg();
+				}
 			},
 			// 点赞
 			handUp(type, item) {
@@ -258,18 +285,72 @@
 					})
 				}
 			},
-			openInput(type,item){
-				if(type == 0){
+			// 点赞公共回复
+			handUpFun(res, item, is_like) {
+				if (res.code === 1) {
+					item.is_like = is_like;
+					if (is_like == 0) {
+						item.like -= 1
+					} else {
+						item.like += 1
+					}
+					this.isAJAX = false;
+					tools.success(res.msg);
+				} else {
+					this.isAJAX = false;
+					tools.error(res.msg);
+				}
+			},
+			openInput(type, item) {
+				if (type == 0) {
 					this.msgData.remark_id = 0;
-				}else if(type == 1){
+				} else if (type == 1) {
 					this.msgData.remark_id = item.id;
 					this.msgData.reply_id = item.m_id;
-				}else{
+				} else {
 					this.msgData.remark_id = item.remark_id;
 					this.msgData.reply_id = item.m_id;
 				}
 				this.isShowIpnut = true;
 			},
+			save() {
+				if (this.isAJAX) {
+					return
+				}
+				this.isAJAX = true;
+				setCreateRemark(this.msgData).then((res) => {
+					if (res.code == 1) {
+						tools.success('评论成功')
+						setTimeout(() => {
+							this.isAJAX = false;
+							this.closeInput()
+							if (this.msgData.remark_id == 0) {
+								this.remarkData.list = [];
+								this.remarkData.page = 1;
+								this.getMsg();
+								// this.list = [];
+								// this.fromData.page = 1;
+								this.listData = []
+								this.page = 1;
+								this.alumnMyAlumni()
+							} else {
+								this.remarkData.list = [];
+								this.remarkData.page = 1;
+								this.getMsg();
+							}
+						}, 1500)
+					} else {
+						this.isAJAX = false;
+						tools.error(res.msg)
+					}
+				})
+			},
+			closeInput() {
+				this.isShowIpnut = false;
+				this.msgData.remark_id = '';
+				this.msgData.content = '';
+				this.msgData.reply_id = '';
+			},
 			// 打开评论
 			openMsg(item) {
 				this.remarkData.news_id = item.news_id;
@@ -278,24 +359,63 @@
 				this.getMsg();
 			},
 			// 获取回复列表
-			openReply(type,item){
+			openReply(type, item) {
 				// type 1获取其他 2加载更多
-				if(this.isAJAX){
+				if (this.isAJAX) {
 					return
 				}
 				this.isAJAX = true;
-				if(type == 1){
+				if (type == 1) {
 					item.replyList = [];
 					this.replyData.page = 1;
-				}else{
+				} else {
 					this.replyData.page += 1;
 				}
-				getRemarkList({news_id:item.news_id,remark_id:item.id,page:this.replyData.page}).then((res)=>{
-					if(res.code === 1){
+				getRemarkList({
+					news_id: item.news_id,
+					remark_id: item.id,
+					page: this.replyData.page
+				}).then((res) => {
+					if (res.code === 1) {
 						this.isAJAX = false;
-						item.replyList = [...item.replyList,...res.data.items];
+						item.replyList = [...item.replyList, ...res.data.items];
 						item.isOpen = false;
-					}else{
+					} else {
+						this.isAJAX = false;
+						tools.error(res.msg)
+					}
+				})
+			},
+			closeMsg() {
+				this.$refs.popmsg.close();
+				this.remarkData.list = [];
+				this.remarkData.page = 1;
+				this.msgData.news_id = '';
+				this.remarkData.remark_id = '';
+			},
+			delInfo(item) {
+				if (this.isAJAX) {
+					return
+				}
+				this.isAJAX = true;
+				delRemark({
+					remark_id: item.id
+				}).then((res) => {
+					if (res.code === 1) {
+						tools.success('删除成功')
+						setTimeout(() => {
+							this.isAJAX = false;
+							this.remarkData.list = [];
+							this.remarkData.page = 1;
+							this.getMsg();
+							// this.list = [];
+							// this.fromData.page = 1;
+							// this.getList();
+							this.listData = []
+							this.page = 1;
+							this.alumnMyAlumni()
+						}, 1500)
+					} else {
 						this.isAJAX = false;
 						tools.error(res.msg)
 					}
@@ -338,7 +458,7 @@
 				}).then((res) => {
 					if (res.code == 1) {
 						if (res.data.items.length > 0) {
-							this.listData.push(res.data.items)
+							this.listData.push(...res.data.items)
 						}
 					}
 				})