Commit bbda2c95 by 前端

修复bug

1 parent a1d16ba5
......@@ -93,6 +93,7 @@ let baseFlag = true;
const getBaseUrl = () => {
return new Promise((resolve, reject) => {
let BASE_URL = store.state.baseURL;
//let BASE_URL = 'http://eshield.test.glsx.com.cn';
if(!BASE_URL && baseFlag) {
baseFlag = false;
instance({
......@@ -100,8 +101,10 @@ const getBaseUrl = () => {
method: 'get'
}).then((res) => {
const resData = res.data;
console.log(resData);
if(resData) {
const resBaseURL = resData.axios.baseURL;
//const resBaseURL = resData.axios.baseURL;
store.commit('updateBaseURL', resBaseURL);
baseFlag = !resBaseURL;
resolve(resBaseURL);
......@@ -120,6 +123,7 @@ const getBaseUrl = () => {
};
const HTTP_POST = (baseUrl, options) => {
instance({
url: baseUrl + options.url,
method: 'post',
......
<template>
<div class="image_list_page">
<template v-if="imgList && imgList.length">
<div
class="image_cell"
v-for="(item, index) in imgList"
:key="`img_upload_${index}`"
>
<image-upload
:value="item"
:status="status"
:limit="1"
@change="onChange('imgList')"
></image-upload>
<div class="image_name" :title="item.originName">
{{ item.originName || item.name }}
<template v-for="(item, index) in imgList">
<div class="image_cell" :key="`img_upload_${index}`" v-if="index < 20">
<image-upload
:value="item"
:status="status"
:limit="1"
@change="onChange('imgList')"
></image-upload>
<div class="image_name" :title="item.originName">
{{ item.originName || item.name }}
</div>
</div>
</div>
</template>
</template>
<ImageOtherUpload
v-model="otherList"
:limit="limit"
:list="otherList"
:limit="20-imgList.length"
:status="status"
:nameIndex="otherList.length"
@change="onChange('otherList')"
......@@ -29,6 +28,7 @@
<script>
import ImageUpload from "./image.vue";
import ImageOtherUpload from "./otherImage.vue";
import {deepClone} from '@/utils/util';
export default {
name: "ImageList",
components: {
......@@ -66,13 +66,15 @@ export default {
}
});
let len = m.length;
if (len <= 20) {
this.limit = 20 - len;
} else {
this.limit = 1;
}
console.log(this.limit);
// let len = m.length;
// if (len <= 20) {
// this.limit = 20 - len - _other.length;
// } else {
// this.limit = 1;
// }
// let _num = 20 - len - Number(_other.length);
// this.limit = _num > 0 ? _num : 0;
// console.log(this.limit);
this.imgList = m;
this.otherList = _other;
},
......@@ -89,8 +91,8 @@ export default {
methods: {
// 监听图片组件删除、上传更新
onChange(id) {
console.log(id);
let _list = this.imgList.concat(this.otherList);
let m = deepClone(this.imgList);
let _list = m.concat(this.otherList);
console.log(_list);
this.$emit("input", _list);
},
......@@ -100,11 +102,13 @@ export default {
<style lang="scss" scoped>
.image_list_page {
display: flex;
flex-wrap: wrap;
// display: flex;
// flex-wrap: wrap;
overflow: hidden;
.image_cell {
width: 120px;
margin: 0 10px 10px 0;
float: left;
}
.image_name {
height: 30px;
......
......@@ -77,7 +77,7 @@
</el-popover>
</el-form-item>
<template v-for="(item,index) in editForm.snList">
<div class="form_flex form_device_flex" :key="index">
<div class="form_flex form_device_flex" :key="index" v-if="index>=0">
<el-form-item label="设备SN号:" :prop="'snList.' + index + '.sn'" :rules="deviceRules">
<el-input v-model.number="item.sn" maxlength="20" placeholder="请输入设备号" :disabled="editForm.orderStatus == 5 || editForm.orderStatus == 2"></el-input>
</el-form-item>
......
<template>
<div class="image_upload_page">
<!-- 图片列表 开始 -->
<div class="img_cell" v-for="(item, index) in imgList" :key="index">
<div class="el_img_box">
<i
class="el-icon-error el_icon"
@click="removeImage(item)"
v-if="readStatus != 1"
></i>
<el-image
class="el_img"
:src="item.path"
:preview-src-list="getPreViewList(item.path, imgList)"
></el-image>
<template v-for="(item, index) in imgList">
<div class="img_cell" :key="index" v-if="limit > 0">
<div class="el_img_box">
<i
class="el-icon-error el_icon"
@click="removeImage(item)"
v-if="readStatus != 1"
></i>
<el-image
class="el_img"
:src="item.path"
:preview-src-list="getPreViewList(item.path, imgList)"
></el-image>
</div>
<div class="image_name" :title="item.originName">
{{ item.originName || item.name }}
</div>
</div>
<div class="image_name" :title="item.originName">
{{ item.originName || item.name }}
</div>
</div>
</template>
<!-- 图片列表 end -->
......@@ -72,7 +74,7 @@ export default {
readStatus: "",
acceptFile: ".jpg,.png",
previewList: [],
idx:0
idx: 0,
};
},
watch: {
......@@ -92,12 +94,12 @@ export default {
},
immediate: true,
},
nameIndex:{
handler:function(n){
this.idx = n
},
immediate:true
}
nameIndex: {
handler: function (n) {
this.idx = n;
},
immediate: true,
},
},
mounted() {},
methods: {
......@@ -232,10 +234,11 @@ export default {
</style>
<style lang="scss" scoped>
.image_upload_page {
display: flex;
flex-wrap: wrap;
// display: flex;
// flex-wrap: wrap;
}
.img_cell {
float: left;
display: flex;
flex-wrap: wrap;
flex-direction: column;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!