Commit 81eb7247 by xinlaa

聊天工具栏接口调试

1 parent 0d9c0c46
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/chat'
/**
*
* @param {*} params
*/
export function getList(params) {
return request({
url: service + '/side/list',
params: {
h5: 0,
},
})
}
/**
* 更新侧边栏信息
* @param {*} data
* {
"sideId": "",
"mediaType": "0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报",
"sideName": "聊天工具栏名称",
"total": "已抓取素材数量",
"using": "是否启用 0 启用 1 未启用"
}
*/
export function update(data) {
return request({
url: service + '/side',
method: 'put',
data,
})
}
/**
* 侧边栏抓取素材
* @param {*} data
* {
"sideId": "",
"materialIds": "素材id列表",
"mediaType": "素材类型 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报",
"checkAll": "是否全选 0 全选 1 非全选"
}
*/
export function getMaterial(data) {
return request({
url: service + '/item',
method: 'POST',
data,
})
}
<script> <script>
import { getList, update, getMaterial } from '@/api/appTool/chatBar'
export default { export default {
components: {}, components: {},
props: {}, props: {},
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
list: [ loading: false,
{ type: "文本类型", name: "企业资料", number: 105, isStart: 1 }, list: [],
{ type: "图片类型", name: "图片类型", number: 86, isStart: 1 }, mediaType: Object.freeze({
{ type: "网页类型", name: "网页类型", number: 55, isStart: 1 }, 0: '图片',
{ type: "文件类型", name: "文件类型", number: 667, isStart: 1 }, 1: '语音',
{ type: "视频类型", name: "视频类型", number: 29, isStart: 1 } 2: '视频',
] 3: '普通文件',
}; 4: '文本',
5: '海报',
}),
}
}, },
watch: {}, watch: {},
computed: {}, computed: {},
created() {}, created() {
this.getList()
},
mounted() {}, mounted() {},
methods: {} methods: {
}; getList() {
this.loading = true
getList()
.then(({ rows, total }) => {
this.list = rows
this.loading = false
})
.catch(() => {
this.loading = false
})
},
getMaterial(data) {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
// this.loading = true
getMaterial(data)
.then(({ rows, total }) => {
this.list = rows
this.loading = false
})
.catch(() => {
this.loading = false
})
},
update(data) {
// this.loading = true
update(data)
.then(() => {
this.msgSuccess('操作成功')
this.loading = false
})
.catch(() => {
this.loading = false
})
},
},
}
</script> </script>
<template> <template>
<div> <div>
...@@ -36,36 +83,37 @@ export default { ...@@ -36,36 +83,37 @@ export default {
<div slot="header"> <div slot="header">
<span>抓取快捷回复素材</span> 素材抓取后,即可在聊天工具栏使用 <span>抓取快捷回复素材</span> 素材抓取后,即可在聊天工具栏使用
</div> </div>
<el-table <el-table v-loading="loading" :data="list">
v-loading="loading" <el-table-column label="素材类型" align="center" prop="mediaType">
:data="list" <template slot-scope="scope">
@selection-change="handleSelectionChange" {{ mediaType[scope.row.mediaType] }}
> </template>
<el-table-column type="selection" width="55" align="center" /> </el-table-column>
<el-table-column label="素材类型" align="center" prop="type" /> <el-table-column
<el-table-column label="聊天工具栏名称" align="center" prop="name" /> label="聊天工具栏名称"
<el-table-column label="已抓取素材数量" align="center" prop="number" /> align="center"
prop="sideName"
/>
<el-table-column label="已抓取素材数量" align="center" prop="total" />
<el-table-column <el-table-column
label="是否启用" label="是否启用"
align="center" align="center"
prop="isStart" prop="using"
width="180" width="180"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-model="scope.row.isStart" v-model="scope.row.using"
:active-value="1" :active-value="0"
:inactive-value="0" :inactive-value="1"
inactive-color="#ff4949" inactive-color="#ddd"
@change="update(scope.row)"
></el-switch> ></el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" prop="operId"> <el-table-column label="操作" align="center" prop="operId">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button type="text" @click="handleView(scope.row, scope.index)"
size="mini"
type="text"
@click="handleView(scope.row, scope.index)"
>抓取素材</el-button >抓取素材</el-button
> >
</template> </template>
......
...@@ -28,7 +28,6 @@ export default { ...@@ -28,7 +28,6 @@ export default {
} }
}, },
created() { created() {
console.log('caread', 1)
this.getList() this.getList()
}, },
methods: { methods: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!