Commit 494a1661 by xinla

抓取素材问题

1 parent b293e2f7
......@@ -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
})
}
<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"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!