Commit 7c6b5cc1 by xinla

图片路径问题,pc抓取图片素材问题等

1 parent 87360c67
......@@ -7,7 +7,7 @@ export default {
props: {},
data() {
return {
keywords: '',
keyword: '',
active: 0,
list: [],
loading: false,
......@@ -43,7 +43,7 @@ export default {
<template>
<div>
<van-search
v-model="keywords"
v-model="keyword"
show-action
placeholder="请输入搜索关键词"
@search="search"
......
<script>
import { getTree, getList } from '@/api/material'
import { getTree, getList } from "@/api/material";
export default {
components: {},
props: {
type: {
type: String,
default: '4',
default: "4",
},
multiple: {
type: Boolean,
......@@ -23,82 +23,83 @@ export default {
query: {
pageNum: 1,
pageSize: 10,
categoryId: '',
search: '',
mediaType: '4',
categoryId: "",
search: "",
mediaType: "4",
},
list: [], // 列表
total: 0, // 总条数
treeData: [], // 树
// 树props
treeProps: {
children: 'children',
label: 'name',
children: "children",
label: "name",
},
// 分组props
groupProps: {
// expandTrigger: 'hover',
checkStrictly: true,
children: 'children',
label: 'name',
value: 'id',
children: "children",
label: "name",
value: "id",
emitPath: false,
},
radio: '',
radio: "",
// 树props
treeProps: {
children: 'children',
label: 'name',
children: "children",
label: "name",
},
}
selectedx: []
};
},
watch: {
radio(val) {
this.$emit('change', val)
this.$emit("change", val);
},
},
computed: {},
created() {
this.query.mediaType = this.type
this.getTree()
this.getList()
this.query.mediaType = this.type;
this.getTree();
this.getList();
},
mounted() {},
methods: {
// 获取类目树
getTree() {
getTree(this.type).then(({ data }) => {
this.treeData = data
})
this.treeData = data;
});
},
// 获取素材列表
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
page && (this.query.pageNum = page);
this.loading = true;
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
this.$emit('listChange', this.list)
this.list = rows;
this.total = +total;
this.loading = false;
this.$emit("listChange", this.list);
})
.catch(() => {
this.loading = false
})
this.loading = false;
});
},
// 节点单击事件
handleNodeClick(data) {
this.query.categoryId = data.id
this.getList(1)
this.query.categoryId = data.id;
this.getList(1);
},
// 多选框选中数据
handleSelectionChange(selection) {
this.$emit('update:selected', selection)
this.$emit("update:selected", selection);
},
},
}
};
</script>
<template>
......@@ -114,7 +115,7 @@ export default {
<el-input
v-model="query.search"
class="ml10 mr10"
style="width: 150px;"
style="width: 150px"
@keydown.enter="getList(1)"
></el-input>
<el-button
......@@ -200,23 +201,25 @@ export default {
</el-table>
<el-row v-else :gutter="20">
<el-col
:span="6"
style="margin-bottom: 24px;min-width: 220px;"
v-for="(item, index) in list"
:key="index"
>
<el-card shadow="hover" body-style="padding: 0px;">
<div class="img-wrap">
<el-image :src="item.materialUrl" fit="contain"></el-image>
</div>
<div style="padding: 14px;">
<el-checkbox v-model="ids" :label="item.id">{{
item.materialName
}}</el-checkbox>
</div>
</el-card>
</el-col>
<el-checkbox-group v-model="selectedx" @change="handleSelectionChange">
<el-col
:span="6"
style="margin-bottom: 24px; min-width: 220px"
v-for="(item, index) in list"
:key="index"
>
<el-card shadow="hover" body-style="padding: 0px;">
<div class="img-wrap">
<el-image :src="item.materialUrl" fit="contain"></el-image>
</div>
<div style="padding: 14px">
<el-checkbox :label="item">{{
item.materialName
}}</el-checkbox>
</div>
</el-card>
</el-col>
</el-checkbox-group>
</el-row>
</el-col>
</el-row>
......
......@@ -33,6 +33,7 @@ export default {
window.CONFIG.services.wecom +
'/material/upload',
headers: window.CONFIG.headers,
domain: process.env.VUE_APP_BASE_API
}
},
watch: {},
......@@ -131,7 +132,7 @@ export default {
>
<slot>
<template v-if="fileUrl">
<img v-if="type === '0'" :src="fileUrl" class="upload-img" />
<img v-if="type === '0'" :src="domain + fileUrl" class="upload-img" />
<div v-else-if="type === '2'">
<video
id="myVideo"
......@@ -144,7 +145,7 @@ export default {
:autoplay="false"
preload="auto"
>
<source :src="fileUrl" type="video/mp4" />
<source :src="domain + fileUrl" type="video/mp4" />
</video>
</div>
<div v-else>{{ fileName }}</div>
......
......@@ -60,7 +60,7 @@ export default {
background: 'rgba(0, 0, 0, 0.7)',
})
this.metarialParams.materialIds = this.selectedMaterial.map((d) => d.id)
if (metarialParams.checkAll == 0) {
if (this.metarialParams.checkAll == 0) {
this.metarialParams.materialIds = []
}
getMaterial(this.metarialParams)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!