Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e35a899c
authored
Jun 20, 2024
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit 图片转base64
1 parent
a365cb4f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
6 deletions
api/module/systemApi.js
components/Canvas/zoom-pan.vue
pages/equity/index.vue
api/module/systemApi.js
View file @
e35a899
...
@@ -45,17 +45,18 @@ const getMockData = async (immediate = false) => {
...
@@ -45,17 +45,18 @@ const getMockData = async (immediate = false) => {
return
Promise
.
reject
(
error
);
return
Promise
.
reject
(
error
);
}
}
};
};
const
imgToBase64
=
(
list
,
urlKey
=
'url'
)
=>
{
const
imgToBase64
=
(
list
,
urlKey
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
arr
=
[]
let
arr
=
[]
list
.
map
(
e
=>
{
list
.
map
(
e
=>
{
uni
.
request
({
uni
.
request
({
url
:
e
[
urlKey
]
,
url
:
urlKey
?
e
[
urlKey
]
:
e
,
method
:
'GET'
,
method
:
'GET'
,
responseType
:
'arraybuffer'
,
responseType
:
'arraybuffer'
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
const
base64
=
`data:image/png;base64,
${
uni
.
arrayBufferToBase64
(
res
.
data
)}
`
const
base64
=
`data:image/png;base64,
${
uni
.
arrayBufferToBase64
(
res
.
data
)}
`
e
[
urlKey
]
=
base64
if
(
urlKey
)
e
[
urlKey
]
=
base64
else
e
=
base64
arr
.
push
(
e
)
arr
.
push
(
e
)
if
(
arr
.
length
===
list
.
length
)
resolve
(
list
)
if
(
arr
.
length
===
list
.
length
)
resolve
(
list
)
},
},
...
@@ -66,6 +67,13 @@ const imgToBase64 = (list, urlKey = 'url') => {
...
@@ -66,6 +67,13 @@ const imgToBase64 = (list, urlKey = 'url') => {
})
})
})
})
};
};
const
updateMockData
=
(
data
,
key
)
=>
{
const
mockData
=
uni
.
$storage
.
get
(
'mock_data'
)
mockData
[
key
]
=
data
setTimeout
(()
=>
{
uni
.
$storage
.
set
(
"mock_data"
,
mockData
)
},
1
e3
)
}
// 图片版本号
// 图片版本号
const
getImageVersion
=
async
()
=>
{
const
getImageVersion
=
async
()
=>
{
const
accountInfo
=
await
getMockData
()
const
accountInfo
=
await
getMockData
()
...
@@ -74,5 +82,7 @@ const getImageVersion = async () => {
...
@@ -74,5 +82,7 @@ const getImageVersion = async () => {
module
.
exports
=
{
module
.
exports
=
{
getImageVersion
,
getImageVersion
,
getMockData
getMockData
,
imgToBase64
,
updateMockData
}
}
\ No newline at end of file
\ No newline at end of file
components/Canvas/zoom-pan.vue
View file @
e35a899
...
@@ -56,7 +56,6 @@ export default {
...
@@ -56,7 +56,6 @@ export default {
this
.
lastScale
=
1
this
.
lastScale
=
1
this
.
scale
=
1
this
.
scale
=
1
this
.
transformStyle
=
`scale(1) translate(0px, 0px)`
this
.
transformStyle
=
`scale(1) translate(0px, 0px)`
console
.
log
(
this
.
transformStyle
)
}
}
},
},
computed
:
{
computed
:
{
...
...
pages/equity/index.vue
View file @
e35a899
...
@@ -120,9 +120,14 @@ export default {
...
@@ -120,9 +120,14 @@ export default {
},
},
// 查询素材
// 查询素材
async
getSoure
()
{
async
getSoure
()
{
let
{
moduleList
,
toolList
}
=
await
uni
.
$api
.
systemApi
.
getMockData
(
true
);
let
{
moduleList
,
toolList
}
=
await
uni
.
$api
.
systemApi
.
getMockData
();
moduleList
.
map
(
async
e
=>
{
if
(
e
.
receptionSourceDetailList
)
e
.
receptionSourceDetailList
=
await
uni
.
$api
.
systemApi
.
imgToBase64
(
e
.
receptionSourceDetailList
,
'detailUrl'
)
if
(
e
.
carTypeList
)
e
.
carTypeList
=
await
uni
.
$api
.
systemApi
.
imgToBase64
(
e
.
carTypeList
)
})
this
.
moduleList
=
moduleList
this
.
moduleList
=
moduleList
this
.
toolList
=
toolList
this
.
toolList
=
toolList
uni
.
$api
.
systemApi
.
updateMockData
(
moduleList
,
'moduleList'
)
},
},
errorImg
(
index
)
{
errorImg
(
index
)
{
this
.
moduleList
[
index
].
showAlt
=
true
this
.
moduleList
[
index
].
showAlt
=
true
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment