[仅供测试]重写navigateTo方法,解决微信小程序中超过10个页面栈时会出现的bug

master
学习很差啦 2022-07-20 18:24:49 +08:00
parent cbd73ae638
commit 09485747a6
58 changed files with 472 additions and 421 deletions

469
App.vue
View File

@ -1,234 +1,257 @@
<script> <script>
/** /**
* vuex管理登录状态具体可以参考官方登录模板示例 * vuex管理登录状态具体可以参考官方登录模板示例
*/ */
import { mapMutations } from "vuex"; import {
import APPUpdate from "@/plugins/APPUpdate"; mapMutations
import { getClipboardData } from "@/js_sdk/h5-copy/h5-copy.js"; } from "vuex";
import config from "@/config/config"; import APPUpdate from "@/plugins/APPUpdate";
import storage from "@/utils/storage"; import {
// getClipboardData
} from "@/js_sdk/h5-copy/h5-copy.js";
import config from "@/config/config";
import storage from "@/utils/storage";
export default {
data() {
return {
config,
};
},
/**
* 监听返回
*/
onBackPress(e) {
if (e.from == "backbutton") {
let routes = getCurrentPages();
let curRoute = routes[routes.length - 1].options;
routes.forEach((item) => {
if (
item.route == "pages/tabbar/cart/cartList" ||
item.route.indexOf("pages/product/goods") != -1
) {
uni.redirectTo({
url: item.route,
});
}
});
if (curRoute.addId) {
uni.reLaunch({
url: "/pages/tabbar/cart/cartList",
});
} else {
uni.navigateBack();
}
return true; //
}
},
methods: {
...mapMutations(["login"]),
},
onLaunch: function () {
// #ifdef APP-PLUS
this.checkArguments(); //
APPUpdate();
//
plus.globalEvent.addEventListener("newintent", (e) => {
this.checkArguments(); //
});
// #endif
// #ifdef MP-WEIXIN
this.applyUpdateWeChat();
// #endif
},
onShow() {
// #ifndef H5
this.getClipboard();
// #endif
// #ifdef APP-PLUS
if (storage.getShow()) {
if(uni.getSystemInfoSync().platform == 'ios'){
this.$u.route("/pages/tabbar/screen/fullScreen");
}
}
// #endif
},
methods: {
/**
* 微信小程序版本提交更新版本 解决缓存问题
*/
applyUpdateWeChat() {
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function (res) {
//
});
updateManager.onUpdateReady(function (res) {
uni.showModal({
title: "更新提示",
content: "发现新版本,是否重启应用?",
success(res) {
if (res.confirm) {
// applyUpdate
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(function (res) {
//
});
},
// TODO 广
launch() {
try {
// launchFlag 广
const value = uni.getStorageSync("launchFlag");
if (!value) {
// this.$u.route("/pages/index/agreement");
} else {
//app广
var w = plus.webview.open(
"/hybrid/html/advertise/advertise.html",
"本地地址",
{
top: 0,
bottom: 0,
zindex: 999,
},
"fade-in",
500
);
//4s广
setTimeout(function () {
plus.webview.close(w);
APPUpdate();
}, 3000);
}
} catch (e) {
// error
uni.setStorage({
key: "launchFlag",
data: true,
success: function () {
console.log("error时存储launchFlag");
},
});
}
},
/**
* 获取粘贴板数据
*/
async getClipboard() {
let res = await getClipboardData();
/**
* 解析粘贴板数据 /**
*/ * 路由监听并删除路由
* https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html
if (res.indexOf(config.shareLink) != -1 && (res!= this.$store.state.shareLink)) { * */
this.$store.state.shareLink = res // #ifdef MP-WEIXIN
uni.showModal({ wx.onAppRoute((res) => {
title: "提示", const pages = getCurrentPages();
content: "检测到一个分享链接是否跳转?", console.log("pages:" + pages.length,pages);
confirmText: "跳转", if (pages.length > 3) {
success: function (callback) { delete getCurrentPages()[2]
if (callback.confirm) { }
const path = res.split(config.shareLink)[1]; console.log('路由监听', {
if (path.indexOf("tabbar") != -1) { res
uni.switchTab({ })
url: path, })
}); // #endif
} else {
uni.navigateTo({
url: path,
});
}
}
},
});
}
},
/** export default {
* h5中打开app获取跳转app的链接并跳转 data() {
*/ return {
checkArguments() { config,
// #ifdef APP-PLUS };
setTimeout(() => { },
const args = plus.runtime.arguments;
if (args) {
const argsStr = decodeURIComponent(args); /**
const path = argsStr.split("//")[1]; * 监听返回
if (path.indexOf("tabbar") != -1) { */
uni.switchTab({ onBackPress(e) {
url: `/${path}`, if (e.from == "backbutton") {
}); let routes = getCurrentPages();
} else { let curRoute = routes[routes.length - 1].options;
uni.navigateTo({ routes.forEach((item) => {
url: `/${path}`, if (
}); item.route == "pages/tabbar/cart/cartList" ||
} item.route.indexOf("pages/product/goods") != -1
} ) {
}); uni.redirectTo({
// #endif url: item.route,
}, });
}, }
}; });
if (curRoute.addId) {
uni.reLaunch({
url: "/pages/tabbar/cart/cartList",
});
} else {
uni.navigateBack();
}
return true; //
}
},
methods: {
...mapMutations(["login"]),
},
onLaunch: function() {
// #ifdef APP-PLUS
this.checkArguments(); //
APPUpdate();
//
plus.globalEvent.addEventListener("newintent", (e) => {
this.checkArguments(); //
});
// #endif
// #ifdef MP-WEIXIN
this.applyUpdateWeChat();
// #endif
},
onShow() {
// #ifndef H5
this.getClipboard();
// #endif
// #ifdef APP-PLUS
if (storage.getShow()) {
if (uni.getSystemInfoSync().platform == 'ios') {
this.$u.route("/pages/tabbar/screen/fullScreen");
}
}
// #endif
},
methods: {
/**
* 微信小程序版本提交更新版本 解决缓存问题
*/
applyUpdateWeChat() {
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
//
});
updateManager.onUpdateReady(function(res) {
uni.showModal({
title: "更新提示",
content: "发现新版本,是否重启应用?",
success(res) {
if (res.confirm) {
// applyUpdate
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(function(res) {
//
});
},
// TODO 广
launch() {
try {
// launchFlag 广
const value = uni.getStorageSync("launchFlag");
if (!value) {
// this.$u.route("/pages/index/agreement");
} else {
//app广
var w = plus.webview.open(
"/hybrid/html/advertise/advertise.html",
"本地地址", {
top: 0,
bottom: 0,
zindex: 999,
},
"fade-in",
500
);
//4s广
setTimeout(function() {
plus.webview.close(w);
APPUpdate();
}, 3000);
}
} catch (e) {
// error
uni.setStorage({
key: "launchFlag",
data: true,
success: function() {
console.log("error时存储launchFlag");
},
});
}
},
/**
* 获取粘贴板数据
*/
async getClipboard() {
let res = await getClipboardData();
/**
* 解析粘贴板数据
*/
if (res.indexOf(config.shareLink) != -1 && (res != this.$store.state.shareLink)) {
this.$store.state.shareLink = res
uni.showModal({
title: "提示",
content: "检测到一个分享链接是否跳转?",
confirmText: "跳转",
success: function(callback) {
if (callback.confirm) {
const path = res.split(config.shareLink)[1];
if (path.indexOf("tabbar") != -1) {
uni.switchTab({
url: path,
});
} else {
this.$navigateTo({
url: path,
});
}
}
},
});
}
},
/**
* h5中打开app获取跳转app的链接并跳转
*/
checkArguments() {
// #ifdef APP-PLUS
setTimeout(() => {
const args = plus.runtime.arguments;
if (args) {
const argsStr = decodeURIComponent(args);
const path = argsStr.split("//")[1];
if (path.indexOf("tabbar") != -1) {
uni.switchTab({
url: `/${path}`,
});
} else {
this.$navigateTo({
url: `/${path}`,
});
}
}
});
// #endif
},
},
};
</script> </script>
<style lang="scss"> <style lang="scss">
@import "uview-ui/index.scss"; @import "uview-ui/index.scss";
// ------- x // ------- x
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
.mp-iphonex-bottom { .mp-iphonex-bottom {
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
box-sizing: content-box; box-sizing: content-box;
height: auto !important; height: auto !important;
padding-top: 10rpx; padding-top: 10rpx;
} }
// #endif
body { // #endif
background-color: $bg-color;
} body {
/************************ */ background-color: $bg-color;
.w200 { }
width: 200rpx !important;
} /************************ */
.flex1 { .w200 {
flex: 1; //flex width: 200rpx !important;
} }
.flex1 {
flex: 1; //flex
}
</style> </style>

View File

@ -46,20 +46,20 @@
formatPrice(item.price)[0] formatPrice(item.price)[0]
}}</span> }}</span>
.{{ formatPrice(item.price)[1] }} .{{ formatPrice(item.price)[1] }}
</span> </span>
<span class='wholesale-item'> <span class='wholesale-item'>
{{item.num}}{{goodsDetail.goodsUnit}} {{item.num}}{{goodsDetail.goodsUnit}}
</span> </span>
</div> </div>
</div> </div>
<div class="goods-price" v-else> <div class="goods-price" v-else>
<span> <span>
<span class="goods-price-bigshow">{{ <span class="goods-price-bigshow">{{
formatPrice(goodsDetail.price)[0] formatPrice(goodsDetail.price)[0]
}}</span> }}</span>
.{{ formatPrice(goodsDetail.price)[1] }} .{{ formatPrice(goodsDetail.price)[1] }}
</span> </span>
</div> </div>
</view> </view>
<view class="goods-check-skus"> <view class="goods-check-skus">
@ -68,12 +68,12 @@
{{ selectName }} {{ selectName }}
<span>{{ num }}</span> <span>{{ num }}</span>
</span> </span>
</view> </view>
<view class="goods-check-skus"> <view class="goods-check-skus">
库存 库存
<span class="goods-check-skus-name"> <span class="goods-check-skus-name">
<span>{{ goodsDetail.quantity }}</span> <span>{{ goodsDetail.quantity }}</span>
</span> </span>
</view> </view>
</view> </view>
</view> </view>
@ -101,7 +101,7 @@
<!-- 数量 --> <!-- 数量 -->
<view class="goods-skus-number"> <view class="goods-skus-number">
<view class="view-class-title">数量</view> <view class="view-class-title">数量</view>
<u-input style='text-align: right;' v-model="num" type="number" /> <u-input style='text-align: right;' v-model="num" type="number" />
</view> </view>
</scroll-view> </scroll-view>
@ -133,14 +133,14 @@
formatList: [], formatList: [],
currentSelceted: [], currentSelceted: [],
skuList: "", skuList: "",
isClose: false, // isClose: false, //
}; };
}, },
props: { props: {
wholesaleList:{ wholesaleList:{
type: null, type: null,
default: false, default: false,
}, },
buyMask: { buyMask: {
type: Boolean, type: Boolean,
@ -170,23 +170,23 @@
default: "", default: "",
type: null, type: null,
}, },
},
computed: {
wholesalePrice(key){
return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.price }) :[]
},
wholesaleNum(key){
return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.num }) :[]
}
}, },
watch: { computed: {
num(val){ wholesalePrice(key){
if(val){ return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.price }) :[]
if(val > this.goodsDetail.quantity){ },
console.log(val) wholesaleNum(key){
this.val = this.goodsDetail.quantity return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.num }) :[]
} }
} },
watch: {
num(val){
if(val){
if(val > this.goodsDetail.quantity){
console.log(val)
this.val = this.goodsDetail.quantity
}
}
}, },
buyType: { buyType: {
handler(val) { handler(val) {
@ -263,7 +263,7 @@
buy(data) { buy(data) {
API_trade.addToCart(data).then((res) => { API_trade.addToCart(data).then((res) => {
if (res.data.success) { if (res.data.success) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/order/fillorder?way=${ url: `/pages/order/fillorder?way=${
data.cartType data.cartType
}&addr=${""}&parentOrder=${encodeURIComponent( }&addr=${""}&parentOrder=${encodeURIComponent(
@ -314,7 +314,7 @@
API_trade.addToCart(data).then((res) => { API_trade.addToCart(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/order/fillorder?way=${data.cartType}&addr=${ url: `/pages/order/fillorder?way=${data.cartType}&addr=${
this.addr.id || "" this.addr.id || ""
}&parentOrder=${encodeURIComponent(JSON.stringify(this.parentOrder))}`, }&parentOrder=${encodeURIComponent(JSON.stringify(this.parentOrder))}`,
@ -399,9 +399,9 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./popup.scss"; @import "./popup.scss";
.price-row{ .price-row{
text-align: center; text-align: center;
} }
.buy { .buy {
background-image: linear-gradient(135deg, #ffba0d, #ffc30d 69%, #ffcf0d); background-image: linear-gradient(135deg, #ffba0d, #ffc30d 69%, #ffcf0d);
@ -422,8 +422,8 @@
.goods-skus-number { .goods-skus-number {
justify-content: space-between; justify-content: space-between;
display: flex; display: flex;
text-align: right text-align: right
} }
/deep/ .uni-scroll-view { /deep/ .uni-scroll-view {
@ -468,13 +468,13 @@
border-radius: 30rpx; border-radius: 30rpx;
} }
} }
} }
.wholesale-item{ .wholesale-item{
color: #999 !important; color: #999 !important;
font-size: 24rpx; font-size: 24rpx;
margin:0 20rpx; margin:0 20rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.goods-header { .goods-header {
@ -494,7 +494,7 @@
.goods-price { .goods-price {
color: $price-color; color: $price-color;
line-height: 80rpx; line-height: 80rpx;
margin-right: 20rpx; margin-right: 20rpx;
>* { >* {
color: $price-color; color: $price-color;
@ -536,4 +536,4 @@
color: #333; color: #333;
} }
} }
</style> </style>

View File

@ -151,7 +151,7 @@
for (let i of Array.from(keyword)) { for (let i of Array.from(keyword)) {
unicodes += this.unicode(i) + "|" unicodes += this.unicode(i) + "|"
} }
const rule = '(' + unicodes + ')' const rule = '(' + unicodes + ')'
const reg = new RegExp(rule, 'gi'); const reg = new RegExp(rule, 'gi');
return str ? str.replace(reg, matchValue => return str ? str.replace(reg, matchValue =>
`<span style="color:${this.lightColor}">${matchValue}</span>` `<span style="color:${this.lightColor}">${matchValue}</span>`
@ -198,13 +198,13 @@
}, },
// //
navigateToDetailPage(item) { navigateToDetailPage(item) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`, url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`,
}); });
}, },
// //
navigateToStoreDetailPage(item) { navigateToStoreDetailPage(item) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/shopPage?id=${item.content.storeId}`, url: `/pages/product/shopPage?id=${item.content.storeId}`,
}); });
}, },
@ -341,4 +341,4 @@
} }
} }
</style> </style>

View File

@ -62,7 +62,7 @@ export default {
this.goodsList.push(...goodsList.data.result.content); this.goodsList.push(...goodsList.data.result.content);
}, },
handleClick(item) { handleClick(item) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`, url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`,
}); });
}, },

View File

@ -3,7 +3,7 @@ import App from "./App";
import * as filters from "./utils/filters.js"; // global filter import * as filters from "./utils/filters.js"; // global filter
import uView from "uview-ui"; import uView from "uview-ui";
import store from "./store"; import store from "./store";
import {navigateTo} from '@/utils/navigateRoute.js'
/** /**
* 仅在h5中显示唤醒app功能 * 仅在h5中显示唤醒app功能
@ -27,6 +27,10 @@ Object.keys(filters).forEach((key) => {
// 引入Vuex // 引入Vuex
Vue.prototype.$store = store; Vue.prototype.$store = store;
// // 引入Vuex
Vue.prototype.$navigateTo = navigateTo;
Vue.use(uView); Vue.use(uView);
Vue.config.productionTip = false; Vue.config.productionTip = false;

View File

@ -145,7 +145,7 @@
}, },
}, },
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {
uni.navigateTo({ this.$navigateTo({
url: "/pages/cart/coupon/couponIntro", url: "/pages/cart/coupon/couponIntro",
}); });
}, },

View File

@ -189,7 +189,7 @@ export default {
*/ */
useItNow(item) { useItNow(item) {
if (item.storeId && item.storeId!='0') { if (item.storeId && item.storeId!='0') {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/shopPage?id=${item.storeId}`, url: `/pages/product/shopPage?id=${item.storeId}`,
}); });
} else { } else {
@ -203,7 +203,7 @@ export default {
* 优惠券详情 * 优惠券详情
*/ */
couponDetail(item) { couponDetail(item) {
uni.navigateTo({ this.$navigateTo({
url: url:
"/pages/cart/coupon/couponDetail?item=" + "/pages/cart/coupon/couponDetail?item=" +
encodeURIComponent(JSON.stringify(item)), encodeURIComponent(JSON.stringify(item)),

View File

@ -120,7 +120,7 @@
* 支付成功后跳转 * 支付成功后跳转
*/ */
callback(paymentMethod){ callback(paymentMethod){
uni.navigateTo({ this.$navigateTo({
url: "/pages/cart/payment/success?paymentMethod=" + url: "/pages/cart/payment/success?paymentMethod=" +
paymentMethod + paymentMethod +
"&payPrice=" + "&payPrice=" +
@ -138,7 +138,7 @@
if (this.routerVal.recharge_sn) { if (this.routerVal.recharge_sn) {
// //
this.sn = this.routerVal.recharge_sn; this.sn = this.routerVal.recharge_sn;
this.orderType = "RECHARGE"; this.orderType = "RECHARGE";
} else if (this.routerVal.trade_sn) { } else if (this.routerVal.trade_sn) {
this.sn = this.routerVal.trade_sn; this.sn = this.routerVal.trade_sn;
@ -178,12 +178,12 @@
this.payList = res.data.result.support.filter((item) => { this.payList = res.data.result.support.filter((item) => {
return item != "ALIPAY"; return item != "ALIPAY";
}); });
// //
if(this.orderType == "RECHARGE"){ if(this.orderType == "RECHARGE"){
this.payList = res.data.result.support.filter((item) => { this.payList = res.data.result.support.filter((item) => {
return item == "WECHAT"; return item == "WECHAT";
}); });
} }
} }

View File

@ -1,11 +1,11 @@
<template> <template>
<view class="add-address"> <view class="add-address">
<div class="uForm"> <div class="uForm">
<u-form :border-bottom="false" :model="form" ref="uForm" :error-type="['toast']" :rule="rules"> <u-form :border-bottom="false" :model="form" ref="uForm" :error-type="['toast']" :rule="rules">
<!-- #ifndef H5 --> <!-- #ifndef H5 -->
<view class="selectAddress" @click="clickUniMap"> <view class="selectAddress" @click="clickUniMap">
选择收货地址 选择收货地址
</view> </view>
<!-- #endif --> <!-- #endif -->
<u-form-item class="border" label="收货人" label-width="130" prop="name"> <u-form-item class="border" label="收货人" label-width="130" prop="name">
<u-input v-model="form.name" clearable placeholder="请输入收货人姓名" /> <u-input v-model="form.name" clearable placeholder="请输入收货人姓名" />
@ -162,7 +162,7 @@ export default {
delete this.form.updateTime; delete this.form.updateTime;
editAddress(this.form).then((res) => { editAddress(this.form).then((res) => {
if (res.data.success) { if (res.data.success) {
uni.navigateTo({ this.$navigateTo({
url: `/${beforePage.route}`, url: `/${beforePage.route}`,
}); });
} }

View File

@ -129,7 +129,7 @@ export default {
// //
addAddress(id) { addAddress(id) {
if (id) { if (id) {
uni.navigateTo({ this.$navigateTo({
url: url:
"/pages/mine/address/add?id=" + "/pages/mine/address/add?id=" +
id + id +
@ -138,7 +138,7 @@ export default {
"&type=order", "&type=order",
}); });
} else { } else {
uni.navigateTo({ this.$navigateTo({
url: url:
"/pages/mine/address/add?way=" + this.routerVal.way + "&type=order", "/pages/mine/address/add?way=" + this.routerVal.way + "&type=order",
}); });

View File

@ -145,7 +145,7 @@ export default {
}, },
// //
addAddress(id) { addAddress(id) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/mine/address/add${id ? "?id=" + id : ""}`, url: `/pages/mine/address/add${id ? "?id=" + id : ""}`,
}); });
}, },

View File

@ -50,7 +50,7 @@ export default {
* 跳转 * 跳转
*/ */
navgition(url) { navgition(url) {
uni.navigateTo({ this.$navigateTo({
url, url,
}); });
}, },

View File

@ -38,7 +38,7 @@ export default {
let res = await recharge({ price: this.price }); let res = await recharge({ price: this.price });
if (res.data.success) { if (res.data.success) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/cart/payment/payOrder?orderType=RECHARGE&recharge_sn=${res.data.result.rechargeSn}`, url: `/pages/cart/payment/payOrder?orderType=RECHARGE&recharge_sn=${res.data.result.rechargeSn}`,
}); });
} }

View File

@ -58,12 +58,12 @@ export default {
}, },
methods: { methods: {
handleClick(url) { handleClick(url) {
uni.navigateTo({ this.$navigateTo({
url, url,
}); });
}, },
queryGoods(src) { queryGoods(src) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/mine/distribution/${src}`, url: `/pages/mine/distribution/${src}`,
}); });
}, },

View File

@ -221,7 +221,7 @@ export default {
* 查看图片 * 查看图片
*/ */
handleNavgationGoods(val) { handleNavgationGoods(val) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${val.skuId}&goodsId=${val.goodsId}`, url: `/pages/product/goods?id=${val.skuId}&goodsId=${val.goodsId}`,
}); });
}, },

View File

@ -56,7 +56,7 @@
methods: { methods: {
...mapMutations(["logout"]), ...mapMutations(["logout"]),
navigateTo(url) { navigateTo(url) {
uni.navigateTo({ this.$navigateTo({
url url
}); });
}, },

View File

@ -45,7 +45,7 @@ export default {
}, },
methods: { methods: {
goDetail(sn,logi_id,ship_no){ goDetail(sn,logi_id,ship_no){
uni.navigateTo({ this.$navigateTo({
url:'/pages/msgTips/packagemsg/logisticsDetail?order_sn=' + sn +'&logi_id='+logi_id+'&ship_no='+ship_no, url:'/pages/msgTips/packagemsg/logisticsDetail?order_sn=' + sn +'&logi_id='+logi_id+'&ship_no='+ship_no,
}) })
}, },

View File

@ -174,7 +174,7 @@
*/ */
goGoodsDetail(val) { goGoodsDetail(val) {
// //
uni.navigateTo({ this.$navigateTo({
url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId, url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId,
}); });
}, },
@ -184,7 +184,7 @@
*/ */
goStoreMainPage(id) { goStoreMainPage(id) {
// //
uni.navigateTo({ this.$navigateTo({
url: "/pages/product/shopPage?id=" + id, url: "/pages/product/shopPage?id=" + id,
}); });
}, },

View File

@ -84,7 +84,7 @@
* 导航到店铺 * 导航到店铺
*/ */
navgaiteToStore(val) { navgaiteToStore(val) {
uni.navigateTo({ this.$navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId, url: "/pages/product/shopPage?id=" + val.storeId,
}); });
}, },
@ -100,7 +100,7 @@
* 跳转详情 * 跳转详情
*/ */
navgaiteToDetail(item) { navgaiteToDetail(item) {
uni.navigateTo({ this.$navigateTo({
url: "/pages/product/goods?id=" + item.id + "&goodsId=" + item.goodsId, url: "/pages/product/goods?id=" + item.id + "&goodsId=" + item.goodsId,
}); });
}, },
@ -256,4 +256,4 @@
display: -webkit-flex; display: -webkit-flex;
display: flex; display: flex;
} }
</style> </style>

View File

@ -88,7 +88,7 @@ export default {
}, },
navigateTo(url) { navigateTo(url) {
uni.navigateTo({ this.$navigateTo({
url, url,
}); });
}, },

View File

@ -16,7 +16,7 @@ export default {
methods: { methods: {
navigateTo(url) { navigateTo(url) {
uni.navigateTo({ this.$navigateTo({
url: url, url: url,
}); });
}, },

View File

@ -49,7 +49,7 @@ export default {
if (url == "/pages/set/securityCenter/securityCenter") { if (url == "/pages/set/securityCenter/securityCenter") {
url += `?mobile=${this.userInfo.mobile}`; url += `?mobile=${this.userInfo.mobile}`;
} }
uni.navigateTo({ this.$navigateTo({
url: url, url: url,
}); });
}, },

View File

@ -488,13 +488,13 @@ export default {
}, },
// //
navigateToDetailPage(item) { navigateToDetailPage(item) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`, url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`,
}); });
}, },
// //
navigateToStoreDetailPage(item) { navigateToStoreDetailPage(item) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/shopPage?id=${item.content.storeId}`, url: `/pages/product/shopPage?id=${item.content.storeId}`,
}); });
}, },

View File

@ -351,7 +351,7 @@ export default {
* 售后详情 * 售后详情
*/ */
afterDetails(order) { afterDetails(order) {
uni.navigateTo({ this.$navigateTo({
url: "./applyDetail?sn=" + order.sn, url: "./applyDetail?sn=" + order.sn,
}); });
}, },
@ -394,7 +394,7 @@ export default {
...sku, ...sku,
}; };
storage.setAfterSaleData(data); storage.setAfterSaleData(data);
uni.navigateTo({ this.$navigateTo({
url: `/pages/order/afterSales/afterSalesSelect?sn=${sn}`, url: `/pages/order/afterSales/afterSalesSelect?sn=${sn}`,
}); });
}, },
@ -410,7 +410,7 @@ export default {
}; };
storage.setAfterSaleData(data); storage.setAfterSaleData(data);
uni.navigateTo({ this.$navigateTo({
url: `./afterSalesDetailExpress?serviceSn=${order.sn}`, url: `./afterSalesDetailExpress?serviceSn=${order.sn}`,
}); });
}, },
@ -421,13 +421,13 @@ export default {
onDetail(goods, sku) { onDetail(goods, sku) {
// //
if (this.current == 0) { if (this.current == 0) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${sku.skuId}&goodsId=${ url: `/pages/product/goods?id=${sku.skuId}&goodsId=${
sku.goodsId || sku.goodsId sku.goodsId || sku.goodsId
}`, }`,
}); });
} else { } else {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${goods.skuId}&goodsId=${ url: `/pages/product/goods?id=${goods.skuId}&goodsId=${
goods.goodsId || goods.goodsId goods.goodsId || goods.goodsId
}`, }`,

View File

@ -94,7 +94,7 @@ export default {
* 跳转到商品信息 * 跳转到商品信息
*/ */
navigateToGoodsDetail(id) { navigateToGoodsDetail(id) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${id}&goodsId=${goodsId}`, url: `/pages/product/goods?id=${id}&goodsId=${goodsId}`,
}); });
}, },

View File

@ -381,7 +381,7 @@ export default {
* 访问商品详情 * 访问商品详情
*/ */
navgiateToGoodsDetail(item) { navgiateToGoodsDetail(item) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`, url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
}); });
}, },
@ -390,7 +390,7 @@ export default {
* 进度 * 进度
*/ */
onProgress() { onProgress() {
uni.navigateTo({ this.$navigateTo({
url: `./applyProgress?sn=${ url: `./applyProgress?sn=${
this.serviceDetail.sn this.serviceDetail.sn
}&createTime=${encodeURIComponent(this.serviceDetail.createTime)} }&createTime=${encodeURIComponent(this.serviceDetail.createTime)}

View File

@ -86,7 +86,7 @@ export default {
methods: { methods: {
// //
handleToGoods(val) { handleToGoods(val) {
uni.navigateTo({ this.$navigateTo({
url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId, url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId,
}); });
}, },
@ -120,7 +120,7 @@ export default {
* 查看详情 * 查看详情
*/ */
handleInfo(val) { handleInfo(val) {
uni.navigateTo({ this.$navigateTo({
url: "./complainInfo?id=" + val.id, url: "./complainInfo?id=" + val.id,
}); });
}, },

View File

@ -219,7 +219,7 @@ export default {
*/ */
talkCommont(sku) { talkCommont(sku) {
console.log(sku); console.log(sku);
uni.navigateTo({ this.$navigateTo({
url: `./releaseEvaluate?sn=${sku.sn}&sku=${encodeURIComponent( url: `./releaseEvaluate?sn=${sku.sn}&sku=${encodeURIComponent(
JSON.stringify(sku) JSON.stringify(sku)
)}`, )}`,
@ -270,7 +270,7 @@ export default {
* 评价详情 * 评价详情
*/ */
onDetail(comment) { onDetail(comment) {
uni.navigateTo({ this.$navigateTo({
url: url:
"./evaluateDetail?comment=" + "./evaluateDetail?comment=" +
encodeURIComponent(JSON.stringify(comment)), encodeURIComponent(JSON.stringify(comment)),

View File

@ -481,7 +481,7 @@ export default {
// //
navigateToStore(val) { navigateToStore(val) {
uni.navigateTo({ this.$navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId, url: "/pages/product/shopPage?id=" + val.storeId,
}); });
}, },
@ -555,7 +555,7 @@ export default {
* 跳转 * 跳转
*/ */
navigateTo(url) { navigateTo(url) {
uni.navigateTo({ this.$navigateTo({
url, url,
}); });
}, },

View File

@ -340,7 +340,7 @@ export default {
* 替换onLoad下代码即可 * 替换onLoad下代码即可
*/ */
let status = Number(options.status); let status = Number(options.status);
this.status = status; this.status = status;
this.tabCurrentIndex = status; this.tabCurrentIndex = status;
// if (status == 0) { // if (status == 0) {
@ -364,14 +364,14 @@ export default {
methods: { methods: {
// //
applyService(order) { applyService(order) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/order/afterSales/afterSales?orderSn=${order.sn}`, url: `/pages/order/afterSales/afterSales?orderSn=${order.sn}`,
}); });
}, },
// //
navigateToStore(val) { navigateToStore(val) {
uni.navigateTo({ this.$navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId, url: "/pages/product/shopPage?id=" + val.storeId,
}); });
}, },
@ -423,7 +423,7 @@ export default {
}).pay(); }).pay();
// #endif // #endif
// #ifndef MP-WEIXIN // #ifndef MP-WEIXIN
uni.navigateTo({ this.$navigateTo({
url: "/pages/cart/payment/payOrder?order_sn=" + val.sn, url: "/pages/cart/payment/payOrder?order_sn=" + val.sn,
}); });
// #endif // #endif
@ -522,7 +522,7 @@ export default {
* 跳转到订单详情 * 跳转到订单详情
*/ */
navigateToOrderDetail(sn) { navigateToOrderDetail(sn) {
uni.navigateTo({ this.$navigateTo({
url: "./orderDetail?sn=" + sn, url: "./orderDetail?sn=" + sn,
}); });
}, },
@ -588,7 +588,7 @@ export default {
* 评价商品 * 评价商品
*/ */
onComment(sn) { onComment(sn) {
uni.navigateTo({ this.$navigateTo({
url: "./evaluate/myEvaluate", url: "./evaluate/myEvaluate",
}); });
}, },
@ -599,7 +599,7 @@ export default {
reBuy(order) { reBuy(order) {
console.log(order); console.log(order);
return; return;
uni.navigateTo({ this.$navigateTo({
url: url:
"/pages/product/goods?id=" + order.id + "&goodsId=" + order.goodsId, "/pages/product/goods?id=" + order.id + "&goodsId=" + order.goodsId,
}); });
@ -609,7 +609,7 @@ export default {
* 查看物流 * 查看物流
*/ */
navigateToLogistics(order) { navigateToLogistics(order) {
uni.navigateTo({ this.$navigateTo({
url: url:
"/pages/mine/msgTips/packageMsg/logisticsDetail?order_sn=" + order.sn, "/pages/mine/msgTips/packageMsg/logisticsDetail?order_sn=" + order.sn,
}); });

View File

@ -277,7 +277,7 @@ export default {
}, },
methods: { methods: {
tostore(val) { tostore(val) {
uni.navigateTo({ this.$navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId, url: "/pages/product/shopPage?id=" + val.storeId,
}); });
}, },
@ -294,7 +294,7 @@ export default {
}, },
// #TODO // #TODO
ByUserMessage(order) { ByUserMessage(order) {
uni.navigateTo({ this.$navigateTo({
url: url:
"/pages/cart/payment/shareOrderGoods?sn=" + "/pages/cart/payment/shareOrderGoods?sn=" +
order.sn + order.sn +
@ -318,12 +318,12 @@ export default {
}); });
}, },
onReceipt(val) { onReceipt(val) {
uni.navigateTo({ this.$navigateTo({
url: "/pages/order/invoice/invoiceDetail?id=" + val.id, url: "/pages/order/invoice/invoiceDetail?id=" + val.id,
}); });
}, },
gotoGoodsDetail(sku) { gotoGoodsDetail(sku) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${sku.skuId}&goodsId=${sku.goodsId}`, url: `/pages/product/goods?id=${sku.skuId}&goodsId=${sku.goodsId}`,
}); });
}, },
@ -363,7 +363,7 @@ export default {
* 投诉 * 投诉
*/ */
complaint(sku) { complaint(sku) {
uni.navigateTo({ this.$navigateTo({
url: url:
"/pages/order/complain/complain?sn=" + "/pages/order/complain/complain?sn=" +
this.sn + this.sn +
@ -373,7 +373,7 @@ export default {
}, },
// //
onAfterSales(sn, sku) { onAfterSales(sn, sku) {
uni.navigateTo({ this.$navigateTo({
url: `./afterSales/afterSalesSelect?sn=${sn}&sku=${encodeURIComponent( url: `./afterSales/afterSalesSelect?sn=${sn}&sku=${encodeURIComponent(
JSON.stringify(sku) JSON.stringify(sku)
)}`, )}`,
@ -382,7 +382,7 @@ export default {
// //
toPay(val) { toPay(val) {
val.sn val.sn
? uni.navigateTo({ ? this.$navigateTo({
url: "/pages/cart/payment/payOrder?order_sn=" + val.sn, url: "/pages/cart/payment/payOrder?order_sn=" + val.sn,
}) })
: false; : false;
@ -459,12 +459,12 @@ export default {
}, },
// //
onComment(sn) { onComment(sn) {
uni.navigateTo({ this.$navigateTo({
url: "./evaluate/myEvaluate", url: "./evaluate/myEvaluate",
}); });
}, // }, //
onLogistics(order) { onLogistics(order) {
uni.navigateTo({ this.$navigateTo({
url: url:
"/pages/mine/msgTips/packageMsg/logisticsDetail?logi_id=" + "/pages/mine/msgTips/packageMsg/logisticsDetail?logi_id=" +
order.logi_id + order.logi_id +
@ -480,7 +480,7 @@ export default {
this.reason = reason; this.reason = reason;
}, },
reBuy(order) { reBuy(order) {
uni.navigateTo({ this.$navigateTo({
url: url:
"/pages/product/goods?id=" + order.id + "&goodsId=" + order.goodsId, "/pages/product/goods?id=" + order.id + "&goodsId=" + order.goodsId,
}); });

View File

@ -545,7 +545,7 @@ export default {
if (user.data.result.mobile) { if (user.data.result.mobile) {
whetherNavigate(); whetherNavigate();
} else { } else {
uni.navigateTo({ this.$navigateTo({
url: "/pages/passport/bindUserPhone", url: "/pages/passport/bindUserPhone",
}); });
} }
@ -639,13 +639,13 @@ export default {
}, },
// //
navigateToPrivacy(val) { navigateToPrivacy(val) {
uni.navigateTo({ this.$navigateTo({
url: "/pages/mine/help/tips?type=" + val, url: "/pages/mine/help/tips?type=" + val,
}); });
console.log(val) console.log(val)
}, },
navigateToPrivacys(val){ navigateToPrivacys(val){
uni.navigateTo({ this.$navigateTo({
url:"/pages/mine/help/tips?type="+ val, url:"/pages/mine/help/tips?type="+ val,
}) })
}, },

View File

@ -718,13 +718,13 @@ export default {
linkMsgDetail() { linkMsgDetail() {
// lili // lili
uni.navigateTo({ this.$navigateTo({
url: `/pages/tabbar/home/web-view?IM=${this.storeDetail.storeId}`, url: `/pages/tabbar/home/web-view?IM=${this.storeDetail.storeId}`,
}); });
// udesk // udesk
// if (this.storeDetail.merchantEuid) { // if (this.storeDetail.merchantEuid) {
// uni.navigateTo({ // this.$navigateTo({
// url: `/pages/tabbar/home/web-view?src=${this.IM}`, // url: `/pages/tabbar/home/web-view?src=${this.IM}`,
// }); // });
// } // }
@ -744,7 +744,7 @@ export default {
// sign: this.storeDetail.yzfSign, // sign: this.storeDetail.yzfSign,
// mpSign: this.storeDetail.yzfMpSign, // mpSign: this.storeDetail.yzfMpSign,
// }; // };
// uni.navigateTo({ // this.$navigateTo({
// url: // url:
// "/pages/product/customerservice/index?params=" + // "/pages/product/customerservice/index?params=" +
// encodeURIComponent(JSON.stringify(params)), // encodeURIComponent(JSON.stringify(params)),
@ -752,7 +752,7 @@ export default {
// // #endif // // #endif
// // #ifndef MP-WEIXIN // // #ifndef MP-WEIXIN
// const sign = this.storeDetail.yzfSign; // const sign = this.storeDetail.yzfSign;
// uni.navigateTo({ // this.$navigateTo({
// url: // url:
// "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" + // "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" +
// sign, // sign,
@ -916,7 +916,7 @@ export default {
* 跳转到店铺页面 * 跳转到店铺页面
*/ */
navigateToStore(store_id) { navigateToStore(store_id) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/shopPage?id=` + store_id, url: `/pages/product/shopPage?id=` + store_id,
}); });
}, },

View File

@ -94,7 +94,7 @@ export default {
); );
}, },
toComment(id, grade) { toComment(id, grade) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/comment?id=${id}&grade=${grade}`, url: `/pages/product/comment?id=${id}&grade=${grade}`,
}); });
}, },

View File

@ -54,7 +54,7 @@ export default {
this.getShippingAddress() this.getShippingAddress()
} }
else{ else{
uni.navigateTo({ this.$navigateTo({
url: 'pages/passport/login' url: 'pages/passport/login'
}); });
} }
@ -71,7 +71,7 @@ export default {
getpicker() { getpicker() {
// this.$refs.cityPicker.show(); // this.$refs.cityPicker.show();
uni.navigateTo({ this.$navigateTo({
url: "/pages/mine/address/add", url: "/pages/mine/address/add",
}); });
this.closeAddress(); this.closeAddress();

View File

@ -57,13 +57,13 @@ export default {
}, },
// //
clickGoods(val) { clickGoods(val) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${val.content.id}&goodsId=${val.content.goodsId}`, url: `/pages/product/goods?id=${val.content.id}&goodsId=${val.content.goodsId}`,
}); });
}, },
tostorePage(val) { tostorePage(val) {
uni.navigateTo({ this.$navigateTo({
url: "../product/shopPage?id=" + val.storeId, url: "../product/shopPage?id=" + val.storeId,
}); });
}, },

