Pārlūkot izejas kodu

调整认证中的userId

sunjh 6 gadi atpakaļ
vecāks
revīzija
f5c91965b4

+ 11 - 4
src/components/authen/AgencyAuthentication.vue

@@ -45,7 +45,8 @@
         </el-form-item>
         <el-form-item label="测评机构资源" prop="name">
           <span v-for="item in authentication.resource" :key="item.id">
-            资源类型:&nbsp;<el-select v-model="item.type" placeholder="请选择" style="width: 150px;margin-bottom: 10px" :value="item.type">
+            资源类型:&nbsp;<el-select v-model="item.type" placeholder="请选择" style="width: 150px;margin-bottom: 10px"
+                                  :value="item.type">
               <el-option
                 v-for="item in resourceTypes"
                 :key="item"
@@ -81,13 +82,14 @@
 import Http from '@/js/http'
 import Apis from '@/js/api'
 import {notify} from '@/constants/index'
-import {getAllAgencyResourceTypes, getAllServiceTypes} from '@/js/index'
+import {getAllAgencyResourceTypes, getAllServiceTypes, storageGet} from '@/js/index'
 
 export default {
   name: 'AgencyAuthentication',
   data () {
     return {
       userId: 0,
+      user: {},
       isModifyMode: true,
       resourceTypes: [],
       serviceTypes: [],
@@ -132,6 +134,7 @@ export default {
     init () {
       this.setServiceTypes()
       this.setResourceTypes()
+      this.setUserInfo()
     },
     //加载数据
     loadData: function () {
@@ -152,7 +155,7 @@ export default {
         resources: this.authentication.resource,
         agencyPhoto: this.authentication.photoUrl,
       }
-      Http.post(Apis.USER.AGENCY_AUTHENTICATION.replace('{userId}', 3), newAuthentication).then((res) => {
+      Http.post(Apis.USER.SUBMIT_AGENCY_AUTHENTICATION_INFO.replace('{userId}', this.user.userVO.id), newAuthentication).then((res) => {
         console.log(res)
         notify('success', '认证信息上传成功')
       }).catch(error => {
@@ -190,7 +193,7 @@ export default {
         headers: {'Content-Type': 'multipart/form-data'},
       }
       formData.append('file', param.file)
-      Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', 3), formData, config).then((res) => {
+      Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
         console.log('上传成功')
         this.authentication.photoUrl = res.data
         console.log(res.data)
@@ -246,6 +249,10 @@ export default {
         }
       }
       return true
+    },
+    //
+    setUserInfo () {
+      this.user = storageGet('user')
     }
   },
   created: function () {

+ 13 - 2
src/components/authen/EnterpriseAuthentication.vue

@@ -51,11 +51,17 @@
 </template>
 
 <script>
+import Http from '@/js/http'
+import Apis from '@/js/api'
+import {notify} from '@/constants/index'
+import {storageGet} from '@/js/index'
+
 export default {
   name: 'EnterpriseAuthentication',
   data () {
     return {
       userId: 0,
+      user: {},
       isModifyMode: true,
       authentication: {
         enterpriseName: '',
@@ -93,6 +99,7 @@ export default {
   methods: {
     //初始化数据
     init () {
+      this.setUserInfo()
     },
     //加载数据
     loadData: function () {
@@ -113,7 +120,7 @@ export default {
         resources: this.authentication.resource,
         agencyPhoto: this.authentication.photoUrl,
       }
-      Http.post(Apis.USER.AGENCY_AUTHENTICATION.replace('{userId}', 3), newAuthentication).then((res) => {
+      Http.post(Apis.USER.SUBMIT_ENTERPRISE_AUTHENTICATION_INFO.replace('{userId}', this.user.userVO.id), newAuthentication).then((res) => {
         console.log(res)
         notify('success', '认证信息上传成功')
       }).catch(error => {
@@ -151,7 +158,7 @@ export default {
         headers: {'Content-Type': 'multipart/form-data'},
       }
       formData.append('file', param.file)
-      Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', 3), formData, config).then((res) => {
+      Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
         console.log('上传成功')
         this.authentication.photoUrl = res.data
         console.log(res.data)
@@ -160,6 +167,10 @@ export default {
         notify('error', error.data.msg)
       })
     },
+    //
+    setUserInfo () {
+      this.user = storageGet('user')
+    },
     //测试用函数
     test () {
 

+ 10 - 5
src/components/authen/IndividualAuthentication.vue

@@ -58,7 +58,8 @@ import {
   getAllAgencyResourceTypes,
   getAllServiceTypes,
   getProvinceCodeByProvinceName,
-  getProvinceNameByProvinceCode
+  getProvinceNameByProvinceCode,
+  storageGet,
 } from '@/js/index'
 
 export default {
@@ -66,6 +67,7 @@ export default {
   data () {
     return {
       userId: 0,
+      user: {},
       isModifyMode: true,
       authentication: {
         photo: [],
@@ -104,8 +106,7 @@ export default {
   methods: {
     //初始化数据
     init () {
-      console.log(getProvinceNameByProvinceCode(1100,1100))
-      console.log(getProvinceCodeByProvinceName('江苏省','盐城市'))
+      this.setUserInfo()
     },
     //加载数据
     loadData: function () {
@@ -126,7 +127,7 @@ export default {
         resources: this.authentication.resource,
         agencyPhoto: this.authentication.photoUrl,
       }
-      Http.post(Apis.USER.AGENCY_AUTHENTICATION.replace('{userId}', 3), newAuthentication).then((res) => {
+      Http.post(Apis.USER.SUBMIT_INDIVIDUAL_AUTHENTICATION_INFO.replace('{userId}', this.user.userVO.id), newAuthentication).then((res) => {
         console.log(res)
         notify('success', '认证信息上传成功')
       }).catch(error => {
@@ -164,7 +165,7 @@ export default {
         headers: {'Content-Type': 'multipart/form-data'},
       }
       formData.append('file', param.file)
-      Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', 3), formData, config).then((res) => {
+      Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
         console.log('上传成功')
         this.authentication.photoUrl = res.data
         console.log(res.data)
@@ -173,6 +174,10 @@ export default {
         notify('error', error.data.msg)
       })
     },
+    //
+    setUserInfo () {
+      this.user = storageGet('user')
+    }
   },
   created: function () {
   }

+ 3 - 1
src/js/api.js

@@ -38,11 +38,13 @@ export default {
     SUBMIT_PROJECT_REQUEST: '',
     END_TASK: '',
     END_PROJECT: '',
-    AGENCY_AUTHENTICATION: '/api/user/{userId}/agency/',
     ADD_AGENCY: '/api/greenChannel/agency/',
     GET_CURRENT_USER: '/api/common/currentUser/',
     GET_USER_IDENTITY: '',
     GET_AUTH_URLS: '',
+    SUBMIT_INDIVIDUAL_AUTHENTICATION_INFO: '/api/user/{userId}/individual/',
+    SUBMIT_ENTERPRISE_AUTHENTICATION_INFO: '/api/user/{userId}/enterprise/',
+    SUBMIT_AGENCY_AUTHENTICATION_INFO: '/api/user/{userId}/agency/'
   },
   PAGE: {
     HOME_PAGE: '/api/common/index/',