|
|
@@ -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"
|
|
|
- >¥</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;
|
|
|
|