Commit 64623ddc by ext.shengxiyong1

Merge branch 'master' of https://gitee.com/LinkWeChat/link-wechat

2 parents 15c35290 d6626035
......@@ -31,9 +31,7 @@ export default {
// this.$toast('agentId:' + this.agentId)
this.$router.onReady(() => {
const noAuth = this.$router.app.$route.meta
? this.$router.app.$route.meta.noAuth
: false
const noAuth = this.$router.app.$route.meta ? this.$router.app.$route.meta.noAuth : false
if (!code && !noAuth) {
this.$toast('未获得授权')
......@@ -67,10 +65,7 @@ export default {
async wxConfig() {
this.$store.state.agentConfigStatus = false
try {
let { data } = await getAgentTicket(
window.location.href.split('#')[0],
this.agentId
)
let { data } = await getAgentTicket(window.location.href.split('#')[0], this.agentId)
let { timestamp, nonceStr, signature } = data
wx.agentConfig({
beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
......@@ -90,7 +85,7 @@ export default {
], //必填
success: (res) => {
// 回调
this.$toast('agentId成功:')
// this.$toast('agentId成功:')
this.$store.state.agentConfigStatus = true
},
fail: (res) => {
......
......@@ -15,7 +15,11 @@ export default {
// userId: this.$store.state.userId,
}
},
watch: {},
watch: {
userId() {
this.getList()
}
},
computed: {
userId() {
return this.$store.state.userId
......@@ -29,6 +33,7 @@ export default {
mounted() {},
methods: {
getList() {
this.list = []
getTypeList().then(({ rows, total }) => {
this.userId &&
this.list.push({
......
......@@ -7,11 +7,23 @@ const service = window.CONFIG.services.wecom + '/chat'
*/
export function getList() {
return request({
url: service + '/side/list',
url: service + '/side/list'
})
}
/**
* 查询素材列表
* @param {*} params
* { categoryId:类目id
search:搜索的值
mediaType: '' 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file), 4 文本
}
*/
export function getMaterialList(params) {
return request({ url: '/wecom/chat/item/mList', params })
}
/**
* 更新侧边栏信息
* @param {*} data
* {
......@@ -26,7 +38,7 @@ export function update(data) {
return request({
url: service + '/side',
method: 'put',
data,
data
})
}
......@@ -44,6 +56,6 @@ export function getMaterial(data) {
return request({
url: service + '/item',
method: 'put',
data,
data
})
}
......@@ -12,7 +12,7 @@ const service = window.CONFIG.services.wecom + '/customer'
"tagIds": "标签id,多个标签,id使用逗号隔开",
"beginTime": "开始时间",
"endTime": "结束时间"
status: 0 客户状态 0正常 1删除
delFlag: 0 客户状态 0正常 1删除
}
*/
export function getListNew(params) {
......@@ -23,6 +23,20 @@ export function getListNew(params) {
})
}
/**
* 客户列表
* @param {*} params
* {
"pageNum": "当前页",
"pageSize": "每页显示条数",
"name": "客户名称",
"userId": "添加人id",
"tagIds": "标签id,多个标签,id使用逗号隔开",
"beginTime": "开始时间",
"endTime": "结束时间"
status: 0 客户状态 0正常 1删除
}
*/
export function getList(params) {
return request({
url: service + '/list',
......
<script>
import { getTree, getList } from '@/api/material'
import { getMaterialList } from '@/api/appTool/chatBar'
export default {
components: {},
props: {
......@@ -15,6 +16,11 @@ export default {
selected: {
type: Array,
default: () => []
},
// 是否使用素材抓取回显选中
isCheck: {
type: Boolean,
default: false
}
},
data() {
......@@ -78,11 +84,28 @@ export default {
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
;(this.isCheck ? getMaterialList : getList)(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
if (this.isCheck) {
let selected = this.list.filter((d) => d.isCheck)
this.$emit('update:selected', selected)
// 选中回显
if ([1, 3, 4].includes(+this.type)) {
this.$nextTick(() => {
selected.forEach((row) => {
this.$refs.table.toggleRowSelection(row, true)
})
})
} else {
this.selectedx = selected
}
}
this.$emit('listChange', this.list)
})
.catch(() => {
......@@ -178,7 +201,7 @@ export default {
:total="total"
></el-pagination>
</div>
<el-table v-if="[1, 3, 4].includes(+type)" :data="list" @selection-change="handleSelectionChange">
<el-table ref="table" v-if="[1, 3, 4].includes(+type)" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column v-if="type == 4" prop="content" label="文本内容"></el-table-column>
<el-table-column v-else prop="materialName" label="素材名称"></el-table-column>
......
......@@ -100,9 +100,7 @@ export default {
<div>
<div>
配置聊天工具栏,方便成员在外部会话中查看和使用,提高服务效率。
<el-button type="text" @click="$router.push('explain')"
>图文详解</el-button
>
<el-button type="text" @click="$router.push('explain')">图文详解</el-button>
<!-- <el-button type="text" @click="$router.push({ path: 'config' })"
>查看已配置信息</el-button
> -->
......@@ -126,16 +124,8 @@ export default {
{{ row.sideName }}
</span>
<i
v-if="!row.isEdit"
class="row-icon el-icon-edit"
@click="$set(row, 'isEdit', true)"
></i>
<i
v-else
class="row-icon el-icon-circle-check"
@click="update(row)"
></i>
<i v-if="!row.isEdit" class="row-icon el-icon-edit" @click="$set(row, 'isEdit', true)"></i>
<i v-else class="row-icon el-icon-circle-check" @click="update(row)"></i>
</template>
</el-table-column>
<el-table-column label="已抓取素材数量" align="center" prop="total" />
......@@ -152,9 +142,7 @@ export default {
</el-table-column>
<el-table-column label="操作" align="center" prop="operId">
<template slot-scope="scope">
<el-button type="text" @click="openDialog(scope.row)"
>抓取素材</el-button
>
<el-button type="text" @click="openDialog(scope.row)">抓取素材</el-button>
</template>
</el-table-column>
</el-table>
......@@ -213,11 +201,9 @@ export default {
</el-row>
</el-card> -->
<el-dialog
:title="`抓取${mediaType[metarialParams.mediaType]}类型素材库`"
:visible.sync="dialogVisible"
>
<el-dialog :title="`抓取${mediaType[metarialParams.mediaType]}类型素材库`" :visible.sync="dialogVisible">
<SelectMaterialMult
isCheck
:selected.sync="selectedMaterial"
:type="metarialParams.mediaType"
:key="metarialParams.mediaType"
......
<script>
import {
getList,
exportCustomer,
lossRemind,
getLossRemindStatus
} from '@/api/customer'
import { getListNew, exportCustomer, lossRemind, getLossRemindStatus } from '@/api/customer'
import { getList as getListTag } from '@/api/customer/tag'
import { getList as getListOrganization } from '@/api/organization'
import SelectUser from '@/components/SelectUser'
......@@ -24,7 +19,7 @@ export default {
tagIds: '', // "标签id,多个标签,id使用逗号隔开",
beginTime: '', // "开始时间",
endTime: '', // "结束时间"
status: 1
delFlag: 1
},
queryTag: [], // 搜索框选择的标签
queryUser: [], // 搜索框选择的添加人
......@@ -80,7 +75,7 @@ export default {
}
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
getListNew(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
......@@ -169,14 +164,7 @@ export default {
<template>
<div>
<el-form
ref="queryForm"
:inline="true"
:model="query"
label-width="100px"
class="top-search"
size="small"
>
<el-form ref="queryForm" :inline="true" :model="query" label-width="100px" class="top-search" size="small">
<el-form-item label="客户名称" prop="name">
<el-input v-model="query.name" placeholder="请输入"></el-input>
</el-form-item>
......@@ -184,12 +172,7 @@ export default {
<div class="tag-input" @click="dialogVisibleSelectUser = true">
<span class="tag-place" v-if="!queryUser.length">请选择</span>
<template v-else>
<el-tag
type="info"
v-for="(unit, unique) in queryUser"
:key="unique"
>{{ unit.name }}</el-tag
>
<el-tag type="info" v-for="(unit, unique) in queryUser" :key="unique">{{ unit.name }}</el-tag>
</template>
</div>
</el-form-item>
......@@ -209,32 +192,14 @@ export default {
<div class="tag-input" @click="showTagDialog">
<span class="tag-place" v-if="!queryTag.length">请选择</span>
<template v-else>
<el-tag
type="info"
v-for="(unit, unique) in queryTag"
:key="unique"
>{{ unit.name }}</el-tag
>
<el-tag type="info" v-for="(unit, unique) in queryTag" :key="unique">{{ unit.name }}</el-tag>
</template>
</div>
</el-form-item>
<el-form-item label=" ">
<el-button
v-hasPermi="['customerManage:customer:query']"
type="primary"
@click="getList(1)"
>查询</el-button
>
<el-button
v-hasPermi="['customerManage:customer:query']"
type="success"
@click="resetForm()"
>重置</el-button
>
<el-button
v-hasPermi="['customerManage:customer:export']"
type="info"
@click="exportCustomer"
<el-button v-hasPermi="['customerManage:customer:query']" type="primary" @click="getList(1)">查询</el-button>
<el-button v-hasPermi="['customerManage:customer:query']" type="success" @click="resetForm()">重置</el-button>
<el-button v-hasPermi="['customerManage:customer:export']" type="info" @click="exportCustomer"
>导出列表</el-button
>
</el-form-item>
......@@ -264,53 +229,29 @@ export default {
style="width: 100%"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
align="center"
width="55"
></el-table-column>
<el-table-column type="selection" align="center" width="55"></el-table-column>
<el-table-column label="客户" prop="name" align="center">
<template slot-scope="scope">
{{ scope.row.name }}
<span
:style="{ color: scope.row.type === 1 ? '#4bde03' : '#f9a90b' }"
>{{ { 1: '@微信', 2: '@企业微信' }[scope.row.type] }}</span
>
<i
:class="[
'el-icon-s-custom',
{ 1: 'man', 2: 'woman' }[scope.row.gender]
]"
></i>
<span :style="{ color: scope.row.type === 1 ? '#4bde03' : '#f9a90b' }">{{
{ 1: '@微信', 2: '@企业微信' }[scope.row.type]
}}</span>
<i :class="['el-icon-s-custom', { 1: 'man', 2: 'woman' }[scope.row.gender]]"></i>
</template>
</el-table-column>
<el-table-column
prop="corpName"
label="公司名称"
align="center"
></el-table-column>
<el-table-column prop="corpName" label="公司名称" align="center"></el-table-column>
<el-table-column prop="userName" label="添加人(首位)" align="center">
<template slot-scope="scope">{{
scope.row.weFlowerCustomerRels[0].userName
}}</template>
<template slot-scope="scope">{{ scope.row.weFlowerCustomerRels[0].userName }}</template>
</el-table-column>
<el-table-column prop="createTime" label="添加时间" align="center">
<template slot-scope="scope">{{
scope.row.weFlowerCustomerRels[0].createTime
}}</template>
<template slot-scope="scope">{{ scope.row.weFlowerCustomerRels[0].createTime }}</template>
</el-table-column>
<el-table-column prop="address" label="标签" align="center">
<template slot-scope="scope">
<div
v-for="(item, index) in scope.row.weFlowerCustomerRels"
:key="index"
>
<el-tag
type="info"
v-for="(unit, unique) in item.weFlowerCustomerTagRels"
:key="unique"
>{{ unit.tagName }}</el-tag
>
<div v-for="(item, index) in scope.row.weFlowerCustomerRels" :key="index">
<el-tag type="info" v-for="(unit, unique) in item.weFlowerCustomerTagRels" :key="unique">{{
unit.tagName
}}</el-tag>
</div>
</template>
</el-table-column>
......@@ -352,11 +293,7 @@ export default {
</SelectTag>
<!-- 选择添加人弹窗 -->
<SelectUser
:visible.sync="dialogVisibleSelectUser"
title="选择添加人"
@success="selectedUser"
></SelectUser>
<SelectUser :visible.sync="dialogVisibleSelectUser" title="选择添加人" @success="selectedUser"></SelectUser>
</div>
</template>
......
......@@ -71,16 +71,10 @@ export default {
dialogVisible: false, // 素材表格对话框显隐
// 表单校验
rules: Object.freeze({
categoryId: [
{ required: true, message: '不能为空', trigger: 'change' }
],
categoryId: [{ required: true, message: '不能为空', trigger: 'change' }],
content: [{ required: true, message: '不能为空', trigger: 'blur' }],
materialUrl: [
{ required: true, message: '不能为空', trigger: 'change' }
],
materialName: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
materialUrl: [{ required: true, message: '不能为空', trigger: 'change' }],
materialName: [{ required: true, message: '不能为空', trigger: 'blur' }],
digest: [{ required: true, message: '不能为空', trigger: 'blur' }],
coverUrl: [{ required: true, message: '不能为空', trigger: 'blur' }]
})
......@@ -112,7 +106,6 @@ export default {
},
// 获取素材列表
getList(page) {
console.log('getList', page, JSON.stringify(this.query))
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
......@@ -138,10 +131,7 @@ export default {
},
// 类目树节点添加/编辑 0: 添加, 1:编辑
treeEdit(data, type) {
this.treeForm = Object.assign(
{},
type ? data : { parentId: data.id || '0', mediaType: this.type }
)
this.treeForm = Object.assign({}, type ? data : { parentId: data.id || '0', mediaType: this.type })
this.treeDialogVisible = true
},
// 类目树节点提交
......@@ -179,10 +169,7 @@ export default {
this.$parent.dialog.edit = true
break
default:
this.form = Object.assign(
{},
data || { categoryId: this.query.categoryId }
)
this.form = Object.assign({}, data || { categoryId: this.query.categoryId })
this.dialogVisible = true
this.$nextTick(() => {
this.$refs['form'].clearValidate()
......@@ -245,11 +232,7 @@ export default {
<el-row type="flex" justify="space-between">
<el-col :span="6">
<div>
<el-button
v-hasPermi="['wechat:category:add']"
slot="reference"
type="primary"
@click="treeEdit({}, 0)"
<el-button v-hasPermi="['wechat:category:add']" slot="reference" type="primary" @click="treeEdit({}, 0)"
>添加分类</el-button
>
</div>
......@@ -307,34 +290,18 @@ export default {
prefix-icon="el-icon-search"
style="width: 300px;"
/>
<el-button
class="ml10"
@click="getList(1)"
v-hasPermi="['wecom:material:list']"
>搜索</el-button
>
<el-button
v-hasPermi="['wechat:material:remove']"
@click="remove()"
:disabled="selected.length === 0"
<el-button class="ml10" @click="getList(1)" v-hasPermi="['wecom:material:list']">搜索</el-button>
<el-button v-hasPermi="['wechat:material:remove']" @click="remove()" :disabled="selected.length === 0"
>删除</el-button
>
<el-popover placement="top" width="260" v-model="groupDialogVisible">
<div>选择分组</div>
<div style="position: relative; margin: 10px 0;">
<el-cascader
v-model="group"
:options="treeData[0].children"
:props="groupProps"
></el-cascader>
<el-cascader v-model="group" :options="treeData[0].children" :props="groupProps"></el-cascader>
</div>
<div style="text-align: right;">
<el-button size="mini" @click="groupDialogVisible = false"
>取消</el-button
>
<el-button type="primary" size="mini" @click="moveGroup"
>确定</el-button
>
<el-button size="mini" @click="groupDialogVisible = false">取消</el-button>
<el-button type="primary" size="mini" @click="moveGroup">确定</el-button>
</div>
<el-button
v-hasPermi="['wechat:material:resetCategory']"
......@@ -346,10 +313,7 @@ export default {
</el-popover>
<div class="fr">
<el-button
v-hasPermi="['wechat:material:add']"
type="primary"
@click="edit(1, ~~type)"
<el-button v-hasPermi="['wechat:material:add']" type="primary" @click="edit(1, ~~type)"
>添加{{ typeTitle[type] }}</el-button
>
</div>
......@@ -364,17 +328,13 @@ export default {
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList(1)"
@pagination="getList()"
/>
</el-col>
</el-row>
<!-- 分类树添加/编辑弹窗 -->
<el-dialog
:title="(treeForm.id ? '修改' : '添加') + '分类'"
:visible.sync="treeDialogVisible"
width="400px"
>
<el-dialog :title="(treeForm.id ? '修改' : '添加') + '分类'" :visible.sync="treeDialogVisible" width="400px">
<el-form ref="treeForm" :model="treeForm">
<el-form-item>
<el-input
......@@ -404,11 +364,7 @@ export default {
>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="分类" prop="categoryId">
<el-cascader
v-model="form.categoryId"
:options="treeData[0].children"
:props="groupProps"
></el-cascader>
<el-cascader v-model="form.categoryId" :options="treeData[0].children" :props="groupProps"></el-cascader>
</el-form-item>
<el-form-item label="文本内容" prop="content" v-if="type === '4'">
......@@ -430,61 +386,40 @@ export default {
></el-input>
</el-form-item>
<el-form-item label="图片" prop="materialUrl">
<upload
:fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName"
:type="type"
>
<upload :fileUrl.sync="form.materialUrl" :fileName.sync="form.materialName" :type="type">
<div slot="tip">
支持JPG,PNG格式,图片大小不超过2M,建议上传宽高1:1的图片
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input
v-model="form.materialName"
placeholder="请输入"
></el-input>
<el-input v-model="form.materialName" placeholder="请输入"></el-input>
</el-form-item>
</template>
<template v-else-if="type === '1'">
<el-form-item label="语音" prop="materialUrl">
<upload
:fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName"
:type="type"
>
<upload :fileUrl.sync="form.materialUrl" :fileName.sync="form.materialName" :type="type">
<div slot="tip">
只能上传amr格式的语音文件。单个文件大小不超过2M,时长不超过1分钟
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input
v-model="form.materialName"
placeholder="请输入"
></el-input>
<el-input v-model="form.materialName" placeholder="请输入"></el-input>
</el-form-item>
</template>
<template v-else-if="type === '2'">
<el-form-item label="视频" prop="materialUrl">
<upload
:fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName"
:type="type"
>
<upload :fileUrl.sync="form.materialUrl" :fileName.sync="form.materialName" :type="type">
<div slot="tip">
不超过10M, 文件格式: mp4
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input
v-model="form.materialName"
placeholder="请输入"
></el-input>
<el-input v-model="form.materialName" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="封面">
<upload :fileUrl.sync="form.coverUrl" type="0">
......@@ -504,21 +439,14 @@ export default {
<template v-else-if="type === '3'">
<el-form-item label="文件" prop="materialUrl">
<upload
:fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName"
:type="type"
>
<upload :fileUrl.sync="form.materialUrl" :fileName.sync="form.materialName" :type="type">
<div slot="tip">
单个文件大小不超过20M
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input
v-model="form.materialName"
placeholder="请输入"
></el-input>
<el-input v-model="form.materialName" placeholder="请输入"></el-input>
</el-form-item>
</template>
</el-form>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!