Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
ReactWeb5
CivManage
Commits
2f35fec8
Commit
2f35fec8
authored
Nov 04, 2024
by
彭俊龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交apk上传读取版本信息
parent
36469bf1
Pipeline
#93610
passed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
150 additions
and
108 deletions
+150
-108
index.js
.../productCenter/mobileConfig/menuconfig/ApkUpload/index.js
+148
-108
api.js
src/services/mobileConfig/api.js
+2
-0
No files found.
src/pages/productCenter/mobileConfig/menuconfig/ApkUpload/index.js
View file @
2f35fec8
import
React
,
{
useEffect
,
useMemo
,
useState
}
from
'react'
;
import
styles
from
'./index.less'
;
import
{
Form
,
Table
,
Input
,
message
,
Button
,
Upload
,
Tooltip
}
from
'antd'
;
import
{
getAppUploadRecords
,
postAppVersionInfo
}
from
'@/services/mobileConfig/api'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
Form
,
Table
,
Input
,
message
,
Button
,
Upload
,
Tooltip
,
Space
}
from
'antd'
;
import
{
getAppUploadRecords
,
postAppVersionInfo
,
getApkVerionInfo
,
}
from
'@/services/mobileConfig/api'
;
import
{
UploadOutlined
,
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
{
request
}
from
'@wisdom-utils/utils/es'
;
const
ApkUpload
=
props
=>
{
const
[
loadding
,
setLoadding
]
=
useState
(
false
);
...
...
@@ -34,31 +38,36 @@ const ApkUpload = props => {
title
:
'发版日志'
,
dataIndex
:
'UploadLog'
,
key
:
'UploadLog'
,
render
:
(
text
,
recore
,
index
)
=>
<
Tooltip
title
=
{
text
}
>
<
div
style
=
{{
width
:
'150px'
,
whiteSpace
:
'nowrap'
,
/* 不换行 */
overflow
:
'hidden'
,
/* 超出部分隐藏 */
textOverflow
:
'ellipsis'
/* 显示省略号 */
}}
>
{
text
}
<
/div
>
<
/Tooltip
>
render
:
(
text
,
recore
,
index
)
=>
(
<
Tooltip
title
=
{
text
}
>
<
div
style
=
{{
width
:
'150px'
,
whiteSpace
:
'nowrap'
/* 不换行 */
,
overflow
:
'hidden'
/* 超出部分隐藏 */
,
textOverflow
:
'ellipsis'
/* 显示省略号 */
,
}}
>
{
text
}
<
/div
>
<
/Tooltip
>
),
},
{
title
:
'下载'
,
key
:
'DownUrl'
,
dataIndex
:
'DownUrl'
,
render
:
(
text
,
record
,
index
)
=>
<
UploadOutlined
onClick
=
{()
=>
window
.
open
(
`
${
window
.
origin
}${
text
}
`
,
'_self'
)
}
/
>
render
:
(
text
,
record
,
index
)
=>
(
<
UploadOutlined
onClick
=
{()
=>
window
.
open
(
`
${
window
.
origin
}${
text
}
`
,
'_self'
)}
/
>
),
},
];
const
[
form
]
=
Form
.
useForm
();
useEffect
(()
=>
{
useEffect
(()
=>
{
getRecords
();
//getAppUploadRecords().then(x=> console.log(x, '上传记录'))
},
[])
},
[])
;
const
normFile
=
e
=>
{
if
(
Array
.
isArray
(
e
))
{
return
e
;
...
...
@@ -66,12 +75,30 @@ const ApkUpload = props => {
return
e
?.
fileList
;
};
const
getVerionInfo
=
filePath
=>
{
getApkVerionInfo
({
apkPath
:
filePath
,
})
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
)
{
form
.
setFieldsValue
({
Ver
:
'V'
+
res
.
data
?.
versionName
,
});
}
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
};
const
getRecords
=
async
()
=>
{
const
res
=
await
getAppUploadRecords
();
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
setDataSource
(
res
.
data
||
[]);
}
}
}
;
const
postAPPUploadInfo
=
async
()
=>
{
await
form
.
validateFields
();
...
...
@@ -81,103 +108,116 @@ const ApkUpload = props => {
return
;
}
setLoadding
(
true
);
postAppVersionInfo
(
formData
).
then
(
res
=>
{
if
(
res
.
code
===
0
){
message
.
success
(
'新版本提交成功!'
);
getRecords
();
form
.
resetFields
()
}
else
{
message
.
error
(
res
.
msg
)
}
}).
catch
(
err
=>
{
console
.
log
(
err
,
'提交失败'
)
});
postAppVersionInfo
(
formData
)
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
message
.
success
(
'新版本提交成功!'
);
getRecords
();
form
.
resetFields
();
}
else
{
message
.
error
(
res
.
msg
);
}
})
.
catch
(
err
=>
{
console
.
log
(
err
,
'提交失败'
);
});
setLoadding
(
false
);
};
return
(
<
div
style
=
{{
display
:
'flex'
,
width
:
'100%'
}}
>
<
Form
style
=
{{
width
:
'50%'
}}
{...
layout
}
initialValues
=
{{
DownUrl
:
''
,
ApkName
:
'水务掌天下'
<
div
style
=
{{
display
:
'flex'
,
width
:
'100%'
,
}}
form
=
{
form
}
name
=
"control-hooks"
onFinish
=
{
valus
=>
console
.
log
(
valus
,
'表单完成信息'
)}
>
<
Form
.
Item
name
=
"ApkName"
label
=
"应用名称"
rules
=
{[{
required
:
true
}]}
>
<
Input
placeholder
=
"请输入应用名称"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"Ver"
label
=
"发布版本号"
rules
=
{[{
required
:
true
}]}
>
<
Input
placeholder
=
"请输入发布版本号"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"UploadLog"
label
=
"发版说明"
rules
=
{[{
required
:
true
}]}
>
<
TextArea
rows
=
{
6
}
placeholder
=
"请输入发版说明"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"DownUrl"
style
=
{{
display
:
'none'
}}
/
>
<
Form
.
Item
name
=
"UploadFile"
label
=
"上传APK"
rules
=
{[{
required
:
true
}]}
valuePropName
=
"fileList"
getValueFromEvent
=
{
normFile
}
<
Form
style
=
{{
width
:
'50%'
,
}}
{...
layout
}
initialValues
=
{{
DownUrl
:
''
,
ApkName
:
'水务掌天下'
,
}}
form
=
{
form
}
name
=
"control-hooks"
onFinish
=
{
valus
=>
console
.
log
(
valus
,
'表单完成信息'
)}
>
<
Upload
maxCount
=
{
1
}
onChange
=
{
baseFile
=>
{
const
file
=
baseFile
.
file
;
let
sourcePath
=
''
;
if
(
file
.
status
===
'done'
&&
file
.
response
.
code
===
0
)
{
sourcePath
=
`/PandaOMS/OMS/FileCenter/DownLoadFiles?filepath=
${
file
.
response
.
data
}
`
;
message
.
success
(
'上传成功!'
);
}
else
if
(
file
.
status
===
'done'
&&
file
.
response
.
code
!==
0
)
{
message
.
error
(
'上传失败:'
+
file
.
response
.
msg
);
}
form
.
setFieldsValue
({
DownUrl
:
sourcePath
,
});
console
.
log
(
file
,
'上传图片'
);
}}
name
=
"file"
a
action
=
{
`
${
window
.
origin
}
/PandaOMS/OMS/FileCenter/UploadApk`
}
accept
=
".apk"
>
<
Button
icon
=
{
<
UploadOutlined
/>
}
>
上传
APK
<
/Button
>
<
/Upload
>
<
/Form.Item
>
<
Form
.
Item
{...
tailLayout
}
>
<
Button
loading
=
{
loadding
}
type
=
"primary"
onClick
=
{()
=>
{
console
.
log
(
form
.
getFieldsValue
(),
'表单完成信息'
);
postAPPUploadInfo
();
}}
<
Form
.
Item
name
=
"ApkName"
label
=
"应用名称"
rules
=
{[{
required
:
true
}]}
>
<
Input
placeholder
=
"请输入应用名称"
/>
<
/Form.Item
>
<
Form
.
Item
label
=
"发布版本号"
>
<
Space
>
<
Form
.
Item
name
=
"Ver"
noStyle
rules
=
{[{
required
:
true
,
message
:
'请输入版本号'
}]}
>
<
Input
placeholder
=
"请输入发布版本号"
/>
<
/Form.Item
>
<
Tooltip
title
=
"版本号通过上传Apk获取或者手动填写"
>
<
QuestionCircleOutlined
/>
<
/Tooltip
>
<
/Space
>
<
/Form.Item
>
<
Form
.
Item
name
=
"UploadLog"
label
=
"发版说明"
rules
=
{[{
required
:
true
}]}
>
<
TextArea
rows
=
{
6
}
placeholder
=
"请输入发版说明"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"DownUrl"
style
=
{{
display
:
'none'
}}
/
>
<
Form
.
Item
name
=
"UploadFile"
label
=
"上传APK"
rules
=
{[{
required
:
true
}]}
valuePropName
=
"fileList"
getValueFromEvent
=
{
normFile
}
>
提交
<
/Button
>
<
/Form.Item
>
<
/Form
>
<
Table
style
=
{{
width
:
'50%'
}}
columns
=
{
columns
}
pagination
=
{{
pageSize
:
10
}}
dataSource
=
{
dataSource
}
/
>
<
Upload
maxCount
=
{
1
}
onChange
=
{
async
baseFile
=>
{
const
file
=
baseFile
.
file
;
let
sourcePath
=
''
;
if
(
file
.
status
===
'done'
&&
file
.
response
.
code
===
0
)
{
sourcePath
=
`/PandaOMS/OMS/FileCenter/DownLoadFiles?filepath=
${
file
.
response
.
data
}
`
;
getVerionInfo
(
file
.
response
.
data
);
message
.
success
(
'上传成功!'
);
}
else
if
(
file
.
status
===
'done'
&&
file
.
response
.
code
!==
0
)
{
message
.
error
(
'上传失败:'
+
file
.
response
.
msg
);
}
form
.
setFieldsValue
({
DownUrl
:
sourcePath
,
});
console
.
log
(
file
,
'上传图片'
);
}}
name
=
"file"
a
action
=
{
`
${
window
.
origin
}
/PandaOMS/OMS/FileCenter/UploadApk`
}
accept
=
".apk"
>
<
Button
icon
=
{
<
UploadOutlined
/>
}
>
上传
APK
<
/Button
>
<
/Upload
>
<
/Form.Item
>
<
Form
.
Item
{...
tailLayout
}
>
<
Button
loading
=
{
loadding
}
type
=
"primary"
onClick
=
{()
=>
{
console
.
log
(
form
.
getFieldsValue
(),
'表单完成信息'
);
postAPPUploadInfo
();
}}
>
提交
<
/Button
>
<
/Form.Item
>
<
/Form
>
<
Table
style
=
{{
width
:
'50%'
,
}}
columns
=
{
columns
}
pagination
=
{{
pageSize
:
10
,
}}
dataSource
=
{
dataSource
}
/
>
<
/div
>
);
};
export
default
ApkUpload
;
src/services/mobileConfig/api.js
View file @
2f35fec8
...
...
@@ -124,3 +124,5 @@ export const upgradeCardVersion = parmas => post(`${PUBLISH_SERVICE}/WebSite/App
export
const
postAppVersionInfo
=
parmas
=>
post
(
`
${
PUBLISH_SERVICE
}
/Mobile/PostAppVersionInfo`
,
parmas
);
export
const
getAppUploadRecords
=
parmas
=>
get
(
`
${
PUBLISH_SERVICE
}
/Mobile/GetAppUploadRecords`
,
parmas
);
export
const
getApkVerionInfo
=
parmas
=>
get
(
`
${
PUBLISH_SERVICE
}
/FileCenter/GetApkVerionInfo`
,
parmas
);
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