Kaynağa Gözat

feat: 签到

Leo 3 yıl önce
ebeveyn
işleme
34c8b6a75e

+ 45 - 0
src/lib/api/shop.js

@@ -0,0 +1,45 @@
+import request from "../utils/request";
+
+/**
+ * 已兑换的商品列表
+ *
+ * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=80e97193-7d1d-4bfa-b626-2b02faba671c)
+ */
+export const getMySkuList = () => request.get("/weapp/mySkuList");
+
+/**
+ * 去实体店取兑换的商品
+ *
+ * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=80e97193-7d1d-4bfa-b626-2b02faba671c)
+ */
+export const useMySku = (data) => request.post("/weapp/use/mySku", data);
+
+/**
+ * 上传小票的历史记录
+ *
+ * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=77a8d929-dbed-4219-83b2-10da4e7b4bfd)
+ */
+export const getMyPhotoList = () => request.get("/weapp/score/photo/list");
+
+/**
+ * 积分兑换商品
+ *
+ * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=80e97193-7d1d-4bfa-b626-2b02faba671c)
+ */
+export const exchangeScore = (data) =>
+  request.post("/weapp/score/exchange", data);
+
+/**
+ * 积分兑换商城
+ *
+ * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=32732123-c89b-487a-b8d4-f15c4b2d3f59)
+ */
+export const getScoreList = () => request.get("/weapp/score/list");
+
+/**
+ * 自助积分
+ *
+ * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=80e97193-7d1d-4bfa-b626-2b02faba671c)
+ */
+export const uploadPhoto = (data) =>
+  request.post("/weapp/score/photo/upload", data);

+ 13 - 1
src/lib/api/task.js

@@ -1,3 +1,15 @@
 import request from "../utils/request";
 
-export const getTaskInfo = () => request.get("/weapp/getTaskInfo");
+/**
+ * 查询今日是否签到
+ *
+ * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=728985a2-8d55-4888-a0c7-38dad12ccd97)
+ */
+export const getSingInfo = () => request.get("/weapp/getNewSingInfo");
+
+/**
+ * 每日签到
+ *
+ * [API](https://console-docs.apipost.cn/preview/888dcf083e39e4e4/ae9a5ffd745e57d1?target_id=728985a2-8d55-4888-a0c7-38dad12ccd97)
+ */
+export const postSingInfo = () => request.post("/weapp/userNewSingIn");

+ 7 - 0
src/lib/api/user.js

@@ -0,0 +1,7 @@
+import request from "../utils/request";
+
+/**
+ * 用户信息
+ *
+ */
+export const getUserInfo = () => request.get("/weapp/userInfo");

+ 2 - 1
src/lib/utils/request.js

@@ -19,7 +19,7 @@ function getCommonHeader() {
   if (info.session) {
     header.session = info.session;
   }
-
+  header.session = "375ac5dd70ebc9af27864ecfc91e9181";
   return header;
 }
 // todo 这里的问题,先注释掉
@@ -183,6 +183,7 @@ function uploadFile(url, filePath, data = null, config = {}) {
 }
 
 export default {
+  getCommonHeader,
   get: getRequest,
   post: postRequest,
   upload: uploadFile,

+ 20 - 1
src/pages.json

@@ -25,6 +25,15 @@
         "backgroundColor": "#F7F7FC"
       }
     },
