Commit 494a1661 by xinla

抓取素材问题

1 parent b293e2f7
...@@ -7,11 +7,23 @@ const service = window.CONFIG.services.wecom + '/chat' ...@@ -7,11 +7,23 @@ const service = window.CONFIG.services.wecom + '/chat'
*/ */
export function getList() { export function getList() {
return request({ 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 * @param {*} data
* { * {
...@@ -26,7 +38,7 @@ export function update(data) { ...@@ -26,7 +38,7 @@ export function update(data) {
return request({ return request({
url: service + '/side', url: service + '/side',
method: 'put', method: 'put',
data, data
}) })
} }
...@@ -44,6 +56,6 @@ export function getMaterial(data) { ...@@ -44,6 +56,6 @@ export function getMaterial(data) {
return request({ return request({
url: service + '/item', url: service + '/item',
method: 'put', method: 'put',
data, data
}) })
} }
<script> <script>
import { getTree, getList } from '@/api/material' import { getTree, getList } from '@/api/material'
import { getMaterialList } from '@/api/appTool/chatBar'
export default { export default {
components: {}, components: {},
props: { props: {
...@@ -15,6 +16,11 @@ export default { ...@@ -15,6 +16,11 @@ export default {
selected: { selected: {
type: Array, type: Array,
default: () => [] default: () => []
},
// 是否使用素材抓取回显选中
isCheck: {
type: Boolean,
default: false
} }
}, },
data() { data() {
...@@ -78,11 +84,28 @@ export default { ...@@ -78,11 +84,28 @@ export default {
getList(page) { getList(page) {
page && (this.query.pageNum = page) page && (this.query.pageNum = page)
this.loading = true this.loading = true
getList(this.query) ;(this.isCheck ? getMaterialList : getList)(this.query)
.then(({ rows, total }) => { .then(({ rows, total }) => {
this.list = rows this.list = rows
this.total = +total this.total = +total
this.loading = false 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) this.$emit('listChange', this.list)
}) })
.catch(() => { .catch(() => {
...@@ -178,7 +201,7 @@ export default { ...@@ -178,7 +201,7 @@ export default {
:total="total" :total="total"
></el-pagination> ></el-pagination>
</div> </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 type="selection" width="55" align="center" />
<el-table-column v-if="type == 4" prop="content" label="文本内容"></el-table-column> <el-table-column v-if="type == 4" prop="content" label="文本内容"></el-table-column>
<el-table-column v-else prop="materialName" label="素材名称"></el-table-column> <el-table-column v-else prop="materialName" label="素材名称"></el-table-column>
......
...@@ -100,9 +100,7 @@ export default { ...@@ -100,9 +100,7 @@ export default {
<div> <div>
<div> <div>
配置聊天工具栏,方便成员在外部会话中查看和使用,提高服务效率。 配置聊天工具栏,方便成员在外部会话中查看和使用,提高服务效率。
<el-button type="text" @click="$router.push('explain')" <el-button type="text" @click="$router.push('explain')">图文详解</el-button>
>图文详解</el-button
>
<!-- <el-button type="text" @click="$router.push({ path: 'config' })" <!-- <el-button type="text" @click="$router.push({ path: 'config' })"
>查看已配置信息</el-button >查看已配置信息</el-button
> --> > -->
...@@ -126,16 +124,8 @@ export default { ...@@ -126,16 +124,8 @@ export default {
{{ row.sideName }} {{ row.sideName }}
</span> </span>
<i <i v-if="!row.isEdit" class="row-icon el-icon-edit" @click="$set(row, 'isEdit', true)"></i>
v-if="!row.isEdit" <i v-else class="row-icon el-icon-circle-check" @click="update(row)"></i>
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> </template>
</el-table-column> </el-table-column>
<el-table-column label="已抓取素材数量" align="center" prop="total" /> <el-table-column label="已抓取素材数量" align="center" prop="total" />
...@@ -152,9 +142,7 @@ export default { ...@@ -152,9 +142,7 @@ export default {
</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 type="text" @click="openDialog(scope.row)" <el-button type="text" @click="openDialog(scope.row)">抓取素材</el-button>
>抓取素材</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -213,11 +201,9 @@ export default { ...@@ -213,11 +201,9 @@ export default {
</el-row> </el-row>
</el-card> --> </el-card> -->
<el-dialog <el-dialog :title="`抓取${mediaType[metarialParams.mediaType]}类型素材库`" :visible.sync="dialogVisible">
:title="`抓取${mediaType[metarialParams.mediaType]}类型素材库`"
:visible.sync="dialogVisible"
>
<SelectMaterialMult <SelectMaterialMult
isCheck
:selected.sync="selectedMaterial" :selected.sync="selectedMaterial"
:type="metarialParams.mediaType" :type="metarialParams.mediaType"
:key="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!