Commit ea640074 by 李伟康

commit -- 营销素材

1 parent 2f6c46db
......@@ -9,8 +9,10 @@
import ssoApi from './ssoApi'
import wwbenchApi from './wwbenchApi'
import wxConfig from './wxConfig'
import marketingApi from './marketingApi'
export {
ssoApi,
wwbenchApi,
wxConfig
wxConfig,
marketingApi
}
\ No newline at end of file
const url = '/rop-scrm-marketing/router'
export default {
/**素材列表 */
getPsdList (data) {
data.method = 'marketing.api.material.list'
data.pageNum = 1
data.pageSize = 9999
data.flag = 2
return window.$HTTP({
url,
data
})
},
/** 素材组列表 */
getPsdGroupList (data = {}) {
data.method = 'marketing.api.material.group.list'
return window.$HTTP({
url,
data
})
},
/** 素材发送/阅读埋点 */
sendReadBuriedPoint (params) {
let data = {
method: 'marketing.api.open.material.sendReadBuriedPoint',
list: [params]
}
return window.$HTTP({
url,
data
})
}
}
\ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 80px 77px;}
.sprite-icon { background-image: url(../images/sprite.png);background-size: 139px 104px;}
.icon-default-avatar { width: 44px; height: 44px; background-position: 0px 0px;}
.icon-down { width: 12px; height: 12px; background-position: -33px -54px;}
.icon-index-tips { width: 23px; height: 23px; background-position: 0px -54px;}
.icon-file { width: 26px; height: 26px; background-position: -54px 0px;}
\ No newline at end of file
.icon-down { width: 12px; height: 12px; background-position: -96px -63px;}
.icon-eye { width: 13px; height: 8px; background-position: 0px -96px;}
.icon-file { width: 26px; height: 26px; background-position: -42px -54px;}
.icon-index-tips { width: 23px; height: 23px; background-position: -96px 0px;}
.icon-link { width: 32px; height: 32px; background-position: 0px -54px;}
.icon-pdf { width: 32px; height: 34px; background-position: -54px 0px;}
.icon-PYQ { width: 21px; height: 20px; background-position: -96px -33px;}
.icon-send { width: 10px; height: 10px; background-position: -129px 0px;}
\ No newline at end of file

3.08 KB | W: | H:

