Bladeren bron

feat:签到领积分模块提交

xyh 5 maanden geleden
bovenliggende
commit
a764396362

+ 10 - 0
src/api/points.js

@@ -0,0 +1,10 @@
+import request from "@/utils/request.js";
+
+// 签到任务获取
+export function orderDeatails(data) {
+    return request({
+        method: 'get',
+        url: '/api/order/v1/wx/getOrder',
+        data
+    });
+}

+ 7 - 12
src/pages/index/index.vue

@@ -339,17 +339,12 @@ export default {
     },
     // 静默登录
     onLogin(wxCode) {
-      // let wxCode = this.getUrlCode('code')
-      // console.log('绕过微信登录,直接添加token')
-      // //TODO
-      // let res = {"code":200,"msg":"操作成功","data":{"token":"eyJhbGciOiJIUzUxMiJ9.eyJ0ZjoiOiIxMmU1NmQzZS0zYzk3LTQ2MzItOTczZC02NDA2ZmY0MWUxZDgifQ.2rJluXVPEBORNDLflsXnlcH59R77Jo7W8vG8XIHoVjJzJIGtEiQQE3ebYjDa5mk4IzzfkI4NdQsUjmWqWBcalA","id":"2033845259451543553","loginTime":1773900425855,"expireTime":1774505225855,"ipaddr":"172.17.0.1","loginLocation":"内网IP","browser":"Mobile Safari","os":"Mac OS X (iPhone)","nickName":null,"code":null,"role":1,"password":null,"enabled":false,"authorities":null,"copenid":"o7Txd6o8yxUPo6o00Q4fum4JjPJE","cicon":"https://thirdwx.qlogo.cn/mmopen/vi_32/hBiaibicQOu5sF8AicvXyOmVWDKiayct5TcYFTic94NBIa76SMTrHF4icRPDibdG4pxXCNJWtYc4iag7zX2Eia0UadENPzuRh8A7PZAibyXibEZpvpYiabIY/132","cphone":null,"cnickName":"名字","username":null,"cunionid":null,"dmoney":0.00,"nnum":0,"caddressList":null,"dbalance":0.00,"dallMoney":0.00,"cscanImg":null,"cupUser":null,"cmrAddressId":null,"csessionKey":"102_Qj1zgSWBZAaA5gi9Joa8sRQxo334WTeEuD8SfgIwKFsLnz9gyyOjrjpNPqMa7mWcQUljz_ABcaXLsSCIDkWlKlOUEfAoqBeGuW7Wejnjsoc","accountNonExpired":false,"accountNonLocked":false,"credentialsNonExpired":false}}
-      // uni.setStorageSync('wx_copenid', res.data.copenid)
-      // uni.setStorageSync('access-token', res.data.token)
-      // var vm = this
-      // vm.$message.success(
-      //     "支付成功")
-      // console.log('支付成功')
-      // return false;
+      console.log('绕过微信登录,直接添加token')
+      //TODO
+      let res = {"code":200,"msg":"操作成功","data":{"token":"eyJhbGciOiJIUzUxMiJ9.eyJ0ZjoiOiIxMmU1NmQzZS0zYzk3LTQ2MzItOTczZC02NDA2ZmY0MWUxZDgifQ.2rJluXVPEBORNDLflsXnlcH59R77Jo7W8vG8XIHoVjJzJIGtEiQQE3ebYjDa5mk4IzzfkI4NdQsUjmWqWBcalA","id":"2033845259451543553","loginTime":1773900425855,"expireTime":1774505225855,"ipaddr":"172.17.0.1","loginLocation":"内网IP","browser":"Mobile Safari","os":"Mac OS X (iPhone)","nickName":null,"code":null,"role":1,"password":null,"enabled":false,"authorities":null,"copenid":"o7Txd6o8yxUPo6o00Q4fum4JjPJE","cicon":"https://thirdwx.qlogo.cn/mmopen/vi_32/hBiaibicQOu5sF8AicvXyOmVWDKiayct5TcYFTic94NBIa76SMTrHF4icRPDibdG4pxXCNJWtYc4iag7zX2Eia0UadENPzuRh8A7PZAibyXibEZpvpYiabIY/132","cphone":null,"cnickName":"名字","username":null,"cunionid":null,"dmoney":0.00,"nnum":0,"caddressList":null,"dbalance":0.00,"dallMoney":0.00,"cscanImg":null,"cupUser":null,"cmrAddressId":null,"csessionKey":"102_Qj1zgSWBZAaA5gi9Joa8sRQxo334WTeEuD8SfgIwKFsLnz9gyyOjrjpNPqMa7mWcQUljz_ABcaXLsSCIDkWlKlOUEfAoqBeGuW7Wejnjsoc","accountNonExpired":false,"accountNonLocked":false,"credentialsNonExpired":false}}
+      uni.setStorageSync('wx_copenid', res.data.copenid)
+      uni.setStorageSync('access-token', res.data.token)
+      return false;
       let params = {
         code: wxCode,
       }
@@ -416,7 +411,7 @@ export default {
   .swiper {
     padding: 16rpx 32rpx;
 
-    ::v-deepuni-swiper {
+    ::v-deep uni-swiper {
       height: 320rpx !important;
     }
   }

+ 144 - 0
src/points/components/sign-in/sign-in.vue

@@ -0,0 +1,144 @@
+<template>
+  <view class="sign-in-container">
+    <view class="sign-in-header">
+      <text class="sign-in-title">签到领积分</text>
+    </view>
+    <view class="sign-in-days">
+      <view 
+        v-for="(day, index) in signDays" 
+        :key="index"
+        class="sign-day"
+        @click="handleSign(day, index)"
+      >
+        <view class="sign-day-circle" :class="getSignCircleClass(day)">
+          <image src="@/static/points/Signed.png" v-if="day.status === '1'"></image>
+          <image src="@/static/points/notSigned.png" v-else></image>
+          <text class="sign-day-number" v-if="day.status === ''">+{{ day.point }}</text>
+        </view>
+        <text :class="day.status === '1' ? 'sign-day-text' : 'day-text'">{{ getSignText(day) }}</text>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+import Image from "@/components/swiper/components/image.vue";
+
+export default {
+  components: {Image},
+  props: {
+    signData: {
+      type: Array,
+      default: () => []
+    }
+  },
+  data() {
+    return {
+      signDays: [
+        { day: '2.09', status: '1',point:'1' },
+        { day: '2.10', status: '0' ,point:'2' },
+        { day: '2.11', status: 'signed',point:'3' },
+        { day: '2.12', status: '',point:'1' },
+        { day: '2.13', status: '',point:'2' },
+        { day: '2.14', status: '',point:'5' },
+        { day: '2.15', status: '',point:'1' },
+      ]
+    }
+  },
+  methods: {
+    getSignCircleClass(day) {
+      return {
+        'signed-circle': day.status === '1',
+        'select-circle': day.status === 'signed'
+      }
+    },
+    getSignText(day) {
+      if (day.status === '1') return '已签到'
+      if (day.status === '0') return '未签到'
+      return day.day
+    },
+    handleSign(day, index) {
+      if (day.status === 'today') {
+        // 处理签到逻辑
+        this.$emit('sign', index)
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.sign-in-container {
+  background-color: #fff;
+  border-radius: 20rpx;
+  padding: 24rpx;
+  margin-bottom: 24rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
+  
+  .sign-in-header {
+    margin-bottom: 26rpx;
+    
+    .sign-in-title {
+      font-size: 32rpx;
+      font-weight: 600;
+      color: #333;
+    }
+  }
+  
+  .sign-in-days {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    
+    .sign-day {
+      display: flex;
+      flex-direction: column;
+      align-items: center;
+      
+      .sign-day-circle {
+        width: 80rpx;
+        height: 96rpx;
+        background: #FBF2E1;
+        border-radius: 12rpx;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        margin-bottom: 16rpx;
+        position: relative;
+        image{
+          width: 60rpx;
+          height: 74rpx;
+        }
+        
+        &.signed-circle {
+          background: #F5F5F5;
+        }
+        
+        &.select-circle {
+          background: #FFEBC7;
+        }
+
+        .sign-day-number {
+          font-size: 14rpx;
+          color: #282100;
+          position: absolute;
+          top: 34rpx;
+        }
+      }
+      .sign-day-text{
+        font-family: PingFang SC, PingFang SC;
+        font-weight: 500;
+        font-size: 24rpx;
+        color:  #999999;
+      }
+
+      .day-text {
+        font-family: PingFang SC, PingFang SC;
+        font-weight: 500;
+        font-size: 24rpx;
+        color: #333333;
+      }
+    }
+  }
+}
+</style>

+ 98 - 3
src/points/home/index.vue

@@ -1,15 +1,110 @@
 <script>
+import SignIn from '../components/sign-in/sign-in.vue'
+import TaskList from '../components/task-list/task-list.vue'
+import ProductList from '../components/product-list/product-list.vue'
+
 export default {
+  components: {
+    SignIn,
+    TaskList,
+    ProductList
+  },
   data() {
-    return {}
+    return {
+      totalPoints: 999,
+      monthlyPoints: 888
+    }
+  },
+  methods: {
+    handleSign(index) {
+      // 处理签到逻辑
+      console.log('签到:', index)
+      // 这里可以调用签到API
+    },
+    handleTask(task) {
+      // 处理任务逻辑
+      console.log('任务:', task)
+      // 这里可以跳转到对应的任务页面
+    },
+    handleMoreTasks() {
+      // 处理更多任务逻辑
+      console.log('更多任务')
+      // 这里可以跳转到更多任务页面
+    }
   }
 }
 </script>
 
 <template>
-<view>积分首页</view>
+  <view class="points-home">
+    <view class="points-task">
+      <!-- 积分头部 -->
+      <view class="points-header">
+        <view class="points-total">
+          <text class="total">{{ totalPoints }}</text>
+        </view>
+        <view class="monthly-points">本月新获取{{ monthlyPoints }}积分</view>
+      </view>
+      <!-- 规则按钮 -->
+      <view class="rule-btn">规则</view>
+      <!-- 签到组件 -->
+      <SignIn @sign="handleSign" />
+      <!-- 任务组件 -->
+      <TaskList @task="handleTask" @moreTasks="handleMoreTasks"/>
+    </view>
+    <!-- 商品列表组件 -->
+    <ProductList />
+  </view>
 </template>
 
 <style lang="scss" scoped>
-
+.points-home{
+  min-height: 100vh;
+}
+.points-task {
+  background-image: url("@/static/points/homeBg.png");
+  background-size: 100%;
+  width: 750rpx;
+  height: 890rpx;
+  position: relative;
+  padding: 52px 32rpx 0 32rpx;
+  .points-header {
+    width: 100%;
+    padding: 0 12rpx;
+    margin-bottom: 34rpx;
+    .points-total{
+      width: 100%;
+      .total {
+        font-family: DIN, DIN;
+        font-weight: 500;
+        font-size: 80rpx;
+        color: #FFFFFF;
+        line-height: 80rpx;
+      }
+    }
+    .monthly-points {
+      font-family: PingFang SC, PingFang SC;
+      font-weight: 500;
+      font-size: 28rpx;
+      color: #FFFFFF;
+      line-height: 28rpx;
+      margin: 10rpx 0 0 0;
+    }
+  }
+  .rule-btn {
+    position: absolute;
+    top: 52rpx;
+    right: 0;
+    width: 88rpx;
+    height: 40rpx;
+    background: #FFFFFF;
+    border-radius: 26rpx 0 0 26rpx;
+    font-family: PingFang SC, PingFang SC;
+    font-weight: 500;
+    font-size: 28rpx;
+    color: #00B6C8;
+    line-height: 40rpx;
+    text-align: center;
+  }
+}
 </style>

BIN
src/static/points/Signed.png


BIN
src/static/points/homeBg.png


BIN
src/static/points/notSigned.png