Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-psp-show-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-psp-show-h5
Commits
60a77629
提交
60a77629
authored
4月 15, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore:增加权限控制
上级
396d4d9a
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
25 行增加
和
10 行删除
+25
-10
main.ts
src/main.ts
+4
-0
ChapterItem.vue
src/modules/course/components/ChapterItem.vue
+1
-0
index.ts
src/modules/course/index.ts
+1
-1
index.ts
src/modules/my/index.ts
+1
-0
Index.vue
src/modules/my/views/Index.vue
+9
-2
index.ts
src/modules/qa/index.ts
+1
-1
index.ts
src/router/index.ts
+8
-6
没有找到文件。
src/main.ts
浏览文件 @
60a77629
...
...
@@ -10,6 +10,7 @@ import AppContainer from '@/components/base/AppContainer.vue'
import
Avatar
from
'@/components/Avatar.vue'
import
modules
from
'./modules'
import
{
useUserStore
}
from
'@/stores/user'
const
app
=
createApp
(
App
)
// 注册公共组件
...
...
@@ -22,3 +23,6 @@ app.use(router)
app
.
use
(
Vant
)
app
.
mount
(
'#app'
)
// 初始化用户信息,判断是否登录
useUserStore
().
getUser
()
src/modules/course/components/ChapterItem.vue
浏览文件 @
60a77629
...
...
@@ -21,6 +21,7 @@ const dataset = reactive<Info>({ loading: false, page: 1, total: 0, list: [] })
const
showChapterRecord
=
()
=>
{
chapterVisible
.
value
=
true
dataset
.
page
=
1
dataset
.
list
=
[]
getChapterRecord
()
}
...
...
src/modules/course/index.ts
浏览文件 @
60a77629
...
...
@@ -8,7 +8,7 @@ export const routes: Array<RouteRecordRaw> = [
children
:
[
{
path
:
''
,
component
:
()
=>
import
(
'./views/Index.vue'
)
},
{
name
:
'courseView'
,
path
:
'view/:id'
,
component
:
()
=>
import
(
'./views/View.vue'
),
props
:
true
},
{
path
:
'publish'
,
component
:
()
=>
import
(
'./views/Publish.vue'
)
}
{
path
:
'publish'
,
component
:
()
=>
import
(
'./views/Publish.vue'
)
,
meta
:
{
requireLogin
:
true
}
}
]
}
]
src/modules/my/index.ts
浏览文件 @
60a77629
...
...
@@ -5,6 +5,7 @@ export const routes: Array<RouteRecordRaw> = [
{
path
:
'/my'
,
component
:
AppLayout
,
meta
:
{
requireLogin
:
true
},
children
:
[{
path
:
''
,
component
:
()
=>
import
(
'./views/Index.vue'
)
}]
}
]
src/modules/my/views/Index.vue
浏览文件 @
60a77629
<
script
setup
lang=
"ts"
>
import
{
ref
,
onMounted
}
from
'vue'
import
{
getMyInfo
}
from
'../api'
import
{
logout
}
from
'@/api/base'
const
info
=
ref
()
const
teamInfo
=
ref
()
const
fetchMyInfo
=
()
=>
{
...
...
@@ -50,6 +50,13 @@ const menus: Array<{
icon
:
'https://webapp-pub.ezijing.com/project/prp-h5/my_menu_6.png'
}
]
// 退出登录
const
onLogout
=
()
=>
{
logout
().
then
(()
=>
{
window
.
location
.
href
=
'/'
})
}
</
script
>
<
template
>
<div
class=
"my"
v-if=
"info"
>
...
...
@@ -79,7 +86,7 @@ const menus: Array<{
</ul>
</nav>
</div>
<div
class=
"logout"
>
退出登录
</div>
<div
class=
"logout"
@
click=
"onLogout"
>
退出登录
</div>
</div>
</
template
>
...
...
src/modules/qa/index.ts
浏览文件 @
60a77629
...
...
@@ -7,7 +7,7 @@ export const routes: Array<RouteRecordRaw> = [
component
:
AppLayout
,
children
:
[
{
path
:
''
,
component
:
()
=>
import
(
'./views/Index.vue'
)
},
{
path
:
'publish'
,
component
:
()
=>
import
(
'./views/Publish.vue'
)
}
{
path
:
'publish'
,
component
:
()
=>
import
(
'./views/Publish.vue'
)
,
meta
:
{
requireLogin
:
true
}
}
]
}
]
src/router/index.ts
浏览文件 @
60a77629
import
{
createRouter
,
createWebHistory
}
from
'vue-router'
//
import { useUserStore } from '@/stores/user'
import
{
useUserStore
}
from
'@/stores/user'
const
router
=
createRouter
({
history
:
createWebHistory
(),
routes
:
[{
path
:
'/:pathMatch(.*)*'
,
redirect
:
'/'
}]
})
// router.beforeEach((to, from, next) => {
// const user = useUserStore()
// user.getUser()
// next()
// })
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
const
user
=
useUserStore
()
if
(
to
.
meta
.
requireLogin
&&
!
user
.
isLogin
)
{
location
.
href
=
`
${
import
.
meta
.
env
.
VITE_LOGIN_URL
}
?rd=
${
encodeURIComponent
(
location
.
href
)}
`
}
next
()
})
export
default
router
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论