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

12
pages/student/index/index.vue

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

Loading…
Cancel
Save