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 679a2cd2
authored
Jun 19, 2024
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit 图片转base64
1 parent
375b4028
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
17 deletions
api/module/systemApi.js
pages/equity/detail/detail.vue
api/module/systemApi.js
View file @
679a2cd
...
@@ -16,11 +16,12 @@ const getMockData = async (immediate = false) => {
...
@@ -16,11 +16,12 @@ const getMockData = async (immediate = false) => {
if
(
!
immediate
&&
MOCKDATA
&&
Date
.
now
()
-
MOCKDATA
.
createTime
<
5
*
60
e3
)
{
if
(
!
immediate
&&
MOCKDATA
&&
Date
.
now
()
-
MOCKDATA
.
createTime
<
5
*
60
e3
)
{
return
Promise
.
resolve
(
MOCKDATA
);
return
Promise
.
resolve
(
MOCKDATA
);
}
else
{
}
else
{
if
(
!
serverConfig
.
mockRequestCount
)
{
if
(
!
serverConfig
.
mockRequestCount
||
immediate
)
{
serverConfig
.
mockCache
=
null
;
serverConfig
.
mockCache
=
null
;
serverConfig
.
mockRequestCount
=
Date
.
now
();
serverConfig
.
mockRequestCount
=
Date
.
now
();
const
data
=
await
http
.
uni_request
({
url
:
configUrl
});
const
data
=
await
http
.
uni_request
({
url
:
configUrl
});
data
.
createTime
=
Date
.
now
();
data
.
createTime
=
Date
.
now
();
data
.
moduleList
=
await
imgToBase64
(
data
.
moduleList
,
'thumbnail'
)
serverConfig
.
mockCache
=
data
;
serverConfig
.
mockCache
=
data
;
uni
.
$storage
.
set
(
"mock_data"
,
data
);
uni
.
$storage
.
set
(
"mock_data"
,
data
);
return
Promise
.
resolve
(
data
);
return
Promise
.
resolve
(
data
);
...
@@ -38,19 +39,40 @@ const getMockData = async (immediate = false) => {
...
@@ -38,19 +39,40 @@ const getMockData = async (immediate = false) => {
}
}
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
if
(
serverConfig
.
mockTimer
[
key
])
clearInterval
(
serverConfig
.
mockTimer
[
key
]);
if
(
serverConfig
.
mockTimer
[
key
])
clearInterval
(
serverConfig
.
mockTimer
[
key
]);
serverConfig
.
mockRequestCount
=
null
;
serverConfig
.
mockRequestCount
=
null
;
return
Promise
.
reject
(
error
);
return
Promise
.
reject
(
error
);
}
}
};
};
const
imgToBase64
=
(
list
,
urlKey
=
'url'
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
arr
=
[]
list
.
map
(
e
=>
{
uni
.
request
({
url
:
e
[
urlKey
],
method
:
'GET'
,
responseType
:
'arraybuffer'
,
success
:
(
res
)
=>
{
const
base64
=
`data:image/png;base64,
${
uni
.
arrayBufferToBase64
(
res
.
data
)}
`
e
[
urlKey
]
=
base64
arr
.
push
(
e
)
if
(
arr
.
length
===
list
.
length
)
resolve
(
list
)
},
fail
:
(
err
)
=>
{
reject
(
err
)
}
})
})
})
};
// 图片版本号
// 图片版本号
const
getImageVersion
=
async
()
=>
{
const
getImageVersion
=
async
()
=>
{
const
accountInfo
=
await
getMockData
()
const
accountInfo
=
await
getMockData
()
return
accountInfo
?.
version
||
Date
.
now
()
return
accountInfo
?.
version
||
Date
.
now
()
}
}
module
.
exports
=
{
module
.
exports
=
{
getImageVersion
,
getImageVersion
,
getMockData
getMockData
}
}
\ No newline at end of file
\ No newline at end of file
pages/equity/detail/detail.vue
View file @
679a2cd
...
@@ -28,14 +28,13 @@
...
@@ -28,14 +28,13 @@
:key="index"
:key="index"
>
>
<component
<component
:is=
"
componentName(item.id)
"
:is=
"
item.componentName
"
:views=
"item.receptionSourceDetailList || []"
:views=
"item.receptionSourceDetailList || []"
:penSwitch=
"penSwitch"
:penSwitch=
"penSwitch"
:show=
"id == item.id"
:show=
"id == item.id"
:ref=
"'media'+item.id"
:ref=
"'media'+item.id"
:title=
"item.detailTitle || ''"
:title=
"item.detailTitle || ''"
:madiaId=
"item.id"
:madiaId=
"item.id"
:defaultIndex=
"item.id == 4 ? 1 : 0"
/>
/>
</view>
</view>
</
template
>
</
template
>
...
@@ -126,16 +125,6 @@ export default {
...
@@ -126,16 +125,6 @@ export default {
},
},
methods
:
{
methods
:
{
...
mapMutations
(
"audio"
,
[
"setReceptionStatus"
]),
...
mapMutations
(
"audio"
,
[
"setReceptionStatus"
]),
componentName
(
id
)
{
let
name
=
""
;
if
(
id
!=
1
&&
id
!=
6
)
name
=
"media-component"
;
else
name
=
{
1
:
"reception"
,
6
:
"media_6"
,
}[
id
]
return
name
;
},
open
()
{
open
()
{
this
.
$refs
.
stepRef
.
open
()
this
.
$refs
.
stepRef
.
open
()
},
},
...
...
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