View File

@ -74,7 +74,7 @@ export default {
}, },
methods: { methods: {
handleClickStore(val){ handleClickStore(val){
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/shopPage?id=${val.id}` url: `/pages/product/shopPage?id=${val.id}`
}); });
}, },

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<u-navbar :border-bottom="false"> <u-navbar :border-bottom="false">
<u-search v-model="keyword" @custom='search' :show-action="true" action-text="搜索" :animation="true" @search="search" @click="search" placeholder="请输入搜索"></u-search> <u-search v-model="keyword" @custom='search' :show-action="true" action-text="搜索" :animation="true" @search="search" @click="search" placeholder="请输入搜索"></u-search>
</u-navbar> </u-navbar>
<div class="wrapper"> <div class="wrapper">
@ -58,7 +58,7 @@
<!-- menu --> <!-- menu -->
<!-- 商品 --> <!-- 商品 -->
<div class="contant" v-if="current == 0"> <div class="contant" v-if="current == 0">
<u-empty style='margin-top:100rpx' v-if="goodsList.length == 0" class="empty" text='暂无商品信息'></u-empty> <u-empty style='margin-top:100rpx' v-if="goodsList.length == 0" class="empty" text='暂无商品信息'></u-empty>
<goodsTemplate v-else :res="goodsList" :storeName="false" /> <goodsTemplate v-else :res="goodsList" :storeName="false" />
@ -84,7 +84,7 @@
</template> </template>
<script> <script>
import { getStoreBaseInfo, getStoreCategory } from "@/api/store.js"; import { getStoreBaseInfo, getStoreCategory } from "@/api/store.js";
import goodsTemplate from '@/components/m-goods-list/list' import goodsTemplate from '@/components/m-goods-list/list'
import { import {
receiveCoupons, receiveCoupons,
@ -119,7 +119,7 @@ export default {
current(val) { current(val) {
val == 0 ? ()=>{ this.goodsList = []; this.getGoodsData()} : this.getCategoryData(); val == 0 ? ()=>{ this.goodsList = []; this.getGoodsData()} : this.getCategoryData();
}, },
}, },
components:{goodsTemplate}, components:{goodsTemplate},
/** /**
@ -152,7 +152,7 @@ export default {
methods: { methods: {
getStoreLicencePhoto() { getStoreLicencePhoto() {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/licencePhoto?id=${this.storeId}`, url: `/pages/product/licencePhoto?id=${this.storeId}`,
}); });
}, },
@ -190,7 +190,7 @@ export default {
// sign: this.storeInfo.yzfSign, // sign: this.storeInfo.yzfSign,
// mpSign: this.storeInfo.yzfMpSign, // mpSign: this.storeInfo.yzfMpSign,
// }; // };
// uni.navigateTo({ // this.$navigateTo({
// url: // url:
// "/pages/product/customerservice/index?params=" + // "/pages/product/customerservice/index?params=" +
// encodeURIComponent(JSON.stringify(params)), // encodeURIComponent(JSON.stringify(params)),
@ -198,15 +198,15 @@ export default {
// // #endif // // #endif
// // #ifndef MP-WEIXIN // // #ifndef MP-WEIXIN
// const sign = this.storeInfo.yzfSign; // const sign = this.storeInfo.yzfSign;
// uni.navigateTo({ // this.$navigateTo({
// url: // url:
// "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" + // "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" +
// sign, // sign,
// }); // });
// // #endif // // #endif
uni.navigateTo({ this.$navigateTo({
url: `/pages/tabbar/home/web-view?IM=${this.storeId}`, url: `/pages/tabbar/home/web-view?IM=${this.storeId}`,
}); });
}, },
@ -227,7 +227,7 @@ export default {
/**商品分类中商品集合 */ /**商品分类中商品集合 */
getCategoryGoodsList(val) { getCategoryGoodsList(val) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/shopPageGoods?title=${val.labelName}&id=${val.id}&storeId=${this.storeId}`, url: `/pages/product/shopPageGoods?title=${val.labelName}&id=${val.id}&storeId=${this.storeId}`,
}); });
}, },
@ -235,9 +235,9 @@ export default {
/** /**
* 搜索 * 搜索
*/ */
search() { search() {
console.log("点击") console.log("点击")
uni.navigateTo({ this.$navigateTo({
url: `/pages/navigation/search/searchPage?storeId=${this.storeId}&keyword=${this.keyword}`, url: `/pages/navigation/search/searchPage?storeId=${this.storeId}&keyword=${this.keyword}`,
}); });
}, },
@ -261,7 +261,7 @@ export default {
async getGoodsData() { async getGoodsData() {
let res = await getGoodsList(this.goodsParams); let res = await getGoodsList(this.goodsParams);
if (res.data.success) { if (res.data.success) {
this.goodsList.push(...res.data.result.content); this.goodsList.push(...res.data.result.content);
console.log(this.goodsList) console.log(this.goodsList)
} }
}, },

View File

@ -74,7 +74,7 @@ export default {
// //
navigateToBargainDetail(val) { navigateToBargainDetail(val) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/promotion/bargain/detail?id=${val.id}`, url: `/pages/promotion/bargain/detail?id=${val.id}`,
}); });
}, },

