Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mocp-uniapp
Overview
Overview
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
pangchong
mocp-uniapp
Commits
e111a694
Commit
e111a694
authored
May 24, 2024
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化
parent
dfa7f786
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
24 deletions
+6
-24
src/components/global-upload/global-upload.vue
+2
-22
src/manifest.json
+3
-1
src/pages/panel/appraisal-record/details.vue
+1
-1
No files found.
src/components/global-upload/global-upload.vue
View file @
e111a694
...
...
@@ -75,16 +75,8 @@ const afterRead = async (event) => {
})
})
for
(
let
i
=
0
;
i
<
lists
.
length
;
i
++
)
{
const
arrayBuffer
=
new
Uint8Array
(
lists
[
i
].
url
)
//先将本地图片路径转换成array类型
const
binary
=
arrayBufferToBinary
(
arrayBuffer
)
// const binary = uni.getFileSystemManager().readFileSync(lists[i].url, 'binary')
// const imgBlob = await fetch(lists[i].url).then((r) => r.blob())
// const imgFile = new File([imgBlob], lists[i].name, { type: imgBlob.type })
// let form = new FormData()
// form.append('file', imgFile)
try
{
const
res
=
await
uploadFilePromise
(
lists
[
i
].
url
,
binary
)
const
res
=
await
uploadFilePromise
(
lists
[
i
].
url
)
if
(
res
.
code
==
200
)
{
fileList
.
value
.
splice
(
fileListLen
,
1
,
{
...
res
.
data
,
...
...
@@ -103,14 +95,6 @@ const afterRead = async (event) => {
}
}
function
arrayBufferToBinary
(
buffer
)
{
// 创建一个二进制编码器
const
encoder
=
new
TextEncoder
()
// 将ArrayBuffer视为UTF-8字符串的字节序列
const
view
=
new
Uint8Array
(
buffer
)
// 使用二进制编码器将字节序列转换为字符串
return
encoder
.
encode
(
new
Uint8Array
(
buffer
)).
toString
()
}
watch
(
fileList
,
(
value
)
=>
{
...
...
@@ -130,16 +114,12 @@ watch(
},
{
deep
:
true
}
)
const
uploadFilePromise
=
(
url
,
binary
)
=>
{
const
uploadFilePromise
=
(
url
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
uploadFile
({
url
:
ps
.
url
,
name
:
'file'
,
filePath
:
url
,
file
:
binary
,
formData
:
{
file
:
binary
},
success
:
(
res
)
=>
{
resolve
(
JSON
.
parse
(
res
.
data
))
},
...
...
src/manifest.json
View file @
e111a694
...
...
@@ -17,7 +17,9 @@
"delay"
:
0
},
/*
模块配置
*/
"modules"
:
{},
"modules"
:
{
"Camera"
:
{}
},
/*
应用发布信息
*/
"distribute"
:
{
/*
android打包配置
*/
...
...
src/pages/panel/appraisal-record/details.vue
View file @
e111a694
...
...
@@ -80,7 +80,7 @@
</card-details>
<card-details
type=
"appeal"
title=
"申诉状态"
titleIcon=
"email"
>
<view
class=
"appeal-status"
>
{{ useGetDictByValue('appealInfo', details.appealInfo) }}
</view>
<image
:src=
"item.fileUrl"
v-for=
"(item, index) in getFileList"
:key=
"item.id"
@
tap=
"previewImage(index)"
/>
<image
:src=
"item.fileUrl"
v-for=
"(item, index) in getFileList"
:key=
"item.id"
@
tap=
"previewImage(index)"
mode=
"widthFix"
/>
</card-details>
</view>
</global-page>
...
...
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