Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loujc2008
gin-vue-admin
提交
3db12359
G
gin-vue-admin
项目概览
loujc2008
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3db12359
编写于
11月 25, 2019
作者:
K
klausY
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
01d91566
75dff712
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
3824 addition
and
47 deletion
+3824
-47
.gitattributes
.gitattributes
+1
-0
QMPlusServer/controller/api/fileUploadAndDownload.go
QMPlusServer/controller/api/fileUploadAndDownload.go
+1
-2
QMPlusServer/db/qmplus.sql
QMPlusServer/db/qmplus.sql
+3721
-38
QMPlusServer/docs/docs.go
QMPlusServer/docs/docs.go
+4
-1
QMPlusServer/docs/swagger.json
QMPlusServer/docs/swagger.json
+3
-0
QMPlusServer/docs/swagger.yaml
QMPlusServer/docs/swagger.yaml
+2
-0
QMPlusVuePage/src/api/fileUploadAndDownload.js
QMPlusVuePage/src/api/fileUploadAndDownload.js
+15
-0
QMPlusVuePage/src/utils/data.js
QMPlusVuePage/src/utils/data.js
+30
-0
QMPlusVuePage/src/view/example/upload/upload.vue
QMPlusVuePage/src/view/example/upload/upload.vue
+47
-6
未找到文件。
.gitattributes
0 → 100644
浏览文件 @
3db12359
*.sql linguist-language=GO
\ No newline at end of file
QMPlusServer/controller/api/fileUploadAndDownload.go
浏览文件 @
3db12359
...
...
@@ -62,7 +62,7 @@ func DeleteFile(c *gin.Context) {
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"删除失败,%v"
,
err
),
gin
.
H
{})
}
else
{
err
=
f
ile
.
DeleteFile
()
err
=
f
.
DeleteFile
()
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"删除失败,%v"
,
err
),
gin
.
H
{})
}
else
{
...
...
@@ -70,7 +70,6 @@ func DeleteFile(c *gin.Context) {
}
}
}
}
// @Tags FileUploadAndDownload
...
...
QMPlusServer/db/qmplus.sql
浏览文件 @
3db12359
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
QMPlusServer/docs/docs.go
浏览文件 @
3db12359
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2019-11-20 16:
37:42.2606856 +0800 CST m=+0.0648250
01
// 2019-11-20 16:
59:15.3568689 +0800 CST m=+0.0569201
01
package
docs
...
...
@@ -1290,6 +1290,9 @@ var doc = `{
"dbModel.FileUploadAndDownload": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
...
...
QMPlusServer/docs/swagger.json
浏览文件 @
3db12359
...
...
@@ -1273,6 +1273,9 @@
"dbModel.FileUploadAndDownload"
:
{
"type"
:
"object"
,
"properties"
:
{
"key"
:
{
"type"
:
"string"
},
"name"
:
{
"type"
:
"string"
},
...
...
QMPlusServer/docs/swagger.yaml
浏览文件 @
3db12359
...
...
@@ -114,6 +114,8 @@ definitions:
type
:
object
dbModel.FileUploadAndDownload
:
properties
:
key
:
type
:
string
name
:
type
:
string
tag
:
...
...
QMPlusVuePage/src/api/fileUploadAndDownload.js
浏览文件 @
3db12359
...
...
@@ -13,4 +13,19 @@ export const getFileList = (data) => {
method
:
"
post
"
,
data
})
}
// @Tags FileUploadAndDownload
// @Summary 删除文件
// @Security ApiKeyAuth
// @Produce application/json
// @Param data body dbModel.FileUploadAndDownload true "传入文件里面id即可"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"返回成功"}"
// @Router /fileUploadAndDownload/deleteFile [post]
export
const
deleteFile
=
(
data
)
=>
{
return
service
({
url
:
"
/fileUploadAndDownload/deleteFile
"
,
method
:
"
post
"
,
data
})
}
\ No newline at end of file
QMPlusVuePage/src/utils/data.js
0 → 100644
浏览文件 @
3db12359
// 对Date的扩展,将 Date 转化为指定格式的String
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
Date
.
prototype
.
Format
=
function
(
fmt
)
{
var
o
=
{
"
M+
"
:
this
.
getMonth
()
+
1
,
//月份
"
d+
"
:
this
.
getDate
(),
//日
"
h+
"
:
this
.
getHours
(),
//小时
"
m+
"
:
this
.
getMinutes
(),
//分
"
s+
"
:
this
.
getSeconds
(),
//秒
"
q+
"
:
Math
.
floor
((
this
.
getMonth
()
+
3
)
/
3
),
//季度
"
S
"
:
this
.
getMilliseconds
()
//毫秒
};
if
(
/
(
y+
)
/
.
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
this
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
));
for
(
var
k
in
o
)
if
(
new
RegExp
(
"
(
"
+
k
+
"
)
"
).
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
RegExp
.
$1
.
length
==
1
)
?
(
o
[
k
])
:
((
"
00
"
+
o
[
k
]).
substr
((
""
+
o
[
k
]).
length
)));
return
fmt
;
}
export
function
formatTimeToStr
(
times
,
pattern
)
{
var
d
=
new
Date
(
times
).
Format
(
"
yyyy-MM-dd hh:mm:ss
"
);
if
(
pattern
)
{
d
=
new
Date
(
times
).
Format
(
pattern
);
}
return
d
.
toLocaleString
();
}
\ No newline at end of file
QMPlusVuePage/src/view/example/upload/upload.vue
浏览文件 @
3db12359
<
template
>
<div>
<el-upload
:headers=
"
{'x-token':token}"
:show-file-list="false"
:before-upload=
"checkFile"
:headers=
"
{'x-token':token}"
:on-error="uploadError"
:on-success="uploadSuccess"
:show-file-list="false"
action="/api/fileUploadAndDownload/upload"
>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
...
...
@@ -17,7 +17,13 @@
<img
:alt=
"scope.row.alt"
:src=
"scope.row.url"
height=
"80"
width=
"80"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"日期"
prop=
"UpdatedAt"
width=
"180"
></el-table-column>
<el-table-column
label=
"日期"
prop=
"UpdatedAt"
width=
"180"
>
<
template
slot-scope=
"scope"
>
<div>
{{
scope
.
row
.
UpdatedAt
|
formatDate
}}
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"文件名"
prop=
"name"
width=
"180"
></el-table-column>
<el-table-column
label=
"链接"
prop=
"url"
></el-table-column>
<el-table-column
label=
"标签"
prop=
"tag"
width=
"100"
>
...
...
@@ -31,6 +37,7 @@
<el-table-column
label=
"操作"
width=
"100"
>
<
template
slot-scope=
"scope"
>
<el-button
@
click=
"downloadFile(scope.row)"
size=
"small"
type=
"text"
>
下载
</el-button>
<el-button
@
click=
"deleteFile(scope.row)"
size=
"small"
type=
"text"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
...
...
@@ -50,8 +57,9 @@
<
script
>
import
{
mapGetters
}
from
'
vuex
'
import
infoList
from
'
@/components/mixins/infoList
'
import
{
getFileList
}
from
'
@/api/fileUploadAndDownload
'
import
{
getFileList
,
deleteFile
}
from
'
@/api/fileUploadAndDownload
'
import
{
downloadImage
}
from
'
@/utils/downloadImg
'
import
{
formatTimeToStr
}
from
'
@/utils/data
'
export
default
{
name
:
'
Upload
'
,
mixins
:
[
infoList
],
...
...
@@ -78,12 +86,45 @@ export default {
computed
:
{
...
mapGetters
(
'
user
'
,
[
'
userInfo
'
,
'
token
'
])
},
filters
:
{
formatDate
:
function
(
time
)
{
if
(
time
!=
null
&&
time
!=
''
)
{
var
date
=
new
Date
(
time
)
return
formatTimeToStr
(
date
,
'
yyyy-MM-dd hh:mm:ss
'
)
}
else
{
return
''
}
}
},
methods
:
{
async
deleteFile
(
row
)
{
this
.
$confirm
(
'
此操作将永久删除所有角色下该菜单, 是否继续?
'
,
'
提示
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
})
.
then
(
async
()
=>
{
const
res
=
await
deleteFile
(
row
)
if
(
res
.
success
)
{
this
.
$message
({
type
:
'
success
'
,
message
:
'
删除成功!
'
})
this
.
getTableData
()
}
})
.
catch
(()
=>
{
this
.
$message
({
type
:
'
info
'
,
message
:
'
已取消删除
'
})
})
},
checkFile
(
file
)
{
const
isJPG
=
file
.
type
===
'
image/jpeg
'
const
isPng
=
file
.
type
===
'
image/png
'
const
isLt2M
=
file
.
size
/
1024
/
1024
<
2
if
(
!
isJPG
&&
!
isPng
)
{
if
(
!
isJPG
&&
!
isPng
)
{
this
.
$message
.
error
(
'
上传头像图片只能是 JPG或png 格式!
'
)
}
if
(
!
isLt2M
)
{
...
...
@@ -96,7 +137,7 @@ export default {
type
:
'
success
'
,
message
:
'
上传成功
'
})
if
(
res
.
success
)
{
if
(
res
.
success
)
{
this
.
getTableData
()
}
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录