提交 bdf45a8f 编写于 作者: Y yyt

布局布局

上级 ee9a115b
......@@ -15,7 +15,9 @@
</view>
</view>
<view class="school-activity-icon-wrapper">
<image class="school-activity-icon" :src="this.picture" @click.stop="showPic(this.picture)"></image>
<image class="school-activity-icon"
:style="'background: url('+this.picture+') no-repeat center/cover #eeeeee;'"
@click.stop="showPic(this.picture)"></image>
</view>
<view class="activity-production">
<image class="activity-production-icon" src="/static/discover/production.png"></image>
......
......@@ -28,7 +28,8 @@
<view v-for="activity in activityList">
<view class="one-school-activity" @click="goToDetail(activity.activityId)">
<text class="school-activity-title">{{activity.title}}</text>
<image class="school-activity-icon" :src="activity.picture" @click.stop="showPic(activity.picture)"></image>
<image class="school-activity-icon"
:style="'background: url('+activity.picture+') no-repeat center/cover #eeeeee;'"></image>
</view>
</view>
<view @click="goActivityAdd(teacherId)" class="add-activity" v-if="showButton">
......@@ -40,7 +41,8 @@
<view v-for="activity in activityList1">
<view class="one-school-activity" @click="goToDetail(activity.activityId,1)">
<text class="school-activity-title">{{activity.title}}</text>
<image class="school-activity-icon" :src="activity.picture"></image>
<image class="school-activity-icon"
:style="'background: url('+activity.picture+') no-repeat center/cover #eeeeee;'"></image>
</view>
</view>
</view>
......@@ -81,16 +83,6 @@
}
},
methods: {
// 图片放大
showPic(imgUrl) {
let arr = [];
arr.push(imgUrl)
console.log(arr, '图片的地址')
uni.previewImage({
current: 0,
urls: arr
});
},
goToDetail(activityId) {
uni.navigateTo({
url: '/pages/discover/discover-detail?activityId=' + activityId
......
......@@ -6,18 +6,15 @@
<view class="title">发布帖子</view>
<image class="add" :src="'../../static/post/send.png'" @click="addPost"></image>
</view>
<!-- 输入文字内容 -->
<view class="text-content">
<u--textarea v-model="value1" placeholder="发布运动相关的图文,分享你的运动生活" height="200px"></u--textarea>
</view>
<!-- 上传图片区域 -->
<view class="pic-content">
<uni-file-picker v-model="imageValue" file-mediatype="image" mode="grid" file-extname="png,jpg" :limit="9"
@select="select" @progress="progress" @success="success" @fail="fail" />
</view>
</view>
</template>
......@@ -32,24 +29,16 @@
img: []
}
},
methods: {
// 获取上传状态
select(e) {
},
// 获取上传进度
progress(e) {
},
// 上传成功
success(e) {
},
// 上传失败
fail(e) {
console.log('上传失败:', e)
......@@ -67,7 +56,6 @@
setTimeout(() => {
this.btnDisabled = false
}, 1000)
var length = this.imageValue.length;
for (var i = 0; i < length; i++) {
this.img.push(this.imageValue[i].path);
......@@ -100,10 +88,8 @@
}
})
}
// console.log(res.result);
});
}
}
}
}
......
......@@ -17,47 +17,40 @@
<text class="text-content">{{postDetail.content}}</text>
<view class="img-conetent">
<!-- 多张图片 -->
<!-- 多张图片 -->
<view class="one-img" v-for="img in postDetail.pictureList">
<view class="post-pic" @click.stop="showPic(img)" :style="'background: url('+img+') no-repeat center/cover #eeeeee;'"></view>
<view class="one-img" v-for="img in postDetail.pictureList">
<view class="post-pic" @click.stop="showPic(img)"
:style="'background: url('+img+') no-repeat center/cover #eeeeee;'"></view>
</view>
</view>
</view>
<!-- 点赞和评论 -->
<view class="like-and-comment">
<!-- 删除键,只有我的帖子可见该组件 -->
<text class="del" @click="delPost" v-if="userId==postDetail.ownerId">删除</text>
<view class="icon-and-num">
<image class="like-icon"
:src="postDetail.islike==1?'../../static/post/like2.png':'../../static/post/like.png'" :disabled="btnDisabled"
style="width: 20px;height:20px;float: left;" @click="changeLike" />
:src="postDetail.islike==1?'../../static/post/like2.png':'../../static/post/like.png'"
:disabled="btnDisabled" style="width: 20px;height:20px;float: left;" @click="changeLike" />
<text style="font-size: 15px;float: left;">{{postDetail.likes}}</text>
<image class="comment-icon" :src="'../../static/post/comment.png'"
style="width: 20px;height: 20px;margin-left: 10px;float: left;" @click="addComment()" />
<text style="font-size: 15px;float: left;">{{postDetail.comments}}</text>
</view>
</view>
</view>
<!-- 分隔线 -->
<view class="parting-line"></view>
<!-- 评论区 -->
<view class="comment-content">
<!-- 评论数 -->
<text class="comment-size">评论 {{postDetail.comments}}</text>
<!-- 点击进入评论 -->
<view class="comment">
<image
:src="icon"
class="icon-small" />
<image :src="icon" class="icon-small" />
<span @click="addComment" class="comment-buttun"><text
style="margin-left:8px;margin-top: 5px;float: left">写评论</text></span>
</view>
<!-- 评论内容 -->
<view v-for="(item,index) in postDetail.commentList">
<view class="one-comment">
......@@ -69,7 +62,7 @@
<text class="add-time">{{item.commentDatetime}}</text>
<view class="icon-and-num">
<image class="like-icon" :disabled="btnDisabled"
:src="item.islike==1?'../../static/post/like2.png':'../../static/post/like.png'"
:src="item.islike==1?'../../static/post/like2.png':'../../static/post/like.png'"
style="width: 16px;height:16px;" @click="changeCommentLike(index)" />
<text style="font-size: 12px;">{{item.commentLikes}}</text>
</view>
......@@ -78,27 +71,21 @@
</view>
</view>
</view>
<!-- 弹出的评论框 -->
<uni-popup ref="popup" type="dialog">
<uni-popup-dialog mode="input" message="评论成功" title="评论" placeholder="请输入内容" :duration="2000"
:before-close="true" @close="close" @confirm="confirm"></uni-popup-dialog>
</uni-popup>
<!-- 是否删除 -->
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog cancelText="取消" confirmText="确定" title="警告" content="确定删除该帖子吗?"
@confirm="dialogConfirm"></uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
btnDisabled: false,
......@@ -123,20 +110,17 @@
},
],
postDetail: [],
userId:'',
icon:'',
userId: '',
icon: '',
};
},
methods: {
onLoad(e) {
//this.from=e.from;
this.postId = e.postId;
this.userId=getApp().globalData.userId;
this.icon=getApp().globalData.icon;
this.userId = getApp().globalData.userId;
this.icon = getApp().globalData.icon;
this.getData();
},
getData() {
......@@ -185,36 +169,31 @@
console.log('点击关闭')
this.$refsalertDialog.close();
},
//发布评论
confirm(value) {
// 输入框的值
console.log(value)
if(value==''){
if (value == '') {
uni.showToast({
title: '空内容不能发布呦',
duration: 1000,
icon: 'error'
})
}
else{
} else {
uniCloud.callFunction({
name: 'fe-college-commentPost',
data: { //向云函数中传入的数据
userId: getApp().globalData.userId,
postId: this.postId,
content: value
},
})
.then(res => {
// this.postDetail = res.result.data;
this.getData();
console.log(res.result.data);
});
name: 'fe-college-commentPost',
data: { //向云函数中传入的数据
userId: getApp().globalData.userId,
postId: this.postId,
content: value
},
})
.then(res => {
this.getData();
console.log(res.result.data);
});
this.$refs.popup.close();
}
},
//评论窗口
addComment() {
......@@ -247,7 +226,6 @@
this.isLike = 1;
}
},
//点赞状态改变
changeLike() {
if (this.btnDisabled) {
......@@ -259,7 +237,6 @@
}, 1000)
//已经点赞
if (this.postDetail.islike == 1) {
// console.log(this.allPost[index].postId);
//取消点赞
uniCloud.callFunction({
name: 'fe-college-likePost',
......@@ -269,15 +246,11 @@
},
})
.then(res => {
// this.allPost=res.result.data.postList;
if (res.result.code == 200) {
this.postDetail.islike = 0;
this.postDetail.likes = res.result.data.newlikes;
}
// console.log(res.result);
});
} else {
//点赞
uniCloud.callFunction({
......@@ -288,18 +261,13 @@
},
})
.then(res => {
// this.allPost=res.result.data.postList;
if (res.result.code == 200) {
this.postDetail.islike = 1;
this.postDetail.likes = res.result.data.newlikes;
}
// console.log(res.result);
});
}
},
//改变评论的点赞状态
changeCommentLike(index) {
if (this.btnDisabled) {
......@@ -311,7 +279,6 @@
}, 1000)
//已经点赞
if (this.postDetail.commentList[index].islike == 1) {
// console.log(this.allPost[index].postId);
//取消点赞
uniCloud.callFunction({
name: 'fe-college-likeComment',
......@@ -321,16 +288,13 @@
},
})
.then(res => {
// this.allPost=res.result.data.postList;
if (res.result.code == 200) {
this.postDetail.commentList[index].islike = 0;
console.log(res.result);
this.postDetail.commentList[index].commentLikes = res.result.data.newlikes;
}
console.log(res.result);
});
} else {
//点赞
uniCloud.callFunction({
......@@ -341,18 +305,13 @@
},
})
.then(res => {
// this.allPost=res.result.data.postList;
if (res.result.code == 200) {
this.postDetail.commentList[index].islike = 1;
this.postDetail.commentList[index].commentLikes = res.result.data.newlikes;
}
// console.log(res.result);
});
}
}
}
}
</script>
......@@ -381,7 +340,6 @@
height: 25px;
border-radius: 15px;
font-size: 12px;
}
.top {
......
<template>
<view>
<!-- 添加帖子按钮 -->
<add-post-tag></add-post-tag>
<!-- 标签栏 -->
<u-tabs :list="list" lineWidth="30" lineColor="#F1992D" :activeStyle="{
color: '#F1992D',
......@@ -14,7 +12,6 @@
transform: 'scale(1)'
}" itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;" @click="tabChange" :current="current">
</u-tabs>
<!-- 所有帖子 -->
<view v-if="current == 1">
<view v-for="(item,index) in allPost" :key="index">
......@@ -30,34 +27,32 @@
<view class="img-conetent">
<!-- 多张图片 -->
<view v-if="item.pictureList.length!=1" class="one-img" v-for="img in item.pictureList">
<view class="post-pic" @click.stop="showPic(img)" :style="'background: url('+img+') no-repeat center/cover #eeeeee;'"></view>
<view class="post-pic" @click.stop="showPic(img)"
:style="'background: url('+img+') no-repeat center/cover #eeeeee;'"></view>
</view>
<!-- 单张图片 -->
<view v-if="item.pictureList.length == 1" class="single-pic" @click.stop="showPic(item.pictureList[0])"
:style="'background: url('+item.pictureList[0]+') no-repeat center/cover #eeeeee;'" >
<view v-if="item.pictureList.length == 1" class="single-pic"
@click.stop="showPic(item.pictureList[0])"
:style="'background: url('+item.pictureList[0]+') no-repeat center/cover #eeeeee;'">
</view>
</view>
</view>
<!-- 点赞和评论 -->
<view class="like-and-comment">
<view class="icon-and-num">
<image class="like-icon"
:src="item.islike=='1'?'../../static/post/like2.png':'../../static/post/like.png'"
style="width: 20px;height:20px;float: left;" @click.stop="changeAllPostLike(index)" :disabled="btnDisabled" />
style="width: 20px;height:20px;float: left;" @click.stop="changeAllPostLike(index)"
:disabled="btnDisabled" />
<text style="font-size: 15px;float: left;">{{item.likes}}</text>
<image class="comment-icon" :src="'../../static/post/comment.png'"
style="width: 20px;height: 20px;margin-left: 10px;float: left;" />
<text style="font-size: 15px;float: left; ">{{item.comments}}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 我的帖子 -->
<view v-if="current == 0">
<!-- 单个帖子 -->
......@@ -74,21 +69,23 @@
<view class="img-conetent">
<!-- 多张图片 -->
<view v-if="item.pictureList.length!=1" class="one-img" v-for="img in item.pictureList">
<view class="post-pic" @click.stop="showPic(img)" :style="'background: url('+img+') no-repeat center/cover #eeeeee;'"></view>
<view class="post-pic" @click.stop="showPic(img)"
:style="'background: url('+img+') no-repeat center/cover #eeeeee;'"></view>
</view>
<!-- 单张图片 -->
<view v-if="item.pictureList.length == 1" class="single-pic" @click.stop="showPic(item.pictureList[0])"
:style="'background: url('+item.pictureList[0]+') no-repeat center/cover #eeeeee;'" >
<view v-if="item.pictureList.length == 1" class="single-pic"
@click.stop="showPic(item.pictureList[0])"
:style="'background: url('+item.pictureList[0]+') no-repeat center/cover #eeeeee;'">
</view>
</view>
</view>
<!-- 点赞和评论 -->
<view class="like-and-comment">
<view class="icon-and-num">
<image class="like-icon"
:src="item.islike=='1'?'../../static/post/like2.png':'../../static/post/like.png'"
style="width: 20px;height:20px;float: left;" @click.stop="changeMyPostLike(index)" :disabled="btnDisabled" />
style="width: 20px;height:20px;float: left;" @click.stop="changeMyPostLike(index)"
:disabled="btnDisabled" />
<text style="font-size: 15px;float: left;">{{item.likes}}</text>
<image class="comment-icon" :src="'../../static/post/comment.png'"
style="width: 20px;height: 20px;margin-left: 10px;float: left;" />
......@@ -104,18 +101,15 @@
<script>
export default {
onPullDownRefresh() {
this.getAllPost();
this.getMyPost();
uni.stopPullDownRefresh();
},
onLoad() {
this.getAllPost();
this.getMyPost();
},
onShow() {
this.getAllPost();
this.getMyPost();
......@@ -141,14 +135,10 @@
isLike: 1,
comment: 120,
pictureList: [{
picture: "https://mp-6f6feaec-a026-4402-8e8d-18f7572890da.cdn.bspapp.com/cloudstorage/becea65c-89d7-4fe0-9c3f-2e08cdf911e8.jpg"
},
],
picture: "https://mp-6f6feaec-a026-4402-8e8d-18f7572890da.cdn.bspapp.com/cloudstorage/becea65c-89d7-4fe0-9c3f-2e08cdf911e8.jpg"
}, ],
};
},
methods: {
toDetial(postId) {
uni.navigateTo({
......@@ -157,21 +147,13 @@
},
tabChange(index) {
this.current = index.index;
//console.log(this.current)
// this.followUserPost = [];
// this.lastPost = [];
if (index.index == 0) {
this.getMyPost();
}
if (index.index == 1) {
this.getAllPost();
}
},
//获得所有的帖子信息
getAllPost() {
//获得所有帖子
......@@ -186,10 +168,8 @@
//console.log(res.result.data);
});
},
//获得我的帖子
getMyPost() {
uniCloud.callFunction({
name: 'fe-college-myPostList',
data: { //向云函数中传入的数据
......@@ -201,7 +181,6 @@
console.log(res.result.data);
});
},
// 图片放大
showPic(imgUrl) {
let arr = [];
......@@ -212,7 +191,6 @@
urls: arr
});
},
//点赞状态改变
changeAllPostLike(index) {
if (this.btnDisabled) {
......@@ -224,7 +202,6 @@
}, 1000)
//已经点赞
if (this.allPost[index].islike == 1) {
// console.log(this.allPost[index].postId);
//取消点赞
uniCloud.callFunction({
name: 'fe-college-likePost',
......@@ -234,14 +211,11 @@
},
})
.then(res => {
// this.allPost=res.result.data.postList;
if (res.result.code == 200) {
this.allPost[index].islike = 0;
this.allPost[index].likes = res.result.data.newlikes;
}
// console.log(res.result);
});
} else {
//点赞
uniCloud.callFunction({
......@@ -252,18 +226,13 @@
},
})
.then(res => {
// this.allPost=res.result.data.postList;
if (res.result.code == 200) {
this.allPost[index].islike = 1;
this.allPost[index].likes = res.result.data.newlikes;
}
// console.log(res.result);
});
}
},
//点赞状态改变
changeMyPostLike(index) {
if (this.btnDisabled) {
......@@ -275,7 +244,6 @@
}, 1000)
//已经点赞
if (this.myPost[index].islike == 1) {
// console.log(this.allPost[index].postId);
//取消点赞
uniCloud.callFunction({
name: 'fe-college-likePost',
......@@ -285,14 +253,11 @@
},
})
.then(res => {
// this.allPost=res.result.data.postList;
if (res.result.code == 200) {
this.myPost[index].islike = 0;
this.myPost[index].likes = res.result.data.newlikes;
}
// console.log(res.result);
});
} else {
//点赞
uniCloud.callFunction({
......@@ -303,16 +268,13 @@
},
})
.then(res => {
// this.allPost=res.result.data.postList;
if (res.result.code == 200) {
this.myPost[index].islike = 1;
this.myPost[index].likes = res.result.data.newlikes;
}
// console.log(res.result);
});
}
}
}
}
</script>
......@@ -335,7 +297,6 @@
margin-top: 15px;
float: left;
overflow: auto;
}
.icon {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册