diff --git a/src/router/index.js b/src/router/index.js
index 3578773..cf4fd65 100755
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -34,7 +34,8 @@ const routes = [
},
meta: {
title: '医院管理',
- hideBreadcrumb: true // 首页不显示面包屑
+ hideBreadcrumb: true, // 首页不显示面包屑
+ requiresAuth:true
}
},
{
@@ -62,9 +63,6 @@ const routes = [
meta: {
title: '编辑医院',
breadcrumbParent: '医生信息' // 手动指定父级
-// r如果想隐藏中间层级
- // breadcrumbParent: '首页', // 跳过医生信息
- // hideInBreadcrumb: true // 可选:隐藏当前项
}
},
{
@@ -74,9 +72,6 @@ const routes = [
meta: {
title: '微信收款',
breadcrumbParent: '编辑医院' // 手动指定父级
-// r如果想隐藏中间层级
- // breadcrumbParent: '首页', // 跳过医生信息
- // hideInBreadcrumb: true // 可选:隐藏当前项
}
},
@@ -103,7 +98,8 @@ const routes = [
name: '收款方式',
meta: {
title: '收款管理',
- hideBreadcrumb: true // 首页不显示面包屑
+ hideBreadcrumb: true, // 首页不显示面包屑
+ requiresAuth:true
}
},
]
@@ -113,7 +109,22 @@ const router = new VueRouter({
base: process.env.BASE_URL,
routes
})
+
router.beforeEach((to, from, next) => {
+ // 检查本地存储是否有nick
+ const hasNick = localStorage.getItem('nick');
+
+ // 如果有nick且访问的是根路径,则重定向到/hospitalManage
+ if (hasNick && to.path === '/') {
+ next('/hospitalManage');
+ return;
+ }
+
+ // 如果没有nick且尝试访问需要认证的页面(如/hospitalManage),则重定向到首页
+ if (!hasNick && to.meta.requiresAuth) {
+ next('/');
+ return;
+ }
if (whiteSlideList.includes(to.path)) {
store.commit('SET_SIDEBAR', true); // 登录页面不显示侧边栏
} else {
@@ -129,6 +140,7 @@ router.beforeEach((to, from, next) => {
} else {
store.commit('SET_HEADER', true); // 其他页面显示顶部
}
+
next();
});
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
index a6f3499..4339af2 100644
--- a/src/views/HomeView.vue
+++ b/src/views/HomeView.vue
@@ -17,7 +17,7 @@
批量启用
- 添加医院
+ 添加医院
搜索医生
@@ -176,6 +176,8 @@ export default {
store.commit('SET_CUSTOMIZE', false);
store.commit('SET_SLIDER_MENU', 'menuData');
this.getInitData()
+ if(this.onlyHosFlag)return
+ // 假的假的数据调用 -- 布局用的
this.getBindpayList()
},
computed: {
@@ -183,8 +185,8 @@ export default {
},
methods: {
// 初始化请求
- getInitData() {
- this.$http('POST', '/api/admin/doctor_depart_list', {
+ async getInitData() {
+ await this.$http('POST', '/api/admin/doctor_depart_list', {
name: this.doctorName
}).then(response => {
if (response.code == 0) {
@@ -209,7 +211,6 @@ export default {
depart_id: 4
}).then(response => {
this.payList.push(...response.data[2],...response.data[3])
- console.log(this.payList,response,'this.payList====00000');
}).catch(error => {
console.error(error, 'error')
})
@@ -294,7 +295,7 @@ export default {
})
},
onSwitchChange1(row) {
- console.log(row, '------flag');
+ // console.log(row, '------flag');
row.status = row.status == 0 ? 1 : 0;
this.$http('POST', '/api/admin/depart_mutil_option', {
depart_index_ids:row.id,
@@ -314,7 +315,7 @@ export default {
this.$set(this.doctorList, row)
},
batchOperate(status) {
- console.log(this.tableSelections,'this.tableSelections----');
+ // console.log(this.tableSelections,'this.tableSelections----');
if(!this.tableSelections || this.tableSelections.length <= 0) {
this.$message.error('未选择要'+(status == '0' ? '禁用':'启用')+'的科室')
return;
@@ -386,6 +387,14 @@ export default {
query: { doctor_id: item.id }
})
},
+ addHospitalUser(){
+ // 医生id不确认怎么获取 跟随token?
+ let id = this.doctor_id;
+ this.$router.push({
+ name: '医院信息',
+ query: { doctor_id: id }
+ })
+ },
editDoctor(item) {
this.$router.push({
name: '医生信息',
diff --git a/src/views/hospitalManage.vue b/src/views/hospitalManage.vue
deleted file mode 100644
index d83cdca..0000000
--- a/src/views/hospitalManage.vue
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file