wangJJ il y a 5 ans
Parent
commit
faab790133

+ 12 - 1
src/components/commons/HomeSlice.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="home-slice">
-    <el-row style="padding-top: 40px">
+    <el-row style="padding-top: 40px" v-loading="loading" element-loading-text="权限检查中...">
       <el-col :span="14">
         <div class="slice-wrapper" style="padding-left: 20%">
           <div class="slice-title"><img src="../../assets/img/homeslice1.png" alt="slice1"></div>
@@ -30,9 +30,16 @@
             return {
                 user: {},
                 isLogin: false,
+              loading:false
             }
         },
         methods: {
+          showLoading() {
+            this.loading = true
+          },
+          hideLoading() {
+            this.loading = false
+          },
             loadData(){
                 if (storageGet('user') != null) {
                     this.isLogin = true;
@@ -45,8 +52,10 @@
                     notify('warning', '请登录后访问');
                 }
                 else if(this.isLogin){
+                  this.showLoading();
                     Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
                         console.log(res)
+                      this.hideLoading()
                         this.$router.push('/project/create');
                     }).catch((error) => {
                         notify('error', error.data)
@@ -59,8 +68,10 @@
                     notify('warning', '请登录后访问');
                 }
                 else if(this.isLogin){
+                  this.showLoading();
                     Http.get(Apis.USER.IS_AGENCY.replace('{userId}', this.user.id)).then((res) => {
                         console.log(res)
+                      this.hideLoading()
                         this.$router.push('/square');
                     }).catch((error) => {
                         notify('error', error.data)

+ 5 - 0
src/components/commons/ProvinceCity.vue

@@ -53,6 +53,10 @@ export default {
     this.province = this.provinceCode;
     this.provinceChanged(this.provinceCode);
     this.city = this.cityCode;
+    console.log(this.city)
+    console.log(this.province)
+    console.log(this.provinceCode)
+    console.log(this.cityCode)
   },
   data() {
     return {
@@ -103,6 +107,7 @@ export default {
       this.province = this.provinceCode
       this.city = this.cityCode
     },
+
   },
 };
 </script>

+ 18 - 2
src/components/commons/SearchBar.vue

@@ -23,7 +23,7 @@
         </div>
       </el-col>
       <el-col :span="6">
-        <el-button type="primary pull-right" class="releaseBtn">免费发布众测需求</el-button>
+        <el-button type="primary pull-right" class="releaseBtn" @click="checkLogin()">免费发布众测需求</el-button>
       </el-col>
     </el-row>
     <!--TabNav-->
@@ -57,7 +57,23 @@
       }
     },
 
-    methods: {}
+    methods: {
+      checkLogin() {
+        this.checkCreateProjectAuth();
+      },
+      checkCreateProjectAuth() {
+        if (!this.isLogin) {
+          console.log("请登录后访问");
+          notify('warning', '请登录后访问');
+        } else if (this.isLogin) {
+          Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+            this.$router.push('/project/create');
+          }).catch((error) => {
+            notify('error', error.data)
+          })
+        }
+      },
+    }
   }
 
 </script>

+ 15 - 9
src/components/commons/TopSearch.vue

@@ -54,15 +54,21 @@
                     this.isLogin = true;
                 }
             },
