Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-h5-ailipay
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 cf7daf08
authored
Nov 19, 2021
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
COMMIT
1 parent
780afd97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
54 deletions
src/components/Share.vue
src/store/modules/app.js
src/components/Share.vue
View file @
cf7daf0
...
...
@@ -24,12 +24,12 @@ import { Notify } from 'vant'
const
staticOptions
=
[
{
name
:
'企业微信'
,
icon
:
require
(
'@/assets/images/icon/wx.png'
),
type
:
1
},
{
name
:
'分享海报'
,
icon
:
require
(
'@/assets/images/icon/poster.png'
),
type
:
2
},
{
name
:
'复制链接'
,
icon
:
require
(
'@/assets/images/icon/copy.png'
),
type
:
3
}
,
{
name
:
'复制链接'
,
icon
:
require
(
'@/assets/images/icon/copy.png'
),
type
:
3
}
]
export
default
{
name
:
'Share'
,
props
:
[
'value'
,
'apiName'
,
'currentItem'
],
data
()
{
data
()
{
return
{
showPoster
:
false
,
showShare
:
false
,
...
...
@@ -40,9 +40,14 @@ export default {
}
},
watch
:
{
value
(
n
)
{
value
(
n
)
{
console
.
log
(
n
)
let
{
currentItem
:
{
id
},
component_id
,
apiName
,
component_api_name
}
=
this
let
{
currentItem
:
{
id
},
component_id
,
apiName
,
component_api_name
}
=
this
if
(
component_id
==
id
&&
n
&&
component_api_name
==
apiName
)
{
this
.
showShare
=
true
return
...
...
@@ -51,6 +56,7 @@ export default {
let
options
=
this
.
tools
.
deepClone
(
staticOptions
)
if
(
apiName
==
'couponApi'
||
apiName
==
'boutiquecouponApi'
||
apiName
==
'equityApi'
)
{
options
[
1
].
className
=
'disabled'
this
.
showShare
=
true
}
this
.
options
=
options
if
(
apiName
==
'activityApi'
||
apiName
==
'liveApi'
)
{
...
...
@@ -73,29 +79,26 @@ export default {
}
if
(
apiName
==
'shopmallApi'
)
{
shopmallApi
.
getGoodsLink
({
id
}).
then
(
data
=>
{
console
.
log
(
data
)
this
.
activityData
=
{
url
:
data
}
})
shopmallApi
.
getGoodsPoster
({
id
}).
then
(
res
=>
{
console
.
log
(
res
)
this
.
activityData
=
{
posterUrl
:
res
}
console
.
log
(
'商品链接'
,
data
)
shopmallApi
.
getGoodsPoster
({
id
}).
then
(
res
=>
{
console
.
log
(
'商品海报'
,
res
)
this
.
activityData
=
{
posterUrl
:
res
,
url
:
data
}
this
.
showShare
=
true
})
})
}
this
.
showShare
=
true
}
}
},
mounted
()
{
},
mounted
()
{},
methods
:
{
closePoster
()
{
closePoster
()
{
this
.
showPoster
=
false
},
onSelect
({
type
,
className
})
{
onSelect
({
type
,
className
})
{
let
{
currentItem
,
apiName
,
activityData
}
=
this
switch
(
type
)
{
/**分享微信 */
...
...
@@ -119,11 +122,11 @@ export default {
if
(
apiName
==
'activityApi'
||
apiName
==
'liveApi'
)
{
let
{
activityData
}
=
this
if
(
apiName
==
'activityApi'
)
{
if
(
userId
)
this
.
sendChatMessage
(
activityData
.
linkUrl
,
''
,
activityData
.
activityName
)
else
this
.
shareAppMessage
(
activityData
.
linkUrl
,
''
,
activityData
.
activityName
)
if
(
userId
)
this
.
sendChatMessage
(
activityData
.
linkUrl
,
''
,
activityData
.
activityName
,
activityData
.
posterUrl
)
else
this
.
shareAppMessage
(
activityData
.
linkUrl
,
''
,
activityData
.
activityName
,
activityData
.
posterUrl
)
}
else
{
if
(
userId
)
this
.
sendChatMessage
(
activityData
.
cdnUrl
,
''
,
currentItem
.
name
,
currentItem
.
i
mgUrl
)
else
this
.
shareAppMessage
(
activityData
.
cdnUrl
,
''
,
currentItem
.
name
,
currentItem
.
i
mgUrl
)
if
(
userId
)
this
.
sendChatMessage
(
activityData
.
cdnUrl
,
''
,
currentItem
.
name
,
currentItem
.
shareI
mgUrl
)
else
this
.
shareAppMessage
(
activityData
.
cdnUrl
,
''
,
currentItem
.
name
,
currentItem
.
shareI
mgUrl
)
}
}
if
(
apiName
==
'equityApi'
||
apiName
==
'shopmallApi'
)
{
...
...
@@ -136,12 +139,13 @@ export default {
})
}
else
{
let
{
activityData
}
=
this
console
.
log
(
'________________________'
,
activityData
.
url
)
if
(
userId
)
this
.
sendChatMessage
(
activityData
.
url
,
''
,
currentItem
.
goodsName
,
currentItem
.
goodsImage
)
else
this
.
shareAppMessage
(
activityData
.
url
,
''
,
currentItem
.
goodsName
,
currentItem
.
goodsImage
)
}
}
this
.
cancel
()
break
;
break
/**分享海报 */
case
2
:
if
(
className
)
{
...
...
@@ -149,7 +153,7 @@ export default {
return
}
this
.
showPoster
=
true
break
;
break
/**复制 */
case
3
:
let
{
id
}
=
currentItem
...
...
@@ -172,54 +176,62 @@ export default {
this
.
setClipboardData
(
res
.
url
)
})
}
break
;
break
}
},
cancel
()
{
cancel
()
{
this
.
$emit
(
'cancel'
)
},
couponShare
(
item
,
shareType
,
callBack
)
{
couponShare
(
item
,
shareType
,
callBack
)
{
let
{
userId
,
id
}
=
item
let
obj
=
{
couponId
:
id
,
shareType
}
if
(
userId
)
obj
.
userList
=
[
{
userId
}
]
if
(
userId
)
obj
.
userList
=
[
{
userId
}
]
else
obj
.
shareType
=
0
couponApi
.
getCouponShared
(
obj
).
then
(
res
=>
{
if
(
shareType
==
0
)
this
.
setClipboardData
(
res
.
url
)
if
(
shareType
==
1
)
callBack
(
res
.
url
)
})
},
getBoutiqueCoupon
(
id
,
callBack
)
{
getBoutiqueCoupon
(
id
,
callBack
)
{
boutiquecouponApi
.
getBoutiqueCoupon
({
id
}).
then
(
res
=>
{
callBack
(
res
)
})
},
sendChatMessage
(
link
,
desc
,
title
,
imgUrl
)
{
window
.
$wx
.
sendChatMessage
({
msgtype
:
'news'
,
news
:
{
link
,
//H5消息页面url 必填
desc
,
title
},
enterChat
:
false
}).
then
(()
=>
{
this
.
showToast
(
'发送成功'
)
})
sendChatMessage
(
link
,
desc
,
title
,
imgUrl
)
{
window
.
$wx
.
sendChatMessage
({
msgtype
:
'news'
,
news
:
{
link
,
//H5消息页面url 必填
desc
,
title
,
imgUrl
},
enterChat
:
false
})
.
then
(()
=>
{
this
.
showToast
(
'发送成功'
)
})
},
shareAppMessage
(
link
,
desc
,
title
,
imgUrl
)
{
window
.
$wx
.
shareAppMessage
({
title
,
desc
,
link
,
imgUrl
})
shareAppMessage
(
link
,
desc
,
title
,
imgUrl
)
{
window
.
$wx
.
shareAppMessage
({
title
,
desc
,
link
,
imgUrl
})
.
then
(()
=>
{
this
.
showToast
(
'发送成功'
)
})
}
}
}
...
...
src/store/modules/app.js
View file @
cf7daf0
...
...
@@ -74,7 +74,7 @@ const actions = {
if
(
data
.
loginList
.
length
>
1
)
{
util
.
setLocalStorage
(
'dj_scrm_loginToken'
,
data
.
loginToken
)
util
.
setLocalStorage
(
'dj_scrm_accountList'
,
data
.
loginList
)
let
userInfo
=
data
.
loginList
[
2
]
let
userInfo
=
data
.
loginList
[
0
]
let
{
merchantId
,
accountName
}
=
userInfo
let
loginAccount
=
accountName
ssoApi
.
selectAccount
({
...
...
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