Files
PC-202306242200\Administrator dac42e3b0c first commit
2026-03-28 23:09:02 +08:00

45 lines
1.2 KiB
JavaScript

"use strict";
const common_vendor = require("../common/vendor.js");
const store_index = require("../store/index.js");
function useNav() {
const navTo = (path, token, call) => {
if (call) {
common_vendor.index.makePhoneCall({
phoneNumber: "17707569278"
});
return;
}
console.log(token, "token");
console.log(store_index.store.state.token, "store.state.token");
if (token && !store_index.store.state.token) {
return common_vendor.index.showModal({
title: "提示",
content: "你还未登录,是否前往登录?",
success: function(res) {
if (res.confirm) {
common_vendor.index.navigateTo({
url: "/pages/login/login"
});
} else if (res.cancel) {
console.log("用户点击取消");
}
}
});
} else {
common_vendor.index.navigateTo({
url: path
});
}
};
const nav = (e) => {
common_vendor.index[e.type == "nav" || !e.type ? "navigateTo" : e.type == "switchTab" ? "switchTab" : "navigateTo"]({
url: e.path
});
};
return {
nav,
navTo
};
}
exports.useNav = useNav;