This commit is contained in:
ylj20011123 2025-09-05 18:37:20 +08:00
parent 93112d2e51
commit 781ceb7ab0
27 changed files with 1566 additions and 610 deletions

View File

@ -16,6 +16,11 @@ export default {
}, },
onLaunch: function (options) { onLaunch: function (options) {
console.log("onLaunch", options); console.log("onLaunch", options);
//
this.globalData.appLaunchTime = Date.now()
console.log('应用启动时间:', this.globalData.appLaunchTime)
this.setVisitChannels(options.scene); this.setVisitChannels(options.scene);
this.handleGetUserInfo(); this.handleGetUserInfo();
let _this = this; let _this = this;
@ -181,6 +186,7 @@ export default {
}, },
globalData: { globalData: {
initReady: null, // initReady: null, //
appLaunchTime: null, //
}, },
}; };
</script> </script>

View File

@ -116,15 +116,19 @@ export default {
} }
if (pageIndex === '/pages/shopMallPage/index/index') { if (pageIndex === '/pages/shopMallPage/index/index') {
if (this.comeForm === 'index') { // console.log('this.comeFormthis.comeFormthis.comeForm', this.comeForm);
uni.redirectTo({ uni.redirectTo({
url: '/pages/shopMallPage/index/index', url: `/pages/shopMallPage/index/index?pageType=${this.pageType}`,
}); });
} else { // if (this.comeForm === 'index') {
uni.navigateBack({ // uni.redirectTo({
delta: 1, // url: '/pages/shopMallPage/index/index',
}); // });
} // } else {
// uni.navigateBack({
// delta: 1,
// });
// }
} else if (pageIndex === "/pages/shopMallPage/shopCar/index") { } else if (pageIndex === "/pages/shopMallPage/shopCar/index") {
if (!this.user && !this.user.MEMBERSHIP_ID) { if (!this.user && !this.user.MEMBERSHIP_ID) {
@ -151,7 +155,7 @@ export default {
// 2 1 // 2 1
uni.setStorageSync("inShop", this.pageType ? 2 : 1) uni.setStorageSync("inShop", this.pageType ? 2 : 1)
uni.navigateTo({ uni.navigateTo({
url: "/pages/shopMallPage/user/newIndex", url: `/pages/shopMallPage/user/newIndex?pageType=${this.pageType}`,
}) })
} else { } else {
if (this.selectIndex === '/pages/shopMallPage/index/index') { if (this.selectIndex === '/pages/shopMallPage/index/index') {

View File

@ -448,11 +448,13 @@ import {
getDistanceBetweenCoordinates getDistanceBetweenCoordinates
} from '../../utils/publicMethods' } from '../../utils/publicMethods'
import { encryptAES, decryptAES } from '../../utils/handleAes' import { encryptAES, decryptAES } from '../../utils/handleAes'
import { useSkeletonControl } from '../../utils/skeletonManager.js'
export default { export default {
components: { tabbar }, components: { tabbar },
data() { data() {
return { return {
isPageLoading: true, isPageLoading: true,
skeletonControl: null, //
menu: {}, menu: {},
funList: [ funList: [
{ {
@ -615,7 +617,11 @@ export default {
everyWeekShopData: [],// everyWeekShopData: [],//
}; };
}, },
async onLoad() { async onLoad(options) {
//
this.skeletonControl = useSkeletonControl('/pages/index/index', options.pageType)
this.isPageLoading = this.skeletonControl.showSkeleton
// if (!this.user.MEMBERSHIP_ID) { // if (!this.user.MEMBERSHIP_ID) {
// uni.navigateTo({ url: `/pages/register/index?backTo=index` }); // uni.navigateTo({ url: `/pages/register/index?backTo=index` });
// } // }
@ -689,7 +695,14 @@ export default {
}); });
// //
this.isPageLoading = false; if (this.skeletonControl && this.skeletonControl.showSkeleton) {
// 访访
await this.skeletonControl.showContentAfterLoading(500)
this.isPageLoading = false
} else {
// 访
this.isPageLoading = false
}
// 广 // 广
this.$nextTick(() => { this.$nextTick(() => {
@ -710,6 +723,11 @@ export default {
}); });
}, },
async onShow() { async onShow() {
// onShow onLoad
//
if (!this.isPageLoading && this.skeletonControl && !this.skeletonControl.showSkeleton) {
// 访
}
let currentService = uni.getStorageSync("currentService"); let currentService = uni.getStorageSync("currentService");
if (currentService) { if (currentService) {
await this.handleGetServiceDetail(currentService.SERVERPART_ID); await this.handleGetServiceDetail(currentService.SERVERPART_ID);

View File

@ -1,6 +1,7 @@
<template> <template>
<scroll-view class="main" scroll-y @scroll="handlePageScroll" :scroll-into-view="scrollView" scroll-with-animation <scroll-view class="main" scroll-y @scroll="handlePageScroll" :scroll-into-view="scrollView" scroll-with-animation
@scrolltolower="handleScrollBottom" :style="{ @scrolltolower="handleScrollBottom" refresher-enabled :refresher-triggered="refresherTriggered"
@refresherrefresh="handleRefresh" refresher-threshold="45" :style="{
backgroundImage: backgroundImage:
pageType === 'UnionMall' pageType === 'UnionMall'
? 'url(https://eshangtech.com/minTestImg/pageBg.png)' ? 'url(https://eshangtech.com/minTestImg/pageBg.png)'
@ -731,12 +732,15 @@
<script> <script>
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import shopTabbar from "../../../components/shopTabbar.vue"; import shopTabbar from "../../../components/shopTabbar.vue";
import { useSkeletonControl } from '../../../utils/skeletonManager.js'
export default { export default {
components: { shopTabbar }, components: { shopTabbar },
data() { data() {
return { return {
showContent: false, // showContent: false, //
isFirstLoad: true, // isFirstLoad: true, //
skeletonControl: null, //
refresherTriggered: false, //
menu: {}, menu: {},
specialOffersList: [], // specialOffersList: [], //
weeklySpecialOffer: [], // weeklySpecialOffer: [], //
@ -808,6 +812,12 @@ export default {
async onLoad(query) { async onLoad(query) {
console.log("query", query); console.log("query", query);
console.log("user", this.user); console.log("user", this.user);
//
this.skeletonControl = useSkeletonControl('/pages/shopMallPage/index/index', query.pageType)
this.showContent = this.skeletonControl.showContent
this.isFirstLoad = this.skeletonControl.showSkeleton
this.menu = uni.getMenuButtonBoundingClientRect(); this.menu = uni.getMenuButtonBoundingClientRect();
this.pageType = query.pageType; this.pageType = query.pageType;
// //
@ -836,33 +846,60 @@ export default {
// this.globalData.recommendId = 2222; // this.globalData.recommendId = 2222;
if (query.pageType === "UnionMall") { if (query.pageType === "UnionMall") {
const data = await this.$api.$javaGet( try {
'/third-party/getWeChatGetMallGoodsType', const data = await this.$api.$javaGet(
{ '/third-party/getWeChatGetMallGoodsType',
ownerUnitId: 911, {
commodityNature: 5070, ownerUnitId: 911,
} commodityNature: 5070,
)
console.log("handleGetShopBigType", data);
let typeList = data.Data.List || [];
let resList = [];
let indexOfList = [1253, 1249, 1250, 3176];
if (typeList && typeList.length > 0) {
typeList.forEach((item) => {
if (indexOfList.indexOf(item.UserdefinedType_Id) !== -1) {
resList.push(item);
} }
)
console.log("工会商城商品类型数据:", data);
let typeList = data && data.Data && data.Data.List ? data.Data.List : [];
let resList = [];
let indexOfList = [1253, 1249, 1250, 3176];
console.log("工会商城类型列表:", typeList);
if (typeList && typeList.length > 0) {
typeList.forEach((item) => {
if (indexOfList.indexOf(item.UserdefinedType_Id) !== -1) {
resList.push(item);
}
});
}
this.sortType = Math.floor(Math.random() * this.sortTypeList.length);
this.shopTypeList = resList;
//
this.handleGetSortList();
//
this.handleGetUnionShopList();
//
if (this.skeletonControl && this.skeletonControl.showSkeleton) {
setTimeout(async () => {
if (this.skeletonControl) {
await this.skeletonControl.showContentAfterLoading(0)
this.showContent = true;
this.isFirstLoad = false;
}
}, 800);
} else {
// 访
this.showContent = true;
this.isFirstLoad = false;
}
} catch (error) {
console.error('工会商城数据加载失败:', error);
// 使
this.showContent = true;
this.isFirstLoad = false;
uni.showToast({
title: '数据加载失败,请稍后重试',
icon: 'none'
}); });
} }
this.sortType = Math.floor(Math.random() * this.sortTypeList.length);
this.shopTypeList = resList;
//
this.handleGetSortList();
//
this.handleGetUnionShopList();
} else { } else {
// uni.showLoading({ // uni.showLoading({
// title: "" // title: ""
@ -880,21 +917,26 @@ export default {
if (this.haveActivity) { if (this.haveActivity) {
this.handleGetActivityList(); this.handleGetActivityList();
} }
// 访访
if (this.skeletonControl && this.skeletonControl.showSkeleton) {
setTimeout(async () => {
if (this.skeletonControl) {
await this.skeletonControl.showContentAfterLoading(0)
this.showContent = true;
this.isFirstLoad = false;
}
}, 800);
} else {
// 访
this.showContent = true;
this.isFirstLoad = false;
}
// uni.hideLoading() // uni.hideLoading()
} }
}, },
onShow() { onShow() {
// // onShow onLoad
if (this.isFirstLoad) {
this.showContent = false;
setTimeout(() => {
this.showContent = true;
}, 800); //
this.isFirstLoad = false; //
} else {
//
this.showContent = true;
}
// 西 // 西
let shopCarList = []; let shopCarList = [];
@ -936,6 +978,126 @@ export default {
this.isFirstLoad = true; this.isFirstLoad = true;
}, },
methods: { methods: {
//
async handleRefresh() {
console.log('商城页面下拉刷新开始');
this.refresherTriggered = true;
try {
//
if (this.pageType === "UnionMall") {
await this.refreshUnionMallData();
} else {
await this.refreshNormalMallData();
}
//
} catch (error) {
console.error('刷新失败:', error);
uni.showToast({
title: '刷新失败,请重试',
icon: 'none',
duration: 2000
});
} finally {
//
setTimeout(() => {
this.refresherTriggered = false;
}, 1000);
}
},
//
async refreshUnionMallData() {
console.log('刷新工会商城数据');
//
uni.removeStorageSync('getWeChatGetMallGoodsType');
uni.removeStorageSync('newShowList');
uni.removeStorageSync('hotShopList');
uni.removeStorageSync('goodShopList');
//
const data = await this.$api.$javaGet(
'/third-party/getWeChatGetMallGoodsType',
{
ownerUnitId: 911,
commodityNature: 5070,
}
);
let typeList = data && data.Data && data.Data.List ? data.Data.List : [];
let resList = [];
let indexOfList = [1253, 1249, 1250, 3176];
if (typeList && typeList.length > 0) {
typeList.forEach((item) => {
if (indexOfList.indexOf(item.UserdefinedType_Id) !== -1) {
resList.push(item);
}
});
}
this.shopTypeList = resList;
//
this.newShopList = [];
this.hotShopList = [];
this.goodShopList = [];
//
await this.handleGetSortList();
//
this.shopMsg = {
pageIndex: 1,
pageSize: 6,
isOver: false,
};
this.showShopList = [];
await this.handleGetUnionShopList();
},
//
async refreshNormalMallData() {
console.log('刷新精选商城数据');
//
uni.removeStorageSync('getWeChatGetMallGoodsType');
uni.removeStorageSync('getWeChatGetMallGoodsInfoExclude');
uni.removeStorageSync('getWeChatGetMallGoodsInfo');
uni.removeStorageSync('getWeChatGetMallGoodsInfoExcludeToday');
//
this.shopMsg = {
pageIndex: 1,
pageSize: 6,
isOver: false,
};
//
this.specialOffersList = [];
this.weeklySpecialOffer = [];
this.todayOffersList = [];
this.productsList = [];
this.showShopList = [];
//
const refreshPromises = [
this.handleGetEveryWeekShop(), //
this.handleGetShopBigType(), //
this.handleGetSpecialOffers(), //
this.handleGetTodayOffers(), //
this.handleGetProductsList(), //
];
if (this.haveActivity) {
refreshPromises.push(this.handleGetActivityList());
}
await Promise.all(refreshPromises);
},
handleHideExportFun() { handleHideExportFun() {
this.showExportFun = false this.showExportFun = false
}, },
@ -1089,20 +1251,30 @@ export default {
}, },
// //
handleGetSortListShowData1(data1) { handleGetSortListShowData1(data1) {
let list1 = this.handleChangeShopList(data1.Data.List); console.log('新品榜数据:', data1);
const dataList = data1 && data1.Data && data1.Data.List ? data1.Data.List : [];
console.log('处理后的新品榜数据列表:', dataList);
let list1 = this.handleChangeShopList(dataList);
this.newShopList = list1.slice(0, 4); this.newShopList = list1.slice(0, 4);
console.log('最终新品榜:', this.newShopList);
// this.newShopList = [] // this.newShopList = []
}, },
// //
handleGetSortListShowData2(data2) { handleGetSortListShowData2(data2) {
let list2 = this.handleChangeShopList(data2.Data.List); console.log('热销榜数据:', data2);
const dataList = data2 && data2.Data && data2.Data.List ? data2.Data.List : [];
let list2 = this.handleChangeShopList(dataList);
this.hotShopList = list2.slice(0, 4); this.hotShopList = list2.slice(0, 4);
console.log('最终热销榜:', this.hotShopList);
// this.hotShopList = [] // this.hotShopList = []
}, },
// //
handleGetSortListShowData3(data3) { handleGetSortListShowData3(data3) {
let list3 = this.handleChangeShopList(data3.Data.List); console.log('推荐榜数据:', data3);
const dataList = data3 && data3.Data && data3.Data.List ? data3.Data.List : [];
let list3 = this.handleChangeShopList(dataList);
this.goodShopList = list3.slice(0, 4); this.goodShopList = list3.slice(0, 4);
console.log('最终推荐榜:', this.goodShopList);
// this.hotShopList = [] // this.hotShopList = []
}, },

View File

@ -14,7 +14,7 @@
<view class="pageName">{{ <view class="pageName">{{
bigPageType === "UnionMall" ? "工会之家" : "购物车" bigPageType === "UnionMall" ? "工会之家" : "购物车"
}}</view> }}</view>
<view class="backArrow"></view> <view class="backArrowBox"></view>
</view> </view>
<!-- 地址选择区域骨架 --> <!-- 地址选择区域骨架 -->
@ -29,7 +29,8 @@
"> ">
<div class="topLeft"> <div class="topLeft">
<view style="display: flex; align-items: center"> <view style="display: flex; align-items: center">
<view class="skeleton skeleton-location-icon-small" style="width: 16px; height: 16px; margin-right: 4px;"></view> <view class="skeleton skeleton-location-icon-small" style="width: 16px; height: 16px; margin-right: 4px;">
</view>
<view class="skeleton skeleton-address-text" style="width: 200px; height: 20px;"></view> <view class="skeleton skeleton-address-text" style="width: 200px; height: 20px;"></view>
</view> </view>
<view style="margin-top: 8rpx"> <view style="margin-top: 8rpx">
@ -272,12 +273,14 @@
<script> <script>
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import shopTabbar from "../../../components/shopTabbar.vue"; import shopTabbar from "../../../components/shopTabbar.vue";
import { useSkeletonControl } from '../../../utils/skeletonManager.js'
export default { export default {
components: { shopTabbar }, components: { shopTabbar },
data() { data() {
return { return {
showContent: false, // showContent: false, //
isFirstLoad: true, // isFirstLoad: true, //
skeletonControl: null, //
menu: {}, // menu: {}, //
pageType: "normal", // normal pageType: "normal", // normal
shopList: [], // shopList: [], //
@ -327,6 +330,11 @@ export default {
}), }),
}, },
async onLoad(query) { async onLoad(query) {
//
this.skeletonControl = useSkeletonControl('/pages/shopMallPage/shopCar/index', query.pageType)
this.showContent = this.skeletonControl.showContent
this.isFirstLoad = this.skeletonControl.showSkeleton
console.log("query", query); console.log("query", query);
let height = uni.getStorageSync("safeHeight"); let height = uni.getStorageSync("safeHeight");
@ -352,22 +360,27 @@ export default {
this.handleGetNowShopCarList(); this.handleGetNowShopCarList();
this.handleSum(); this.handleSum();
// this.$utils.addUserBehaviorNew(); // this.$utils.addUserBehaviorNew();
// 访访
if (this.skeletonControl && this.skeletonControl.showSkeleton) {
setTimeout(async () => {
if (this.skeletonControl) {
await this.skeletonControl.showContentAfterLoading(0)
this.showContent = true;
this.isFirstLoad = false;
}
}, 800);
} else {
// 访
this.showContent = true;
this.isFirstLoad = false;
}
this.$utils.addUserBehaviorNew({ this.$utils.addUserBehaviorNew({
behaviorRecordDesc: this.bigPageType ? '进入工会商城购物车' : "进入精选商城购物车" behaviorRecordDesc: this.bigPageType ? '进入工会商城购物车' : "进入精选商城购物车"
}); });
}, },
onShow() { onShow() {
// // onShow onLoad
if (this.isFirstLoad) {
this.showContent = false;
setTimeout(() => {
this.showContent = true;
}, 800); //
this.isFirstLoad = false; //
} else {
//
this.showContent = true;
}
// 西 // 西
let shopCarList = []; let shopCarList = [];
@ -1546,8 +1559,13 @@ export default {
} }
@keyframes loading { @keyframes loading {
0% { background-position: 200% 0; } 0% {
100% { background-position: -200% 0; } background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
} }
/* 顶部地址选择区域骨架样式 */ /* 顶部地址选择区域骨架样式 */

View File

@ -325,6 +325,7 @@ import { mapGetters } from "vuex";
import NoData from "../../../components/noData.vue"; import NoData from "../../../components/noData.vue";
import shopTabbar from "../../../components/shopTabbar.vue"; import shopTabbar from "../../../components/shopTabbar.vue";
import CustomImage from './components/CustomImage.vue' import CustomImage from './components/CustomImage.vue'
import { useSkeletonControl } from '../../../utils/skeletonManager.js'
export default { export default {
components: { shopTabbar, NoData, CustomImage }, components: { shopTabbar, NoData, CustomImage },
@ -332,6 +333,7 @@ export default {
return { return {
showContent: false, // showContent: false, //
isFirstLoad: true, // isFirstLoad: true, //
skeletonControl: null, //
menu: {}, // menu: {}, //
searchText: "", // searchText: "", //
shopTypeList: [], // shopTypeList: [], //
@ -422,6 +424,11 @@ export default {
}, },
}, },
onLoad(query) { onLoad(query) {
//
this.skeletonControl = useSkeletonControl('/pages/shopMallPage/shopType/index', query.pageType)
this.showContent = this.skeletonControl.showContent
this.isFirstLoad = this.skeletonControl.showSkeleton
let systemInfo = uni.getSystemInfoSync(); let systemInfo = uni.getSystemInfoSync();
this.systemInfo = systemInfo; this.systemInfo = systemInfo;
@ -464,22 +471,27 @@ export default {
// this.handleGetAllShopItem(); // this.handleGetAllShopItem();
} }
// this.onVirtualScroll = this.throttle(this.onVirtualScroll, 100); // // this.onVirtualScroll = this.throttle(this.onVirtualScroll, 100); //
// 访访
if (this.skeletonControl && this.skeletonControl.showSkeleton) {
setTimeout(async () => {
if (this.skeletonControl) {
await this.skeletonControl.showContentAfterLoading(0)
this.showContent = true;
this.isFirstLoad = false;
}
}, 800);
} else {
// 访
this.showContent = true;
this.isFirstLoad = false;
}
this.$utils.addUserBehaviorNew({ this.$utils.addUserBehaviorNew({
behaviorRecordDesc: this.pageType ? '进入工会商城分类页' : "进入精选商城分类页" behaviorRecordDesc: this.pageType ? '进入工会商城分类页' : "进入精选商城分类页"
}); });
}, },
onShow() { onShow() {
// // onShow onLoad
if (this.isFirstLoad) {
this.showContent = false;
setTimeout(() => {
this.showContent = true;
}, 800); //
this.isFirstLoad = false; //
} else {
//
this.showContent = true;
}
this.menu = uni.getMenuButtonBoundingClientRect(); this.menu = uni.getMenuButtonBoundingClientRect();
// 西 // 西

View File

@ -139,7 +139,7 @@
<view class="CouponItem" @click="handleGoPoint"> <view class="CouponItem" @click="handleGoPoint">
<view class="CouponItemValue">{{ <view class="CouponItemValue">{{
$utils.handleFormatNumber(userInfo.MEMBERSHIP_POINT || 0) $utils.handleFormatNumber(userInfo.MEMBERSHIP_POINT || 0)
}}</view> }}</view>
<view class="CouponItemLabel">积分</view> <view class="CouponItemLabel">积分</view>
</view> </view>
<!-- <view class="line"></view> <!-- <view class="line"></view>
@ -326,7 +326,7 @@
</view> </view>
<shop-tabbar :page="`/pages/shopMallPage/user/newIndex`" :pageType="bigPageType" <shop-tabbar :page="`/pages/shopMallPage/user/newIndex`" :pageType="bigPageType"
:shopCarLength="shopCarListCount" /> :shopCarLength="shopCarListCount" :comeForm="comeForm" />
</view> </view>
</template> </template>
@ -335,11 +335,13 @@
import { handleSaveOrderStore } from '../../../utils/publicMethods' import { handleSaveOrderStore } from '../../../utils/publicMethods'
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import shopTabbar from "../../../components/shopTabbar.vue"; import shopTabbar from "../../../components/shopTabbar.vue";
import { useSkeletonControl } from '../../../utils/skeletonManager.js'
export default { export default {
components: { shopTabbar }, components: { shopTabbar },
data() { data() {
return { return {
showContent: false, // showContent: false, //
skeletonControl: null, //
isFirstLoad: true, // isFirstLoad: true, //
pageType: "", // spring pageType: "", // spring
menu: {}, menu: {},
@ -420,18 +422,23 @@ export default {
mallOrderCountList: [0, 0, 0],// mallOrderCountList: [0, 0, 0],//
foodOrderCountList: [0, 0, 0],// foodOrderCountList: [0, 0, 0],//
bigPageType: "",// bigPageType: "",//
comeForm: "",//
}; };
}, },
async onLoad(query) { async onLoad(query) {
console.log("queryqueryqueryqueryquery", query); console.log("queryqueryqueryqueryquery", query);
//
this.skeletonControl = useSkeletonControl('/pages/shopMallPage/user/newIndex', query.pageType)
this.showContent = this.skeletonControl.showContent
this.isFirstLoad = this.skeletonControl.showSkeleton
if (query.pageType) { if (query.pageType) {
this.bigPageType = query.pageType this.bigPageType = query.pageType
} }
if (query.comeForm) {
// this.comeForm = query.comeForm;
this.isFirstLoad = true; }
this.showContent = false;
if (!this.user.MEMBERSHIP_ID) { if (!this.user.MEMBERSHIP_ID) {
uni.navigateTo({ url: "/pages/register/index" }); uni.navigateTo({ url: "/pages/register/index" });
} }
@ -462,22 +469,27 @@ export default {
// await this.handleGetCarCode(); // await this.handleGetCarCode();
// 访访
if (this.skeletonControl && this.skeletonControl.showSkeleton) {
setTimeout(async () => {
if (this.skeletonControl) {
await this.skeletonControl.showContentAfterLoading(0)
this.showContent = true;
this.isFirstLoad = false;
}
}, 500);
} else {
// 访
this.showContent = true;
this.isFirstLoad = false;
}
this.$utils.addUserBehaviorNew({ this.$utils.addUserBehaviorNew({
behaviorRecordDesc: "进入了我的页面" behaviorRecordDesc: "进入了我的页面"
}); });
}, },
async onShow() { async onShow() {
// // onShow onLoad
if (this.isFirstLoad) {
this.showContent = false;
setTimeout(() => {
this.showContent = true;
this.isFirstLoad = false; //
}, 500);
} else {
//
this.showContent = true;
}
let inShop = uni.getStorageSync("inShop"); let inShop = uni.getStorageSync("inShop");
this.inShop = inShop this.inShop = inShop
@ -559,7 +571,8 @@ export default {
this.userInfo = userData this.userInfo = userData
this.cards = userData.LicencePlate.List && userData.LicencePlate.List.length > 0 ? userData.LicencePlate.List[0].License_Plate : "" this.cards = userData.LicencePlate.List && userData.LicencePlate.List.length > 0 ? userData.LicencePlate.List[0].License_Plate : ""
} }
this.$forceUpdate() // onShow
// this.$forceUpdate()
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
@ -2234,8 +2247,13 @@ export default {
} }
@keyframes loading { @keyframes loading {
0% { background-position: 200% 0; } 0% {
100% { background-position: -200% 0; } background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
} }
/* 用户顶部信息骨架 */ /* 用户顶部信息骨架 */

View File

@ -314,12 +314,14 @@ import { handleSaveOrderStore } from '../../utils/publicMethods'
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import tabbar from "../../components/tabbar.vue"; import tabbar from "../../components/tabbar.vue";
import shopTabbar from "../../components/shopTabbar.vue"; import shopTabbar from "../../components/shopTabbar.vue";
import { useSkeletonControl } from '../../utils/skeletonManager.js'
export default { export default {
components: { tabbar, shopTabbar }, components: { tabbar, shopTabbar },
data() { data() {
return { return {
showContent: false, // showContent: false, //
isFirstLoad: true, // isFirstLoad: true, //
skeletonControl: null, //
pageType: "", // spring pageType: "", // spring
menu: {}, menu: {},
orderFunList: [ orderFunList: [
@ -400,10 +402,11 @@ export default {
foodOrderCountList: [0, 0, 0],// foodOrderCountList: [0, 0, 0],//
}; };
}, },
async onLoad() { async onLoad(options) {
// //
this.isFirstLoad = true; this.skeletonControl = useSkeletonControl('/pages/user/index', options.pageType)
this.showContent = false; this.showContent = this.skeletonControl.showContent
this.isFirstLoad = this.skeletonControl.showSkeleton
if (!this.user.MEMBERSHIP_ID) { if (!this.user.MEMBERSHIP_ID) {
uni.navigateTo({ url: `/pages/register/index?backTo=index` }); uni.navigateTo({ url: `/pages/register/index?backTo=index` });
@ -439,20 +442,29 @@ export default {
// await this.handleGetCarCode(); // await this.handleGetCarCode();
// 访访
if (this.skeletonControl && this.skeletonControl.showSkeleton) {
setTimeout(async () => {
if (this.skeletonControl) {
await this.skeletonControl.showContentAfterLoading(0)
this.showContent = true;
this.isFirstLoad = false;
}
}, 500);
} else {
// 访
this.showContent = true;
this.isFirstLoad = false;
}
this.$utils.addUserBehaviorNew({ this.$utils.addUserBehaviorNew({
behaviorRecordDesc: "进入了我的页面" behaviorRecordDesc: "进入了我的页面"
}); });
}, },
async onShow() { async onShow() {
// // onShow onLoad
if (this.isFirstLoad) { //
this.showContent = false; if (!this.isFirstLoad) {
setTimeout(() => {
this.showContent = true;
this.isFirstLoad = false; //
}, 500);
} else {
//
this.showContent = true; this.showContent = true;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -131,6 +131,10 @@ var _default = {
})), })),
onLaunch: function onLaunch(options) { onLaunch: function onLaunch(options) {
console.log("onLaunch", options); console.log("onLaunch", options);
// 设置应用启动时间戳,用于骨架屏管理
this.globalData.appLaunchTime = Date.now();
console.log('应用启动时间:', this.globalData.appLaunchTime);
this.setVisitChannels(options.scene); this.setVisitChannels(options.scene);
this.handleGetUserInfo(); this.handleGetUserInfo();
var _this = this; var _this = this;
@ -296,7 +300,9 @@ var _default = {
}), }),
globalData: { globalData: {
initReady: null // 用于页面等待初始化完成 initReady: null,
// 用于页面等待初始化完成
appLaunchTime: null // 应用启动时间戳,用于骨架屏管理
} }
}; };
exports.default = _default; exports.default = _default;

View File

@ -15957,6 +15957,194 @@ module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module
/***/ }), /***/ }),
/***/ 737:
/*!****************************************************************!*\
!*** E:/workfile/minprogram/caiyunyi/utils/skeletonManager.js ***!
\****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
exports.useSkeletonControl = useSkeletonControl;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
/**
* 骨架屏管理器
* 用于控制页面骨架屏的显示逻辑
*
* 逻辑说明
* 1. 首次进入小程序时每个页面第一次访问都显示骨架屏
* 2. 对于带pageType参数的页面每个不同的pageType都算作一次新页面访问
* 3. 后续访问相同页面相同pageType不显示骨架屏
*/
var SkeletonManager = /*#__PURE__*/function () {
function SkeletonManager() {
(0, _classCallCheck2.default)(this, SkeletonManager);
this.visitedPages = new Set(); // 存储已访问的页面标识
this.currentAppSession = null; // 当前小程序会话ID
this.init();
}
/**
* 初始化从缓存中恢复已访问页面记录
*/
(0, _createClass2.default)(SkeletonManager, [{
key: "init",
value: function init() {
try {
var _getApp$globalData;
// 检查是否是新的小程序启动(应用级生命周期)
var appLaunchTime = ((_getApp$globalData = getApp().globalData) === null || _getApp$globalData === void 0 ? void 0 : _getApp$globalData.appLaunchTime) || Date.now();
var lastAppLaunchTime = uni.getStorageSync('lastAppLaunchTime');
if (!lastAppLaunchTime || lastAppLaunchTime !== appLaunchTime) {
// 新的应用启动,清空所有已访问记录
this.visitedPages = new Set();
uni.removeStorageSync('visitedPages');
uni.setStorageSync('lastAppLaunchTime', appLaunchTime);
console.log('骨架屏管理器: 检测到新的小程序启动,重置访问记录');
} else {
// 同一次应用启动,恢复已访问记录
var cachedVisitedPages = uni.getStorageSync('visitedPages');
if (cachedVisitedPages && Array.isArray(cachedVisitedPages)) {
this.visitedPages = new Set(cachedVisitedPages);
console.log('骨架屏管理器: 恢复已访问记录', cachedVisitedPages);
}
}
} catch (error) {
console.warn('骨架屏管理器初始化失败:', error);
this.visitedPages = new Set();
}
}
/**
* 生成页面标识
* @param {string} pagePath - 页面路径
* @param {string} pageType - 页面类型参数可选
* @returns {string} 页面唯一标识
*/
}, {
key: "generatePageKey",
value: function generatePageKey(pagePath) {
var pageType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
if (pageType) {
return "".concat(pagePath, "?pageType=").concat(pageType);
}
return pagePath;
}
/**
* 检查是否应该显示骨架屏
* @param {string} pagePath - 页面路径
* @param {string} pageType - 页面类型参数可选
* @returns {boolean} 是否显示骨架屏
*/
}, {
key: "shouldShowSkeleton",
value: function shouldShowSkeleton(pagePath) {
var pageType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var pageKey = this.generatePageKey(pagePath, pageType);
var shouldShow = !this.visitedPages.has(pageKey);
console.log("\u9AA8\u67B6\u5C4F\u68C0\u67E5 ".concat(pageKey, ": ").concat(shouldShow ? '需要显示' : '已访问过'), "\u5F53\u524D\u5DF2\u8BBF\u95EE\u9875\u9762:", Array.from(this.visitedPages));
return shouldShow;
}
/**
* 标记页面已访问
* @param {string} pagePath - 页面路径
* @param {string} pageType - 页面类型参数可选
*/
}, {
key: "markPageVisited",
value: function markPageVisited(pagePath) {
var pageType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var pageKey = this.generatePageKey(pagePath, pageType);
this.visitedPages.add(pageKey);
this.saveToCache();
console.log("\u9AA8\u67B6\u5C4F\u6807\u8BB0\u5DF2\u8BBF\u95EE: ".concat(pageKey), "\u5F53\u524D\u5DF2\u8BBF\u95EE\u9875\u9762:", Array.from(this.visitedPages));
}
/**
* 保存访问记录到缓存
*/
}, {
key: "saveToCache",
value: function saveToCache() {
try {
uni.setStorageSync('visitedPages', Array.from(this.visitedPages));
} catch (error) {
console.warn('保存骨架屏访问记录失败:', error);
}
}
/**
* 清除所有访问记录用于重置状态比如用户重新打开小程序
*/
}, {
key: "clearAllVisited",
value: function clearAllVisited() {
this.visitedPages.clear();
uni.removeStorageSync('visitedPages');
}
/**
* 获取页面骨架屏控制状态
* 返回一个包含状态和控制方法的对象
* @param {string} pagePath - 页面路径
* @param {string} pageType - 页面类型参数可选
* @returns {object} 控制状态对象
*/
}, {
key: "getPageSkeletonControl",
value: function getPageSkeletonControl(pagePath) {
var _this = this;
var pageType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var shouldShow = this.shouldShowSkeleton(pagePath, pageType);
return {
// 是否显示骨架屏
showSkeleton: shouldShow,
// 是否显示内容
showContent: !shouldShow,
// 标记页面已访问的方法
markVisited: function markVisited() {
_this.markPageVisited(pagePath, pageType);
},
// 手动控制显示内容的方法(用于异步加载完成后)
showContentAfterLoading: function showContentAfterLoading() {
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
return new Promise(function (resolve) {
setTimeout(function () {
_this.markPageVisited(pagePath, pageType);
resolve(true);
}, delay);
});
}
};
}
}]);
return SkeletonManager;
}(); // 创建全局单例
var skeletonManager = new SkeletonManager();
// 导出工厂函数,用于在页面中快速获取控制状态
function useSkeletonControl(pagePath) {
var pageType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return skeletonManager.getPageSkeletonControl(pagePath, pageType);
}
// 导出管理器实例(用于高级操作)
var _default = skeletonManager;
exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/***/ }),
/***/ 8: /***/ 8:
/*!***************************************************************************!*\ /*!***************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***! !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!

View File

@ -179,15 +179,19 @@ var _default = {
return; return;
} }
if (pageIndex === '/pages/shopMallPage/index/index') { if (pageIndex === '/pages/shopMallPage/index/index') {
if (this.comeForm === 'index') { // console.log('this.comeFormthis.comeFormthis.comeForm', this.comeForm);
uni.redirectTo({ uni.redirectTo({
url: '/pages/shopMallPage/index/index' url: "/pages/shopMallPage/index/index?pageType=".concat(this.pageType)
}); });
} else { // if (this.comeForm === 'index') {
uni.navigateBack({ // uni.redirectTo({
delta: 1 // url: '/pages/shopMallPage/index/index',
}); // });
} // } else {
// uni.navigateBack({
// delta: 1,
// });
// }
} else if (pageIndex === "/pages/shopMallPage/shopCar/index") { } else if (pageIndex === "/pages/shopMallPage/shopCar/index") {
if (!this.user && !this.user.MEMBERSHIP_ID) { if (!this.user && !this.user.MEMBERSHIP_ID) {
uni.showModal({ uni.showModal({
@ -216,7 +220,7 @@ var _default = {
// 判断是不是在购物车里面 2 表示工会商城 1 表示精选商城 // 判断是不是在购物车里面 2 表示工会商城 1 表示精选商城
uni.setStorageSync("inShop", this.pageType ? 2 : 1); uni.setStorageSync("inShop", this.pageType ? 2 : 1);
uni.navigateTo({ uni.navigateTo({
url: "/pages/shopMallPage/user/newIndex" url: "/pages/shopMallPage/user/newIndex?pageType=".concat(this.pageType)
}); });
} else { } else {
if (this.selectIndex === '/pages/shopMallPage/index/index') { if (this.selectIndex === '/pages/shopMallPage/index/index') {

View File

@ -290,6 +290,7 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/r
var _vuex = __webpack_require__(/*! vuex */ 33); var _vuex = __webpack_require__(/*! vuex */ 33);
var _publicMethods = __webpack_require__(/*! ../../utils/publicMethods */ 60); var _publicMethods = __webpack_require__(/*! ../../utils/publicMethods */ 60);
var _handleAes = __webpack_require__(/*! ../../utils/handleAes */ 47); var _handleAes = __webpack_require__(/*! ../../utils/handleAes */ 47);
var _skeletonManager = __webpack_require__(/*! ../../utils/skeletonManager.js */ 737);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var tabbar = function tabbar() { var tabbar = function tabbar() {
@ -304,6 +305,8 @@ var _default = {
data: function data() { data: function data() {
return { return {
isPageLoading: true, isPageLoading: true,
skeletonControl: null,
// 骨架屏控制器
menu: {}, menu: {},
funList: [{ funList: [{
label: "服务区", label: "服务区",
@ -458,7 +461,7 @@ var _default = {
everyWeekShopData: [] // 每周特惠数据 everyWeekShopData: [] // 每周特惠数据
}; };
}, },
onLoad: function onLoad() { onLoad: function onLoad(options) {
var _this2 = this; var _this2 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
var systemInfo, height, currentService, seatInfo, res, funList, newFunList, loadPromises; var systemInfo, height, currentService, seatInfo, res, funList, newFunList, loadPromises;
@ -466,6 +469,10 @@ var _default = {
while (1) { while (1) {
switch (_context.prev = _context.next) { switch (_context.prev = _context.next) {
case 0: case 0:
// 初始化骨架屏控制
_this2.skeletonControl = (0, _skeletonManager.useSkeletonControl)('/pages/index/index', options.pageType);
_this2.isPageLoading = _this2.skeletonControl.showSkeleton;
// if (!this.user.MEMBERSHIP_ID) { // if (!this.user.MEMBERSHIP_ID) {
// uni.navigateTo({ url: `/pages/register/index?backTo=index` }); // uni.navigateTo({ url: `/pages/register/index?backTo=index` });
// } // }
@ -504,9 +511,9 @@ var _default = {
} else { } else {
uni.setStorageSync("funList", JSON.stringify(_this2.funList)); uni.setStorageSync("funList", JSON.stringify(_this2.funList));
} }
_context.next = 11; _context.next = 13;
return _this2.handleGetAdvertisementData(); return _this2.handleGetAdvertisementData();
case 11: case 13:
// 并行加载所有数据 // 并行加载所有数据
loadPromises = [_this2.handleGetHighwayHeadlines(), loadPromises = [_this2.handleGetHighwayHeadlines(),
// 高速头条播报 // 高速头条播报
@ -523,25 +530,37 @@ var _default = {
} }
// 等待所有数据加载完成 // 等待所有数据加载完成
_context.prev = 13; _context.prev = 15;
_context.next = 16; _context.next = 18;
return Promise.all(loadPromises); return Promise.all(loadPromises);
case 16:
_context.next = 21;
break;
case 18: case 18:
_context.prev = 18; _context.next = 23;
_context.t0 = _context["catch"](13); break;
case 20:
_context.prev = 20;
_context.t0 = _context["catch"](15);
console.error('数据加载失败:', _context.t0); console.error('数据加载失败:', _context.t0);
case 21: case 23:
// this.handleAes() // this.handleAes()
_this2.$utils.addUserBehaviorNew({ _this2.$utils.addUserBehaviorNew({
behaviorRecordDesc: "进入了首页" behaviorRecordDesc: "进入了首页"
}); });
// 所有数据加载完成,隐藏骨架屏 // 所有数据加载完成,隐藏骨架屏
if (!(_this2.skeletonControl && _this2.skeletonControl.showSkeleton)) {
_context.next = 30;
break;
}
_context.next = 27;
return _this2.skeletonControl.showContentAfterLoading(500);
case 27:
_this2.isPageLoading = false; _this2.isPageLoading = false;
_context.next = 31;
break;
case 30:
// 非首次访问直接显示内容
_this2.isPageLoading = false;
case 31:
// 骨架屏结束后显示广告弹窗 // 骨架屏结束后显示广告弹窗
_this2.$nextTick(function () { _this2.$nextTick(function () {
// 稍微延迟一下让页面渲染完成 // 稍微延迟一下让页面渲染完成
@ -559,12 +578,12 @@ var _default = {
} }
}, 300); }, 300);
}); });
case 24: case 32:
case "end": case "end":
return _context.stop(); return _context.stop();
} }
} }
}, _callee, null, [[13, 18]]); }, _callee, null, [[15, 20]]);
}))(); }))();
}, },
onShow: function onShow() { onShow: function onShow() {
@ -575,14 +594,19 @@ var _default = {
while (1) { while (1) {
switch (_context2.prev = _context2.next) { switch (_context2.prev = _context2.next) {
case 0: case 0:
// onShow 中不控制骨架屏,骨架屏只在 onLoad 中控制一次
// 如果不是首次加载,直接显示内容
if (!_this4.isPageLoading && _this4.skeletonControl && !_this4.skeletonControl.showSkeleton) {
// 非首次访问,确保内容显示
}
currentService = uni.getStorageSync("currentService"); currentService = uni.getStorageSync("currentService");
if (!currentService) { if (!currentService) {
_context2.next = 9; _context2.next = 10;
break; break;
} }
_context2.next = 4; _context2.next = 5;
return _this4.handleGetServiceDetail(currentService.SERVERPART_ID); return _this4.handleGetServiceDetail(currentService.SERVERPART_ID);
case 4: case 5:
// this.serviceDetail = currentService; // this.serviceDetail = currentService;
obj = _this4.handleMergeDetail(currentService); obj = _this4.handleMergeDetail(currentService);
newObj = _objectSpread(_objectSpread({}, currentService), {}, { newObj = _objectSpread(_objectSpread({}, currentService), {}, {
@ -599,7 +623,7 @@ var _default = {
if (idList.indexOf(_this4.serviceDetail.SERVERPART_ID) !== -1) { if (idList.indexOf(_this4.serviceDetail.SERVERPART_ID) !== -1) {
_this4.handleGetChargingStation(_this4.serviceDetail); _this4.handleGetChargingStation(_this4.serviceDetail);
} }
case 9: case 10:
funList = uni.getStorageSync("funList"); funList = uni.getStorageSync("funList");
if (funList) { if (funList) {
newFunList = JSON.parse(funList); newFunList = JSON.parse(funList);
@ -628,7 +652,7 @@ var _default = {
// this.funList = fun; // this.funList = fun;
// this.$forceUpdate(); // this.$forceUpdate();
// } // }
case 11: case 12:
case "end": case "end":
return _context2.stop(); return _context2.stop();
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -198,6 +198,7 @@ var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runt
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 32)); var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 32));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11)); var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
var _vuex = __webpack_require__(/*! vuex */ 33); var _vuex = __webpack_require__(/*! vuex */ 33);
var _skeletonManager = __webpack_require__(/*! ../../../utils/skeletonManager.js */ 737);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var shopTabbar = function shopTabbar() { var shopTabbar = function shopTabbar() {
@ -215,6 +216,8 @@ var _default = {
// 是否显示内容(控制骨架屏切换) // 是否显示内容(控制骨架屏切换)
isFirstLoad: true, isFirstLoad: true,
// 是否是首次进入页面 // 是否是首次进入页面
skeletonControl: null,
// 骨架屏控制器
menu: {}, menu: {},
// 手机基本信息 // 手机基本信息
pageType: "normal", pageType: "normal",
@ -283,12 +286,16 @@ var _default = {
})), })),
onLoad: function onLoad(query) { onLoad: function onLoad(query) {
var _this2 = this; var _this2 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
var height, systemInfo; var height, systemInfo;
return _regenerator.default.wrap(function _callee$(_context) { return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) { while (1) {
switch (_context.prev = _context.next) { switch (_context2.prev = _context2.next) {
case 0: case 0:
// 初始化骨架屏控制
_this2.skeletonControl = (0, _skeletonManager.useSkeletonControl)('/pages/shopMallPage/shopCar/index', query.pageType);
_this2.showContent = _this2.skeletonControl.showContent;
_this2.isFirstLoad = _this2.skeletonControl.showSkeleton;
console.log("query", query); console.log("query", query);
height = uni.getStorageSync("safeHeight"); height = uni.getStorageSync("safeHeight");
_this2.safeHeight = Number(height); _this2.safeHeight = Number(height);
@ -302,41 +309,58 @@ var _default = {
// 获取最新的用户余额 // 获取最新的用户余额
if (!(_this2.bigPageType === "UnionMall")) { if (!(_this2.bigPageType === "UnionMall")) {
_context.next = 11; _context2.next = 14;
break; break;
} }
_context.next = 11; _context2.next = 14;
return _this2.handleGetUserBalance(); return _this2.handleGetUserBalance();
case 11: case 14:
// 获得用户地址数据 // 获得用户地址数据
_this2.handleGetAddressList(); _this2.handleGetAddressList();
_this2.handleGetNowShopCarList(); _this2.handleGetNowShopCarList();
_this2.handleSum(); _this2.handleSum();
// this.$utils.addUserBehaviorNew(); // this.$utils.addUserBehaviorNew();
// 如果是首次访问,延迟显示内容并标记已访问
if (_this2.skeletonControl && _this2.skeletonControl.showSkeleton) {
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!_this2.skeletonControl) {
_context.next = 5;
break;
}
_context.next = 3;
return _this2.skeletonControl.showContentAfterLoading(0);
case 3:
_this2.showContent = true;
_this2.isFirstLoad = false;
case 5:
case "end":
return _context.stop();
}
}
}, _callee);
})), 800);
} else {
// 非首次访问直接显示内容
_this2.showContent = true;
_this2.isFirstLoad = false;
}
_this2.$utils.addUserBehaviorNew({ _this2.$utils.addUserBehaviorNew({
behaviorRecordDesc: _this2.bigPageType ? '进入工会商城购物车' : "进入精选商城购物车" behaviorRecordDesc: _this2.bigPageType ? '进入工会商城购物车' : "进入精选商城购物车"
}); });
case 15: case 19:
case "end": case "end":
return _context.stop(); return _context2.stop();
} }
} }
}, _callee); }, _callee2);
}))(); }))();
}, },
onShow: function onShow() { onShow: function onShow() {
var _this3 = this; // onShow 中不控制骨架屏,骨架屏完全由 onLoad 中控制
// 只在首次进入时显示骨架屏
if (this.isFirstLoad) {
this.showContent = false;
setTimeout(function () {
_this3.showContent = true;
}, 800); // 适当延长骨架屏显示时间
this.isFirstLoad = false; // 标记已经不是首次进入
} else {
// 非首次进入,直接显示内容
this.showContent = true;
}
// 判断当前的购物车里面是否有东西 // 判断当前的购物车里面是否有东西
var shopCarList = []; var shopCarList = [];
@ -409,12 +433,12 @@ var _default = {
}, },
// 切换选中的地址 // 切换选中的地址
handleChangeAddress: function handleChangeAddress(id) { handleChangeAddress: function handleChangeAddress(id) {
var _this4 = this; var _this3 = this;
console.log("this.selectAddressId", this.selectAddressId); console.log("this.selectAddressId", this.selectAddressId);
this.addressList.forEach(function (item) { this.addressList.forEach(function (item) {
if (item.MEMBERADDRESS_ID === id) { if (item.MEMBERADDRESS_ID === id) {
_this4.showAddressObj = item; _this3.showAddressObj = item;
_this4.selectAddressId = item.MEMBERADDRESS_ID; _this3.selectAddressId = item.MEMBERADDRESS_ID;
} }
}); });
this.$forceUpdate(); this.$forceUpdate();
@ -430,19 +454,19 @@ var _default = {
}, },
// 选择地址列表 // 选择地址列表
handleGetAddressList: function handleGetAddressList() { handleGetAddressList: function handleGetAddressList() {
var _this5 = this; var _this4 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
var data, list, haveMEMBERADDRESSCODEList, defaultAddress; var data, list, haveMEMBERADDRESSCODEList, defaultAddress;
return _regenerator.default.wrap(function _callee2$(_context2) { return _regenerator.default.wrap(function _callee3$(_context3) {
while (1) { while (1) {
switch (_context2.prev = _context2.next) { switch (_context3.prev = _context3.next) {
case 0: case 0:
_context2.next = 2; _context3.next = 2;
return _this5.$api.getCoop({ return _this4.$api.getCoop({
action_type: "GetAddressList" action_type: "GetAddressList"
}); });
case 2: case 2:
data = _context2.sent; data = _context3.sent;
list = data.Data.List; list = data.Data.List;
haveMEMBERADDRESSCODEList = []; haveMEMBERADDRESSCODEList = [];
defaultAddress = {}; defaultAddress = {};
@ -464,45 +488,15 @@ var _default = {
} }
} }
if (defaultAddress) { if (defaultAddress) {
_this5.showAddressObj = defaultAddress; _this4.showAddressObj = defaultAddress;
_this5.selectAddressId = defaultAddress.MEMBERADDRESS_ID; _this4.selectAddressId = defaultAddress.MEMBERADDRESS_ID;
} else { } else {
_this5.showAddressObj = {}; _this4.showAddressObj = {};
_this5.selectAddressId = 0; _this4.selectAddressId = 0;
} }
_this5.addressList = list; _this4.addressList = list;
_this5.$forceUpdate(); _this4.$forceUpdate();
case 13: case 13:
case "end":
return _context2.stop();
}
}
}, _callee2);
}))();
},
// 获取最新的用户余额
handleGetUserBalance: function handleGetUserBalance() {
var _this6 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
var data;
return _regenerator.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
uni.showLoading({
title: "获取用户余额..."
});
_context3.next = 3;
return _this6.$api.getCoop({
action_type: "GetMembershipInfo",
WechatUserId: _this6.user.WechatUserId
});
case 3:
data = _context3.sent;
_this6.userInfo = data.Data;
console.log("this.userInfo", _this6.userInfo);
uni.hideLoading();
case 7:
case "end": case "end":
return _context3.stop(); return _context3.stop();
} }
@ -510,6 +504,36 @@ var _default = {
}, _callee3); }, _callee3);
}))(); }))();
}, },
// 获取最新的用户余额
handleGetUserBalance: function handleGetUserBalance() {
var _this5 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
var data;
return _regenerator.default.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
uni.showLoading({
title: "获取用户余额..."
});
_context4.next = 3;
return _this5.$api.getCoop({
action_type: "GetMembershipInfo",
WechatUserId: _this5.user.WechatUserId
});
case 3:
data = _context4.sent;
_this5.userInfo = data.Data;
console.log("this.userInfo", _this5.userInfo);
uni.hideLoading();
case 7:
case "end":
return _context4.stop();
}
}
}, _callee4);
}))();
},
// 判断当前购物车是否有内容 有内容的话 处理 // 判断当前购物车是否有内容 有内容的话 处理
handleGetNowShopCarList: function handleGetNowShopCarList() { handleGetNowShopCarList: function handleGetNowShopCarList() {
var shopCarList = []; var shopCarList = [];
@ -574,13 +598,13 @@ var _default = {
}, },
// 拿到合计金额 // 拿到合计金额
handleSum: function handleSum() { handleSum: function handleSum() {
var _this7 = this; var _this6 = this;
this.totalPay = 0; this.totalPay = 0;
this.shopList.forEach(function (u) { this.shopList.forEach(function (u) {
if (u.select === true) { if (u.select === true) {
var goodNum = Number(u.count); var goodNum = Number(u.count);
_this7.totalPay += Number(u.COMMODITY_MEMBERPRICE) * goodNum; _this6.totalPay += Number(u.COMMODITY_MEMBERPRICE) * goodNum;
_this7.totalPay = Number(_this7.totalPay.toFixed(2)); _this6.totalPay = Number(_this6.totalPay.toFixed(2));
} }
}); });
}, },

File diff suppressed because one or more lines are too long

View File

@ -206,6 +206,7 @@ var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runt
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 32)); var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 32));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11)); var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
var _vuex = __webpack_require__(/*! vuex */ 33); var _vuex = __webpack_require__(/*! vuex */ 33);
var _skeletonManager = __webpack_require__(/*! ../../../utils/skeletonManager.js */ 737);
var _methods; var _methods;
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@ -236,6 +237,8 @@ var _default = {
// 是否显示内容(控制骨架屏切换) // 是否显示内容(控制骨架屏切换)
isFirstLoad: true, isFirstLoad: true,
// 是否是首次进入页面 // 是否是首次进入页面
skeletonControl: null,
// 骨架屏控制器
menu: {}, menu: {},
// 手机的一些位置信息 // 手机的一些位置信息
searchText: "", searchText: "",
@ -342,6 +345,11 @@ var _default = {
} }
}), }),
onLoad: function onLoad(query) { onLoad: function onLoad(query) {
var _this2 = this;
// 初始化骨架屏控制
this.skeletonControl = (0, _skeletonManager.useSkeletonControl)('/pages/shopMallPage/shopType/index', query.pageType);
this.showContent = this.skeletonControl.showContent;
this.isFirstLoad = this.skeletonControl.showSkeleton;
var systemInfo = uni.getSystemInfoSync(); var systemInfo = uni.getSystemInfoSync();
this.systemInfo = systemInfo; this.systemInfo = systemInfo;
var height = uni.getStorageSync("safeHeight"); var height = uni.getStorageSync("safeHeight");
@ -379,23 +387,41 @@ var _default = {
// this.handleGetAllShopItem(); // this.handleGetAllShopItem();
} }
// this.onVirtualScroll = this.throttle(this.onVirtualScroll, 100); // // this.onVirtualScroll = this.throttle(this.onVirtualScroll, 100); //
// 如果是首次访问,延迟显示内容并标记已访问
if (this.skeletonControl && this.skeletonControl.showSkeleton) {
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!_this2.skeletonControl) {
_context.next = 5;
break;
}
_context.next = 3;
return _this2.skeletonControl.showContentAfterLoading(0);
case 3:
_this2.showContent = true;
_this2.isFirstLoad = false;
case 5:
case "end":
return _context.stop();
}
}
}, _callee);
})), 800);
} else {
// 非首次访问直接显示内容
this.showContent = true;
this.isFirstLoad = false;
}
this.$utils.addUserBehaviorNew({ this.$utils.addUserBehaviorNew({
behaviorRecordDesc: this.pageType ? '进入工会商城分类页' : "进入精选商城分类页" behaviorRecordDesc: this.pageType ? '进入工会商城分类页' : "进入精选商城分类页"
}); });
}, },
onShow: function onShow() { onShow: function onShow() {
var _this2 = this; // onShow 中不控制骨架屏,骨架屏完全由 onLoad 中控制
// 只在首次进入时显示骨架屏
if (this.isFirstLoad) {
this.showContent = false;
setTimeout(function () {
_this2.showContent = true;
}, 800); // 适当延长骨架屏显示时间
this.isFirstLoad = false; // 标记已经不是首次进入
} else {
// 非首次进入,直接显示内容
this.showContent = true;
}
this.menu = uni.getMenuButtonBoundingClientRect(); this.menu = uni.getMenuButtonBoundingClientRect();
// 判断当前的购物车里面是否有东西 // 判断当前的购物车里面是否有东西
var shopCarList = []; var shopCarList = [];
@ -688,20 +714,20 @@ var _default = {
this.$refs.shopPopup.close(); this.$refs.shopPopup.close();
}), (0, _defineProperty2.default)(_methods, "handleGetUnionMallShopType", function handleGetUnionMallShopType() { }), (0, _defineProperty2.default)(_methods, "handleGetUnionMallShopType", function handleGetUnionMallShopType() {
var _this5 = this; var _this5 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
var data, typeList, resList, indexOfList; var data, typeList, resList, indexOfList;
return _regenerator.default.wrap(function _callee$(_context) { return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) { while (1) {
switch (_context.prev = _context.next) { switch (_context2.prev = _context2.next) {
case 0: case 0:
_context.next = 2; _context2.next = 2;
return _this5.$api.$javaGet('/third-party/getWeChatGetMallGoodsType', { return _this5.$api.$javaGet('/third-party/getWeChatGetMallGoodsType', {
ownerUnitId: 911, ownerUnitId: 911,
appId: "wxee018fb96955552a", appId: "wxee018fb96955552a",
commodityNature: 5070 commodityNature: 5070
}); });
case 2: case 2:
data = _context.sent; data = _context2.sent;
// const data = await this.$api.getCoop(req); // const data = await this.$api.getCoop(req);
typeList = data.Data.List; typeList = data.Data.List;
console.log("typeList321", typeList); console.log("typeList321", typeList);
@ -724,21 +750,21 @@ var _default = {
_this5.handleGetAllShopItem(resList[_this5.activeTabs].UserdefinedType_Id); _this5.handleGetAllShopItem(resList[_this5.activeTabs].UserdefinedType_Id);
case 12: case 12:
case "end": case "end":
return _context.stop(); return _context2.stop();
} }
} }
}, _callee); }, _callee2);
}))(); }))();
}), (0, _defineProperty2.default)(_methods, "handleSearch", function handleSearch() { }), (0, _defineProperty2.default)(_methods, "handleSearch", function handleSearch() {
var _this6 = this; var _this6 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
var url, data, list, shopList, res, shopIdList; var url, data, list, shopList, res, shopIdList;
return _regenerator.default.wrap(function _callee2$(_context2) { return _regenerator.default.wrap(function _callee3$(_context3) {
while (1) { while (1) {
switch (_context2.prev = _context2.next) { switch (_context3.prev = _context3.next) {
case 0: case 0:
if (!_this6.searchText) { if (!_this6.searchText) {
_context2.next = 18; _context3.next = 18;
break; break;
} }
uni.showLoading({ uni.showLoading({
@ -755,7 +781,7 @@ var _default = {
// // justCommodity: 1, // // justCommodity: 1,
// }); // });
url = _this6.pageType === "UnionMall" ? '/third-party/getWeChatGetMallGoodsInfo' : '/third-party/getWeChatGetMallGoodsInfoExclude'; url = _this6.pageType === "UnionMall" ? '/third-party/getWeChatGetMallGoodsInfo' : '/third-party/getWeChatGetMallGoodsInfoExclude';
_context2.next = 5; _context3.next = 5;
return _this6.$api.$javaGet( return _this6.$api.$javaGet(
// '/third-party/getExcludeWeChatGetMallGoodsInfo', // '/third-party/getExcludeWeChatGetMallGoodsInfo',
url, { url, {
@ -768,7 +794,7 @@ var _default = {
// justCommodity: 1, // justCommodity: 1,
}); });
case 5: case 5:
data = _context2.sent; data = _context3.sent;
uni.hideLoading(); uni.hideLoading();
list = data.Data.List; list = data.Data.List;
console.log("list", list); console.log("list", list);
@ -821,7 +847,7 @@ var _default = {
}); });
} }
_this6.rightShopList = res; _this6.rightShopList = res;
_context2.next = 19; _context3.next = 19;
break; break;
case 18: case 18:
if (_this6.pageType === "UnionMall") { if (_this6.pageType === "UnionMall") {
@ -833,24 +859,24 @@ var _default = {
} }
case 19: case 19:
case "end": case "end":
return _context2.stop(); return _context3.stop();
} }
} }
}, _callee2); }, _callee3);
}))(); }))();
}), (0, _defineProperty2.default)(_methods, "handleGetShopType", function handleGetShopType() { }), (0, _defineProperty2.default)(_methods, "handleGetShopType", function handleGetShopType() {
var _this7 = this; var _this7 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
var _this, typeList, getWeChatGetMallGoodsType, data; var _this, typeList, getWeChatGetMallGoodsType, data;
return _regenerator.default.wrap(function _callee3$(_context3) { return _regenerator.default.wrap(function _callee4$(_context4) {
while (1) { while (1) {
switch (_context3.prev = _context3.next) { switch (_context4.prev = _context4.next) {
case 0: case 0:
_this = _this7; _this = _this7;
typeList = []; typeList = [];
getWeChatGetMallGoodsType = uni.getStorageSync("getWeChatGetMallGoodsType"); getWeChatGetMallGoodsType = uni.getStorageSync("getWeChatGetMallGoodsType");
if (!getWeChatGetMallGoodsType) { if (!getWeChatGetMallGoodsType) {
_context3.next = 8; _context4.next = 8;
break; break;
} }
typeList = getWeChatGetMallGoodsType; typeList = getWeChatGetMallGoodsType;
@ -865,26 +891,26 @@ var _default = {
_this.handleGetShopTypeShowData(newTypeList); _this.handleGetShopTypeShowData(newTypeList);
} }
}); });
_context3.next = 12; _context4.next = 12;
break; break;
case 8: case 8:
_context3.next = 10; _context4.next = 10;
return _this7.$api.$javaGet('/third-party/getWeChatGetMallGoodsType', { return _this7.$api.$javaGet('/third-party/getWeChatGetMallGoodsType', {
ownerUnitId: 911, ownerUnitId: 911,
appId: "wxee018fb96955552a", appId: "wxee018fb96955552a",
commodityNature: _this7.pageType === "UnionMall" ? "" : 5070 commodityNature: _this7.pageType === "UnionMall" ? "" : 5070
}); });
case 10: case 10:
data = _context3.sent; data = _context4.sent;
typeList = data.Data.List; typeList = data.Data.List;
case 12: case 12:
_this7.handleGetShopTypeShowData(typeList); _this7.handleGetShopTypeShowData(typeList);
case 13: case 13:
case "end": case "end":
return _context3.stop(); return _context4.stop();
} }
} }
}, _callee3); }, _callee4);
}))(); }))();
}), (0, _defineProperty2.default)(_methods, "handleGetShopTypeShowData", function handleGetShopTypeShowData(typeList) { }), (0, _defineProperty2.default)(_methods, "handleGetShopTypeShowData", function handleGetShopTypeShowData(typeList) {
var resList = []; var resList = [];
@ -919,11 +945,11 @@ var _default = {
return []; return [];
}), (0, _defineProperty2.default)(_methods, "handleGetAllShopItem", function handleGetAllShopItem(id) { }), (0, _defineProperty2.default)(_methods, "handleGetAllShopItem", function handleGetAllShopItem(id) {
var _this8 = this; var _this8 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
var url, data, list, thisAllType, haveAll, leftIndex, shopList, thisTypeAllShop, allShopID, obj, newList, allShopList, allShopID2; var url, data, list, thisAllType, haveAll, leftIndex, shopList, thisTypeAllShop, allShopID, obj, newList, allShopList, allShopID2;
return _regenerator.default.wrap(function _callee4$(_context4) { return _regenerator.default.wrap(function _callee5$(_context5) {
while (1) { while (1) {
switch (_context4.prev = _context4.next) { switch (_context5.prev = _context5.next) {
case 0: case 0:
console.log("id", id); console.log("id", id);
uni.showLoading({ uni.showLoading({
@ -939,7 +965,7 @@ var _default = {
// // justCommodity: 1, // // justCommodity: 1,
// }); // });
url = _this8.pageType === "UnionMall" ? '/third-party/getWeChatGetMallGoodsInfo' : '/third-party/getWeChatGetMallGoodsInfoExclude'; url = _this8.pageType === "UnionMall" ? '/third-party/getWeChatGetMallGoodsInfo' : '/third-party/getWeChatGetMallGoodsInfoExclude';
_context4.next = 5; _context5.next = 5;
return _this8.$api.$javaGet( return _this8.$api.$javaGet(
// '/third-party/getExcludeWeChatGetMallGoodsInfo', // '/third-party/getExcludeWeChatGetMallGoodsInfo',
url, { url, {
@ -952,7 +978,7 @@ var _default = {
// justCommodity: 1, // justCommodity: 1,
}); });
case 5: case 5:
data = _context4.sent; data = _context5.sent;
uni.hideLoading(); uni.hideLoading();
list = data.Data.List; list = data.Data.List;
console.log("拿到全部的商品", list); console.log("拿到全部的商品", list);
@ -1144,10 +1170,10 @@ var _default = {
uni.hideLoading(); uni.hideLoading();
case 30: case 30:
case "end": case "end":
return _context4.stop(); return _context5.stop();
} }
} }
}, _callee4); }, _callee5);
}))(); }))();
}), (0, _defineProperty2.default)(_methods, "showDetail", function showDetail(obj) { }), (0, _defineProperty2.default)(_methods, "showDetail", function showDetail(obj) {
console.log("obj", obj); console.log("obj", obj);
@ -1426,10 +1452,10 @@ var _default = {
} }
}), (0, _defineProperty2.default)(_methods, "handleGoPointsMall", function handleGoPointsMall() { }), (0, _defineProperty2.default)(_methods, "handleGoPointsMall", function handleGoPointsMall() {
var _this11 = this; var _this11 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
return _regenerator.default.wrap(function _callee5$(_context5) { return _regenerator.default.wrap(function _callee6$(_context6) {
while (1) { while (1) {
switch (_context5.prev = _context5.next) { switch (_context6.prev = _context6.next) {
case 0: case 0:
uni.showLoading({ uni.showLoading({
title: "加载中" title: "加载中"
@ -1444,24 +1470,24 @@ var _default = {
USERDEFINEDTYPE_NAME: "积分商城", USERDEFINEDTYPE_NAME: "积分商城",
USERDEFINEDTYPE_ID: 999999 USERDEFINEDTYPE_ID: 999999
}]; }];
_context5.next = 7; _context6.next = 7;
return _this11.handleGetPointMallShop(); return _this11.handleGetPointMallShop();
case 7: case 7:
uni.hideLoading(); uni.hideLoading();
case 8: case 8:
case "end": case "end":
return _context5.stop(); return _context6.stop();
} }
} }
}, _callee5); }, _callee6);
}))(); }))();
}), (0, _defineProperty2.default)(_methods, "handleGetPointMallShop", function handleGetPointMallShop() { }), (0, _defineProperty2.default)(_methods, "handleGetPointMallShop", function handleGetPointMallShop() {
var _this12 = this; var _this12 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
var req, data, list, shopList; var req, data, list, shopList;
return _regenerator.default.wrap(function _callee6$(_context6) { return _regenerator.default.wrap(function _callee7$(_context7) {
while (1) { while (1) {
switch (_context6.prev = _context6.next) { switch (_context7.prev = _context7.next) {
case 0: case 0:
req = { req = {
action_type: "WeChat_GetMallGoodsInfo", action_type: "WeChat_GetMallGoodsInfo",
@ -1470,10 +1496,10 @@ var _default = {
payMethod: "2000,3000", payMethod: "2000,3000",
excludeNature: _this12.user.INDUSTRY_MEMBERSHIP_ID ? '' : 5070 excludeNature: _this12.user.INDUSTRY_MEMBERSHIP_ID ? '' : 5070
}; };
_context6.next = 3; _context7.next = 3;
return _this12.$api.getCoop(req); return _this12.$api.getCoop(req);
case 3: case 3:
data = _context6.sent; data = _context7.sent;
list = data.Data.List; list = data.Data.List;
shopList = []; shopList = [];
if (list && list.length > 0) { if (list && list.length > 0) {
@ -1516,10 +1542,10 @@ var _default = {
} }
case 9: case 9:
case "end": case "end":
return _context6.stop(); return _context7.stop();
} }
} }
}, _callee6); }, _callee7);
}))(); }))();
}), (0, _defineProperty2.default)(_methods, "handleGoUnionMall", function handleGoUnionMall() { }), (0, _defineProperty2.default)(_methods, "handleGoUnionMall", function handleGoUnionMall() {
uni.navigateTo({ uni.navigateTo({

View File

@ -158,6 +158,7 @@ var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/run
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 32)); var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 32));
var _publicMethods = __webpack_require__(/*! ../../utils/publicMethods */ 60); var _publicMethods = __webpack_require__(/*! ../../utils/publicMethods */ 60);
var _vuex = __webpack_require__(/*! vuex */ 33); var _vuex = __webpack_require__(/*! vuex */ 33);
var _skeletonManager = __webpack_require__(/*! ../../utils/skeletonManager.js */ 737);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var tabbar = function tabbar() { var tabbar = function tabbar() {
@ -181,6 +182,8 @@ var _default = {
// 是否显示内容(控制骨架屏切换) // 是否显示内容(控制骨架屏切换)
isFirstLoad: true, isFirstLoad: true,
// 是否是首次进入页面 // 是否是首次进入页面
skeletonControl: null,
// 骨架屏控制器
pageType: "", pageType: "",
// spring 春节模式 // spring 春节模式
menu: {}, menu: {},
@ -253,17 +256,18 @@ var _default = {
foodOrderCountList: [0, 0, 0] // 点餐订单的数量 foodOrderCountList: [0, 0, 0] // 点餐订单的数量
}; };
}, },
onLoad: function onLoad() { onLoad: function onLoad(options) {
var _this2 = this; var _this2 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
var height, userData, shopOrderStatus; var height, userData, shopOrderStatus;
return _regenerator.default.wrap(function _callee$(_context) { return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) { while (1) {
switch (_context.prev = _context.next) { switch (_context2.prev = _context2.next) {
case 0: case 0:
// 确保首次加载时显示骨架屏 // 初始化骨架屏控制
_this2.isFirstLoad = true; _this2.skeletonControl = (0, _skeletonManager.useSkeletonControl)('/pages/user/index', options.pageType);
_this2.showContent = false; _this2.showContent = _this2.skeletonControl.showContent;
_this2.isFirstLoad = _this2.skeletonControl.showSkeleton;
if (!_this2.user.MEMBERSHIP_ID) { if (!_this2.user.MEMBERSHIP_ID) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/register/index?backTo=index" url: "/pages/register/index?backTo=index"
@ -281,50 +285,72 @@ var _default = {
_this2.cards = userData.LicencePlate.List && userData.LicencePlate.List.length > 0 ? userData.LicencePlate.List[0].License_Plate : ""; _this2.cards = userData.LicencePlate.List && userData.LicencePlate.List.length > 0 ? userData.LicencePlate.List[0].License_Plate : "";
} }
// 拿用户信息 // 拿用户信息
_context.next = 11; _context2.next = 12;
return _this2.handleGetUserDetail(); return _this2.handleGetUserDetail();
case 11: case 12:
shopOrderStatus = uni.getStorageSync('shopOrderStatus'); shopOrderStatus = uni.getStorageSync('shopOrderStatus');
if (shopOrderStatus) { if (shopOrderStatus) {
_context.next = 15; _context2.next = 16;
break; break;
} }
_context.next = 15; _context2.next = 16;
return _this2.handleGetOrderDetail(); return _this2.handleGetOrderDetail();
case 15: case 16:
// 拿到订单信息 // 拿到订单信息
// await this.handleGetOrderDetail() // await this.handleGetOrderDetail()
// 拿车牌号 // 拿车牌号
// await this.handleGetCarCode(); // await this.handleGetCarCode();
// 如果是首次访问,延迟显示内容并标记已访问
if (_this2.skeletonControl && _this2.skeletonControl.showSkeleton) {
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!_this2.skeletonControl) {
_context.next = 5;
break;
}
_context.next = 3;
return _this2.skeletonControl.showContentAfterLoading(0);
case 3:
_this2.showContent = true;
_this2.isFirstLoad = false;
case 5:
case "end":
return _context.stop();
}
}
}, _callee);
})), 500);
} else {
// 非首次访问直接显示内容
_this2.showContent = true;
_this2.isFirstLoad = false;
}
_this2.$utils.addUserBehaviorNew({ _this2.$utils.addUserBehaviorNew({
behaviorRecordDesc: "进入了我的页面" behaviorRecordDesc: "进入了我的页面"
}); });
case 16: case 18:
case "end": case "end":
return _context.stop(); return _context2.stop();
} }
} }
}, _callee); }, _callee2);
}))(); }))();
}, },
onShow: function onShow() { onShow: function onShow() {
var _this3 = this; var _this3 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
var inShop, shopOrderStatus, foodOrderStatus, foodTab, shopCarList, count, userData; var inShop, shopOrderStatus, foodOrderStatus, foodTab, shopCarList, count, userData;
return _regenerator.default.wrap(function _callee2$(_context2) { return _regenerator.default.wrap(function _callee3$(_context3) {
while (1) { while (1) {
switch (_context2.prev = _context2.next) { switch (_context3.prev = _context3.next) {
case 0: case 0:
// 只有第一次进入时才显示骨架屏 // onShow 中不控制骨架屏,骨架屏只在 onLoad 中控制一次
if (_this3.isFirstLoad) { // 如果不是首次加载,直接显示内容
_this3.showContent = false; if (!_this3.isFirstLoad) {
setTimeout(function () {
_this3.showContent = true;
_this3.isFirstLoad = false; // 标记已不是第一次进入
}, 500);
} else {
// 非第一次进入直接显示内容
_this3.showContent = true; _this3.showContent = true;
} }
inShop = uni.getStorageSync("inShop"); inShop = uni.getStorageSync("inShop");
@ -403,16 +429,16 @@ var _default = {
_this3.$forceUpdate(); _this3.$forceUpdate();
} }
console.log('userDatauserDatauserData', userData); console.log('userDatauserDatauserData', userData);
_context2.next = 14; _context3.next = 14;
return _this3.handleGetOrderDetail(); return _this3.handleGetOrderDetail();
case 14: case 14:
_this3.$forceUpdate(); _this3.$forceUpdate();
case 15: case 15:
case "end": case "end":
return _context2.stop(); return _context3.stop();
} }
} }
}, _callee2); }, _callee3);
}))(); }))();
}, },
computed: _objectSpread(_objectSpread({}, (0, _vuex.mapGetters)({ computed: _objectSpread(_objectSpread({}, (0, _vuex.mapGetters)({
@ -480,36 +506,36 @@ var _default = {
// 拿到服务区详情 // 拿到服务区详情
handleGetServiceDetail: function handleGetServiceDetail(id) { handleGetServiceDetail: function handleGetServiceDetail(id) {
var _this4 = this; var _this4 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
var req, data, obj; var req, data, obj;
return _regenerator.default.wrap(function _callee3$(_context3) { return _regenerator.default.wrap(function _callee4$(_context4) {
while (1) { while (1) {
switch (_context3.prev = _context3.next) { switch (_context4.prev = _context4.next) {
case 0: case 0:
if (id) { if (id) {
_context3.next = 2; _context4.next = 2;
break; break;
} }
return _context3.abrupt("return"); return _context4.abrupt("return");
case 2: case 2:
req = { req = {
ServerpartId: id, ServerpartId: id,
latitude: _this4.seat.latitude, latitude: _this4.seat.latitude,
longitude: _this4.seat.longitude longitude: _this4.seat.longitude
}; };
_context3.next = 5; _context4.next = 5;
return _this4.$api.$get("/CommercialApi/BaseInfo/GetServerpartInfo", req); return _this4.$api.$get("/CommercialApi/BaseInfo/GetServerpartInfo", req);
case 5: case 5:
data = _context3.sent; data = _context4.sent;
obj = data.Result_Data; obj = data.Result_Data;
_this4.serviceDetail = obj; _this4.serviceDetail = obj;
_this4.serviceDetail.sumDetail = _this4.handleMergeDetail(obj); _this4.serviceDetail.sumDetail = _this4.handleMergeDetail(obj);
case 9: case 9:
case "end": case "end":
return _context3.stop(); return _context4.stop();
} }
} }
}, _callee3); }, _callee4);
}))(); }))();
}, },
// 合并服务区数据 // 合并服务区数据
@ -654,11 +680,11 @@ var _default = {
// 查询现在的充电桩 // 查询现在的充电桩
handleGetChargingStation: function handleGetChargingStation(obj) { handleGetChargingStation: function handleGetChargingStation(obj) {
var _this5 = this; var _this5 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
var _this; var _this;
return _regenerator.default.wrap(function _callee4$(_context4) { return _regenerator.default.wrap(function _callee5$(_context5) {
while (1) { while (1) {
switch (_context4.prev = _context4.next) { switch (_context5.prev = _context5.next) {
case 0: case 0:
_this = _this5; _this = _this5;
uni.request({ uni.request({
@ -714,10 +740,10 @@ var _default = {
}); });
case 2: case 2:
case "end": case "end":
return _context4.stop(); return _context5.stop();
} }
} }
}, _callee4); }, _callee5);
}))(); }))();
}, },
// 跳转会员设置 // 跳转会员设置
@ -786,14 +812,14 @@ var _default = {
// 用户上传头像 // 用户上传头像
onChooseAvatar: function onChooseAvatar(e) { onChooseAvatar: function onChooseAvatar(e) {
var _this6 = this; var _this6 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
var _this7, _this; var _this7, _this;
return _regenerator.default.wrap(function _callee6$(_context6) { return _regenerator.default.wrap(function _callee7$(_context7) {
while (1) { while (1) {
switch (_context6.prev = _context6.next) { switch (_context7.prev = _context7.next) {
case 0: case 0:
if (!(_this6.user && !_this6.user.MEMBERSHIP_ID || !_this6.user && !_this6.user.MEMBERSHIP_ID)) { if (!(_this6.user && !_this6.user.MEMBERSHIP_ID || !_this6.user && !_this6.user.MEMBERSHIP_ID)) {
_context6.next = 4; _context7.next = 4;
break; break;
} }
_this7 = _this6; _this7 = _this6;
@ -808,7 +834,7 @@ var _default = {
} }
} }
}); });
return _context6.abrupt("return"); return _context7.abrupt("return");
case 4: case 4:
_this = _this6; _this = _this6;
_this.showErrorText = 1; _this.showErrorText = 1;
@ -823,16 +849,16 @@ var _default = {
}, },
success: function () { success: function () {
var _success = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(uploadRes) { var _success = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(uploadRes) {
var data, url, req, userInfoData; var data, url, req, userInfoData;
return _regenerator.default.wrap(function _callee5$(_context5) { return _regenerator.default.wrap(function _callee6$(_context6) {
while (1) { while (1) {
switch (_context5.prev = _context5.next) { switch (_context6.prev = _context6.next) {
case 0: case 0:
data = uploadRes.data ? JSON.parse(uploadRes.data) : ""; data = uploadRes.data ? JSON.parse(uploadRes.data) : "";
url = data.Result_Data.ImageUrl; url = data.Result_Data.ImageUrl;
if (!url) { if (!url) {
_context5.next = 10; _context6.next = 10;
break; break;
} }
req = { req = {
@ -841,19 +867,19 @@ var _default = {
}; };
_this.WXProfile = url; _this.WXProfile = url;
_this.showErrorText = _this.WXProfile; _this.showErrorText = _this.WXProfile;
_context5.next = 8; _context6.next = 8;
return _this.$api.$get("/WeChat/UpdateMemberInfo", req); return _this.$api.$get("/WeChat/UpdateMemberInfo", req);
case 8: case 8:
userInfoData = _context5.sent; userInfoData = _context6.sent;
if (userInfoData.Result_Code === 100) { if (userInfoData.Result_Code === 100) {
_this.handleGetUserDetail(); _this.handleGetUserDetail();
} }
case 10: case 10:
case "end": case "end":
return _context5.stop(); return _context6.stop();
} }
} }
}, _callee5); }, _callee6);
})); }));
function success(_x) { function success(_x) {
return _success.apply(this, arguments); return _success.apply(this, arguments);
@ -866,20 +892,20 @@ var _default = {
}); });
case 7: case 7:
case "end": case "end":
return _context6.stop(); return _context7.stop();
} }
} }
}, _callee6); }, _callee7);
}))(); }))();
}, },
// 拿到用户详情 // 拿到用户详情
handleGetUserDetail: function handleGetUserDetail() { handleGetUserDetail: function handleGetUserDetail() {
var _this8 = this; var _this8 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
var _this; var _this;
return _regenerator.default.wrap(function _callee7$(_context7) { return _regenerator.default.wrap(function _callee8$(_context8) {
while (1) { while (1) {
switch (_context7.prev = _context7.next) { switch (_context8.prev = _context8.next) {
case 0: case 0:
_this = _this8; _this = _this8;
_this.$api.getCoop({ _this.$api.getCoop({
@ -915,10 +941,10 @@ var _default = {
}); });
case 2: case 2:
case "end": case "end":
return _context7.stop(); return _context8.stop();
} }
} }
}, _callee7); }, _callee8);
}))(); }))();
}, },
// 跳转去售后 即已完成的列表 // 跳转去售后 即已完成的列表
@ -987,22 +1013,22 @@ var _default = {
// 拿到车牌号 // 拿到车牌号
handleGetCarCode: function handleGetCarCode() { handleGetCarCode: function handleGetCarCode() {
var _this9 = this; var _this9 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
var _this, res, list; var _this, res, list;
return _regenerator.default.wrap(function _callee8$(_context8) { return _regenerator.default.wrap(function _callee9$(_context9) {
while (1) { while (1) {
switch (_context8.prev = _context8.next) { switch (_context9.prev = _context9.next) {
case 0: case 0:
_this = _this9; _this = _this9;
uni.showLoading({ uni.showLoading({
title: "加载中" title: "加载中"
}); });
_context8.next = 4; _context9.next = 4;
return _this9.$api.getCoop({ return _this9.$api.getCoop({
action_type: "GetVehicleList" action_type: "GetVehicleList"
}); });
case 4: case 4:
res = _context8.sent; res = _context9.sent;
list = res.Result_Data.List; list = res.Result_Data.List;
if (list && list.length > 0) { if (list && list.length > 0) {
_this.cards = list[0].License_Plate; _this.cards = list[0].License_Plate;
@ -1010,10 +1036,10 @@ var _default = {
uni.hideLoading(); uni.hideLoading();
case 8: case 8:
case "end": case "end":
return _context8.stop(); return _context9.stop();
} }
} }
}, _callee8); }, _callee9);
}))(); }))();
}, },
// 常用功能的跳转 // 常用功能的跳转
@ -1038,11 +1064,11 @@ var _default = {
// // 调起付款码 // // 调起付款码
handleShowPayCode: function handleShowPayCode() { handleShowPayCode: function handleShowPayCode() {
var _this10 = this; var _this10 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
var timeStamp, nonceStr, req, reqSign, data; var timeStamp, nonceStr, req, reqSign, data;
return _regenerator.default.wrap(function _callee9$(_context9) { return _regenerator.default.wrap(function _callee10$(_context10) {
while (1) { while (1) {
switch (_context9.prev = _context9.next) { switch (_context10.prev = _context10.next) {
case 0: case 0:
timeStamp = Math.ceil(new Date().getTime() / 1000); timeStamp = Math.ceil(new Date().getTime() / 1000);
nonceStr = Math.random().toString(36).substring(2, 8); nonceStr = Math.random().toString(36).substring(2, 8);
@ -1063,10 +1089,10 @@ var _default = {
// req.package + // req.package +
// "\n", // "\n",
}; };
_context9.next = 6; _context10.next = 6;
return _this10.$api.$get("/WeChat/GenerateSign", reqSign); return _this10.$api.$get("/WeChat/GenerateSign", reqSign);
case 6: case 6:
data = _context9.sent; data = _context10.sent;
console.log("data", data); console.log("data", data);
wx.openOfflinePayView({ wx.openOfflinePayView({
appId: "wxee018fb96955552a", appId: "wxee018fb96955552a",
@ -1081,10 +1107,10 @@ var _default = {
}); });
case 9: case 9:
case "end": case "end":
return _context9.stop(); return _context10.stop();
} }
} }
}, _callee9); }, _callee10);
}))(); }))();
}, },
// 最底下的两个点击事件 // 最底下的两个点击事件
@ -1191,17 +1217,17 @@ var _default = {
}, },
handleGetOrderDetail: function handleGetOrderDetail() { handleGetOrderDetail: function handleGetOrderDetail() {
var _this11 = this; var _this11 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
var req, data, list, obligation, pendingShipment, pendingReceiptOfGoods, mallOrderCountList, reqFood, dataFood, _list, _obligation, _pendingShipment, _pendingReceiptOfGoods, foodOrderCountList, foodTab; var req, data, list, obligation, pendingShipment, pendingReceiptOfGoods, mallOrderCountList, reqFood, dataFood, _list, _obligation, _pendingShipment, _pendingReceiptOfGoods, foodOrderCountList, foodTab;
return _regenerator.default.wrap(function _callee10$(_context10) { return _regenerator.default.wrap(function _callee11$(_context11) {
while (1) { while (1) {
switch (_context10.prev = _context10.next) { switch (_context11.prev = _context11.next) {
case 0: case 0:
if (!(_this11.user && !_this11.user.MEMBERSHIP_ID || !_this11.user && !_this11.user.MEMBERSHIP_ID)) { if (!(_this11.user && !_this11.user.MEMBERSHIP_ID || !_this11.user && !_this11.user.MEMBERSHIP_ID)) {
_context10.next = 2; _context11.next = 2;
break; break;
} }
return _context10.abrupt("return"); return _context11.abrupt("return");
case 2: case 2:
// 商城订单数据 // 商城订单数据
req = { req = {
@ -1214,10 +1240,10 @@ var _default = {
requestType: "application/x-www-form-urlencoded", requestType: "application/x-www-form-urlencoded",
noLoading: true noLoading: true
}; };
_context10.next = 5; _context11.next = 5;
return _this11.$api.postCoop(req); return _this11.$api.postCoop(req);
case 5: case 5:
data = _context10.sent; data = _context11.sent;
console.log('商城订单', data); console.log('商城订单', data);
if (data.ResultCode === "100") { if (data.ResultCode === "100") {
list = data.Data.List; // 待付款 list = data.Data.List; // 待付款
@ -1251,10 +1277,10 @@ var _default = {
requestType: "application/x-www-form-urlencoded", requestType: "application/x-www-form-urlencoded",
noLoading: true noLoading: true
}; };
_context10.next = 12; _context11.next = 12;
return _this11.$api.postCoop(reqFood); return _this11.$api.postCoop(reqFood);
case 12: case 12:
dataFood = _context10.sent; dataFood = _context11.sent;
console.log('点餐订单', dataFood); console.log('点餐订单', dataFood);
if (dataFood.ResultCode === "100") { if (dataFood.ResultCode === "100") {
_list = dataFood.Data.List; // 待付款 _list = dataFood.Data.List; // 待付款
@ -1307,10 +1333,10 @@ var _default = {
_this11.$forceUpdate(); _this11.$forceUpdate();
case 16: case 16:
case "end": case "end":
return _context10.stop(); return _context11.stop();
} }
} }
}, _callee10); }, _callee11);
}))(); }))();
} }
} }

