Browse Source

refactor(components): 重构 AQTabber 组件

- 修改了用户类型的默认值为 '1'
- 更新了 tabbar 图标路径- 调整了组件的生命周期钩子,从 onShow改为 created
- 移除了 pages/student/index/index.vue 中的冗余代码
master
liutong 1 year ago
parent
commit
d89f93ea45
  1. 59
      components/AQ/AQTabber.vue
  2. 12
      pages/student/index/index.vue

59
components/AQ/AQTabber.vue

@ -8,21 +8,20 @@
<script>
import fuiTabbar from "@/components/firstui/fui-tabbar/fui-tabbar.vue"
export default {
name: "AQTabber",
components:{
fuiTabbar
},
data() {
return {
userType:'',//|1=,2=,3=
userType:'1',//|1=,2=,3=
current:'0',
tabBar: []
};
},
onShow(){
//
uni.setStorageSync('userType',1)
//
this.userType = uni.getStorageSync('userType')
created(){
console.log(123)
this.init()
},
@ -34,26 +33,26 @@
{
text: "首页",
urlPath:'pages/student/index/index',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/home.png",
selectedIconPath: "/static/images/tabbar/home_selected.png"
},
{
text: "课表",
urlPath:'pages/student/timetable/index',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "班级",
urlPath:'pages/student/my/my',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "我的",
urlPath:'pages/student/my/my',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
}
]
break;
@ -62,20 +61,20 @@
{
text: "首页",
urlPath:'pages/student/index/index',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "线索",
urlPath:'pages/student/my/my',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "添加",
urlPath:'pages/student/my/my',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png",
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png",
midButton: true,
width: 96,
height: 96
@ -83,14 +82,14 @@
{
text: "数据",
urlPath:'pages/student/my/my',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "我的",
urlPath:'pages/student/my/my',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
}
]
break;
@ -99,20 +98,20 @@
{
text: "首页",
urlPath:'pages/student/index/index',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "课表",
urlPath:'pages/student/timetable/index',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "我的",
urlPath:'pages/student/my/my',//
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
}
]
break;

12
pages/student/index/index.vue

@ -61,7 +61,7 @@
<view style="width: 100%;height: 20rpx;"></view>
<AQTabber></AQTabber>
<AQTabber/>
</view>
</template>
@ -72,7 +72,7 @@
export default {
components: {
fuiIcon,
AQTabber
AQTabber,
},
data() {
return {
@ -86,14 +86,6 @@
}
},
onLoad() {
wx.hideTabBar({
success: function() {
console.log('TabBar 已隐藏');
},
fail: function(err) {
console.error('隐藏TabBar失败', err);
}
});
const um_id = uni.getStorageSync('um_id');
this.um_id = um_id
if (um_id == '') {

Loading…
Cancel
Save