Bläddra i källkod

Merge branch 'dev' into 'master'

Dev

See merge request tuosi-crowd-test-service/cofotest-frontend!3
冯翔 2 år sedan
förälder
incheckning
73ff6dafb7

+ 1 - 1
.gitignore

@@ -1,7 +1,7 @@
 .DS_Store
 node_modules/
 /dist/
-/tool4deploy/
+#/tool4deploy/
 npm-debug.log*
 yarn-debug.log*
 yarn-error.log*

+ 43 - 4
src/components/task/Task.vue

@@ -157,6 +157,8 @@
               <el-button v-if="taskOperationControl.update||taskOperationControl.taskRecommend" @click="manageVirtualMachine()" type="primary" size="mini">管理虚拟机</el-button>
               <el-button v-if="taskOperationControl.writeReport||taskOperationControl.uploadReport" @click="connectVirtualMachine()" type="primary" size="mini">连接虚拟机</el-button>
               <el-button size="mini" @click="toProject()">项目详情</el-button>
+              <el-button size="mini" @click="toGo()">go语言测试在线测试平台</el-button>
+
               <el-popover
                 placement="top-start"
                 title="确认结束?"
@@ -420,6 +422,8 @@ export default {
       acceptedUserList: [],
       shortLink:'',
       editShortLink:false,
+      creatorId:'',
+      receiverId:''
     }
   },
   watch: {
@@ -433,8 +437,10 @@ export default {
   },
   mounted() {
     this.$nextTick(() => {
-      this.init()
+      this.init();
+
     })
+
   },
   methods: {
     //跳转到任务对应的数据面板
@@ -479,6 +485,7 @@ export default {
       this.getTaskDetail()
       this.getWordCloud()
       this.setInstitutions()
+      this.getProjectInfo()
     },
 
     //北斗测试报告填写跳转
@@ -493,6 +500,21 @@ export default {
         params: {projectId: this.projectId}
       })
     },
