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>
import { getList, update, getMaterial } from '@/api/appTool/chatBar'
export default {
components: {},
props: {},
data() {
return {
dialogVisible: false,
list: [
{ type: "文本类型", name: "企业资料", number: 105, isStart: 1 },
{ type: "图片类型", name: "图片类型", number: 86, isStart: 1 },
{ type: "网页类型", name: "网页类型", number: 55, isStart: 1 },
{ type: "文件类型", name: "文件类型", number: 667, isStart: 1 },
{ type: "视频类型", name: "视频类型", number: 29, isStart: 1 }
]
};
loading: false,
list: [],
mediaType: Object.freeze({
0: '图片',
1: '语音',
2: '视频',
3: '普通文件',
4: '文本',
5: '海报',
}),
}
},
watch: {},
computed: {},
created() {},
created() {
this.getList()
},
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>
<template>
<div>
......@@ -36,36 +83,37 @@ export default {
<div slot="header">
<span>抓取快捷回复素材</span> 素材抓取后,即可在聊天工具栏使用
</div>
<el-table
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="素材类型" align="center" prop="type" />
<el-table-column label="聊天工具栏名称" align="center" prop="name" />
<el-table-column label="已抓取素材数量" align="center" prop="number" />
<el-table v-loading="loading" :data="list">
<el-table-column label="素材类型" align="center" prop="mediaType">
<template slot-scope="scope">
{{ mediaType[scope.row.mediaType] }}
</template>
</el-table-column>
<el-table-column
label="聊天工具栏名称"
align="center"
prop="sideName"
/>
<el-table-column label="已抓取素材数量" align="center" prop="total" />
<el-table-column
label="是否启用"
align="center"
prop="isStart"
prop="using"
width="180"
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.isStart"
:active-value="1"
:inactive-value="0"
inactive-color="#ff4949"
v-model="scope.row.using"
:active-value="0"
:inactive-value="1"
inactive-color="#ddd"
@change="update(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="操作" align="center" prop="operId">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleView(scope.row, scope.index)"
<el-button type="text" @click="handleView(scope.row, scope.index)"
>抓取素材</el-button
>
</template>
......
......@@ -28,7 +28,6 @@ export default {
}
},
created() {
console.log('caread', 1)
this.getList()
},
methods: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!