-            checkLogin(){
-                if(!this.isLogin){
-                    console.log("请登录后访问");
-                    notify('warning','请登录后访问');
-                }else{
-                    console.log("已登录");
-                    this.$router.push('/project/create');
-                }
-            },
+          checkLogin() {
+            this.checkCreateProjectAuth();
+          },
+          checkCreateProjectAuth() {
+            if (!this.isLogin) {
+              console.log("请登录后访问");
+              notify('warning', '请登录后访问');
+            } else if (this.isLogin) {
+              Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                this.$router.push('/project/create');
+              }).catch((error) => {
+                notify('error', error.data)
+              })
+            }
+          },
             handleSearchData() {
                 console.log(this.searchType);
                 let url = '/api/common/index/page';

+ 721 - 716
src/components/project/Project.vue

@@ -15,7 +15,9 @@
             <el-form-item label="项目名称" prop="name">
               <el-input size="small" v-if="isModifyMode" v-model="project.name"></el-input>
               <span v-if="!isModifyMode" style="margin-right: 5px">{{project.name}}</span>
-              <el-tag v-if="!isModifyMode" :type="project.statusVO&&project.statusVO.style">{{project.statusVO?project.statusVO.text:''}}</el-tag>
+              <el-tag v-if="!isModifyMode" :type="project.statusVO&&project.statusVO.style">
+                {{project.statusVO?project.statusVO.text:''}}
+              </el-tag>
             </el-form-item>
             <el-form-item size="small" label="联系人" prop="contactName">
               <el-input v-if="isModifyMode" v-model="project.contactName" placeholder="请输入联系人姓名"></el-input>
@@ -39,15 +41,15 @@
               <span v-if="!isModifyMode">{{project.valuationStandard}}</span>
             </el-form-item>
 
-<!--            <el-form-item size="small" label="计价标准" prop="valuationStandard">-->
-<!--              <el-input v-if="isModifyMode" type="number" v-model="project.valuationStandard">-->
-<!--                <template slot="append"></template>-->
-<!--              </el-input>-->
-<!--              <span v-if="!isModifyMode">{{project.valuationStandard}}</span>-->
-<!--            </el-form-item>-->
-<!--            <el-form-item v-if="!isModifyMode" size="small" label="状态" prop="status">-->
-<!--              <span v-if="!isModifyMode">{{project.statusVO?project.statusVO.text:''}}</span>-->
-<!--            </el-form-item>-->
+            <!--            <el-form-item size="small" label="计价标准" prop="valuationStandard">-->
+            <!--              <el-input v-if="isModifyMode" type="number" v-model="project.valuationStandard">-->
+            <!--                <template slot="append"></template>-->
+            <!--              </el-input>-->
+            <!--              <span v-if="!isModifyMode">{{project.valuationStandard}}</span>-->
+            <!--            </el-form-item>-->
+            <!--            <el-form-item v-if="!isModifyMode" size="small" label="状态" prop="status">-->
+            <!--              <span v-if="!isModifyMode">{{project.statusVO?project.statusVO.text:''}}</span>-->
+            <!--            </el-form-item>-->
             <el-form-item size="small" label="区域管理员" prop="institution" v-if="project.institution">
               <span v-if="!isModifyMode">{{project.institution}}</span>
             </el-form-item>
@@ -65,7 +67,7 @@
             <el-form-item label="领域类型" prop="field">
               <el-radio-group v-if="isModifyMode" v-model="project.field">
                 <span v-for="(item,index) in fields" :key="index">
-              <el-radio :label="item.code" style="margin: 3px">{{ item.name }}&nbsp;&nbsp;&nbsp;&nbsp;</el-radio>
+              <el-radio :label="item.name" style="margin: 3px">{{ item.name }}&nbsp;&nbsp;&nbsp;&nbsp;</el-radio>
             </span>
               </el-radio-group>
               <span
@@ -78,7 +80,7 @@
             <el-form-item label="应用类型" prop="platform">
               <el-radio-group v-if="isModifyMode" v-model="project.platform">
                 <span v-for="(item,index) in platforms" :key="index">
-              <el-radio :label="item.code" style="margin: 3px">{{ item.name }}&nbsp;&nbsp;&nbsp;&nbsp;</el-radio>
+              <el-radio :label="item.name" style="margin: 3px">{{ item.name }}&nbsp;&nbsp;&nbsp;&nbsp;</el-radio>
             </span>
               </el-radio-group>
               <span
@@ -90,7 +92,7 @@
             <el-form-item label="测试类型" prop="type">
               <el-checkbox-group v-if="isModifyMode" v-model="project.type">
             <span v-for="(item,index) in serviceType" :key="index">
-              <el-checkbox :label="item.code" name="type">{{ item.name }}&nbsp;&nbsp;</el-checkbox>
+              <el-checkbox :label="item.name" name="type">{{ item.name }}&nbsp;&nbsp;</el-checkbox>
             </span>
               </el-checkbox-group>
               <span v-if="!isModifyMode" class="badge" v-for="item in project.type">{{item}}</span>
@@ -239,7 +241,7 @@
         </el-col>
       </el-row>
     </div>
-<!--    任务列表-->
+    <!--    任务列表-->
     <div class="create-body" v-if="!isModifyMode && showTaskList">
       <div class="title h2">任务列表</div>
       <div class="task-list">
@@ -281,11 +283,11 @@
                 @click="goToTaskDetail(projectId, scope.row.id)"
               >查看详情
               </div>
-<!--              <div-->
-<!--                class="btn btn-small btn-danger"-->
-<!--                @click="handleDelete(scope.$index, scope.row.id)"-->
-<!--              >删除-->
-<!--              </div>-->
+              <!--              <div-->
+              <!--                class="btn btn-small btn-danger"-->
+              <!--                @click="handleDelete(scope.$index, scope.row.id)"-->
+              <!--              >删除-->
+              <!--              </div>-->
             </template>
           </el-table-column>
         </el-table>
@@ -300,743 +302,746 @@
 </template>
 
 <script>
-import ReportList from '@/components/report/ReportList'
-import Http from '@/js/http.js'
-import Apis from '@/js/api.js'
-import ResourceType from '@/constants/enum/resource-type'
-import provincecity from '@/components/commons/ProvinceCity'
-import {notify} from '@/constants/index'
-import echarts from 'echarts'
-import {
-  checkFileType,
-  ensureEndProject,
-  getAllInstitutions,
-  getAllPlatformTypes,
-  getAllFields,
-  getAllServiceTypes,
-  getFormalTimeFromDate,
-  getProvinceCodeByProvinceName,
-  getProvinceNameByProvinceCode,
-  receiveProjectRequest,
-  rejectProject,
-  storageGet,
-  submitProjectRequest,
-  deleteTask
-} from '@/js/index'
+  import ReportList from '@/components/report/ReportList'
+  import Http from '@/js/http.js'
+  import Apis from '@/js/api.js'
+  import ResourceType from '@/constants/enum/resource-type'
+  import provincecity from '@/components/commons/ProvinceCity'
+  import {notify} from '@/constants/index'
+  import echarts from 'echarts'
+  import {
+    checkFileType,
+    ensureEndProject,
+    getAllInstitutions,
+    getAllPlatformTypes,
+    getAllFields,
+    getAllServiceTypes,
+    getFormalTimeFromDate,
+    getProvinceCodeByProvinceName,
+    getProvinceNameByProvinceCode,
+    receiveProjectRequest,
+    rejectProject,
+    storageGet,
+    submitProjectRequest,
+    deleteTask
+  } from '@/js/index'
 
-export default {
-  name: 'Project',
-  components: {
-    provincecity,
-    ReportList
-  },
-  data () {
-    var validatePass = (rule, value, callback) => {
-      var reg = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/
-      if (this.project.contactPhone) {
-        if (!reg.test(this.project.contactPhone)) {
-          callback(new Error('请检查手机号码'))
-        } else {
-          callback()
+  export default {
+    name: 'Project',
+    components: {
+      provincecity,
+      ReportList
+    },
+    data() {
+      var validatePass = (rule, value, callback) => {
+        var reg = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/
+        if (this.project.contactPhone) {
+          if (!reg.test(this.project.contactPhone)) {
+            callback(new Error('请检查手机号码'))
+          } else {
+            callback()
+          }
         }
       }
-    }
-    return {
-      showTaskList: true,
-      acceptedUserList:[],
-      projectId: 0,
-      user: {},
-      loading: false,
-      tabPosition: 'top',
-      institutionArray: [],
-      isModifyMode: false,
-      platforms: [],
-      fields: [],
-      resourceType: ResourceType,
-      serviceType: [],
-      projectOperationControl: {
-        confirmFinish: false,
-        createTask: false,
-        finish: false,
-        receive: false,
-        reject: false,
-        update: false,
-        uploadReport: false,
-      },
-      project: {
-        userId: 0,
-        name: '',
-        type: [],
-        platform: '',
-        valuationStandard: '',
-        entrustUnit:'',
-        field: '',
-        desc: '',
-        resource: '',
-        location: '',
-        institution: {},
-        contactName: '',
-        contactPhone: '',
-        doc: [],
-        requireDocUrl: '',
-        file: [],
-        fileUrl: '',
-        budget: '',
-        price: '',
-        datetime: '',
-        usage: '',
-        status: ''
-      },
-      task: [],
-      progress: [],
-      reportList: [],
-      pickerOptions: {
-        disabledDate(time) {
-          return time.getTime() <= Date.now();
+      return {
+        showTaskList: true,
+        acceptedUserList: [],
+        projectId: 0,
+        user: {},
+        loading: false,
+        tabPosition: 'top',
+        institutionArray: [],
+        isModifyMode: false,
+        platforms: [],
+        fields: [],
+        resourceType: ResourceType,
+        serviceType: [],
+        projectOperationControl: {
+          confirmFinish: false,
+          createTask: false,
+          finish: false,
+          receive: false,
+          reject: false,
+          update: false,
+          uploadReport: false,
         },
-        shortcuts: [
-          {
-            text: '今天',
-            onClick (picker) {
-              picker.$emit('pick', new Date())
-            }
-          },
-          {
-            text: '明天',
-            onClick (picker) {
-              const date = new Date()
-              date.setTime(date.getTime() + 3600 * 1000 * 24)
-              picker.$emit('pick', date)
-            }
+        project: {
+          userId: 0,
+          name: '',
+          type: [],
+          platform: '',
+          valuationStandard: '',
+          entrustUnit: '',
+          field: '',
+          desc: '',
+          resource: '',
+          location: '',
+          institution: {},
+          contactName: '',
+          contactPhone: '',
+          doc: [],
+          requireDocUrl: '',
+          file: [],
+          fileUrl: '',
+          budget: '',
+          price: '',
+          datetime: '',
+          usage: '',
+          status: ''
+        },
+        task: [],
+        progress: [],
+        reportList: [],
+        pickerOptions: {
+          disabledDate(time) {
+            return time.getTime() <= Date.now();
           },
-          {
-            text: '一周后',
-            onClick (picker) {
-              const date = new Date()
-              date.setTime(date.getTime() + 3600 * 1000 * 24 * 7)
-              picker.$emit('pick', date)
-            }
-          }
-        ]
-      },
-      rules: {
-        name: [
-          {required: true, message: '请输入项目名称', trigger: 'blur'},
-          {min: 5, max: 50, message: '项目名称长度在 5 到 50 个字符', trigger: 'blur'}
-        ],
-        contactName: [
-          {required: true, message: '请输入联系人姓名', trigger: 'blur'}
-          // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
-        ],
-        contactPhone: [
-          {required: true, message: '请输入手机号', trigger: 'blur'},
-          {min: 11, max: 11, message: '请输入正确的手机号', trigger: 'blur'},
-          {
-            validator: (rule, value, callback) => {
-              if (!this.checkPhoneNumber(value)) {
-                callback(new Error('手机号输入有误'))
-              } else {
-                callback()
+          shortcuts: [
+            {
+              text: '今天',
+              onClick(picker) {
+                picker.$emit('pick', new Date())
               }
-            }, trigger: 'blur'
-          },
-        ],
-        type: [
-          {
-            type: 'array',
-            required: true,
-            message: '请至少选择一种测试类型',
-            trigger: 'change'
-          }
-        ],
-        platform: [
-          {
-            required: true,
-            message: '请选择一个应用类型',
-            trigger: 'change'
-          }
-        ],
-        field: [
+            },
             {
-                required: true,
-                message: '请选择一个领域类型',
-                trigger: 'change'
-            }
-        ],
-        desc: [{required: false, message: '请填写描述', trigger: 'blur'}],
-        //price: [{required: true, message: '请填写价格', trigger: 'blur'}],
-        budget: [
-          {required: true, message: '预算不可为空', trigger: 'blur'},
-          {
-            validator: (rule, value, callback) => {
-              if (value < 0) {
-                callback(new Error('请输入不小于0的数'))
-              } else {
-                callback()
+              text: '明天',
+              onClick(picker) {
+                const date = new Date()
+                date.setTime(date.getTime() + 3600 * 1000 * 24)
+                picker.$emit('pick', date)
               }
-            }, trigger: 'blur'
-          },
-        ],
-        resource: [
-          {required: true},
-          {
-            validator: (rule, value, callback) => {
-              if (value == 0 && this.project.institution == null) {
-                callback(new Error('定向发布至少要选择一个区域管理员'))
-              } else {
-                callback()
+            },
+            {
+              text: '一周后',
+              onClick(picker) {
+                const date = new Date()
+                date.setTime(date.getTime() + 3600 * 1000 * 24 * 7)
+                picker.$emit('pick', date)
               }
-            }, trigger: 'change'
-          },
-        ],
-        datetime: [{required: true, message: '截止时间不可为空', trigger: 'blur'}],
-      }
-    }
-  },
-  mounted () {
-    this.$nextTick(() => {
-      this.init();
-    })
-  },
-  watch: {
-    serviceType (val) {
-      this.serviceType = val
-    },
-    institutionArray (val) {
-      this.institutionArray = val
-    },
-    // 'project.institution' () {
-    //   if (this.project.institution) {
-    //     //this.$refs.addFormProvince.resetProviceCity()
-    //     this.project.location = {provinceCode: '', cityCode: ''}
-    //   }
-    // },
-    // 'project.location' () {
-    //   if (this.project.location.provinceCode || this.project.location.cityCode) {
-    //     this.project.institution = ''
-    //   }
-    // },
-    // 'project.resource' () {
-    //   if (this.project.resource == '2') {
-    //     //this.$refs.addFormProvince.resetProviceCity()
-    //     this.project.institution = ''
-    //     this.project.location = {provinceCode: '', cityCode: ''}
-    //   }
-    // },
-    deep: true
-  },
-  methods: {
-    updateLocation (location) {
-      //console.log(location)
-      const loactionName = getProvinceNameByProvinceCode(location.provinceCode, location.cityCode)
-      // var provinceName = ''
-      // var cityName = ''
-      // for (var item of provinceCityJSON.provinces) {
-      //   if (item.code === location.provinceCode) {
-      //     provinceName = item.name
-      //     for (var city of item.cities) {
-      //       if (city.code === location.cityCode) {
-      //         cityName = city.name
-      //         break
-      //       }
-      //     }
-      //   }
-      // }
-      return loactionName.provinceCode + ' / ' + loactionName.cityCode
-    },
-    init () {
-      this.projectId = this.$route.params.projectId
-      this.setServiceType()
-      this.setFields()
-      this.setPlatformType()
-      this.setInstitutions()
-      this.setUserInfo()
-      this.loadData()
-      //this.reformDate(123)
-      // this.project.platform.map(item => {
-      //   this.platformType.push(PlatformType[item])
-      // })
-    },
-    //画个饼
-    setEcharts () {
-      // 基于准备好的dom,初始化echarts实例
-      let myChart = echarts.init(document.getElementById('pieImage'))
-      // 绘制图表
-      var option = {
-        tooltip: {
-          trigger: 'item',
-          formatter: '{a} <br/>{b}: {c} ({d}%)'
-        },
-        legend: {
-          orient: 'vertical',
-          x: 'left',
-          data: ['已完成', '进行中']
+            }
+          ]
         },
-        series: [
-          {
-            name: '任务状态',
-            type: 'pie',
-            radius: ['50%', '70%'],
-            avoidLabelOverlap: false,
-            label: {
-              normal: {
-                show: false,
-                position: 'center'
-              },
-              emphasis: {
-                show: true,
-                textStyle: {
-                  fontSize: '30',
-                  fontWeight: 'bold'
+        rules: {
+          name: [
+            {required: true, message: '请输入项目名称', trigger: 'blur'},
+            {min: 5, max: 50, message: '项目名称长度在 5 到 50 个字符', trigger: 'blur'}
+          ],
+          contactName: [
+            {required: true, message: '请输入联系人姓名', trigger: 'blur'}
+            // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
+          ],
+          contactPhone: [
+            {required: true, message: '请输入手机号', trigger: 'blur'},
+            {min: 11, max: 11, message: '请输入正确的手机号', trigger: 'blur'},
+            {
+              validator: (rule, value, callback) => {
+                if (!this.checkPhoneNumber(value)) {
+                  callback(new Error('手机号输入有误'))
+                } else {
+                  callback()
                 }
-              }
+              }, trigger: 'blur'
             },
-            labelLine: {
-              normal: {
-                show: false
-              }
+          ],
+          type: [
+            {
+              type: 'array',
+              required: true,
+              message: '请至少选择一种测试类型',
+              trigger: 'change'
+            }
+          ],
+          platform: [
+            {
+              required: true,
+              message: '请选择一个应用类型',
+              trigger: 'change'
+            }
+          ],
+          field: [
+            {
+              required: true,
+              message: '请选择一个领域类型',
+              trigger: 'change'
+            }
+          ],
+          desc: [{required: false, message: '请填写描述', trigger: 'blur'}],
+          //price: [{required: true, message: '请填写价格', trigger: 'blur'}],
+          budget: [
+            {required: true, message: '预算不可为空', trigger: 'blur'},
+            {
+              validator: (rule, value, callback) => {
+                if (value < 0) {
+                  callback(new Error('请输入不小于0的数'))
+                } else {
+                  callback()
+                }
+              }, trigger: 'blur'
             },
-            data: this.progress,
-            color:['#909399','#409EFF']
-          }
-        ]
-      }
-      myChart.setOption(option)
-    },
-    //提交修改
-    submitForm (formName) {
-      this.$refs['project'].validate(valid => {
-        if (valid) {
-          this.showLoading()
-          const newProject = {
-            userId: this.user.userVO.id,
-            name: this.project.name,
-            type: this.project.type,
-            platform: this.project.platform,
-            valuationStandard: this.project.valuationStandard,
-            entrustUnit: this.project.entrustUnit,
-            field: this.project.field,
-            desc: this.project.desc,
-            resource: this.project.resource,
-            location: getProvinceNameByProvinceCode(this.project.location.provinceCode, this.project.location.cityCode),
-            institution: this.project.institution == null ? null : this.project.institution.id,
-            contactName: this.project.contactName,
-            contactPhone: this.project.contactPhone,
-            doc: this.project.requireDocUrl,
-            file: this.project.fileUrl,
-            budget: this.project.budget,
-            price: this.project.price,
-            datetime: this.project.datetime,
-            usage: this.project.usage,
-          }
-          console.log(newProject);
-          Http.put(Apis.PROJECT.UPDATE_PROJECT.replace('{projectId}', this.projectId), newProject).then((res) => {
-            console.log(res)
-            this.projectId = res.projectDetails.id
-            this.project.name = res.projectDetails.name
-            this.project.contactName = res.projectDetails.contactName
-            this.project.contactPhone = res.projectDetails.contactPhone
-            this.project.type = res.projectDetails.type
-            this.project.platform = res.projectDetails.platform
-            this.project.valuationStandard = res.projectDetails.valuationStandard
-            this.project.entrustUnit = res.projectDetails.entrustUnit
-            this.project.field = res.projectDetails.field
-            this.project.desc = res.projectDetails.desc
-            this.project.doc = []
-            this.project.file = []
-            this.project.resource = res.projectDetails.resource
-            this.project.location = getProvinceCodeByProvinceName(res.projectDetails.location.provinceCode, res.projectDetails.location.cityCode)
-            this.project.institution = res.projectDetails.institution
-            this.project.datetime = new Date(res.projectDetails.datetime)
-            this.project.price = res.projectDetails.price
-            this.project.budget = res.projectDetails.budget
-            this.project.usage = res.projectDetails.usage
-            this.project.fileUrl = res.projectDetails.file
-            this.project.requireDocUrl = res.projectDetails.doc
-            this.task = res.taskList
-            this.reportList = res.reportList
-            this.isModifyMode = false
-            this.hideLoading()
-            notify('success', '项目修改成功')
-          }).catch(error => {
-            this.hideLoading()
-            notify('error', error.data)
-            console.log(error)
-          })
-        } else {
-          notify('error', '表单填写错误!')
-          return false
+          ],
+          resource: [
+            {required: true},
+            {
+              validator: (rule, value, callback) => {
+                if (value == 0 && this.project.institution == null) {
+                  callback(new Error('定向发布至少要选择一个区域管理员'))
+                } else {
+                  callback()
+                }
+              }, trigger: 'change'
+            },
+          ],
+          datetime: [{required: true, message: '截止时间不可为空', trigger: 'blur'}],
         }
-      })
-    },
-    //重置表单
-    resetForm (formName) {
-      this.$refs[formName].resetFields()
-      this.project.name = ''
-      this.project.type = []
-      this.project.platform = ''
-      this.project.valuationStandard = ''
-      this.project.entrustUnit = ''
-      this.project.field = ''
-      this.project.desc = ''
-      this.project.doc = ''
-      this.project.file = ''
-      this.project.contactName = ''
-      this.project.contactPhone = ''
-      this.project.resource = '2'
-      this.project.institution = ''
-      this.project.datetime = ''
-      this.project.price = ''
-      this.project.usage = ''
-      this.project.budget = ''
-    },
-    //进入修改项目页面
-    modifyForm () {
-      this.isModifyMode = true
-      this.project.type = []
-      this.project.platform = []
-      this.project.field = []
-      console.log(this.project)
-      // console.log(this.project.doc)
-      //this.setInstitutions()
-      //获得update 信息
-      //this.loadData()
-    },
-    //接收项目
-    receiveProject () {
-      this.$confirm('确认接收项目?', '提示', {
-        confirmButtonText: '确认接收',
-        cancelButtonText: '取消',
-        type: 'success'
-      }).then(() => {
-        this.showLoading()
-        console.log('接收项目')
-        receiveProjectRequest(this.projectId, this.user.userVO.id, this.receiveProjectSuccess, this.receiveProjectFail)
-      }).catch(() => {
-      })
-    },
-    receiveProjectSuccess (res) {
-      this.hideLoading()
-      notify('success', '项目接收成功!')
-      this.projectOperationControl = res.projectOperationControl
-      this.project.status = res.projectDetails.status
-      this.project.institution = res.projectDetails.institution
-    },
-    receiveProjectFail (error) {
-      this.hideLoading()
-      notify('error', '接收项目失败:' + error.data)
-    },
-    //拒绝项目
-    rejectProject () {
-      this.$confirm('确认拒绝项目?', '提示', {
-        confirmButtonText: '确认拒绝',
-        cancelButtonText: '取消',
-        type: 'success'
-      }).then(() => {
-        this.showLoading()
-        rejectProject(this.projectId, this.rejectProjectSuccess, this.rejectProjectFail)
-      }).catch(() => {
-      })
-
-    },
-    rejectProjectSuccess (res) {
-      this.hideLoading()
-      notify('success', '拒绝项目成功')
-    },
-    rejectProjectFail (error) {
-      this.hideLoading()
-      notify('error', '拒绝项目失败:' + error.data)
-    },
-    //提交项目
-    submitProjectRequest () {
-      this.$confirm('确认提交项目?', '提示', {
-        confirmButtonText: '确认提交',
-        cancelButtonText: '取消',
-        type: 'success'
-      }).then(() => {
-        this.showLoading()
-        submitProjectRequest(this.projectId, this.submitProjectRequestSuccess, this.submitProjectRequestFail)
-      }).catch(() => {
-      })
-    },
-    submitProjectRequestSuccess (res) {
-      this.hideLoading()
-      notify('success', '项目提交成功!')
-      this.loadData()
-      this.projectOperationControl = res.projectOperationControl
-      this.project.status = res.projectDetails.status
-      this.project.institution = res.projectDetails.institution
-    },
-    submitProjectRequestFail (error) {
-      this.hideLoading()
-      notify('error', '提交项目失败:' + error.data)
-    },
-    //结束项目
-    endProject () {
-      this.$confirm('确认结束项目?', '提示', {
-        confirmButtonText: '确认结束',
-        cancelButtonText: '取消',
-        type: 'success'
-      }).then(() => {
-        this.showLoading()
-        ensureEndProject(this.projectId, this.endProjectSuccess, this.endProjectFail)
-      }).catch(() => {
-      })
-
-    },
-    endProjectSuccess (res) {
-      this.hideLoading()
-      notify('success', '项目提交成功!')
-      this.loadData()
-      this.projectOperationControl = res.projectOperationControl
-      this.project.status = res.projectDetails.status
-      this.project.institution = res.projectDetails.institution
-    },
-    endProjectFail (error) {
-      this.hideLoading()
-      notify('error', '结束项目失败:' + error.data)
-    },
-    cancelMode (formName) {
-      this.isModifyMode = false
-      this.loadData()
-
+      }
     },
-    goToTaskDetail (projectId, taskId) {
-      this.$router.push({
-        name: 'Task',
-        params: {projectId: projectId, taskId: taskId}
+    mounted() {
+      this.$nextTick(() => {
+        this.init();
       })
     },
-    createNewTask () {
-      const that = this
-      this.$router.push({
-        name: 'TaskCreate',
-        params: {projectId: that.projectId}
-      })
+    watch: {
+      serviceType(val) {
+        this.serviceType = val
+      },
+      institutionArray(val) {
+        this.institutionArray = val
+      },
+      // 'project.institution' () {
+      //   if (this.project.institution) {
+      //     //this.$refs.addFormProvince.resetProviceCity()
+      //     this.project.location = {provinceCode: '', cityCode: ''}
+      //   }
+      // },
+      // 'project.location' () {
+      //   if (this.project.location.provinceCode || this.project.location.cityCode) {
+      //     this.project.institution = ''
+      //   }
+      // },
+      // 'project.resource' () {
+      //   if (this.project.resource == '2') {
+      //     //this.$refs.addFormProvince.resetProviceCity()
+      //     this.project.institution = ''
+      //     this.project.location = {provinceCode: '', cityCode: ''}
+      //   }
+      // },
+      deep: true
     },
-    createReport () {
-      this.$router.push({
-        name: 'ProjectReportCreate',
-        params: {
-          scope: 0,
-          dependencyCode: this.projectId,
-          projectId: this.projectId,
+    methods: {
+      updateLocation(location) {
+        //console.log(location)
+        const loactionName = getProvinceNameByProvinceCode(location.provinceCode, location.cityCode)
+        // var provinceName = ''
+        // var cityName = ''
+        // for (var item of provinceCityJSON.provinces) {
+        //   if (item.code === location.provinceCode) {
+        //     provinceName = item.name
+        //     for (var city of item.cities) {
+        //       if (city.code === location.cityCode) {
+        //         cityName = city.name
+        //         break
+        //       }
+        //     }
+        //   }
+        // }
+        return loactionName.provinceCode + ' / ' + loactionName.cityCode
+      },
+      init() {
+        this.projectId = this.$route.params.projectId
+        this.setServiceType()
+        this.setFields()
+        this.setPlatformType()
+        this.setInstitutions()
+        this.setUserInfo()
+        this.loadData()
+        //this.reformDate(123)
+        // this.project.platform.map(item => {
+        //   this.platformType.push(PlatformType[item])
+        // })
+      },
+      //画个饼
+      setEcharts() {
+        // 基于准备好的dom,初始化echarts实例
+        let myChart = echarts.init(document.getElementById('pieImage'))
+        // 绘制图表
+        var option = {
+          tooltip: {
+            trigger: 'item',
+            formatter: '{a} <br/>{b}: {c} ({d}%)'
+          },
+          legend: {
+            orient: 'vertical',
+            x: 'left',
+            data: ['已完成', '进行中']
+          },
+          series: [
+            {
+              name: '任务状态',
+              type: 'pie',
+              radius: ['50%', '70%'],
+              avoidLabelOverlap: false,
+              label: {
+                normal: {
+                  show: false,
+                  position: 'center'
+                },
+                emphasis: {
+                  show: true,
+                  textStyle: {
+                    fontSize: '30',
+                    fontWeight: 'bold'
+                  }
+                }
+              },
+              labelLine: {
+                normal: {
+                  show: false
+                }
+              },
+              data: this.progress,
+              color: ['#909399', '#409EFF']
+            }
+          ]
         }
-      })
-    },
-    handleDelete (index, id) {
-      this.$confirm('确认删除该任务?')
-        .then(_ => {
-          //done()
-          //id->taskid
-          console.log(id)
-          console.log(this.projectId)
-          deleteTask(this.projectId,id,this.deleteTaskSuccess,this.deleteTaskFail)
+        myChart.setOption(option)
+      },
+      //提交修改
+      submitForm(formName) {
+        this.$refs['project'].validate(valid => {
+          if (valid) {
+            this.showLoading()
+            const newProject = {
+              userId: this.user.userVO.id,
+              name: this.project.name,
+              type: this.project.type,
+              platform: this.project.platform,
+              valuationStandard: this.project.valuationStandard,
+              entrustUnit: this.project.entrustUnit,
+              field: this.project.field,
+              desc: this.project.desc,
+              resource: this.project.resource,
+              location: getProvinceNameByProvinceCode(this.project.location.provinceCode, this.project.location.cityCode),
+              institution: this.project.institution == null ? null : this.project.institution.id,
+              contactName: this.project.contactName,
+              contactPhone: this.project.contactPhone,
+              doc: this.project.requireDocUrl,
+              file: this.project.fileUrl,
+              budget: this.project.budget,
+              price: this.project.price,
+              datetime: this.project.datetime,
+              usage: this.project.usage,
+            }
+            console.log(newProject);
+            Http.put(Apis.PROJECT.UPDATE_PROJECT.replace('{projectId}', this.projectId), newProject).then((res) => {
+              console.log(res)
+              this.projectId = res.projectDetails.id
+              this.project.name = res.projectDetails.name
+              this.project.contactName = res.projectDetails.contactName
+              this.project.contactPhone = res.projectDetails.contactPhone
+              this.project.type = res.projectDetails.type
+              this.project.platform = res.projectDetails.platform
+              this.project.valuationStandard = res.projectDetails.valuationStandard
+              this.project.entrustUnit = res.projectDetails.entrustUnit
+              this.project.field = res.projectDetails.field
+              this.project.desc = res.projectDetails.desc
+              this.project.doc = []
+              this.project.file = []
+              this.project.resource = res.projectDetails.resource
+              this.project.location = getProvinceCodeByProvinceName(res.projectDetails.location.provinceCode, res.projectDetails.location.cityCode)
+              this.project.institution = res.projectDetails.institution
+              this.project.datetime = new Date(res.projectDetails.datetime)
+              this.project.price = res.projectDetails.price
+              this.project.budget = res.projectDetails.budget
+              this.project.usage = res.projectDetails.usage
+              this.project.fileUrl = res.projectDetails.file
+              this.project.requireDocUrl = res.projectDetails.doc
+              this.task = res.taskList
+              this.reportList = res.reportList
+              this.isModifyMode = false
+              this.hideLoading()
+              notify('success', '项目修改成功')
+            }).catch(error => {
+              this.hideLoading()
+              notify('error', error.data)
+              console.log(error)
+            })
+          } else {
+            notify('error', '表单填写错误!')
+            return false
+          }
         })
-        .catch(_ => {
-          notify('error', '删除失败')
+      },
+      //重置表单
+      resetForm(formName) {
+        this.$refs[formName].resetFields()
+        this.project.name = ''
+        this.project.type = []
+        this.project.platform = ''
+        this.project.valuationStandard = ''
+        this.project.entrustUnit = ''
+        this.project.field = ''
+        this.project.desc = ''
+        this.project.doc = ''
+        this.project.file = ''
+        this.project.contactName = ''
+        this.project.contactPhone = ''
+        this.project.resource = '2'
+        this.project.institution = ''
+        this.project.datetime = ''
+        this.project.price = ''
+        this.project.usage = ''
+        this.project.budget = ''
+      },
+      //进入修改项目页面
+      modifyForm() {
+        this.isModifyMode = true
+        // this.project.type = []
+        // this.project.platform = ''
+        // this.project.field = ''
+        // console.log(this.project.doc)
+        //this.setInstitutions()
+        //获得update 信息
+        //this.loadData()
+      },
+      //接收项目
+      receiveProject() {
+        this.$confirm('确认接收项目?', '提示', {
+          confirmButtonText: '确认接收',
+          cancelButtonText: '取消',
+          type: 'success'
+        }).then(() => {
+          this.showLoading()
+          console.log('接收项目')
+          receiveProjectRequest(this.projectId, this.user.userVO.id, this.receiveProjectSuccess, this.receiveProjectFail)
+        }).catch(() => {
         })
-      //this.task.splice(index, 1)
-    },
-    deleteTaskSuccess(res){
-      notify('success', '删除成功')
-    },
-    deleteTaskFail(error){
-      console.log(error)
-      notify('error', '删除失败:'+error)
-    },
-    beforeApkUpload (file) {
-      return true;
-      //const fileTypeList = ['dmg', 'exe', 'apk']
-      //return checkFileType(file, fileTypeList, this.beforeFileUploadError)
-    },
-    beforeFileUpload (file) {
-      return true;
-      //const fileTypeList = ['pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt']
-      //return checkFileType(file, fileTypeList, this.beforeFileUploadError)
-    },
-    beforeFileUploadError () {
-      this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
-    },
-    analyseDemand () {
-      this.$router.push({name: 'AnalyseDemand'})
-    },
-    handleAccept (index, id) {
-      console.log('接收')
-    },
-    handleReject (index, id) {
-      console.log('拒绝')
-    },
-    loadData () {//PROJ--2019073114009
-      this.showLoading()
-      Http.get(Apis.PROJECT.GET_PROJECT.replace('{projectId}', this.projectId)).then((res) => {
-        console.log(res)
-        this.projectId = res.projectDetails.id
-        this.project.name = res.projectDetails.name
-        this.project.contactName = res.projectDetails.contactName
-        this.project.contactPhone = res.projectDetails.contactPhone
-        this.project.type = res.projectDetails.type
-        this.project.platform = res.projectDetails.platform
-        this.project.valuationStandard = res.projectDetails.valuationStandard
-        this.project.entrustUnit = res.projectDetails.entrustUnit
-        this.project.field = res.projectDetails.field
-        this.project.desc = res.projectDetails.desc
-        this.project.doc = []
-        this.project.file = []
-        this.project.resource = res.projectDetails.resource
-        this.project.location = getProvinceCodeByProvinceName(res.projectDetails.location.provinceCode, res.projectDetails.location.cityCode)
+      },
+      receiveProjectSuccess(res) {
+        this.hideLoading()
+        notify('success', '项目接收成功!')
+        this.projectOperationControl = res.projectOperationControl
+        this.project.status = res.projectDetails.status
         this.project.institution = res.projectDetails.institution
-        this.project.datetime = new Date(res.projectDetails.datetime)
-        this.project.price = res.projectDetails.price
-        this.project.budget = res.projectDetails.budget
-        this.project.usage = res.projectDetails.usage
-        this.project.fileUrl = res.projectDetails.file
-        this.project.requireDocUrl = res.projectDetails.doc
-        this.project.userId = res.projectDetails.userId
+      },
+      receiveProjectFail(error) {
+        this.hideLoading()
+        notify('error', '接收项目失败:' + error.data)
+      },
+      //拒绝项目
+      rejectProject() {
+        this.$confirm('确认拒绝项目?', '提示', {
+          confirmButtonText: '确认拒绝',
+          cancelButtonText: '取消',
+          type: 'success'
+        }).then(() => {
+          this.showLoading()
+          rejectProject(this.projectId, this.rejectProjectSuccess, this.rejectProjectFail)
+        }).catch(() => {
+        })
+
+      },
+      rejectProjectSuccess(res) {
+        this.hideLoading()
+        notify('success', '拒绝项目成功')
+      },
+      rejectProjectFail(error) {
+        this.hideLoading()
+        notify('error', '拒绝项目失败:' + error.data)
+      },
+      //提交项目
+      submitProjectRequest() {
+        this.$confirm('确认提交项目?', '提示', {
+          confirmButtonText: '确认提交',
+          cancelButtonText: '取消',
+          type: 'success'
+        }).then(() => {
+          this.showLoading()
+          submitProjectRequest(this.projectId, this.submitProjectRequestSuccess, this.submitProjectRequestFail)
+        }).catch(() => {
+        })
+      },
+      submitProjectRequestSuccess(res) {
+        this.hideLoading()
+        notify('success', '项目提交成功!')
+        this.loadData()
+        this.projectOperationControl = res.projectOperationControl
         this.project.status = res.projectDetails.status
-        this.project.statusVO = res.projectDetails.statusVO
-        this.task = res.taskList
-        this.reportList = res.reportList
+        this.project.institution = res.projectDetails.institution
+      },
+      submitProjectRequestFail(error) {
+        this.hideLoading()
+        notify('error', '提交项目失败:' + error.data)
+      },
+      //结束项目
+      endProject() {
+        this.$confirm('确认结束项目?', '提示', {
+          confirmButtonText: '确认结束',
+          cancelButtonText: '取消',
+          type: 'success'
+        }).then(() => {
+          this.showLoading()
+          ensureEndProject(this.projectId, this.endProjectSuccess, this.endProjectFail)
+        }).catch(() => {
+        })
+
+      },
+      endProjectSuccess(res) {
+        this.hideLoading()
+        notify('success', '项目提交成功!')
+        this.loadData()
         this.projectOperationControl = res.projectOperationControl
-        this.progress = res.progress
+        this.project.status = res.projectDetails.status
+        this.project.institution = res.projectDetails.institution
+      },
+      endProjectFail(error) {
         this.hideLoading()
-        this.handleShowTaskListOrNot()
-        for(var i = 0; i < this.progress.length; i++){
-          if(this.progress[i].value != 0){
+        notify('error', '结束项目失败:' + error.data)
+      },
+      cancelMode(formName) {
+        this.isModifyMode = false
+        this.loadData()
+
+      },
+      goToTaskDetail(projectId, taskId) {
+        this.$router.push({
+          name: 'Task',
+          params: {projectId: projectId, taskId: taskId}
+        })
+      },
+      createNewTask() {
+        const that = this
+        this.$router.push({
+          name: 'TaskCreate',
+          params: {projectId: that.projectId}
+        })
+      },
+      createReport() {
+        this.$router.push({
+          name: 'ProjectReportCreate',
+          params: {
+            scope: 0,
+            dependencyCode: this.projectId,
+            projectId: this.projectId,
+          }
+        })
+      },
+      handleDelete(index, id) {
+        this.$confirm('确认删除该任务?')
+          .then(_ => {
+            //done()
+            //id->taskid
+            console.log(id)
+            console.log(this.projectId)
+            deleteTask(this.projectId, id, this.deleteTaskSuccess, this.deleteTaskFail)
+          })
+          .catch(_ => {
+            notify('error', '删除失败')
+          })
+        //this.task.splice(index, 1)
+      },
+      deleteTaskSuccess(res) {
+        notify('success', '删除成功')
+      },
+      deleteTaskFail(error) {
+        console.log(error)
+        notify('error', '删除失败:' + error)
+      },
+      beforeApkUpload(file) {
+        return true;
+        //const fileTypeList = ['dmg', 'exe', 'apk']
+        //return checkFileType(file, fileTypeList, this.beforeFileUploadError)
+      },
+      beforeFileUpload(file) {
+        return true;
+        //const fileTypeList = ['pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt']
+        //return checkFileType(file, fileTypeList, this.beforeFileUploadError)
+      },
+      beforeFileUploadError() {
+        this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
+      },
+      analyseDemand() {
+        this.$router.push({name: 'AnalyseDemand'})
+      },
+      handleAccept(index, id) {
+        console.log('接收')
+      },
+      handleReject(index, id) {
+        console.log('拒绝')
+      },
+      loadData() {//PROJ--2019073114009
+        this.showLoading()
+        Http.get(Apis.PROJECT.GET_PROJECT.replace('{projectId}', this.projectId)).then((res) => {
+          console.log(res)
+          console.log(typeof res.projectDetails.field)
+          this.projectId = res.projectDetails.id
+          this.project.name = res.projectDetails.name
+          this.project.contactName = res.projectDetails.contactName
+          this.project.contactPhone = res.projectDetails.contactPhone
+          this.project.type = res.projectDetails.type
+          this.project.platform = res.projectDetails.platform
+          this.project.valuationStandard = res.projectDetails.valuationStandard
+          this.project.entrustUnit = res.projectDetails.entrustUnit
+          this.project.field = res.projectDetails.field
+          console.log(res.projectDetails.field)
+          console.log(this.project.field)
+          this.project.desc = res.projectDetails.desc
+          this.project.doc = []
+          this.project.file = []
+          this.project.resource = res.projectDetails.resource
+          this.project.location = getProvinceCodeByProvinceName(res.projectDetails.location.provinceCode, res.projectDetails.location.cityCode)
+          this.project.institution = res.projectDetails.institution
+          this.project.datetime = new Date(res.projectDetails.datetime)
+          this.project.price = res.projectDetails.price
+          this.project.budget = res.projectDetails.budget
+          this.project.usage = res.projectDetails.usage
+          this.project.fileUrl = res.projectDetails.file
+          this.project.requireDocUrl = res.projectDetails.doc
+          this.project.userId = res.projectDetails.userId
+          this.project.status = res.projectDetails.status
+          this.project.statusVO = res.projectDetails.statusVO
+          this.task = res.taskList
+          this.reportList = res.reportList
+          this.projectOperationControl = res.projectOperationControl
+          this.progress = res.progress
+          console.log(this.project)
+          this.hideLoading()
+          this.handleShowTaskListOrNot()
+          for (var i = 0; i < this.progress.length; i++) {
+            if (this.progress[i].value != 0) {
               this.setEcharts()
               break
+            }
           }
-        }
-      }).catch((error) => {
-        this.hideLoading()
-        // notify('error', error.data)
-      })
-    },
+        }).catch((error) => {
+          this.hideLoading()
+          // notify('error', error.data)
+        })
+      },
 
-    handleShowTaskListOrNot () {
-      // console.log(storageGet('user')['userVO']['id'])
-      if(storageGet('user')['userVO']['id'] === this.project.userId){
-        this.showTaskList = false
-      }
-    },
+      handleShowTaskListOrNot() {
+        // console.log(storageGet('user')['userVO']['id'])
+        if (storageGet('user')['userVO']['id'] === this.project.userId) {
+          this.showTaskList = false
+        }
+      },
 
-    locationChange (provinceId, cityId) {
-      if (provinceId || cityId) {
-        this.project.location = {provinceCode: provinceId, cityCode: cityId}
-      }
-    },
-    handleRemove (file, fileList) {
-      console.log(file, fileList)
-    },
-    handleExceed (files, fileList) {
-      this.$message.warning(
-        `当前限制选择 1 个文件,本次选择了 ${
-          files.length
-          } 个文件,共选择了 ${files.length + fileList.length} 个文件`
-      )
-    },
-    beforeRemove (file, fileList) {
-      //return this.$confirm(`确定移除 ${file.name}?`)
-    },
-    beforeUploadRequireDoc () {
-    },
-    beforeUploadApkFile () {
-    },
-    uploadRequireDoc (param) {
-      this.showLoading()
-      const formData = new FormData()
-      let config = {
-        //添加请求头
-        headers: {'Content-Type': 'multipart/form-data'},
-      }
-      formData.append('file', param.file)
-      Http.upload(Apis.FILE.REQUIREMENT_FILE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
-        this.project.requireDocUrl = res.data
-        this.hideLoading()
-        notify('success', '需求文档上传成功')
-      }).catch((error) => {
-        this.hideLoading()
-        notify('error', '需求文档上传失败:' + error.data)
-      })
-    },
-    uploadApkFile (param) {
-      this.showLoading()
-      const formData = new FormData()
-      let config = {
-        //添加请求头
-        headers: {'Content-Type': 'multipart/form-data'},
-      }
-      formData.append('file', param.file)
-      Http.upload(Apis.FILE.APK.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
-        this.project.fileUrl = res.data
-        this.hideLoading()
-        notify('success', '文件上传成功')
-      }).catch((error) => {
-        this.hideLoading()
-        this.project.file = []
-        notify('error', '文件上传失败')
-      })
-    },
-    setServiceType () {
+      locationChange(provinceId, cityId) {
+        if (provinceId || cityId) {
+          this.project.location = {provinceCode: provinceId, cityCode: cityId}
+        }
+      },
+      handleRemove(file, fileList) {
+        console.log(file, fileList)
+      },
+      handleExceed(files, fileList) {
+        this.$message.warning(
+          `当前限制选择 1 个文件,本次选择了 ${
+            files.length
+            } 个文件,共选择了 ${files.length + fileList.length} 个文件`
+        )
+      },
+      beforeRemove(file, fileList) {
+        //return this.$confirm(`确定移除 ${file.name}?`)
+      },
+      beforeUploadRequireDoc() {
+      },
+      beforeUploadApkFile() {
+      },
+      uploadRequireDoc(param) {
+        this.showLoading()
+        const formData = new FormData()
+        let config = {
+          //添加请求头
+          headers: {'Content-Type': 'multipart/form-data'},
+        }
+        formData.append('file', param.file)
+        Http.upload(Apis.FILE.REQUIREMENT_FILE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
+          this.project.requireDocUrl = res.data
+          this.hideLoading()
+          notify('success', '需求文档上传成功')
+        }).catch((error) => {
+          this.hideLoading()
+          notify('error', '需求文档上传失败:' + error.data)
+        })
+      },
+      uploadApkFile(param) {
+        this.showLoading()
+        const formData = new FormData()
+        let config = {
+          //添加请求头
+          headers: {'Content-Type': 'multipart/form-data'},
+        }
+        formData.append('file', param.file)
+        Http.upload(Apis.FILE.APK.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
+          this.project.fileUrl = res.data
+          this.hideLoading()
+          notify('success', '文件上传成功')
+        }).catch((error) => {
+          this.hideLoading()
+          this.project.file = []
+          notify('error', '文件上传失败')
+        })
+      },
+      setServiceType() {
         getAllServiceTypes().then((res) => {
-            this.serviceType = res
+          this.serviceType = res
         })
-    },
-    setPlatformType () {
+      },
+      setPlatformType() {
         getAllPlatformTypes().then((res) => {
-            this.platforms = res
+          this.platforms = res
         })
-    },
-    setFields(){
+      },
+      setFields() {
         getAllFields().then((res) => {
-            this.fields = res
+          this.fields = res
         })
-    }  ,
-    setInstitutions () {
-      getAllInstitutions().then((res) => {
-        this.institutionArray = res
-      }).catch((error) => {
-        notify('error', '获取institution失败' + error.data)
-      })
-    },
-    setUserInfo () {
-      this.user = storageGet('user')
-    },
-    checkPhoneNumber(phoneNumber){
-      return /^1[3456789]\d{9}$/.test(phoneNumber)
-    },
-    showLoading () {
-      this.loading = true
-    },
-    hideLoading () {
-      this.loading = false
-    },
-    reformDate (date) {
-      return getFormalTimeFromDate(date)
-    },
-    dateFormat (date, format) {
-      date = new Date(date)
-      let o = {
-        'M+' : date.getMonth() + 1, //month
-        'd+' : date.getDate(), //day
-        'H+' : date.getHours(), //hour+8小时
-        'm+' : date.getMinutes(), //minute
-        's+' : date.getSeconds(), //second
-        'q+' : Math.floor((date.getMonth() + 3) / 3), //quarter
-        'S' : date.getMilliseconds() //millisecond
-      }
-      if (/(y+)/.test(format)){
-        format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
-      }
+      },
+      setInstitutions() {
+        getAllInstitutions().then((res) => {
+          this.institutionArray = res
+        }).catch((error) => {
+          notify('error', '获取institution失败' + error.data)
+        })
+      },
+      setUserInfo() {
+        this.user = storageGet('user')
+      },
+      checkPhoneNumber(phoneNumber) {
+        return /^1[3456789]\d{9}$/.test(phoneNumber)
+      },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
+      reformDate(date) {
+        return getFormalTimeFromDate(date)
+      },
+      dateFormat(date, format) {
+        date = new Date(date)
+        let o = {
+          'M+': date.getMonth() + 1, //month
+          'd+': date.getDate(), //day
+          'H+': date.getHours(), //hour+8小时
+          'm+': date.getMinutes(), //minute
+          's+': date.getSeconds(), //second
+          'q+': Math.floor((date.getMonth() + 3) / 3), //quarter
+          'S': date.getMilliseconds() //millisecond
+        }
+        if (/(y+)/.test(format)) {
+          format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
+        }
 
-      for (let k in o)
-        if (new RegExp('(' + k + ')').test(format))
-          format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
+        for (let k in o)
+          if (new RegExp('(' + k + ')').test(format))
+            format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
 
-      return format;
+        return format;
+      }
     }
   }
-}
 </script>
 
 <style lang="less" scoped>

+ 15 - 9
src/pages/DetailPage/CrowdDetail.vue

@@ -125,15 +125,21 @@
             gotoHome(){
                 this.$router.push('/home');
             },
-            checkLogin(){
-                if(!this.isLogin){
-                    console.log("请登录后访问");
-                    notify('warning','请登录后访问');
-                }else{
-                    console.log("已登录");
-                    this.$router.push('/project/create');
-                }
-            },
+          checkLogin() {
+            this.checkCreateProjectAuth();
+          },
+          checkCreateProjectAuth() {
+            if (!this.isLogin) {
+              console.log("请登录后访问");
+              notify('warning', '请登录后访问');
+            } else if (this.isLogin) {
+              Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                this.$router.push('/project/create');
+              }).catch((error) => {
+                notify('error', error.data)
+              })
+            }
+          },
             handleSearchData(){
               this.activePage = 1;
               this.getCrowdProject();

+ 15 - 9
src/pages/HomepageSearch/AgencyList.vue

@@ -146,15 +146,21 @@
             hideLoading () {
                 this.loading = false
             },
-            checkLogin() {
-                if (!this.isLogin) {
-                    console.log("请登录后访问");
-                    notify('warning', '请登录后访问');
-                } else {
-                    console.log("已登录");
-                    this.$router.push('/project/create');
-                }
-            },
+          checkLogin() {
+            this.checkCreateProjectAuth();
+          },
+          checkCreateProjectAuth() {
+            if (!this.isLogin) {
+              console.log("请登录后访问");
+              notify('warning', '请登录后访问');
+            } else if (this.isLogin) {
+              Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                this.$router.push('/project/create');
+              }).catch((error) => {
+                notify('error', error.data)
+              })
+            }
+          },
             handleSearchData() {
                 if (this.searchType == 0) {
                     // this.$router.push({name: 'Square2.0', params: {searchVal: this.searchVal, searchType: "project"}});

+ 15 - 9
src/pages/HomepageSearch/AgencyResidentList.vue

@@ -130,15 +130,21 @@
                     this.totalElements=res.data.totalElements;
                 })
             },
-            checkLogin() {
-                if (!this.isLogin) {
-                    console.log("请登录后访问");
-                    notify('warning', '请登录后访问');
-                } else {
-                    console.log("已登录");
-                    this.$router.push('/project/create');
-                }
-            },
+          checkLogin() {
+            this.checkCreateProjectAuth();
+          },
+          checkCreateProjectAuth() {
+            if (!this.isLogin) {
+              console.log("请登录后访问");
+              notify('warning', '请登录后访问');
+            } else if (this.isLogin) {
+              Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                this.$router.push('/project/create');
+              }).catch((error) => {
+                notify('error', error.data)
+              })
+            }
+          },
             handleSearchData() {
                 let url = '/api/resident/agency/more';
                 let params = {

+ 15 - 9
src/pages/HomepageSearch/CompetitionList.vue

@@ -128,15 +128,21 @@
                     this.totalElements=res.data.totalElements;
                 })
             },
-            checkLogin() {
-                if (!this.isLogin) {
-                    console.log("请登录后访问");
-                    notify('warning', '请登录后访问');
-                } else {
-                    console.log("已登录");
-                    this.$router.push('/project/create');
-                }
-            },
+          checkLogin() {
+            this.checkCreateProjectAuth();
+          },
+          checkCreateProjectAuth() {
+            if (!this.isLogin) {
+              console.log("请登录后访问");
+              notify('warning', '请登录后访问');
+            } else if (this.isLogin) {
+              Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                this.$router.push('/project/create');
+              }).catch((error) => {
+                notify('error', error.data)
+              })
+            }
+          },
             handleSearchData() {
                 let url = '/api/common/index/competition';
                 let params = {

+ 15 - 9
src/pages/HomepageSearch/CrowdList.vue

@@ -128,15 +128,21 @@
                     this.totalElements=res.data.totalElements;
                 })
             },
-            checkLogin() {
-                if (!this.isLogin) {
-                    console.log("请登录后访问");
-                    notify('warning', '请登录后访问');
-                } else {
-                    console.log("已登录");
-                    this.$router.push('/project/create');
-                }
-            },
+          checkLogin() {
+            this.checkCreateProjectAuth();
+          },
+          checkCreateProjectAuth() {
+            if (!this.isLogin) {
+              console.log("请登录后访问");
+              notify('warning', '请登录后访问');
+            } else if (this.isLogin) {
+              Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                this.$router.push('/project/create');
+              }).catch((error) => {
+                notify('error', error.data)
+              })
+            }
+          },
             handleSearchData() {
                 let url = '/api/common/index/application';
                 let params = {

+ 15 - 9
src/pages/HomepageSearch/ExpertList.vue

@@ -106,15 +106,21 @@
                 this.searchVal = this.$route.params.searchVal;
                 this.handleSearchData();
             },
-            checkLogin() {
-                if (!this.isLogin) {
-                    console.log("请登录后访问");
-                    notify('warning', '请登录后访问');
-                } else {
-                    console.log("已登录");
-                    this.$router.push('/project/create');
-                }
-            },
+          checkLogin() {
+            this.checkCreateProjectAuth();
+          },
+          checkCreateProjectAuth() {
+            if (!this.isLogin) {
+              console.log("请登录后访问");
+              notify('warning', '请登录后访问');
+            } else if (this.isLogin) {
+              Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                this.$router.push('/project/create');
+              }).catch((error) => {
+                notify('error', error.data)
+              })
+            }
+          },
             handleSearchData() {
                 if(this.searchType == 0){
                     this.$router.push({name: 'Square', params: {searchVal: this.searchVal, searchType: "project", currTab: "project"}});

+ 15 - 7
src/pages/HomepageSearch/ResourceList.vue

@@ -141,13 +141,21 @@
                 this.searchVal = this.$route.params.searchVal;
                 this.handleSearchData();
             },
-            checkLogin() {
-                if (!this.isLogin) {
-                    notify('warning', '请登录后访问');
-                } else {
-                    this.$router.push('/project/create');
-                }
-            },
+          checkLogin() {
+            this.checkCreateProjectAuth();
+          },
+          checkCreateProjectAuth() {
+            if (!this.isLogin) {
+              console.log("请登录后访问");
+              notify('warning', '请登录后访问');
+            } else if (this.isLogin) {
+              Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                this.$router.push('/project/create');
+              }).catch((error) => {
+                notify('error', error.data)
+              })
+            }
+          },
             handleSearchData() {
 
                 if(this.searchType == 0){

+ 15 - 9
src/pages/HomepageSearch/UserList.vue

@@ -141,15 +141,21 @@
                     this.totalElements=res.data.totalElements;
                 })
             },
-            checkLogin() {
-                if (!this.isLogin) {
-                    console.log("请登录后访问");
-                    notify('warning', '请登录后访问');
-                } else {
-                    console.log("已登录");
-                    this.$router.push('/project/create');
-                }
-            },
+          checkLogin() {
+            this.checkCreateProjectAuth();
+          },
+          checkCreateProjectAuth() {
+            if (!this.isLogin) {
+              console.log("请登录后访问");
+              notify('warning', '请登录后访问');
+            } else if (this.isLogin) {
+              Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                this.$router.push('/project/create');
+              }).catch((error) => {
+                notify('error', error.data)
+              })
+            }
+          },
             handleSearchData() {
                 let url = '/api/common/index/user/more';
                 let params = {

+ 15 - 9
src/pages/Square/PopularProjectAndTaskList.vue

@@ -202,15 +202,21 @@
                 // this.currTab = this.searchType;
                 this.activePage = 1;
             },
-            checkLogin(){
-                if(!this.isLogin){
-                    console.log("请登录后访问");
-                    notify('warning','请登录后访问');
-                }else{
-                    console.log("已登录");
-                    this.$router.push('/project/create');
-                }
-            },
+          checkLogin() {
+            this.checkCreateProjectAuth();
+          },
+          checkCreateProjectAuth() {
+            if (!this.isLogin) {
+              console.log("请登录后访问");
+              notify('warning', '请登录后访问');
+            } else if (this.isLogin) {
+              Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                this.$router.push('/project/create');
+              }).catch((error) => {
+                notify('error', error.data)
+              })
+            }
+          },
             handleSearchData(){
                 console.log("this.searchVal  "  + this.searchVal)
                 this.activePage = 1;

+ 14 - 8
src/pages/Square/Square2.0.vue

@@ -183,14 +183,20 @@
               this.hotCrowdTaskVOs = res.data.hotCrowdTaskVOs;
           })
       },
-      checkLogin(){
-          if(!this.isLogin){
-              console.log("请登录后访问");
-              notify('warning','请登录后访问');
-          }else{
-              console.log("已登录");
-              this.$router.push('/project/create');
-          }
+      checkLogin() {
+        this.checkCreateProjectAuth();
+      },
+      checkCreateProjectAuth() {
+        if (!this.isLogin) {
+          console.log("请登录后访问");
+          notify('warning', '请登录后访问');
+        } else if (this.isLogin) {
+          Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+            this.$router.push('/project/create');
+          }).catch((error) => {
+            notify('error', error.data)
+          })
+        }
       },
       handleSearchData(){
         let url = '/api/square/search/list';

+ 14 - 8
src/pages/Technology/Technology2.0.vue

@@ -110,14 +110,20 @@
               this.isLogin = true;
           }
       },
