Commit bbda2c95 by 前端

修复bug

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