修改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

@@ -778,12 +778,6 @@
"selectedIconPath": "static/tab/icon1_y.png", "selectedIconPath": "static/tab/icon1_y.png",
"text": "首页" "text": "首页"
}, },
// {
// "pagePath": "pages/peanut/shopping",
// "iconPath": "static/tab/tab_nor_02.png",
// "selectedIconPath": "static/tab/tab_cur_02.png",
// "text": "购物车"
// },
{ {
"pagePath": "pages/bookShop/orderList", "pagePath": "pages/bookShop/orderList",
"iconPath": "static/tab/order.png", "iconPath": "static/tab/order.png",
@@ -803,15 +797,5 @@
"text": "我的" "text": "我的"
} }
] ]
},
"condition": { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [
{
"name": "", //模式名称
"path": "", //启动页面,必选
"query": "" //启动参数在页面的onLoad函数里面得到
}
]
} }
} }

View File

@@ -2,7 +2,7 @@
<view> <view>
<!-- 公共组件-每个页面必须引入 --> <!-- 公共组件-每个页面必须引入 -->
<public-module></public-module> <public-module></public-module>
<z-nav-bar :title="pageTitle"><view class="curseSet" slot="right" @click="shuomingPage('/pages/course/courseSet',tagId,pid)"><uni-icons type="info" size="24"></uni-icons> 课程说明</view></z-nav-bar> <z-nav-bar :title="pageTitle" @back='handleBack'><view class="curseSet" slot="right" @click="shuomingPage('/pages/course/courseSet',tagId,pid)"><uni-icons type="info" size="24"></uni-icons> 课程说明</view></z-nav-bar>
<view class="tabsBox" :class="[fixed ? 'fixed' : '' ]"> <view class="tabsBox" :class="[fixed ? 'fixed' : '' ]">
<u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="fatherClick" :current="curTagId" <u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="fatherClick" :current="curTagId"
:activeStyle="activeStyle" :scrollable="scrollable" :list="tabList" :activeStyle="activeStyle" :scrollable="scrollable" :list="tabList"
@@ -160,6 +160,9 @@
}, },
//方法 //方法
methods: { methods: {
handleBack(){
uni.setStorageSync('fixed',true)
},
surl(imageurl) { surl(imageurl) {
return `url(${imageurl})` return `url(${imageurl})`
}, },

View File

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

View File

@@ -416,6 +416,7 @@ export default {
if (this.backState == 3000) { if (this.backState == 3000) {
this.$emit("backClick"); this.$emit("backClick");
} else { } else {
this.$emit('back');
uni.navigateBack(); uni.navigateBack();
} }
}, },