Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
dj-scrm-wx-work-attachment-psd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c645bc0a
authored
Dec 28, 2022
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
bug修复
1 parent
cc0e3171
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
40 deletions
src/assets/css/sprite.scss
src/components/Psd.vue
src/mixins/shareMixin.js
src/utils/util.js
src/views/psd/detail.vue
src/assets/css/sprite.scss
View file @
c645bc0
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
.icon-down
{
width
:
12px
;
height
:
12px
;
background-position
:
-26px
-74px
;}
.icon-down
{
width
:
12px
;
height
:
12px
;
background-position
:
-26px
-74px
;}
.icon-eye
{
width
:
13px
;
height
:
8px
;
background-position
:
-48px
-74px
;}
.icon-eye
{
width
:
13px
;
height
:
8px
;
background-position
:
-48px
-74px
;}
.icon-gift-del
{
width
:
18px
;
height
:
18px
;
background-position
:
-84px
-30px
;}
.icon-gift-del
{
width
:
18px
;
height
:
18px
;
background-position
:
-84px
-30px
;}
.icon-grctx
{
width
:
16px
;
height
:
16px
;
background-position
:
0px
-74px
;}
.icon-link
{
width
:
32px
;
height
:
32px
;
background-position
:
-42px
0px
;}
.icon-link
{
width
:
32px
;
height
:
32px
;
background-position
:
-42px
0px
;}
.icon-menu-active
{
width
:
22px
;
height
:
20px
;
background-position
:
0px
-44px
;}
.icon-menu-active
{
width
:
22px
;
height
:
20px
;
background-position
:
0px
-44px
;}
.icon-menu
{
width
:
22px
;
height
:
20px
;
background-position
:
-32px
-44px
;}
.icon-menu
{
width
:
22px
;
height
:
20px
;
background-position
:
-32px
-44px
;}
.icon-pdf
{
width
:
32px
;
height
:
34px
;
background-position
:
0px
0px
;}
.icon-pdf
{
width
:
32px
;
height
:
34px
;
background-position
:
0px
0px
;}
.icon-PYQ
{
width
:
21px
;
height
:
20px
;
background-position
:
-84px
0px
;}
.icon-PYQ
{
width
:
21px
;
height
:
20px
;
background-position
:
-84px
0px
;}
.icon-send
{
width
:
10px
;
height
:
10px
;
background-position
:
-64px
-44px
;}
.icon-send
{
width
:
10px
;
height
:
10px
;
background-position
:
-64px
-44px
;}
\ No newline at end of file
\ No newline at end of file
.icon-grctx
{
width
:
16px
;
height
:
16px
;
background-position
:
0px
-74px
;}
\ No newline at end of file
\ No newline at end of file
src/components/Psd.vue
View file @
c645bc0
...
@@ -55,7 +55,7 @@ export default {
...
@@ -55,7 +55,7 @@ export default {
goDetailPage
(
i
){
goDetailPage
(
i
){
this
.
$router
.
push
({
this
.
$router
.
push
({
path
:
'/psd/detail'
,
path
:
'/psd/detail'
,
query
:
{
id
:
i
.
id
}
query
:
{
id
:
i
.
id
,
name
:
i
.
materialName
}
})
})
}
}
}
}
...
...
src/mixins/shareMixin.js
View file @
c645bc0
...
@@ -22,13 +22,15 @@ export default {
...
@@ -22,13 +22,15 @@ export default {
shareToExternalMoments
(
i
)
{
shareToExternalMoments
(
i
)
{
this
.
sendMessage
(
i
,
true
)
this
.
sendMessage
(
i
,
true
)
},
},
sendMessage
(
i
,
isPyq
)
{
async
sendMessage
(
i
,
isPyq
)
{
const
{
shopmall_appid
,
envVersion
}
=
window
.
$fetchConfig
const
{
shopmall_appid
,
envVersion
}
=
window
.
$fetchConfig
const
path
=
'pages/psdView/psdView'
const
path
=
'pages/psdView/psdView'
const
{
merchantId
,
uuid
,
sapCode
}
=
this
.
getLocalStorage
(
'dj_scrm_userInfo'
)
const
{
merchantId
,
uuid
,
sapCode
,
userName
}
=
this
.
getLocalStorage
(
'dj_scrm_userInfo'
)
const
{
entry
}
=
this
const
{
entry
}
=
this
const
{
materialName
,
id
,
titleUrl
,
materialTitle
,
description
}
=
i
const
{
materialName
,
id
,
titleUrl
,
materialTitle
,
description
,
videoUrl
,
imageUrlList
}
=
i
let
fisrtFrame
=
videoUrl
&&
await
this
.
getVideoFirstFrame
(
videoUrl
)
const
imgUrl
=
'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/test/test.jpg'
const
imgUrl
=
'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/test/test.jpg'
let
frameUrl
=
(
imageUrlList
&&
imageUrlList
.
length
)
?
imageUrlList
[
0
]
:
(
videoUrl
&&
fisrtFrame
&&
fisrtFrame
.
dataURL
)
?
fisrtFrame
.
dataURL
:
imgUrl
let
query
=
`merchantId=
${
merchantId
}
&id=
${
id
}
&staffUuid=
${
uuid
}
&shareTime=
${
Date
.
now
()}
`
let
query
=
`merchantId=
${
merchantId
}
&id=
${
id
}
&staffUuid=
${
uuid
}
&shareTime=
${
Date
.
now
()}
`
if
(
sapCode
)
query
=
`
${
query
}
&storeCode=
${
sapCode
}
`
if
(
sapCode
)
query
=
`
${
query
}
&storeCode=
${
sapCode
}
`
...
@@ -46,8 +48,8 @@ export default {
...
@@ -46,8 +48,8 @@ export default {
{
{
msgtype
:
'link'
,
// 消息类型,必填
msgtype
:
'link'
,
// 消息类型,必填
link
:
{
link
:
{
title
:
materialTitle
||
materialName
,
// H5消息标题
title
:
materialTitle
||
`「
${
userName
}
」邀请您查看「
${
materialName
}
」`
,
// H5消息标题
imgUrl
:
titleUrl
||
img
Url
,
// H5消息封面图片URL
imgUrl
:
titleUrl
||
frame
Url
,
// H5消息封面图片URL
url
:
link
// H5消息页面url 必填
url
:
link
// H5消息页面url 必填
},
},
}
}
...
@@ -62,9 +64,9 @@ export default {
...
@@ -62,9 +64,9 @@ export default {
}
else
{
}
else
{
let
params
=
{
let
params
=
{
link
,
link
,
title
:
materialTitle
||
materialName
,
title
:
materialTitle
||
`「
${
userName
}
」邀请您查看「
${
materialName
}
」`
,
desc
:
description
||
''
,
desc
:
description
||
''
,
imgUrl
:
titleUrl
||
img
Url
imgUrl
:
titleUrl
||
frame
Url
}
}
// if (entry != 'normal') this.sendChatMessage(params, { id, merchantId, uuid })
// if (entry != 'normal') this.sendChatMessage(params, { id, merchantId, uuid })
// else this.shareAppMessage(params, { id, merchantId, uuid })
// else this.shareAppMessage(params, { id, merchantId, uuid })
...
...
src/utils/util.js
View file @
c645bc0
...
@@ -165,7 +165,43 @@ const watchPageBack = () => {
...
@@ -165,7 +165,43 @@ const watchPageBack = () => {
const
centsToyuan
=
price
=>
{
const
centsToyuan
=
price
=>
{
return
decimal
(
price
/
100
,
2
).
toFixed
(
2
)
return
decimal
(
price
/
100
,
2
).
toFixed
(
2
)
}
}
const
getVideoFirstFrame
=
(
url
)
=>
{
return
new
Promise
(
function
(
resolve
)
{
let
dataURL
=
''
let
video
=
document
.
createElement
(
"video"
)
video
.
setAttribute
(
'crossOrigin'
,
'anonymous'
)
//处理跨域
video
.
setAttribute
(
'src'
,
url
)
video
.
setAttribute
(
'autoplay'
,
'autoplay'
)
video
.
addEventListener
(
'canplaythrough'
,
function
()
{
video
.
setAttribute
(
'width'
,
video
.
videoWidth
)
video
.
setAttribute
(
'height'
,
video
.
videoHeight
)
let
canvas
=
document
.
createElement
(
"canvas"
),
width
=
video
.
width
,
//canvas的尺寸和图片一样
height
=
video
.
height
canvas
.
width
=
width
canvas
.
height
=
height
canvas
.
getContext
(
"2d"
).
drawImage
(
video
,
0
,
0
,
width
,
height
)
//绘制canvas
dataURL
=
canvas
.
toDataURL
(
'image/jpeg'
)
//转换为base64
//转换成file
const
arr
=
dataURL
.
split
(
","
)
const
mime
=
arr
[
0
].
match
(
/:
(
.*
?)
;/
)[
1
]
const
bstr
=
window
.
atob
(
arr
[
1
])
let
n
=
bstr
.
length
const
u8arr
=
new
Uint8Array
(
n
)
while
(
n
--
)
{
u8arr
[
n
]
=
bstr
.
charCodeAt
(
n
)
}
const
FILE
=
new
File
([
u8arr
],
'cover'
+
Date
.
now
()
+
'.jpeg'
,
{
type
:
mime
})
resolve
({
dataURL
,
//预览路径
file
:
FILE
,
//上传的文件
})
})
})
}
const
utils
=
{
const
utils
=
{
getVideoFirstFrame
,
removeLocalStorage
,
removeLocalStorage
,
setClipboardData
,
setClipboardData
,
jumpChildrenPage
,
jumpChildrenPage
,
...
...
src/views/psd/detail.vue
View file @
c645bc0
<
template
>
<
template
>
<div
class=
"layout"
>
<div
class=
"layout"
v-if=
"loaded"
>
<div>
<div>
<template
v-if=
"fileList && fileList.length"
>
<template
v-if=
"(info.imageUrlList && info.imageUrlList.length) || info.videoUrl"
>
<van-swipe
@
change=
"changeSwiper"
:autoplay=
"autoplay"
height=
"210"
show-indicators
>
<van-swipe
@
change=
"changeSwiper"
height=
"210"
show-indicators
>
<van-swipe-item
v-for=
"(item, index) in fileList"
:key=
"index"
>
<van-swipe-item
v-if=
"info.videoUrl"
>
<video
id=
"swiper_video"
v-if=
"item.type == 'video'"
controls
controlslist=
"nodownload"
disablepictureinpicture
playsinline=
"true"
:src=
"item.url"
></video>
<video
id=
"swiper_video"
:autoplay=
"autoplay"
:poster=
"poster"
controls
controlslist=
"nodownload"
disablepictureinpicture
playsinline=
"true"
:src=
"info.videoUrl"
></video>
<van-image
width=
"100%"
height=
"100%"
fit=
"contain"
v-if=
"item.type == 'image'"
:src=
"item.url"
/>
</van-swipe-item>
<van-swipe-item
v-for=
"(item, index) in info.imageUrlList"
:key=
"index"
>
<van-image
width=
"100%"
height=
"100%"
fit=
"cover"
:src=
"item"
/>
</van-swipe-item>
</van-swipe-item>
<template
#
indicator
>
<template
#
indicator
>
<div
class=
"custom-indicator"
>
{{
curIdx
+
1
}}
/
{{
file
List
?
fileList
.
length
:
0
}}
</div>
<div
class=
"custom-indicator"
>
{{
curIdx
+
1
}}
/
{{
file
Num
}}
</div>
</
template
>
</
template
>
</van-swipe>
</van-swipe>
</template>
</template>
...
@@ -43,18 +45,53 @@ export default {
...
@@ -43,18 +45,53 @@ export default {
fileList
:
[],
fileList
:
[],
autoplay
:
3000
,
autoplay
:
3000
,
materialUrl
:
''
,
materialUrl
:
''
,
info
:
{}
info
:
{},
fileNum
:
0
,
loaded
:
false
,
poster
:
''
}
}
},
},
beforeRouteEnter
(
to
,
from
,
next
)
{
let
{
query
}
=
to
document
.
title
=
query
.
name
||
'详情'
next
()
},
created
()
{
created
()
{
const
{
id
}
=
this
.
getQuery
()
const
{
id
}
=
this
.
getQuery
()
// let id = 148
// let id = 148
this
.
getDetail
(
id
)
this
.
getDetail
(
id
)
},
},
mounted
()
{
mounted
()
{
if
(
!
this
.
info
.
videoUrl
)
return
},
methods
:
{
changeSwiper
(
idx
)
{
this
.
curIdx
=
idx
},
getDetail
(
id
)
{
marketingApi
.
getTextDetail
({
id
,
flag
:
0
}).
then
(
data
=>
{
if
(
data
){
// const fileList = []
// if (data.videoUrl) {
// fileList.push({ type: 'video', url: data.videoUrl })
// }
// if (data.imageUrlList && data.imageUrlList.length) {
// data.imageUrlList.forEach(item => {
// fileList.push({ type: 'image', url: item })
// })
// }
// this.fileList = fileList
this
.
fileNum
=
data
.
imageUrlList
&&
data
.
imageUrlList
.
length
?
data
.
imageUrlList
.
length
:
0
if
(
data
.
videoUrl
)
this
.
fileNum
=
this
.
fileNum
+
1
this
.
info
=
data
this
.
loaded
=
true
if
(
!
data
.
videoUrl
)
return
;
this
.
getVideoFirstFrame
(
data
.
videoUrl
).
then
(
res
=>
{
this
.
poster
=
res
.
dataURL
})
this
.
$nextTick
(()
=>
{
const
video
=
document
.
getElementById
(
'swiper_video'
)
const
video
=
document
.
getElementById
(
'swiper_video'
)
if
(
video
){
video
.
addEventListener
(
'play'
,
()
=>
{
video
.
addEventListener
(
'play'
,
()
=>
{
this
.
autoplay
=
0
this
.
autoplay
=
0
})
})
...
@@ -64,28 +101,8 @@ export default {
...
@@ -64,28 +101,8 @@ export default {
video
.
addEventListener
(
'ended'
,
()
=>
{
video
.
addEventListener
(
'ended'
,
()
=>
{
this
.
autoplay
=
3000
this
.
autoplay
=
3000
},
false
)
},
false
)
}
},
methods
:
{
changeSwiper
(
idx
)
{
this
.
curIdx
=
idx
},
getDetail
(
id
)
{
marketingApi
.
getTextDetail
({
id
,
flag
:
0
}).
then
(
data
=>
{
if
(
data
){
const
fileList
=
[]
if
(
data
.
videoUrl
)
{
fileList
.
push
({
type
:
'video'
,
url
:
data
.
videoUrl
})
}
if
(
data
.
imageUrlList
&&
data
.
imageUrlList
.
length
)
{
data
.
imageUrlList
.
forEach
(
item
=>
{
fileList
.
push
({
type
:
'image'
,
url
:
item
})
})
})
}
}
this
.
fileList
=
fileList
this
.
info
=
data
}
})
})
}
}
}
}
...
@@ -122,7 +139,7 @@ export default {
...
@@ -122,7 +139,7 @@ export default {
border-radius
:
12px
;
border-radius
:
12px
;
}
}
.rich-text
{
.rich-text
{
margin-top
:
20px
;
padding-bottom
:
1
20px
;
}
}
.hide
img
{
.hide
img
{
width
:
100%
;
width
:
100%
;
...
...
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