sunjh 6 anni fa
parent
commit
1b8db1d3fa
3 ha cambiato i file con 109 aggiunte e 104 eliminazioni
  1. 96 91
      src/components/project/Project.vue
  2. 1 1
      src/js/api.js
  3. 12 12
      src/js/http.js

+ 96 - 91
src/components/project/Project.vue

@@ -21,8 +21,8 @@
                 <span>联系人</span>
               </el-col>
               <el-col :span="10">
-                <el-input v-if="isModifyMode" v-model="project.contact.name" placeholder="请输入联系人姓名"></el-input>
-                <div v-if="!isModifyMode">{{project.contact.name}}</div>
+                <el-input v-if="isModifyMode" v-model="project.contactName" placeholder="请输入联系人姓名"></el-input>
+                <div v-if="!isModifyMode">{{project.contactName}}</div>
               </el-col>
             </el-row>
             <el-row :gutter="2">
@@ -32,10 +32,10 @@
               <el-col :span="10">
                 <el-input
                   v-if="isModifyMode"
-                  v-model="project.contact.phone"
+                  v-model="project.contactPhone"
                   placeholder="请输入联系人电话"
                 ></el-input>
-                <div v-if="!isModifyMode">{{project.contact.phone}}</div>
+                <div v-if="!isModifyMode">{{project.contactPhone}}</div>
               </el-col>
             </el-row>
           </div>
@@ -73,16 +73,16 @@
             <el-checkbox label="性能测试" name="type"></el-checkbox>
             <el-checkbox label="功能和易用性测试" name="type"></el-checkbox>
           </el-checkbox-group>
-          <span v-if="!isModifyMode" class="badge" v-for="item in project.type">{{item}}</span>
+          <span v-if="!isModifyMode" class="badge" v-for="item in project.type">{{serviceType[item]}}</span>
         </el-form-item>
-        <el-form-item label="用途" prop="useage">
-          <el-input v-if="isModifyMode" v-model="project.useage"></el-input>
-          <span v-if="!isModifyMode">{{project.useage}}</span>
+        <el-form-item label="用途" prop="usage">
+          <el-input v-if="isModifyMode" v-model="project.usage"></el-input>
+          <span v-if="!isModifyMode">{{project.usage}}</span>
         </el-form-item>
 
         <el-form-item label="预算" prop="budget">
           <el-input v-if="isModifyMode" type="number" v-model="project.budget">
-            <template slot="append">¥</template>
+            ¥<template slot="append"></template>
           </el-input>
           <span v-if="!isModifyMode">{{project.budget}}¥</span>
         </el-form-item>
@@ -135,7 +135,7 @@
             </div>
             <div class="el-upload__tip" slot="tip">请上传需求文档</div>
           </el-upload>
-          <span v-if="!isModifyMode">{{project.doc}}</span>
+          <span v-if="!isModifyMode"><a :href="project.doc">{{project.doc}}</a></span>
         </el-form-item>
         <el-form-item label="安装包" prop="file">
           <el-upload
@@ -153,7 +153,7 @@
             </div>
             <div class="el-upload__tip" slot="tip">只能上传Android或IOS安装包文件</div>
           </el-upload>
-          <span v-if="!isModifyMode">{{project.file}}</span>
+          <span v-if="!isModifyMode"><a :href="project.file">{{project.file}}</a></span>
         </el-form-item>
         <el-form-item label="项目截止时间" prop="datetime">
           <div class="block" v-if="isModifyMode">
@@ -234,7 +234,7 @@
     <div class="create-body" v-if="!isModifyMode">
       <div class="title h2">任务列表</div>
       <div class="task-list">
-        <el-table :showHeader="false" :data="project.task" style="width: 100%" max-height="400">
+        <el-table :showHeader="false" :data="task" style="width: 100%;min-height: 200px" max-height="800px">
           <el-table-column prop="name" label="任务名称" title="任务名称"></el-table-column>
           <el-table-column prop="datetime" sortable label="任务截止时间"></el-table-column>
           <el-table-column prop="resource" label="任务可见性">
@@ -246,7 +246,7 @@
           </el-table-column>
           <el-table-column prop="type" label="业务类型">
             <template slot-scope="scope">
