Commit cf7daf08 by 李伟康

COMMIT

1 parent 780afd97
...@@ -24,12 +24,12 @@ import { Notify } from 'vant' ...@@ -24,12 +24,12 @@ import { Notify } from 'vant'
const staticOptions = [ const staticOptions = [
{ name: '企业微信', icon: require('@/assets/images/icon/wx.png'), type: 1 }, { 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/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 { export default {
name: 'Share', name: 'Share',
props: ['value', 'apiName', 'currentItem'], props: ['value', 'apiName', 'currentItem'],
data () { data() {
return { return {
showPoster: false, showPoster: false,
showShare: false, showShare: false,
...@@ -40,9 +40,14 @@ export default { ...@@ -40,9 +40,14 @@ export default {
} }
}, },
watch: { watch: {
value (n) { value(n) {
console.log(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) { if (component_id == id && n && component_api_name == apiName) {
this.showShare = true this.showShare = true
return return
...@@ -51,6 +56,7 @@ export default { ...@@ -51,6 +56,7 @@ export default {
let options = this.tools.deepClone(staticOptions) let options = this.tools.deepClone(staticOptions)
if (apiName == 'couponApi' || apiName == 'boutiquecouponApi' || apiName == 'equityApi') { if (apiName == 'couponApi' || apiName == 'boutiquecouponApi' || apiName == 'equityApi') {
options[1].className = 'disabled' options[1].className = 'disabled'
this.showShare = true
} }
this.options = options this.options = options
if (apiName == 'activityApi' || apiName == 'liveApi') { if (apiName == 'activityApi' || apiName == 'liveApi') {
...@@ -73,29 +79,26 @@ export default { ...@@ -73,29 +79,26 @@ export default {
} }
if (apiName == 'shopmallApi') { if (apiName == 'shopmallApi') {
shopmallApi.getGoodsLink({ id }).then(data => { shopmallApi.getGoodsLink({ id }).then(data => {
console.log(data) console.log('商品链接', data)
this.activityData = { shopmallApi.getGoodsPoster({ id }).then(res => {
url: data console.log('商品海报', res)
} this.activityData = {
}) posterUrl: res,
shopmallApi.getGoodsPoster({ id }).then(res => { url: data
console.log(res) }
this.activityData = { this.showShare = true
posterUrl: res })
}
}) })
} }
this.showShare = true
} }
} }
}, },
mounted () { mounted() {},
},
methods: { methods: {
closePoster () { closePoster() {
this.showPoster = false this.showPoster = false
}, },
onSelect ({ type, className }) { onSelect({ type, className }) {
let { currentItem, apiName, activityData } = this let { currentItem, apiName, activityData } = this
switch (type) { switch (type) {
/**分享微信 */ /**分享微信 */
...@@ -119,11 +122,11 @@ export default { ...@@ -119,11 +122,11 @@ export default {
if (apiName == 'activityApi' || apiName == 'liveApi') { if (apiName == 'activityApi' || apiName == 'liveApi') {
let { activityData } = this let { activityData } = this
if (apiName == 'activityApi') { if (apiName == 'activityApi') {
if (userId) this.sendChatMessage(activityData.linkUrl, '', activityData.activityName) if (userId) this.sendChatMessage(activityData.linkUrl, '', activityData.activityName, activityData.posterUrl)
else this.shareAppMessage(activityData.linkUrl, '', activityData.activityName) else this.shareAppMessage(activityData.linkUrl, '', activityData.activityName, activityData.posterUrl)
} else { } else {
if (userId) this.sendChatMessage(activityData.cdnUrl, '', currentItem.name, currentItem.imgUrl) if (userId) this.sendChatMessage(activityData.cdnUrl, '', currentItem.name, currentItem.shareImgUrl)
else this.shareAppMessage(activityData.cdnUrl, '', currentItem.name, currentItem.imgUrl) else this.shareAppMessage(activityData.cdnUrl, '', currentItem.name, currentItem.shareImgUrl)
} }
} }
if (apiName == 'equityApi' || apiName == 'shopmallApi') { if (apiName == 'equityApi' || apiName == 'shopmallApi') {
...@@ -136,12 +139,13 @@ export default { ...@@ -136,12 +139,13 @@ export default {
}) })
} else { } else {
let { activityData } = this let { activityData } = this
console.log('________________________', activityData.url)
if (userId) this.sendChatMessage(activityData.url, '', currentItem.goodsName, currentItem.goodsImage) if (userId) this.sendChatMessage(activityData.url, '', currentItem.goodsName, currentItem.goodsImage)
else this.shareAppMessage(activityData.url, '', currentItem.goodsName, currentItem.goodsImage) else this.shareAppMessage(activityData.url, '', currentItem.goodsName, currentItem.goodsImage)
} }
} }
this.cancel() this.cancel()
break; break
/**分享海报 */ /**分享海报 */
case 2: case 2:
if (className) { if (className) {
...@@ -149,7 +153,7 @@ export default { ...@@ -149,7 +153,7 @@ export default {
return return
} }
this.showPoster = true this.showPoster = true
break; break
/**复制 */ /**复制 */
case 3: case 3:
let { id } = currentItem let { id } = currentItem
...@@ -172,54 +176,62 @@ export default { ...@@ -172,54 +176,62 @@ export default {
this.setClipboardData(res.url) this.setClipboardData(res.url)
}) })
} }
break; break
} }
}, },
cancel () { cancel() {
this.$emit('cancel') this.$emit('cancel')
}, },
couponShare (item, shareType, callBack) { couponShare(item, shareType, callBack) {
let { userId, id } = item let { userId, id } = item
let obj = { let obj = {
couponId: id, couponId: id,
shareType shareType
} }
if (userId) obj.userList = [ if (userId)
{ obj.userList = [
userId {
} userId
] }
]
else obj.shareType = 0 else obj.shareType = 0
couponApi.getCouponShared(obj).then(res => { couponApi.getCouponShared(obj).then(res => {
if (shareType == 0) this.setClipboardData(res.url) if (shareType == 0) this.setClipboardData(res.url)
if (shareType == 1) callBack(res.url) if (shareType == 1) callBack(res.url)
}) })
}, },
getBoutiqueCoupon (id, callBack) { getBoutiqueCoupon(id, callBack) {
boutiquecouponApi.getBoutiqueCoupon({ id }).then(res => { boutiquecouponApi.getBoutiqueCoupon({ id }).then(res => {
callBack(res) callBack(res)
}) })
}, },
sendChatMessage (link, desc, title, imgUrl) { sendChatMessage(link, desc, title, imgUrl) {
window.$wx.sendChatMessage({ window.$wx
msgtype: 'news', .sendChatMessage({
news: { msgtype: 'news',
link, //H5消息页面url 必填 news: {
desc, link, //H5消息页面url 必填
title desc,
}, title,
enterChat: false imgUrl
}).then(() => { },
this.showToast('发送成功') enterChat: false
}) })
.then(() => {
this.showToast('发送成功')
})
}, },
shareAppMessage (link, desc, title, imgUrl) { shareAppMessage(link, desc, title, imgUrl) {
window.$wx.shareAppMessage({ window.$wx
title, .shareAppMessage({
desc, title,
link, desc,
imgUrl link,
}) imgUrl
})
.then(() => {
this.showToast('发送成功')
})
} }
} }
} }
......
...@@ -74,7 +74,7 @@ const actions = { ...@@ -74,7 +74,7 @@ const actions = {
if (data.loginList.length > 1) { if (data.loginList.length > 1) {
util.setLocalStorage('dj_scrm_loginToken', data.loginToken) util.setLocalStorage('dj_scrm_loginToken', data.loginToken)
util.setLocalStorage('dj_scrm_accountList', data.loginList) util.setLocalStorage('dj_scrm_accountList', data.loginList)
let userInfo = data.loginList[2] let userInfo = data.loginList[0]
let { merchantId, accountName } = userInfo let { merchantId, accountName } = userInfo
let loginAccount = accountName let loginAccount = accountName
ssoApi.selectAccount({ ssoApi.selectAccount({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!