You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bocai_supplyChain/custom-tab-bar/index.js

114 lines
2.9 KiB
JavaScript

const app = getApp();
Component({
1 year ago
data: {
isShow: false,
toTop: false,
selected: 0,
color: "#444",
selectedColor: "#1890ff",
list: [
{
iconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/IOS/home.png",
selectedIconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/IOS/home1.png",
pagePath: "/pages/firstBill/index",
text: "首页",
index: 0,
},
{
1 year ago
iconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/IOS/ksbm.svg",
selectedIconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/IOS/ksbm.svg",
pagePath: "/pages/workBench/index",
text: "工具",
1 year ago
index: 1,
},
{
"iconPath": "../assets/images/xx.png",
"selectedIconPath": "../assets/images/xx1_lao.png",
"pagePath": "/pages/message/index",
"text": "消息",
1 year ago
index: 3,
},
{
"iconPath": "../assets/images/apply.png",
"selectedIconPath": "../assets/images/apply1.png",
"pagePath": "/pages/myBill/index",
"text": "工单",
1 year ago
index: 2,
},
1 year ago
1 year ago
{
iconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/IOS/wd.png",
selectedIconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/IOS/wd1.png",
pagePath: "/pages/mine/index",
text: "我的",
1 year ago
index: 4,
1 year ago
},
],
},
lifetimes: {
show: function () {
// 页面被展示
console.log("tabbar show");
},
attached: function () {
// 在组件实例进入页面节点树时执行
console.log("tabbar attached");
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
},
},
methods: {
switchTab (e) {
const data = e.currentTarget.dataset;
const url = data.path;
wx.vibrateShort({
type: "heavy",
success: function (e) {
console.log(e);
},
});
1 year ago
if (data.index == 0 && this.data.selected == 0) {
if (this.data.toTop) {
app.globalData.toTop = 1;
} else {
app.globalData.refresh = 1
}
1 year ago
}
1 year ago
// if (!app.globalData.isLogin) {
// if (data.index == 1) {
// wx.navigateTo({
// url: "/pages/login/index",
// });
// return;
// }
// }
// else {
// if (data.index == 1) {
// if (app.globalData.loginUserInfo.agencyStatus != 1) {
// wx.navigateTo({
// url: "/pages/tobeAgency/index",
// });
// } else {
// wx.navigateTo({
// url,
// });
// // wx.redirectTo({});
// }
// return;
// }
// }
// this.setData({
// selected: data.index,
// });
wx.switchTab({ url });
},
touchMove () {
return false
}
1 year ago
},
});