Commit 513dfaa1 by lishengfu

update

parent fb8d001f
# self-service
# typescript
## Project setup
```
npm install
yarn install
```
### Compiles and hot-reloads for development
```
npm run serve
yarn run serve
```
### Compiles and minifies for production
```
npm run build
yarn run build
```
### Run your tests
```
npm run test
yarn run test
```
### Lints and fixes files
```
npm run lint
yarn run lint
```
### Customize configuration
......
module.exports = {
presets: [
'@vue/app'
],
plugins: [
['import', {
libraryName: 'vant',
libraryDirectory: 'es',
style: true
}, 'vant']
]
}
This diff could not be displayed because it is too large.
{
"name": "self-service",
"name": "typescript",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@types/qs": "^6.9.3",
"amfe-flexible": "^2.2.1",
"axios": "^0.19.2",
"core-js": "^3.6.4",
"core-js": "^2.6.11",
"oidc-client": "^1.10.1",
"qs": "^6.9.4",
"qs.js": "^0.1.12",
"ts-loader": "^7.0.5",
"vant": "^2.8.3",
"vue": "^2.6.11",
"vue-axios": "^2.1.5",
"vant": "^2.2.0",
"vue": "^2.6.10",
"vue-class-component": "^7.2.3",
"vue-property-decorator": "^8.4.1",
"vue-router": "^3.1.6",
"vuex": "^3.1.3"
"vue-router": "^3.3.1",
"vuex": "^3.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.3.0",
"@vue/cli-plugin-typescript": "^4.3.0",
"@vue/cli-service": "^4.3.0",
"babel-plugin-import": "^1.13.0",
"less": "^3.0.4",
"@vue/cli-plugin-babel": "^3.8.0",
"@vue/cli-plugin-typescript": "^3.8.1",
"@vue/cli-service": "^3.8.3",
"less": "^3.9.0",
"less-loader": "^5.0.0",
"postcss-pxtorem": "^5.1.1",
"ts-import-plugin": "^1.6.6",
"typescript": "~3.8.3",
"vue-template-compiler": "^2.6.11"
"ts-import-plugin": "^1.5.5",
"typescript": "^3.5.1",
"vue-property-decorator": "^8.4.2",
"vue-template-compiler": "^2.6.10"
}
}
No preview for this file type
......@@ -5,11 +5,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<title>typescript</title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
<strong>We're sorry but typescript doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
......
<template>
<router-view />
<div>
<router-view />
</div>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
export default class App extends Vue {
}
</script>
<style lang="less">
</style>
// import "babel-polyfill";
//import "babel-polyfill";
import Oidc from "oidc-client";
var mgr = new Oidc.UserManager({
......@@ -8,6 +8,7 @@ var mgr = new Oidc.UserManager({
});
mgr.signinRedirectCallback().then(function (user: any) {
let returnUrl = localStorage.getItem("returnUrl");
if (returnUrl) {
window.location.href = returnUrl;
......
import Vue from 'vue'
import App from './App.vue'
import Vue from 'vue';
import App from './App.vue';
import router from './router'
import store from './store'
import "./assets/css/index.less"
import 'amfe-flexible/index.js'
import server from '@/services/install';
Vue.config.productionTip = false
Vue.use(server);
Vue.config.productionTip = false;
Vue.use(server)
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
render: (h) => h(App),
}).$mount('#app');
......@@ -13,12 +13,12 @@ const isOpenHttps = process.env.VUE_APP_OPEN_HTTPS;
* 加载和设置路由
*/
const router = new Router({
mode: 'history',
mode: 'history',
base: process.env.BASE_URL,//'/',
routes: [
...employee_router
]
base: process.env.BASE_URL,//'/',
routes: [
...employee_router
]
});
......@@ -27,8 +27,8 @@ const router = new Router({
* @param authCode 授权码
*/
function loginByAuthcode(authCode: any) {
let loginArgs = { extraQueryParams: { authcode: authCode } };
mgr.signIn(loginArgs);
let loginArgs = { extraQueryParams: { authcode: authCode } };
mgr.signIn(loginArgs);
}
/**
......@@ -36,15 +36,15 @@ function loginByAuthcode(authCode: any) {
* @param authcode 授权码
*/
function autoLogin(authcode: any) {
mgr.getUser().then(user => {
if (user == null) {
loginByAuthcode(authcode);
} else {
//如果已经登录,则先退出
localStorage.setItem("authcode", authcode);
mgr.signOut();
}
})
mgr.getUser().then(user => {
if (user == null) {
loginByAuthcode(authcode);
} else {
//如果已经登录,则先退出
localStorage.setItem("authcode", authcode);
mgr.signOut();
}
})
}
......@@ -52,43 +52,44 @@ function autoLogin(authcode: any) {
* 请求路由前 一些操作
*/
router.beforeEach((to, from, next) => {
// console.log(isOpenHttps);
if (isOpenHttps === "true" && location.href.startsWith("http://")) {
location.href = location.href.replace("http://", "https://");
}
const requiresAuth = to.matched.some(record => record.meta.requiresAuth);
localStorage.setItem("returnUrl", to.path);
//更改标题
if (to.meta.title) {
document.title = to.meta.title;
}
let authcode = localStorage.getItem("authcode")
if (authcode) {
localStorage.removeItem("authcode");
loginByAuthcode(authcode)
} else {
let authcode = to.query.authcode;
// console.log(isOpenHttps);
if (isOpenHttps === "true" && location.href.startsWith("http://")) {
location.href = location.href.replace("http://", "https://");
}
const requiresAuth = to.matched.some(record => record.meta.requiresAuth);
localStorage.setItem("returnUrl", to.path);
//更改标题
if (to.meta.title) {
document.title = to.meta.title;
}
let authcode = localStorage.getItem("authcode")
if (authcode) {
autoLogin(authcode);
localStorage.removeItem("authcode");
loginByAuthcode(authcode)
} else {
if (requiresAuth) {
mgr.getUser().then(user => {
if (user == null) {
mgr.signIn();
} else {
next();
}
});
}
else {
next();
}
let authcode = to.query.authcode;
if (authcode) {
autoLogin(authcode);
} else {
if (requiresAuth) {
mgr.getUser().then(user => {
if (user == null) {
mgr.signIn();
} else {
next();
}
});
}
else {
next();
}
}
}
}
});
......
......@@ -3,6 +3,20 @@
*/
export interface EmployeeInterface {
getUserInfo(params: any): Promise<any>;
getWorkInfoDetail(params: any): Promise<any>;
putEmail(params: any): Promise<any>;
getWorkInfoList(params: any): Promise<any>; //获取工作信息列表
getWorkInfoDetail(params: any): Promise<any>; //获取工作信息详情
getPersonInfo(params: any): Promise<any>; //获取个人信息
savePersonInfo(params: any): Promise<any>; //保存个人信息
getContactInfo(params: any): Promise<any>; //获取联系信息
saveContactInfo(params: any): Promise<any>; //保存联系信息
getSocialInfo(params: any): Promise<any>; //获取社保信息
saveSocialInfo(params: any): Promise<any>; //保存社保信息
getWageCardInfo(params: any): Promise<any>; //获取工资卡信息
saveWageCardInfo(params:any):Promise<any>; //保存工资卡信息
getEduExperience(params:any):Promise<any>; //获取教育经历
getEduExperienceDetial(params:any):Promise<any>; //获取教育信息详情
addEduExperience(params:any):Promise<any>; //新增教育信息
updateEduExperience(params:any):Promise<any>; //修改教育信息
getTechnologyExperience(params:any):Promise<any>; //获取技术特长
updateTechnologyExperience(params:any):Promise<any>; //修改技术特长
}
......@@ -52,7 +52,16 @@ class EmployeeService implements EmployeeInterface {
}
/**
* 获取工作信息
* 获取工作信息列表
* @param params 请求参数
*/
public getWorkInfoList(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/work`;
return request.get(url, params, this.header)
}
/**
* 获取工作信息详情
* @param params 请求参数
*/
......@@ -62,17 +71,131 @@ class EmployeeService implements EmployeeInterface {
}
/**
* 修改邮箱
* 获取个人信息
* @param params 请求参数
*/
public getPersonInfo(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/info`;
return request.get(url, params, this.header)
}
/**
* 保存个人信息
* @param params 请求参数
*/
public savePersonInfo(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/info`;
return request.post(url, params, this.header)
}
/**
* 获取联系信息
* @param params 请求参数
*/
public getContactInfo(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/contact/info`;
return request.get(url, params, this.header)
}
/**
* 保存联系信息
* @param params 请求参数
*/
public saveContactInfo(params: any): Promise<any> {
let url = `/api/user/contact/${params.edId}/info`;
return request.post(url, params, this.header)
}
/**
* 获取社保信息
* @param params 请求参数
*/
public getSocialInfo(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/unit/relation`;
return request.get(url, params, this.header)
}
/**
* 保存社保信息
* @param params 请求参数
*/
public putEmail(params: any): Promise<any> {
// // /v2/internal/account/{userId}/download/{accountId}/summary
// let url3=aa('/v2/internal/account/{userId}/download/{accountId}/summary',params)
// let url1 = `${urls.employeeUrl}/${this.version}/internal/account/${params.userId}/download/${params.accountId}/summary`;
let url = `${urls.employeeUrl}/${this.version}/users/${this.sub}/email`;
return request.put(url, params, this.header);
public saveSocialInfo(params: any): Promise<any> {
let url = `/api/user/employee/unit/relation/save`;
return request.post(url, params, this.header)
}
/**
* 获取工资卡信息
* @param params 请求参数
*/
public getWageCardInfo(params: any): Promise<any> {
let url = `/api/user/contact/${params.edId}/salary/card/info`;
return request.get(url, params, this.header)
}
/**
* 保存工资卡信息
* @params params
*/
public saveWageCardInfo(params: any): Promise<any> {
let url = `/api/user/contact/salary/card/info`;
return request.post(url, params, this.header)
}
/**
* 获取教育经历
* @param params 请求参数
*/
public getEduExperience(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/education`;
return request.get(url, params, this.header)
}
/**
* 获取教育信息详细
* @param params
*/
public getEduExperienceDetial(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/education/detial`;
return request.get(url, params, this.header)
}
/**
* 新增教育信息
* @param params
*/
public addEduExperience(params: any): Promise<any> {
let url = `/api/user/employee/edu/info`;
return request.post(url, params, this.header)
}
/**
* 修改教育信息
* @param params
*/
public updateEduExperience(params: any): Promise<any> {
let url = `/api/user/employee/edu/info`;
return request.put(url, params, this.header)
}
/**
* 获取技术特长
* @param params
*/
public getTechnologyExperience(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/expertise/info`;
return request.get(url, params, this.header)
}
/**
* 修改技术特长
* @param params
*/
public updateTechnologyExperience(params: any): Promise<any> {
let url = `/api/user/employee/expertise/info`;
return request.put(url, params, this.header)
}
}
......
import Vue, { VNode } from 'vue'
import Vue, { VNode } from 'vue';
declare global {
namespace JSX {
......@@ -7,7 +7,7 @@ declare global {
// tslint:disable no-empty-interface
interface ElementClass extends Vue {}
interface IntrinsicElements {
[elem: string]: any
[elem: string]: any;
}
}
}
declare module '*.vue' {
import Vue from 'vue'
export default Vue
import Vue from 'vue';
export default Vue;
}
<template>
<div class="home">
<van-button type="primary" ></van-button>
<van-button type="primary" >普通按钮</van-button>
</div>
</template>
......
......@@ -6,9 +6,9 @@
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators":true,
"sourceMap": true,
"baseUrl": ".",
"types": [
......@@ -31,7 +31,7 @@
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx", "src/api/index.js"
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
......
const path = require("path");
const merge = require('webpack-merge');
const tsImportPluginFactory = require('ts-import-plugin');
module.exports = {
// 基本路径
publicPath: "/",
// 输出文件目录
outputDir: "dist",
pages: {
app: {
entry: './src/main.ts',
template: 'public/index.html',
filename: 'index.html',
favicon: 'public/favicon.ico',
chunks: ['app', 'chunk-vendors'],
excludeChunks: ['silent-renew-oidc']
},
silentrenewoidc: {
entry: './src/common/silent-renew.ts',
template: 'public/silent-renew.html',
filename: 'silent-renew.html',
favicon: 'public/favicon.ico',
excludeChunks: ['app']
},
callback: {
entry: './src/common/callback.ts',
template: 'public/callback.html',
filename: 'callback.html',
favicon: 'public/favicon.ico',
excludeChunks: ['app']
},
},
// eslint-loader 是否在保存的时候检查
lintOnSave: true,
// webpack配置
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
chainWebpack: config => {
config.module
.rule('tsx')
.use('ts-loader')
.loader('ts-loader')
.tap(options => {
options = merge(options, {
transpileOnly: true,
getCustomTransformers: () => ({
before: [
tsImportPluginFactory({
libraryName: "vant",
libraryDirectory: "es",
style: true
})
]
}),
compilerOptions: {
module: 'es2015'
}
});
return options;
//return Object.assign(options || {}, { allowTsInNodeModules: true });
});
},
configureWebpack: config => {
if (process.env.NODE_ENV === "production") {
// 为生产环境修改配置...
config.mode = "production";
} else {
// 为开发环境修改配置...
config.mode = "development";
}
outputDir: "dist",
publicPath: process.env.NODE_ENV === 'production' ? '/selfservice/' : '/',
pages: {
app: {
entry: './src/main.ts',
template: 'public/index.html',
filename: 'index.html',
favicon: 'public/favicon.ico',
chunks: ['app', 'chunk-vendors'],
excludeChunks: ['silent-renew-oidc']
},
// 生产环境是否生成 sourceMap 文件
productionSourceMap: true,
// css相关配置
css: {
// 是否使用css分离插件 ExtractTextPlugin
extract: true,
// 开启 CSS source maps?
sourceMap: false,
// css预设器配置项
loaderOptions: {},
// 启用 CSS modules for all css / pre-processor files.
modules: false,
//requireModuleExtension
silentrenewoidc: {
entry: './src/common/silent-renew.ts',
template: 'public/silent-renew.html',
filename: 'silent-renew.html',
favicon: 'public/favicon.ico',
excludeChunks: ['app']
},
// use thread-loader for babel & TS in production build
// enabled by default if the machine has more than 1 cores
parallel: require("os").cpus().length > 1,
// PWA 插件相关配置
// see https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa
pwa: {},
// webpack-dev-server 相关配置
devServer: {
open: true,//process.platform === "darwin",
host: "0.0.0.0",
port: 8080,
https: false,
hotOnly: false,
proxy: {
"/api": {
target: "http://192.168.1.101:8080",
// target: "http://192.168.1.46:8001",
// target: "http://106.120.107.150:8001",
ws: true,
changeOrigin: true,
pathRewrite: {
"^/api": "/"
}
},
},
// historyApiFallback: {
// rewrites: [
// { from: /^\/single/, to: '/single.html' },
// ],
// },
before: app => { }
callback: {
entry: './src/common/callback.ts',
template: 'public/callback.html',
filename: 'callback.html',
favicon: 'public/favicon.ico',
excludeChunks: ['app']
},
// 第三方插件配置
pluginOptions: {
'style-resources-loader': {
preProcessor: 'scss',
patterns: []
}
},
// eslint-loader 是否在保存的时候检查
lintOnSave: true,
// webpack配置
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
chainWebpack: config => {
config.module
.rule('ts')
.use('ts-loader')
.tap(options => {
options = merge(options, {
transpileOnly: true,
getCustomTransformers: () => ({
before: [
tsImportPluginFactory({
libraryName: 'vant',
libraryDirectory: 'es',
style: true
})
]
}),
compilerOptions: {
module: 'es2015'
}
});
return options;
});
},
configureWebpack: config => {
if (process.env.NODE_ENV === "production") {
// 为生产环境修改配置...
config.mode = "production";
} else {
// 为开发环境修改配置...
config.mode = "development";
}
},
// 生产环境是否生成 sourceMap 文件
productionSourceMap: true,
// css相关配置
css: {
// 是否使用css分离插件 ExtractTextPlugin
extract: true,
// 开启 CSS source maps?
sourceMap: false,
// css预设器配置项
loaderOptions: {},
// 启用 CSS modules for all css / pre-processor files.
modules: false,
//requireModuleExtension
},
// use thread-loader for babel & TS in production build
// enabled by default if the machine has more than 1 cores
parallel: require("os").cpus().length > 1,
// PWA 插件相关配置
// see https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa
pwa: {},
// webpack-dev-server 相关配置
devServer: {
open: false,//process.platform === "darwin",
host: "0.0.0.0",
port: 8080,
https: false,
hotOnly: false,
// proxy: {
// "/api": {
// target: "http://192.168.1.101:8080",
// // target: "http://192.168.1.46:8001",
// // target: "http://106.120.107.150:8001",
// ws: true,
// changeOrigin: true,
// pathRewrite: {
// "^/api": "/"
// }
// },
// },
// historyApiFallback: {
// rewrites: [
// { from: /^\/single/, to: '/single.html' },
// ],
// },
before: app => { }
},
// 第三方插件配置
pluginOptions: {
'style-resources-loader': {
preProcessor: 'scss',
patterns: []
}
};
\ No newline at end of file
}
};
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