zpj před 2 roky
rodič
revize
0ad3ca50b3

+ 6 - 1
api/alumni.js

@@ -8,4 +8,9 @@ export const setAlumniLike = (data) => request(newsUrl + 'like', 'post', { ...da
 
 
 // 获取评论列表
-export const getRemarkList = (data) => request(newsUrl + 'remark_list', 'post', { ...data },false)
+export const getRemarkList = (data) => request(newsUrl + 'remark_list', 'post', { ...data },false)
+
+// 新增&编辑帖子
+export const alumniSave = (data) => request(newsUrl + 'save', 'post', { ...data },false)
+// 举报帖子
+export const alumniReport = (data) => request(newsUrl + 'report', 'post', { ...data },false)

+ 12 - 5
pages-address/select-school.vue

@@ -88,7 +88,7 @@
 				this.leftShow = false;
 			}else{
 				this.leftShow = true;
-				if(this.type == 1){
+				if(this.indexType == 1){
 					this.schoolData.school_name = school_name;
 				}else{
 					this.schoolData.school_name = circleSchoolId?circleSchoolName:school_name;
@@ -123,11 +123,18 @@
 			},
 			
 			selectSchool(item){
-				uni.setStorageSync('school_id',item.school_id);
-				uni.setStorageSync('operate_id',item.operate_id);
-				uni.setStorageSync('school_name',item.school_name);
+				if(this.indexType == 2){
+					uni.setStorageSync('circleSchoolId',item.school_id);
+					uni.setStorageSync('circleSchoolName',item.school_name);
+				}else{
+					uni.setStorageSync('school_id',item.school_id);
+					uni.setStorageSync('operate_id',item.operate_id);
+					uni.setStorageSync('school_name',item.school_name);
+				}
+				
+				
 				if(this.leftShow){
-					if(type == 1){
+					if(this.indexType == 1){
 						uni.switchTab({
 							url:'/pages/index/index'
 						})

+ 98 - 7
pages-school/add-circle.vue

@@ -5,25 +5,43 @@
 		<view class="scroll-view-css box-border-box ptp-24">
 			<view class="bgc-f box-border-box p-32">
 				<view class="fs-34 fw-600 mb-20">内容描述 <span class='fs-34 fc-9 fw-400'>(必填)</span></view>
-				<textarea class=" fs-24" placeholder='这一刻说些什么'></textarea>
+				<textarea v-model="fromData.content" class=" fs-24" :maxlength='500' placeholder='这一刻说些什么'></textarea>
 			</view>
 			<view class="bgc-f mb-20">
-				<EnUpload></EnUpload>
+				<EnUpload v-model="fromData.image" ></EnUpload>
 			</view>
 			
-			<view class="bgc-f box-border-box p-32 flex-justify-space align-items-center">
-				<view class="fs-34 fw-600">分享交流</view>
+			<view class="bgc-f box-border-box p-32 flex-justify-space align-items-center" @click="openPop()">
+				<view class="fs-34 fw-600">{{typeName}}</view>
 				<image class="right-icon" src="@/static/img/toRight.png" mode=""></image>
 			</view>
 		</view>
 		
-		<view class="box-border-box p-32">
-			<view class="b-bottom text-align-center fs-32 fw-600">发布</view>
+		<view class="box-border-box p-32" @click="save()">
+			<view class="b-bottom text-align-center fs-32 fw-600 fc-f">发布</view>
 		</view>
+		
+		
+		<uni-popup ref="popup" type="bottom">
+			<view class="pop-box box-border-box p-24">
+				<view class="head-pop flex-justify-space align-items-center mb-24">
+					<uni-icons @click.stop="closePop(1)" type="closeempty" size="24"></uni-icons>
+					<view class="fs-36 fc-0 fw-600">选发布类型</view>
+					<view class="fs-28 fw-600 fc-41ABF5" @click.stop="closePop(2)">确定</view>
+				</view>
+				<view class="scroll-view-css">
+					<view class="item-box fs-32 " :class="fromData.topic_id==item.id?'fc-41ABF5 bgc-D5EDFB':'bgc-F3F4F6'" 
+					v-for="(item,i) in classList" :key="i" @click="selectPopAddEditType(item)">{{item.name}}</view>
+				</view>
+			</view>
+		</uni-popup>
 	</view>
 </template>
 
 <script>
+	import {getTopic} from '@/api/category.js';
+	import {alumniSave} from '@/api/alumni.js';
+	import tools from '@/service/tools';
 	import EnUpload from '@/components/en-from/en-upload/en-upload.vue';
 	export default {
 		components:{EnUpload},
@@ -36,13 +54,65 @@
 					school_id:'',
 					topic_id:'',
 				},
+				isAJAX:false,
+				classList:[],
+				typeName:'请选择发布类型',
 			}
 		},
 		onLoad(e) {
-			
+			if(e.news_id){
+				this.fromData.news_id = e.news_id;
+			}else{
+				this.fromData.news_id = '';
+			}
 		},
 		methods:{
+			selectPopAddEditType(item){
+				if(this.fromData.topic_id != item.id){
+					this.fromData.topic_id = item.id;
+					this.typeName = item.name;
+				}
+			},
+			openPop(){
+				getTopic().then((res)=>{
+					if(res.code === 1){
+						this.classList = res.data;
+						this.$refs.popup.open();
+					}
+				})
+			},
+			closePop(type){
+				if(type === 1){
+					this.fromData.topic_id = '';
+					this.typeName = '请选择发布类型';
+				}
+				this.$refs.popup.close();
+			},
 			
+			save(){
+				
+				if(this.isAJAX){
+					return
+				}
+				this.isAJAX = true;
+				let circleSchoolId = uni.getStorageSync('circleSchoolId');
+				let school_id = uni.getStorageSync('school_id');
+				this.fromData.school_id = circleSchoolId?circleSchoolId:school_id;
+				alumniSave(this.fromData).then((res)=>{
+					if(res.code === 1){
+						tools.success(res.mag)
+						setTimeout(()=>{
+							this.isAJAX = false;
+							uni.reLaunch({
+								url:'/pages-school/school-circle'
+							})
+						},1500)
+					}else{
+						tools.error(res.mag)
+						this.isAJAX = false;
+					}
+				})
+			},
 		}
 	}
 </script>
@@ -60,5 +130,26 @@
 			width: 32rpx;
 			height: 32rpx;
 		}
+		.head-pop{
+			padding-bottom: 34rpx !important;
+			border-bottom: 1rpx solid #F2F2F2;
+		}
+		.pop-box{
+			width: 100%;
+			height: 50vh;
+			background-color: #fff;
+			border-radius: 24rpx 24rpx 0rpx 0rpx;
+			display: flex;
+			flex-direction: column;
+			.item-box{
+				width: 100%;
+				height: 92rpx;
+				
+				border-radius: 200rpx;
+				line-height: 92rpx;
+				text-align: center;
+				margin-bottom: 24rpx;
+			}
+		}
 	}
 </style>

+ 101 - 24
pages-school/school-circle.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="school-circle iPhone-bottom flex-common-css box-border-box ">
-		<image class="circle-add" src="@/static/img/school/add.png" mode="" @click="openPop()"></image>
+		<image class="circle-add" src="@/static/img/school/add.png" mode="" @click="add()"></image>
 
 		<view class="bg-box"></view>
 		
@@ -46,7 +46,7 @@
 		</view>
 		
 		<scroll-view v-else scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
-			<view class="card-box box-border-box p-24 bgc-f flex-justify-space" v-for="(item,i) in list" :key="i" @click.stop="toDet()">
+			<view class="card-box box-border-box p-24 bgc-f flex-justify-space" v-for="(item,i) in list" :key="i" @click.stop="toDet(item)">
 				<image class="card-head" :src="item.head_img" mode="scaleToFill"></image>
 				<view class="flex-1">
 					<view class="card-1 flex-justify-space mb-16">
@@ -55,7 +55,7 @@
 							<view class="fs-24 fc-9">{{item.created_date}}</view>
 						</view>
 						<view class="">
-							<image class="dian-img" src="@/static/img/school/dian.png" mode=""></image>
+							<image @click.stop="openRepot(item)" class="dian-img" src="@/static/img/school/dian.png" mode=""></image>
 							<view class="align-items-center">
 								<image class="hot-img" src="@/static/img/school/hot.png" mode=""></image>
 								<view class="fs-26 fw-400 fc-9">{{item.heat}}</view>
@@ -74,7 +74,7 @@
 					</view>
 					
 					<view class="card-5 flex-justify-space">
-						<view class="align-items-center">
+						<view class="align-items-center" @click.stop="share()">
 							<image src="@/static/img/school/fx.png" mode=""></image>
 							<view class="fs-24 fc-9">分享</view>
 						</view>
@@ -92,16 +92,25 @@
 		</scroll-view>
 		
 		
+		
+		<uni-popup ref="popshare" type="bottom">
+			<view class="pop-box pop-h-20 box-border-box p-24">
+				<view @click.stop="shareSelect(0)" class="b-bottom text-align-center fs-32 fw-600 fc-f mb-20">分享到群聊</view>
+				<view @click.stop="shareSelect(1)" class="b-bottom text-align-center fs-32 fw-600 fc-f">分享到朋友圈</view>
+			</view>
+		</uni-popup>
+		
 		<uni-popup ref="popup" type="bottom">
-			<view class="pop-box box-border-box p-24">
+			<view class="pop-box pop-h-30 box-border-box p-24">
 				<view class="head-pop flex-justify-space align-items-center mb-24">
-					<uni-icons @click.stop="closePop()" type="closeempty" size="24"></uni-icons>
-					<view class="fs-36 fc-0 fw-600">选发布类型</view>
-					<view class="fs-28 fw-600 fc-41ABF5" @click.stop="add()">确定</view>
+					<uni-icons @click.stop="closePop(1)" type="closeempty" size="24"></uni-icons>
+					<view class="fs-36 fc-0 fw-600">请输入举报内容</view>
+					<view class="fs-28 fw-600 fc-41ABF5">确定</view>
 				</view>
 				<view class="scroll-view-css">
-					<view class="item-box fs-32 " :class="id==i?'fc-41ABF5 bgc-D5EDFB':'bgc-F3F4F6'" v-for="(item,i) in classListPop" :key="i">{{item.name}}</view>
+					<textarea style="height: 100%;" v-model="reportData.content" class=" fs-24" :maxlength='50' placeholder='请输入举报内容'></textarea>
 				</view>
+				<view @click.stop="closePop(2)" class="b-bottom text-align-center fs-32 fw-600 fc-f">确认举报</view>
 			</view>
 		</uni-popup>
 		
@@ -178,7 +187,7 @@
 
 <script>
 	import EnBlank from "@/components/en-utils/en-blank/en-blank";
-	import {getAlumniList,setAlumniLike,getRemarkList} from '@/api/alumni.js';
+	import {getAlumniList,setAlumniLike,getRemarkList,alumniReport} from '@/api/alumni.js';
 	import {getTopic} from '@/api/category.js';
 	import tools from '@/service/tools';
 	
@@ -186,11 +195,9 @@
 		components:{EnBlank},
 		data(){
 			return{
-				id:0,
 				isShowIpnut:false,
 				
 				classList:[],
-				classListPop:[],
 				
 				total:0,
 				list:[],
@@ -211,6 +218,11 @@
 				schoolData:{
 					school_name:'',
 				},
+				
+				reportData:{
+					news_id:'',
+					content:'',
+				},
 			}
 		},
 		onShow(){
@@ -238,7 +250,6 @@
 			getTopic(){
 				getTopic().then((res)=>{
 					if(res.code === 1){
-						this.classListPop = JSON.parse(JSON.stringify(res.data));
 						this.classList = res.data;
 						this.classList.unshift({name:'全部贴子',id:0});
 					}
@@ -289,6 +300,11 @@
 				setAlumniLike({news_id:item.news_id,is_like:is_like}).then((res)=>{
 					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{
@@ -313,27 +329,72 @@
 					}
 				})
 			},
-			
-			
-			
-			toDet(){
+			add(){
 				uni.navigateTo({
-					url:"/pages-school/circle-info"
+					url:"/pages-school/add-circle"
 				})
 			},
-			openPop(){
+			openRepot(item){
+				this.reportData.news_id = item.news_id;
 				this.$refs.popup.open();
 			},
-			closePop(){
-				this.$refs.popup.close();
+			closePop(type){
+				if(type === 1){
+					this.reportData.news_id = '';
+					this.reportData.content = '';
+					this.$refs.popup.close();
+				}else{
+					if(this.isAJAX){
+						return
+					}
+					this.isAJAX = true;
+					alumniReport(this.reportData).then((res)=>{
+						if(res.code === 1){
+							tools.success(res.msg)
+							setTimeout(()=>{
+								this.isAJAX = false;
+								this.closePop(1);
+							},1000)
+						}else{
+							tools.success(res.msg);
+							this.isAJAX = false;;
+						}
+					})
+				}
+			},
+			share(){
+				this.$refs.popshare.open();
 			},
-			add(item){
+			shareSelect(type){
+				let pages = getCurrentPages();
+				let currentPage = pages[pages.length - 1];
+				let url = currentPage.route || currentPage.$route.path;
+				uni.share({
+					provider: "weixin",
+					scene: "WXSceneTimeline",
+					type: type,
+					href: url,
+					title: "君子校友",
+					summary: "我正在使用君子校友小程序,邀请您一起体验",
+					imageUrl: "https://sjz-school.oss-cn-chengdu.aliyuncs.com/logo.png",
+					success:(res)=>{
+						tools.success('分享成功')
+						this.$refs.popshare.close();
+					},
+					fail:(err)=>{
+						tools.error('分享失败')
+						this.$refs.popshare.close();
+					}
+				});
+			},
+			
+			
+			toDet(item){
 				uni.navigateTo({
-					url:"/pages-school/add-circle?topic_id=" + this.fromData.topic_id + '&news_id=' + item.news_id
+					url:"/pages-school/circle-info?news_id=" + item.news_id
 				})
 			},
 			
-			
 			closeMsg(){
 				this.$refs.popmsg.close();
 			},
@@ -351,11 +412,27 @@
 </script>
 
 <style scoped lang="scss">
+	.b-bottom{
+		width: 100%;
+		height: 88rpx;
+		line-height: 88rpx;
+		background: linear-gradient( 105deg, #57CAFF 0%, #41ABF5 100%);
+		border-radius: 200rpx;
+	}
+	
 	.school-circle{
 		padding-left: 24rpx;
 		padding-right: 24rpx;
 		position: relative;
 		
+		
+		.pop-h-20{
+			height: 18vh !important;
+		}
+		
+		.pop-h-30{
+			height: 30vh !important;
+		}
 		.pop-box{
 			
 			width: 100%;