doctor-admin-components 1.0.13-beta.8 → 1.0.13-pro.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,52 +6,63 @@
6
6
  * @FilePath: /doctor-admin-components/README.md
7
7
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE1
8
8
  -->
9
+
9
10
  # doctor-admin-components
10
11
 
11
12
  ## Project setup
13
+
12
14
  ```
13
15
  npm install
14
16
  ```
15
17
 
16
- ### 运行项目可以开调试模块(example文件)
18
+ ### 运行项目可以开调试模块(example 文件)
19
+
17
20
  ```
18
21
  npm run serve
19
22
  ```
20
23
 
21
- ### 打包(组件修改在packages文件中)
24
+ ### 打包(组件修改在 packages 文件中)
25
+
22
26
  ```
23
27
  npm run lib
24
28
  ```
25
29
 
26
30
  ### 调试
27
- package.json文件 入口改为:"main": "packages/index.js"
31
+
32
+ package.json 文件 入口改为:"main": "packages/index.js"
33
+
28
34
  #### 把模块链接到全局
35
+
29
36
  ```
30
- sudo npm link
37
+ sudo npm link
31
38
  ```
32
39
 
33
40
  #### 模块取消软链接
41
+
34
42
  ```
35
- sudo npm unlink doctor-admin-components
43
+ sudo npm unlink doctor-admin-components
36
44
  ```
37
45
 
38
46
  #### 把模块链接到项目
47
+
39
48
  ```
40
49
  npm link doctor-admin-components --legacy-peer-deps
41
50
  ```
42
51
 
43
52
  #### 项目取消软链接
53
+
44
54
  ```
45
55
  npm unlink doctor-admin-components --legacy-peer-deps
46
56
  ```
47
57
 
48
58
  ### 发布包
59
+
49
60
  ```
50
61
  package.json文件 入口改为:"main": "lib/index.umd.min.js"
51
62
 
52
63
  登录npm账号
53
64
 
54
- npm login
65
+ npm login
55
66
 
56
67
  1 npm run lib
57
68
  2 修改package.json里的 version
@@ -61,6 +72,6 @@ npm login
61
72
  npm publish
62
73
  ```
63
74
 
64
-
65
75
  ### Customize configuration
76
+
66
77
  See [Configuration Reference](https://cli.vuejs.org/config/).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "doctor-admin-components",
3
3
  "version1": "1.0.11",
4
- "version": "1.0.13-beta.8",
4
+ "version": "1.0.13-pro.0",
5
5
  "private": false,
6
6
  "main1": "lib/index.umd.min.js",
7
7
  "main": "packages/index.js",
@@ -25,7 +25,6 @@ export function getBizContract(id) {
25
25
  method: "get",
26
26
  });
27
27
  }
28
-
29
28
  // 查询合同详细
30
29
  export function getSaleContractInfo(dealId) {
31
30
  return request({
@@ -50,4 +50,4 @@ export function exportBizContractCompany(query) {
50
50
  method: 'get',
51
51
  params: query
52
52
  })
53
- }
53
+ }
@@ -1,224 +1,198 @@
1
- import axios from "axios";
2
- import { Notification, MessageBox, Message, Loading } from "element-ui";
3
- import store from "../store";
4
- import { getToken } from "./auth";
5
- import errorCode from "./errorCode";
6
- import { tansParams, blobValidate } from "./ruoyi";
7
- import cache from "../plugins/cache";
8
- import { saveAs } from "file-saver";
9
- import Cookies from "js-cookie";
1
+ import axios from 'axios'
2
+ import { Notification, MessageBox, Message, Loading } from 'element-ui'
3
+ import store from '../store'
4
+ import { getToken } from './auth'
5
+ import errorCode from './errorCode'
6
+ import { tansParams, blobValidate } from './ruoyi'
7
+ import cache from '../plugins/cache'
8
+ import { saveAs } from 'file-saver'
9
+ import Cookies from 'js-cookie'
10
10
 
11
- let downloadLoadingInstance;
11
+ let downloadLoadingInstance
12
12
  // 是否显示重新登录
13
- export let isRelogin = { show: false };
13
+ export let isRelogin = { show: false }
14
14
 
15
- axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
15
+ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
16
16
  // 创建axios实例
17
17
  const service = axios.create({
18
18
  // axios中请求配置有baseURL选项,表示请求URL公共部分
19
- baseURL: "/prod-admin",
19
+ baseURL: '/prod-admin',
20
20
  // 超时
21
- timeout: 60000,
22
- });
21
+ timeout: 60000
22
+ })
23
23
 
24
24
  // request拦截器
