Commit 8972189b by 李伟康

commit

1 parent b16a4a44
...@@ -311,6 +311,22 @@ const WxConfig = { ...@@ -311,6 +311,22 @@ const WxConfig = {
} }
) )
}) })
},
/**自定义转发到微信 */
shareWechatMessage(obj) {
// title: '', // 分享标题
// desc: '', // 分享描述
// link: '', // 分享链接
// imgUrl: '' // 分享封面
return new Promise((resolve) => {
wx.invoke('shareWechatMessage', obj,
function(res) {
if (res.err_msg == 'shareWechatMessage:ok') {
}
}
)
})
} }
} }
......
...@@ -36,7 +36,13 @@ const pages = [{ ...@@ -36,7 +36,13 @@ const pages = [{
backgroundColor: '#F7F7F7' backgroundColor: '#F7F7F7'
}, },
children: [ children: [
{
name:'goods',
meta: {
backgroundColor: '#F7F7F7',
title:'商品中心'
},
}
] ]
} }
] ]
......
...@@ -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[1] let userInfo = data.loginList[2]
let { merchantId, accountName } = userInfo let { merchantId, accountName } = userInfo
let loginAccount = accountName let loginAccount = accountName
ssoApi.selectAccount({ ssoApi.selectAccount({
...@@ -89,7 +89,7 @@ const actions = { ...@@ -89,7 +89,7 @@ const actions = {
util.setLocalStorage('dj_scrm_userInfo', res.data) util.setLocalStorage('dj_scrm_userInfo', res.data)
util.setSessionId(res.data.sessionId) util.setSessionId(res.data.sessionId)
dispatch('registerHttp', res.data.sessionId) dispatch('registerHttp', res.data.sessionId)
window.location.replace(`${redirectUrl}${route}`) window.location.replace(`${redirectUrl}#/${route}`)
}) })
} else { } else {
let [userInfo] = data.loginList let [userInfo] = data.loginList
......
<template>
<div class="layout">
<template v-if="flag">
<template v-if="list.length">
<scroll-view
class="list-box"
@ReachBottom="onReachBottom"
ref="scrollView"
>
<div class="type-1">
<template v-for="(i,index) in list">
<div
:key="index"
class="item"
>
<div class="icon">
<img :src="i.goodsImage || ''">
</div>
<div class="info">
<div class="name text-two-line">{{i.goodsName}}</div>
<template v-if="i.price">
<div class="price">¥{{i.price.toFixed(2)}}</div>
</template>
</div>
<div
class="sprite-icon icon-share"
@click="choose(i)"
></div>
</div>
</template>
</div>
</scroll-view>
</template>
<template v-else>
<van-empty description="暂无内容" />
</template>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
import { shopmallApi, wxConfig } from '@/api'
export default {
name: '',
data() {
return {
pageNum: 1,
list: [],
flag: false,
total: 0,
WX: wxConfig
}
},
mounted() {
this.getList()
this.WX.init(['shareAppMessage'])
},
methods: {
getList() {
let { list, pageNum } = this
shopmallApi.getGoodsList({ currentPage: pageNum }).then(res => {
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
this.hideLoading()
})
},
choose(e) {
let { id, goodsName, goodsImage } = e
shopmallApi.getGoodsLink({ id }).then(data => {
console.log(data)
this.WX.shareAppMessage({
title: goodsName,
desc: '',
link: data,
imgUrl: goodsImage
}).then(res => {
this.showToast('发送成功')
})
})
},
onReachBottom() {
let { total, pageNum, list } = this
this.$refs.scrollView.loading = false
if (list.length == total) {
this.$refs.scrollView.finished = true
return
}
if (Math.ceil(total / 10) > pageNum) {
this.pageNum = pageNum + 1
this.getList()
} else {
this.$refs.scrollView.finished = true
}
}
}
}
</script>
<style scoped lang='scss'>
.list-box {
height: 100vh;
.type-1 {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.item {
width: 164px;
height: 208px;
box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
.icon {
height: 120px;
}
.icon-share {
position: absolute;
right: 10px;
bottom: 10px;
}
.info {
height: calc(100% - 120px);
box-sizing: border-box;
padding: 12px 8px 10px;
display: flex;
justify-content: space-between;
flex-direction: column;
position: relative;
.name {
color: #3a3a3a;
line-height: 17px;
}
.price {
color: #5850ff;
font-weight: 500;
font-size: 16px;
}
}
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!