123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <template>
- <view @touchmove.stop.prevent="moveHandle">
- <u-popup :show="show" :round="10">
- <view class="content">
- <view class="title">
- <text>共{{total}}条评论</text>
- <u-icon name="close" @click="close"></u-icon>
- </view>
- <scroll-view style="maxHeight:60vh" :scroll-y="true" :refresher-enabled="true"
- :refresher-triggered="triggered" @scrolltolower="scrolltolower" @refresherrefresh="onRefresh"
- refresher-default-style="black">
- <!-- 需要滚动的区域 -->
- <view class="commentBox" v-for="item in 10" :key="item">
- <view class="left">
- <!-- 圆形标记 -->
- <view class="comment_round"></view>
- <!-- 头像 -->
- <u-avatar :src="avatarSrc" shape="square"></u-avatar>
- </view>
- <!-- 名称、内容等 -->
- <view class="comment_detail">
- <view class="comment_info">
- <view class="name">开心小市民</view>
- <view class="likeNum">
- <i class="custom-icon custom-icon-thumb-up"></i>
- 543
- </view>
- </view>
- <view class="comment_content">我还在用果6</view>
- <view class="comment_func">
- <view>
- <text class="reply" @click="handleApply">回复></text>
- <text class="time">2分钟前</text>
- </view>
- <view class="delete">删除</view>
- </view>
- </view>
- </view>
- </scroll-view>
- <!-- 评论框 -->
- <u--input placeholder="写评论" prefixIcon="edit-pen"
- prefixIconStyle="font-size: 22px;color: #909399;margin-left:10px" border="none"
- :customStyle="{height:'80rpx',marginTop: '50rpx',backgroundColor: '#eee'}"></u--input>
- </view>
- </u-popup>
- <!-- 回复弹出组件 -->
- <Reply :show="replyShow" @close="closeReply" />
- </view>
- </template>
- <script>
- import Reply from '@/components/Reply/index.vue'
- export default {
- components: {
- Reply
- },
- props: {
- // 弹出层是否展示
- show: {
- type: Boolean,
- default: false
- },
- },
- data() {
- return {
- total: 0, // 总评论量
- triggered: false, // 下拉是否激活
- list: [], // 列表数据
- pageNum: 1,
- pageSize: 10,
- isRequesting: false, // 是否正在请求,如果是则返回,用于节流
- replyShow: false,
- avatarSrc: "http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg",
- };
- },
- methods: {
- closeReply() {
- this.replyShow = false
- },
- // 点击弹出回复框
- handleApply() {
- this.replyShow = true
- },
- // 关闭弹出框
- close() {
- this.$emit('close')
- },
- // 禁止外层容器滚动
- moveHandle() {},
- // 上拉加载
- scrolltolower() {
- if (this.list.length < this.total) {
- this.pageNum += 1;
- // 继续请求下一页,记得保留原先数组
- this.loadmore();
- } else {
- uni.showToast({
- title: "没有更多了",
- icon: "none",
- duration: 2000,
- });
- return;
- }
- },
- // 自定义下拉刷新被触发
- onRefresh() {
- // 开启下拉自定义样式
- this.triggered = true;
- // 重新调用
- this.loadmore();
- // 1秒之后复位
- setTimeout(() => {
- this.triggered = false;
- }, 1000);
- },
- scrolltolower() {
- this.loadmore();
- },
- loadmore() {
- this.request('/info/InfoContent/list', 'GET').then(res => {
- console.log("res:", res)
- if (res) {}
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .u-popup {
- .content {
- // min-height: 600rpx;
- padding: 40rpx;
- max-height: 80%;
- }
- .title {
- display: flex;
- justify-content: space-between;
- font-size: 50rpx;
- font-weight: 900;
- margin-bottom: 60rpx;
- }
- .commentBox {
- width: 100%;
- display: flex;
- color: #000;
- font-size: 32rpx;
- margin-bottom: 20rpx;
- .left {
- height: 80rpx;
- // background-color: red;
- display: flex;
- align-items: center;
- margin-right: 30rpx;
- .comment_round {
- width: 20rpx;
- height: 20rpx;
- background-color: #ff2950;
- border-radius: 50%;
- margin-right: 20rpx;
- }
- }
- .comment_detail {
- width: 100%;
- .comment_info {
- display: flex;
- justify-content: space-between;
- .name {
- font-weight: 600;
- }
- .likeNum {
- font-size: 28rpx;
- }
- .custom-icon {
- margin-right: 10rpx;
- font-size: 40rpx;
- &::before {
- background: -webkit-linear-gradient(top, #f84a1a, #ffa53e);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- font-weight: bold;
- }
- }
- }
- .comment_content {
- margin: 20rpx 0;
- color: #333;
- }
- .comment_func {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .reply {
- color: #f87f2d;
- font-size: 28rpx;
- margin-right: 10rpx;
- font-weight: 600;
- }
- .time {
- color: #999;
- font-size: 28rpx;
- }
- .delete {
- font-size: 28rpx;
- ;
- width: 100rpx;
- height: 50rpx;
- line-height: 50rpx;
- background-color: #eae8e7;
- text-align: center;
- border-radius: 50rpx;
- }
- }
- }
- }
- }
- </style>
|