Leo 3 rokov pred
rodič
commit
59bc4ffe69

+ 4 - 4
src/components/list-item/list-item.vue

@@ -7,13 +7,13 @@
     <image
       v-if="item && item.is_cheap === 1"
       class="list-lable"
-      src="@/assets/icon/icon-sale.png"
+      :src="require('@/assets/icon/icon-sale.png')"
       mode="heightFix"
     ></image>
     <image
       v-else-if="item && item.is_new === 1"
       class="list-lable"
-      src="@/assets/icon/icon-new.png"
+      :src="require('@/assets/icon/icon-new.png')"
       mode="heightFix"
     ></image>
     <view class="list-item-body">
@@ -22,7 +22,7 @@
         <view class="skeleton"></view>
         <view class="skeleton"></view>
       </view>
-      <view v-if="item" class="list-sub">
+      <!-- <view v-if="item" class="list-sub">
         <view class="list-sub-main">
           <text class="list-label">&yen;</text>
           <text class="list-price">{{ item.price }}</text>
@@ -53,7 +53,7 @@
         <view v-for="tag in item.tags" :key="tag" class="list-tag list-tag2">{{
           tag
         }}</view>
-      </view>
+      </view> -->
     </view>
   </view>
 </template>

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

@@ -30,7 +30,7 @@ export default {
   },
   //首页模块
   homeModules() {
-    return request.get("/weapp/kujis/module");
+    return request.get("/weapp/index/module");
   },
   // 详情
   detail(id) {

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

@@ -2,7 +2,7 @@
 // 测试域名
 // const baseUrl = "https://cj.weapp.yergoo.com";
 // 生产域名
-const baseUrl = "https://cj.weapp.yerhao.com";
+const baseUrl = "https://yggc.weapp.yergoo.com";
 
 function getCommonHeader() {
   let header = {

+ 28 - 28
src/pages.json

@@ -42,6 +42,34 @@
         "navigationBarBackgroundColor": "#30303A",
         "backgroundColor": "#F6F6F6"
       }
+    },
+    {
+      "path": "pages/my/coupon",
+      "style": {
+        "navigationBarTitleText": "红包卡券",
+        "enablePullDownRefresh": false
+      }
+    },
+    {
+      "path": "pages/help/help",
+      "style": {
+        "navigationBarTitleText": "问题与帮助",
+        "enablePullDownRefresh": false
+      }
+    },
+    {
+      "path": "pages/help/help_user",
+      "style": {
+        "navigationBarTitleText": "用户服务协议",
+        "enablePullDownRefresh": false
+      }
+    },
+    {
+      "path": "pages/help/help_about",
+      "style": {
+        "navigationBarTitleText": "关于我们",
+        "enablePullDownRefresh": false
+      }
     }
     // {
     //   "path": "pages/index/list",
@@ -57,13 +85,6 @@
     //   }
     // },
     // {
-    //   "path": "pages/my/coupon",
-    //   "style": {
-    //     "navigationBarTitleText": "红包卡券",
-    //     "enablePullDownRefresh": false
-    //   }
-    // },
-    // {
     //   "path": "pages/detail/detail",
     //   "style": {
     //     "navigationBarTitleText": "初见潮玩",
@@ -113,27 +134,6 @@
     //   }
     // },
     // {
-    //   "path": "pages/help/help",
-    //   "style": {
-    //     "navigationBarTitleText": "问题与帮助",
-    //     "enablePullDownRefresh": false
-    //   }
-    // },
-    // {
-    //   "path": "pages/help/help_user",
-    //   "style": {
-    //     "navigationBarTitleText": "用户服务协议",
-    //     "enablePullDownRefresh": false
-    //   }
-    // },
-    // {
-    //   "path": "pages/help/help_about",
-    //   "style": {
-    //     "navigationBarTitleText": "关于我们",
-    //     "enablePullDownRefresh": false
-    //   }
-    // },
-    // {
     //   "path": "pages/help/help_rule",
     //   "style": {
     //     "navigationBarTitleText": "余额说明",

+ 6 - 6
src/pages/help/help.vue

@@ -11,7 +11,7 @@
         >
           <view class="option-list_text">{{ item1.name }}</view>
           <view class="option-list_img1">
-            <image mode src="@/assets/my/icon-more.png"></image>
+            <image mode :src="require('@/assets/my/icon-more.png')"></image>
           </view>
           <view v-if="key < datas.length - 1" class="option-border"></view>
         </view>
@@ -23,23 +23,23 @@
         <view class="option-list">
           <view class="option-list_text">用户服务协议</view>
           <view class="option-list_img1">
-            <image mode src="@/assets/my/icon-more.png"></image>
+            <image mode :src="require('@/assets/my/icon-more.png')"></image>
           </view>
         </view>
       </view>
-      <view class="option" @tap="openDetail('rule')">
+      <!-- <view class="option" @tap="openDetail('rule')">
         <view class="option-list">
           <view class="option-list_text">余额服务须知</view>
           <view class="option-list_img1">
-            <image mode src="@/assets/my/icon-more.png"></image>
+            <image mode :src="require('@/assets/my/icon-more.png')"></image>
           </view>
         </view>
-      </view>
+      </view> -->
       <view class="option" @tap="openDetail('about')">
         <view class="option-list">
           <view class="option-list_text">关于我们</view>
           <view class="option-list_img1">
-            <image mode src="@/assets/my/icon-more.png"></image>
+            <image mode :src="require('@/assets/my/icon-more.png')"></image>
           </view>
         </view>
       </view>

+ 44 - 0
src/pages/index/index.scss

@@ -26,6 +26,50 @@
   }
 }
 
