You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
2.6 KiB
102 lines
2.6 KiB
9 months ago
|
<template>
|
||
|
<view class="tabBar_contaier flex around">
|
||
|
<view @click="selectFn(item,index)" class="tabBar_item flex jc column ac" v-for="(item,index) in tabBarList " :key="index">
|
||
|
<image :src="value==item.selectIndex?item.selectedIconPath:item.iconPath"></image>
|
||
|
<view :class=" 'tabBar_item_text' + (value==item.selectIndex?' .select_tabBar_item_text':'') ">{{item.text}}</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import station from '@/api/station.js'
|
||
|
export default {
|
||
|
name: "tabBar",
|
||
|
props:{
|
||
|
value:{
|
||
|
type:Number,
|
||
|
default:0
|
||
|
}
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
tabBarList: [{
|
||
|
"selectIndex":0,
|
||
|
"iconPath": require('../../static/home.png'),
|
||
|
"selectedIconPath": require('../../static/select-home.png'),
|
||
|
"text": "首页"
|
||
|
},
|
||
|
{
|
||
|
"selectIndex": 1,
|
||
|
"iconPath": require('../../static/ChargingStation.png'),
|
||
|
"selectedIconPath": require('../../static/select-ChargingStation.png'),
|
||
|
"text": "电站"
|
||
|
},
|
||
|
{
|
||
|
"selectIndex": 2,
|
||
|
"iconPath": require('../../static/Scan.png'),
|
||
|
"selectedIconPath": require('../../static/Scan.png'),
|
||
|
"text": " "
|
||
|
},
|
||
|
// {
|
||
|
// "selectIndex": 3,
|
||
|
// "iconPath": require('../../static/order.png'),
|
||
|
// "selectedIconPath": require('../../static/select-order.png'),
|
||
|
// "text": "订单"
|
||
|
// },
|
||
|
// {
|
||
|
// "selectIndex": 4,
|
||
|
// "iconPath": require('../../static/Personal.png'),
|
||
|
// "selectedIconPath": require('../../static/select-Personal.png'),
|
||
|
// "text": "我的"
|
||
|
// }
|
||
|
]
|
||
|
};
|
||
|
},
|
||
|
created() {
|
||
|
console.log(this.tool);
|
||
|
},
|
||
|
methods:{
|
||
|
async scanCode(){
|
||
|
let res = await this.tool.scanCode();
|
||
|
if(res.result){
|
||
|
uni.navigateTo({
|
||
|
url:`/ChargingStation/pages/placeOrder/index?type=qrCode&id=${res.result}`
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
selectFn(e,index){
|
||
|
// if(index==2){
|
||
|
// const token = uni.getStorageSync('Authorization');
|
||
|
// if(!token){
|
||
|
// uni.showModal({
|
||
|
// title: '暂未登录',
|
||
|
// content: '是否去登陆',
|
||
|
// success: function(res) {
|
||
|
// if (res.confirm) {
|
||
|
// uni.redirectTo({
|
||
|
// url: '/pages/login/index',
|
||
|
// fail(e) {
|
||
|
// console.log(e)
|
||
|
// }
|
||
|
// })
|
||
|
// } else if (res.cancel) {
|
||
|
// console.log('用户点击取消');
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
// });
|
||
|
// return
|
||
|
// }
|
||
|
// this.scanCode()
|
||
|
// }else{
|
||
|
// this.$emit('input',e.selectIndex);
|
||
|
// }
|
||
|
this.$emit('input',e.selectIndex);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
@import 'index.scss'
|
||
|
</style>
|