View File

@ -67,7 +67,7 @@ export default {
}, },
// //
navigateToBargainDetail(val) { navigateToBargainDetail(val) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/promotion/bargain/detail?id=${val.kanjiaActivityGoodsId}`, url: `/pages/promotion/bargain/detail?id=${val.kanjiaActivityGoodsId}`,
}); });
}, },

View File

@ -113,7 +113,7 @@ export default {
}, },
toHref(goods) { toHref(goods) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${goods.skuId}&goodsId=${goods.goodsId}`, url: `/pages/product/goods?id=${goods.skuId}&goodsId=${goods.goodsId}`,
}); });
}, },

View File

@ -229,7 +229,7 @@ export default {
let customParams = encodeURIComponent( let customParams = encodeURIComponent(
JSON.stringify({ path: "pages/index/index", pid: 1 }) JSON.stringify({ path: "pages/index/index", pid: 1 })
); // 600 ); // 600
uni.navigateTo({ this.$navigateTo({
url: url:
"plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=" + "plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=" +
roomId + roomId +

View File

@ -137,14 +137,14 @@ export default {
methods: { methods: {
// //
navigateTo(url) { navigateTo(url) {
uni.navigateTo({ this.$navigateTo({
url, url,
}); });
}, },
toGoods(item) { toGoods(item) {
// //
uni.navigateTo({ this.$navigateTo({
url: `/pages/promotion/point/detail?id=${item.id}`, url: `/pages/promotion/point/detail?id=${item.id}`,
}); });
}, },

View File

@ -151,7 +151,7 @@ export default {
) { ) {
return; return;
} else { } else {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${item.skuId}&goodsId=${item.goodsId}`, url: `/pages/product/goods?id=${item.skuId}&goodsId=${item.goodsId}`,
}); });
} }

View File

@ -111,8 +111,8 @@
预估到手价 <span>{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span> 预估到手价 <span>{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span>
<span>.{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span> <span>.{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span>
</div> </div>
<div style='margin-left: 20rpx;' v-if="!skuItem.checked && skuItem.errorMessage"> <div style='margin-left: 20rpx;' v-if="!skuItem.checked && skuItem.errorMessage">
{{skuItem.errorMessage}} {{skuItem.errorMessage}}
</div> </div>
</view> </view>
</view> </view>
@ -343,7 +343,7 @@ export default {
* 跳转到店铺 * 跳转到店铺
*/ */
navigateToStore(val) { navigateToStore(val) {
uni.navigateTo({ this.$navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId, url: "/pages/product/shopPage?id=" + val.storeId,
}); });
}, },
@ -352,7 +352,7 @@ export default {
* 跳转到优惠券 * 跳转到优惠券
*/ */
navigateToConpon(val) { navigateToConpon(val) {
uni.navigateTo({ this.$navigateTo({
url: "/pages/cart/coupon/couponCenter?storeId=" + val.storeId, url: "/pages/cart/coupon/couponCenter?storeId=" + val.storeId,
}); });
}, },
@ -361,7 +361,7 @@ export default {
* 跳转到商品 * 跳转到商品
*/ */
navigateToGoods(val) { navigateToGoods(val) {
uni.navigateTo({ this.$navigateTo({
url: url:
"/pages/product/goods?id=" + "/pages/product/goods?id=" +
val.goodsSku.id + val.goodsSku.id +
@ -437,7 +437,7 @@ export default {
* 跳转 * 跳转
*/ */
navigateTo(url) { navigateTo(url) {
uni.navigateTo({ this.$navigateTo({
url, url,
}); });
}, },

View File

@ -57,7 +57,7 @@ export default {
* 查询 * 查询
*/ */
search() { search() {
uni.navigateTo({ this.$navigateTo({
url: "/pages/navigation/search/searchPage", url: "/pages/navigation/search/searchPage",
}); });
}, },
@ -90,7 +90,7 @@ export default {
}, },
navigateToList(sid, tid) { navigateToList(sid, tid) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/navigation/search/searchPage?category=${tid}`, url: `/pages/navigation/search/searchPage?category=${tid}`,
}); });
}, },

View File

@ -57,7 +57,7 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
handleClick(item) { handleClick(item) {
uni.navigateTo({ this.$navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`, url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
}); });
}, },

View File

@ -145,22 +145,22 @@ export default {
goToDetail(type) { goToDetail(type) {
switch(type) { switch(type) {
case "SECKILL": case "SECKILL":
uni.navigateTo({ this.$navigateTo({
url: `/pages/promotion/seckill`, url: `/pages/promotion/seckill`,
}); });
break; break;
case "PINTUAN": case "PINTUAN":
uni.navigateTo({ this.$navigateTo({
url: `/pages/promotion/joinGroup`, url: `/pages/promotion/joinGroup`,
}); });
break; break;
case "LIVE": case "LIVE":
uni.navigateTo({ this.$navigateTo({
url: `/pages/promotion/lives`, url: `/pages/promotion/lives`,
}); });
break; break;
case "KANJIA": case "KANJIA":
uni.navigateTo({ this.$navigateTo({
url: `/pages/promotion/bargain/list`, url: `/pages/promotion/bargain/list`,
}); });
break; break;

View File

@ -12,7 +12,7 @@ export default {
props: ["res"], props: ["res"],
methods: { methods: {
handleSearch() { handleSearch() {
uni.navigateTo({ this.$navigateTo({
url: "/pages/navigation/search/searchPage", url: "/pages/navigation/search/searchPage",
}); });
}, },

View File

@ -127,10 +127,10 @@ export default {
this.pageData = JSON.parse(res.data.result.pageData); this.pageData = JSON.parse(res.data.result.pageData);
} }
}); });
}, },
// //
isConnected(val){ isConnected(val){
val ? this.init() : '' val ? this.init() : ''
}, },
/** /**
@ -149,18 +149,18 @@ export default {
// WX_CODE // WX_CODE
if (res.scanType == "WX_CODE") { if (res.scanType == "WX_CODE") {
console.log(res); console.log(res);
uni.navigateTo({ this.$navigateTo({
url: `/${res.path}`, url: `/${res.path}`,
}); });
} else { } else {
config.scanAuthNavigation.forEach((src) => { config.scanAuthNavigation.forEach((src) => {
if (res.result.indexOf(src) != -1) { if (res.result.indexOf(src) != -1) {
uni.navigateTo({ this.$navigateTo({
url: `/${res.result.substring(src.length)}`, url: `/${res.result.substring(src.length)}`,
}); });
} else { } else {
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ this.$navigateTo({
url: "/pages/tabbar/home/web-view?src=" + path, url: "/pages/tabbar/home/web-view?src=" + path,
}); });
}, 100); }, 100);

View File

@ -45,14 +45,14 @@ export default {
// }, // },
methods: { methods: {
gotoLink() { gotoLink() {
uni.navigateTo({ this.$navigateTo({
// //
url: url:
"/pages/tabbar/home/web-view?src=https://pc-b2b2c.pickmall.cn/article/detail?id=1371992704333905920", "/pages/tabbar/home/web-view?src=https://pc-b2b2c.pickmall.cn/article/detail?id=1371992704333905920",
}); });
}, },
gotoB() { gotoB() {
uni.navigateTo({ this.$navigateTo({
url: url:
"/pages/tabbar/home/web-view?src=https://pc-b2b2c.pickmall.cn/article/detail?id=1371779927900160000", "/pages/tabbar/home/web-view?src=https://pc-b2b2c.pickmall.cn/article/detail?id=1371779927900160000",
}); });

View File

@ -122,7 +122,7 @@ export default {
* navigator标签现在默认没有转场动画所以用view * navigator标签现在默认没有转场动画所以用view
*/ */
navigateTo(url) { navigateTo(url) {
uni.navigateTo({ this.$navigateTo({
url, url,
}); });
}, },

View File

@ -73,7 +73,7 @@
}) })
}, },
goDetail(item) { goDetail(item) {
uni.navigateTo({ this.$navigateTo({
url: '/pages/product/goods?id=' + item.content.id + "&goodsId=" +item.content.goodsId url: '/pages/product/goods?id=' + item.content.id + "&goodsId=" +item.content.goodsId
}) })
}, },

View File

@ -69,7 +69,7 @@ import { distribution } from "@/api/goods";
export default { export default {
methods: { methods: {
navigateTo(url) { navigateTo(url) {
uni.navigateTo({ this.$navigateTo({
url, url,
}); });
}, },
@ -78,11 +78,11 @@ export default {
if (res.data.result) { if (res.data.result) {
let type = res.data.result.distributionStatus; let type = res.data.result.distributionStatus;
if (type == "PASS") { if (type == "PASS") {
uni.navigateTo({ this.$navigateTo({
url: "/pages/mine/distribution/home", url: "/pages/mine/distribution/home",
}); });
} else if (type == "REFUSE") { } else if (type == "REFUSE") {
uni.navigateTo({ this.$navigateTo({
url: "/pages/mine/distribution/auth", url: "/pages/mine/distribution/auth",
}); });
} else if (type == "RETREAT") { } else if (type == "RETREAT") {
@ -106,7 +106,7 @@ export default {
}); });
} else { } else {
// //
uni.navigateTo({ this.$navigateTo({
url: "/pages/mine/distribution/auth", url: "/pages/mine/distribution/auth",
}); });
} }

24
utils/navigateRoute.js Normal file
View File

@ -0,0 +1,24 @@
export function navigateTo({url}) {
// #ifdef MP-WEIXIN
//判断当前页面栈的长度
if (getCurrentPages().length >= 8) {
//超过八层的时候跳转销毁当前页面,十层的时候手机应该会很卡;
uni.redirectTo({
url: url,
success: function (res) {},
fail: function (res) {},
complete: function (res) {},
});
} else {
uni.navigateTo({
url: url,
});
}
// #endif
// #ifndef MP-WEIXIN
uni.navigateTo({
url: url,
});
// #endif
}

View File

@ -215,7 +215,7 @@
if (jump) { if (jump) {
// #ifdef MP // #ifdef MP
if (attrs['app-id']) { if (attrs['app-id']) {
return uni.navigateToMiniProgram({ return this.$navigateToMiniProgram({
appId: attrs['app-id'], appId: attrs['app-id'],
path: attrs.path path: attrs.path
}) })
@ -241,7 +241,7 @@
}) })
// #endif // #endif
} else } else
uni.navigateTo({ this.$navigateTo({
url: attrs.href, url: attrs.href,
fail() { fail() {
uni.switchTab({ uni.switchTab({

View File

@ -331,7 +331,7 @@
} else if (href.indexOf('http') == 0 || href.indexOf('//') == 0) } else if (href.indexOf('http') == 0 || href.indexOf('//') == 0)
return true; return true;
else else
uni.navigateTo({ this.$navigateTo({
url: href url: href
}) })
} }
@ -578,7 +578,7 @@
} else if (href.includes('://')) } else if (href.includes('://'))
plus.runtime.openWeb(href); plus.runtime.openWeb(href);
else else
uni.navigateTo({ this.$navigateTo({
url: href url: href
}) })
} }

View File

@ -114,7 +114,7 @@
url: this.config.url url: this.config.url
}); });
} else { } else {
uni.navigateTo({ this.$navigateTo({
url: this.config.url url: this.config.url
}); });
} }