chore: 使用常量来处理首页的路由页面路径

This commit is contained in:
2026-01-07 15:40:13 +08:00
parent b10fcf02d4
commit 6f01b3c1c6
39 changed files with 57 additions and 56 deletions

View File

@@ -145,7 +145,7 @@ export default {
if (isJump && route != 'pages/index/index') { if (isJump && route != 'pages/index/index') {
uni.setStorageSync('manual_change_store', true); // 手动切换门店 uni.setStorageSync('manual_change_store', true); // 手动切换门店
this.$store.dispatch('getCartNumber'); //重新获取购物车数据 this.$store.dispatch('getCartNumber'); //重新获取购物车数据
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}, },

View File

@@ -240,7 +240,7 @@ export default {
}, },
goHome() { goHome() {
if (this.preview) return; // 开启预览,禁止任何操作和跳转 if (this.preview) return; // 开启预览,禁止任何操作和跳转
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, },
goCart() { goCart() {
if (this.preview) return; // 开启预览,禁止任何操作和跳转 if (this.preview) return; // 开启预览,禁止任何操作和跳转

View File

@@ -92,7 +92,7 @@ export const checkTabBarActive = (linkUrl, currentPageRoute) => {
const linkUrlParts = adaptSubpackageUrl(linkUrl).split('/'); const linkUrlParts = adaptSubpackageUrl(linkUrl).split('/');
const currentPageRouteParts = currentPageRoute.split('/'); const currentPageRouteParts = currentPageRoute.split('/');
console.log('diy-bottom-nav verify:', { linkUrlParts, currentPageRouteParts}); // console.log('diy-bottom-nav verify:', { linkUrlParts, currentPageRouteParts});
try { try {
// 二级页面 // 二级页面
@@ -804,7 +804,7 @@ export default {
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组 let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
return routes.length ? routes[routes.length - 1].route : ''; return routes.length ? routes[routes.length - 1].route : '';
}, },
goBack(backUrl = '/pages/index/index') { goBack(backUrl = INDEX_PAGE_URL) {
if (getCurrentPages().length == 1) { if (getCurrentPages().length == 1) {
this.redirectTo(backUrl); this.redirectTo(backUrl);
} else { } else {

View File

@@ -145,7 +145,7 @@ export default {
let linkUrl = link.wap_url; let linkUrl = link.wap_url;
// 首页特殊处理 // 首页特殊处理
if (linkUrl === '/pages/index/index' && this.name === 'DIY_VIEW_INDEX') { if (linkUrl === this.$util.INDEX_PAGE_URL && this.name === 'DIY_VIEW_INDEX') {
return true; return true;
} }

View File

@@ -454,7 +454,7 @@ export default {
} }
}); });
} else { } else {
this.$refs.login.open('/pages/index/index'); this.$refs.login.open(this.$util.INDEX_PAGE_URL);
this.couponBtnSwitch = false; this.couponBtnSwitch = false;
} }
}, },

View File

@@ -157,7 +157,7 @@ export default {
/* 点赞 */ /* 点赞 */
giveLike(noteId, index) { giveLike(noteId, index) {
if (!this.storeToken) { if (!this.storeToken) {
this.$refs.login.open('/pages/index/index'); this.$refs.login.open(this.$util.INDEX_PAGE_URL);
return; return;
} }

View File

@@ -270,7 +270,7 @@ export default {
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 1000) }, 1000)
} }
} }

View File

