import store from '../store/index.js'
|
import message from '../plugins/message.js'
|
|
exports.install = function(Vue, options) {
|
Vue.prototype.isCurrent = function(current, arr) {
|
if (!!arr) {
|
for (let url of arr) {
|
if (current == url) {
|
return true
|
}
|
}
|
}
|
return false
|
};
|
Vue.prototype.goto = function(current_path,url) {
|
console.log('current_path:',current_path,' url:',url)
|
console.log('store')
|
// console.log(store.state.hasLogin)
|
|
if (current_path == url) {
|
|
} else {
|
//判断有没有登录
|
// if(url.con)
|
if(url.includes('/center')&&!store.state.hasLogin&&!store.state.isDebug){
|
//跳转到不同页面
|
console.log('goto no登录')
|
// store.state.hasLogin = true
|
// // #ifdef H5
|
// uni.navigateTo({
|
// url: '/views/pc/login'
|
// });
|
// // #endif
|
// // #ifndef H5
|
// uni.navigateTo({
|
// url: '/views/app/login'
|
// });
|
// // #endif
|
message.showToast('请先登录')
|
// uni.navigateTo({
|
// url: '/views/home/home?select=self'
|
// });
|
}else{
|
console.log('goto ok登录')
|
uni.navigateTo({
|
url: url
|
});
|
}
|
|
}
|
|
};
|
};
|