146
utils/skeletonManager.js Normal file
View File

@ -0,0 +1,146 @@
/**
* 骨架屏管理器
* 用于控制页面骨架屏的显示逻辑
*
* 逻辑说明
* 1. 首次进入小程序时每个页面第一次访问都显示骨架屏
* 2. 对于带pageType参数的页面每个不同的pageType都算作一次新页面访问
* 3. 后续访问相同页面相同pageType不显示骨架屏
*/
class SkeletonManager {
constructor() {
this.visitedPages = new Set() // 存储已访问的页面标识
this.currentAppSession = null // 当前小程序会话ID
this.init()
}
/**
* 初始化从缓存中恢复已访问页面记录
*/
init() {
try {
// 检查是否是新的小程序启动(应用级生命周期)
const appLaunchTime = getApp().globalData?.appLaunchTime || Date.now()
const lastAppLaunchTime = uni.getStorageSync('lastAppLaunchTime')
if (!lastAppLaunchTime || lastAppLaunchTime !== appLaunchTime) {
// 新的应用启动,清空所有已访问记录
this.visitedPages = new Set()
uni.removeStorageSync('visitedPages')
uni.setStorageSync('lastAppLaunchTime', appLaunchTime)
console.log('骨架屏管理器: 检测到新的小程序启动,重置访问记录')
} else {
// 同一次应用启动,恢复已访问记录
const cachedVisitedPages = uni.getStorageSync('visitedPages')
if (cachedVisitedPages && Array.isArray(cachedVisitedPages)) {
this.visitedPages = new Set(cachedVisitedPages)
console.log('骨架屏管理器: 恢复已访问记录', cachedVisitedPages)
}
}
} catch (error) {
console.warn('骨架屏管理器初始化失败:', error)
this.visitedPages = new Set()
}
}
/**
* 生成页面标识
* @param {string} pagePath - 页面路径
* @param {string} pageType - 页面类型参数可选
* @returns {string} 页面唯一标识
*/
generatePageKey(pagePath, pageType = '') {
if (pageType) {
return `${pagePath}?pageType=${pageType}`
}
return pagePath
}
/**
* 检查是否应该显示骨架屏
* @param {string} pagePath - 页面路径
* @param {string} pageType - 页面类型参数可选
* @returns {boolean} 是否显示骨架屏
*/
shouldShowSkeleton(pagePath, pageType = '') {
const pageKey = this.generatePageKey(pagePath, pageType)
const shouldShow = !this.visitedPages.has(pageKey)
console.log(`骨架屏检查 ${pageKey}: ${shouldShow ? '需要显示' : '已访问过'}`,
`当前已访问页面:`, Array.from(this.visitedPages))
return shouldShow
}
/**
* 标记页面已访问
* @param {string} pagePath - 页面路径
* @param {string} pageType - 页面类型参数可选
*/
markPageVisited(pagePath, pageType = '') {
const pageKey = this.generatePageKey(pagePath, pageType)
this.visitedPages.add(pageKey)
this.saveToCache()
console.log(`骨架屏标记已访问: ${pageKey}`, `当前已访问页面:`, Array.from(this.visitedPages))
}
/**
* 保存访问记录到缓存
*/
saveToCache() {
try {
uni.setStorageSync('visitedPages', Array.from(this.visitedPages))
} catch (error) {
console.warn('保存骨架屏访问记录失败:', error)
}
}
/**
* 清除所有访问记录用于重置状态比如用户重新打开小程序
*/
clearAllVisited() {
this.visitedPages.clear()
uni.removeStorageSync('visitedPages')
}
/**
* 获取页面骨架屏控制状态
* 返回一个包含状态和控制方法的对象
* @param {string} pagePath - 页面路径
* @param {string} pageType - 页面类型参数可选
* @returns {object} 控制状态对象
*/
getPageSkeletonControl(pagePath, pageType = '') {
const shouldShow = this.shouldShowSkeleton(pagePath, pageType)
return {
// 是否显示骨架屏
showSkeleton: shouldShow,
// 是否显示内容
showContent: !shouldShow,
// 标记页面已访问的方法
markVisited: () => {
this.markPageVisited(pagePath, pageType)
},
// 手动控制显示内容的方法(用于异步加载完成后)
showContentAfterLoading: (delay = 500) => {
return new Promise((resolve) => {
setTimeout(() => {
this.markPageVisited(pagePath, pageType)
resolve(true)
}, delay)
})
}
}
}
}
// 创建全局单例
const skeletonManager = new SkeletonManager()
// 导出工厂函数,用于在页面中快速获取控制状态
export function useSkeletonControl(pagePath, pageType = '') {
return skeletonManager.getPageSkeletonControl(pagePath, pageType)
}
// 导出管理器实例(用于高级操作)
export default skeletonManager