Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-lab
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-lab
Commits
8c4e7894
提交
8c4e7894
authored
4月 25, 2023
作者:
lhh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
a7f3f829
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
140 行增加
和
27 行删除
+140
-27
api.ts
src/modules/admin/contest/items/api.ts
+11
-1
ViewBook.vue
src/modules/admin/contest/items/components/ViewBook.vue
+6
-5
ViewBookFormDialog.vue
...les/admin/contest/items/components/ViewBookFormDialog.vue
+29
-8
types.ts
src/modules/admin/contest/items/types.ts
+1
-0
api.ts
src/modules/student/contest/api.ts
+5
-0
Book.vue
src/modules/student/contest/components/Book.vue
+78
-13
vite.config.ts
vite.config.ts
+10
-0
没有找到文件。
src/modules/admin/contest/items/api.ts
浏览文件 @
8c4e7894
...
@@ -76,6 +76,11 @@ export function updateContestRuleBook(data: ContestBookUpdateParams) {
...
@@ -76,6 +76,11 @@ export function updateContestRuleBook(data: ContestBookUpdateParams) {
export
function
getContestBook
(
params
:
{
competition_id
:
string
})
{
export
function
getContestBook
(
params
:
{
competition_id
:
string
})
{
return
httpRequest
.
get
(
'/api/resource/v1/backend/competition-book/detail'
,
{
params
})
return
httpRequest
.
get
(
'/api/resource/v1/backend/competition-book/detail'
,
{
params
})
}
}
// 获取赛项指导书详情
export
function
getContestBooks
(
params
:
{
competition_id
:
string
})
{
return
httpRequest
.
get
(
'/api/resource/v1/backend/competition-book/list'
,
{
params
})
}
// 添加赛项指导书
// 添加赛项指导书
export
function
createContestBook
(
data
:
ContestBookUpdateParams
)
{
export
function
createContestBook
(
data
:
ContestBookUpdateParams
)
{
return
httpRequest
.
post
(
'/api/resource/v1/backend/competition-book/create'
,
data
)
return
httpRequest
.
post
(
'/api/resource/v1/backend/competition-book/create'
,
data
)
...
@@ -85,7 +90,7 @@ export function updateContestBook(data: ContestBookUpdateParams) {
...
@@ -85,7 +90,7 @@ export function updateContestBook(data: ContestBookUpdateParams) {
return
httpRequest
.
post
(
'/api/resource/v1/backend/competition-book/update'
,
data
)
return
httpRequest
.
post
(
'/api/resource/v1/backend/competition-book/update'
,
data
)
}
}
// 删除赛项指导书
// 删除赛项指导书
export
function
deleteContestBook
(
data
:
{
competition_
id
:
string
})
{
export
function
deleteContestBook
(
data
:
{
id
:
string
})
{
return
httpRequest
.
post
(
'/api/resource/v1/backend/competition-book/delete'
,
data
)
return
httpRequest
.
post
(
'/api/resource/v1/backend/competition-book/delete'
,
data
)
}
}
...
@@ -137,3 +142,8 @@ export function getExpert(params: { id: string }) {
...
@@ -137,3 +142,8 @@ export function getExpert(params: { id: string }) {
export
function
getContestantList
(
params
?:
{
student_name
?:
string
;
page
?:
number
;
'per-page'
?:
number
})
{
export
function
getContestantList
(
params
?:
{
student_name
?:
string
;
page
?:
number
;
'per-page'
?:
number
})
{
return
httpRequest
.
get
(
'/api/resource/v1/backend/competition-competitor/list'
,
{
params
})
return
httpRequest
.
get
(
'/api/resource/v1/backend/competition-competitor/list'
,
{
params
})
}
}
// 获取平台标识列表
export
function
getPlatformKeys
(
params
?:
{
competition_id
:
string
})
{
return
httpRequest
.
get
(
'/api/resource/v1/backend/competition-book/platform-keys'
,
{
params
})
}
src/modules/admin/contest/items/components/ViewBook.vue
浏览文件 @
8c4e7894
...
@@ -4,7 +4,7 @@ import { CirclePlus } from '@element-plus/icons-vue'
...
@@ -4,7 +4,7 @@ import { CirclePlus } from '@element-plus/icons-vue'
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
import
AppList
from
'@/components/base/AppList.vue'
import
AppList
from
'@/components/base/AppList.vue'
import
ViewBookPreviewDialog
from
'./ViewBookPreviewDialog.vue'
import
ViewBookPreviewDialog
from
'./ViewBookPreviewDialog.vue'
import
{
getContestBook
,
deleteContestBook
}
from
'../api'
import
{
getContestBook
s
,
deleteContestBook
}
from
'../api'
const
FormDialog
=
defineAsyncComponent
(()
=>
import
(
'./ViewBookFormDialog.vue'
))
const
FormDialog
=
defineAsyncComponent
(()
=>
import
(
'./ViewBookFormDialog.vue'
))
...
@@ -18,17 +18,18 @@ const appList = $ref<InstanceType<typeof AppList> | null>(null)
...
@@ -18,17 +18,18 @@ const appList = $ref<InstanceType<typeof AppList> | null>(null)
const
listOptions
=
{
const
listOptions
=
{
hasPagination
:
false
,
hasPagination
:
false
,
remote
:
{
remote
:
{
httpRequest
:
getContestBook
,
httpRequest
:
getContestBook
s
,
params
:
{
competition_id
:
props
.
id
},
params
:
{
competition_id
:
props
.
id
},
callback
(
res
:
any
)
{
callback
(
res
:
any
)
{
return
res
.
detail
?.
id
?
{
list
:
[
res
.
detail
]
}
:
{
list
:
[]
}
// return res.detail?.id ? { list: [res.detail] } : { list: [] }
return
res
?.
items
?
{
list
:
res
?.
items
}
:
{
list
:
[]
}
}
}
},
},
columns
:
[
columns
:
[
{
label
:
'序号'
,
type
:
'index'
,
width
:
60
},
{
label
:
'序号'
,
type
:
'index'
,
width
:
60
},
{
label
:
'训练指导书名称'
,
prop
:
'name'
},
{
label
:
'训练指导书名称'
,
prop
:
'name'
},
{
label
:
'文件类型'
,
prop
:
'type'
},
{
label
:
'文件类型'
,
prop
:
'type'
},
{
label
:
'创建人'
,
prop
:
'create
_use
r.real_name'
},
{
label
:
'创建人'
,
prop
:
'create
d_operato
r.real_name'
},
{
label
:
'创建时间'
,
prop
:
'updated_time'
},
{
label
:
'创建时间'
,
prop
:
'updated_time'
},
{
label
:
'更新时间'
,
prop
:
'updated_time'
},
{
label
:
'更新时间'
,
prop
:
'updated_time'
},
{
label
:
'操作'
,
slots
:
'table-x'
,
width
:
180
}
{
label
:
'操作'
,
slots
:
'table-x'
,
width
:
180
}
...
@@ -56,7 +57,7 @@ function handleView(row: ContestBookItem) {
...
@@ -56,7 +57,7 @@ function handleView(row: ContestBookItem) {
// 删除
// 删除
function
handleRemoveClass
(
row
:
ContestBookItem
)
{
function
handleRemoveClass
(
row
:
ContestBookItem
)
{
ElMessageBox
.
confirm
(
'确定要删除吗?'
,
'提示'
).
then
(()
=>
{
ElMessageBox
.
confirm
(
'确定要删除吗?'
,
'提示'
).
then
(()
=>
{
deleteContestBook
({
competition_id
:
row
.
competition_
id
}).
then
(()
=>
{
deleteContestBook
({
id
:
row
.
id
}).
then
(()
=>
{
ElMessage
({
message
:
'删除成功'
,
type
:
'success'
})
ElMessage
({
message
:
'删除成功'
,
type
:
'success'
})
onUpdateSuccess
()
onUpdateSuccess
()
})
})
...
...
src/modules/admin/contest/items/components/ViewBookFormDialog.vue
浏览文件 @
8c4e7894
...
@@ -4,7 +4,7 @@ import type { ContestItem, ContestBookItem, ContestBookUpdateParams } from '../t
...
@@ -4,7 +4,7 @@ import type { ContestItem, ContestBookItem, ContestBookUpdateParams } from '../t
import
{
ElMessageBox
,
ElMessage
}
from
'element-plus'
import
{
ElMessageBox
,
ElMessage
}
from
'element-plus'
import
{
pick
}
from
'lodash-es'
import
{
pick
}
from
'lodash-es'
import
AppUpload
from
'@/components/base/AppUpload.vue'
import
AppUpload
from
'@/components/base/AppUpload.vue'
import
{
createContestBook
,
updateContestBook
}
from
'../api'
import
{
createContestBook
,
updateContestBook
,
getPlatformKeys
}
from
'../api'
import
{
useMapStore
}
from
'@/stores/map'
import
{
useMapStore
}
from
'@/stores/map'
interface
Props
{
interface
Props
{
...
@@ -12,6 +12,8 @@ interface Props {
...
@@ -12,6 +12,8 @@ interface Props {
}
}
const
props
=
defineProps
<
Props
>
()
const
props
=
defineProps
<
Props
>
()
const
route
=
useRoute
()
const
emit
=
defineEmits
<
{
const
emit
=
defineEmits
<
{
(
e
:
'update'
):
void
(
e
:
'update'
):
void
(
e
:
'update:modelValue'
,
visible
:
boolean
):
void
(
e
:
'update:modelValue'
,
visible
:
boolean
):
void
...
@@ -30,7 +32,8 @@ const form = reactive<any>({
...
@@ -30,7 +32,8 @@ const form = reactive<any>({
type
:
''
,
type
:
''
,
name
:
''
,
name
:
''
,
status
:
'1'
,
status
:
'1'
,
protocol
:
false
protocol
:
false
,
platform_key
:
''
})
})
watchEffect
(()
=>
{
watchEffect
(()
=>
{
if
(
!
props
.
data
)
return
if
(
!
props
.
data
)
return
...
@@ -75,7 +78,7 @@ function handleUploadSuccess(file: any) {
...
@@ -75,7 +78,7 @@ function handleUploadSuccess(file: any) {
function
handleSubmit
()
{
function
handleSubmit
()
{
formRef
?.
validate
().
then
(()
=>
{
formRef
?.
validate
().
then
(()
=>
{
const
[
file
]
=
form
.
files
const
[
file
]
=
form
.
files
const
params
=
Object
.
assign
({},
pick
(
form
,
[
'competition_id'
,
'name'
,
'type'
,
'status'
]),
{
const
params
=
Object
.
assign
({},
pick
(
form
,
[
'competition_id'
,
'name'
,
'type'
,
'status'
,
'platform_key'
]),
{
url
:
JSON
.
stringify
({
name
:
file
.
name
,
url
:
file
.
url
,
size
:
file
.
size
})
url
:
JSON
.
stringify
({
name
:
file
.
name
,
url
:
file
.
url
,
size
:
file
.
size
})
})
})
isUpdate
?
handleUpdate
(
params
)
:
handleCreate
(
params
)
isUpdate
?
handleUpdate
(
params
)
:
handleCreate
(
params
)
...
@@ -91,12 +94,28 @@ function handleCreate(params: ContestBookUpdateParams) {
...
@@ -91,12 +94,28 @@ function handleCreate(params: ContestBookUpdateParams) {
}
}
// 修改
// 修改
function
handleUpdate
(
params
:
ContestBookUpdateParams
)
{
function
handleUpdate
(
params
:
ContestBookUpdateParams
)
{
params
.
id
=
props
.
data
?.
id
updateContestBook
(
params
).
then
(()
=>
{
updateContestBook
(
params
).
then
(()
=>
{
ElMessage
({
message
:
'修改成功'
,
type
:
'success'
})
ElMessage
({
message
:
'修改成功'
,
type
:
'success'
})
emit
(
'update'
)
emit
(
'update'
)
emit
(
'update:modelValue'
,
false
)
emit
(
'update:modelValue'
,
false
)
})
})
}
}
// 获取平台标识列表
let
platformKeys
=
$ref
<
{
platform_key
:
string
;
name
:
string
}[]
>
([])
const
getPlatformKeysList
=
function
()
{
console
.
log
(
route
,
'route'
)
getPlatformKeys
({
competition_id
:
route
.
params
?.
id
as
string
}).
then
(
res
=>
{
if
(
res
.
data
?.
items
)
{
platformKeys
=
res
.
data
?.
items
if
(
form
.
platform_key
===
''
)
{
form
.
platform_key
=
res
.
data
?.
items
[
0
]?.
platform_key
}
}
})
}
getPlatformKeysList
()
</
script
>
</
script
>
<
template
>
<
template
>
...
@@ -120,11 +139,13 @@ function handleUpdate(params: ContestBookUpdateParams) {
...
@@ -120,11 +139,13 @@ function handleUpdate(params: ContestBookUpdateParams) {
<el-form-item
label=
"关联赛项"
>
<el-form-item
label=
"关联赛项"
>
<el-input
:value=
"detail.name"
disabled
></el-input>
<el-input
:value=
"detail.name"
disabled
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"默认有效"
prop=
"status"
>
<el-form-item
label=
"关联实验"
>
<el-radio-group
v-model=
"form.status"
>
<el-radio-group
v-model=
"form.platform_key"
>
<!-- <el-radio v-for="item in status" :key="item.id" :label="item.value">{{ item.label }}</el-radio> -->
<el-radio
v-for=
"item in platformKeys"
:key=
"item.platform_key"
:label=
"item.platform_key"
>
{{
<el-radio
:key=
"1"
label=
"1"
>
商业数据分析实验
</el-radio>
item.name
<el-radio
:key=
"1"
label=
"2"
>
数字营销实操
</el-radio>
}}
</el-radio>
<!-- <el-radio :key="1" label="1">商业数据分析实验</el-radio>
<el-radio :key="1" label="2">数字营销实操</el-radio> -->
</el-radio-group>
</el-radio-group>
</el-form-item>
</el-form-item>
<el-form-item
label=
"有效状态"
prop=
"status"
>
<el-form-item
label=
"有效状态"
prop=
"status"
>
...
...
src/modules/admin/contest/items/types.ts
浏览文件 @
8c4e7894
...
@@ -71,6 +71,7 @@ export interface ContestBookItem {
...
@@ -71,6 +71,7 @@ export interface ContestBookItem {
}
}
export
interface
ContestBookUpdateParams
{
export
interface
ContestBookUpdateParams
{
id
?:
string
competition_id
:
string
competition_id
:
string
name
:
string
name
:
string
url
:
string
url
:
string
...
...
src/modules/student/contest/api.ts
浏览文件 @
8c4e7894
...
@@ -36,6 +36,11 @@ export function getExperimentBook(params: { competition_id: string }) {
...
@@ -36,6 +36,11 @@ export function getExperimentBook(params: { competition_id: string }) {
return
httpRequest
.
get
(
'/api/lab/v1/student/competition/book'
,
{
params
})
return
httpRequest
.
get
(
'/api/lab/v1/student/competition/book'
,
{
params
})
}
}
// 获取实验指导书
export
function
getExperimentBooks
(
params
:
{
competition_id
:
string
;
platform_key
:
string
})
{
return
httpRequest
.
get
(
'/api/lab/v1/student/competition/books'
,
{
params
})
}
// 获取实验视频
// 获取实验视频
export
function
getExperimentVideoList
(
params
:
{
competition_id
:
string
})
{
export
function
getExperimentVideoList
(
params
:
{
competition_id
:
string
})
{
return
httpRequest
.
get
(
'/api/lab/v1/student/competition/videos'
,
{
params
})
return
httpRequest
.
get
(
'/api/lab/v1/student/competition/videos'
,
{
params
})
...
...
src/modules/student/contest/components/Book.vue
浏览文件 @
8c4e7894
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
type
{
ExperimentBookType
}
from
'../types'
import
type
{
ExperimentBookType
}
from
'../types'
import
{
CloseBold
}
from
'@element-plus/icons-vue'
import
Preview
from
'@/components/Preview.vue'
import
Preview
from
'@/components/Preview.vue'
import
{
getExperimentBook
}
from
'../api'
import
{
getExperimentBook
s
}
from
'../api'
interface
Props
{
interface
Props
{
competition_id
:
string
competition_id
:
string
}
}
const
props
=
defineProps
<
Props
>
()
const
props
=
defineProps
<
Props
>
()
let
detail
=
$ref
<
ExperimentBookType
>
()
const
route
=
useRoute
()
let
list
=
$ref
<
ExperimentBookType
[]
>
([])
function
fetchInfo
()
{
function
fetchInfo
()
{
getExperimentBook
({
competition_id
:
props
.
competition_id
}).
then
(
res
=>
{
getExperimentBook
s
({
competition_id
:
props
.
competition_id
,
platform_key
:
route
.
query
?.
type
as
string
}).
then
(
res
=>
{
detail
=
res
.
data
.
detail
list
=
res
.
data
.
items
})
})
}
}
watchEffect
(()
=>
{
watchEffect
(()
=>
{
fetchInfo
()
fetchInfo
()
})
})
const
isEmpty
=
$computed
(()
=>
{
//
const isEmpty = $computed(() => {
return
!
props
.
competition_id
||
!
detail
?.
id
//
return !props.competition_id || !detail?.id
})
//
})
const
file
=
$computed
(()
=>
{
// const file = $computed(() => {
if
(
!
detail
)
return
{}
// if (!detail) return {}
return
JSON
.
parse
(
detail
.
url
)
// return JSON.parse(detail.url)
})
// })
let
currentRaw
=
$ref
<
ExperimentBookType
|
undefined
>
()
let
currentRawUrl
=
$ref
(
''
)
let
show
=
$ref
(
false
)
// 预览
function
handleView
(
row
:
ExperimentBookType
)
{
currentRaw
=
row
currentRawUrl
=
row
.
url
?
(
JSON
.
parse
(
row
.
url
)?.
url
as
string
)
:
''
console
.
log
(
row
,
'row'
)
show
=
true
}
// 关闭
function
handleClose
()
{
show
=
false
}
</
script
>
</
script
>
<
template
>
<
template
>
<el-empty
description=
"暂无数据"
v-if=
"isEmpty"
/>
<
!--
<
el-empty
description=
"暂无数据"
v-if=
"isEmpty"
/>
<template
v-else
>
<template
v-else
>
<Preview
:url=
"file.url"
></Preview>
<Preview
:url=
"file.url"
></Preview>
</
template
>
</
template
>
-->
<div
v-if=
"list.length"
>
<ul
class=
"book-list"
>
<li
v-for=
"item in list"
:key=
"item.id"
@
click=
"handleView(item)"
>
<el-icon><Document
/></el-icon>
<p>
{{ item.name }}
</p>
</li>
</ul>
</div>
<el-empty
description=
"暂无数据"
v-else
/>
<!-- 预览 -->
<div
class=
"book-preview"
v-if=
"show && currentRaw"
>
<div
class=
"book-preview__close"
@
click=
"handleClose"
>
<el-button
type=
"info"
circle
:icon=
"CloseBold"
/>
</div>
<Preview
:url=
"currentRawUrl"
></Preview>
</div>
</template>
</template>
<
style
lang=
"scss"
>
.book-list
{
li
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
10px
;
font-size
:
14px
;
cursor
:
pointer
;
.el-icon
{
margin-right
:
5px
;
}
}
}
.book-preview
{
position
:
absolute
;
top
:
15px
;
left
:
15px
;
right
:
15px
;
bottom
:
15px
;
background-color
:
#fff
;
}
.book-preview__close
{
position
:
absolute
;
right
:
-12px
;
top
:
-12px
;
font-size
:
20px
;
color
:
#fff
;
cursor
:
pointer
;
}
</
style
>
vite.config.ts
浏览文件 @
8c4e7894
...
@@ -26,6 +26,16 @@ export default defineConfig(({ mode }) => ({
...
@@ -26,6 +26,16 @@ export default defineConfig(({ mode }) => ({
cert
:
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'./https/ezijing.com.pem'
))
cert
:
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'./https/ezijing.com.pem'
))
},
},
proxy
:
{
proxy
:
{
'/api/resource'
:
{
target
:
'http://com-resource-admin-test.ezijing.com'
,
changeOrigin
:
true
,
rewrite
:
path
=>
path
.
replace
(
/^
\/
api
\/
resource/
,
''
)
},
'/api/lab'
:
{
target
:
'http://com-resource-api-test.ezijing.com'
,
changeOrigin
:
true
,
rewrite
:
path
=>
path
.
replace
(
/^
\/
api
\/
lab/
,
''
)
},
'/api'
:
'https://saas-lab.ezijing.com'
'/api'
:
'https://saas-lab.ezijing.com'
}
}
},
},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论