Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
evm-store
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanli
evm-store
Commits
79eb2e3c
Commit
79eb2e3c
authored
Mar 16, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
5e559b46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
185 additions
and
115 deletions
+185
-115
backend/model/apps.py
backend/model/apps.py
+1
-1
frontend/src/views/app-store/index.vue
frontend/src/views/app-store/index.vue
+184
-114
No files found.
backend/model/apps.py
View file @
79eb2e3c
...
...
@@ -21,7 +21,7 @@ class Apps(db.Entity):
app_version
=
Optional
(
str
,
default
=
""
)
app_url
=
Optional
(
str
,
default
=
""
)
category
=
Optional
(
str
,
default
=
""
)
app_icon
=
Optional
(
"Annex"
,
reverse
=
"app_icon"
,
cascade_delete
=
True
)
app_icon
=
Optional
(
"Annex"
,
reverse
=
"app_icon"
)
app_desc
=
Optional
(
str
,
default
=
""
)
app_annex
=
Set
(
"Annex"
,
reverse
=
"app"
,
cascade_delete
=
True
)
app_user
=
Optional
(
"AppUser"
,
reverse
=
"app"
,
cascade_delete
=
True
)
...
...
frontend/src/views/app-store/index.vue
View file @
79eb2e3c
<
template
>
<div
class=
"app-container"
>
<el-form
:inline=
"true"
ref=
"form"
:model=
"form"
size=
"mini"
>
<el-form-item><el-button
type=
"warning"
@
click=
"onAdd"
>
添加应用
</el-button></el-form-item>
<el-form-item
><el-button
type=
"warning"
@
click=
"onAdd"
>
添加应用
</el-button
></el-form-item
>
<!--
<el-form-item><el-button
type=
"success"
@
click=
"onAddFramework"
>
添加系统页面
</el-button></el-form-item>
-->
<!--
<el-form-item><el-button
type=
"success"
@
click=
"onAddFramework"
>
上传JSON配置文件
</el-button></el-form-item>
-->
</el-form>
...
...
@@ -61,9 +65,14 @@
label=
"更新者"
width=
"150"
></el-table-column>
<el-table-column
label=
"操作"
align=
"center"
min-width=
"180"
fixed=
"right"
>
<el-table-column
label=
"操作"
align=
"center"
min-width=
"180"
fixed=
"right"
>
<template
slot-scope=
"scope"
>
<el-button
<el-button
size=
"mini"
type=
"primary"
@
click=
"handleBuild(scope.$index, scope.row)"
...
...
@@ -97,24 +106,54 @@
></el-pagination>
</div>
<el-dialog
:title=
"dialogTitle"
:visible.sync=
"dialogVisible"
width=
"45%"
>
<el-form
:model=
"post"
status-icon
ref=
"post"
size=
"medium"
label-width=
"100px"
>
<el-form
:model=
"post"
status-icon
ref=
"post"
size=
"medium"
label-width=
"100px"
>
<el-form-item
label=
"应用排序"
prop=
"sort"
>
<el-input
type=
"number"
v-model.number=
"post.sort"
autocomplete=
"off"
></el-input>
<el-input
type=
"number"
v-model.number=
"post.sort"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"应用名称"
prop=
"app_name"
>
<el-input
type=
"text"
v-model=
"post.app_name"
autocomplete=
"off"
></el-input>
<el-input
type=
"text"
v-model=
"post.app_name"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"应用版本号"
prop=
"app_version"
>
<el-input
type=
"text"
v-model=
"post.app_version"
autocomplete=
"off"
></el-input>
<el-input
type=
"text"
v-model=
"post.app_version"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"应用路径"
prop=
"app_url"
>
<el-input
type=
"text"
v-model=
"post.app_url"
autocomplete=
"off"
></el-input>
<el-input
type=
"text"
v-model=
"post.app_url"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"应用类别"
prop=
"category"
>
<el-input
type=
"text"
v-model=
"post.category"
autocomplete=
"off"
></el-input>
<el-input
type=
"text"
v-model=
"post.category"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"应用描述"
prop=
"app_desc"
>
<el-input
type=
"text"
v-model=
"post.app_desc"
autocomplete=
"off"
></el-input>
<el-input
type=
"text"
v-model=
"post.app_desc"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"应用Logo"
prop=
"app_icon"
>
<el-upload
...
...
@@ -132,6 +171,7 @@
<el-form-item
label=
"应用文件"
prop=
"app_files"
>
<el-upload
drag
ref=
"upload"
:action=
"`${window.location.protocol}//${window.location.host}/api/v1/evm_store/upload`"
:on-remove=
"handleRemove"
:on-success=
"handleUploadSuccess"
...
...
@@ -143,56 +183,77 @@
将文件拖到此处,或
<em>
点击上传
</em>
</div>
<div
class=
"el-upload__tip"
slot=
"tip"
>
.evue和资源文件
<el-button
size=
"small"
type=
"text"
@
click=
"clear"
>
清空上传
</el-button
>
</div>
</el-upload>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
size=
"medium"
plain
@
click=
"submitForm('post')"
>
提交
</el-button>
<el-button
type=
"success"
size=
"medium"
plain
@
click=
"onReset('form')"
>
重置
</el-button>
<el-button
type=
"primary"
size=
"medium"
plain
@
click=
"submitForm('post')"
>
提交
</el-button
>
<el-button
type=
"success"
size=
"medium"
plain
@
click=
"onReset('form')"
>
重置
</el-button
>
<el-button
size=
"medium"
@
click=
"dialogVisible = false"
>
关闭
</el-button>
</div>
</el-dialog>
<el-dialog
title=
"添加系统页面"
:visible.sync=
"frameworkDialog"
>
<el-form
:model=
"form"
label-width=
"100px"
>
<el-form-item
label=
"页面名称"
>
<el-input
v-model=
"framework.name"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"页面路径"
>
<el-input
v-model=
"framework.url"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"活动描述"
>
<el-input
v-model=
"framework.desc"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"活动类型"
>
<el-input
v-model=
"framework.type"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"资源文件"
prop=
"app_icon"
>
<el-upload
drag
multiple
name=
"binfile"
:action=
"`${window.location.protocol}//${window.location.host}/api/v1/evm_store/upload`"
:on-remove=
"handleFrameworkRemove"
:on-success=
"handleFrameworkSuccess"
:file-list=
"fileList"
>
<i
class=
"el-icon-upload"
></i>
<div
class=
"el-upload__text"
>
将文件拖到此处,或
<em>
点击上传
</em></div>
<div
class=
"el-upload__tip"
slot=
"tip"
>
只能上传jpg/png文件,且不超过500kb
</div>
</el-upload>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"frameworkDialog = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"addFramework"
>
确 定
</el-button>
</div>
<el-form
:model=
"form"
label-width=
"100px"
>
<el-form-item
label=
"页面名称"
>
<el-input
v-model=
"framework.name"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"页面路径"
>
<el-input
v-model=
"framework.url"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"活动描述"
>
<el-input
v-model=
"framework.desc"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"活动类型"
>
<el-input
v-model=
"framework.type"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
label=
"资源文件"
prop=
"app_icon"
>
<el-upload
drag
multiple
name=
"binfile"
:action=
"`${window.location.protocol}//${window.location.host}/api/v1/evm_store/upload`"
:on-remove=
"handleFrameworkRemove"
:on-success=
"handleFrameworkSuccess"
:file-list=
"fileList"
>
<i
class=
"el-icon-upload"
></i>
<div
class=
"el-upload__text"
>
将文件拖到此处,或
<em>
点击上传
</em>
</div>
<div
class=
"el-upload__tip"
slot=
"tip"
>
只能上传jpg/png文件,且不超过500kb
</div>
</el-upload>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"frameworkDialog = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"addFramework"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
</template>
<
script
>
import
{
getAppsList
,
deleteApp
,
addApp
,
updateApp
,
getBuildApp
,
addFramework
}
from
"
@/api/app-store
"
;
import
{
getAppsList
,
deleteApp
,
addApp
,
updateApp
,
getBuildApp
,
addFramework
,
}
from
"
@/api/app-store
"
;
import
{
mapTrim
,
checkURL
,
download
}
from
"
@/utils/index
"
;
export
default
{
...
...
@@ -211,13 +272,13 @@ export default {
pagenum
:
1
,
},
framework
:
{
name
:
null
,
url
:
null
,
desc
:
null
,
type
:
null
,
assets
:
{
files
:
[]
}
name
:
null
,
url
:
null
,
desc
:
null
,
type
:
null
,
assets
:
{
files
:
[],
},
},
currentIndex
:
0
,
currentValue
:
null
,
...
...
@@ -225,14 +286,14 @@ export default {
dialogTitle
:
""
,
dialogVisible
:
false
,
post
:
{
sort
:
0
,
app_name
:
null
,
app_version
:
null
,
app_icon
:
null
,
app_url
:
null
,
category
:
null
,
app_desc
:
null
,
app_files
:
[],
sort
:
0
,
app_name
:
null
,
app_version
:
null
,
app_icon
:
null
,
app_url
:
null
,
category
:
null
,
app_desc
:
null
,
app_files
:
[],
},
};
},
...
...
@@ -240,6 +301,9 @@ export default {
window
:
()
=>
window
,
},
methods
:
{
clear
()
{
this
.
$refs
.
upload
.
clearFiles
();
},
fetchData
(
params
)
{
this
.
isLoading
=
true
;
getAppsList
(
params
)
...
...
@@ -256,29 +320,33 @@ export default {
});
},
handleSizeChange
(
e
)
{
this
.
form
.
pagesize
=
e
;
this
.
fetchData
(
mapTrim
(
this
.
form
));
this
.
form
.
pagesize
=
e
;
this
.
fetchData
(
mapTrim
(
this
.
form
));
},
handleCurrentChange
(
e
)
{
this
.
form
.
pagenum
=
e
;
this
.
fetchData
(
mapTrim
(
this
.
form
));
this
.
form
.
pagenum
=
e
;
this
.
fetchData
(
mapTrim
(
this
.
form
));
},
handleBuild
(
index
,
row
)
{
console
.
log
(
index
)
getBuildApp
(
row
.
uuid
).
then
(
res
=>
{
download
(
res
.
data
.
app_name
,
res
.
data
.
app_path
)
this
.
$message
.
success
(
res
.
message
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
this
.
$message
.
error
(
err
.
message
)
console
.
log
(
index
);
getBuildApp
(
row
.
uuid
)
.
then
((
res
)
=>
{
download
(
res
.
data
.
app_name
,
res
.
data
.
app_path
);
this
.
$message
.
success
(
res
.
message
);
})
.
catch
((
err
)
=>
{
console
.
log
(
err
);
this
.
$message
.
error
(
err
.
message
);
});
},
handleEdit
(
index
,
row
)
{
this
.
post
=
Object
.
assign
(
row
);
this
.
currentIndex
=
index
;
this
.
currentValue
=
row
;
this
.
dialogTitle
=
"
编辑
"
;
this
.
dialogVisible
=
true
;
this
.
post
=
Object
.
assign
(
row
);
this
.
fileList
=
[];
this
.
imageUrl
=
null
;
this
.
currentIndex
=
index
;
this
.
currentValue
=
row
;
this
.
dialogTitle
=
"
编辑
"
;
this
.
dialogVisible
=
true
;
},
handleDelete
(
index
,
row
)
{
this
.
$alert
(
...
...
@@ -306,49 +374,49 @@ export default {
);
},
handleUploadSuccess
(
res
)
{
if
(
res
.
code
==
200
)
{
if
(
!
checkURL
(
res
.
data
.
filepath
))
res
.
data
.
filepath
=
`
${
window
.
location
.
origin
}
/
${
res
.
data
.
filepath
}
`
this
.
post
.
app_files
.
push
(
res
.
data
)
}
if
(
res
.
code
==
200
)
{
if
(
!
checkURL
(
res
.
data
.
filepath
))
res
.
data
.
filepath
=
`
${
window
.
location
.
origin
}
/
${
res
.
data
.
filepath
}
`
;
this
.
post
.
app_files
.
push
(
res
.
data
);
}
},
handleAvatarSuccess
(
res
,
file
)
{
if
(
res
.
code
==
200
)
{
if
(
!
checkURL
(
res
.
data
.
filepath
))
res
.
data
.
filepath
=
`
${
window
.
location
.
origin
}
/
${
res
.
data
.
filepath
}
`
this
.
post
.
app_icon
=
res
.
data
}
this
.
imageUrl
=
URL
.
createObjectURL
(
file
.
raw
);
if
(
res
.
code
==
200
)
{
if
(
!
checkURL
(
res
.
data
.
filepath
))
res
.
data
.
filepath
=
`
${
window
.
location
.
origin
}
/
${
res
.
data
.
filepath
}
`
;
this
.
post
.
app_icon
=
res
.
data
;
}
this
.
imageUrl
=
URL
.
createObjectURL
(
file
.
raw
);
},
beforeAvatarUpload
()
{
// const isJPG = file.type === "image/jpeg";
// const isLt2M = file.size / 1024 / 1024
<
2
;
// const isJPG = file.type === "image/jpeg";
// const isLt2M = file.size / 1024 / 1024
<
2
;
// if (!isJPG) {
// this.$message.error("上传头像图片只能是 JPG 格式!");
// }
// if (!isLt2M) {
// this.$message.error("上传头像图片大小不能超过 2MB!");
// }
// return isJPG && isLt2M;
return
true
;
// if (!isJPG) {
// this.$message.error("上传头像图片只能是 JPG 格式!");
// }
// if (!isLt2M) {
// this.$message.error("上传头像图片大小不能超过 2MB!");
// }
// return isJPG && isLt2M;
return
true
;
},
handleAvatarRemove
(
file
)
{
console
.
log
(
file
);
this
.
imageUrl
=
null
;
console
.
log
(
file
);
this
.
imageUrl
=
null
;
},
handleRemove
(
file
)
{
for
(
let
i
=
0
;
i
<
this
.
post
.
app_files
.
length
;
i
++
)
{
if
(
this
.
post
.
app_files
[
i
].
uuid
==
file
.
response
.
data
.
uuid
)
{
this
.
post
.
app_files
.
splice
(
i
,
1
);
break
;
}
for
(
let
i
=
0
;
i
<
this
.
post
.
app_files
.
length
;
i
++
)
{
if
(
this
.
post
.
app_files
[
i
].
uuid
==
file
.
response
.
data
.
uuid
)
{
this
.
post
.
app_files
.
splice
(
i
,
1
);
break
;
}
console
.
log
(
file
);
}
console
.
log
(
file
);
},
handleFrameworkRemove
()
{},
handleFrameworkSuccess
(
res
)
{
this
.
framework
.
assets
.
files
.
push
(
res
.
data
)
this
.
framework
.
assets
.
files
.
push
(
res
.
data
);
},
submitForm
(
formName
)
{
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
...
...
@@ -383,15 +451,17 @@ export default {
});
},
addFramework
()
{
addFramework
(
this
.
framework
).
then
(
res
=>
{
this
.
$message
.
success
(
res
.
message
)
this
.
frameworkDialog
=
false
}).
catch
(
err
=>
{
this
.
$message
.
error
(
err
.
message
)
addFramework
(
this
.
framework
)
.
then
((
res
)
=>
{
this
.
$message
.
success
(
res
.
message
);
this
.
frameworkDialog
=
false
;
})
.
catch
((
err
)
=>
{
this
.
$message
.
error
(
err
.
message
);
});
},
onAddFramework
()
{
this
.
frameworkDialog
=
true
;
this
.
frameworkDialog
=
true
;
},
onAdd
()
{
this
.
dialogTitle
=
"
添加
"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment