mushencc пре 3 година
родитељ
комит
0f521ec57b
2 измењених фајлова са 197 додато и 187 уклоњено
  1. 197 186
      src/views/BasicSettings/Setting.vue
  2. 0 1
      src/views/BidSystem/ContractList/edit.vue

+ 197 - 186
src/views/BasicSettings/Setting.vue

@@ -1,204 +1,139 @@
 <template>
+<div>
+      <Toptitle title="项目设置">
+      </Toptitle>
      <div style="padding: 10px" class="setting" dis-hover>
-        <Card title="Options" icon="ios-options" :padding="0"  >
+        <Card :title="examine_title" :padding="0" >
             <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-      <Card title="Options" icon="ios-options" :padding="0"   >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"  >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"  >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"  >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"  >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"  >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"   >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"   >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"   >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"   >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"   >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"   >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0"   >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-            </CellGroup>
-        </Card>
-         <Card title="Options" icon="ios-options" :padding="0" >
-            <CellGroup>
-                <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
-                </Cell>
-                 <Cell title="With Switch">
-                    <i-switch v-model="switchValue" slot="extra" />
+                <Cell :title="item.title" v-for="(item,index) in cell_title" :key="index">
+                    <i-switch v-model="item.state" slot="extra"  @on-change="change($event,index)" />
                 </Cell>
             </CellGroup>
         </Card>
+      <Card :title="logo_title"  :padding="0"   >
+              <a @click="upload" class="upload_pic">上传</a>
+              <div class="product-add">
+                <div
+                  class="items"
+                  v-for="(_item, _index) of tempItem.url"
+                  :key="_index"
+                >
+                  <img
+                    @click="looks(_item)"
+                    :src="$store.state.ip + _item"
+                    alt=""
+                  />
+                  <Icon
+                    size="20"
+                    @click="delItems(_index, tempItem.url)"
+                    class="delete-img"
+                    type="ios-close-circle"
+                  />
+                </div>
 
+                <div class="add-items" v-show="this.tempItem.url.length == 0">
+                  <div class="_item">
+                    <Icon size="50" type="ios-add" />
+                  </div>
+                  <input
+                    @change="changeIpt($event, tempItem.url)"
+                    type="file"
+                    class="ipt"
+                  />
+                </div>
+              </div>
+        </Card>
     </div>
+</div>
 </template>
 <script>
+import { toArray } from 'xe-utils';
 export default {
     data(){
         return {
                 switchValue: true,
-                switch1:true
+                switch1:true,
+                tempItem:{
+                    url:[],
+                },
+                logo_title:'',
+                content:[],
+                examine_title:{},
+                logo_title:{},
+                cell_title:{},
+                tempItem_op:{},
+                examine_data:{}
             }
+    },
+   mounted(){
+        this.axios.get('/api/basics_config_list').then(res=>{
+            this.content = res.data;
+            this.content.forEach(item =>{
+                  if(item.sub_type == 2){
+                      this.examine_title = item.title
+                      this.examine_data = item
+                      this.cell_title =item.content
+                      this.cell_title.forEach(item=>{
+                          if(item.state == 0){
+                              item.state = false
+                          }else{
+                              item.state = true
+                          }
+                      })
+                      console.log(this.cell_title)
+                  }
+                  if(item.sub_type == 3){
+                      this.logo_title = item.title
+                      this.tempItem_op = item
+                      this.tempItem.url = item.content.split(',')
+                      console.log(this.tempItem.url)
+                  }
+            })
+        })
+    },
+    methods:{
+        change(e,index){
+             this.examine_data.content[index].state = e;
+             this.axios.post('/api/basics_config_edit',this.examine_data).then(res=>{
+                 console.log(res)
+             })
+        },
+        upload(){
+            this.tempItem_op.content = this.tempItem.url[0];
+            this.axios.post('/api/basics_config_edit',{...this.tempItem_op}).then(res=>{
+                if(res.code == 200){
+                     this.$Message.success(res.msg)
+                }
+               
+            })
+        },
+        looks(img) {
+      const array = [{ img_url: img }];
+      this.$previewImg({
+        list: array,
+        baseUrl: this.$store.state.ip,
+        baseImgField: "img_url",
+        baseTitleField: "",
+      });
+    },
+    delItems(n, arr) {
+      arr.splice(n, 1);
+    },
+    changeIpt(e, row) {
+      let file = e.target.files[0];
+      this.postImg(file, row);
+      e.target.value = null;
+    },
+    postImg(file, row) {
+      let formData = new FormData();
+      formData.append("file", file);
+      this.axios.post("/api/upload_pic", formData).then((res) => {
+        this.$nextTick(() => {
+          row.push(res.data.url);
+          this.$forceUpdate();
+        });
+      });
+    },
     }
        
         }
@@ -209,6 +144,65 @@ export default {
    display: flex;
    flex-wrap: wrap;
 }
+.product-add {
+  position: relative;
+  top: -20px;
+  height: 140px;
+  .ipt {
+    position: absolute;
+    width: 100%;
+    height: 100%;
+    opacity: 0;
+    cursor: pointer;
+    outline: none;
+    top: 0;
+    left: 0;
+  }
+  .add-items {
+      position: relative;
+      left: 50%;
+      top:40% ;
+      transform: translate(-50%,-50%);
+    width: 40px;
+    height: 40px;
+    border: 1px dotted #e7e7e7;
+    border-radius: 5px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    overflow: hidden;
+    background: #f4f5f7;
+    .item {
+      width: 46px;
+      height: 46px;
+      background: #3764ff;
+      opacity: 0.6;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      border-radius: 50%;
+      color: #fff;
+    }
+  }
+  .items {
+    width: 100px;
+    height: 100px;
+    margin-bottom: 10px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    margin-right: 10px;
+    border-radius: 5px;
+    position: relative;
+    left:50%;
+    top: 40%;
+    transform: translate(-50%,-50%);
+    img {
+      max-width: 100px;
+      max-height: 100px;
+    }
+  }
+}
 /deep/ .ivu-card{
          background:  #f8f8f9;
          width: 250px;
@@ -221,5 +215,22 @@ export default {
 }
  /deep/ .ivu-card-head{
     border-bottom: none;
+    p{
+         font-weight: 800;
+    }
+   
+}
+/deep/ .ivu-card-body{
+    height: 200px;
+}
+.delete-img{
+    position: relative;
+    top:-35px
+}
+.upload_pic{
+    position: relative;
+    top: -38px;
+    right: -196px;
+    color: red;
 }
 </style>

+ 0 - 1
src/views/BidSystem/ContractList/edit.vue

@@ -41,7 +41,6 @@
           @click="showSupModal = true"
           type="primary"
           style="margin-right: 10px"
-          v-show="false"
           >项目辅料</Button
         >
         <Button