Commit 0fdd0fd0 by 李伟康

提交代码

1 parent 828e78d4
const url = '/rop-scrm-marketing/router' const url = '/rop-scrm-marketing/router'
export default { export default {
/**素材列表 */ /**素材列表 */
getPsdList(data) { getPsdList (data) {
data.method = 'marketing.api.material.list' data.method = 'marketing.api.material.list'
data.pageNum = 1 data.pageNum = 1
data.pageSize = 9999 data.pageSize = 9999
...@@ -12,7 +12,7 @@ export default { ...@@ -12,7 +12,7 @@ export default {
}) })
}, },
/** 素材组列表 */ /** 素材组列表 */
getPsdGroupList(data = {}) { getPsdGroupList (data = {}) {
data.method = 'marketing.api.material.group.list' data.method = 'marketing.api.material.group.list'
return window.$HTTP({ return window.$HTTP({
url, url,
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
}) })
}, },
/** 素材发送/阅读埋点 */ /** 素材发送/阅读埋点 */
sendReadBuriedPoint(params) { sendReadBuriedPoint (params) {
let data = { let data = {
method: 'marketing.api.open.material.sendReadBuriedPoint', method: 'marketing.api.open.material.sendReadBuriedPoint',
list: [params] list: [params]
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
}) })
}, },
uploadMaterial(data = {}) { uploadMaterial (data = {}) {
data.method = 'marketing.api.material.sop.upload' data.method = 'marketing.api.material.sop.upload'
return window.$HTTP({ return window.$HTTP({
url, url,
...@@ -39,11 +39,28 @@ export default { ...@@ -39,11 +39,28 @@ export default {
}) })
}, },
getTextDetail(data = {}) { getTextDetail (data = {}) {
data.method = 'marketing.api.material.detail' data.method = 'marketing.api.material.detail'
return window.$HTTP({ return window.$HTTP({
url, url,
data data
}) })
} },
/** 查询话术组列表 */
getChatGroupList (data = {}) {
data.method = 'marketing.api.scriptlibrary.group.list'
return window.$HTTP({
url,
data
})
},
/**查询话术库列表 */
getChatLibraryList (data = {}) {
data.method = 'marketing.api.scriptlibrary.page'
return window.$HTTP({
url,
data
})
},
} }
...@@ -44,7 +44,9 @@ const WxConfig = { ...@@ -44,7 +44,9 @@ const WxConfig = {
}) })
}, 500) }, 500)
} else { } else {
Notify('网络异常') let err_msg = '注册config失败'
Notify(err_msg)
reject(err_msg)
} }
}) })
}) })
......
<template>
<van-popup
v-model="show"
position="bottom"
class="date-popup"
closeable
round
@close="close"
>
<div class="date-title flex">时间选择</div>
<div class="date-box">
<div class="date-subtitle">推送日期</div>
<div class="date-list flex">
<template v-for="(i,index) in dateList">
<div
:key="index"
:class="['item flex',{'active':index == dateIndex}]"
@click="chooseDate(index)"
>
{{ i }}
</div>
</template>
</div>
<div class="date-subtitle">自定义</div>
<van-calendar
ref="calendar"
class="calendar"
:poppable="false"
:show-confirm="false"
:show-title="false"
:show-subtitle="false"
type="range"
color="#3975C6"
:min-date="minDate"
:max-date="maxDate"
:allow-same-day="true"
:lazy-render="false"
row-height="50px"
@confirm="confirmCalendar"
/>
<van-button
block
round
color="#3975C6"
class="date-btn"
:disabled="!dateValue.start && !dateValue.end"
@click="confirmDate"
>确定</van-button>
</div>
</van-popup>
</template>
<script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'
export default {
name: 'DatePopup',
props: {
value: Boolean
},
data () {
return {
show: false,
dateList: ['上月', '近三月', '近一年'],
dateValue: {
start: '',
end: ''
},
dateIndex: -1,
minDate: new Date('2023/01/01'),
maxDate: new Date(),
}
},
watch: {
value (n) {
this.show = n
}
},
mounted () {
},
methods: {
chooseDate (index) {
let monthNumber = {
0: 1,
1: 3,
2: 12
}[index],
{ minDate } = this,
end = dayjs(),
start = dayjs().subtract(monthNumber, 'month')
if (start < dayjs(minDate)) start = dayjs(minDate)
this.dateIndex = index
this.setDateValue([start, end])
this.$refs.calendar.reset()
},
confirmCalendar (val) {
this.dateIndex = -1
this.setDateValue(val)
},
setDateValue ([start, end]) {
this.dateValue = {
start: dayjs(start).format('YYYY/MM/DD'),
end: dayjs(end).format('YYYY/MM/DD')
}
},
close(){
this.$emit('update:value', false)
},
confirmDate () {
let { dateValue } = this
this.$emit('confirm', dateValue)
this.close()
}
}
}
</script>
<style scoped lang='scss'>
.date-popup {
max-height: 80%;
/deep/.van-popup__close-icon {
z-index: 3;
}
.date-title {
height: 56px;
padding: 0 16px;
font-weight: 500;
font-size: 16px;
color: #222222;
position: sticky;
background-color: #fff;
z-index: 2;
top: 0;
}
.date-box {
padding: 16px;
.date-subtitle {
font-size: 14px;
color: #333333;
margin-bottom: 8px;
}
.date-list {
margin-bottom: 16px;
gap: 8px;
.item {
width: 80px;
height: 28px;
border: 1px solid #dadde0;
border-radius: 14px;
font-size: 14px;
color: #333333;
justify-content: center;
}
.active {
color: #3975c6;
background: #3975c61a;
border-color: #3975c61a;
}
}
.calendar {
height: 300px;
margin-bottom: 10px;
}
}
.date-btn {
position: sticky;
bottom: 0;
z-index: 2;
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -28,7 +28,7 @@ export default { ...@@ -28,7 +28,7 @@ export default {
<style scoped lang='scss'> <style scoped lang='scss'>
.nothing { .nothing {
display: flex; display: flex;
padding-top: 103px; padding: 103px 0;
flex-direction: column; flex-direction: column;
font-size: 12px; font-size: 12px;
color: #666666; color: #666666;
......
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
title-active-color="#2c2c2c" title-active-color="#2c2c2c"
@click="click" @click="click"
:key="updata" :key="updata"
v-bind="$attrs"
> >
<template v-for="(i,index) in data"> <template v-for="(i,index) in data">
<van-tab <van-tab
:key="index" :key="index"
:title-class="titleClass"
> >
<template #title> <template #title>
{{i}} {{i}}
...@@ -40,7 +41,8 @@ export default { ...@@ -40,7 +41,8 @@ export default {
updata: { updata: {
type: Number, type: Number,
default: new Date().getTime() default: new Date().getTime()
} },
titleClass: String
}, },
data () { data () {
return { return {
......
...@@ -11,7 +11,7 @@ module.exports = { ...@@ -11,7 +11,7 @@ module.exports = {
title: '嘀加企微助手', title: '嘀加企微助手',
envVersion: 'trial', envVersion: 'trial',
request: { request: {
baseURL: 'http://scrm.dev.glsx.com.cn', // 本地测试项目地址, baseURL: '//scrm.dev.glsx.com.cn', // 本地测试项目地址,
// 设置超时时间 // 设置超时时间
timeout: 180000, timeout: 180000,
// 携带凭证 // 携带凭证
......
...@@ -7,21 +7,20 @@ ...@@ -7,21 +7,20 @@
* @LastEditTime: 2021-06-30 11:23:25 * @LastEditTime: 2021-06-30 11:23:25
*/ */
// 根据环境引入不同配置 process.env.VUE_APP_ENV // 根据环境引入不同配置 process.env.VUE_APP_ENV
import { utils } from 'glsx-common'
let config = require('./conf.js') let config = require('./conf.js')
let timeout = 30000 //超时时间 let timeout = 30000 //超时时间
export const fetchConfig = function(isEnv = true) { export const fetchConfig = function (isEnv = true) {
if (isEnv) { if (isEnv) {
let { request } = config let { request } = config
Object.assign(request, { timeout }) Object.assign(request, { timeout })
return Promise.resolve(config) return Promise.resolve(config)
} }
/**测试mock */ let params = { moduleName: 'scrm-wx-work-psd-config', mockUrl: 'https://oss-config.test.glsx.com.cn/mock/617918601072f92988f05a11/base/scrm-wx-work-psd-config', httpOptions: { Headers: { refererurl: location.href }, request: { timeout: 30000 } } }
return utils.getConfig(params)
// return window.fetch('https://oss-config.dev.glsx.com.cn/mock/617918601072f92988f05a11/base/scrm-wx-work-psd-config', {}).then(res => res.json())
/**生产mock */ return window.fetch('https://oss-config.test.glsx.com.cn/mock/617918601072f92988f05a11/base/scrm-wx-work-psd-config', {}).then(res => res.json())
} }
export const cfg = { export const cfg = {
install(vue, config) { install (vue, config) {
vue.prototype.$config = config vue.prototype.$config = config
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -14,6 +14,20 @@ const pages = { ...@@ -14,6 +14,20 @@ const pages = {
noAuth: true noAuth: true
} }
} }
],
Chat: [
{
name: 'library',
meta: {
title: '话术库'
}
},
{
name: 'paper',
meta: {
title: '喜报早报记录'
}
}
] ]
} }
let routes = [ let routes = [
......
<template>
<div class="layout">
<div class="sticky">
<search-box
@search="search"
placeholder="输入关键词搜索"
:showDropdown="false"
></search-box>
<template v-if="groupList.length">
<tab
:list="groupList"
:updata="updata"
@change="change"
>
</tab>
</template>
</div>
<template v-if="flag">
<template v-if="list.length">
<scroll-view
class="list-box"
@ReachBottom="onReachBottom"
ref="scrollView"
>
<div class="box">
<template v-for="(i,index) in list">
<div
class="item"
:key="index"
>
<div
v-html="decodeURIComponent(i.text)"
class="content"
></div>
<div class="chat-btn">
<van-button
block
round
color="#3975C6"
:disabled="sendChatMessageDisabled"
@click="sendChatMessage(i.scriptContent)"
>发送</van-button>
</div>
</div>
</template>
</div>
</scroll-view>
</template>
<template v-else>
<nothing
class="nothing-box"
image="https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/list-nothing.png"
>暂无可用话术</nothing>
</template>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
import { Notify } from 'vant'
import { wxConfig, marketingApi } from '@/api'
export default {
name: 'library',
data () {
return {
groupList: [],
updata: Date.now(),
flag: false,
list: [],
pageNum: 1,
sendChatMessageDisabled: false,//发送按钮权限
params: {
scriptGroup: '',
scriptContent: '',
pageNum: 1,
pageSize: 10
},
total: 0
}
},
async mounted () {
try {
await wxConfig.init(['sendChatMessage'])
} catch (error) {
this.sendChatMessageDisabled = true
}
this.getChatGroupList()
this.getChatLibraryList()
},
methods: {
/**发送 */
sendChatMessage (content) {
this.showLoading()
wxConfig
.sendChatMessage({
msgtype: 'text', //消息类型,必填
enterChat: false, //为true时表示发送完成之后顺便进入会话,仅移动端3.1.10及以上版本支持该字段
text: {
content
},
})
.then(res => {
this.hideLoading()
}).catch(err => {
Notify(String(err))
this.hideLoading()
})
},
/**清空 */
clearData () {
this.list = []
this.flag = false
this.params.pageNum = 1
this.getChatLibraryList()
},
/**搜索 */
search (val) {
this.params.scriptContent = val
this.clearData()
},
/**切换tab */
change (index) {
const { groupList, params: { scriptGroup } } = this
if (scriptGroup == groupList[index] || (index == 0 && scriptGroup == '')) return
this.params.scriptGroup = index == 0 ? '' : groupList[index]
this.clearData()
},
/**话术组 */
async getChatGroupList () {
const res = await marketingApi.getChatGroupList()
console.log(res)
this.groupList = ['全部', ...res]
this.updata = Date.now()
},
/**话术 */
async getChatLibraryList () {
this.showLoading()
try {
const { params, list } = this,
{ data, count } = await marketingApi.getChatLibraryList(params),
val = params.scriptContent || '',
rex = new RegExp(`${val}`, 'g')
data.length && data.map(e => {
let txt = e.scriptContent
if (val) txt = txt.replace(rex, `<span>${val}</span>`)
e.text = encodeURIComponent(txt)
})
this.list = list.concat(data)
this.total = count
this.hideLoading()
} catch (error) {
this.hideLoading()
}
this.flag = true
},
/**触底分页加载 */
onReachBottom () {
let { total, params: { pageNum }, list, $refs: {
scrollView
} } = this
scrollView.loading = false
if (list.length == total) {
return scrollView.finished = true
}
if (Math.ceil(total / 10) > pageNum) {
this.params.pageNum = pageNum + 1
this.getChatLibraryList()
} else scrollView.finished = true
},
}
}
</script>
<style scoped lang='scss'>
.layout {
.list-box {
height: calc(100vh - 100px);
box-sizing: border-box;
.item {
background: #ffffff;
box-shadow: 0 2px 8px 0 #ced1de66, 0 2px 4px 0 #ced1de1f;
border-radius: 4px;
margin-bottom: 12px;
padding: 14px 10px;
font-size: 12px;
color: #666666;
word-break: break-all;
position: relative;
.content {
/deep/span {
color: #3582ee;
}
}
.chat-btn {
width: 60px;
height: 24px;
margin: 12px 0 0 auto;
.van-button--block {
height: 100%;
font-weight: 500;
font-size: 12px;
color: #ffffff;
}
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="layout">
<div class="sticky">
<div class="search">
<search-box
@search="search"
:showDropdown="false"
placeholder="输入4S店/群聊名称搜索"
></search-box>
<div
class="date-menu flex"
@click="showDatePopup = true"
>
<!-- <template v-if="dateValue.start && dateValue.end">
{{ dateValue.start }} - {{ dateValue.end }}
</template>
<template v-else> -->
自定义
<!-- </template> -->
</div>
</div>
<tab
:list="tabList"
@change="change"
title-class="tab-item"
:ellipsis="false"
>
</tab>
</div>
<template v-if="flag">
<template v-if="list.length">
<scroll-view
class="list-box"
@ReachBottom="onReachBottom"
ref="scrollView"
>
<div class="box">
<template v-for="(i,index) in list">
<div
class="item"
:key="index"
>
<div class="title flex">佛山市顺德广治汽车销售服务有限公司</div>
<div class="content">
<div class="content-item">
<div class="label">推送时间:</div>
<div class="value">2023-5-5 17:31:23</div>
</div>
<div class="content-item">
<div class="label">所属园区:</div>
<div class="value">D+安徽合肥膜捷园区店</div>
</div>
<div class="content-item">
<div class="label">推送群聊:</div>
<div class="value">群聊名称群聊名称、群聊名称群聊名称群聊名称、群聊名称群聊名称群聊名称群聊名称群聊名称群聊名称群聊名称</div>
</div>
</div>
<div class="bottom flex">
推送类型:<span>SA个人喜报</span>
<van-button
block
round
color="#3975C6"
class="bottom-btn"
@click="viewImage(i)"
>查看</van-button>
</div>
</div>
</template>
</div>
</scroll-view>
</template>
<template v-else>
<nothing
class="nothing-box"
image="https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/list-nothing.png"
>暂无可用素材</nothing>
</template>
</template>
<date-popup
:value.sync="showDatePopup"
@confirm="dateValue = $event"
></date-popup>
<van-image-preview
v-model="showImagePreview"
:show-index="false"
:images="['https://wx.qlogo.cn/mmhead/Q3auHgzwzM61IrWiche8MUupVtib5pywzGGu18S4FhgkAEx6pFofTRRQ/0']"
>
<template v-slot:cover>
<div class="image-tips flex">长按保存图片</div>
</template>
</van-image-preview>
</div>
</template>
<script type='text/ecmascript-6'>
import { ImagePreview } from 'vant';
export default {
name: 'paper',
components: {
[ImagePreview.Component.name]: ImagePreview.Component,
},
data () {
return {
tabList: ['全部', '早报', 'SA个人喜报', 'SA喜报', '收款喜报'],
showDatePopup: false,
list: new Array(10),
// list: [],
flag: true,
dateValue: {
start: '',
end: ''
},
showImagePreview: false
}
},
mounted () {
},
methods: {
viewImage(){
this.showImagePreview = true
},
search () { },
change () { },
/**触底分页加载 */
onReachBottom () {
// let { total, params: { pageNum }, list,
let { $refs: {
scrollView
} } = this
// scrollView.loading = false
// if (list.length == total) {
// return scrollView.finished = true
// }
// if (Math.ceil(total / 10) > pageNum) {
// this.params.pageNum = pageNum + 1
// this.getChatLibraryList()
// } else
scrollView.finished = true
},
}
}
</script>
<style scoped lang='scss'>
.search {
display: flex;
background-color: #fff;
.search-box {
flex: 1;
transition: all 1s;
}
/deep/.tab-item {
font-size: 14px;
color: #666666;
}
.date-menu {
flex-shrink: 0;
font-size: 12px;
color: #333333;
padding-right: 16px;
&::after {
border: 4px solid transparent;
border-top-color: #333;
content: '';
display: block;
transform: translateY(2px);
margin-left: 4px;
border-radius: 1px;
}
}
}
/deep/.van-search {
padding: 9px 16px;
}
.list-box {
height: calc(100vh - 100px);
box-sizing: border-box;
padding: 10px 16px;
.item {
margin-bottom: 10px;
background: #ffffff;
box-shadow: 0 4px 8px 0 #e0e0e080;
border-radius: 4px;
.title {
font-weight: 500;
font-size: 14px;
color: #282829;
padding: 0 16px;
height: 39px;
}
.content {
padding: 12px 16px;
border-top: 1px solid rgba(194, 194, 194, 0.3);
border-bottom: 1px solid rgba(194, 194, 194, 0.3);
font-size: 12px;
color: #999999;
&-item {
margin-bottom: 8px;
display: flex;
.label {
flex-shrink: 0;
}
.value {
line-height: 16px;
flex: 1;
}
&:last-of-type {
margin-bottom: 0;
}
}
}
.bottom {
font-size: 12px;
color: #999999;
height: 36px;
padding: 0 16px;
span {
color: #3975c6;
}
&-btn {
margin-left: auto;
width: 60px;
height: 24px;
font-weight: 500;
font-size: 12px;
span {
color: #fff;
}
}
}
}
}
.nothing-box {
height: calc(100vh - 99px);
}
.image-tips{
height: 36px;
color: #fff;
justify-content: center;
width: 100vw;
user-select: none;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -5,7 +5,7 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl ...@@ -5,7 +5,7 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
const resolve = dir => path.join(__dirname, dir) const resolve = dir => path.join(__dirname, dir)
// page title // page title
const name = defaultSettings.title || 'vue mobile template' const name = defaultSettings.title || ''
// 生产环境,测试和正式 // 生产环境,测试和正式
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV) const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
// externals // externals
...@@ -59,7 +59,7 @@ module.exports = { ...@@ -59,7 +59,7 @@ module.exports = {
productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。 productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: { devServer: {
disableHostCheck: true, disableHostCheck: true,
port: 9527, // 端口 port: 9528, // 端口
open: false, // 启动后打开浏览器 open: false, // 启动后打开浏览器
public:'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main-lwk/#/', public:'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main-lwk/#/',
overlay: { overlay: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!