-      checkLogin(){
-          if(!this.isLogin){
-              console.log("请登录后访问");
-              notify('warning','请登录后访问');
-          }else{
-              console.log("已登录");
-              this.$router.push('/project/create');
-          }
+      checkLogin() {
+        this.checkCreateProjectAuth();
+      },
+      checkCreateProjectAuth() {
+        if (!this.isLogin) {
+          console.log("请登录后访问");
+          notify('warning', '请登录后访问');
+        } else if (this.isLogin) {
+          Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+            this.$router.push('/project/create');
+          }).catch((error) => {
+            notify('error', error.data)
+          })
+        }
       },
       gotoHome(){
         this.$router.push('/home');

+ 14 - 8
src/pages/Technology/TechnologyMore.vue

@@ -100,14 +100,20 @@
               this.isLogin = true;
           }
       },
-      checkLogin(){
-          if(!this.isLogin){
-              console.log("请登录后访问");
-              notify('warning','请登录后访问');
-          }else{
-              console.log("已登录");
-              this.$router.push('/project/create');
-          }
+      checkLogin() {
+        this.checkCreateProjectAuth();
+      },
+      checkCreateProjectAuth() {
+        if (!this.isLogin) {
+          console.log("请登录后访问");
+          notify('warning', '请登录后访问');
+        } else if (this.isLogin) {
+          Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+            this.$router.push('/project/create');
+          }).catch((error) => {
+            notify('error', error.data)
+          })
+        }
       },
       gotoHome(){
         this.$router.push('/home');

+ 14 - 8
src/pages/UserCenter/Mine.vue

@@ -41,8 +41,8 @@
           <provincecity
             ref="addFormProvince"
             @selectChange="locationChange"
-            :provinceCode="location?location.provinceCode:'3200'"
-            :cityCode="location?location.cityCode:'3201'"
+            :provinceCode="userForm.location.provinceCode!==''?userForm.location.provinceCode:'3200'"
+            :cityCode="userForm.location.cityCode!==''?userForm.location.cityCode:'3201'"
           ></provincecity>
 <!--          :isModifyMode="!isModifyMode"-->
         </el-form-item>
@@ -82,8 +82,8 @@
           personalCompetence:[],
           province:'',
           city:'',
+          location:{},
         },
