110 lines
2.5 KiB
JavaScript
110 lines
2.5 KiB
JavaScript
// components/tabbar/tabbar.js
|
||
const app = getApp()
|
||
Component({
|
||
/**
|
||
* 组件的属性列表
|
||
*/
|
||
properties: {
|
||
isIPX: {
|
||
type: Boolean,
|
||
value: app.globalData.isIPX
|
||
},
|
||
currentIndex: {
|
||
type: String,
|
||
value: '0'
|
||
},
|
||
type: { // dri-司机端,dis-调度员
|
||
type: String,
|
||
value: 'biz'
|
||
},
|
||
tabbarListDri: {
|
||
type: Array,
|
||
value: [{
|
||
"index": 0,
|
||
"pagePath": "/driver/pages/add/add",
|
||
"iconPath": "/images/add_nor.png",
|
||
"selectedIconPath": "/images/add_act.png",
|
||
"text": "新增配送"
|
||
},
|
||
{
|
||
"index": 1,
|
||
"pagePath": "/driver/pages/record/record",
|
||
"iconPath": "/images/record_nor.png",
|
||
"selectedIconPath": "/images/record_act.png",
|
||
"text": "配送记录"
|
||
|
||
},
|
||
{
|
||
"index": 2,
|
||
"pagePath": "/driver/pages/mine/mine",
|
||
"iconPath": "/images/mine_nor.png",
|
||
"selectedIconPath": "/images/mine_act.png",
|
||
"text": "我的"
|
||
}]
|
||
},
|
||
tabbarListDis: {
|
||
type: Array,
|
||
value: [
|
||
{
|
||
"index": 0,
|
||
"pagePath": "/dispatcher/pages/record/record",
|
||
"iconPath": "/images/record_nor.png",
|
||
"selectedIconPath": "/images/record_act.png",
|
||
"text": "配送记录"
|
||
|
||
},
|
||
{
|
||
"index": 1,
|
||
"pagePath": "/dispatcher/pages/driver/driver",
|
||
"iconPath": "/images/driver_nor.png",
|
||
"selectedIconPath": "/images/driver_act.png",
|
||
"text": "司机管理"
|
||
},
|
||
{
|
||
"index": 2,
|
||
"pagePath": "/dispatcher/pages/mine/mine",
|
||
"iconPath": "/images/mine_nor.png",
|
||
"selectedIconPath": "/images/mine_act.png",
|
||
"text": "我的"
|
||
}]
|
||
}
|
||
},
|
||
|
||
/**
|
||
* 组件的初始数据
|
||
*/
|
||
data: {
|
||
|
||
},
|
||
|
||
options: {
|
||
multipleSlots: true, // 允许组件中使用多个slot
|
||
addGlobalClass: true // 允许使用全局样式
|
||
},
|
||
|
||
/**
|
||
* 组件的方法列表
|
||
*/
|
||
methods: {
|
||
switchTab: function (e) {
|
||
const index = e.currentTarget.dataset.index
|
||
const currentindex = e.currentTarget.dataset.currentindex
|
||
const url = e.currentTarget.dataset.url
|
||
// 在当前页不跳转
|
||
if (index == currentindex) {
|
||
return
|
||
}
|
||
wx.redirectTo({
|
||
url: url,
|
||
})
|
||
},
|
||
getUserInfo: function (e) {
|
||
const url = e.currentTarget.dataset.url
|
||
wx.redirectTo({
|
||
url: url,
|
||
})
|
||
this.triggerEvent('sure', { url: url })
|
||
}
|
||
}
|
||
})
|