8.72 KB | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -58,13 +58,16 @@ export default {
searchValue: ''
}
},
mounted(){
console.log('searchValue',this.searchValue)
},
watch: {
'updata' (n) {
this.value = this.index
},
'keyword' (n) {
this.searchValue = n
}
},
},
methods: {
onEmit (e, name) {
......
......@@ -8,10 +8,10 @@
*/
// 本地环境配置
module.exports = {
envVersion: "develop",
envVersion: 'trial',
title: '嘀加企微管家',
request: {
baseURL: 'http://scrm.test.glsx.com.cn', // 本地测试项目地址,
baseURL: 'http://scrm.dev.glsx.com.cn', // 本地测试项目地址,
// 设置超时时间
timeout: 180000,
// 携带凭证
......@@ -37,5 +37,5 @@ module.exports = {
source: "scrm-main",
v: "1.0.0",
},
vconsole: false
vconsole: true
}
\ No newline at end of file
import indexMixin from './indexMixin'
import shareMixin from './shareMixin'
export {
indexMixin
indexMixin,
shareMixin
}
\ No newline at end of file
import { wxConfig, marketingApi } from '@/api'
export default {
data () {
return {
entry: 'normal'
}
},
mounted () {
this.wxInit()
},
methods: {
wxInit () {
let _this = this
wxConfig.init(['getContext', 'shareAppMessage', 'sendChatMessage', 'shareToExternalMoments']).then(() => {
wxConfig.getContext().then(({ entry }) => {
_this.$parent.entry = entry
_this.entry = entry
})
})
},
shareToExternalMoments (i) {
this.sendMessage(i, true)
},
sendMessage (i, isPyq) {
const { shopmall_appid, envVersion } = window.$fetchConfig
const path = 'pages/psdView/psdView'
const { merchantId, uuid, sapCode } = this.getLocalStorage('dj_scrm_userInfo')
const { entry } = this
const { materialName, id, titleUrl, materialTitle, description } = i
const imgUrl = 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/test/test.jpg'
let query = `merchantId=${merchantId}&id=${id}&staffUuid=${uuid}`
if (sapCode) query = `${query}&storeCode=${sapCode}`
marketingApi.sendReadBuriedPoint({
materialId: id,
type: 1,
merchantId,
staffUuid: uuid
}).then(() => {
wxConfig.createMiniprogramUrlLink({
path,
query,
appId: shopmall_appid,
envVersion
})
.then(link => {
this.showLoading()
if (isPyq) {
console.log('朋友圈')
wxConfig.shareToExternalMoments({
attachments: [
{
msgtype: 'link', // 消息类型,必填
link: {
title: materialTitle || materialName, // H5消息标题
imgUrl: titleUrl || imgUrl, // H5消息封面图片URL
url: link // H5消息页面url 必填
},
}
]
}).then(() => {
this.hideLoading()
})
.catch(err => {
this.hideLoading()
})
} else {
let params = {
link,
title: materialTitle || materialName,
desc: description || '',
imgUrl: titleUrl || imgUrl
}
if (entry != 'normal') this.sendChatMessage(params, 'news')
else this.shareAppMessage(params)
}
})
})
},
sendChatMessage (params, msgtype) {
wxConfig
.sendChatMessage({
msgtype,
[msgtype]: params,
enterChat: false
})
.then(() => {
this.hideLoading()
})
.catch(err => {
console.log(err)
this.hideLoading()
})
},
shareAppMessage (params) {
wxConfig
.shareAppMessage(params)
.then(() => {
this.hideLoading()
})
.catch(() => {
this.hideLoading()
})
},
toUnicode (chineseStr = '') {
let unicodeStr = ''
for (let i = 0, iLength = chineseStr.length; i < iLength; i++) {
unicodeStr += '@' + chineseStr.charCodeAt(i).toString(16)
}
return unicodeStr
}
}
}
<template>
<div class="psd-item">
<div class="title flex">
产品操作手册(这里显示素材名称)
{{item.materialName}}
<template v-if="!hidePYQ">
<div class="sprite-icon icon-PYQ"></div>
<div class="sprite-icon icon-PYQ" @click="onEmit('share',item)"></div>
</template>
</div>
<div class="content">
{{item}}
<template v-if="item.materialType == 1">
<div class="sprite-icon icon-pdf"></div>
</template>
<template v-else-if="item.materialType == 2">链接</template>
<template v-else>
<div v-html="decodeURIComponent(item.materialUrl)"></div>
</template>
</div>
<div class="bottom flex">
<div class="num flex">
<div class="sprite-icon icon-send"></div>
998
{{item.sendNum}}
</div>
<div class="num flex">
<div class="sprite-icon icon-eye"></div>
10086
{{item.readNum}}
</div>
<van-button
block
round
color="#3975C6"
@click="send"
@click="onEmit('send',item)"
>
发送
</van-button>
......@@ -44,8 +50,8 @@ export default {
mounted () {
},
methods: {
send () {
onEmit (name, item) {
this.$emit(name, item)
}
}
}
......
......@@ -13,7 +13,7 @@
<div class="text">营销素材发给客户后,客户的阅读行为将会<br />主动通知你,系统并自动给客户打上指定标签</div>
<search-box
@search="search"
:keyword="keyword"
:keyword="materialName"
:showDropdown="false"
placeholder="输入关键词"
@focus="focus"
......@@ -33,15 +33,15 @@
<div
:key="index"
class="item"
@click="jump(i)"
@click="jump(i.id)"
>
<img
class="bg"
:src="itemBgUrl[1]"
:src="itemBgUrl[index % 2 == 0 ? 0: 1]"
/>
<div class="text">
<div class="name text-hide">恒河猴</div>
15
<div class="name text-hide">{{i.materialGroupName}}</div>
{{i.materialNum || 0}}
</div>
</div>
</template>
......@@ -50,14 +50,25 @@
class="search-item"
:key="index"
>
<div class="group flex">
<div class="sprite-icon icon-file"></div>
恒河猴
<div class="arrow">
<img src="https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/arrow.png" />
<!-- type 1 素材组 2 素材 -->
<template v-if="i.type == 1">
<div
class="group flex"
@click="jump(i.id)"
>
<div class="sprite-icon icon-file"></div>
{{i.materialName}}
<div class="arrow">
<img src="https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/arrow.png" />
</div>
</div>
</div>
<psd />
</template>
<psd
v-else
:item="i"
@send="sendMessage"
@share="shareToExternalMoments"
/>
</div>
</template>
</template>
......@@ -76,31 +87,32 @@
<script type='text/ecmascript-6'>
import Nothing from './Nothing'
import Psd from './Psd'
import { marketingApi } from '@/api'
import { shareMixin } from '@/mixins'
export default {
name: '',
mixins: [shareMixin],
components: { Nothing, Psd },
data () {
return {
itemBgUrl: {
1: 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/item-0.png',
2: 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/item-1.png',
3: 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/item-2.png'
},
flag: true,
list: new Array(10),
itemBgUrl: [
'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/item-1.png',
'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/item-2.png'
],
flag: false,
list: [],
userInfo: window.vm.getLocalStorage('dj_scrm_userInfo'),
keyword: '',
total: 0,
pageNum: 1,
searchStyle: true
materialName: '',
searchStyle: false
}
},
mounted () {
this.getList()
},
methods: {
jump (e) {
jump (groupId) {
let { corpId } = this.getLocalStorage('dj_scrm_corpId')
let query = `?sessionId=${this.getSessionId()}&corpId=${corpId}`
let query = `?groupId=${groupId}&sessionId=${this.getSessionId()}&corpId=${corpId}`
let url = window.location.origin || `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}`
let path = ['prod', 'production'].includes(process.env.NODE_ENV)
? 'dj-scrm-wx-work-attachment-psd' //测试、生产
......@@ -108,23 +120,29 @@ export default {
window.location.href = `/${path}/#/psd/list${query}`
},
onReachBottom (e) {
let { total, pageNum, list } = this
this.$refs.scrollView.loading = false
if (list.length == total || Math.ceil(total / 10) < pageNum) {
this.$refs.scrollView.finished = true
return
}
this.pageNum = pageNum + 1
this.getList()
this.$refs.scrollView.finished = true
},
search () {
search (e) {
this.materialName = e
this.getList()
},
focus () {
/** */
},
getList () {
this.flag = false
this.list = []
let { materialName } = this
let target = 'getPsdGroupList'
if (materialName) target = 'getPsdList'
this.showLoading()
marketingApi[target]({ materialName }).then(data => {
this.searchStyle = materialName ? true : false
console.log(materialName ? '素材列表' : '素材组', data)
this.list = data
this.hideLoading()
this.flag = true
})
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!