xinfeng hace 6 años
padre
commit
7a38aca489

+ 94 - 0
assets/css/kaifain/index.scss

@@ -256,6 +256,100 @@
     text-align: center;
   }
 
+  .toastBox {
+    position: fixed;
+    width: 100vw;
+    height: 100vh;
+    background-color: rgba(0, 0, 0, 0.8);
+    z-index: 888;
+    left: 0;
+    top: 0;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+
+    .toastArea {
+      position: relative;
+      width: 446px;
+      height: 403px;
+      background: rgba(255, 255, 255, 1);
+      border-radius: 3px;
+      padding: 30px 47px;
+
+      .title {
+        font-size: 19px;
+        font-weight: 500;
+        color: rgba(34, 34, 34, 1);
+        line-height: 26px;
+        text-align: center;
+      }
+
+      .tips {
+        margin-top: 8px;
+        margin-bottom: 14px;
+        font-size: 12px;
+        font-weight: 400;
+        color: rgba(153, 153, 153, 1);
+        line-height: 17px;
+        text-align: center;
+      }
+
+      .nameCell, .phoneCell {
+        margin-top: 25px;
+
+        .label {
+          font-size: 14px;
+          font-weight: 500;
+          color: rgba(25, 34, 46, 1);
+          line-height: 20px;
+        }
+        input {
+          margin-top: 5px;
+          padding: 10px;
+          width: 352px;
+          height: 48px;
+          background: rgba(255, 255, 255, 1);
+          border-radius: 3px;
+          border: 1px solid rgba(221, 225, 230, 1);
+        }
+      }
+      .nameCell {
+        margin-top: 39px;
+      }
+
+      .submitBtn {
+        margin-top: 18px;
+        width: 352px;
+        height: 48px;
+        background: rgba(48, 142, 255, 1);
+        box-shadow: 0 2px 6px 0 rgba(48, 142, 255, 0.3);
+        border-radius: 2px;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        cursor: pointer;
+        p {
+          font-size: 14px;
+          font-weight: 500;
+          color: rgba(255, 255, 255, 1);
+          line-height: 20px;
+        }
+      }
+
+      .closeIcon {
+        position: absolute;
+        right: 20px;
+        top: 34px;
+        width: 16px;
+        height: 16px;
+        background: url('~@/assets/img/credit/closeIcon.png') no-repeat;
+        background-size: cover;
+        cursor: pointer;
+      }
+    }
+
+  }
+
 }
 
 .main {

+ 6 - 0
assets/css/kaifain/kaifainAdd.scss

@@ -208,6 +208,7 @@
           }
         }
         .cell {
+          cursor: pointer;
           height: 130px;
           width: 100%;
           display: flex;
@@ -216,6 +217,9 @@
             font-size: 0;
             width: 115px;
             height: 130px;
+            display: flex;
+            justify-content: center;
+            align-items: center;
             img {
               width: 96px;
               height: 96px;
@@ -240,6 +244,7 @@
             justify-content: center;
             align-items: center;
             flex-direction: column;
+            cursor: pointer;
             .icon {
               width: 25px;
               height: 25px;
@@ -261,6 +266,7 @@
             display: flex;
             justify-content: center;
             align-items: center;
+            cursor: pointer;
             .icon {
               width: 18px;
               height: 18px;

+ 109 - 13
assets/css/kaifain/kaifainAddNoScoped.scss

@@ -85,38 +85,107 @@ input {
 }
 
 .diaContentWork {
+  padding:0 25px;
   .taskName, .ourLogo, .taskDesc, .taskFile{
     margin-top: 20px;
-    display: flex;
-    align-items: center;
     .name {
       flex-shrink: 0;
-      height: 20px;
-      font-size: 14px;
-      font-weight: 500;
-      color: #19222e;
-      line-height: 20px;
+      height:20px;
+      font-size:14px;
+      font-weight:500;
+      color:rgba(25,34,46,1);
+      line-height:20px;
+      margin-bottom: 3px;
     }
     .value {
       flex-grow: 1;
-      margin-left: 20px;
-
       .uploadInfo {
         display: flex;
         align-items: center;
-        .right {
+        .left {
+          width: 120px;
+          flex-shrink: 0;
+          overflow: hidden;
+          position: relative;
+          background: #fff;
+          .el-icon-delete {
+            display: none;
+          }
+          .avatar-uploader .el-upload {
+            width: 120px;
+            height: 120px;
+            border: 1px dashed #dce1e8;
+            border-radius: 6px;
+            cursor: pointer;
+            position: relative;
+            overflow: hidden;
+            img {
+              width: 100%;
+              height: auto;
+              object-fit: contain;
+              object-position: top left;
+            }
+          }
+          .avatar-uploader .el-upload:hover {
+            border-color: #409eff;
+            .el-icon-delete {
+              display: block;
+            }
+          }
+          .avatar-uploader-icon {
+            position: absolute;
+            top: 0;
+            left: 0;
+            font-size: 44px;
+            color: #dce1e8;;
+            width: 120px;
+            height: 120px;
+            line-height: 120px;
+            text-align: center;
+          }
+          .avatar {
+            width: 120px;
+            height: 120px;
+            display: block;
+          }
+          .title {
+            position: absolute;
+            left: 50%;
+            bottom: 40px;
+            transform: translateX(-50%);
+            font-size: 13px;
+            font-weight: 500;
+            color: #dce1e8;
+            line-height: 18px;
+            text-decoration: underline;
+          }
 
+          .rightTips {
+            height: 19px;
+            font-size: 13px;
+            font-weight: 400;
+            color: rgba(153, 153, 153, 1);
+            line-height: 19px;
+            text-align: center;
+          }
         }
       }
     }
   }
+
+  .taskDesc {
+    margin-top: 33px;
+  }
 }
 
 
 .dialog-footer {
-  .submit {
-    margin-top: 20px;
-    width:159px;
+  margin-left: 25px;
+  display: flex;
+  .submit, .cancle {
+
+    margin-top: 35px;
+    width:115px;
     height:44px;
     background:rgba(48,142,255,1);
     box-shadow:0px 2px 6px 0px rgba(48,142,255,0.3);
@@ -133,4 +202,31 @@ input {
       line-height:20px;
     }
   }
+  .cancle {
+    margin-left: 10px;
+    background:rgba(236,236,236,1);
+    border-radius:2px;
+    p {
+      color:rgba(102,102,102,1);
+    }
+  }
+}
+
+.uploadFileWord {
+  height:20px;
+  font-size:14px;
+  font-weight:400;
+  color:rgba(0,147,253,1);
+  line-height:20px;
+  text-decoration: underline;
+}
+
+.uploadFileTip {
+  margin-top: 10px;
+  margin-left: 13px;
+  height:17px;
+  font-size:12px;
+  font-weight:400;
+  color:rgba(153,153,153,1);
+  line-height:17px;
 }

+ 48 - 0
mixins/uploadFile.js

@@ -0,0 +1,48 @@
+export default {
+  mounted() {
+  },
+  data() {
+    return {
+      uploadInfo: {},
+      options: {
+        server: 'https://v0.api.upyun.com/programmerinnfile',
+        auto: true,
+        compress: null,
+      },
+      file: null,
+      post_url: ''
+    }
+  },
+  methods: {
+    apiPrepareUpload(file, cb) {
+      let uploadInfo = null;
+      let formData = new FormData()
+      formData.append("filename", file.name);
+      formData.append("target", '{"type":1,"pro_id":38986}');
+      this.$axios.post('/file/prepareUpload', formData,{
+        headers: { "Content-Type": "multipart/form-data" }
+      }).then( (data) => {
+        this.uploadInfo = data.data.data.post_params;
+        this.post_url = data.data.data.post_url;
+        this.apiSend(file, cb)
+      })
+      return uploadInfo;
+    },
+    apiSend(file, cb) {
+      let formData = new FormData()
+      formData.append("file", file);
+      formData.append("name", file.name);
+      for (let key in this.uploadInfo) {
+        console.log('key', key)
+        formData.append(key, this.uploadInfo[key])
+      }
+      console.log(formData)
+      this.$axios.$post(this.options.server, formData, {
+        headers: { "Content-Type": "multipart/form-data" }
+      }).then(res=>{
+        cb && cb(res, this.post_url)
+      })
+    }
+    
+  }
+}

+ 2 - 0
nuxt.config.js

@@ -100,6 +100,8 @@ module.exports = {
   proxy: [
     [ '/api', { target: 'https://dev.test.proginn.com', changeOrigin: true } ],
     [ '/file/proxyUpload', { target: 'https://dev.test.proginn.com', changeOrigin: true } ],
+    [ '/file/prepareUpload', { target: 'https://dev.test.proginn.com', changeOrigin: true } ],
+    [ '/programmerinnfile', { target: 'https://v0.api.upyun.com', changeOrigin: true } ],
     [ '/upload_image', { target: 'https://dev.test-jishuin.proginn.com', changeOrigin: true } ],
     [ '/image', { target: 'https://stacdn.proginn.com', changeOrigin: true } ]
   ],

+ 323 - 107
pages/kaifain/add.vue

@@ -19,28 +19,28 @@
 
       <div class="nameBox">
         <div class="stitle">方案名称</div>
-        <el-input v-model="data.name" placeholder="20字以内 不能包含 & ¥ % / \ *"></el-input>
+        <el-input v-model="data.title" placeholder="20字以内 不能包含 & ¥ % / \ *"></el-input>
       </div>
       <div class="selectArea">
         <div class="left">
           <div class="stitle">行业领域</div>
-          <el-select style="width: 280px" v-model="value" placeholder="选择行业类型">
+          <el-select style="width: 280px" v-model="data.industry" placeholder="选择行业类型">
             <el-option
-              v-for="item in options"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value">
+              v-for="item in industryList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id">
             </el-option>
           </el-select>
         </div>
         <div class="right">
           <div class="stitle">技术分类</div>
-          <el-select style="width: 427px" v-model="value" placeholder="选择技术分类">
+          <el-select style="width: 427px" v-model="data.tech_type" placeholder="选择技术分类">
             <el-option
-              v-for="item in options"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value">
+              v-for="item in techTypeList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id">
             </el-option>
           </el-select>
         </div>
@@ -55,11 +55,11 @@
               :show-file-list="false"
               :multiple="false"
               accept="image/png, image/jpeg"
-              :before-upload="handleFileChange"
+              :before-upload="(file) => handleFileChange(file, 'images')"
             >
-              <i v-if="data.imageUrl" class="el-icon-delete avatar-uploader-icon"
-                @click.stop="handleDeleteFile"></i>
-              <img v-if="data.imageUrl" :src="data.imageUrl" class="avatar"/>
+              <i v-if="data.images" class="el-icon-delete avatar-uploader-icon"
+                @click.stop="(file) => handleDeleteFile('images')"></i>
+              <img v-if="data.images" :src="data.images" class="avatar"/>
               <div v-else class="noneImage">
                 <i class="el-icon-plus avatar-uploader-icon"></i>
                 <span class="title">上传照片</span>
@@ -74,12 +74,12 @@
       </div>
       <div class="smallIntro">
         <div class="stitle">方案简介</div>
-        <el-input v-model="data.desc" placeholder="请用一句话来介绍您的方案,10-50字符"></el-input>
+        <el-input v-model="data.description" placeholder="请用一句话来介绍您的方案,10-50字符"></el-input>
       </div>
       <div class="intro">
         <div class="stitle">方案介绍<span>查看参考示例</span></div>
         <div class="editor">
-          <editor :content="descContent"></editor>
+          <editor :content="data.detail" @change="(val) => data.detail = val"></editor>
         </div>
       </div>
 
@@ -92,34 +92,36 @@
             <div class="tt3">附件</div>
             <div class="tt4">操作</div>
           </div>
-          <div class="cell">
+          <div class="cell"
+            v-for="(item, index) in data.successful_case"
+            @click="openEditCase(item)"
+          >
             <div class="img">
-              <img src="" alt="">
+              <img :src="item.logo" alt="">
             </div>
             <div class="content">
-              <p>AUSHEN TECHNOLOGY主要致力于留学生教育的APP结合线上及下线互动交流和咨询,让在异国他乡留学生门可以在课业上找到及寻求更多他们所需要的帮助。对于初创公司而言,考…..</p>
+              <p>{{item.description}}</p>
             </div>
-            <div class="pdf">
+            <div class="pdf" @click.stop="openNewUrl(item)">
               <div class="icon"></div>
               <p>成功案例.PDF</p>
             </div>
-            <div class="del">
+            <div class="del" @click.stop="deleteCase(item)">
               <div class="icon"></div>
             </div>
           </div>
-          <div class="addCell">
+          <div class="addCell" @click="addSuccessInfo">
             <div class="icon"></div>
             <p>添加成功案例</p>
           </div>
         </div>
-
       </div>
 
       <div class="bottomBtn">
-        <div class="submit">
+        <div class="submit" @click="submitAll">
           <p>提交审核</p>
         </div>
-        <div class="keepTmp">
+        <div class="keepTmp" @click="saveDraft()">
           <p>存草稿</p>
         </div>
       </div>
@@ -128,70 +130,75 @@
     <el-dialog
       title="添加成功案例"
       :visible.sync="dialogVisible"
-      width="657px"
+      width="613px"
       :append-to-body="true"
       :center="true"
     >
       <div class="diaContentWork">
-       <div class="taskName">
-         <div class="name">案例名称</div>
-         <div class="value">
-           <el-input v-model="dataItem.name" placeholder="请输入案例名称(2-10个字符)"></el-input>
-         </div>
-       </div>
-       <div class="ourLogo">
-         <div class="name">品牌logo</div>
-         <div class="value">
-           <div class="uploadInfo">
-             <div class="left">
-               <el-upload
-                 class="avatar-uploader"
-                 action="#"
-                 :show-file-list="false"
-                 :multiple="false"
-                 accept="image/png, image/jpeg"
-                 :before-upload="handleFileChange"
-               >
-                 <i v-if="data.imageUrl" class="el-icon-delete avatar-uploader-icon"
-                   @click.stop="handleDeleteFile"></i>
-                 <img v-if="data.imageUrl" :src="data.imageUrl" class="avatar"/>
-                 <div v-else class="noneImage">
-                   <i class="el-icon-plus avatar-uploader-icon"></i>
-                   <span class="title">上传照片</span>
-                 </div>
-               </el-upload>
-               <p class="rightTips">支持JPG、PNG格式</p>
-             </div>
-             <div class="right">
-               <p>(800*800,图片最大2M,最多1张)</p>
-             </div>
-           </div>         </div>
-       </div>
-       <div class="taskDesc">
-         <div class="name">案例描述</div>
-         <div class="value">
-           <el-input v-model="dataItem.desc" placeholder="请输入案例描述(10-50个字符)"></el-input>
-         </div>
-       </div>
-       <div class="taskFile">
-         <div class="name">案例附件</div>
-         <div class="value">
-           <el-upload
-             class="upload-demo"
-             action="#"
-             :show-file-list="false"
-             :multiple="false"
-             accept="pdf"
-             :before-upload="handlePDFFileChange">
-             <el-button size="small" type="primary">点击上传</el-button>
-             <div slot="tips" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
-           </el-upload>
-         </div>
-       </div>
+        <div class="taskName">
+          <div class="name">案例名称</div>
+          <div class="value">
+            <el-input v-model="dataItem.title" placeholder="请输入案例名称(2-10个字符)"></el-input>
+          </div>
+        </div>
+        <div class="ourLogo">
+          <div class="name">品牌logo</div>
+          <div class="value">
+            <div class="uploadInfo">
+              <div class="left">
+                <el-upload
+                  class="avatar-uploader"
+                  action="#"
+                  :show-file-list="false"
+                  :multiple="false"
+                  accept="image/png, image/jpeg"
+                  :before-upload="(file) => handleFileChange(file, 'logo')"
+                >
+                  <i v-if="dataItem.logo" class="el-icon-delete avatar-uploader-icon"
+                    @click.stop="() => handleDeleteFile('logo') "></i>
+                  <img v-if="dataItem.logo" :src="dataItem.logo" class="avatar"/>
+                  <div v-else class="noneImage">
+                    <i class="el-icon-plus avatar-uploader-icon"></i>
+                  </div>
+                </el-upload>
+              </div>
+              <div class="right">
+                <p>(800*800,图片最大2M,最多1张)</p>
+              </div>
+            </div>
+          </div>
+        </div>
+        <div class="taskDesc">
+          <div class="name">案例描述</div>
+          <div class="value">
+            <el-input v-model="dataItem.description" placeholder="请输入案例描述(10-50个字符)"></el-input>
+          </div>
+        </div>
+        <div class="taskFile">
+          <div class="name">案例附件</div>
+          <div class="value">
+            <el-upload
+              class="upload-demo"
+              action="#"
+              :show-file-list="true"
+              :multiple="false"
+              accept="application/pdf"
+              :file-list="fileList"
+              :before-upload="handlePDFFileChange"
+              :before-remove="handlePDFFileRemove"
+            >
+              <div style="margin-top: 10px">
+                <span class="uploadFileWord">立即上传</span>
+                <span class="uploadFileTip">仅支持PDF格式(最大2M)</span>
+              </div>
+            </el-upload>
+          </div>
+        </div>
 
       </div>
       <div class="dialog-footer">
-        <div class="submit" @click="submitChange"><p>确定</p></div>
+        <div class="submit" @click="addCase"><p>提交</p></div>
+        <div class="cancle" @click="dialogVisible=false"><p>取消</p></div>
       </div>
     </el-dialog>
 
@@ -200,34 +207,42 @@
 
 <script>
   import editor from "@/components/editor";
+  import uploadFile from "@/mixins/uploadFile";
 
   export default {
     name: 'userSetting',
-    components:{
+    components: {
       editor
     },
     data() {
       return {
         data: {
-          name: '',
-          desc: '',
-          imageUrl: '',
-          descContent: ''
+          city: 1,//服务商所在城市的ID
+          industry: null, //所处行业的ID
+          title: '', //服务名称
+          description: '', //简单描述
+          images: '', //封面图片,缩略图的地址URL
+          detail: '',//具体的描述
+          tech_type: null,//技术类型
+          successful_case: []
         },
-        options: [
-          { value: 1, label: 1 }
-        ],
-        dialogVisible: true,
+        industryList: [],
+        techTypeList: [],
+        dialogVisible: false,
         dataItem: {
-          imgUrl: '',
-          name: '',
-        }
+          provider_id: 0,//服务商ID
+          title: '', //成功案例1
+          logo: '',//http://www.baidu.com,URL
+          description: '', //描述一下啊啥的发啊的算法
+          file: '', //https://www.baidu.com,用户上传的PDF,格式必须为PDF,URL
+        },
+        fileList: [],
       }
     },
+    mixins: [uploadFile],
     async created() {
-      this.$on('change', (val)=>{
-        this.data.descContent = val
-      })
+      this.getDraftInfo()
+      this.getTypeList()
     },
     async mounted() {
     },
@@ -235,11 +250,19 @@
       jumpTo() {
         location.href = ""
       },
-      /** 删除问及爱你 **/
-      handleDeleteFile() {
-        this.imageUrl = ''
-      },
-      handleFileChange(file) {
+      /** 图片文件上传 **/
+      handleFileChange(file, type) {
+        const isJPG = file.type === 'image/jpeg';
+        const isPNG = file.type === 'image/png';
+        const isLt2M = file.size / 1024 / 1024 < 2;
+        if (!isJPG && !isPNG) {
+          this.$message.error('上传头像图片只能是 JPG/PNG 格式!');
+          return
+        }
+        if (!isLt2M) {
+          this.$message.error('上传头像图片大小不能超过 2MB!');
+          return
+        }
         const formData = new FormData();
         formData.append("file", file);
         formData.append("original_filename", file.name);
@@ -249,19 +272,212 @@
             headers: { "Content-Type": "multipart/form-data" }
           })
           .then(res => {
-            this.imageUrl = res.filename
-            this.itemData.work_certify_img = res.filename || ''
+            if (type === 'images') {
+              this.data.images = res.filename
+            } else if (type === 'logo') {
+              this.dataItem.logo = res.filename
+            }
+            console.log('type', type, this.data, this.dataItem)
           })
           .finally(() => {
             this.uploading = false;
           });
       },
-      handlePDFFileChange() {
-
+      /** 删除问及爱你 **/
+      handleDeleteFile(type) {
+        if (type === 'images') {
+          this.data.images = ''
+        } else if (type === 'logo') {
+          this.dataItem.logo = ''
+        }
+      },
+      /** pdf上传  **/
+      handlePDFFileChange(file, type) {
+        console.log(file)
+        const isPDF = file.type === 'application/pdf';
+        const isLt2M = file.size / 1024 / 1024 < 2;
+        if (!isPDF) {
+          this.$message.error('上传文件只能是 JPG/PNG 格式!');
+          return
+        }
+        if (!isLt2M) {
+          this.$message.error('上传文件大小不能超过 2MB!');
+          return
+        }
+        const formData = new FormData();
+        formData.append("file", file);
+        formData.append("original_filename", file.name);
+        this.uploading = true;
+        this.apiPrepareUpload(file, (res, baseUrl)=>{
+          if (res.code === 200) {
+            this.dataItem.file = baseUrl + res.url
+            this.fileList = [{name:file.name, url: this.dataItem.file}]
+          }
+        })
+        return false
+      },
+      /** pdf删除 **/
+      handlePDFFileRemove() {
+        this.fileList = []
+        this.dataItem.file = ""
       },
       /** 弹窗逻辑 **/
       submitChange() {
+      },
+      /** 获取选择信息 **/
+      getTypeList() {
+        this.$axios.get('/api/kaifawu/get_options').then(res => {
+          if (Number(res.data.status) === 1) {
+            this.industryList = res.data.data.industries
+            this.techTypeList = res.data.data.tech_types
+          }
+        })
+      },
+      /** 点击添加生成案例 **/
+      addSuccessInfo() {
+        if (!this.data.id) {
+          this.$message.warning('请先保存草稿后再添加成功案例!')
+          return
+        }
+        this.dialogVisible = true
+        this.dataItem = {
+          provider_id: '',//服务商ID
+          title: '', //成功案例1
+          logo: '',//http://www.baidu.com,URL
+          description: '', //描述一下啊啥的发啊的算法
+          file: '', //https://www.baidu.com,用户上传的PDF,格式必须为PDF,URL
+        }
+      },
+      /** 删除案例 **/
+      deleteCase(item) {
+        this.$confirm('此操作将直接删除该成功案例, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.$axios.post('/api/kaifawu/delete_case', {
+            id: item.id
+          }).then(res => {
+            if (Number(res.data.status) === 1) {
+              this.$message({
+                type: 'success',
+                message: '删除成功!'
+              });
+            }
+          })
+        }).catch(() => {
+          this.$message({
+            type: 'info',
+            message: '已取消删除'
+          });
+        });
+      },
+      /** 添加案例 **/
+      addCase() {
+        let p = {}
+        let keyList = ['id', 'provider_id', 'title', 'logo', 'description', 'file']
+        for (let key of keyList) {
+          if (this.dataItem[key]) {
+            p[key] = this.dataItem[key]
+          }
+        }
+        p.provider_id = this.data.id
 
+        let isEdit = !!p.id
+        if (!p.title || p.title.length < 2 || p.title.length > 20) {
+          this.$message.warning('请填写2-20字符的案例名称!')
+          return
+        }
+        if (!p.logo) {
+          this.$message.warning('请上传品牌logo')
+          return
+        }
+        if (!p.description || p.description.length < 10 || p.description.length > 50) {
+          this.$message.warning('请填写10-50字符的案例描述')
+          return
+        }
+        if (!p.file) {
+          this.$message.warning('请上传案例附件')
+          return
+        }
+        let url = isEdit ? '/api/kaifawu/update_case' : '/api/kaifawu/store_case'
+        this.$axios.post(url, p).then(res => {
+          if (Number(res.data.status) === 1) {
+            this.dataItem.id = 4
+            this.data.successful_case.push(this.dataItem)
+            this.dataItem = {
+              provider_id: 0, title: '', logo: '', description: '', file: '',
+            }
+            this.dialogVisible = false
+            this.fileList = []
+            this.$message.success(isEdit ? '更新成功' : '添加成功')
+          }
+        })
+      },
+      openEditCase(item) {
+        this.dataItem = {
+          ...item
+        }
+        if (item.file) {
+          this.fileList = [ {
+            name: '成功案例.pdf',
+            url: item.file
+          } ]
+        } else {
+          this.fileList = []
+        }
+
+        this.dialogVisible = true
+        console.log('openEditCase', this)
+      },
+      /** 获取草稿 **/
+      getDraftInfo() {
+        this.$axios.get('/api/kaifawu/get_draft').then(res => {
+          if (Number(res.data.status) == 1 && res.data.data) {
+            let data = res.data.data
+            if (!Array.isArray(data.successful_case)) {
+              if (data.successful_case && typeof data.successful_case === "object") {
+                data.successful_case = [ data.successful_case ]
+              } else {
+                data.successful_case = []
+              }
+            }
+            data.city = Number(data.city)
+            data.industry = Number(data.industry)
+            data.tech_type = Number(data.tech_type)
+            this.data = data
+            console.log('this.data', this.data)
+          }
+        })
+      },
+      /** 存储草稿 **/
+      saveDraft(isPublish) {
+        console.log(isPublish)
+        let url = '/api/kaifawu/store'
+        if (this.data.id) {
+          url = '/api/kaifawu/publish'
+        }
+        let p = {
+          ...this.data,
+          publish: isPublish ? 1 : 0
+        }
+        this.$axios.post(url, p).then(res => {
+          if (Number(res.data.status) === 1) {
+            if (!isPublish) {
+              this.getDraftInfo()
+              this.$message.success('保存成功')
+            } else {
+              this.$message.success('发布成功')
+            }
+          }
+        })
+      },
+      /** 确认提交 **/
+      submitAll() {
+        this.saveDraft(true)
+      },
+      openNewUrl(item) {
+        window.open(item.file, '__black')
       }
     },
 

+ 47 - 2
pages/kaifain/index.vue

@@ -5,8 +5,8 @@
         <img src="~@/assets/img/kaifain/banner_bj@2x.png" alt="">
       </div>
       <div class="topContent">
-        <div class="freeSubmit"></div>
-        <div class="bePartner"></div>
+        <div class="freeSubmit" @click="isShowToast = true"></div>
+        <div class="bePartner" @click="handleApplyBtnClick"></div>
       </div>
     </div>
     <div class="contentArea">
@@ -74,6 +74,25 @@
         </el-pagination>
       </div>
     </div>
+
+    <div class="toastBox" v-if="isShowToast">
+      <div class="toastArea">
+        <div class="title">行业解决方案专属客服</div>
+        <div class="tips">填写联系方式 立即与专属客服进行沟通</div>
+        <div class="nameCell">
+          <p class="label">联系人</p>
+          <input type="text" v-model="name" maxlength="10">
+        </div>
+        <div class="phoneCell">
+          <p class="label">电话</p>
+          <input type="number" v-model="phone" oninput="if(value.length>5)value=value.slice(0,11)">
+        </div>
+        <div class="submitBtn" @click="handleSubmit">
+          <p>提 交</p>
+        </div>
+        <div class="closeIcon" @click="isShowToast=false"/>
+      </div>
+    </div>
   </div>
 </template>
 
@@ -134,6 +153,9 @@
           size:10,
           total: 0
         },
+        isShowToast: false,
+        name: '',
+        phone: ''
       }
     },
     created() {
@@ -194,6 +216,29 @@
       pageChange(i) {
         this.page.page = i
         this.getList()
+      },
+      handleApplyBtnClick() {
+        location.href = "/kaifain/add";
+      },
+
+      handleSubmit() {
+        if (!this.name || !this.phone || this.phone.length < 6) {
+          return this.$message.error('请填写完整的信息')
+        }
+        const { name, phone } = this
+        let p = {
+          name, phone, from: '开发屋'
+        }
+        this.$axios.$post('/api/user/create_not_login_user', p).then(res => {
+          this.$message.success(res.info || '提交成功')
+          this.isShowToast = false
+          if (res.status === 1) {
+            this.name = ''
+            this.phone = ''
+          }
+        }).catch(e => {
+          this.$message.error('提交失败,请重试!')
+        })
       }
     }
   }

+ 3 - 2
plugins/nuxtAxios.js

@@ -91,7 +91,7 @@ export default function({ $axios, redirect, req, ...args }) {
         }
       }
     }
-		if (data.status === 1 || data.filename) {
+		if (data.status === 1 || data.filename || data.sign) {
 		} else if (needLogin && data.status === -99) {
       const deviceType = getDeviceType();
       if (deviceType === 'ios' || deviceType === 'android') {
@@ -114,8 +114,9 @@ export default function({ $axios, redirect, req, ...args }) {
 			// return {code: '401', message: '请登录!'};
 		} else {
 			// if (!Vue.hasMessage) {
+      console.log(data)
 			  Vue.prototype.$message.closeAll()
-				Vue.prototype.$message.error(data.info)
+				Vue.prototype.$message.error(data.info || '')
 				// Vue.hasMessage = true
 				// setTimeout(() => {
 				// 	Vue.hasMessage = false