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
da0ac451
Commit
da0ac451
authored
Jul 20, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix(应用编辑模块): 修复应用编辑后端接口bug
前端增加应用编辑功能
parent
35c6ad51
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
28 deletions
+58
-28
tools/build_out/controllers/app.py
tools/build_out/controllers/app.py
+5
-5
tools/build_out/models/app.py
tools/build_out/models/app.py
+14
-9
tools/build_out/views/app.py
tools/build_out/views/app.py
+3
-2
tools/frontend/src/api/openapi.js
tools/frontend/src/api/openapi.js
+9
-1
tools/frontend/src/router/index.js
tools/frontend/src/router/index.js
+1
-0
tools/frontend/src/views/Application/Form.vue
tools/frontend/src/views/Application/Form.vue
+21
-10
tools/frontend/src/views/Application/Index.vue
tools/frontend/src/views/Application/Index.vue
+5
-1
No files found.
tools/build_out/controllers/app.py
View file @
da0ac451
...
...
@@ -232,7 +232,7 @@ class AppResource(object):
return
True
,
ResponseCode
.
HTTP_SUCCESS
def
put
(
self
,
uuid
,
params
,
jwt
=
{}):
user
=
UserModel
.
query
.
filter
(
UserModel
.
id
==
params
.
get
(
'user
'
))
.
one_or_none
()
user
=
UserModel
.
query
.
filter
(
UserModel
.
uuid
==
jwt
.
get
(
'uuid
'
))
.
one_or_none
()
if
not
user
:
return
False
,
ResponseCode
.
USER_NOT_EXISTS
...
...
@@ -245,15 +245,15 @@ class AppResource(object):
# 更新文件
if
params
.
get
(
"app_files"
):
for
a
in
params
.
get
(
"app_files"
):
res
=
AnnexModel
(
app
=
app
,
title
=
a
.
get
(
"filename"
),
path
=
a
.
get
(
"filepath"
),
size
=
a
.
get
(
"filesize"
),
create_by
=
user
,
create_at
=
datetime
.
now
(),
update_by
=
user
,
update_at
=
datetime
.
now
())
res
=
AnnexModel
(
app
=
app
.
id
,
title
=
a
.
get
(
"filename"
),
path
=
a
.
get
(
"filepath"
),
size
=
a
.
get
(
"filesize"
),
create_by
=
user
.
id
,
create_at
=
datetime
.
now
(),
update_by
=
user
.
id
,
update_at
=
datetime
.
now
())
db
.
session
.
add
(
res
)
db
.
session
.
flush
()
db
.
session
.
commit
()
params
.
pop
(
"app_files"
)
# 更新icon
if
params
.
get
(
"app_icon"
):
condition
=
{
'update_by'
:
user
,
'update_at'
:
datetime
.
now
()
}
if
params
.
get
(
"app_icon"
)
and
isinstance
(
params
.
get
(
"app_icon"
),
dict
)
:
condition
=
{
'update_by'
:
user
.
id
,
'update_at'
:
datetime
.
now
()
}
if
params
.
get
(
"app_icon"
)
.
get
(
"filename"
):
condition
.
update
({
"title"
:
params
.
get
(
"app_icon"
)
.
get
(
"filename"
)})
if
params
.
get
(
"app_icon"
)
.
get
(
"filepath"
):
...
...
@@ -266,7 +266,7 @@ class AppResource(object):
for
key
,
value
in
params
.
items
():
if
value
!=
None
:
setattr
(
app
,
key
,
value
)
app
.
update_by
=
jwt
.
get
(
"id"
,
""
)
app
.
update_by
=
user
.
id
app
.
update_date
=
datetime
.
now
()
db
.
session
.
commit
()
return
True
,
ResponseCode
.
HTTP_SUCCESS
...
...
tools/build_out/models/app.py
View file @
da0ac451
...
...
@@ -113,6 +113,7 @@ class GetListAppSchema(ma.SQLAlchemySchema):
app_name
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_icon
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_version
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
algorithm
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
category
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
launcher
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_arch
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
...
...
@@ -123,7 +124,7 @@ class GetListAppSchema(ma.SQLAlchemySchema):
app_review
=
fields
.
Integer
(
required
=
False
,
nullable
=
True
)
create_at
=
fields
.
DateTime
(
required
=
False
,
nullable
=
True
)
update_at
=
fields
.
DateTime
(
required
=
False
,
nullable
=
True
)
remarks
=
fields
.
String
(
required
=
False
)
getListAppSchema
=
GetListAppSchema
()
getListAppsSchema
=
GetListAppSchema
(
many
=
True
)
...
...
@@ -153,13 +154,17 @@ class PutAppSchema(ma.SQLAlchemySchema):
unknown
=
EXCLUDE
# 未知字段默认排除
model
=
AppModel
app_name
=
ma
.
auto_field
()
app_icon
=
ma
.
auto_field
()
app_version
=
ma
.
auto_field
()
app_screen_size
=
ma
.
auto_field
()
app_arch
=
ma
.
auto_field
()
app_review
=
ma
.
auto_field
()
category
=
ma
.
auto_field
()
launcher
=
ma
.
auto_field
()
app_name
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_icon
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_version
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
category
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
launcher
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_arch
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
download_url
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_file_size
=
fields
.
Integer
(
required
=
False
,
nullable
=
True
)
app_screen_size
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
meta_data
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
app_review
=
fields
.
Integer
(
required
=
False
,
nullable
=
True
)
remarks
=
fields
.
String
(
required
=
False
,
nullable
=
True
)
putAppSchema
=
PutAppSchema
()
tools/build_out/views/app.py
View file @
da0ac451
...
...
@@ -151,14 +151,15 @@ class AppResource(Resource):
@
jwt_required
(
locations
=
[
"headers"
])
def
put
(
self
,
uuid
):
try
:
jwt
=
get_jwt_identity
()
json_payload
=
request
.
json
print
(
"========>"
,
uuid
,
json_payload
)
data
=
putAppSchema
.
load
(
json_payload
)
result
,
message
=
signalManager
.
actionPutApp
.
emit
(
uuid
,
data
)
result
,
message
=
signalManager
.
actionPutApp
.
emit
(
uuid
,
data
,
jwt
)
if
result
:
return
response_result
(
ResponseCode
.
HTTP_SUCCESS
,
data
=
result
)
return
response_result
(
message
)
except
Exception
as
e
:
traceback
.
print_exc
()
current_app
.
logger
.
error
(
e
)
return
response_result
(
ResponseCode
.
HTTP_SERVER_ERROR
)
...
...
tools/frontend/src/api/openapi.js
View file @
da0ac451
/*
* @Author: your name
* @Date: 2021-07-15 09:33:39
* @LastEditTime: 2021-07-20
01:59:15
* @LastEditTime: 2021-07-20
14:53:11
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \evm-store\tools\frontend\src\api\openapi.js
...
...
@@ -39,6 +39,14 @@ export function postLogin(params) {
});
}
export
function
updateApplication
(
uuid
,
params
)
{
return
request
({
url
:
`/api/v1/app/
${
uuid
}
`
,
method
:
"
put
"
,
data
:
params
,
});
}
export
function
postApplication
(
params
)
{
return
request
({
url
:
"
/api/v1/app
"
,
...
...
tools/frontend/src/router/index.js
View file @
da0ac451
...
...
@@ -185,6 +185,7 @@ const router = new Router({
},
{
path
:
"
/application/form
"
,
name
:
"
ApplicationForm
"
,
component
:
()
=>
import
(
"
@/views/Application/Form
"
),
},
{
...
...
tools/frontend/src/views/Application/Form.vue
View file @
da0ac451
...
...
@@ -132,8 +132,8 @@
style=
"margin-top: 24px"
:wrapperCol=
"
{ span: 10, offset: 7 }"
>
<a-button
type=
"primary"
@
click=
"onSumbit"
>
提交
</a-button>
<a-button
style=
"margin-left: 8px"
>
保存
</a-button>
<a-button
type=
"primary"
v-if=
"title == '添加'"
@
click=
"onSumbit"
>
提交
</a-button>
<a-button
style=
"margin-left: 8px"
v-else
@
click=
"updateApplication"
>
保存
</a-button>
</a-form-item>
</a-form>
</a-card>
...
...
@@ -165,15 +165,16 @@ import {
import
PageHeaderWrapper
from
"
@/components/PageHeaderWrapper
"
;
import
DescriptionItem
from
"
@/components/DescriptionItem
"
;
import
{
postApplication
}
from
"
@/api/openapi
"
;
import
{
mapTrim
}
from
"
@/utils/index
"
;
import
{
postApplication
,
updateApplication
}
from
"
@/api/openapi
"
;
export
default
{
name
:
"
Basic
Form
"
,
name
:
"
Application
Form
"
,
data
()
{
return
{
loading
:
false
,
imageUrl
:
""
,
value
:
1
,
uuid
:
null
,
title
:
"
添加
"
,
post
:
{
app_name
:
null
,
...
...
@@ -281,6 +282,13 @@ export default {
this
.
postApplication
(
formData
)
},
updateApplication
()
{
updateApplication
(
this
.
uuid
,
mapTrim
(
this
.
post
)).
then
(
res
=>
{
message
.
success
(
res
.
msg
)
}).
catch
(
err
=>
{
message
.
error
(
err
.
msg
)
})
},
postApplication
(
formData
)
{
postApplication
(
formData
).
then
(
res
=>
{
// this.fileList = [];
...
...
@@ -304,11 +312,14 @@ export default {
},
},
created
()
{
const
{
type
}
=
this
.
$route
.
query
if
(
type
&&
type
==
"
update
"
)
{
this
.
title
=
"
更新
"
}
else
{
this
.
title
=
"
添加
"
const
params
=
this
.
$route
.
params
console
.
log
(
params
)
if
(
params
.
title
)
{
this
.
title
=
params
.
title
}
if
(
params
.
record
)
{
this
.
uuid
=
params
.
record
.
uuid
this
.
post
=
params
.
record
}
},
};
...
...
tools/frontend/src/views/Application/Index.vue
View file @
da0ac451
...
...
@@ -283,6 +283,8 @@
</a-row>
</
template
>
<
template
slot=
"action"
slot-scope=
"text, record"
>
<a
href=
"javascript:;"
@
click=
"handleEdit(record)"
>
编辑应用
</a>
<a-divider
type=
"vertical"
/>
<a
href=
"javascript:;"
@
click=
"rebuildApplication(record)"
>
重新打包
</a
>
...
...
@@ -457,8 +459,10 @@ export default {
this
.
form
=
this
.
$form
.
createForm
(
this
,
{});
},
methods
:
{
handleEdit
(
record
)
{
this
.
$router
.
push
({
name
:
"
ApplicationForm
"
,
params
:
{
title
:
"
编辑
"
,
record
:
record
}
})
},
handleEditSource
(
record
)
{
console
.
log
(
record
)
this
.
$router
.
push
({
name
:
"
FileManager
"
,
params
:
{
directory
:
record
.
file_dir
,
disk
:
"
epks
"
}
})
},
updateReview
(
record
,
value
)
{
...
...
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