-              <div class="badge">{{scope.row.type}}</div>
+              <div class="badge">{{serviceType[scope.row.type]}}</div>
             </template>
           </el-table-column>
 
@@ -284,7 +284,7 @@ import Apis from '@/js/api.js'
 import ResourceType from '@/constants/enum/resource-type'
 import provincecity from '@/components/commons/ProvinceCity'
 import provinceCityJSON from '@/constants/provinceCity.json'
-
+import ServiceType from '@/constants/enum/service-type'
 export default {
   name: 'Project',
   components: {
@@ -309,7 +309,9 @@ export default {
       isModifyMode: false,
       platformType: PlatformType,
       resourceType: ResourceType,
+      serviceType:ServiceType,
       project: {},
+      task:[],
       analyseDemandList: [],
       pickerOptions: {
         shortcuts: [
@@ -452,7 +454,7 @@ export default {
       this.project.institution = ''
       this.project.datetime = ''
       this.project.price = ''
-      this.project.useage = ''
+      this.project.usage = ''
       this.project.budget = ''
     },
     modifyForm () {
@@ -475,44 +477,44 @@ export default {
         institution: '',
         datetime: new Date('2018-11-11 23:11:11'),
         price: '400',
-        useage: '练习',
+        usage: '练习',
         budget: '100',
-        task: [
-          {
-            id: '1',
-            name: '任务1',
-            desc: '任务描述文字',
-            type: '安全漏洞扫描',
-            resource: '1',
-            location: {provinceCode: '', cityCode: ''},
-            institution: '',
-            datetime: '2018-11-12 11:11:01',
-            worker: ''
-          },
-          {
-            id: '2',
-            name: '任务2',
-            desc: '任务描述文字',
-            type: '接口测试',
-            resource: '1',
-            location: {provinceCode: '', cityCode: ''},
-            institution: '上软',
-            datetime: '2018-11-11 10:11:01',
-            worker: ''
-          },
-          {
-            id: '3',
-            name: '任务3',
-            desc: '任务描述文字',
-            type: '功能测试服务',
-            resource: '1',
-            location: {provinceCode: '3200', cityCode: '3201'},
-            institution: '',
-            datetime: '2018-11-11 11:11:01',
-            worker: ''
-          }
-        ]
       }
+      this.task = [
+        {
+          id: '1',
+          name: '任务1',
+          desc: '任务描述文字',
+          type: '安全漏洞扫描',
+          resource: '1',
+          location: {provinceCode: '', cityCode: ''},
+          institution: '',
+          datetime: '2018-11-12 11:11:01',
+          worker: ''
+        },
+        {
+          id: '2',
+          name: '任务2',
+          desc: '任务描述文字',
+          type: '接口测试',
+          resource: '1',
+          location: {provinceCode: '', cityCode: ''},
+          institution: '上软',
+          datetime: '2018-11-11 10:11:01',
+          worker: ''
+        },
+        {
+          id: '3',
+          name: '任务3',
+          desc: '任务描述文字',
+          type: '功能测试服务',
+          resource: '1',
+          location: {provinceCode: '3200', cityCode: '3201'},
+          institution: '',
+          datetime: '2018-11-11 11:11:01',
+          worker: ''
+        }
+      ]
     },
     cancelMode (formName) {
       this.isModifyMode = false
@@ -534,44 +536,45 @@ export default {
         institution: '',
         datetime: new Date('2018-11-11 23:11:11'),
         price: '400',
-        useage: '练习',
+        usage: '练习',
         budget: '100',
-        task: [
-          {
-            id: '1',
-            name: '任务1',
-            desc: '任务描述文字',
-            type: '安全漏洞扫描',
-            resource: '1',
-            location: {provinceCode: '3200', cityCode: '3201'},
-            institution: '',
-            datetime: '2018-11-12 11:11:01',
-            worker: ''
-          },
-          {
-            id: '2',
-            name: '任务2',
-            desc: '任务描述文字',
-            type: '接口测试',
-            resource: '1',
-            location: {provinceCode: '3200', cityCode: '3201'},
-            institution: '',
-            datetime: '2018-11-11 10:11:01',
-            worker: ''
-          },
-          {
-            id: '3',
-            name: '任务3',
-            desc: '任务描述文字',
-            type: '功能测试服务',
-            resource: '1',
-            location: {provinceCode: '3200', cityCode: '3201'},
-            institution: '',
-            datetime: '2018-11-11 11:11:01',
-            worker: ''
-          }
-        ]
       }
+      this.task = [
+        {
+          id: '1',
+          name: '任务1',
+          desc: '任务描述文字',
+          type: '安全漏洞扫描',
+          resource: '1',
+          location: {provinceCode: '3200', cityCode: '3201'},
+          institution: '',
+          datetime: '2018-11-12 11:11:01',
+          worker: ''
+        },
+        {
+          id: '2',
+          name: '任务2',
+          desc: '任务描述文字',
+          type: '接口测试',
+          resource: '1',
+          location: {provinceCode: '3200', cityCode: '3201'},
+          institution: '',
+          datetime: '2018-11-11 10:11:01',
+          worker: ''
+        },
+        {
+          id: '3',
+          name: '任务3',
+          desc: '任务描述文字',
+          type: '功能测试服务',
+          resource: '1',
+          location: {provinceCode: '3200', cityCode: '3201'},
+          institution: '',
+          datetime: '2018-11-11 11:11:01',
+          worker: ''
+        }
+      ]
+
     },
     goToTaskDetail (id) {
       this.$router.push({
@@ -586,7 +589,7 @@ export default {
       this.$router.push({name: 'ReportCreate'})
     },
     handleDelete (index, id) {
-      this.project.task.splice(index, 1)
+      this.task.splice(index, 1)
     },
     beforeFileUpload (file) {
       const isAPK = file.type === 'application/vnd.android.package-archive'
@@ -607,9 +610,11 @@ export default {
       console.log('拒绝')
     },
     loadData () {
-      Http.get(Apis.PAGE.PROJECT_DETAIL_PAGE).then((res) => {
-        this.project = res.project
-        this.analyseDemandList = res.analyseDemandList
+      Http.get(Apis.PAGE.PROJECT_DETAIL_PAGE.replace('{projectId}','PROJECT_1')).then((res) => {
+        console.log(res)
+        this.project = res.projectDetails
+        this.task = res.taskList
+        this.analyseDemandList = res.reportList
       })
     },
     locationChange (provinceId, cityId) {

+ 1 - 1
src/js/api.js

@@ -18,7 +18,7 @@ export default {
     SQUARE_PAGE: '/api/page/square/',
     MY_CROWD_TEST_PAGE: '/api/page/myCrowdTest/',
     TASK_DETAIL_PAGE: '/api/page/taskDetail/{taskId}/',
-    PROJECT_DETAIL_PAGE: '/api/page/projectDetail/{projectId}/',
+    PROJECT_DETAIL_PAGE: '/api/project/{projectId}/',
     REPORT_DETAIL_PAGE: '/api/page/reportDetail/{reportId}/',
   }
 }

+ 12 - 12
src/js/http.js

@@ -4,17 +4,17 @@ const TIME_OUT_MS = 60 * 1000 // 默认请求超时时间
 axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
 
 // 请求拦截器
-axios.interceptors.request.use(function (config) {
-  return config
-}, function (error) {
-  return Promise.reject(error)
-})
-// 响应拦截器
-axios.interceptors.response.use(function (response) {
-  return response
-}, function (error) {
-  return Promise.reject(error)
-})
+// axios.interceptors.request.use(function (config) {
+//   return config
+// }, function (error) {
+//   return Promise.reject(error)
+// })
+// // 响应拦截器
+// axios.interceptors.response.use(function (response) {
+//   return response
+// }, function (error) {
+//   return Promise.reject(error)
+// })
 
 /*
  * @param response 返回数据列表
@@ -76,7 +76,7 @@ export default {
   },
   get (url) {
     return new Promise((resolve, reject) => {
-      axios.get(url )
+      axios.get(handleUrl(url) )
         .then(response => {
           resolve(response.data)
         }).catch(error => {