|
@@ -29,6 +29,7 @@
|
|
|
@cancle="isShowSelect = false"
|
|
|
@submit="handleSelect"
|
|
|
:selectableType="['image']"
|
|
|
+ :isMultiSelection="true"
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
@@ -36,8 +37,6 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getMaterialList} from "@/api";
|
|
|
-import { changeByteUnit } from '@/utils/file'
|
|
|
import MaterialSelectorForEditor from "@/components/materialSelectorForEditor.vue";
|
|
|
|
|
|
export default {
|
|
@@ -47,17 +46,8 @@ export default {
|
|
|
props:['image'],
|
|
|
data(){
|
|
|
return {
|
|
|
- type:'image',
|
|
|
- images:[...this.image],
|
|
|
- isShowSelect:false,
|
|
|
- list:[],
|
|
|
- paging: {
|
|
|
- pageSize: 8,
|
|
|
- pageNum: 1,
|
|
|
- total: 0,
|
|
|
- showSize: 4,
|
|
|
- current: 1
|
|
|
- },
|
|
|
+ images: [...this.image],
|
|
|
+ isShowSelect: false,
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
@@ -65,52 +55,17 @@ export default {
|
|
|
let index = this.images.findIndex(i => i.id === item.id)
|
|
|
~index && this.images.splice(index, 1)
|
|
|
},
|
|
|
- selectHandle(){
|
|
|
+ selectHandle() {
|
|
|
this.isShowSelect = true
|
|
|
- this.getMaterialList()
|
|
|
},
|
|
|
- changeCurrent(data){
|
|
|
- this.paging.pageNum = data;
|
|
|
- },
|
|
|
- update(data) {
|
|
|
- this.key = data;
|
|
|
- this.getMaterialList();
|
|
|
- },
|
|
|
- handleSelect(data){
|
|
|
+ handleSelect(data) {
|
|
|
this.images = this.images.concat(data)
|
|
|
this.isShowSelect = false
|
|
|
},
|
|
|
- getMaterialList() {
|
|
|
- getMaterialList(
|
|
|
- {
|
|
|
- pageNum: this.paging.pageNum,
|
|
|
- pageSize: this.paging.pageSize,
|
|
|
- searchKey: this.key,
|
|
|
- type:this.type
|
|
|
- },
|
|
|
- (data) => {
|
|
|
- this.paging.pageNum = data.data.pageNum;
|
|
|
- this.paging.pageSize = data.data.pageSize;
|
|
|
- this.paging.total = data.data.total;
|
|
|
- this.list = data.data.list.map(i=>{
|
|
|
- i.fileSize = changeByteUnit(Number(i.fileSize))
|
|
|
- return i
|
|
|
- })
|
|
|
- }
|
|
|
- );
|
|
|
- },
|
|
|
},
|
|
|
- watch:{
|
|
|
- "paging.pageNum": function () {
|
|
|
- this.isShowSelect && this.getMaterialList();
|
|
|
- },
|
|
|
- isShowSelect(newVal){
|
|
|
- if (!newVal) {
|
|
|
- this.paging.pageNum = 1
|
|
|
- }
|
|
|
- },
|
|
|
- images(newVal){
|
|
|
- if (newVal.length>20) {
|
|
|
+ watch: {
|
|
|
+ images(newVal) {
|
|
|
+ if (newVal.length > 20) {
|
|
|
return this.$alert({ content: "最多添加20张图片" });
|
|
|
}
|
|
|
this.$emit('imageChange',newVal)
|