修改1.07首页子目录跳转后回来没有固定位置的问题

This commit is contained in:
liuyuan
2025-01-08 15:46:54 +08:00
parent d46a4e6b66
commit c043408e68
4 changed files with 31 additions and 32 deletions

View File

@@ -46,7 +46,7 @@
<view class="newLeve2">
<view class="home_nar nomargin" style="padding: 0; background-color: #fff">
<view class="flexbox">
<view :class="['hn_cl_tit', tabsid == item.id ? 'active' : '']" @click="curseClick(item)"
<view :class="['hn_cl_tit', currentIndex == index ? 'active' : '']" @click="curseClick(item,index)"
v-for="(item, index) in curseTagList" :key="index">
<image :src="item.icon" mode="aspectFit"></image>
<text>{{ item.title }}</text>
@@ -332,7 +332,6 @@
return {
myList: [],
advertisementList: [],
showEbook: false, // 显示电子书相关
transaction: {
// 成功回调
@@ -374,6 +373,10 @@
timeDif: {},
showCountDown: false,
classId: undefined,
//下标
currentIndex: 0,
currentIndex: null,
fixed: null
};
},
onPageScroll(e) {
@@ -389,9 +392,21 @@
},
onHide() {
this.page = 1;
uni.removeStorageSync('fixed');
},
//页面显示
async onShow() {
//存储的需要固定分类
this.fixed = uni.getStorageSync('fixed');
//固定分类
if(this.fixed){
this.curseClick(this.currentItem,this.currentIndex);
}else{
console.log('我是else11111')
this.currentIndex = 0;
this.currentItem = null;
}
uni.hideTabBar();
// #ifdef APP-PLUS
// plus.screen.unlockOrientation();
@@ -420,9 +435,7 @@
this.examId = undefined;
paperEndTime = 0;
}
console.log("this.examId////////////", paperEndTime);
// severNowTime = await this.getServerTime()
// console.log('//////////////', paperEndTime, severNowTime);
if (severNowTime > -1 && paperEndTime - severNowTime > 0) {
var secondTimeDif = paperEndTime - severNowTime;
this.timeDif.hour = parseInt(
@@ -433,7 +446,6 @@
);
this.timeDif.second = (secondTimeDif % (1000 * 60)) / 1000;
this.showCountDown = true;
console.log("时间符合吗?", this.showCountDown, secondTimeDif);
} else {
this.showCountDown = false;
}
@@ -507,8 +519,6 @@
var startTime = startTimeDate.getTime();
var step = 1000 * 60 * 60 * e; // 时间间隔
var interval = startTime + step; //开始 + 时长 = 结束的毫秒数
// var a = new Date(interval)
console.log("aaaaaaaaaa结束时间的毫秒数时间戳", interval);
return interval;
},
// 继续考试
@@ -599,7 +609,6 @@
return _list;
},
goGoodsDetail(v, isMiaosha) {
console.log(v);
uni.navigateTo({
url: `/pages/goods/index/index?navTitle=${v.title}&isMiaosha=${isMiaosha}&title=${v.title}&id=${v.productId}`,
});
@@ -634,15 +643,16 @@
if (res && res.code == 0) {
if (res.labels.length > 0) {
this.curseTagList = res.labels;
this.tabsid = res.labels[0].id;
// this.curseClick(res.labels[0])
//按currentIndex同步显示
this.tabsid = res.labels[this.currentIndex].id;
if (res.labels[0].isLast == 0) {
// 非终极
if (
res.labels[0].children &&
res.labels[0].children.length > 0
) {
this.sbuMedicalTagsList = res.labels[0].children;
//数据按currentIndex同步显示
this.sbuMedicalTagsList = res.labels[this.currentIndex].children;
} else {
this.sbuMedicalTagsList = [];
}
@@ -703,7 +713,6 @@
if (res.code == 0) {
if (res.result.records.length > 0) {
this.seckillList = res.result.records;
console.log(this.seckillList, '111111111111111ss')
} else {
this.seckillList = [];
}
@@ -799,8 +808,11 @@
window.open(url);
// #endif
},
curseClick(item) {
curseClick(item,index) {
this.tabsid = item.id;
//记录被选中的item和index
this.currentItem = item;
this.currentIndex = index;
if (item.isLast == 0) {
// 终极
if (item.children && item.children.length > 0) {
@@ -816,7 +828,6 @@
},
curseClickJump(item) {
uni.navigateTo({
// url: `/pages/course/index?id=${item.id}&title=中医学`
url: `/pages/course/index?id=${item.id}&title=${item.title}&pid=${item.pid}`,
});
},