byt-ui 0.1.14 → 0.1.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "byt-ui",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "private": false,
5
5
  "description": "byt组件库",
6
6
  "author": {
@@ -35,6 +35,7 @@
35
35
  "@vue/cli-plugin-eslint": "~5.0.0",
36
36
  "@vue/cli-service": "~5.0.0",
37
37
  "babel-plugin-component": "^1.1.1",
38
+ "babel-plugin-import": "1.13.6",
38
39
  "babel-preset-env": "^1.7.0",
39
40
  "eslint": "^7.32.0",
40
41
  "eslint-plugin-vue": "^8.0.3",
@@ -1,7 +1,6 @@
1
1
  import axios from 'axios'
2
2
  import { Message } from 'element-ui'
3
3
  import { getCookie } from './cookie'
4
-
5
4
  class Request {
6
5
  constructor(config = {}, Vue = null) {
7
6
  const { options = {}, handler = {}} = config;
@@ -18,6 +17,7 @@ class Request {
18
17
  '428': 'token过期,请重新登录',
19
18
  '429': '请求过频繁',
20
19
  '479': '演示环境,没有权限操作',
20
+ '503': '服务未启动,请联系管理员处理',
21
21
  'default': '系统未知错误,请反馈给管理员'
22
22
  }
23
23
  this._methods = ['get', 'post', 'delete', 'put']
@@ -26,17 +26,22 @@ class Request {
26
26
  baseURL: '/bytserver',
27
27
  responseType: 'json',
28
28
  timeout: 60000,
29
- withCredentials: false
29
+ showError: true,
30
+ withCredentials: false,
31
+ validateStatus(status) {
32
+ // >=200或者<=500的统一由成功拦截处理
33
+ return status >= 200 && status <= 500 // 默认的
34
+ }
30
35
  }, options)
31
36
 
32
- this.request = axios.create(this.options)
37
+ this._request = axios.create(this.options)
33
38
  // 注册fetch;
34
39
  this.register()
35
40
  }
36
41
 
37
42
  interceptors() {
38
43
  // HTTPrequest拦截
39
- this.request.interceptors.request.use(config => {
44
+ this._request.interceptors.request.use(config => {
40
45
  const TENANT_ID = getCookie('tenantId')
41
46
  const isToken = (config.headers || {}).isToken === false
42
47
  const token = getCookie('access_token')
@@ -51,7 +56,7 @@ class Request {
51
56
  })
52
57
 
53
58
  // HTTPresponse拦截
54
- this.request.interceptors.response.use(res => {
59
+ this._request.interceptors.response.use(res => {
55
60
  const status = Number(res.status) || 200
56
61
  const message = res.data.msg || this._errorCode[status] || this._errorCode['default']
57
62
  if (status == 424 || status == 428) {
@@ -61,7 +66,7 @@ class Request {
61
66
  const { outLogin } = this._Vue.prototype.$appCommon;
62
67
  outLogin && outLogin();
63
68
  }
64
- return res.data
69
+ return Promise.reject(res.data)
65
70
  }
66
71
  if (status !== 200 || res.data.code === 1) {
67
72
  if (res.config.showError) Message.error(message)
@@ -70,7 +75,7 @@ class Request {
70
75
 
71
76
  this.handler.success && this.handler.success(res.data);
72
77
  return res.data
73
- }, error => {
78
+ }, (error) => {
74
79
  if (error.response) {
75
80
  // const status = error.response.status
76
81
  const message = error.response.data.msg;
@@ -91,7 +96,7 @@ class Request {
91
96
  }
92
97
  setMethods() {
93
98
  this._methods.forEach(v => {
94
- this.request[v] = ({
99
+ this._request[v] = ({
95
100
  url,
96
101
  data = {},
97
102
  params = {},
@@ -101,7 +106,7 @@ class Request {
101
106
  showError
102
107
  }) => {
103
108
  return new Promise((resolve, reject) => {
104
- this.request({
109
+ this._request({
105
110
  url,
106
111
  method: v.toUpperCase(),
107
112
  data,
@@ -124,7 +129,7 @@ class Request {
124
129
  // 重试请求
125
130
  reject(err)
126
131
  if (retry > 0) {
127
- this.request[v]({
132
+ this._request[v]({
128
133
  url,
129
134
  data,
130
135
  params,
@@ -150,8 +155,8 @@ class Request {
150
155
  }
151
156
 
152
157
  export const fetch = (config = {}, Vue) => {
153
- const { request } = new Request(Object.assign({}, config), Vue)
154
- return request
158
+ const { _request } = new Request(Object.assign({}, config), Vue)
159
+ return _request
155
160
  }
156
161
 
157
162
  export default {
package/packages/index.js CHANGED
@@ -2,26 +2,18 @@
2
2
  * @Description:
3
3
  * @Author: 王国火
4
4
  * @Date: 2022-09-15 17:02:55
5
- * @LastEditTime: 2024-04-18 16:27:33
5
+ * @LastEditTime: 2024-06-26 11:27:07
6
6
  * @LastEditors: 王国火
7
7
  */
8
- import Vue from 'vue'
8
+ // import Vue from 'vue'
9
9
  // 通用组件
10
10
  import components from './components.js'
11
11
  // 公用方法
12
12
  import Common from './common/index'
13
13
 
14
14
  // 第三方依赖
15
- import 'xe-utils'
16
- import VXETable from 'vxe-table'
17
- import 'vxe-table/lib/style.css'
18
- import ElementUI from 'element-ui'
19
- import 'element-ui/lib/theme-chalk/index.css'
20
- Vue.use(VXETable)
21
- Vue.use(ElementUI, {
22
- size: 'small',
23
- menuType: 'text'
24
- })
15
+ import './plugins/element-ui.js'
16
+ import './plugins/vxe-table.js'
25
17
 
26
18
  const Cmps = {}
27
19
  components.map(component => {
@@ -0,0 +1,103 @@
1
+ import Vue from 'vue'
2
+ import {
3
+ Pagination,
4
+ Dialog,
5
+ Autocomplete,
6
+ Input,
7
+ InputNumber,
8
+ Radio,
9
+ RadioGroup,
10
+ RadioButton,
11
+ Checkbox,
12
+ CheckboxButton,
13
+ CheckboxGroup,
14
+ Switch,
15
+ Select,
16
+ Option,
17
+ OptionGroup,
18
+ Button,
19
+ ButtonGroup,
20
+ Table,
21
+ TableColumn,
22
+ DatePicker,
23
+ Popover,
24
+ Tooltip,
25
+ Form,
26
+ FormItem,
27
+ Tabs,
28
+ TabPane,
29
+ Tag,
30
+ Tree,
31
+ Icon,
32
+ Row,
33
+ Col,
34
+ Upload,
35
+ Cascader,
36
+ Transfer,
37
+ Link,
38
+ Divider,
39
+ Image,
40
+ Loading,
41
+ MessageBox,
42
+ Message,
43
+ Empty
44
+ } from 'element-ui';
45
+ import langZHCN from 'element-ui/lib/locale/lang/zh-CN'
46
+ import locale from 'element-ui/lib/locale'
47
+ // import 'element-ui/lib/theme-chalk/index.css';
48
+ // Vue.use(ElementUI, {
49
+ // size: 'small',
50
+ // menuType: 'text'
51
+ // })
52
+ locale.use(langZHCN)
53
+ Vue.prototype.$ELEMENT = {
54
+ size: 'small',
55
+ menuType: 'text'
56
+ }
57
+ Vue.use(Pagination);
58
+ Vue.use(Dialog);
59
+ Vue.use(Autocomplete);
60
+ Vue.use(Input);
61
+ Vue.use(InputNumber);
62
+ Vue.use(Radio);
63
+ Vue.use(RadioGroup);
64
+ Vue.use(RadioButton);
65
+ Vue.use(Checkbox);
66
+ Vue.use(CheckboxButton);
67
+ Vue.use(CheckboxGroup);
68
+ Vue.use(Switch);
69
+ Vue.use(Select);
70
+ Vue.use(Option);
71
+ Vue.use(OptionGroup);
72
+ Vue.use(Button);
73
+ Vue.use(ButtonGroup);
74
+ Vue.use(Table);
75
+ Vue.use(TableColumn);
76
+ Vue.use(DatePicker);
77
+ Vue.use(Popover);
78
+ Vue.use(Tooltip);
79
+ Vue.use(Form);
80
+ Vue.use(FormItem);
81
+ Vue.use(Tabs);
82
+ Vue.use(TabPane);
83
+ Vue.use(Tag);
84
+ Vue.use(Tree);
85
+ Vue.use(Icon);
86
+ Vue.use(Row);
87
+ Vue.use(Col);
88
+ Vue.use(Upload);
89
+ Vue.use(Cascader);
90
+ Vue.use(Transfer);
91
+ Vue.use(Link);
92
+ Vue.use(Divider);
93
+ Vue.use(Image);
94
+ Vue.use(Empty)
95
+ Vue.use(Loading.directive);
96
+
97
+ Vue.prototype.$loading = Loading.service;
98
+ Vue.prototype.$msgbox = MessageBox;
99
+ Vue.prototype.$alert = MessageBox.alert;
100
+ Vue.prototype.$confirm = MessageBox.confirm;
101
+ Vue.prototype.$prompt = MessageBox.prompt;
102
+ Vue.prototype.$notify = Notification;
103
+ Vue.prototype.$message = Message;
@@ -0,0 +1,53 @@
1
+ /*
2
+ * @Description:
3
+ * @Author: 王国火
4
+ * @Date: 2024-06-26 11:20:33
5
+ * @LastEditTime: 2024-06-26 12:02:26
6
+ * @LastEditors: 王国火
7
+ */
8
+ import Vue from 'vue'
9
+ import XEUtils from 'xe-utils'
10
+ import {
11
+ // 全局实例对象
12
+ VXETable,
13
+ // 可选表格模块
14
+ // VxeTableFilterModule,
15
+ // VxeTableEditModule,
16
+ // VxeTableMenuModule,
17
+ // VxeTableExportModule,
18
+ // VxeTableKeyboardModule,
19
+ // VxeTableValidatorModule,
20
+ // VxeTableCustomModule,
21
+
22
+ // 可选组件
23
+ VxeIcon,
24
+ VxeTable,
25
+ VxeColumn,
26
+ VxeColgroup,
27
+ VxeInput
28
+ } from 'vxe-table'
29
+
30
+ // 导入默认的语言
31
+ import zhCN from 'vxe-table/lib/locale/lang/zh-CN'
32
+
33
+ // 按需加载的方式默认是不带国际化的,自定义国际化需要自行解析占位符 '{0}',例如:
34
+ VXETable.setConfig({
35
+ size: 'small',
36
+ i18n: (key, args) => XEUtils.toFormatString(XEUtils.get(zhCN, key), args)
37
+ })
38
+
39
+ // 可选表格模块
40
+ // Vue.use(VxeTableFilterModule)
41
+ // Vue.use(VxeTableEditModule)
42
+ // Vue.use(VxeTableMenuModule)
43
+ // Vue.use(VxeTableExportModule)
44
+ // Vue.use(VxeTableKeyboardModule)
45
+ // Vue.use(VxeTableValidatorModule)
46
+ // Vue.use(VxeTableCustomModule)
47
+
48
+ // 可选组件
49
+ Vue.use(VxeIcon)
50
+ Vue.use(VxeTable)
51
+ Vue.use(VxeColumn)
52
+ Vue.use(VxeColgroup)
53
+ Vue.use(VxeInput)
package/.env.local DELETED
@@ -1,10 +0,0 @@
1
- ###
2
- # @Description:
3
- # @Author: 王国火
4
- # @Date: 2024-04-18 16:52:22
5
- # @LastEditTime: 2024-06-19 15:48:12
6
- # @LastEditors: 王国火
7
- ###
8
- VUE_APP_SERVER=http://192.168.0.125/bytserver
9
- VUE_APP_MINIO_HOST=192.168.0.125
10
- VUE_APP_MINIO_PORT=19000