Commit cf7daf08 by 李伟康

COMMIT

1 parent 780afd97
......@@ -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.imgUrl)
else this.shareAppMessage(activityData.cdnUrl, '', currentItem.name, currentItem.imgUrl)
if (userId) this.sendChatMessage(activityData.cdnUrl, '', currentItem.name, currentItem.shareImgUrl)
else this.shareAppMessage(activityData.cdnUrl, '', currentItem.name, currentItem.shareImgUrl)
}
}
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('发送成功')
})
}
}
}
......
......@@ -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({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!