@@ -45,7 +45,7 @@ export default {
if (this.emptyBtn.url) { if (this.emptyBtn.url) {
this.$util.redirectTo(this.emptyBtn.url, {}, 'redirectTo'); this.$util.redirectTo(this.emptyBtn.url, {}, 'redirectTo');
} else { } else {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
}, },
re(text) { re(text) {

View File

@@ -28,7 +28,7 @@ export default {
*/ */
addCart(config, data, event) { addCart(config, data, event) {
if (!this.storeToken) { if (!this.storeToken) {
this.$refs.login.open('/pages/index/index') this.$refs.login.open(this.$util.INDEX_PAGE_URL);
return; return;
} }
if (config == "detail" || data.is_virtual) { if (config == "detail" || data.is_virtual) {

View File

@@ -413,7 +413,7 @@
this.isLoad = false; this.isLoad = false;
if (callback) callback(); if (callback) callback();
} else { } else {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}); });
@@ -441,7 +441,7 @@
this.skuId = res.data[0].sku_id; this.skuId = res.data[0].sku_id;
this.goodsSkuInfo = obj; this.goodsSkuInfo = obj;
} else { } else {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}); });
@@ -467,7 +467,7 @@
this.skuId = res.data[0].sku_id; this.skuId = res.data[0].sku_id;
this.goodsSkuInfo = obj; this.goodsSkuInfo = obj;
} else { } else {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}); });
@@ -500,7 +500,7 @@
this.skuId = res.data[0].sku_id; this.skuId = res.data[0].sku_id;
this.goodsSkuInfo = obj; this.goodsSkuInfo = obj;
} else { } else {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}); });
@@ -527,7 +527,7 @@
this.skuId = res.data[0].sku_id; this.skuId = res.data[0].sku_id;
this.goodsSkuInfo = obj; this.goodsSkuInfo = obj;
} else { } else {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}); });
@@ -553,7 +553,7 @@
this.skuId = res.data[0].sku_id; this.skuId = res.data[0].sku_id;
this.goodsSkuInfo = obj; this.goodsSkuInfo = obj;
} else { } else {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}); });
@@ -579,7 +579,7 @@
this.skuId = res.data[0].sku_id; this.skuId = res.data[0].sku_id;
this.goodsSkuInfo = obj; this.goodsSkuInfo = obj;
} else { } else {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}); });
@@ -606,7 +606,7 @@
this.skuId = res.data[0].sku_id; this.skuId = res.data[0].sku_id;
this.goodsSkuInfo = obj; this.goodsSkuInfo = obj;
} else { } else {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}); });
@@ -630,7 +630,7 @@
this.skuId = res.data[0].sku_id; this.skuId = res.data[0].sku_id;
this.goodsSkuInfo = obj; this.goodsSkuInfo = obj;
} else { } else {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}); });

View File

@@ -185,7 +185,7 @@ export default {
title: '未获取到支付信息!' title: '未获取到支付信息!'
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 1500); }, 1500);
} }
} }

View File

@@ -138,7 +138,7 @@
break; break;
default: default:
if (this.back) this.$util.redirectTo(decodeURIComponent(this.back), {}, 'redirectTo'); if (this.back) this.$util.redirectTo(decodeURIComponent(this.back), {}, 'redirectTo');
else this.$util.redirectTo('/pages/index/index'); else this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
break; break;
} }
} }

View File

@@ -196,7 +196,7 @@
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
},1000); },1000);

View File

@@ -40,7 +40,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
}, 1000); }, 1000);

View File

@@ -59,7 +59,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
}, 1000); }, 1000);

View File

@@ -307,7 +307,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index', {}, 'redirectTo'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL, {}, 'redirectTo');
}, 2000); }, 2000);
} }
}, 1000); }, 1000);

View File

@@ -213,7 +213,7 @@
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
},1000); },1000);

View File

@@ -142,7 +142,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
}, 1000); }, 1000);

View File

@@ -105,7 +105,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
},1000); },1000);

View File

@@ -84,7 +84,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
}, 1000); }, 1000);

View File

@@ -65,7 +65,7 @@ export default {
this.$api.sendRequest({ this.$api.sendRequest({
url: '/fenxiao/api/fenxiao/poster', url: '/fenxiao/api/fenxiao/poster',
data: { data: {
page: '/pages/index/index', page: this.$util.INDEX_PAGE_URL,
qrcode_param: JSON.stringify({}), qrcode_param: JSON.stringify({}),
template_id: id template_id: id
}, },
@@ -154,7 +154,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
}, 1000); }, 1000);

View File

@@ -27,7 +27,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
}, 1000); }, 1000);

View File

@@ -113,7 +113,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
}, 1000); }, 1000);

View File

@@ -70,7 +70,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
}, 1000); }, 1000);

View File

@@ -302,7 +302,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
}, 1000); }, 1000);
@@ -544,7 +544,7 @@ export default {
if (getCurrentPages().length > 1) uni.navigateBack({ if (getCurrentPages().length > 1) uni.navigateBack({
delta: 1 delta: 1
}); });
else this.$util.redirectTo('/pages/index/index'); else this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, },
getNewestGame() { getNewestGame() {
this.$api.sendRequest({ this.$api.sendRequest({

View File

@@ -120,7 +120,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index', {}, 'redirectTo'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL, {}, 'redirectTo');
}, 2000); }, 2000);
} }
}, 1000); }, 1000);

View File

@@ -95,7 +95,7 @@ export default {
title: '未获取到创建订单所需数据!' title: '未获取到创建订单所需数据!'
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 1500); }, 1500);
} }
return; return;
@@ -122,7 +122,7 @@ export default {
title: '未获取到创建订单所需数据!' title: '未获取到创建订单所需数据!'
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 1500); }, 1500);
} }
}, },