+    {
+      "path": "pages/shop/index",
+      "style": {
+        "navigationBarTitleText": "积分商城",
+        "enablePullDownRefresh": true,
+        "navigationBarBackgroundColor": "#F7F7FC",
+        "backgroundColor": "#F7F7FC"
+      }
+    },
     {
       "path": "pages/activity/index",
       "style": {
@@ -45,7 +54,7 @@
     {
       "path": "pages/task/index",
       "style": {
-        "navigationBarTitleText": "签到",
+        "navigationBarTitleText": "积分",
         "navigationBarTextStyle": "white",
         "navigationBarBackgroundColor": "#30303A",
         "backgroundColor": "#F6F6F6"
@@ -260,6 +269,12 @@
         "iconPath": "static/icon/icon-home.png",
         "selectedIconPath": "static/icon/icon-home-selected.png"
       },
+      {
+        "pagePath": "pages/shop/index",
+        "text": "积分商城",
+        "iconPath": "static/icon/icon-reward.png",
+        "selectedIconPath": "static/icon/icon-reward-selected.png"
+      },
       {
         "pagePath": "pages/activity/index",
         "text": "活动",
@@ -289,6 +304,10 @@
         "name": "vip detail",
         "path": "pages/vip/detail",
         "query": "id=1"
+      },
+      {
+        "name": "签到",
+        "path": "pages/task/index"
       }
     ]
   }

+ 2 - 3
src/pages/my/my.vue

@@ -78,7 +78,7 @@
 
 <script>
 import login from "@/lib/utils/login";
-import api from "@/lib/api/api";
+import { getUserInfo } from "@/lib/api/user";
 
 export default {
   name: "PageMy",
@@ -177,8 +177,7 @@ export default {
   methods: {
     //获取个人信息
     getUserInfo() {
-      api
-        .userInfo(this.userInfo.session)
+      getUserInfo()
         .then((data) => {
           this.userInfo = { ...this.userInfo, ...data.data };
           uni.setStorageSync("userinfo", JSON.stringify(this.userInfo));

+ 451 - 0
src/pages/shop/index.scss

@@ -0,0 +1,451 @@
+.BanContain {
+  position: fixed;
+  width: 100%;
+  top: 0;
+  z-index: 10;
+  background: #fff;
+
+  .status_bar {
+    height: var(--status-bar-height);
+    width: 100%;
+  }
+
+  .navBar {
+    display: flex;
+    align-items: center;
+    padding: 0 24rpx;
+    .logo {
+      display: block;
+      width: 148rpx;
+      height: 40rpx;
+    }
+
+    .bans {
+      margin-left: 12rpx;
+    }
+  }
+}
+
+.icon-list {
+  display: flex;
+  text-align: center;
+  padding: 23rpx 0;
+  margin-bottom: 86rpx-48rpx-25rpx;
+  flex-wrap: wrap;
+  .icon-item {
+    width: 25%;
+    font-size: 24rpx;
+    color: #555555;
+    line-height: 28rpx;
+    margin: 25rpx 0;
+    position: relative;
+    .icon {
+      display: block;
+      width: 100rpx;
+      height: 100rpx;
+      margin: 0 auto 12rpx;
+    }
+    .my-tip {
+      position: absolute;
+      box-sizing: border-box;
+      width: 22rpx;
+      height: 22rpx;
+      border-radius: 22rpx;
+      background: #eb5757;
+      border: 2rpx solid #ffffff;
+      top: -4rpx;
+      left: 50%;
+      margin-left: 14rpx;
+    }
+  }
+}
+.title {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  height: 48rpx;
+  font-size: 34rpx;
+  font-weight: 600;
+  color: #222222;
+  padding: 0 42rpx;
+  margin-top: 30rpx;
+}
+.home-index2 {
+  // background: #f5f5f5;
+  background: #fff;
+  // background-size: 100% auto;
+  overflow: hidden;
+  .swiper {
+    width: 100%;
+    height: 276rpx;
+  }
+  .swiper-item {
+    width: 100%;
+    display: block;
+    height: 276rpx;
+  }
+  .banner {
+    padding: 0 24rpx;
+    margin: 24rpx 0;
+    display: flex;
+    &.banner-swiper {
+      height: 164rpx;
+    }
+    .banner-item {
+      width: 100%;
+      height: 160rpx;
+      margin: 0 7rpx;
+      &:first-child {
+        margin-left: 0;
+      }
+      &:last-child {
+        margin-right: 0;
+      }
+    }
+  }
+
+  .flash-sale {
+    width: 750rpx;
+    height: 572rpx;
+    padding: 52rpx 0 0;
+    background: url("https://chujianchaowan.oss-cn-beijing.aliyuncs.com/images/d73e5555842c968cf39a6bea9442e4fd.png")
+      no-repeat center top;
+    background-size: 100% 100%;
+    overflow: hidden;
+    margin-top: -24rpx;
+    .cd-title {
+      height: 32rpx;
+      padding-left: 158rpx;
+      overflow: hidden;
+      display: flex;
+      align-items: flex-start;
+      .cd-block {
+        min-width: 22rpx;
+        height: 28rpx;
+        font-size: 20rpx;
+        color: #292d3b;
+        width: 32rpx;
+        height: 32rpx;
+        background: #4efbff;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+      }
+      .cd-item {
+        min-width: 14rpx;
+        height: 32rpx;
+        font-size: 20rpx;
+        color: #08c2c3;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        &.day {
+          margin: 0 6rpx;
+        }
+      }
+    }
+    .sale-list {
+      width: 670rpx;
+      height: 394rpx;
+      overflow-x: auto;
+      white-space: nowrap;
+      margin: 32rpx auto 14rpx;
+      .sale-item {
+        display: inline-block;
+        vertical-align: top;
+        width: 256rpx;
+        height: 376rpx;
+        overflow: hidden;
+        margin-right: 16rpx;
+        &:last-child {
+          margin-right: 0;
+        }
+      }
+      .sale-pic,
+      .sale-img {
+        position: relative;
+        width: 256rpx;
+        height: 256rpx;
+        display: block;
+      }
+      .sale-text {
+        position: absolute;
+        left: 0;
+        bottom: 0;
+        width: 100%;
+        font-size: 22rpx;
+        font-weight: 500;
+        color: #ffffff;
+        height: 36rpx;
+        background: linear-gradient(
+          95deg,
+          #fc5e94 0%,
+          rgba(252, 94, 148, 0.47) 100%
+        );
+        line-height: 36rpx;
+        text-align: center;
+      }
+
+      .sale-title {
+        font-size: 24rpx;
+        font-weight: 500;
+        color: #292d3b;
+        line-height: 34rpx;
+        height: 68rpx;
+        display: block;
+        white-space: normal;
+        margin: 8rpx 0;
+      }
+      .sale-sub {
+        color: #08c2c3;
+        line-height: 34rpx;
+        display: block;
+        font-family: unidreamledregular, Helvetica Neue, Helvetica, Arial,
+          Hiragino Sans GB, Hiragino Sans GB W3, Microsoft YaHei UI,
+          Microsoft YaHei, WenQuanYi Micro Hei, sans-serif;
+        .sale-label {
+          font-size: 24rpx;
+          margin-right: 5rpx;
+          font-weight: bolder;
+        }
+        .sale-price {
+          font-size: 32rpx;
+        }
+        .sale-origin {
+          font-size: 20rpx;
+          font-weight: 400;
+          color: #a6a7ac;
+          text-decoration: line-through;
+          margin-left: 10rpx;
+        }
+      }
+    }
+    .fill-title {
+      margin-top: 46rpx;
+    }
+  }
+  .fill-title-wrap {
+    height: 88rpx;
+  }
+  .fill-title {
+    box-sizing: border-box;
+    width: 100%;
+    display: flex;
+    justify-content: space-between;
+    font-size: 28rpx;
+    font-weight: 500;
+    color: #555;
+    height: 88rpx;
+    padding: 0;
+    line-height: 88rpx;
+    .icon-sort {
+      width: 28rpx;
+      height: 28rpx;
+      margin-left: 2rpx;
+    }
+    .fill-item {
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      position: relative;
+      width: 0;
+      flex: 1;
+      &.white {
+        color: #222;
+        font-weight: bold;
+        &::after {
+          width: 32rpx;
+          height: 6rpx;
+          background: #08c2c3;
+          position: absolute;
+          content: "";
+          left: 50%;
+          bottom: 0;
+          margin-left: -16rpx;
+        }
+      }
+    }
+  }
+  .home-titlebar {
+    background-color: #fff;
+  }
+  .home-titlebar-fix {
+    position: fixed;
+    left: 0;
+    top: 0;
+    z-index: 9;
+  }
+  .footer {
+    width: 100%;
+    margin-top: 24rpx;
+    margin-bottom: 22rpx;
+
+    .info {
+      height: 40rpx;
+      font-size: 28rpx;
+      font-weight: 500;
+      color: #999999;
+      line-height: 40rpx;
+      text-align: center;
+    }
+
+    .contact {
+      margin-top: 8rpx;
+      height: 40rpx;
+      font-size: 28rpx;
+      font-weight: 500;
+      color: #999999;
+      line-height: 40rpx;
+      text-align: center;
+    }
+  }
+  .popup_coupon {
+    color: #fff;
+    font-weight: 500;
+    text-align: center;
+    position: relative;
+    .title {
+      display: block;
+      height: 50rpx;
+      font-size: 36rpx;
+      line-height: 50rpx;
+    }
+    .desc {
+      display: block;
+      height: 40rpx;
+      font-size: 28rpx;
+      line-height: 40rpx;
+    }
+    .gifts {
+      width: 708rpx;
+      height: 686rpx;
+      display: block;
+      margin: -16rpx auto -80rpx;
+      animation: zoomIn 0.3s both;
+    }
+    .coupon-button {
+      display: inline-block;
+      height: 80rpx;
+      font-size: 32rpx;
+      line-height: 80rpx;
+      padding: 0 46rpx;
+      background: #08c2c3;
+      border-radius: 0;
+    }
+  }
+  .popup_coupon_res {
+    box-sizing: border-box;
+    width: 840rpx;
+    height: 852rpx;
+    position: relative;
+    padding-top: 44rpx;
+    background: url(https://chujianchaowan.oss-cn-beijing.aliyuncs.com/images/b52109ed4dfc4551ad0254a99ddd0e34.png)
+      no-repeat center;
+    background-size: contain;
+
+    .title {
+      display: block;
+      position: relative;
+      text-align: center;
+      height: 50rpx;
+      font-size: 36rpx;
+      font-weight: 500;
+      color: #292d3b;
+      line-height: 50rpx;
+      margin: 0 0 24rpx;
+    }
+    .coupon-list {
+      position: relative;
+      width: 476rpx;
+      margin: 0 auto;
+      display: flex;
+      flex-wrap: wrap;
+      margin-bottom: 16rpx;
+      justify-content: space-between;
+      max-height: 380rpx;
+      overflow: auto;
+      .coupon-item {
+        width: 230rpx;
+        height: 116rpx;
+        background: url(@/assets/home/gifts-item.png) no-repeat;
+        background-size: contain;
+        display: flex;
+        color: #fff;
+        align-items: center;
+        margin-bottom: 16rpx;
+        .text {
+          flex: 1;
+          text-align: center;
+          .big {
+            font-size: 80rpx;
+            font-weight: bold;
+            line-height: 98rpx;
+          }
+          .small {
+            font-size: 36rpx;
+            font-weight: 600;
+            line-height: 50rpx;
+          }
+        }
+        .label {
+          width: 62rpx;
+          height: 94rpx;
+          border-left: 1px dashed #717181;
+          position: relative;
+          overflow: hidden;
+          .label-text {
+            white-space: nowrap;
+            font-size: 28rpx;
+            font-weight: 600;
+            color: #ffffff;
+            position: absolute;
+            left: 50%;
+            top: 50%;
+            transform: translate(-50%, -50%) rotate(90deg);
+          }
+        }
+      }
+    }
+    .coupon-button {
+      width: 378rpx;
+      height: 128rpx;
+      font-size: 36rpx;
+      font-weight: 600;
+      color: #ffffff;
+      line-height: 128rpx;
+      text-align: center;
+      background: url(@/assets/home/gifts-btn.png) no-repeat center transparent;
+      background-size: contain;
+      border: 0 none;
+      padding: 0;
+      position: absolute;
+      bottom: 28rpx;
+      left: 50%;
+      margin-left: -189rpx;
+      &::after {
+        display: none;
+      }
+    }
+  }
+  .fixed-btns {
+    position: fixed;
+    right: 14rpx;
+    bottom: 154rpx;
+    z-index: 999;
+    .fixed-btn {
+      display: block;
+      width: 112rpx;
+      height: 112rpx;
+      margin-bottom: 18rpx;
+    }
+  }
+}
+
+@keyframes zoomIn {
+  from {
+    transform: scale(0);
+  }
+  to {
+    transform: scale(1);
+  }
+}

+ 192 - 0
src/pages/shop/index.vue

@@ -0,0 +1,192 @@
+<template>
+  <view class="home-index2">
+    <view
+      v-if="modules.latest_recommend && modules.latest_recommend.length"
+      class="base-list"
+    >
+      <list-item
+        v-for="item in modules.latest_recommend"
+        :key="item.module_id"
+        :item="item"
+        class="base-list-item"
+        @click="handleDetail(item)"
+      >
+      </list-item>
+    </view>
+    <view class="fixed-btns">
+      <!-- <image
+        class="fixed-btn"
+        :src="require('@/assets/icon/icon-btn-service.png')"
+        @click="jumpModuleAll('/pages/help/help_contact')"
+      ></image>
+      <image
+        class="fixed-btn"
+        :src="require('@/assets/icon/icon-btn-message.png')"
+        @click="jumpModuleAll('/pages/my/messages')"
+      ></image>
+       -->
+      <image
+        v-if="showTask"
+        class="fixed-btn"
+        :src="require('@/assets/icon/icon-btn-sign.png')"
+        @click="jumpModuleAll('/pages/task/index')"
+      ></image>
+    </view>
+  </view>
+</template>
+<script>
+import { homeModules } from "@/lib/api/home";
+import { getTaskInfo } from "@/lib/api/task";
+import listItem from "@/components/list-item/list-item.vue";
+
+export default {
+  name: "PageHome",
+  components: {
+    listItem,
+  },
+  data() {
+    return {
+      statusBarHeight: 0, // 自定义导航
+      titleBarHeight: 44, // 自定义导航
+      BarHeight: 0, // 自定义导航
+      userInfo: {},
+      modules: {},
+      tabStyle: "",
+      showTask: false,
+    };
+  },
+  onLoad() {
+    const uinfoStr = uni.getStorageSync("userinfo");
+    if (uinfoStr) {
+      this.userInfo = JSON.parse(uinfoStr);
+    }
+    uni.showLoading({
+      title: "加载中",
+    });
+    this.loadModules().then(() => {
+      uni.hideLoading();
+    });
+  },
+  onShow() {
+    const uinfoStr = uni.getStorageSync("userinfo");
+    if (uinfoStr) {
+      this.userInfo = JSON.parse(uinfoStr);
+    } else {
+      this.userInfo = {};
+    }
+    // this.getTaskInfo();
+  },
+  onShareAppMessage() {
+    return {
+      title: "各种爆款手办/盲盒,还能0元抽热款~快来试试你的欧气!",
+      imageUrl:
+        "https://chujianchaowan.oss-cn-beijing.aliyuncs.com/images/45bfb688e6e9dba557f64fd052e850cc.png",
+      path: "/pages/index/index",
+    };
+  },
+  onShareTimeline() {
+    return {
+      title: "各种爆款手办/盲盒,还能0元抽热款~快来试试你的欧气!",
+      imageUrl:
+        "https://chujianchaowan.oss-cn-beijing.aliyuncs.com/images/45bfb688e6e9dba557f64fd052e850cc.png",
+      path: "/pages/index/index",
+    };
+  },
+  async onPullDownRefresh() {
+    await this.loadModules().catch((e) => console.log(e));
+    uni.stopPullDownRefresh();
+  },
+  mounted() {
+    const systemInfo = uni.getSystemInfoSync();
+    this.statusBarHeight = systemInfo.statusBarHeight;
+
+    // #ifdef MP
+    this.statusBarHeight = systemInfo.statusBarHeight;
+    // this.titleBarHeight = systemInfo.statusBarHeight;
+    // #endif
+
+    // #ifdef MP-WEIXIN
+    this.statusBarHeight = systemInfo.statusBarHeight;
+    const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
+    this.titleBarHeight =
+      (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 +
+      menuButtonInfo.height;
+    // #endif
+
+    // #ifdef MP-ALIPAY
+    this.statusBarHeight = systemInfo.statusBarHeight;
+    this.titleBarHeight =
+      systemInfo.statusBarHeight + systemInfo.titleBarHeight;
+    // #endif
+
+    // #ifdef APP-PLUS
+    this.statusBarHeight = systemInfo.statusBarHeight;
+    // this.titleBarHeight = 44;
+    // #endif
+
+    // #ifdef H5
+    this.statusBarHeight = 0;
+    // this.titleBarHeight = systemInfo.statusBarHeight;
+    // #endif
+    this.BarHeight = this.statusBarHeight + this.titleBarHeight;
+  },
+  methods: {
+    async loadModules() {
+      try {
+        const data = await homeModules();
+        if (data.errno == 10000) {
+          this.modules = data.data;
+          // this.endTime = data.diff_time;
+          // this.runCd();
+        } else {
+          uni.showToast({
+            icon: "none",
+            title: data.errmsg,
+            duration: 3000,
+          });
+        }
+      } catch (e) {
+        uni.showToast({
+          icon: "none",
+          title: "出错啦,请稍后重试",
+          duration: 3000,
+        });
+      }
+    },
+
+    async getTaskInfo() {
+      if (!this.userInfo.session) {
+        this.showTask = true;
+        return Promise.reject();
+      }
+      const data = await getTaskInfo(this.userInfo.session);
+      this.showTask = !data.is_current_signin;
+    },
+
+    jumpModuleAll(url) {
+      if (!url) return;
+
+      if (/^https?:\/\//i.test(url)) {
+        uni.navigateTo({
+          url: `../webview/webview?url=${encodeURIComponent(url)}`,
+        });
+        return;
+      }
+      uni.navigateTo({
+        url: url,
+      });
+    },
+
+    handleDetail(item) {
+      if (item.play_type === 1) {
+        this.jumpModuleAll(`../detail/detail?id=${item.id}`);
+      } else {
+        this.jumpModuleAll(`../reward/detail?id=${item.id}`);
+      }
+    },
+  },
+};
+</script>
+<style lang="scss">
+@import "./index.scss";
+</style>

+ 149 - 0
src/pages/shop/list.scss

@@ -0,0 +1,149 @@
+text {
+  letter-spacing: 0.3px;
+}
+.home-list {
+  width: 750rpx;
+  background: #f5f5f5;
+  height: 100%;
+  .list {
+    margin: 20rpx 20rpx 0;
+    .r {
+      width: 100%;
+      height: 240rpx;
+      margin: 0rpx 0rpx 20rpx;
+      .r1 {
+        width: 240rpx;
+        position: relative;
+        img {
+          border-radius: 8rpx;
+          height: 240rpx;
+          width: 240rpx;
+        }
+        .tag {
+          position: absolute;
+          background: linear-gradient(45deg, #ff8104 10%, #ffcd71 100%);
+          text-align: center;
+          color: #ffffff;
+          letter-spacing: 1rpx;
+          font-size: 20rpx;
+          top: 6rpx;
+          left: 6rpx;
+          font-weight: 500;
+          padding: 4rpx 10rpx 6rpx;
+          border-radius: 8rpx;
+        }
+      }
+      .r2 {
+        width: 412rpx;
+        margin-left: 18rpx;
+        height: 240rpx;
+        position: relative;
+        .n1 {
+          width: 100%;
+          height: 40rpx;
+          margin-bottom: 50rpx;
+          text {
+            width: 100%;
+            font-size: 28rpx;
+            font-weight: 550;
+            color: #26272c;
+            line-height: 40rpx;
+            overflow: hidden;
+            white-space: nowrap;
+            word-break: break-all; /* break-all(允许在单词内换行。) */
+            text-overflow: ellipsis; /* 超出部分省略号 */
+            display: block;
+          }
+        }
+        .tag {
+          border: 1rpx solid #ff9f5b;
+          text-align: center;
+          color: #ff9f5b;
+          letter-spacing: 1rpx;
+          font-size: 20rpx;
+          font-weight: 500;
+          padding: 0rpx 10rpx;
+          line-height: 33rpx;
+          text-align: center;
+          height: 33rpx;
+          border-radius: 8rpx;
+          position: absolute;
+          top: 48rpx;
+          display: inline-block;
+        }
+        .n2 {
+          height: 50rpx;
+          margin-top: 8rpx;
+          .price1 {
+            height: 50rpx;
+            font-size: 22rpx;
+            font-weight: 550;
+            color: #ec2e56;
+            line-height: 40rpx;
+            letter-spacing: 1rpx;
+            text {
+              margin-left: 4rpx;
+              font-size: 28rpx;
+            }
+          }
+          .price2 {
+            text-decoration: line-through;
+            margin-left: 8rpx;
+            height: 34rpx;
+            font-size: 24rpx;
+            font-weight: 550;
+            color: #999999;
+            line-height: 34rpx;
+            letter-spacing: 1rpx;
+            text {
+              margin-left: 4rpx;
+            }
+          }
+        }
+        .n3 {
+          height: 96rpx;
+          margin-top: 8rpx;
+          img {
+            height: 96rpx;
+            width: 96rpx;
+            border-radius: 6rpx;
+          }
+        }
+      }
+    }
+  }
+  .gc-1 {
+    width: 710rpx;
+    margin: 20rpx 20rpx 0;
+    background-color: #ffffff;
+    border-radius: 16rpx;
+    .line {
+      margin-bottom: 20rpx;
+      width: 100%;
+      height: 2rpx;
+      background-color: #f5f5f5;
+    }
+  }
+  .footer {
+    width: 100%;
+    margin-top: 16rpx;
+    margin-bottom: 22rpx;
+    .info {
+      height: 40rpx;
+      font-size: 28rpx;
+      font-weight: 500;
+      color: #999999;
+      line-height: 40rpx;
+      text-align: center;
+    }
+    .contact {
+      margin-top: 8rpx;
+      height: 40rpx;
+      font-size: 28rpx;
+      font-weight: 500;
+      color: #999999;
+      line-height: 40rpx;
+      text-align: center;
+    }
+  }
+}

+ 107 - 0
src/pages/shop/list.vue

@@ -0,0 +1,107 @@
+<template>
+  <view class="home-list flex-col">
+    <view class="gc-1">
+      <view class="list flex-col">
+        <view v-for="(ele, idx) in datas.relations" :key="ele.id">
+          <view class="r flex-row" @tap="jumpToDetail(ele)">
+            <view class="r1"><img mode :src="ele.img" alt="" /></view>
+            <view class="r2">
+              <view class="n1"
+                ><text>{{ ele.name }}</text></view
+              >
+              <text v-if="ele.tag" class="tag">{{ ele.tag }}</text>
+              <view class="n2">
+                <text class="price1"
+                  >¥<text>{{ ele.show_price }}</text></text
+                >
+                <text v-if="ele.show_price != ele.source_price" class="price2"
+                  >¥<text>{{ ele.source_price }}</text></text
+                >
+              </view>
+              <view class="n3 justify-between">
+                <img v-for="sub in ele.sub_imgs" :key="sub" :src="sub" alt="" />
+              </view>
+            </view>
+          </view>
+          <view v-if="idx < datas.relations.length - 1" class="line"></view>
+        </view>
+      </view>
+    </view>
+    <view class="footer">
+      <view class="info">到底啦~ ( ̄▽ ̄)”</view>
+      <view class="contact">联系我们:oushen2022@126.com</view>
+    </view>
+  </view>
+</template>
+<script>
+import api from "@/lib/api/api";
+export default {
+  name: "PageList",
+  data() {
+    return {
+      datas: [],
+      id: "",
+    };
+  },
+  onLoad(data) {
+    this.id = data.id;
+    this.loadModule(data.id);
+  },
+  // 分享
+  onShareAppMessage() {
+    return {
+      title: "云果国潮,各种绝版大娃抽到飞起!",
+    };
+  },
+  // 分享
+  onShareTimeline() {
+    return {
+      title: "云果国潮,各种绝版大娃抽到飞起!",
+    };
+  },
+  // 下拉刷新
+  onPullDownRefresh() {
+    this.loadModule(this.id, () => {
+      uni.stopPullDownRefresh();
+    });
+  },
+  methods: {
+    // 获取数据
+    loadModule(id, cb) {
+      api
+        .homeModule(id)
+        .then((data) => {
+          if (data.data) {
+            this.datas = data.data;
+            uni.setNavigationBarTitle({
+              title: this.datas.title,
+            });
+          }
+          if (cb) cb();
+        })
+        .catch(() => {
+          uni.showToast({
+            icon: "none",
+            title: "出错啦,请稍后重试",
+            duration: 2e3,
+          });
+          if (cb) cb();
+        });
+    },
+    jumpToDetail(data) {
+      if (data.play_type == 2) {
+        uni.navigateTo({
+          url: `../detail/pinche?id=${data.id}`,
+        });
+      } else {
+        uni.navigateTo({
+          url: `../detail/detail?id=${data.id}`,
+        });
+      }
+    },
+  },
+};
+</script>
+<style lang="scss">
+@import "./list.scss";
+</style>

+ 110 - 181
src/pages/task/index.vue

@@ -3,67 +3,51 @@
     <view class="task-header">
       <view class="task-header-title"
         >我的积分<text class="big">{{
-          (singInfo && singInfo.total_score) || 0
+          (userInfo && userInfo.score) || 0
         }}</text></view
       >
       <view class="task-header-desc">每日签到做任务可领取积分</view>
-      <image
+      <!-- <image
         :src="require('@/assets/task/icon-help.png')"
         class="invite-icon"
         @tap="$refs.popup_info.open()"
-      ></image>
+      ></image> -->
     </view>
     <view class="task-box">
-      <view class="task-box-title">签到得积分</view>
-      <template v-if="userInfo && singInfo">
-        <view class="task-days">
-          <view
-            v-for="item in singInfo.data"
-            :key="item.date"
-            :class="['task-day', { 'task-day-active': !!item.is_signin }]"
-          >
-            <view class="task-day-integral">{{ item.score }}</view>
-            {{ item.day_name }}
-          </view>
-        </view>
-        <button class="task-days-btn" @click="handleSing">
-          {{ singInfo.is_current_signin ? "今日已签到" : "立即签到" }}
+      <view class="task-btns">
+        <button class="task-btn" @click="uploadFiles">拍照积分</button>
+        <button class="task-btn" :disabled="isSing" @click="handleSing">
+          {{ isSing ? "已签到" : "签到积分" }}
         </button>
-      </template>
-      <button v-else class="task-days-btn" @click="handleSing">
-        登录签到领积分
-      </button>
+      </view>
     </view>
-    <view class="task-box">
-      <view class="task-box-title">每日任务得积分</view>
-      <view v-if="userInfo && singInfo" class="task-list">
+    <view class="task-box" v-if="photoList.length">
+      <view class="task-box-title">拍照积分记录</view>
+      <view class="task-list">
         <view
-          v-for="item in singInfo.task"
-          :key="item.task_id"
+          v-for="item in photoList"
+          :key="item.id"
           class="task-item"
+          @click="handlePreviewImage(item.img)"
         >
-          <image
-            v-if="item.type === 2"
-            class="task-item-icon"
-            :src="require('@/assets/task/icon-video.png')"
-          />
-          <image
-            v-else
-            class="task-item-icon"
-            :src="require('@/assets/task/icon-money.png')"
-          />
+          <image class="task-item-icon" :src="item.img" />
           <view class="task-item-body">
-            <view class="task-item-title"
-              >{{ item.name
-              }}<text class="task-item-label"
-                >{{ item.symbol }}{{ item.score }}{{ item.unit }}</text
-              ></view
+            <view class="task-item-title" v-if="item.status === 1"
+              >审核通过</view
             >
-            <view v-if="item.type !== 2" class="task-item-desc"
-              >完成 {{ item.finish }}/{{ item.total }}</view
+            <view class="task-item-title" v-else-if="item.status === 2"
+              >审核失败</view
             >
+            <view class="task-item-title" v-else>待审核</view>
+            <view class="task-item-desc" v-if="item.reason">{{
+              item.reason
+            }}</view>
+            <view class="task-item-desc">{{ item.upload_time }}</view>
           </view>
-          <button
+          <view class="task-after" v-if="item.score && item.status === 1"
+            >{{ item.score }}积分</view
+          >
+          <!-- <button
             v-if="item.status === 1"
             class="task-item-btn receive"
             @click="handleReceive(item)"
@@ -73,9 +57,7 @@
           <button v-else-if="item.status === 2" class="task-item-btn disabled">
             已完成
           </button>
-          <button v-else class="task-item-btn" @click="handleDoTask(item)">
-            去完成
-          </button>
+          <button v-else class="task-item-btn">去完成</button> -->
         </view>
       </view>
     </view>
@@ -101,13 +83,11 @@
 </template>
 
 <script>
-import api from "@/lib/api/api";
+import { getSingInfo, postSingInfo } from "@/lib/api/task";
+import { getUserInfo } from "@/lib/api/user";
+import { getMyPhotoList } from "@/lib/api/shop";
+import request from "@/lib/utils/request";
 import login from "@/lib/utils/login";
-import createShowRewardedVideoAd from "@/lib/utils/showRewardedVideoAd";
-import {
-  requestSubscribeMessage,
-  defaultTemplateIds,
-} from "@/lib/utils/wxSubscribe";
 
 export default {
   name: "PageTask",
@@ -115,6 +95,8 @@ export default {
     return {
       userInfo: null,
       singInfo: null,
+      isSing: false,
+      photoList: [],
     };
   },
 
@@ -122,87 +104,83 @@ export default {
     const uinfoStr = uni.getStorageSync("userinfo");
     if (uinfoStr) {
       this.userInfo = JSON.parse(uinfoStr);
-      this.getTaskInfo();
+      this.getSingInfo();
+      this.getMyPhotoList();
     }
   },
 
   methods: {
-    async handleShowAd(item) {
-      if (!this.showRewardedVideoAd) {
-        this.showRewardedVideoAd = createShowRewardedVideoAd();
-      }
-      try {
-        const res = await this.showRewardedVideoAd();
+    async getUserInfo() {
+      const data = await getUserInfo();
+      this.userInfo = { ...this.userInfo, ...data.data };
+      uni.setStorageSync("userinfo", JSON.stringify(this.userInfo));
+    },
 
-        if (res && res.isEnded) {
-          this.adComplete(item);
-        }
-      } catch (e) {
-        uni.showToast({
-          icon: "none",
-          title: e?.errMsg || "广告播放失败",
-          duration: 2e3,
-          mask: true,
-        });
-      }
+    async getSingInfo() {
+      const res = await getSingInfo();
+      this.isSing = !!res.is_signin;
     },
 
     async handleSing() {
-      if (!this.userInfo || !this.userInfo.session) {
-        await this.login();
-      }
-      if (this.singInfo.is_current_signin) {
+      if (this.isSing) {
         uni.showToast({
           icon: "none",
-          title: "今日已签到",
-          duration: 2e3,
-          mask: true,
+          title: "已签到",
         });
         return;
       }
-      try {
-        // #ifdef MP-WEIXIN
-        await requestSubscribeMessage(defaultTemplateIds).catch(() => void 0);
-        // #endif
-
-        const data = await api.userNewSingIn({
-          session: this.userInfo.session,
-        });
-        this.singInfo = { ...this.singInfo, ...data };
-
-        if (data.errno === 10000) {
-          uni.showToast({
-            icon: "success",
-            title: "签到成功",
-            duration: 2e3,
-            mask: true,
-          });
-        } else {
-          uni.showToast({
-            icon: "none",
-            title: data.errmsg || "签到失败,请重试",
-            duration: 2e3,
-            mask: true,
-          });
-        }
-      } catch (e) {
+      const res = await postSingInfo();
+      if (res.errno === 10000) {
         uni.showToast({
           icon: "none",
-          title: "签到失败,请重试",
-          duration: 2e3,
-          mask: true,
+          title: "签到成功",
         });
+        this.isSing = true;
+        this.getUserInfo();
+        return;
       }
+      uni.showToast({
+        icon: "none",
+        title: res.errmsg,
+      });
     },
 
-    async getTaskInfo() {
-      if (!this.userInfo.session) {
-        return Promise.reject();
-      }
-      const data = await api.getTaskInfo(this.userInfo.session);
-      data.task = (data.task || []).sort((a, b) => a.sort - b.sort);
-      this.singInfo = data;
+    async getMyPhotoList() {
+      const res = await getMyPhotoList();
+      this.photoList = res?.data || [];
+    },
+
+    uploadFiles() {
+      uni.chooseImage({
+        count: 1,
+        success: (chooseImageRes) => {
+          const tempFilePaths = chooseImageRes.tempFilePaths;
+          uni.uploadFile({
+            url: "https://yggc.weapp.yergoo.com/weapp/score/photo/upload", //仅为示例,非真实的接口地址
+            filePath: tempFilePaths[0],
+            name: "f",
+            header: request.getCommonHeader(),
+            timeout: 30000,
+            success: (uploadFileRes) => {
+              const res = JSON.parse(uploadFileRes.data);
+              console.log(res);
+              uni.showToast({
+                icon: "none",
+                title: res.errno === 10000 ? "上传成功" : res.errmsg,
+              });
+              if (res.errno === 10000) this.getMyPhotoList();
+            },
+          });
+        },
+      });
+    },
+
+    handlePreviewImage(url) {
+      uni.previewImage({
+        urls: [url],
+      });
     },
+
     login() {
       return new Promise((resolve, reject) => {
         login.wxLogin(async (userInfo) => {
@@ -225,72 +203,6 @@ export default {
         });
       });
     },
-    async adComplete(item) {
-      try {
-        const data = await api.setAdTask({
-          session: this.userInfo.session,
-          task_id: `${item.task_id}`,
-        });
-        if (data.errno === 10000) {
-          this.handleReceive(item);
-        } else {
-          uni.showToast({
-            icon: "none",
-            title: data.errmsg || "领取失败",
-            duration: 2e3,
-            mask: true,
-          });
-        }
-      } catch (e) {
-        uni.showToast({
-          icon: "none",
-          title: "领取失败",
-          duration: 2e3,
-          mask: true,
-        });
-      }
-    },
-    handleDoTask(item) {
-      if (item.type === 2) {
-        this.handleShowAd(item);
-      } else {
-        uni.switchTab({
-          url: "/pages/index/index",
-        });
-      }
-    },
-    async handleReceive(item) {
-      uni.showLoading({ title: "领取中", mask: true });
-      try {
-        const data = await api.getTaskScore({
-          session: this.userInfo.session,
-          task_id: `${item.task_id}`,
-        });
-        uni.hideLoading();
-        if (data.errno === 10000) {
-          data.task = (data.task || []).sort((a, b) => a.sort - b.sort);
-          this.singInfo = {
-            ...this.singInfo,
-            ...data,
-          };
-          uni.showToast({
-            icon: "success",
-            title: "领取成功",
-            duration: 2e3,
-            mask: true,
-          });
-        } else {
-          uni.showToast({
-            icon: "none",
-            title: data.errmsg || "领取失败",
-            duration: 2e3,
-            mask: true,
-          });
-        }
-      } catch (e) {
-        uni.hideLoading();
-      }
-    },
   },
 };
 </script>
@@ -301,6 +213,8 @@ export default {
   overflow: hidden;
   background: #f6f6f6;
   min-height: 100vh;
+  box-sizing: border-box;
+  padding-bottom: 60rpx;
 
   .task-header {
     box-sizing: border-box;
@@ -347,7 +261,7 @@ export default {
   .task-box-title {
     height: 54rpx;
     font-size: 42rpx;
-    font-family: ysbth;
+    // font-family: ysbth;
     color: #000000;
     line-height: 54rpx;
     margin-bottom: 12rpx;
@@ -456,6 +370,9 @@ export default {
           color: #ffffff;
         }
       }
+      .task-after {
+        color: #22c8c9;
+      }
       .task-item-body {
         flex: 1;
         width: 0;
@@ -481,4 +398,16 @@ export default {
     }
   }
 }
+.task-btns {
+  display: flex;
+  .task-btn {
+    flex: 1;
+    border-radius: 1000px;
+    background-color: #08c2c3;
+    margin: 0 20rpx;
+    &::after {
+      display: none;
+    }
+  }
+}
 </style>