25
25
  service.interceptors.request.use(
26
26
  (config) => {
27
27
  // 是否需要设置 token
28
- const isToken = (config.headers || {}).isToken === false;
28
+ const isToken = (config.headers || {}).isToken === false
29
29
  // 是否需要防止数据重复提交
30
- const isRepeatSubmit = (config.headers || {}).repeatSubmit === false;
31
- if (
32
- !config.url.includes("/api/transaction/list") &&
33
- getToken() &&
34
- !isToken
35
- ) {
36
- config.headers["Authorization"] = "Bearer " + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
30
+ const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
31
+ if (!config.url.includes('/api/transaction/list') && getToken() && !isToken) {
32
+ config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
37
33
  }
38
34
  // get请求映射params参数
39
- if (config.method === "get" && config.params) {
40
- let url = config.url + "?" + tansParams(config.params);
41
- url = url.slice(0, -1);
42
- config.params = {};
43
- config.url = url;
35
+ if (config.method === 'get' && config.params) {
36
+ let url = config.url + '?' + tansParams(config.params)
37
+ url = url.slice(0, -1)
38
+ config.params = {}
39
+ config.url = url
44
40
  }
45
- if (
46
- !isRepeatSubmit &&
47
- (config.method === "post" || config.method === "put")
48
- ) {
41
+ if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
49
42
  const requestObj = {
50
43
  url: config.url,
51
- data:
52
- typeof config.data === "object"
53
- ? JSON.stringify(config.data)
54
- : config.data,
55
- time: new Date().getTime(),
56
- };
57
- const sessionObj = cache.session.getJSON("sessionObj");
58
- if (
59
- sessionObj === undefined ||
60
- sessionObj === null ||
61
- sessionObj === ""
62
- ) {
63
- cache.session.setJSON("sessionObj", requestObj);
44
+ data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
45
+ time: new Date().getTime()
46
+ }
47
+ const sessionObj = cache.session.getJSON('sessionObj')
48
+ if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
49
+ cache.session.setJSON('sessionObj', requestObj)
64
50
  } else {
65
- const s_url = sessionObj.url; // 请求地址
66
- const s_data = sessionObj.data; // 请求数据
67
- const s_time = sessionObj.time; // 请求时间
68
- const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
69
- if (
70
- s_data === requestObj.data &&
71
- requestObj.time - s_time < interval &&
72
- s_url === requestObj.url
73
- ) {
74
- const message = "数据正在处理,请勿重复提交";
75
- console.warn(`[${s_url}]: ` + message);
76
- return Promise.reject(new Error(message));
51
+ const s_url = sessionObj.url // 请求地址
52
+ const s_data = sessionObj.data // 请求数据
53
+ const s_time = sessionObj.time // 请求时间
54
+ const interval = 1000 // 间隔时间(ms),小于此时间视为重复提交
55
+ if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
56
+ const message = '数据正在处理,请勿重复提交'
57
+ console.warn(`[${s_url}]: ` + message)
58
+ return Promise.reject(new Error(message))
77
59
  } else {
78
- cache.session.setJSON("sessionObj", requestObj);
60
+ cache.session.setJSON('sessionObj', requestObj)
79
61
  }
80
62
  }
81
63
  }
82
64
 
83
- if (config.url.includes("/order/tracing?askId")) {
84
- config.baseURL = "";
85
- const token = Cookies.get("token");
86
- config.headers.token = token;
65
+ if (config.url.includes('/order/tracing?askId')) {
66
+ config.baseURL = ''
67
+ const token = Cookies.get('token')
68
+ config.headers.token = token
87
69
  }
88
- return config;
70
+ return config
89
71
  },
90
72
  (error) => {
91
- console.log(error);
92
- Promise.reject(error);
73
+ console.log(error)
74
+ Promise.reject(error)
93
75
  }
94
- );
76
+ )
95
77
 
96
78
  // 响应拦截器
97
79
  service.interceptors.response.use(
98
80
  (res) => {
99
81
  // 未设置状态码则默认成功状态
100
- const code = res.data.code || 200;
82
+ const code = res.data.code || 200
101
83
  // 获取错误信息
102
- const msg = errorCode[code] || res.data.msg || errorCode["default"];
84
+ const msg = errorCode[code] || res.data.msg || errorCode['default']
103
85
  // 二进制数据则直接返回
104
- if (
105
- res.request.responseType === "blob" ||
106
- res.request.responseType === "arraybuffer"
107
- ) {
108
- return res.data;
86
+ if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
87
+ return res.data
109
88
  }
110
89
  if (code === 401) {
111
90
  if (!isRelogin.show) {
112
- isRelogin.show = true;
113
- MessageBox.confirm(
114
- "登录状态已过期,您可以继续留在该页面,或者重新登录",
115
- "系统提示",
116
- {
117
- confirmButtonText: "重新登录",
118
- cancelButtonText: "取消",
119
- type: "warning",
120
- }
121
- )
91
+ isRelogin.show = true
92
+ MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
93
+ confirmButtonText: '重新登录',
94
+ cancelButtonText: '取消',
95
+ type: 'warning'
96
+ })
122
97
  .then(() => {
123
- isRelogin.show = false;
124
- store.dispatch("LogOut").then(() => {
125
- location.href = "/index";
126
- });
98
+ isRelogin.show = false
99
+ store.dispatch('LogOut').then(() => {
100
+ location.href = '/index'
101
+ })
127
102
  })
128
103
  .catch(() => {
129
- isRelogin.show = false;
130
- });
104
+ isRelogin.show = false
105
+ })
131
106
  }