+.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: 52rpx;
+      height: 52rpx;
+      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-size: 100% auto;

+ 21 - 362
src/pages/index/index.vue

@@ -6,7 +6,7 @@
         :style="{ height: statusBarHeight + 'px' }"
       ></view>
       <view class="navBar" :style="{ height: titleBarHeight + 'px' }">
-        <image class="logo" src="@/assets/logo.png" mode=""></image>
+        <image class="logo" :src="require('@/assets/logo.png')" mode=""></image>
       </view>
     </view>
     <view :style="{ marginTop: BarHeight + 'px' }"></view>
@@ -29,239 +29,69 @@
         ></image>
       </swiper-item>
     </swiper>
-    <view
-      v-if="modules.shortcut_two && modules.shortcut_two.length"
-      class="banner"
-    >
-      <image
-        v-for="item in modules.shortcut_two"
-        :key="item.module_id"
-        class="banner-item"
-        :src="item.img"
-        mode="widthFix"
-        @click="jumpModuleAll(item.url)"
-      ></image>
-    </view>
-    <view
-      v-if="modules.shortcut_thtee && modules.shortcut_thtee.length"
-      class="banner"
-    >
-      <image
-        v-for="item in modules.shortcut_thtee"
-        :key="item.module_id"
-        class="banner-item"
-        :src="item.img"
-        mode="widthFix"
-        @click="jumpModuleAll(item.url)"
-      ></image>
-    </view>
-
-    <swiper
-      v-if="modules.banner_images && modules.banner_images.length > 1"
-      class="banner banner-swiper"
-      circular
-      indicator-dots
-      autoplay
-    >
-      <swiper-item v-for="item in modules.banner_images" :key="item.module_id">
-        <image
-          class="swiper-item"
-          :src="item.img"
-          mode=""
-          @click="jumpModuleAll(item.url)"
-        ></image>
-      </swiper-item>
-    </swiper>
-    <view
-      v-else-if="modules.banner_images && modules.banner_images.length"
-      class="banner"
-    >
-      <image
-        v-for="item in modules.banner_images"
+    <view class="icon-list" v-if="modules.shortcut && modules.shortcut.length">
+      <view
+        v-for="item in modules.shortcut"
         :key="item.module_id"
-        class="banner-item"
-        :src="item.img"
-        mode="widthFix"
+        class="icon-item"
         @click="jumpModuleAll(item.url)"
-      ></image>
-    </view>
-    <view v-if="lists.length > 0" id="tab" class="fill-title-wrap">
-      <view
-        :class="[
-          'fill-title',
-          'home-titlebar',
-          { 'home-titlebar-fix': fixtab },
-        ]"
-        :style="tabStyle"
       >
-        <view
-          v-for="item in listsArr"
-          :key="item.play_type"
-          :class="[
-            'fill-item',
-            { white: currentList.play_type === item.play_type },
-          ]"
-          @click="handleTabClick(item)"
-        >
-          <text>{{ item.name }}</text>
-        </view>
+        <image class="icon" :src="item.img"></image>
+        {{ item.name }}
       </view>
     </view>
-    <view
-      v-if="currentList.list.length === 0 && currentList.loading"
-      class="base-list"
-    >
-      <list-item v-for="item in 10" :key="item" class="base-list-item">
-      </list-item>
-    </view>
-    <view v-else class="base-list">
+    <view class="title">最新推荐</view>
+    <view v-if="modules.zxtj && modules.zxtj.length" class="base-list">
       <list-item