+    toGo() {
+      let roleid=1;
+      // console.log(this.user.roleList.length,"this.user.roleList.length");
+      // console.log(this.user.roleList.includes("generalUser"),'this.user.roleList.includes("generalUser")');
+      // console.log(this.receiverId,"this.receiverId   ",this.user.userVO.id,"this.user.userVO.id");
+      // console.log(this.creatorId,'this.creatorId')
+      if(this.user.roleList.length==1 && this.user.roleList.includes("generalUser")){roleid = 1;}
+      if(this.creatorId==this.user.userVO.id){roleid=3;}
+      if(this.taskOperationControl.uploadReport){roleid=4;}
+      if(this.receiverId==this.user.userVO.id){roleid=2;}
+
+      // console.log(roleid,'roleid')
+      let goUrl='http://101.132.74.9:1106/hjc2?project_code='+this.projectId+'&user_id'+this.user.userVO.id+'&role_id='+roleid;
+      window.open(goUrl, '_blank');
+    },
     //切换至可编辑页面
     modifyForm() {
       // this.task.serviceType = ''
@@ -528,13 +550,27 @@ export default {
     //加载用户信息
     setUserInfo() {
       this.user = storageGet('user')
+      console.log(this.user,'this.user')
+
       this.rolesPermissions = storageGet('rolesPermissions')
+      console.log(this.rolesPermissions,'this.rolesPermissions')
       if (storageGet('rolesPermissions').isRegionManager || storageGet('rolesPermissions').isSystemAdministrator) {
         this.showBD = true;
       } else {
         this.showBD = false;
       }
     },
+    getProjectInfo(){
+       Http.get(Apis.PROJECT.GET_PROJECT.replace('{projectId}', this.projectId)).then((res) => {
+          // console.log(res,"获取project res");
+          this.creatorId = res.projectDetails.userId;
+          this.receiverId =res.projectDetails.regionManagerId;
+          // console.log(typeof res.projectDetails.field)
+        }).catch((error) => {
+          // this.hideLoading()
+          // notify('error', error.data)
+        })
+    },
     //加载任务的测试类型
     setServiceType() {
       getAllServiceTypes().then((res) => {
@@ -560,7 +596,7 @@ export default {
     manageVirtualMachine(){
       getToken(this.projectId, this.taskId).then((res) => {
         var token = res.data
-        var url = 'http://49.232.124.49:38080/cloudtest/api/oauth/gateway?website=cofortest&token='+ token + '&userId='+this.user.userVO.id +
+        var url = 'http://docker.chuangchaokeji.cn:38080/cloudtest/api/oauth/gateway?website=cofortest&token='+ token + '&userId='+this.user.userVO.id +
           '&screen=PROJECT' + '&projectId='+this.projectId+'&taskId='+this.taskId;
         window.open(url);
       })
@@ -569,7 +605,7 @@ export default {
     // createVirtualMachine(){
     //   getToken(this.projectId, this.taskId).then((res) => {
     //     var token = res.data
-    //     var url = 'http://49.232.124.49:38080/cloudtest/api/oauth/gateway?website=cofortest&token='+ token + '&userId='+this.user.userVO.id +
+    //     var url = 'http://docker.chuangchaokeji.cn:38080/cloudtest/api/oauth/gateway?website=cofortest&token='+ token + '&userId='+this.user.userVO.id +
     //       '&screen=HOME';
     //     window.open(url);
     //   })
@@ -578,7 +614,7 @@ export default {
     connectVirtualMachine(){
       getToken(this.projectId, this.taskId).then((res) => {
         var token = res.data
-        var url = 'http://49.232.124.49:38080/cloudtest/api/oauth/connect?userId='+this.user.userVO.id+ '&projectId='+
+        var url = 'http://docker.chuangchaokeji.cn:38080/cloudtest/api/oauth/connect?userId='+this.user.userVO.id+ '&projectId='+
           this.projectId+'&taskId='+this.taskId+'&token='+token;
         window.open(url);
       })
@@ -620,6 +656,7 @@ export default {
         serverCode: '',
       }
       this.taskOperationControl = res.taskOperationControl;
+      // console.log(this.taskOperationControl,'this.taskOperationControl')
       this.acceptedUserList = res.acceptedUserList;
       this.crowdReportUrl = res.crowdTaskVO.writeReportUrl;
       this.handleFormatReport(this.acceptedUserList);
@@ -645,7 +682,9 @@ export default {
 
     //处理显示报告
     handleFormatReport(acceptedUserList) {
+      console.log(acceptedUserList,"this.acceptedUserList")
       acceptedUserList.map((user) => {
+
         user.crowdReportVOS && user.crowdReportVOS.map((report) => {
           report.userName = user.userVO.userName;
           this.reportList.push(report);

+ 4 - 4
src/config/index.js

@@ -135,10 +135,10 @@ export const setConfig = (conf) => {
 }
 
 // 开发使用
-export const login_url = 'http://crowd.dev.mooctest.net/page/login?redirect=http%3a%2f%2fcrowd.dev.mooctest.net%2f%23%2fhome'
-export const register_url = 'http://crowd.dev.mooctest.net/page/register'
+// export const login_url = 'http://crowd.dev.mooctest.net/page/login?redirect=http%3a%2f%2fcrowd.dev.mooctest.net%2f%23%2fhome'
+// export const register_url = 'http://crowd.dev.mooctest.net/page/register'
 
 
 // 线上使用
-// export const login_url = 'http://user.cofortest.com:8081/page/login?redirect=http%3a%2f%2fwww.cofortest.com%2f%23%2fhome'
-// export const  register_url = 'http://user.cofortest.com:8081/page/register'
+export const login_url = 'http://user.cofortest.com:8081/page/login?redirect=http%3a%2f%2fwww.cofortest.com%2f%23%2fhome'
+export const  register_url = 'http://user.cofortest.com:8081/page/register'

+ 44 - 35
src/pages/UserCenter/EnterpriseAuth.vue

@@ -36,7 +36,7 @@
         </el-form-item>
         <el-form-item label="企业名称:" prop="evaluationAgencyName">
           <el-input :disabled="!canEdit" v-model="enterpriseForm1.evaluationAgencyName"
-                    placeholder="身份证前后不能有空格"></el-input>
+                    placeholder="企业名称不能为空"></el-input>
         </el-form-item>
         <el-form-item label="营业执照:" prop="businessLicensePhoto" style="width: 850px">
           <el-row class="agency-form-item">
@@ -117,10 +117,10 @@
           <el-input :disabled="!canEdit" v-model="enterpriseForm.address"></el-input>
         </el-form-item>
         <el-form-item label="认证权限" prop="roleList">
-          <el-checkbox-group v-model="enterpriseForm.roleList" :disabled="!canEdit">
-            <el-checkbox :label="1">发包</el-checkbox>
-            <el-checkbox :label="0">接包</el-checkbox>
-          </el-checkbox-group>
+          <el-radio-group v-model="enterpriseForm.roleList" :disabled="!canEdit">
+            <el-radio :label="1">发包企业</el-radio>
+            <el-radio :label="0">测评机构</el-radio>
+          </el-radio-group>
         </el-form-item>
       </el-form>
       <div class="uploader-wrapper">
@@ -216,7 +216,7 @@
           businessLicensePhoto: "",//企业执照
         },
         enterpriseForm: {
-          roleList: [],//0是发包 1是接包 如果两个都有那么权限都有。
+          roleList: 1,//0是发包 1是接包 如果两个都有那么权限都有。
           legalPersonName: "", //法人姓名
           idCardNum: "",//身份证号码
           address: "",//地址
@@ -245,16 +245,16 @@
             {required: false, message: '请输入身份证号码', trigger: 'blur'},
           ],
           address: [
-            {required: true, message: '请输入家庭或单位地址', trigger: 'blur'},
+            {required: false, message: '请输入家庭或单位地址', trigger: 'blur'},
           ],
           gender: [
-            {required: true, message: '请选择性别', trigger: 'blur'}
+            {required: false, message: '请选择性别', trigger: 'blur'}
           ],
           roleList: [
-            {type: 'array', required: true, message: '请至少选择一个认证权限', trigger: 'change'}
+            {required: true, message: '请选择认证权限', trigger: 'change'}
           ],
           idCardDeadTime: [
-            {required: true, message: '请选择身份证过期时间', trigger: 'change'}
+            {required: false, message: '请选择身份证过期时间', trigger: 'change'}
           ]
         }
 
@@ -281,6 +281,36 @@
           if (!valid) {
             notify('error', '信息填写不规范');
             return false
+          }else{
+            let firstSubmit = this.$route.query.type;
+            if (this.enterpriseForm.roleList === 0) {
+              this.enterpriseForm.roleList = ["0", "1"]
+            }else{
+              this.enterpriseForm.roleList = ["1"]
+            }
+            let data = {...this.enterpriseForm, ...this.enterpriseForm1};
+            this.showLoading();
+            if (firstSubmit == 1) {
+              Http.post(`/api/user/${this.user.id}/agency`, data).then(res => {
+                if (res) {
+                  notify('success', '提交成功');
+                  this.$router.push('/personal/authentication')
+                }
+              }).catch(err => {
+                this.hideLoading();
+                notify('error', err.data)
+              })
+            } else {
+              Http.put(`/api/user/${this.user.id}/agency`, data).then(res => {
+                if (res) {
+                  notify('success', '修改成功');
+                  this.$router.push('/personal/authentication')
+                }
+              }).catch(err => {
+                this.hideLoading();
+                notify('error', err.data)
+              })
+            }
           }
         })
          //if (!this.enterpriseForm.idCardPositivePhoto) {
@@ -291,30 +321,7 @@
            //notify('error', '身份证反面照片上传不规范');
            //return false;
          //}
-        let firstSubmit = this.$route.query.type;
-        let data = {...this.enterpriseForm, ...this.enterpriseForm1};
-        this.showLoading();
-        if (firstSubmit == 1) {
-          Http.post(`/api/user/${this.user.id}/agency`, data).then(res => {
-            if (res) {
-              notify('success', '提交成功');
-              this.$router.push('/personal/authentication')
-            }
-          }).catch(err => {
-            this.hideLoading();
-            notify('error', err.data)
-          })
-        } else {
-          Http.put(`/api/user/${this.user.id}/agency`, data).then(res => {
-            if (res) {
-              notify('success', '修改成功');
-              this.$router.push('/personal/authentication')
-            }
-          }).catch(err => {
-            this.hideLoading();
-            notify('error', err.data)
-          })
-        }
+
       },
       //获取当前认证状态
       getAuthStatus() {
@@ -334,7 +341,9 @@
       },
       setFormInfo(detail) {
         //回显认证信息
-        this.enterpriseForm.roleList = detail.roleList,
+        console.log("回显认证信息rolelist", detail.roleList);
+        this.enterpriseForm.roleList = detail.roleList.length >1? 0 : 1 ;
+        console.log(this.enterpriseForm.roleList,"this.enterpriseForm.roleList");
           this.enterpriseForm.legalPersonName = detail.legalPersonName,
           this.enterpriseForm.gender = detail.gender,
           this.enterpriseForm.idCardNum = detail.idCardNum,

+ 11 - 0
tool4deploy/Dockerfile

@@ -0,0 +1,11 @@
+FROM nginx
+
+RUN rm -rf /usr/share/nginx/html/*
+
+COPY ./crowd-web /usr/share/nginx/html/
+
+RUN chmod -R 777 /usr/share/nginx/html
+
+EXPOSE 80
+
+CMD ["nginx", "-g", "daemon off;"]

+ 44 - 0
tool4deploy/conf.d/nginx.conf

@@ -0,0 +1,44 @@
+server {
+        listen       80;
+        server_name  www.cofortest.com;
+        root /usr/share/nginx/html;
+        #charset koi8-r;
+        client_max_body_size 100m;
+        #access_log  logs/host.access.log  main;
+
+        # 开启代理缓冲区
+        proxy_buffering on;
+        # 响应头的缓冲区
+        proxy_buffer_size 128k;
+        # 网页内容缓冲区的个数为4,单个大小为1M
+        proxy_buffers 8 1M;
+        proxy_busy_buffers_size 2M;
+
+        location / {
+            root /usr/share/nginx/html;
+        }
+
+        location /api {
+            proxy_set_header Host                          $host;
+            proxy_set_header X-Real-IP                  $remote_addr;
+            proxy_set_header X-Forwarded-For      $proxy_add_x_forwarded_for;
+            proxy_pass http://backend:8080;
+            proxy_connect_timeout 1200s;
+            proxy_read_timeout 1200s;
+            proxy_send_timeout 1200s;
+        }
+
+        location /recommendationtest {
+            proxy_pass http://taskRecommend:7477;
+        }
+
+
+        #error_page  404              /404.html;
+
+        # redirect server error pages to the static page /50x.html
+        #
+        error_page   500 502 503 504  /50x.html;
+        location = /50x.html {
+            root   html;
+        }
+ }

+ 0 - 0
tool4deploy/crowd-web/.gitkeep


+ 0 - 0
tool4deploy/crowd-web/README.MD


+ 1 - 0
tool4deploy/slider-type.js

@@ -0,0 +1 @@
+export const  slice_type =  0 // 0:online , 1:private