Commit 7c6b5cc1 by xinla

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

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