|
|
@@ -17,8 +17,8 @@
|
|
|
type="drag"
|
|
|
:max-size="$config.uploadFileConfig.maxSize"
|
|
|
:multiple="multiple"
|
|
|
- :action="$config.uploadUrl"
|
|
|
- :data="{'folder':folder}"
|
|
|
+ :action="uploadUrl"
|
|
|
+ :data="{'folder':folderData}"
|
|
|
:before-upload="beforeUpload">
|
|
|
<div style="width: 120px;height:120px;line-height: 120px;">
|
|
|
<Icon type="ios-camera" size="32"/>
|
|
|
@@ -45,11 +45,11 @@
|
|
|
style="cursor: pointer;line-height: 120px;font-size: 40px;opacity: 0;color: #fff;" type="md-eye"/>
|
|
|
<div v-if="item.type!='img' && item.type!='video'" class="other">
|
|
|
<Icon type="md-document" size="30"/>
|
|
|
- <a @click="openOther(item)">{{item.name}}</a>
|
|
|
+ <a @click="openOther(item)">{{ item.name }}</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-if="!onlyShow"
|
|
|
- style="width: 240px;height:50px;background-color: #00000096;transform: rotate(45deg);margin-top: -20px;"></div>
|
|
|
+ style="width: 240px;height:50px;background-color: #00000096;transform: rotate(45deg);margin-top: -20px;"></div>
|
|
|
<Icon type="md-close" @click="delItem(index,1)" v-if="!onlyShow"
|
|
|
style="font-size:20px;color: white;position: absolute;right: 0;top:0;cursor: pointer;"/>
|
|
|
</div>
|
|
|
@@ -61,17 +61,21 @@
|
|
|
okText="下载"
|
|
|
cancelText="关闭"
|
|
|
:title="currentItem.name">
|
|
|
- <video :src="currentItem.fullPath ? currentItem.fullPath : $config.imgUrl+currentItem.path" autoplay controls v-if="currentItem.type=='video'"
|
|
|
+ <video :src="currentItem.fullPath ? currentItem.fullPath : $config.imgUrl+currentItem.path" autoplay controls
|
|
|
+ v-if="currentItem.type=='video'"
|
|
|
style="width: 480px;height:320px;"></video>
|
|
|
- <img :src="currentItem.fullPath ? currentItem.fullPath : $config.imgUrl+currentItem.path" v-if="currentItem.type=='img'" style="width: 480px;"/>
|
|
|
+ <img :src="currentItem.fullPath ? currentItem.fullPath : $config.imgUrl+currentItem.path"
|
|
|
+ v-if="currentItem.type=='img'" style="width: 480px;"/>
|
|
|
</Modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import store from "@/store";
|
|
|
+
|
|
|
export default {
|
|
|
name: 'DkPicWall',
|
|
|
- model:{
|
|
|
+ model: {
|
|
|
prop: "uploadListOuter", // 这个字段,是指父组件设置 v-model 时,将变量值传给子组件的 msg
|
|
|
event: "update" // 这个字段,是指父组件监听 parent-event 事件
|
|
|
},
|
|
|
@@ -81,9 +85,9 @@ export default {
|
|
|
default: () => [],
|
|
|
},
|
|
|
// 是否禁用
|
|
|
- disabled:{
|
|
|
- type:Boolean,
|
|
|
- default:false
|
|
|
+ disabled: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
},
|
|
|
// 是否上传多个
|
|
|
multiple: {
|
|
|
@@ -107,28 +111,43 @@ export default {
|
|
|
format: {
|
|
|
type: Array
|
|
|
},
|
|
|
+ // 表名
|
|
|
+ table: {
|
|
|
+ type: String
|
|
|
+ }
|
|
|
},
|
|
|
data() {
|
|
|
+ let self = this
|
|
|
return {
|
|
|
+ uploadUrl: self.$config.uploadUrl,
|
|
|
videoSrc: '',
|
|
|
currentItem: {},
|
|
|
modalFlag: false,
|
|
|
goodsCode: null,
|
|
|
dragIndex: null,
|
|
|
- uploadListInner:this.uploadListOuter,
|
|
|
+ uploadListInner: this.uploadListOuter,
|
|
|
+ // 配置存放的文件夹 公司code - 表名 - 年月 -- 日
|
|
|
+ folderData: self.$store.state.user.cpCode + '/' + self.table + '/' + new Date().toYearMonth2() + '/' + new Date().toDay(),
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
// this.uploadListInner=this.uploadListOuter;
|
|
|
+ if (store.state.user.svcCode) {
|
|
|
+ this.uploadUrl = this.uploadUrl.replace('mdm-server', 'mdm-server' + '-' + store.state.user.svcCode.replace('_', '-'))
|
|
|
+ }
|
|
|
},
|
|
|
+ // computed:{
|
|
|
+ // folderData()
|
|
|
+ // },
|
|
|
watch: {
|
|
|
// 监听uploadList变化
|
|
|
uploadListInner(n, o) {
|
|
|
+ console.log('tt',this.uploadListInner)
|
|
|
this.$emit("update", this.uploadListInner);
|
|
|
|
|
|
},
|
|
|
- uploadListOuter(n, o){
|
|
|
- this.uploadListInner=this.uploadListOuter;
|
|
|
+ uploadListOuter(n, o) {
|
|
|
+ this.uploadListInner = this.uploadListOuter;
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -138,7 +157,7 @@ export default {
|
|
|
* @date : 2022-5-25 19:20
|
|
|
*/
|
|
|
beforeUpload(file) {
|
|
|
- if (!this.accept && !(this.$config.uploadFileConfig.acceptPicType+','+this.$config.uploadFileConfig.acceptVideoType).split(',').includes(file.type)) {
|
|
|
+ if (!this.accept && !(this.$config.uploadFileConfig.acceptPicType + ',' + this.$config.uploadFileConfig.acceptVideoType).split(',').includes(file.type)) {
|
|
|
this.$Message.warning('图片格式不在允许的范围内')
|
|
|
return false
|
|
|
}
|
|
|
@@ -155,26 +174,28 @@ export default {
|
|
|
uploadSuccess(res, file) {
|
|
|
if (res.code == 200 && res.data) {
|
|
|
if (!this.multiple) {
|
|
|
- this.uploadListInner = [
|
|
|
- {
|
|
|
- 'type': this.getFileType(res.data),
|
|
|
- 'path': res.data,
|
|
|
- 'name': file.name,
|
|
|
- 'createTime': new Date().format()
|
|
|
- }
|
|
|
- ]
|
|
|
+ // this.uploadListInner = [
|
|
|
+ // {
|
|
|
+ // 'type': this.getFileType(res.data),
|
|
|
+ // 'path': res.data,
|
|
|
+ // 'name': file.name,
|
|
|
+ // 'createTime': new Date().format()
|
|
|
+ // }
|
|
|
+ // ]
|
|
|
+ this.uploadListInner = [...res.data]
|
|
|
} else {
|
|
|
- if (!this.uploadListInner){
|
|
|
+ if (!this.uploadListInner) {
|
|
|
this.uploadListInner = []
|
|
|
}
|
|
|
- this.uploadListInner.push(
|
|
|
- {
|
|
|
- 'type': this.getFileType(res.data),
|
|
|
- 'path': res.data,
|
|
|
- 'name': file.name,
|
|
|
- 'createTime': new Date().format()
|
|
|
- }
|
|
|
- )
|
|
|
+ this.uploadListInner.push(res.data)
|
|
|
+ // this.uploadListInner.push(
|
|
|
+ // {
|
|
|
+ // 'type': this.getFileType(res.data),
|
|
|
+ // 'path': res.data,
|
|
|
+ // 'name': file.name,
|
|
|
+ // 'createTime': new Date().format()
|
|
|
+ // }
|
|
|
+ // )
|
|
|
}
|
|
|
} else {
|
|
|
this.$Message.warning(res.message)
|
|
|
@@ -206,7 +227,7 @@ export default {
|
|
|
},
|
|
|
fullScreenShow() {
|
|
|
// window.location.href = this.currentItem.path
|
|
|
- window.open(this.currentItem.fullPath ? this.currentItem.fullPath : this.$config.imgUrl+this.currentItem.path)
|
|
|
+ window.open(this.currentItem.fullPath ? this.currentItem.fullPath : this.$config.imgUrl + this.currentItem.path)
|
|
|
},
|
|
|
openModal(item) {
|
|
|
|
|
|
@@ -218,7 +239,7 @@ export default {
|
|
|
* @author : 洪旭东
|
|
|
* @date : 2022-07-21 19:59
|
|
|
*/
|
|
|
- openOther(item){
|
|
|
+ openOther(item) {
|
|
|
window.open(this.$config.imgUrl + item.path)
|
|
|
},
|
|
|
getVideoBase64(list, returnList) {
|
|
|
@@ -240,7 +261,7 @@ export default {
|
|
|
// 创建一个video节点
|
|
|
const video = document.createElement('video')
|
|
|
// const video = document.getElementById('video-haha')
|
|
|
- video.setAttribute('src', this.$config.imgUrl+tlist[0].path)
|
|
|
+ video.setAttribute('src', this.$config.imgUrl + tlist[0].path)
|
|
|
video.setAttribute('crossOrigin', 'anonymous')
|
|
|
// video.preload = 'preload'
|
|
|
video.crossOrigin = 'anonymous'
|
|
|
@@ -274,10 +295,10 @@ export default {
|
|
|
allowDropIn(e, i) {
|
|
|
// console.log('this.dragIndex',i)
|
|
|
},
|
|
|
- drop(index){
|
|
|
- let arr =this.uploadListInner;
|
|
|
- [arr[this.dragIndex],arr[index]]=[arr[index],arr[this.dragIndex]];//es6解构赋值,交换元素位置
|
|
|
- this.uploadListInner=[...arr];
|
|
|
+ drop(index) {
|
|
|
+ let arr = this.uploadListInner;
|
|
|
+ [arr[this.dragIndex], arr[index]] = [arr[index], arr[this.dragIndex]];//es6解构赋值,交换元素位置
|
|
|
+ this.uploadListInner = [...arr];
|
|
|
},
|
|
|
handleDragStart(e) {
|
|
|
this.dragIndex = e
|
|
|
@@ -323,8 +344,7 @@ export default {
|
|
|
return value2 - value1
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
- }
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|