Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
1532635456
gin-vue-admin
提交
4972cc3a
G
gin-vue-admin
项目概览
1532635456
/
gin-vue-admin
落后 Fork 源项目 1212 个版本
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
6
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,发现更多精彩内容 >>
提交
4972cc3a
编写于
12月 15, 2019
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加上传的动态路径方法 增加用户录入功能 修复了切换账号必须刷新才能改变菜单的bug
上级
e064d326
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
191 addition
and
113 deletion
+191
-113
QMPlusServer/controller/api/exa_fileUploadAndDownload.go
QMPlusServer/controller/api/exa_fileUploadAndDownload.go
+4
-1
QMPlusServer/controller/api/sys_user.go
QMPlusServer/controller/api/sys_user.go
+3
-5
QMPlusServer/model/sysModel/sys_user.go
QMPlusServer/model/sysModel/sys_user.go
+1
-1
QMPlusVuePage/src/components/HelloWorld.vue
QMPlusVuePage/src/components/HelloWorld.vue
+0
-58
QMPlusVuePage/src/store/module/user.js
QMPlusVuePage/src/store/module/user.js
+1
-0
QMPlusVuePage/src/view/example/excel/excel.vue
QMPlusVuePage/src/view/example/excel/excel.vue
+59
-38
QMPlusVuePage/src/view/example/upload/upload.vue
QMPlusVuePage/src/view/example/upload/upload.vue
+4
-2
QMPlusVuePage/src/view/login/regist.vue
QMPlusVuePage/src/view/login/regist.vue
+7
-3
QMPlusVuePage/src/view/person/person.vue
QMPlusVuePage/src/view/person/person.vue
+7
-1
QMPlusVuePage/src/view/superAdmin/user/user.vue
QMPlusVuePage/src/view/superAdmin/user/user.vue
+105
-4
未找到文件。
QMPlusServer/controller/api/exa_fileUploadAndDownload.go
浏览文件 @
4972cc3a
...
...
@@ -18,6 +18,7 @@ import (
// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
// @Router /fileUploadAndDownload/upload [post]
func
UploadFile
(
c
*
gin
.
Context
)
{
noSave
:=
c
.
DefaultQuery
(
"noSave"
,
"0"
)
_
,
header
,
err
:=
c
.
Request
.
FormFile
(
"file"
)
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"上传文件失败,%v"
,
err
),
gin
.
H
{})
...
...
@@ -34,7 +35,9 @@ func UploadFile(c *gin.Context) {
s
:=
strings
.
Split
(
file
.
Name
,
"."
)
file
.
Tag
=
s
[
len
(
s
)
-
1
]
file
.
Key
=
key
err
:=
file
.
Upload
()
if
(
noSave
==
"0"
){
err
=
file
.
Upload
()
}
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"修改数据库链接失败,%v"
,
err
),
gin
.
H
{})
}
else
{
...
...
QMPlusServer/controller/api/sys_user.go
浏览文件 @
4972cc3a
...
...
@@ -26,15 +26,13 @@ type RegistAndLoginStuct struct {
// @Tags Base
// @Summary 用户注册账号
// @Produce application/json
// @Param data body
api.RegistAndLoginStuct
true "用户注册接口"
// @Param data body
sysModel.SysUser
true "用户注册接口"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}"
// @Router /base/regist [post]
func
Regist
(
c
*
gin
.
Context
)
{
var
R
RegistAndLoginStuct
var
R
sysModel
.
SysUser
_
=
c
.
BindJSON
(
&
R
)
U
:=
&
sysModel
.
SysUser
{
Username
:
R
.
Username
,
Password
:
R
.
Password
}
err
,
user
:=
U
.
Regist
()
err
,
user
:=
R
.
Regist
()
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"%v"
,
err
),
gin
.
H
{
"user"
:
user
,
...
...
QMPlusServer/model/sysModel/sys_user.go
浏览文件 @
4972cc3a
...
...
@@ -18,7 +18,7 @@ type SysUser struct {
NickName
string
`json:"nickName" gorm:"default:'QMPlusUser'"`
HeaderImg
string
`json:"headerImg" gorm:"default:'http://www.henrongyi.top/avatar/lufu.jpg'"`
Authority
SysAuthority
`json:"authority" gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId"`
AuthorityId
string
`json:"
-
" gorm:"default:888"`
AuthorityId
string
`json:"
authorityId
" gorm:"default:888"`
}
//type Propertie struct {
...
...
QMPlusVuePage/src/components/HelloWorld.vue
已删除
100644 → 0
浏览文件 @
e064d326
<
template
>
<div
class=
"hello"
>
<h1>
{{
msg
}}
</h1>
<p>
For a guide and recipes on how to configure / customize this project,
<br>
check out the
<a
href=
"https://cli.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
vue-cli documentation
</a>
.
</p>
<h3>
Installed CLI Plugins
</h3>
<ul>
<li><a
href=
"https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel"
target=
"_blank"
rel=
"noopener"
>
babel
</a></li>
<li><a
href=
"https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint"
target=
"_blank"
rel=
"noopener"
>
eslint
</a></li>
</ul>
<h3>
Essential Links
</h3>
<ul>
<li><a
href=
"https://vuejs.org"
target=
"_blank"
rel=
"noopener"
>
Core Docs
</a></li>
<li><a
href=
"https://forum.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
Forum
</a></li>
<li><a
href=
"https://chat.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
Community Chat
</a></li>
<li><a
href=
"https://twitter.com/vuejs"
target=
"_blank"
rel=
"noopener"
>
Twitter
</a></li>
<li><a
href=
"https://news.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
News
</a></li>
</ul>
<h3>
Ecosystem
</h3>
<ul>
<li><a
href=
"https://router.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
vue-router
</a></li>
<li><a
href=
"https://vuex.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
vuex
</a></li>
<li><a
href=
"https://github.com/vuejs/vue-devtools#vue-devtools"
target=
"_blank"
rel=
"noopener"
>
vue-devtools
</a></li>
<li><a
href=
"https://vue-loader.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
vue-loader
</a></li>
<li><a
href=
"https://github.com/vuejs/awesome-vue"
target=
"_blank"
rel=
"noopener"
>
awesome-vue
</a></li>
</ul>
</div>
</
template
>
<
script
>
export
default
{
name
:
'
HelloWorld
'
,
props
:
{
msg
:
String
}
}
</
script
>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<
style
scoped
>
h3
{
margin
:
40px
0
0
;
}
ul
{
list-style-type
:
none
;
padding
:
0
;
}
li
{
display
:
inline-block
;
margin
:
0
10px
;
}
a
{
color
:
#42b983
;
}
</
style
>
QMPlusVuePage/src/store/module/user.js
浏览文件 @
4972cc3a
...
...
@@ -30,6 +30,7 @@ export const user = {
state
.
token
=
""
state
.
expiresAt
=
""
router
.
push
({
name
:
'
login
'
,
replace
:
true
})
window
.
location
.
reload
()
},
ResetUserInfo
(
state
,
userInfo
=
{})
{
state
.
userInfo
=
{...
state
.
userInfo
,
...
...
QMPlusVuePage/src/view/example/excel/excel.vue
浏览文件 @
4972cc3a
<
template
>
<div>
<el-upload
class=
"upload-demo
"
:headers=
"
{'x-token':token}
"
action="/api/fileUploadAndDownload/upload
"
:on-preview="handlePreview
"
:on-remove="handleRemove
"
:before-remove="beforeRemove
"
multiple
:limit="10
"
:on-exceed="handleExceed
"
:file-list="fileList">
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button
>
<div
slot=
"tip"
class=
"el-upload__tip"
>
未对文件格式及大小做校验
</div
>
</el-upload
>
</el-upload>
</div>
<div>
<el-upload
:action=
"`$
{path}/fileUploadAndDownload/upload`
"
:before-remove="beforeRemove
"
:file-list="fileList
"
:headers="{'x-token':token}
"
:limit="10
"
:on-exceed="handleExceed
"
:on-preview="handlePreview"
:on-remove="handleRemove
"
class="upload-demo
"
multiple
>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button
>
<div
class=
"el-upload__tip"
slot=
"tip"
>
未对文件格式及大小做校验
</div
>
</el-upload>
</div>
</
template
>
<
script
>
import
{
mapGetters
}
from
'
vuex
'
import
{
mapGetters
}
from
'
vuex
'
const
path
=
process
.
env
.
VUE_APP_BASE_API
export
default
{
name
:
'
Excel
'
,
data
()
{
return
{
fileList
:
[{
name
:
'
food.jpeg
'
,
url
:
'
https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100
'
},
{
name
:
'
food2.jpeg
'
,
url
:
'
https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100
'
}]
};
name
:
'
Excel
'
,
data
()
{
return
{
path
:
path
,
},
computed
:
{
...
mapGetters
(
'
user
'
,
[
'
userInfo
'
,
'
token
'
])
},
methods
:
{
handleRemove
(
file
,
fileList
)
{
console
.
log
(
file
,
fileList
);
},
handlePreview
(
file
)
{
console
.
log
(
file
);
},
handleExceed
(
files
,
fileList
)
{
this
.
$message
.
warning
(
`当前限制选择 3 个文件,本次选择了
${
files
.
length
}
个文件,共选择了
${
files
.
length
+
fileList
.
length
}
个文件`
);
fileList
:
[
{
name
:
'
food.jpeg
'
,
url
:
'
https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100
'
},
beforeRemove
(
file
,
fileList
)
{
return
this
.
$confirm
(
`确定移除
${
file
.
name
}
?`
);
{
name
:
'
food2.jpeg
'
,
url
:
'
https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100
'
}
]
}
},
computed
:
{
...
mapGetters
(
'
user
'
,
[
'
userInfo
'
,
'
token
'
])
},
methods
:
{
handleRemove
(
file
,
fileList
)
{
this
.
$message
.
warning
(
`共有
${
fileList
.
length
}
个文件,移除了
${
file
.
name
}
`
)
},
handlePreview
(
file
)
{
this
.
$message
.
warning
(
`
${
file
.
name
}
选择完成`
)
},
handleExceed
(
files
,
fileList
)
{
this
.
$message
.
warning
(
`当前限制选择 3 个文件,本次选择了
${
files
.
length
}
个文件,共选择了
${
files
.
length
+
fileList
.
length
}
个文件`
)
},
beforeRemove
(
file
,
fileList
)
{
return
this
.
$confirm
(
`共有
${
fileList
.
length
}
个文件,确定移除
${
file
.
name
}
?`
)
}
}
}
</
script
>
\ No newline at end of file
QMPlusVuePage/src/view/example/upload/upload.vue
浏览文件 @
4972cc3a
<
template
>
<div>
<el-upload
:action=
"`$
{path}/fileUploadAndDownload/upload`"
: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>
<div
class=
"el-upload__tip"
slot=
"tip"
>
只能上传jpg/png文件,且不超过500kb
</div>
...
...
@@ -53,6 +53,7 @@
</template>
<
script
>
const
path
=
process
.
env
.
VUE_APP_BASE_API
import
{
mapGetters
}
from
'
vuex
'
import
infoList
from
'
@/components/mixins/infoList
'
import
{
getFileList
,
deleteFile
}
from
'
@/api/fileUploadAndDownload
'
...
...
@@ -65,6 +66,7 @@ export default {
return
{
listApi
:
getFileList
,
listKey
:
'
list
'
,
path
:
path
,
tableData
:
[
{
UpdatedAt
:
'
2019-10-25
'
,
...
...
@@ -96,7 +98,7 @@ export default {
},
methods
:
{
async
deleteFile
(
row
)
{
this
.
$confirm
(
'
此操作将永久
删除所有角色下该菜单
, 是否继续?
'
,
'
提示
'
,
{
this
.
$confirm
(
'
此操作将永久
文件
, 是否继续?
'
,
'
提示
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
...
...
QMPlusVuePage/src/view/login/regist.vue
浏览文件 @
4972cc3a
...
...
@@ -2,7 +2,7 @@
<el-container
class=
"login-regist-box"
>
<vue-particle-line></vue-particle-line>
<el-main
class=
"login-box"
>
<h1
class=
"title-1"
>
GIN-VUE-ADMIN
</h1>
by 奇淼
<h1
class=
"title-1"
>
GIN-VUE-ADMIN
</h1>
<el-form
:model=
"registForm"
:rules=
"rules"
ref=
"registForm"
>
<el-form-item
prop=
"username"
>
<el-input
placeholder=
"请输入用户名"
v-model=
"registForm.username"
></el-input>
...
...
@@ -16,8 +16,12 @@
<i
:class=
"'el-input__icon el-icon-' + lock"
@
click=
"changeLock"
slot=
"suffix"
></i>
</el-input>
</el-form-item>
<el-form-item
label=
"重复密码"
prop=
"rePassword"
>
<el-input
:type=
"lock==='lock'?'password':'text'"
v-model=
"registForm.rePassword"
>
<el-form-item
prop=
"rePassword"
>
<el-input
:type=
"lock==='lock'?'password':'text'"
placeholder=
"请再次输入密码"
v-model=
"registForm.rePassword"
>
<i
:class=
"'el-input__icon el-icon-' + lock"
@
click=
"changeLock"
slot=
"suffix"
></i>
</el-input>
</el-form-item>
...
...
QMPlusVuePage/src/view/person/person.vue
浏览文件 @
4972cc3a
...
...
@@ -5,7 +5,7 @@
:headers=
"
{'x-token':token}"
:on-success="handleAvatarSuccess"
:show-file-list="false"
action="api/user/uploadHeaderImg
"
:action="`${path}/user/uploadHeaderImg`
"
class="avatar-uploader"
name="headerImg"
>
...
...
@@ -24,8 +24,14 @@
</
template
>
<
script
>
import
{
mapGetters
,
mapMutations
}
from
'
vuex
'
const
path
=
process
.
env
.
VUE_APP_BASE_API
export
default
{
name
:
'
Person
'
,
data
(){
return
{
path
:
path
}
},
computed
:
{
...
mapGetters
(
'
user
'
,
[
'
userInfo
'
,
'
token
'
])
},
...
...
QMPlusVuePage/src/view/superAdmin/user/user.vue
浏览文件 @
4972cc3a
<
template
>
<div>
<div
class=
"button-box clearflex"
></div>
<div
class=
"button-box clearflex"
>
<el-button
@
click=
"addUser"
type=
"primary"
>
新增用户
</el-button>
</div>
<el-table
:data=
"tableData"
border
stripe
>
<el-table-column
label=
"头像"
min-width=
"50"
>
<template
slot-scope=
"scope"
>
...
...
@@ -39,16 +41,58 @@
@
size-change=
"handleSizeChange"
layout=
"total, sizes, prev, pager, next, jumper"
></el-pagination>
<el-dialog
:visible.sync=
"addUserDialog"
custom-class=
"user-dialog"
title=
"新增用户"
>
<el-form
:model=
"userInfo"
>
<el-form-item
label=
"用户名"
label-width=
"80px"
>
<el-input
v-model=
"userInfo.username"
></el-input>
</el-form-item>
<el-form-item
label=
"密码"
label-width=
"80px"
>
<el-input
v-model=
"userInfo.password"
></el-input>
</el-form-item>
<el-form-item
label=
"别名"
label-width=
"80px"
>
<el-input
v-model=
"userInfo.nickName"
></el-input>
</el-form-item>
<el-form-item
label=
"头像"
label-width=
"80px"
>
<el-upload
:headers=
"{'x-token':token}"
:on-success=
"handleAvatarSuccess"
:show-file-list=
"false"
:action=
"`${path}/fileUploadAndDownload/upload?noSave=1`"
class=
"avatar-uploader"
name=
"file"
>
<img
:src=
"userInfo.headerImg"
class=
"avatar"
v-if=
"userInfo.headerImg"
/>
<i
class=
"el-icon-plus avatar-uploader-icon"
v-else
></i>
</el-upload>
</el-form-item>
<el-form-item
label=
"用户角色"
label-width=
"80px"
>
<el-select
placeholder=
"请选择"
v-model=
"userInfo.authorityId"
>
<el-option
:key=
"item.authorityId"
:label=
"item.authorityName"
:value=
"item.authorityId"
v-for=
"item in authOptions"
></el-option>
</el-select>
</el-form-item>
</el-form>
<div
class=
"dialog-footer"
slot=
"footer"
>
<el-button
@
click=
"closeAddUserDialog"
>
取 消
</el-button>
<el-button
@
click=
"enterAddUserDialog"
type=
"primary"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
</template>
<
script
>
// 获取列表内容封装在mixins内部 getTableData方法 初始化已封装完成
import
{
getUserList
,
setUserAuthority
}
from
'
@/api/user
'
const
path
=
process
.
env
.
VUE_APP_BASE_API
import
{
getUserList
,
setUserAuthority
,
regist
}
from
'
@/api/user
'
import
{
getAuthorityList
}
from
'
@/api/authority
'
import
infoList
from
'
@/components/mixins/infoList
'
import
{
mapGetters
}
from
'
vuex
'
export
default
{
name
:
'
Api
'
,
mixins
:
[
infoList
],
...
...
@@ -56,10 +100,46 @@ export default {
return
{
listApi
:
getUserList
,
listKey
:
'
userList
'
,
authOptions
:
[]
path
:
path
,
authOptions
:
[],
addUserDialog
:
false
,
userInfo
:
{
username
:
''
,
password
:
''
,
nickName
:
''
,
headerImg
:
''
,
authorityId
:
''
}
}
},
computed
:
{
...
mapGetters
(
'
user
'
,
[
'
token
'
])
},
methods
:
{
async
enterAddUserDialog
()
{
const
res
=
await
regist
(
this
.
userInfo
)
if
(
res
.
success
)
{
this
.
$message
({
type
:
'
success
'
,
message
:
'
创建成功
'
})
}
await
this
.
getTableData
()
this
.
closeAddUserDialog
()
},
closeAddUserDialog
()
{
this
.
userInfo
=
{
username
:
''
,
password
:
''
,
nickName
:
''
,
headerImg
:
''
,
authorityId
:
''
}
this
.
addUserDialog
=
false
},
handleAvatarSuccess
(
res
)
{
this
.
userInfo
.
headerImg
=
res
.
data
.
file
.
url
},
addUser
()
{
this
.
addUserDialog
=
true
},
async
changeAuthority
(
row
)
{
const
res
=
await
setUserAuthority
({
uuid
:
row
.
uuid
,
...
...
@@ -83,4 +163,25 @@ export default {
float
:
right
;
}
}
.user-dialog
{
.avatar-uploader
.el-upload
:hover
{
border-color
:
#409eff
;
}
.avatar-uploader-icon
{
border
:
1px
dashed
#d9d9d9
!
important
;
border-radius
:
6px
;
font-size
:
28px
;
color
:
#8c939d
;
width
:
178px
;
height
:
178px
;
line-height
:
178px
;
text-align
:
center
;
}
.avatar
{
width
:
178px
;
height
:
178px
;
display
:
block
;
}
}
</
style
>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录