Commit e9b06f58 by 胡锦波

1. init companyservice 替换

parent 579d89ce
import BaseService from "@/api/core";
class CompanyService extends BaseService {
public constructor() {
super();
}
public getDepartment(comid: string) {
this.getWithCompanyToken(`/v1/companies/${comid}/departments/all`);
}
}
const companyService = new CompanyService();
export default companyService;
import EnterpriseHost from "@/views/service/enterprise-host";
import Axios, { AxiosRequestConfig } from "axios"; import Axios, { AxiosRequestConfig } from "axios";
import qs from 'qs'; import qs from 'qs';
import { getAuditorInfo } from './auditor'; import { getAuditorInfo } from './auditor';
...@@ -194,11 +195,11 @@ export default abstract class BaseService { ...@@ -194,11 +195,11 @@ export default abstract class BaseService {
} }
protected async buildCompanyToken2Config(config?: AxiosRequestConfig) { protected async buildCompanyToken2Config(config?: AxiosRequestConfig) {
const comid = EnterpriseHost.getPoid();
config = this.buildRequestConfig(config); config = this.buildRequestConfig(config);
if (config.headers) { if (config.headers) {
config.headers[this.authKey] = await TokenManager.getCompanyToken(this.onceCompanyId); config.headers[this.teammixAuthKey] = await TokenManager.getCompanyToken(comid);
} }
this.onceCompanyId = 0;
return this.checkContentType(config); return this.checkContentType(config);
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
import { TokenManager } from "@/api/token"; import { TokenManager } from "@/api/token";
import EnterpriseHost from "@/views/service/enterprise-host"; import EnterpriseHost from "@/views/service/enterprise-host";
import { sdkService } from "@/api/sdk-service"; import { sdkService } from "@/api/sdk-service";
import companyService from "@/api/company-service";
@Component({ components: {} }) @Component({ components: {} })
export default class AddressBook extends Vue { export default class AddressBook extends Vue {
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
sdkService.getJoinedList(); sdkService.getJoinedList();
const comid = EnterpriseHost.getPoid(); const comid = EnterpriseHost.getPoid();
TokenManager.getCompanyToken(comid); TokenManager.getCompanyToken(comid);
companyService.getDepartment(comid);
} }
} }
</script> </script>
......
...@@ -14,6 +14,15 @@ module.exports = { ...@@ -14,6 +14,15 @@ module.exports = {
port: 8080, port: 8080,
https: false, https: false,
hotOnly: false, hotOnly: false,
proxy: {
"/v1/companies": {
target: "http://106.120.107.150:7771",
changeOrigin: true,
},
},
headers: {
"Access-Control-Allow-Origin": "*"
}
}, },
chainWebpack: config => { chainWebpack: config => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment