Commit 43c6176e authored by hailiang.sun's avatar hailiang.sun

init

parent f6c543c8
> 1%
last 2 versions
not dead
module.exports = {
root: true,
env: {
node: true,
},
extends: ["plugin:vue/essential", "eslint:recommended", "@vue/prettier"],
parserOptions: {
parser: "babel-eslint",
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
},
};
.DS_Store
node_modules
/dist
.history
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# bims
# BIMS
ECCS-医疗机构商保管理系统(Business insurance management system)简称BIMS
\ No newline at end of file
> ECCS-医疗机构商保管理系统(Business insurance management system)简称 BIMS
## 接口文档
> http://git.ssish.com/root/core-ci/wikis/interface_documenthttp://git.ssish.com/root/core-ci/wikis/interface_document
## 蓝湖(ui)
> https://lanhuapp.com/url/4G9cN-1hUp9
module.exports = {
presets: [
"@vue/cli-plugin-babel/preset",
["@babel/preset-env", { modules: false }],
],
plugins: [
[
"import",
{
libraryName: "ant-design-vue",
libraryDirectory: "es",
style: true,
},
],
"lodash",
],
};
{
"name": "bims",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --mode dev",
"build:test": "vue-cli-service build --mode dev",
"build": "vue-cli-service build --mode production --report",
"lint": "vue-cli-service lint"
},
"dependencies": {
"ant-design-vue": "^1.7.8",
"axios": "^0.24.0",
"babel-plugin-import": "^1.13.3",
"babel-plugin-lodash": "^3.3.4",
"core-js": "^3.6.5",
"lodash": "^4.17.21",
"lodash-webpack-plugin": "^0.11.6",
"nprogress": "^0.2.0",
"style-resources-loader": "^1.5.0",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0",
"vuex-persistedstate": "^4.1.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.1.0",
"compression-webpack-plugin": "^6.1.1",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^6.2.2",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"prettier": "^2.2.1",
"style-resources-loader": "^1.5.0",
"vue-cli-plugin-style-resources-loader": "^0.1.5",
"vue-template-compiler": "^2.6.11"
}
}
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8" />
<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>
<script
type="text/javascript"
src="//at.alicdn.com/t/font_3020450_3q020khoouw.js"
></script>
</head>
<body>
<noscript>
<strong
>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
properly without JavaScript enabled. Please enable it to
continue.</strong
>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<div id="app">
<router-view />
</div>
</template>
<style lang="less"></style>
// 基础api
export default {
getUserInfo: `/getUserInfo`,
};
// 报表api
export default {};
// 收费查询api
export default {};
// 客户管理api
export default {};
// 基础
import base from "./base";
// 报表api
import bi from "./bi";
// 收费查询api
import chargeQuery from "./charge-query";
// 客户管理api
import customer from "./customer";
// 信息维护api
import info from "./info";
// 预授权管理api
import preAuth from "./pre-auth";
// 核销管理api
import verification from "./verification";
// 福利管理api
import welfare from "./welfare";
const apis = {
...base,
...bi,
...chargeQuery,
...customer,
...info,
...preAuth,
...verification,
...welfare,
};
export default apis;
// 信息管理api
export default {};
// 预授权api
export default {};
// 核销管理api
export default {};
// 福利管理api
export default {};
// 根据环境变量确认baseurl
let baseUrl = "";
switch (process.env.NODE_ENV) {
case "dev":
// 本地地址,dev会被代理到测试环境
baseUrl = `${window.location.protocol}//${window.location.host}/dev`;
break;
// 正式地址
case "production":
baseUrl = ""; // 暂无
break;
}
export default baseUrl;
// 基础模块函数库
import apis from "../apis_moudles/index";
import req from "../request";
// 示例:获取用户信息
const GETUSERINFO = (params) => {
return req.get(apis.getUserInfo, {
params,
});
};
// 对象数组
export default { GETUSERINFO };
// 报表函数库
// import apis from "../apis_moudles/index";
// import req from "../request";
// 对象数组
export default {};
// 收费查询函数库
// import apis from "../apis_moudles/index";
// import req from "../request";
// 对象数组
export default {};
// 客户管理函数库
// import apis from "../apis_moudles/index";
// import req from "../request";
// 对象数组
export default {};
// 基础模块
import base from "./base";
// 报表api
import bi from "./bi";
// 收费查询api
import chargeQuery from "./charge-query";
// 客户管理api
import customer from "./customer";
// 信息维护api
import info from "./info";
// 预授权管理api
import preAuth from "./pre-auth";
// 核销管理api
import verification from "./verification";
// 福利管理api
import welfare from "./welfare";
const funcs = {
...base,
...bi,
...chargeQuery,
...customer,
...info,
...preAuth,
...verification,
...welfare,
};
export default funcs;
// 信息维护函数库
// import apis from "../apis_moudles/index";
// import req from "../request";
// 对象数组
export default {};
// 预授权函数库
// import apis from "../apis_moudles/index";
// import req from "../request";
// 对象数组
export default {};
// 核销管理函数库
// import apis from "../apis_moudles/index";
// import req from "../request";
// 对象数组
export default {};
// 福利管理函数库
// import apis from "../apis_moudles/index";
// import req from "../request";
// 对象数组
export default {};
// axios二次封装
import axios from "axios"; // 引入 axios
import baseUrl from "./env"; // 基础url
import Vue from "vue";
import code from "./state_code"; // 状态码维护
import store from "@/store";
let that = new Vue();
const service = axios.create({
validateStatus(status) {
return status >= 200 && status <= 504; // 合法状态码
},
baseURL: baseUrl, // 基础请求路径
timeout: 10000, // 请求超时
});
// 重复尝试此时
service.defaults.retry = 3;
// 重试延时
service.defaults.retryDelay = 15000;
// 开启重试
service.defaults.shouldRetry = true;
// 请求拦截
service.interceptors.request.use(
(config) => {
config.headers["Content-Type"] = "application/json;charset=UTF-8";
config.headers["Accept-Language"] = "zh-CN";
// token
config.headers["Authorization"] = store.state.common.token;
if (config.method === "post") {
if (!config.data) {
config.data = {};
}
}
return config;
},
(error) => {
const {
response: { status, statusText },
} = error;
that.$msg.error({
message: status,
description: statusText,
});
}
);
// response 拦截器
service.interceptors.response.use(
(response) => {
return new Promise((resolve, reject) => {
if (response.status !== 200) {
// 请求失败
reject(response);
} else {
// 判断token有效
const TOKENSTATE = code.TOKEN_INVLIDE_TO_LOGIN(response.data.status);
// 全局错误拦截
const PUBSTATE = code.PUB_ERR(
response.data.status,
response.data.message,
response.config
);
// 请求成功,但逻辑或者业务有错,返回具体数据,根据业务决定是否要提示 有token失效全局异常不返回
if (TOKENSTATE && PUBSTATE) {
resolve(response.data);
}
}
}).catch(() => {
console.log("that?", response);
that.$msg.error({
message: response.config.url,
description: response.status + " : " + response.statusText,
});
});
},
(err) => {
// 失败
let message = "请求异常,请检测网络!";
if (err.response) {
message = err.response.data.message;
}
that.$msg.error({
message: message,
description: err,
});
}
);
export default service;
// 状态码处理
import route from "@/router";
import store from "@/store";
import Vue from "vue";
let that = new Vue();
// token失效
const TOKEN_INVLIDE_TO_LOGIN = (code) => {
// 状态码判断
if (code) {
if (store.state.common.userInfo !== "") {
that.$msg.error({
message: "登陆失败",
description: "token已过期",
});
}
// 清楚个人数据
store.commit("user/setUserInfo", "");
route.replace({
path: "/login",
});
return false;
} else {
return true;
}
};
// 全局错误处理
const PUB_ERR = (code, message, config) => {
console.log("错误信息", code, message, config);
};
export default {
TOKEN_INVLIDE_TO_LOGIN,
PUB_ERR,
};
li {
list-style: none;
}
* {
padding: 0;
margin: 0;
}
button {
outline: none !important;
}
button:focus {
outline: 0 !important;
}
button::-moz-focus-inner {
border-color: transparent;
}
/*for mozilla*/
.el-drawer {
box-shadow: none !important;
}
.text-overOne {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
This diff is collapsed.
import Vue from "vue";
import { Button, Input, notification } from "ant-design-vue";
export default () => {
let els = [Button, Input, notification];
// 注册
els.forEach((item) => {
Vue.use(item);
});
// 全局提示
Vue.prototype.$msg = notification;
};
<template>
<div class="icon-class" :style="`font-size:${size}px`" @click="clickEvent">
<svg class="icon" aria-hidden="true">
<use :xlink:href="iconName" />
</svg>
</div>
</template>
<script>
export default {
props: {
name: {
type: String,
required: true,
},
size: {
type: Number,
default: 12,
},
},
data() {
return {};
},
computed: {
iconName() {
return `#${this.name}`;
},
},
created() {},
mounted() {},
methods: {
clickEvent() {
this.$emit("click");
},
},
};
</script>
<style lang="less" scoped>
.icon-class {
display: inline-block;
line-height: 1;
}
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
</style>
import icon from "./icon";
import Vue from "vue";
export default () => {
Vue.component("Icon", icon);
};
import { after } from "lodash";
import Vue from "vue";
let lodashs = { after };
export default () => {
Vue.prototype.$lodash = lodashs;
};
import Antd from "./Antd";
import Lodash from "./Lodash";
import Icon from "./Icon";
let components = [Antd, Lodash, Icon];
export default () => {
components.forEach((item) => {
item();
});
};
import Vue from "vue";
//引入指令
// import item from './item'
// 指令集合
let directives = [];
export default () => {
directives.forEach((item) => {
Vue.use(item);
});
};
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import globalComponents from "./components";
import utils from "./utils";
import globalMixin from "./mixins";
import apis from "./api/funcs_modules";
import directives from "./directives";
Vue.config.productionTip = false;
//全局混入
Vue.mixin(globalMixin);
//全局工具箱
Vue.prototype.$utils = utils;
//全局组件
globalComponents();
// 统一api
Vue.prototype.$apis = apis;
// 指令注入
directives();
new Vue({
router,
store,
render: (h) => h(App),
}).$mount("#app");
import bus from "../utils/bus";
// 全局混入将会影响每个单文件组件,请慎重思考是否要混入
export default {
data() {
return {
bus,
};
},
};
import Vue from "vue";
import VueRouter from "vue-router";
import RouterGuard from "./router.config";
Vue.use(VueRouter);
// 布局容器
import Layout from "../views/layout/index.vue";
// 客户管理
import customer from "./modules/customer";
// 福利信息管理
import welfare from "./modules/welfare";
// 预授权信息管理
import preAuth from "./modules/pre-auth";
// 收费查询
import chargeQuery from "./modules/charge-query";
// 核销管理
import verification from "./modules/verification";
// 信息维护
import info from "./modules/info";
// 报表管理
import bi from "./modules/bi";
const routes = [
{
path: "/",
component: Layout,
children: [
{
path: "/",
redirect: "/customer",
},
customer,
welfare,
preAuth,
chargeQuery,
verification,
info,
bi,
],
},
];
const router = new VueRouter({
mode: "history",
base: process.env.BASE_URL,
routes,
});
RouterGuard(VueRouter);
export default router;
//报表路由表,分包名称:bi
export default {
path: "/bi",
name: "BI",
component: () => {
return import(/* webpackChunkName: "bi" */ "@/views/bi");
},
};
// 收费查询路由表,分包名称:charge-query
export default {
path: "/charge-query",
name: "ChargeQuery",
component: () => {
return import(/* webpackChunkName: "chargeQuery" */ "@/views/charge-query");
},
};
// 客户信息路由表,分包名称:customer
export default {
path: "/customer",
name: "Customer",
component: () => {
return import(/* webpackChunkName: "customer" */ "@/views/customer");
},
};
// 信息管理路由表,分包名称:info
export default {
path: "/info",
name: "Info",
component: () => {
return import(/* webpackChunkName: "info" */ "@/views/info");
},
};
// 预授权路由表,分包名称:preAuth
export default {
path: "/pre-auth",
name: "PreAuth",
component: () => {
return import(/* webpackChunkName: "preAuth" */ "@/views/pre-auth");
},
};
// 核销管理路由表,分包名称:verification
export default {
path: "/verification",
name: "Verification",
component: () => {
return import(
/* webpackChunkName: "verification" */ "@/views/verification"
);
},
};
// 福利管理路由表,分包名称:welfare
export default {
path: "/welfare",
name: "Welfare",
component: () => {
return import(/* webpackChunkName: "Welfare" */ "@/views/welfare");
},
};
import NProgress from "nprogress";
import "nprogress/nprogress.css";
// 路由页面路由首位配置
export default (VueRouter) => {
// 解决路由点击重复报错
const VueRouterPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(to) {
return VueRouterPush.call(this, to).catch((err) => err);
};
VueRouter.prototype.replace = function push(to) {
return VueRouterPush.call(this, to).catch((err) => err);
};
// 页面路由切换时进度条
let router = new VueRouter();
router.beforeEach((to, from, next) => {
NProgress.start();
next();
});
router.afterEach(() => {
NProgress.done();
});
};
import Vue from "vue";
import Vuex from "vuex";
// 状态保持,防止数据刷新丢失
import createPersistedState from "vuex-persistedstate";
// 项目足够大时,将store进行拆分成若干moudle
// 存放通用信息
import common from "./modules/common";
// 可按模块继续扩展...
// 注意:只有程序级状态/数据方可使用store
Vue.use(Vuex);
export default new Vuex.Store({
modules: {
namespaced: true,
common,
},
plugins: [createPersistedState()],
});
const state = {
token: "",
userInfo: {},
};
const actions = {};
const mutations = {
// 设置token
setToken(state, token) {
state.token = token;
},
// 存储用户信息
setUserInfo(state, userInfo) {
state.userInfo = userInfo;
},
};
export default {
namespaced: true,
state,
actions,
mutations,
};
import Vue from "vue";
// 存储所有的事件
const EventStore = {};
const Bus = new Vue();
// 存放当前组件实例
const destoryHandler = function () {
// this 为调用此方法的vue组件
const currentEventObj = EventStore[this._uid];
if (!currentEventObj) {
return;
}
for (const type in currentEventObj) {
const key = Array.isArray(type) ? type.join(",") : type;
// Bus 解绑事件
Bus.$off(type, currentEventObj[key]);
}
// 删除记录的事件集合
delete EventStore[this._uid];
};
const BusFactory = (vm) => {
// 获取当前组件实例的destroyed生命周期
const destroyed = vm.$options.destroyed;
// 获取当前组件实例的uid
const uid = vm._uid;
// 不存在则声明一个对象,防止每次只存最后一个
if (!Object.prototype.hasOwnProperty.call(EventStore, uid)) {
EventStore[uid] = {};
}
!destroyed.includes(destoryHandler) && destroyed.push(destoryHandler);
return {
$on: (type, handler) => {
const key = Array.isArray(type) ? type.join(",") : type;
EventStore[uid][key] = handler;
Bus.$on(type, handler);
},
$off: (type, handler) => {
if (!type) {
delete EventStore[uid];
Bus.$off();
return;
}
const key = Array.isArray(type) ? type.join(",") : type;
// 删除对应的事件
delete EventStore[uid][key];
Bus.$off(type, handler);
},
$once: (...params) => Bus.$once(...params),
$emit: (...params) => Bus.$emit(...params),
};
};
// 这两行是允许bus不调用依然能够触发emit和once
BusFactory.$emit = (...params) => Bus.$emit(...params);
BusFactory.$once = (...params) => Bus.$once(...params);
export default BusFactory;
// 统一暴露工具,供其他地方调用
// 数组转对象
function arrToObj(arr) {
// 参数必须是一个数组
if (!Array.isArray(arr)) {
throw new Error("type err: arr 必须是一个数组");
}
// 存放返回结果
const obj = {};
arr.map((item) => {
obj[Object.keys(item)[0]] = item[Object.keys(item)[0]];
});
return obj;
}
export default { arrToObj };
<template>
<div>
<!-- 报表 -->
报表
</div>
</template>
<script>
export default {
components: {},
data() {
return {};
},
created() {},
mounted() {},
methods: {},
};
</script>
<style lang="less" scoped></style>
<template>
<div>
<!-- 费用查询 -->
费用查询
</div>
</template>
<script>
export default {
components: {},
data() {
return {};
},
created() {},
mounted() {},
methods: {},
};
</script>
<style lang="less" scoped></style>
<template>
<div class="index">
<!-- 客户信息 -->
客户信息
<a-button>按钮</a-button>
<a-input placeholder="按需"></a-input>
<a-button @click="() => openNotificationWithIcon('success')">
Success
</a-button>
<a-button @click="() => openNotificationWithIcon('info')"> Info </a-button>
<a-button @click="() => openNotificationWithIcon('warning')">
Warning
</a-button>
<a-button @click="() => openNotificationWithIcon('error')">
Error
</a-button>
<Icon :name="'ssisuccess'" :size="50" />
</div>
</template>
<script>
export default {
data() {
return {};
},
computed: {},
watch: {},
methods: {
openNotificationWithIcon(type) {
this.$msg[type]({
message: "Notification Title",
description:
"This is the content of the notification. This is the content of the notification. This is the content of the notification.",
});
},
},
mounted() {
console.log("this.apis", this.$apis.GETUSERINFO(), this.$lodash);
},
};
</script>
<style lang="less" scoped></style>
<template>
<div class="index">
<!-- 信息维护 -->
信息维护
</div>
</template>
<script>
export default {
data() {
return {};
},
computed: {},
watch: {},
methods: {},
};
</script>
<style lang="less" scoped></style>
<template>
<div>
<router-view />
</div>
</template>
<script>
export default {
components: {},
data() {
return {};
},
created() {},
mounted() {},
methods: {},
};
</script>
<style lang="less" scoped></style>
<template>
<div class="index">
<!-- 预授权 -->
预授权
</div>
</template>
<script>
export default {
data() {
return {};
},
computed: {},
watch: {},
methods: {},
};
</script>
<style lang="less" scoped></style>
<template>
<div class="index">
<!-- 核销管理 -->
核销管理
</div>
</template>
<script>
export default {
data() {
return {};
},
computed: {},
watch: {},
methods: {},
};
</script>
<style lang="less" scoped></style>
<template>
<div class="index">
<!-- 福利管理 -->
福利管理
</div>
</template>
<script>
export default {
data() {
return {};
},
computed: {},
watch: {},
methods: {},
};
</script>
<style lang="less" scoped></style>
const path = require("path");
const LodashModuleReplacementPlugin = require("lodash-webpack-plugin");
const CompressionPlugin = require("compression-webpack-plugin"); // 代码压缩
module.exports = {
productionSourceMap: false,
pluginOptions: {
"style-resources-loader": {
preProcessor: "less",
patterns: [path.resolve(__dirname, "src/assets/style/common.less")],
},
},
css: {
loaderOptions: {
less: {
javascriptEnabled: true,
},
},
},
chainWebpack: (config) => {
if (process.env.NODE_ENV === "production") {
// lodash 按需加载
config.plugin("loadshReplace").use(new LodashModuleReplacementPlugin());
}
},
configureWebpack: (config) => {
const plugins = [];
if (process.env.NODE_ENV === "production") {
plugins.push(
new CompressionPlugin({
filename: "[path][base].gz",
algorithm: "gzip",
test: new RegExp(".(" + ["js", "css", "json"].join("|") + ")$"),
threshold: 8192,
include: /\/src/,
exclude: /node_modules/,
minRatio: 0.8,
deleteOriginalAssets: false, // 此处源文件保留吧,以防不测
})
);
}
config.plugins = [...config.plugins, ...plugins];
},
devServer: {
disableHostCheck: true,
useLocalIp: true,
port: 8888,
hot: true,
proxy: {
"/dev": {
target: "http://www.jd.com",
pathRewrite: {
"/dev": "",
},
changeOrigin: true,
secure: false,
},
},
},
};
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 to comment