|
|
@@ -1,101 +1,125 @@
|
|
|
<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 class="wrap">
|
|
|
+ <view v-if="list && list.length" class="list">
|
|
|
+ <navigator
|
|
|
+ class="item"
|
|
|
+ v-for="item in list"
|
|
|
+ :key="item.id"
|
|
|
+ :url="`/pages/shop/detail?id=${item.id}`"
|
|
|
+ >
|
|
|
+ <image class="item-img" :src="item.banner"></image>
|
|
|
+ <view class="item-body">
|
|
|
+ <view class="item-name">{{ item.name }}</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="footer">
|
|
|
- <view class="info">到底啦~ ( ̄▽ ̄)”</view>
|
|
|
- <view class="contact">联系我们:oushen2022@126.com</view>
|
|
|
+ </navigator>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import api from "@/lib/api/api";
|
|
|
+import login from "@/lib/utils/login";
|
|
|
+import { getShopList } from "@/lib/api/shop";
|
|
|
+
|
|
|
export default {
|
|
|
- name: "PageList",
|
|
|
+ name: "PageHome",
|
|
|
data() {
|
|
|
return {
|
|
|
- datas: [],
|
|
|
- id: "",
|
|
|
+ statusBarHeight: 0, // 自定义导航
|
|
|
+ titleBarHeight: 44, // 自定义导航
|
|
|
+ BarHeight: 0, // 自定义导航
|
|
|
+ userInfo: {},
|
|
|
+ list: [],
|
|
|
+ tabStyle: "",
|
|
|
+ // showTask: false,
|
|
|
};
|
|
|
},
|
|
|
- onLoad(data) {
|
|
|
- this.id = data.id;
|
|
|
- this.loadModule(data.id);
|
|
|
+ async onLoad() {
|
|
|
+ this.userInfo = await login.getUserInfo();
|
|
|
+ uni.showLoading({
|
|
|
+ title: "加载中",
|
|
|
+ });
|
|
|
+ this.loadList().then(() => {
|
|
|
+ uni.hideLoading();
|
|
|
+ });
|
|
|
},
|
|
|
- // 分享
|
|
|
+ // onShow() {
|
|
|
+ // // this.getSingInfo();
|
|
|
+ // },
|
|
|
onShareAppMessage() {
|
|
|
return {
|
|
|
- title: "云果国潮,各种绝版大娃抽到飞起!",
|
|
|
+ title: "云果国潮会员中心",
|
|
|
+ imageUrl:
|
|
|
+ "https://yggc.oss-cn-beijing.aliyuncs.com/images/81d939394aea637ac0f6a3026d1a38e6.jpg",
|
|
|
+ path: "/pages/index/index",
|
|
|
};
|
|
|
},
|
|
|
- // 分享
|
|
|
onShareTimeline() {
|
|
|
return {
|
|
|
- title: "云果国潮,各种绝版大娃抽到飞起!",
|
|
|
+ title: "云果国潮会员中心",
|
|
|
+ imageUrl:
|
|
|
+ "https://yggc.oss-cn-beijing.aliyuncs.com/images/81d939394aea637ac0f6a3026d1a38e6.jpg",
|
|
|
+ path: "/pages/index/index",
|
|
|
};
|
|
|
},
|
|
|
- // 下拉刷新
|
|
|
- onPullDownRefresh() {
|
|
|
- this.loadModule(this.id, () => {
|
|
|
- uni.stopPullDownRefresh();
|
|
|
- });
|
|
|
+ async onPullDownRefresh() {
|
|
|
+ await this.loadList().catch((e) => console.log(e));
|
|
|
+ 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(() => {
|
|
|
+ async loadList() {
|
|
|
+ try {
|
|
|
+ const data = await getShopList();
|
|
|
+ if (data.errno == 10000) {
|
|
|
+ this.list = data.data;
|
|
|
+ // this.endTime = data.diff_time;
|
|
|
+ // this.runCd();
|
|
|
+ } else {
|
|
|
uni.showToast({
|
|
|
icon: "none",
|
|
|
- title: "出错啦,请稍后重试",
|
|
|
- duration: 2e3,
|
|
|
+ title: data.errmsg,
|
|
|
+ duration: 3000,
|
|
|
});
|
|
|
- if (cb) cb();
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: "出错啦,请稍后重试",
|
|
|
+ duration: 3000,
|
|
|
});
|
|
|
+ }
|
|
|
},
|
|
|
- jumpToDetail(data) {
|
|
|
- if (data.play_type == 2) {
|
|
|
+
|
|
|
+ // async getSingInfo() {
|
|
|
+ // if (!this.userInfo.session) {
|
|
|
+ // this.showTask = true;
|
|
|
+ // return Promise.reject();
|
|
|
+ // }
|
|
|
+ // const data = await getSingInfo(this.userInfo.session);
|
|
|
+ // this.showTask = !data.is_current_signin;
|
|
|
+ // },
|
|
|
+
|
|
|
+ jumpModuleAll(url) {
|
|
|
+ if (!url) return;
|
|
|
+
|
|
|
+ if (/^https?:\/\//i.test(url)) {
|
|
|
uni.navigateTo({
|
|
|
- url: `../detail/pinche?id=${data.id}`,
|
|
|
+ url: `../webview/webview?url=${encodeURIComponent(url)}`,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ [
|
|
|
+ "/pages/index/index",
|
|
|
+ "/pages/shop/index",
|
|
|
+ "/pages/activity/index",
|
|
|
+ "/pages/my/my",
|
|
|
+ ].includes(url)
|
|
|
+ ) {
|
|
|
+ uni.switchTab({
|
|
|
+ url,
|
|
|
});
|
|
|
} else {
|
|
|
uni.navigateTo({
|
|
|
- url: `../detail/detail?id=${data.id}`,
|
|
|
+ url,
|
|
|
});
|
|
|
}
|
|
|
},
|