| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <template>
- <u-popup :show="showTask" @close="handleClose" @open="handleOpen" round="32rpx" bgColor="#ffffff" zIndex="10077">
- <view class="content">
- <!-- 头部 -->
- <view class="header">
- <view class="row bg">
- <image class="w40 h40" src="/static/images/answer_icon.png"></image>
- <image class="w428 h64" src="/static/images/collecting_coins_title.png"></image>
- <image class="w40 h40" src="/static/images/pop_close_icon.png" @click="showTask=false"></image>
- </view>
- <!-- 积分信息 -->
- <view class="row mtb48 plr24">
- <view class="points row">
- <text class="lable">我的积分</text>
- <text class="num">3688</text>
- </view>
- <view class="shop row">
- <image class="w48 h48" src="/static/images/fanghua_coin_icon.png"></image>
- <text class="shop-txt">芳华币商城</text>
- <image class="w24 h24" src="/static/images/coin_arrow.png"></image>
- </view>
- </view>
- </view>
- <!-- 可滚动列表区域 -->
- <scroll-view scroll-y class="list" :style="{ height: scrollHeight + 'px' }" @scroll="handleScroll">
- <!-- 列表项 - 这里应该用 v-for 循环,简化代码 -->
- <view v-for="(item, index) in taskList" :key="index" class="list-item">
- <view class="row">
- <view class="left">
- <image class="w88 h88 mr24" src="/static/images/img.png"></image>
- <view>
- <view class="mb8 row">
- <text class="title">{{ item.title }}({{ item.current }}/{{ item.total }})</text>
- <image class="w40 h40 mr4 ml8" src="/static/images/fanghua_coin_icon.png"></image>
- <text class="num">+{{ item.points }}</text>
- </view>
- <view class="txt">{{ item.desc }}</view>
- </view>
- </view>
- <view class="button" @click="handleTaskClick(item)">
- {{ item.buttonText }}
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </u-popup>
- </template>
- <script>
- export default {
- data() {
- return {
- showTask: true,
- scrollHeight: 400, // 根据实际情况调整
- taskList: [{
- title: '点赞内容',
- current: 0,
- total: 1,
- points: 1,
- desc: '最多1条得芳华币',
- buttonText: '去完成'
- }, {
- title: '点赞内容',
- current: 0,
- total: 1,
- points: 1,
- desc: '最多1条得芳华币',
- buttonText: '去完成'
- }, {
- title: '点赞内容',
- current: 0,
- total: 1,
- points: 1,
- desc: '最多1条得芳华币',
- buttonText: '去完成'
- }, {
- title: '点赞内容',
- current: 0,
- total: 1,
- points: 1,
- desc: '最多1条得芳华币',
- buttonText: '去完成'
- }, {
- title: '点赞内容',
- current: 0,
- total: 1,
- points: 1,
- desc: '最多1条得芳华币',
- buttonText: '去完成'
- }, {
- title: '点赞内容',
- current: 0,
- total: 1,
- points: 1,
- desc: '最多1条得芳华币',
- buttonText: '去完成'
- }, {
- title: '点赞内容',
- current: 0,
- total: 1,
- points: 1,
- desc: '最多1条得芳华币',
- buttonText: '去完成'
- }, {
- title: '点赞内容',
- current: 0,
- total: 1,
- points: 1,
- desc: '最多1条得芳华币',
- buttonText: '去完成'
- }, {
- title: '点赞内容',
- current: 0,
- total: 1,
- points: 1,
- desc: '最多1条得芳华币',
- buttonText: '去完成'
- }, {
- title: '点赞内容',
- current: 0,
- total: 1,
- points: 1,
- desc: '最多1条得芳华币',
- buttonText: '去完成'
- },
- ]
- }
- },
- mounted() {
- this.calcScrollHeight();
- },
- methods: {
- handleScroll(event) {
- // 更新当前滚动位置
- this.scrollTop = event.detail.scrollTop;
- // 判断是否显示返回顶部按钮
- this.showBackTop = this.scrollTop > 300;
- // 判断是否滚动到底部(需要加载更多)
- if (!this.loadingMore && this.hasMore) {
- const {
- scrollHeight
- } = event.detail;
- const scrollViewHeight = this.scrollHeight; // scroll-view 的高度
- // 距离底部50rpx时触发加载
- if (scrollHeight - this.scrollTop - scrollViewHeight < 50) {
- this.loadMoreData();
- }
- }
- },
- async loadMoreData() {
- if (this.loadingMore || !this.hasMore) return;
- this.loadingMore = true;
- try {
- // 调用API加载更多数据
- const newData = await this.fetchMoreTasks();
- if (newData.length > 0) {
- this.taskList.push(...newData);
- } else {
- this.hasMore = false;
- }
- } catch (error) {
- console.error('加载失败:', error);
- } finally {
- this.loadingMore = false;
- }
- },
- calcScrollHeight() {
- // 计算屏幕可用高度
- const systemInfo = uni.getSystemInfoSync();
- // 根据实际情况计算,这里减去头部高度
- this.scrollHeight = systemInfo.windowHeight * 0.6; // 示例值
- },
-
- handleTaskClick(item) {
- console.log('点击任务:', item);
- // 处理任务点击逻辑
- },
- handleClose() {
- console.log("关闭")
- // 关闭弹窗
- },
- handleOpen() {
- // 打开弹窗
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content {
- height: 1000rpx;
- background: #FFFFFF;
- border-radius: 32rpx 32rpx 0rpx 0rpx;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- .bg {
- padding: 36rpx 24rpx;
- background: linear-gradient(180deg, #FFDFCD 0%, #FFFFFF 100%);
- }
- .row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .points {
- font-weight: 400;
- font-size: 28rpx;
- color: #333333;
- .num {
- font-weight: 500;
- font-size: 40rpx;
- color: #222426;
- margin-left: 4rpx;
- }
- }
- .shop {
- .shop-txt {
- font-weight: 500;
- font-size: 28rpx;
- color: #FF5C03;
- margin: 0 12rpx;
- }
- }
- .list {
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- padding: 0 24rpx;
- box-sizing: border-box;
- flex: 1;
- overflow: hidden;
- .list-item {
- width: 100%;
- margin-bottom: 32rpx;
- .button {
- width: 132rpx;
- height: 64rpx;
- background: #FF5C03;
- border-radius: 32rpx 32rpx 32rpx 32rpx;
- text-align: center;
- line-height: 64rpx;
- color: #FFFFFF;
- font-weight: 500;
- font-size: 28rpx;
- }
- .left {
- display: flex;
- .title {
- font-weight: 500;
- font-size: 30rpx;
- color: #333333;
- }
- .num {
- font-weight: 600;
- font-size: 28rpx;
- color: #FF5C03;
- }
- .txt {
- font-size: 24rpx;
- color: #999999;
- }
- }
- }
- }
- }
- </style>
|