View File

@@ -23,7 +23,7 @@
this.$util.redirectTo('/pages_promotion/point/order_list', {}, 'redirectTo'); this.$util.redirectTo('/pages_promotion/point/order_list', {}, 'redirectTo');
}, },
toIndex() { toIndex() {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}; };

View File

@@ -99,7 +99,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
}, 1000); }, 1000);

View File

@@ -58,7 +58,7 @@
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
},1000); },1000);

View File

@@ -71,7 +71,7 @@
this.$store.commit('setMemberInfo', ''); this.$store.commit('setMemberInfo', '');
this.$store.commit('setMemberInfo', ''); this.$store.commit('setMemberInfo', '');
this.$store.dispatch('emptyCart'); this.$store.dispatch('emptyCart');
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}); });

View File

@@ -40,7 +40,7 @@
this.$store.commit('setToken', ''); this.$store.commit('setToken', '');
this.$store.commit('setMemberInfo', ''); this.$store.commit('setMemberInfo', '');
this.$store.dispatch('emptyCart'); this.$store.dispatch('emptyCart');
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
} }

View File

@@ -60,7 +60,7 @@
</view> </view>
</view> </view>
<view v-if="!list.length && showEmpty" class="margin-top cart-empty" :fixed="false"> <view v-if="!list.length && showEmpty" class="margin-top cart-empty" :fixed="false">
<ns-empty :isIndex="true" :emptyBtn="{url: '/pages/index/index',text: '去逛逛'}" text="暂无优惠券"></ns-empty> <ns-empty :isIndex="true" :emptyBtn="{url: $util.INDEX_PAGE_URL,text: '去逛逛'}" text="暂无优惠券"></ns-empty>
</view> </view>
</block> </block>
</mescroll-uni> </mescroll-uni>
@@ -93,7 +93,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
},1000); },1000);

View File

@@ -1,8 +1,9 @@
export default { export default {
methods: { methods: {
// 跳转至登录页 // 跳转至登录页
toLogin() { toLogin(url) {
this.$refs.login.open(); console.log('跳转至登录页', {url, currentRoute: this.$util.getCurrentRoute()});
this.$refs.login.open(url ?? this.$util.getCurrentRoute());
} }
} }
} }

View File

@@ -51,7 +51,7 @@ export default {
this.$refs.rulePopup.close(); this.$refs.rulePopup.close();
}, },
copyUrl() { copyUrl() {
let text = this.$config.h5Domain + '/pages/index/index'; let text = this.$config.h5Domain + this.$util.INDEX_PAGE_URL;
if (this.memberInf && this.memberInfo.member_id) text += '?source_member=' + this.memberInfo.member_id; if (this.memberInf && this.memberInfo.member_id) text += '?source_member=' + this.memberInfo.member_id;
this.$util.copy(text, () => { this.$util.copy(text, () => {
this.closeSharePopup(); this.closeSharePopup();
@@ -76,7 +76,7 @@ export default {
this.$api.sendRequest({ this.$api.sendRequest({
url: "/memberrecommend/api/memberrecommend/poster", url: "/memberrecommend/api/memberrecommend/poster",
data: { data: {
page: '/pages/index/index', page: this.$util.INDEX_PAGE_URL,
qrcode_param: JSON.stringify(qrcode_param) qrcode_param: JSON.stringify(qrcode_param)
}, },
success: res => { success: res => {

View File

@@ -33,7 +33,7 @@ export default {
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 2000); }, 2000);
} }
},1000); },1000);

View File

@@ -54,7 +54,7 @@ export default {
title: '未获取到支付信息!' title: '未获取到支付信息!'
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
}, 1500); }, 1500);
} }
}, },

View File

@@ -133,7 +133,7 @@
title: '未获取到支付信息!' title: '未获取到支付信息!'
}); });
setTimeout(() => { setTimeout(() => {
this.$util.redirectTo('/pages/index/index', {}, 'reLaunch'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL, {}, 'reLaunch');
}, 1500); }, 1500);
} }
}, },
@@ -143,7 +143,7 @@
}); });
}, },
goHome() { goHome() {
this.$util.redirectTo('/pages/index/index', {}, 'reLaunch'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL, {}, 'reLaunch');
}, },
toOrderDetail(id) { toOrderDetail(id) {
if (this.payInfo.order_type == 2) { if (this.payInfo.order_type == 2) {

View File

@@ -30,7 +30,7 @@ export default {
data: {}, data: {},
success: res => { success: res => {
if (res.code == 0) { if (res.code == 0) {
this.$util.redirectTo('/pages/index/index'); this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
} }
} }
}); });