-        v-for="item in currentList.list"
-        :key="item.id"
+        v-for="item in modules.zxtj"
+        :key="item.module_id"
         :item="item"
         class="base-list-item"
         @click="handleDetail(item)"
       >
       </list-item>
     </view>
-    <view v-if="!currentList.loading && !currentList.hasMore" class="footer">
-      <view class="info">到底啦~ ( ̄▽ ̄)”</view>
-      <!-- <view class="contact">联系我们:oushen2022@126.com</view> -->
-    </view>
-    <uni-popup
-      ref="popup_coupon"
-      type="center"
-      mask-background-color="rgba(0,0,0,0.8)"
-      :is-mask-click="false"
-    >
-      <view class="popup_coupon">
-        <text class="title">送你新人大礼包</text>
-        <text class="desc">拆开看看吧</text>
-        <image
-          class="gifts"
-          src="https://chujianchaowan.oss-cn-beijing.aliyuncs.com/images/23115720b6416c5f5235ea69a069d528.png"
-        ></image>
-        <button class="coupon-button" @click="doReceive">立即拆开</button>
-        <image
-          class="popup_close"
-          :src="require('@/assets/icon/icon-close.png')"
-          @click="doClose('popup_coupon')"
-        >
-        </image>
-      </view>
-    </uni-popup>
-    <uni-popup
-      ref="popup_coupon_res"
-      type="center"
-      mask-background-color="rgba(0,0,0,0.8)"
-      :is-mask-click="false"
-    >
-      <view class="popup_coupon_res">
-        <text class="title">恭喜领取580新人大礼包</text>
-        <view class="coupon-list">
-          <view v-for="item in couponDatas" :key="item.id" class="coupon-item">
-            <view class="text">
-              <text
-                v-if="item.unit === '元' || item.unit === '¥'"
-                class="small"
-                >&yen;</text
-              >
-              <text class="big">{{ item.price }}</text>
-              <text
-                v-if="item.unit !== '元' && item.unit !== '¥'"
-                class="small"
-                >{{ item.unit }}</text
-              >
-            </view>
-            <view class="label"
-              ><text class="label-text">{{ item.name }}</text></view
-            >
-          </view>
-        </view>
-        <button class="coupon-button" @click="doClose('popup_coupon_res')">
-          立即使用
-        </button>
-        <image
-          class="popup_close"
-          :src="require('@/assets/icon/icon-close.png')"
-          @click="doClose('popup_coupon_res')"
-        >
-        </image>
-      </view>
-    </uni-popup>
-    <!-- <popup-signin
-      ref="popup_signin"
-      :list="singInfo && singInfo.data ? singInfo.data : []"
-      :isCurrentSignin="singInfo ? singInfo.is_current_signin : 0"
-      :session="userInfo && userInfo.session ? userInfo.session : ''"
-      @change="handleSigninChange"
-    ></popup-signin> -->
-    <!-- <task-btn v-if="showTask" /> -->
     <view class="fixed-btns">
-      <image
+      <!-- <image
         class="fixed-btn"
-        src="@/assets/icon/icon-btn-service.png"
+        :src="require('@/assets/icon/icon-btn-service.png')"
         @click="jumpModuleAll('/pages/help/help_contact')"
       ></image>
-      <!-- <image
+      <image
         class="fixed-btn"
-        src="@/assets/icon/icon-btn-message.png"
+        :src="require('@/assets/icon/icon-btn-message.png')"
         @click="jumpModuleAll('/pages/my/messages')"
-      ></image> -->
+      ></image>
+       -->
       <image
         v-if="showTask"
         class="fixed-btn"
-        src="@/assets/icon/icon-btn-sign.png"
+        :src="require('@/assets/icon/icon-btn-sign.png')"
         @click="jumpModuleAll('/pages/task/index')"
       ></image>
     </view>
   </view>
 </template>
 <script>
-import login from "@/lib/utils/login";
 import api from "@/lib/api/api";
 import listItem from "@/components/list-item/list-item.vue";
