Commit ea640074 by 李伟康

commit -- 营销素材

1 parent 2f6c46db
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
import ssoApi from './ssoApi' import ssoApi from './ssoApi'
import wwbenchApi from './wwbenchApi' import wwbenchApi from './wwbenchApi'
import wxConfig from './wxConfig' import wxConfig from './wxConfig'
import marketingApi from './marketingApi'
export { export {
ssoApi, ssoApi,
wwbenchApi, wwbenchApi,
wxConfig wxConfig,
marketingApi
} }
\ No newline at end of file \ 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 \ 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-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 \ 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 \ 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 { ...@@ -58,13 +58,16 @@ export default {
searchValue: '' searchValue: ''
} }
}, },
mounted(){
console.log('searchValue',this.searchValue)
},
watch: { watch: {
'updata' (n) { 'updata' (n) {
this.value = this.index this.value = this.index
}, },
'keyword' (n) { 'keyword' (n) {
this.searchValue = n this.searchValue = n
} },
}, },
methods: { methods: {
onEmit (e, name) { onEmit (e, name) {
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
*/ */
// 本地环境配置 // 本地环境配置
module.exports = { module.exports = {
envVersion: "develop", envVersion: 'trial',
title: '嘀加企微管家', title: '嘀加企微管家',
request: { request: {
baseURL: 'http://scrm.test.glsx.com.cn', // 本地测试项目地址, baseURL: 'http://scrm.dev.glsx.com.cn', // 本地测试项目地址,
// 设置超时时间 // 设置超时时间
timeout: 180000, timeout: 180000,
// 携带凭证 // 携带凭证
...@@ -37,5 +37,5 @@ module.exports = { ...@@ -37,5 +37,5 @@ module.exports = {
source: "scrm-main", source: "scrm-main",
v: "1.0.0", v: "1.0.0",
}, },
vconsole: false vconsole: true
} }
\ No newline at end of file \ No newline at end of file
import indexMixin from './indexMixin' import indexMixin from './indexMixin'
import shareMixin from './shareMixin'
export { export {
indexMixin indexMixin,
shareMixin
} }
\ No newline at end of file \ 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> <template>
<div class="psd-item"> <div class="psd-item">
<div class="title flex"> <div class="title flex">
产品操作手册(这里显示素材名称) {{item.materialName}}
<template v-if="!hidePYQ"> <template v-if="!hidePYQ">
<div class="sprite-icon icon-PYQ"></div> <div class="sprite-icon icon-PYQ" @click="onEmit('share',item)"></div>
</template> </template>
</div> </div>
<div class="content"> <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>
<div class="bottom flex"> <div class="bottom flex">
<div class="num flex"> <div class="num flex">
<div class="sprite-icon icon-send"></div> <div class="sprite-icon icon-send"></div>
998 {{item.sendNum}}
</div> </div>
<div class="num flex"> <div class="num flex">
<div class="sprite-icon icon-eye"></div> <div class="sprite-icon icon-eye"></div>
10086 {{item.readNum}}
</div> </div>
<van-button <van-button
block block
round round
color="#3975C6" color="#3975C6"
@click="send" @click="onEmit('send',item)"
> >
发送 发送
</van-button> </van-button>
...@@ -44,8 +50,8 @@ export default { ...@@ -44,8 +50,8 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
send () { onEmit (name, item) {
this.$emit(name, item)
} }
} }
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<div class="text">营销素材发给客户后,客户的阅读行为将会<br />主动通知你,系统并自动给客户打上指定标签</div> <div class="text">营销素材发给客户后,客户的阅读行为将会<br />主动通知你,系统并自动给客户打上指定标签</div>
<search-box <search-box
@search="search" @search="search"
:keyword="keyword" :keyword="materialName"
:showDropdown="false" :showDropdown="false"
placeholder="输入关键词" placeholder="输入关键词"
@focus="focus" @focus="focus"
...@@ -33,15 +33,15 @@ ...@@ -33,15 +33,15 @@
<div <div
:key="index" :key="index"
class="item" class="item"
@click="jump(i)" @click="jump(i.id)"
> >
<img <img
class="bg" class="bg"
:src="itemBgUrl[1]" :src="itemBgUrl[index % 2 == 0 ? 0: 1]"
/> />
<div class="text"> <div class="text">
<div class="name text-hide">恒河猴</div> <div class="name text-hide">{{i.materialGroupName}}</div>
15 {{i.materialNum || 0}}
</div> </div>
</div> </div>
</template> </template>
...@@ -50,14 +50,25 @@ ...@@ -50,14 +50,25 @@
class="search-item" class="search-item"
:key="index" :key="index"
> >
<div class="group flex"> <!-- type 1 素材组 2 素材 -->
<template v-if="i.type == 1">
<div
class="group flex"
@click="jump(i.id)"
>
<div class="sprite-icon icon-file"></div> <div class="sprite-icon icon-file"></div>
恒河猴 {{i.materialName}}
<div class="arrow"> <div class="arrow">
<img src="https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/arrow.png" /> <img src="https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/arrow.png" />
</div> </div>
</div> </div>
<psd /> </template>
<psd
v-else
:item="i"
@send="sendMessage"
@share="shareToExternalMoments"
/>
</div> </div>
</template> </template>
</template> </template>
...@@ -76,31 +87,32 @@ ...@@ -76,31 +87,32 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import Nothing from './Nothing' import Nothing from './Nothing'
import Psd from './Psd' import Psd from './Psd'
import { marketingApi } from '@/api'
import { shareMixin } from '@/mixins'
export default { export default {
name: '', name: '',
mixins: [shareMixin],
components: { Nothing, Psd }, components: { Nothing, Psd },
data () { data () {
return { return {
itemBgUrl: { itemBgUrl: [
1: 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/item-0.png', 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/item-1.png',
2: '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'
3: 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/item-2.png' ],
}, flag: false,
flag: true, list: [],
list: new Array(10),
userInfo: window.vm.getLocalStorage('dj_scrm_userInfo'), userInfo: window.vm.getLocalStorage('dj_scrm_userInfo'),
keyword: '', materialName: '',
total: 0, searchStyle: false
pageNum: 1,
searchStyle: true
} }
}, },
mounted () { mounted () {
this.getList()
}, },
methods: { methods: {
jump (e) { jump (groupId) {
let { corpId } = this.getLocalStorage('dj_scrm_corpId') 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 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) let path = ['prod', 'production'].includes(process.env.NODE_ENV)
? 'dj-scrm-wx-work-attachment-psd' //测试、生产 ? 'dj-scrm-wx-work-attachment-psd' //测试、生产
...@@ -108,23 +120,29 @@ export default { ...@@ -108,23 +120,29 @@ export default {
window.location.href = `/${path}/#/psd/list${query}` window.location.href = `/${path}/#/psd/list${query}`
}, },
onReachBottom (e) { 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 this.$refs.scrollView.finished = true
return
}
this.pageNum = pageNum + 1
this.getList()
}, },
search () { search (e) {
this.materialName = e
this.getList()
}, },
focus () { focus () {
/** */ /** */
}, },
getList () { 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!