-        location:{},
         pickerOptions: {
           disabledDate(time) {
             return time.getTime() > Date.now();
@@ -118,7 +118,14 @@
       submitUserInfo() {
         this.$refs['userForm'].validate(valid => {
           if (valid) {
-            Http.put(`/api/personal/update/${this.user.id}`, this.userForm).then(res => {
+            let location = getProvinceNameByProvinceCode(this.userForm.province, this.userForm.city);
+            console.log(location)
+            this.userForm.province = location.provinceCode;
+            this.userForm.city = location.cityCode;
+            let params = this.userForm;
+            delete params.location;
+            console.log(params);
+            Http.put(`/api/personal/update/${this.user.id}`, params).then(res => {
               this.isModifyMode = false;
               notify('success', '修改成功 ')
             })
@@ -180,10 +187,9 @@
           this.userForm.province = res.userVO.province ? res.userVO.province : '';
           this.userForm.city = res.userVO.city ? res.userVO.city : '';
           this.userForm.personalCompetence = res.userVO.personalCompetence ? res.userVO.personalCompetence : [];
-          let location = getProvinceCodeByProvinceName(this.userForm.province, this.userForm.city);
-          this.userForm.province = location&&location.provinceCode;
-          this.userForm.city = location&&location.cityCode;
-          this.location = location;
+          this.location = getProvinceCodeByProvinceName(this.userForm.province, this.userForm.city);
+          this.userForm.province = this.location&&this.location.provinceCode;
+          this.userForm.city = this.location&&this.location.cityCode;
         })
       },
       setUserInfo(){

+ 6 - 1
src/pages/UserCenter/ReBindingMail.vue

@@ -83,7 +83,12 @@
             this.hasVerifyCode = false;
           } else {
             notify('success', '重新绑定成功');
-            this.$router.push({path: '/personal/mailBinding'});
+            window.alert('密码修改成功,请重新登录');
+            logout().then((res) => {
+              window.location.href = process.env.LOGIN_URL;
+              // this.$router.push('/home')
+            })
+            // this.$router.push({path: '/personal/mailBinding'});
           }
         })