-// import popupSignin from "@/components/popup-signin/popup-signin.vue";
-// import homeSaleItem from "@/components/home-sale-item/home-sale-item.vue";
-// import taskBtn from "@/components/task-btn/task-btn.vue";
-import { reqAcceptSubMsgs, defaultTemplateIds } from "@/lib/utils/wxSubscribe";
 
 export default {
   name: "PageHome",
   components: {
     listItem,
-    // popupSignin,
-    // homeSaleItem,
-    // taskBtn,
   },
   data() {
     return {
       statusBarHeight: 0, // 自定义导航
       titleBarHeight: 44, // 自定义导航
       BarHeight: 0, // 自定义导航
-      fixtab: false,
-      scrollTop: 0,
-      datas: [],
       userInfo: {},
-      couponDatas: [],
-      receiveStatus: 0,
-      newStatus: 0,
       modules: {},
       tabStyle: "",
-      currentTab: "",
-      lists: [],
-      singInfo: null,
       showTask: false,
     };
   },
-  computed: {
-    currentList() {
-      return this.lists.find((i) => i.play_type === this.currentTab);
-    },
-    listsArr() {
-      return Object.keys(this.lists).map((key) => this.lists[key]);
-    },
-  },
   onLoad() {
     const uinfoStr = uni.getStorageSync("userinfo");
     if (uinfoStr) {
@@ -273,7 +103,6 @@ export default {
     this.loadModules().then(() => {
       uni.hideLoading();
     });
-    this.loadList(this.currentList);
   },
   onShow() {
     const uinfoStr = uni.getStorageSync("userinfo");
@@ -282,33 +111,6 @@ export default {
     } else {
       this.userInfo = {};
     }
-    if (!this.userInfo.session) {
-      this.getNewUserActivity();
-    }
-    this.getTaskInfo();
-    reqAcceptSubMsgs(defaultTemplateIds);
-  },
-  onPageScroll(e) {
-    this.scrollTop = e.scrollTop;
-    const tab = uni.createSelectorQuery().select("#tab");
-    tab
-      .fields(
-        {
-          rect: true,
-        },
-        (res) => {
-          if (res.top <= this.statusBarHeight + this.titleBarHeight) {
-            this.fixtab = true;
-            this.tabStyle = `top:${
-              this.statusBarHeight + this.titleBarHeight
-            }px;margin-top:0;`;
-          } else {
-            this.fixtab = false;
-            this.tabStyle = "";
-          }
-        }
-      )
-      .exec();
   },
   onShareAppMessage() {
     return {
@@ -326,21 +128,9 @@ export default {
       path: "/pages/index/index",
     };
   },
-  onPullDownRefresh() {
-    // this.lists = resetLists();
-
-    Promise.all([this.loadModules(), this.loadList(this.currentList)])
-      .then(() => {
-        uni.stopPullDownRefresh();
-      })
-      .catch(() => {
-        uni.stopPullDownRefresh();
-      });
-  },
-  onReachBottom() {
-    if (!this.currentList.loading && this.currentList.hasMore) {
-      this.loadList(this.currentList);
-    }
+  async onPullDownRefresh() {
+    await this.loadModules().catch((e) => console.log(e));
+    uni.stopPullDownRefresh();
   },
   mounted() {
     const systemInfo = uni.getSystemInfoSync();
@@ -377,9 +167,6 @@ export default {
     this.BarHeight = this.statusBarHeight + this.titleBarHeight;
   },
   methods: {
-    handleSigninChange(data) {
-      this.singInfo = data;
-    },
     async loadModules() {
       try {
         const data = await api.homeModules();
@@ -402,134 +189,6 @@ export default {
         });
       }
     },
-    // 获取优惠券列表
-    async getNewUserActivity() {
-      try {
-        const data = await api.getNewUserActivity();
-        if (data.errno == 10000) {
-          this.couponDatas = data.data;
-          if (this.couponDatas && this.couponDatas.length > 0) {
-            this.doShowCoupon("popup_coupon");
-            return true;
-          }
-          return false;
-        }
-        return false;
-      } catch (e) {
-        return false;
-      }
-    },
-    doReceive() {
-      uni.showLoading({
-        title: "加载中",
-        mask: true,
-      });
-      login.wxLogin((userInfo) => {
-        this.userInfo = userInfo;
-        uni.hideLoading();
-        this.getTaskInfo();
-        this.doClose("popup_coupon");
-        if (
-          userInfo.coupons &&
-          userInfo.coupons.is_bind_coupon === 1 &&
-          userInfo.coupons.coupons_info &&
-          userInfo.coupons.coupons_info.length
-        ) {
-          this.couponDatas = userInfo.coupons.coupons_info;
-          this.doShowCoupon("popup_coupon_res");
-          if (userInfo.coupons.is_bind_info_index) {
-            uni.showToast({
-              icon: "none",
-              title: userInfo.coupons.is_bind_info_index,
-              duration: 3000,
-            });
-          }
-        } else {
-          uni.showToast({
-            icon: "none",
-            title: "您已经领取过了~",
-            duration: 3000,
-          });
-        }
-      });
-    },
-    doShowCoupon(popup_ref) {
-      this.$refs[popup_ref].open();
-    },
-    doClose(popup_ref) {
-      this.$refs[popup_ref].close();
-    },
-    handleTabClick(item) {
-      if (this.currentTab === item.play_type) {
-        return;
-      }
-      this.currentTab = item.play_type;
-      if (item.list.length === 0 && item.hasMore) {
-        this.loadList(item);
-      }
-    },
-    async getTaskInfo() {
-      if (!this.userInfo.session) {
-        this.showTask = true;
-        return Promise.reject();
-      }
-      const data = await api.getTaskInfo(this.userInfo.session);
-      this.showTask = !data.is_current_signin;
-    },
-    async loadList(item) {
-      try {
-        const params = { session: this.userInfo?.session || "" };
-        if (item) {
-          params.play_type = item.play_type;
-          params.last_id = item.last_id;
-        }
-        const data = await api.homeListV3(params);
-
-        if (!this.lists.length) {
-          this.currentTab = Number(data.play_type);
-          this.lists = data.tab_list.map((tab) => {
-            tab.hasMore = true;
-            tab.loading = false;
-            tab.list = [];
-            return tab;
-          });
-        }
-
-        const currentTab = this.lists.find(
-          (i) => i.play_type === Number(data.play_type)
-        );
-
-        if (!currentTab.last_id || !currentTab.list) {
-          currentTab.list = data.data;
-        } else {
-          currentTab.list = currentTab.list.concat(data.data);
-        }
-
-        currentTab.last_id = data.last_id;
-        currentTab.loading = data.false;
-      } catch (e) {}
-    },
-    // async loadList(item) {
-    //   item.loading = true;
-    //   try {
-    //     const params = item.query;
-    //     if (item.query.page > 1 && item.list && item.list.length) {
-    //       params.lastId = item.list[item.list.length - 1].id;
-    //     } else {
-    //       params.lastId = 0;
-    //     }
-    //     const data = await api.homeList(item.query);
-    //     if (item.query.page === 1) {
-    //       item.list = data.data;
-    //     } else {
-    //       item.list = item.list.concat(data.data);
-    //     }
-
-    //     item.hasMore = item.query.page * item.query.size < data.total;
-    //     item.query.page++;
-    //   } catch (e) {}
-    //   item.loading = false;
-    // },
     jumpModuleAll(url) {
       if (!url) return;
 

+ 0 - 42
src/pages/my/coupon.scss

@@ -1,42 +0,0 @@
-.coupon-page {
-  background: #f5f5f5;
-  min-height: 100vh;
-  position: relative;
-  .tab {
-    width: 100%;
-    height: 76rpx;
-    background: #ffffff;
-    letter-spacing: 3rpx;
-    position: sticky;
-    top: 0;
-    z-index: 99;
-    .curr,
-    .his {
-      width: 50%;
-      text-align: center;
-      font-size: 32rpx;
-      font-weight: 500;
-      color: #9496a5;
-      text {
-        box-sizing: border-box;
-        display: inline-flex;
-        align-items: center;
-        justify-content: center;
-        height: 76rpx;
-      }
-    }
-    .cur {
-      color: #08c2c3;
-      text {
-        padding-top: 8rpx;
-        border-bottom: 8rpx solid #08c2c3;
-      }
-    }
-  }
-
-  .list {
-    padding-top: 24rpx;
-    position: relative;
-    z-index: 0;
-  }
-}

+ 42 - 1
src/pages/my/coupon.vue

@@ -90,5 +90,46 @@ export default {
 </script>
 
 <style lang="scss">
-@import "./coupon.scss";
+.coupon-page {
+  background: #f5f5f5;
+  min-height: 100vh;
+  position: relative;
+  .tab {
+    width: 100%;
+    height: 76rpx;
+    background: #ffffff;
+    letter-spacing: 3rpx;
+    position: sticky;
+    top: 0;
+    z-index: 99;
+    .curr,
+    .his {
+      width: 50%;
+      text-align: center;
+      font-size: 32rpx;
+      font-weight: 500;
+      color: #9496a5;
+      text {
+        box-sizing: border-box;
+        display: inline-flex;
+        align-items: center;
+        justify-content: center;
+        height: 76rpx;
+      }
+    }
+    .cur {
+      color: #08c2c3;
+      text {
+        padding-top: 8rpx;
+        border-bottom: 8rpx solid #08c2c3;
+      }
+    }
+  }
+
+  .list {
+    padding-top: 24rpx;
+    position: relative;
+    z-index: 0;
+  }
+}
 </style>