132
- return Promise.reject("无效的会话,或者会话已过期,请重新登录。");
107
+ return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
133
108
  } else if (code === 500) {
134
109
  Message({
135
110
  message: msg,
136
- type: "error",
137
- });
138
-
139
- return Promise.reject(new Error(msg));
111
+ type: 'error'
112
+ })
113
+ return res.data
140
114
  } else if (code !== 200) {
141
- Notification.error({
142
- title: msg,
143
- });
144
- return Promise.reject("error");
115
+ Message({
116
+ message: msg,
117
+ type: 'error'
118
+ })
119
+ return res.data
145
120
  } else {
146
- return res.data;
121
+ return res.data
147
122
  }
148
123
  },
149
124
  (error) => {
150
- console.log("err" + error);
151
- let { message } = error;
152
- if (message == "Network Error") {
153
- message = "后端接口连接异常";
154
- } else if (message.includes("timeout")) {
155
- message = "系统接口请求超时";
156
- } else if (message.includes("Request failed with status code")) {
157
- message = "系统接口" + message.substr(message.length - 3) + "异常";
125
+ console.log('err' + error)
126
+ let { message } = error
127
+ if (message == 'Network Error') {
128
+ message = '后端接口连接异常'
129
+ } else if (message.includes('timeout')) {
130
+ message = '系统接口请求超时'
131
+ } else if (message.includes('Request failed with status code')) {
132
+ message = '系统接口' + message.substr(message.length - 3) + '异常'
158
133
  }
159
134
  Message({
160
135
  message: message,
161
- type: "error",
162
- duration: 5 * 1000,
163
- });
164
- return Promise.reject(error);
136
+ type: 'error',
137
+ duration: 5 * 1000
138
+ })
139
+ return Promise.reject(error)
165
140
  }
166
- );
141
+ )
167
142
 
168
143
  // 通用下载方法
169
144
  export function download(url, params, filename) {
170
145
  downloadLoadingInstance = Loading.service({
171
- text: "正在下载数据,请稍候",
172
- spinner: "el-icon-loading",
173
- background: "rgba(0, 0, 0, 0.7)",
174
- });
146
+ text: '正在下载数据,请稍候',
147
+ spinner: 'el-icon-loading',
148
+ background: 'rgba(0, 0, 0, 0.7)'
149
+ })
175
150
  return service
176
151
  .post(url, params, {
177
152
  transformRequest: [
178
153
  (params) => {
179
- return tansParams(params);
180
- },
154
+ return tansParams(params)
155
+ }
181
156
  ],
182
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
183
- responseType: "blob",
157
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
158
+ responseType: 'blob'
184
159
  })
185
160
  .then(async (data) => {
186
- const isLogin = await blobValidate(data);
161
+ const isLogin = await blobValidate(data)
187
162
  if (isLogin) {
188
- const blob = new Blob([data]);
189
- saveAs(blob, filename);
163
+ const blob = new Blob([data])
164
+ saveAs(blob, filename)
190
165
  } else {
191
- const resText = await data.text();
192
- const rspObj = JSON.parse(resText);
193
- const errMsg =
194
- errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
195
- Message.error(errMsg);
166
+ const resText = await data.text()
167
+ const rspObj = JSON.parse(resText)
168
+ const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
169
+ Message.error(errMsg)
196
170
  }
197
- downloadLoadingInstance.close();
171
+ downloadLoadingInstance.close()
198
172
  })
199
173
  .catch((r) => {
200
- console.error(r);
201
- Message.error("下载文件出现错误,请联系管理员!");
202
- downloadLoadingInstance.close();
203
- });
174
+ console.error(r)
175
+ Message.error('下载文件出现错误,请联系管理员!')
176
+ downloadLoadingInstance.close()
177
+ })
204
178
  }
205
179
 
206
180
  export function downloadFile(url, filename) {
207
- let xmlhttp = new XMLHttpRequest();
208
- xmlhttp.open("GET", url, true);
209
- xmlhttp.responseType = "blob";
181
+ let xmlhttp = new XMLHttpRequest()
182
+ xmlhttp.open('GET', url, true)
183
+ xmlhttp.responseType = 'blob'
210
184
  xmlhttp.onload = function () {
211
185
  if (this.status == 200) {
212
- const blob = this.response;
213
- const link = document.createElement("a");
214
- link.href = window.URL.createObjectURL(blob);
215
- link.download = filename;
216
- document.body.appendChild(link);
217
- link.click();
218
- document.body.removeChild(link);
186
+ const blob = this.response
187
+ const link = document.createElement('a')
188
+ link.href = window.URL.createObjectURL(blob)
189
+ link.download = filename
190
+ document.body.appendChild(link)
191
+ link.click()
192
+ document.body.removeChild(link)
219
193
  }
220
- };
221
- xmlhttp.send();
194
+ }
195
+ xmlhttp.send()
222
196
  }
223
197
 
224
- export default service;
198
+ export default service