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
9db4d825
提交
9db4d825
authored
4月 21, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
updates
上级
cb9eb081
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
32 行增加
和
36 行删除
+32
-36
env.d.ts
env.d.ts
+2
-0
UploadFileList.vue
src/components/UploadFileList.vue
+14
-5
UploadImage.vue
src/components/UploadImage.vue
+1
-8
Publish.vue
src/modules/learn/views/Publish.vue
+2
-2
Publish.vue
src/modules/qa/views/Publish.vue
+2
-2
Create.vue
src/modules/team/views/Create.vue
+7
-18
vite.config.ts
vite.config.ts
+4
-1
没有找到文件。
env.d.ts
浏览文件 @
9db4d825
/// <reference types="vite/client" />
/// <reference types="vue/macros-global" />
interface
ImportMetaEnv
{
readonly
VITE_LOGIN_URL
:
string
}
...
...
src/components/Upload
Imag
eList.vue
→
src/components/Upload
Fil
eList.vue
浏览文件 @
9db4d825
<
script
setup
lang=
"ts"
>
import
md5
from
'blueimp-md5'
import
{
ref
,
withDefaults
,
watch
}
from
'vue'
import
{
ref
,
withDefaults
,
watch
,
computed
}
from
'vue'
import
{
getSignature
,
uploadFile
}
from
'@/api/base'
import
type
{
UploaderFileListItem
}
from
'vant'
const
props
=
withDefaults
(
defineProps
<
{
modelValue
:
string
[];
prefix
?:
string
}
>
(),
{
prefix
:
'upload/psp/'
})
const
props
=
withDefaults
(
defineProps
<
{
modelValue
?
:
string
[];
prefix
?:
string
}
>
(),
{
prefix
:
'upload/psp/'
})
const
emit
=
defineEmits
([
'update:modelValue'
])
const
fileList
=
ref
<
UploaderFileListItem
[]
>
([])
watch
(
props
.
modelValue
,
files
=>
{
fileList
.
value
=
files
.
map
((
url
:
string
)
=>
({
url
})
)
const
isFileList
=
computed
(()
=>
{
return
Array
.
isArray
(
props
.
modelValue
)
})
watch
(
()
=>
props
.
modelValue
,
files
=>
{
if
(
Array
.
isArray
(
files
))
{
fileList
.
value
=
files
.
map
((
url
:
string
)
=>
({
url
}))
}
}
)
console
.
log
(
isFileList
)
// 上传
const
afterRead
=
async
(
file
:
any
)
=>
{
// 获取签名
...
...
@@ -56,5 +65,5 @@ const onDelete = () => {
</
script
>
<
template
>
<van-uploader
v-model=
"fileList"
:after-read=
"afterRead"
@
delete=
"onDelete"
/
>
<van-uploader
v-model=
"fileList"
:after-read=
"afterRead"
@
delete=
"onDelete"
></van-uploader
>
</
template
>
src/components/UploadImage.vue
浏览文件 @
9db4d825
...
...
@@ -46,15 +46,8 @@ const afterRead = async (file: any) => {
file
.
message
=
'上传失败'
})
}
// 删除
const
onDelete
=
()
=>
{
emit
(
'update:modelValue'
,
fileList
.
value
.
map
((
item
:
any
)
=>
item
.
url
)
)
}
</
script
>
<
template
>
<van-uploader
v-model=
"fileList"
:after-read=
"afterRead"
@
delete=
"onDelete"
/
>
<van-uploader
:after-read=
"afterRead"
></van-uploader
>
</
template
>
src/modules/learn/views/Publish.vue
浏览文件 @
9db4d825
...
...
@@ -2,7 +2,7 @@
import
{
reactive
}
from
'vue'
import
{
useRouter
,
useRoute
}
from
'vue-router'
import
{
createCourseRecord
}
from
'../api'
import
Upload
ImageList
from
'@/components/UploadImag
eList.vue'
import
Upload
FileList
from
'@/components/UploadFil
eList.vue'
import
{
Toast
}
from
'vant'
const
router
=
useRouter
()
const
route
=
useRoute
()
...
...
@@ -31,7 +31,7 @@ function onSubmit() {
/>
<van-field
:rules=
"[
{ validator: pictureValidator, message: '请上传图片' }]">
<template
#
input
>
<Upload
ImageList
v-model=
"form.picture"
></UploadImag
eList>
<Upload
FileList
v-model=
"form.picture"
></UploadFil
eList>
</
template
>
</van-field>
<van-button
block
round
native-type=
"submit"
class=
"my-button"
>
发表
</van-button>
...
...
src/modules/qa/views/Publish.vue
浏览文件 @
9db4d825
...
...
@@ -2,7 +2,7 @@
import
{
reactive
}
from
'vue'
import
{
useRouter
}
from
'vue-router'
import
{
createQuestion
}
from
'../api'
import
Upload
ImageList
from
'@/components/UploadImag
eList.vue'
import
Upload
FileList
from
'@/components/UploadFil
eList.vue'
import
{
Toast
}
from
'vant'
const
router
=
useRouter
()
...
...
@@ -34,7 +34,7 @@ function onSubmit() {
/>
<van-field>
<template
#
input
>
<Upload
ImageList
v-model=
"form.picture"
></UploadImag
eList>
<Upload
FileList
v-model=
"form.picture"
></UploadFil
eList>
</
template
>
</van-field>
<van-button
block
round
native-type=
"submit"
class=
"my-button"
>
发布
</van-button>
...
...
src/modules/team/views/Create.vue
浏览文件 @
9db4d825
<
script
setup
lang=
"ts"
>
import
{
reactive
}
from
'vue'
import
{
useRouter
,
useRoute
}
from
'vue-router'
import
{
createTeam
}
from
'../api'
import
Upload
ImageList
from
'@/components/UploadImag
eList.vue'
import
Upload
FileList
from
'@/components/UploadFil
eList.vue'
import
{
Toast
}
from
'vant'
const
router
=
useRouter
()
const
route
=
useRoute
()
const
form
=
reactive
({
name
:
''
,
slogan
:
''
,
logo
:
''
,
brief
:
''
})
const
form
=
reactive
({
...{
chapter_id
:
''
,
course_id
:
''
,
content
:
''
,
picture
:
[]
},
...
route
.
query
})
const
pictureValidator
=
()
=>
!!
form
.
picture
.
length
function
onSubmit
()
{
const
params
=
Object
.
assign
({},
form
,
{
picture
:
JSON
.
stringify
(
form
.
picture
)
})
createTeam
(
params
).
then
(()
=>
{
createTeam
(
form
).
then
(()
=>
{
Toast
.
success
(
'创建成功'
)
router
.
push
({
name
:
'learnCourseView'
,
params
:
{
id
:
form
.
course_id
}
})
})
}
</
script
>
...
...
@@ -22,21 +15,17 @@ function onSubmit() {
<
template
>
<AppContainer
title=
"团队创建"
backgroundColor=
"#fff"
headerAlign=
"center"
>
<van-form
@
submit=
"onSubmit"
>
<van-field
v-model=
"form.name"
placeholder=
"团队名称"
:rules=
"[
{ required: true, message: '请输入团队名称' }]" />
<van-field
v-model=
"form.content"
placeholder=
"团队名称"
:rules=
"[
{ required: true, message: '请输入团队名称' }]"
/>
<van-field
v-model=
"form.content"
v-model=
"form.brief"
type=
"textarea"
placeholder=
"团队简介"
:autosize=
"
{ minHeight: 200 }"
:rules="[{ required: true, message: '请输入团队简介' }]"
/>
<van-field
:rules=
"[
{
validator: pictureValidator
, message: '请上传图片' }]">
<van-field
:rules=
"[
{
required: true
, message: '请上传图片' }]">
<template
#
input
>
<Upload
ImageList
v-model=
"form.picture"
></UploadImag
eList>
<Upload
FileList></UploadFil
eList>
</
template
>
</van-field>
<van-button
block
round
native-type=
"submit"
class=
"my-button"
>
立即创建
</van-button>
...
...
vite.config.ts
浏览文件 @
9db4d825
...
...
@@ -9,7 +9,10 @@ import checker from 'vite-plugin-checker'
export
default
defineConfig
(({
mode
})
=>
{
return
{
base
:
mode
===
'prod'
?
'https://webapp-pub.ezijing.com/website/prod/prp-h5/'
:
'/'
,
plugins
:
[
checker
({
eslint
:
{
lintCommand
:
'eslint "./src/**/*.{vue,js,jsx,ts,tsx}"'
}
}),
vue
()],
plugins
:
[
checker
({
eslint
:
{
lintCommand
:
'eslint "./src/**/*.{vue,js,jsx,ts,tsx}"'
}
}),
vue
({
reactivityTransform
:
true
})
],
server
:
{
open
:
true
,
host
:
'dev.ezijing.com'
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论