测试版V1.2.0更新

This commit is contained in:
2025-08-01 17:13:20 +08:00
parent bc0cd959f0
commit 9153dff407
37 changed files with 40 additions and 100 deletions

View File

@@ -296,13 +296,12 @@ export default {
let url = `/${lang}/AccessMiningPool`
// 使用 name 进行导航,避免重复的路由参数
this.$router.push({
path:url,
query: {
lang: lang,
name:'AccessMiningPool',
params: {
coin: this.activeItemCoin.value,
imgUrl: this.activeItemCoin.imgUrl
},
replace: false // 保留历史记录,允许回退
});

View File

@@ -28,7 +28,7 @@ Vue.use(ElementUI, {
});
Vue.prototype.$axios = axios
// console.log = ()=>{} //全局关闭打印
console.log = ()=>{} //全局关闭打印
// 全局注册混入
Vue.mixin(loadingStateMixin);//loading状态管理
Vue.mixin(networkRecoveryMixin);//网络恢复后数据刷新

View File

@@ -283,8 +283,8 @@ export default {
this.currentRoutePath =to.path.split(`/`)[3]
this.activeItem = this.currencyList.find(item => { return item.path == this.currentRoutePath })
this.$addStorageEvent(1, `activeItem`, JSON.stringify( this.activeItem))
// this.activeItem = this.currencyList.find(item => { return item.path == this.currentRoutePath })
// this.$addStorageEvent(1, `activeItem`, JSON.stringify( this.activeItem))
@@ -293,94 +293,21 @@ export default {
},
mounted() {
// if (this.$route.name =="AccessMiningPool" ) {
// this.$router.go(-1);
// }
this.fetchAllList(this.listParams)
console.log(this.$route, "this.$route.query.coin");
if (this.$route.query.coin) {
this.activeCoin = this.$route.query.coin
// this.currencyPath = this.$route.query.imgUrl
this.imgUrl = this.$route.query.imgUrl
this.currencyPath = this.$route.query.imgUrl
this.params.coin = this.$route.query.coin
this.$addStorageEvent(1, `activeCoin`, JSON.stringify(this.activeCoin))
this.activeItem = this.currencyList.find(item => { return item.value == this.params.coin })
const item = this.navList.find(item => { return item.coin == this.params.coin })
console.log(item, "item65656565",this.navList,this.$route.query.coin);
if (item && item.coin) {
this.clickJump(item)
// const mockEvent = {
// stopPropagation: () => {},
// currentTarget: document.getElementById('menu1')
// };
// this.changeMenuName(mockEvent, item)
}
// 优先级:路由参数 > localStorage > 默认
let coinFromRoute = this.$route.params && this.$route.params.coin;
let localActiveCoin = localStorage.getItem('activeCoin') ? JSON.parse(localStorage.getItem('activeCoin')) : null;
let targetCoin = coinFromRoute || localActiveCoin || (this.currencyList[0] && this.currencyList[0].value);
this.activeCoin = targetCoin;
this.activeItem = this.currencyList.find(item => item.value === targetCoin) || this.currencyList[0];
this.params.coin = targetCoin;
// 如果是路由参数记忆到localStorage
if (coinFromRoute) {
localStorage.setItem('activeCoin', JSON.stringify(coinFromRoute));
}
let activeCoin = localStorage.getItem("activeCoin")
this.activeCoin = JSON.parse(activeCoin)
let currencyList = localStorage.getItem("currencyList")
this.currencyList = JSON.parse(currencyList)
window.addEventListener("setItem", () => {
let activeCoin = localStorage.getItem("activeCoin")
this.activeCoin = JSON.parse(activeCoin)
let currencyList = localStorage.getItem("currencyList")
this.currencyList = JSON.parse(currencyList)
});
if (!this.activeCoin) {
this.activeCoin = "nexa"
this.imgUrl = `${this.$baseApi}/img/nexa.png`
this.currencyPath = `${this.$baseApi}/img/nexa.png`
this.params.coin = "nexa"
this.$addStorageEvent(1, `activeCoin`, JSON.stringify(this.activeCoin))
this.openAPI = true
} else {
// this.openAPI =true
try {
this.pageTitle = this.currencyList.find(item => item.value == this.activeCoin).name
this.imgUrl = this.currencyList.find(item => item.value == this.activeCoin).imgUrl
} catch (error) {
console.log(error);
}
}
// 从本地存储获取activeItem
// const savedActiveItem = localStorage.getItem('activeItem');
// if (savedActiveItem) {
// try {
// this.activeItem = JSON.parse(savedActiveItem);
// } catch (error) {
// console.error('Parse activeItem failed:', error);
// // 使用默认值
// this.activeItem = this.currencyList[0];
// }
// } else {
// // 没有存储值时使用默认值
// this.activeItem = this.currencyList[0];
// }
this.fetchAllList(this.listParams);
},
methods: {
async fetchAllList(params){
@@ -444,7 +371,8 @@ export default {
},
changeMenuName(e, item) {
console.log(`走移动端了?`);
if (!e) return;
if (!item.path) return; // 添加路径检查
@@ -481,6 +409,7 @@ export default {
this.DetailsParams.id = item.id
this.DetailsParams.coin = item.coin
this.activeCoin = item.coin
localStorage.setItem('activeCoin', JSON.stringify(this.activeCoin))
this.fetchProblemDetails(this.DetailsParams)
// if (!item.path) return; // 添加路径检查
// this.activeCoin = item.value

View File

@@ -50,10 +50,10 @@
<section class="menu">
<ul>
{{ DetailsParams.coin }}
{{activeCoin }}
<li
:class="{ active: DetailsParams.coin == item.coin }"
:class="{ active: activeCoin == item.coin }"
@click="clickJump(item)"
v-for="item in navList"
:key="item.id"

View File

@@ -1568,9 +1568,8 @@ export default {
let url = `/${this.lang}/AccessMiningPool`
// 使用 name 进行导航,避免重复的路由参数
this.$router.push({
path:url,
query: {
lang: this.lang,
name:'AccessMiningPool',
params: {
coin: this.params.coin,
imgUrl: this.currencyPath