@ditari/bsui 1.1.28 → 1.1.29

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.
@@ -1,59 +1,59 @@
1
1
  {
2
- "hash": "127dc0b3",
3
- "browserHash": "ecbe7dde",
2
+ "hash": "ed01a902",
3
+ "browserHash": "6c59cd66",
4
4
  "optimized": {
5
5
  "@ant-design/icons-vue": {
6
6
  "src": "../../../../../../node_modules/.pnpm/@ant-design+icons-vue@6.1.0_vue@3.3.4/node_modules/@ant-design/icons-vue/es/index.js",
7
7
  "file": "@ant-design_icons-vue.js",
8
- "fileHash": "7220585f",
8
+ "fileHash": "9584c5c4",
9
9
  "needsInterop": false
10
10
  },
11
11
  "@vueuse/core": {
12
12
  "src": "../../../../../../node_modules/.pnpm/@vueuse+core@9.13.0_@vue+composition-api@1.7.1_vue@3.3.4/node_modules/@vueuse/core/index.mjs",
13
13
  "file": "@vueuse_core.js",
14
- "fileHash": "68554331",
14
+ "fileHash": "1ff61211",
15
15
  "needsInterop": false
16
16
  },
17
17
  "ant-design-vue": {
18
18
  "src": "../../../../../../node_modules/.pnpm/ant-design-vue@3.2.20_vue@3.3.4/node_modules/ant-design-vue/es/index.js",
19
19
  "file": "ant-design-vue.js",
20
- "fileHash": "07f9a6e1",
20
+ "fileHash": "e9e273ea",
21
+ "needsInterop": false
22
+ },
23
+ "axios": {
24
+ "src": "../../../../../../node_modules/.pnpm/axios@1.4.0/node_modules/axios/index.js",
25
+ "file": "axios.js",
26
+ "fileHash": "703a70b0",
21
27
  "needsInterop": false
22
28
  },
23
29
  "pinia": {
24
30
  "src": "../../../../../../node_modules/.pnpm/pinia@2.1.4_@vue+composition-api@1.7.1_typescript@4.9.5_vue@3.3.4/node_modules/pinia/dist/pinia.mjs",
25
31
  "file": "pinia.js",
26
- "fileHash": "5b165f94",
32
+ "fileHash": "90342e48",
27
33
  "needsInterop": false
28
34
  },
29
35
  "pinia-plugin-persistedstate": {
30
36
  "src": "../../../../../../node_modules/.pnpm/pinia-plugin-persistedstate@3.1.0_pinia@2.1.4/node_modules/pinia-plugin-persistedstate/dist/index.mjs",
31
37
  "file": "pinia-plugin-persistedstate.js",
32
- "fileHash": "7875307e",
38
+ "fileHash": "4c0ed159",
33
39
  "needsInterop": false
34
40
  },
35
41
  "vue": {
36
42
  "src": "../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.js",
37
43
  "file": "vue.js",
38
- "fileHash": "b862c4cd",
39
- "needsInterop": false
40
- },
41
- "vue-router": {
42
- "src": "../../../../../../node_modules/.pnpm/vue-router@4.2.4_vue@3.3.4/node_modules/vue-router/dist/vue-router.mjs",
43
- "file": "vue-router.js",
44
- "fileHash": "8dd191e8",
45
- "needsInterop": false
46
- },
47
- "axios": {
48
- "src": "../../../../../../node_modules/.pnpm/axios@1.4.0/node_modules/axios/index.js",
49
- "file": "axios.js",
50
- "fileHash": "299d8ad7",
44
+ "fileHash": "a4178637",
51
45
  "needsInterop": false
52
46
  },
53
47
  "vue-request": {
54
48
  "src": "../../../../../../node_modules/.pnpm/vue-request@2.0.0-rc.4_@vue+composition-api@1.7.1_vue@3.3.4/node_modules/vue-request/dist/index.es.js",
55
49
  "file": "vue-request.js",
56
- "fileHash": "450a611a",
50
+ "fileHash": "b90ec3ba",
51
+ "needsInterop": false
52
+ },
53
+ "vue-router": {
54
+ "src": "../../../../../../node_modules/.pnpm/vue-router@4.2.4_vue@3.3.4/node_modules/vue-router/dist/vue-router.mjs",
55
+ "file": "vue-router.js",
56
+ "fileHash": "1c61adf5",
57
57
  "needsInterop": false
58
58
  }
59
59
  },
@@ -61,12 +61,15 @@
61
61
  "chunk-EKNPBJBG": {
62
62
  "file": "chunk-EKNPBJBG.js"
63
63
  },
64
+ "chunk-D36HXFYL": {
65
+ "file": "chunk-D36HXFYL.js"
66
+ },
67
+ "chunk-TDI2FIXO": {
68
+ "file": "chunk-TDI2FIXO.js"
69
+ },
64
70
  "chunk-EBDM3ESC": {
65
71
  "file": "chunk-EBDM3ESC.js"
66
72
  },
67
- "chunk-SHNKM4NZ": {
68
- "file": "chunk-SHNKM4NZ.js"
69
- },
70
73
  "chunk-GK7Q6YQN": {
71
74
  "file": "chunk-GK7Q6YQN.js"
72
75
  },
@@ -1,6 +1,5 @@
1
1
  // ../../../node_modules/.pnpm/vue-demi@0.14.5_@vue+composition-api@1.7.1_vue@3.3.4/node_modules/vue-demi/lib/index.mjs
2
2
  var isVue2 = false;
3
- var isVue3 = true;
4
3
  function set(target, key, val) {
5
4
  if (Array.isArray(target)) {
6
5
  target.length = Math.max(target.length, key);
@@ -20,8 +19,7 @@ function del(target, key) {
20
19
 
21
20
  export {
22
21
  isVue2,
23
- isVue3,
24
22
  set,
25
23
  del
26
24
  };
27
- //# sourceMappingURL=chunk-SHNKM4NZ.js.map
25
+ //# sourceMappingURL=chunk-D36HXFYL.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../node_modules/.pnpm/vue-demi@0.14.5_@vue+composition-api@1.7.1_vue@3.3.4/node_modules/vue-demi/lib/index.mjs"],
4
+ "sourcesContent": ["import * as Vue from 'vue'\n\nvar isVue2 = false\nvar isVue3 = true\nvar Vue2 = undefined\n\nfunction install() {}\n\nexport function set(target, key, val) {\n if (Array.isArray(target)) {\n target.length = Math.max(target.length, key)\n target.splice(key, 1, val)\n return val\n }\n target[key] = val\n return val\n}\n\nexport function del(target, key) {\n if (Array.isArray(target)) {\n target.splice(key, 1)\n return\n }\n delete target[key]\n}\n\nexport * from 'vue'\nexport {\n Vue,\n Vue2,\n isVue2,\n isVue3,\n install,\n}\n"],
5
+ "mappings": ";AAEA,IAAI,SAAS;AAMN,SAAS,IAAI,QAAQ,KAAK,KAAK;AACpC,MAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,WAAO,SAAS,KAAK,IAAI,OAAO,QAAQ,GAAG;AAC3C,WAAO,OAAO,KAAK,GAAG,GAAG;AACzB,WAAO;AAAA,EACT;AACA,SAAO,GAAG,IAAI;AACd,SAAO;AACT;AAEO,SAAS,IAAI,QAAQ,KAAK;AAC/B,MAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,WAAO,OAAO,KAAK,CAAC;AACpB;AAAA,EACF;AACA,SAAO,OAAO,GAAG;AACnB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+ // ../../../node_modules/.pnpm/vue-demi@0.14.6_@vue+composition-api@1.7.1_vue@3.3.4/node_modules/vue-demi/lib/index.mjs
2
+ var isVue2 = false;
3
+ var isVue3 = true;
4
+ function set(target, key, val) {
5
+ if (Array.isArray(target)) {
6
+ target.length = Math.max(target.length, key);
7
+ target.splice(key, 1, val);
8
+ return val;
9
+ }
10
+ target[key] = val;
11
+ return val;
12
+ }
13
+
14
+ export {
15
+ isVue2,
16
+ isVue3,
17
+ set
18
+ };
19
+ //# sourceMappingURL=chunk-TDI2FIXO.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../../../node_modules/.pnpm/vue-demi@0.14.5_@vue+composition-api@1.7.1_vue@3.3.4/node_modules/vue-demi/lib/index.mjs"],
3
+ "sources": ["../../../../../../node_modules/.pnpm/vue-demi@0.14.6_@vue+composition-api@1.7.1_vue@3.3.4/node_modules/vue-demi/lib/index.mjs"],
4
4
  "sourcesContent": ["import * as Vue from 'vue'\n\nvar isVue2 = false\nvar isVue3 = true\nvar Vue2 = undefined\n\nfunction install() {}\n\nexport function set(target, key, val) {\n if (Array.isArray(target)) {\n target.length = Math.max(target.length, key)\n target.splice(key, 1, val)\n return val\n }\n target[key] = val\n return val\n}\n\nexport function del(target, key) {\n if (Array.isArray(target)) {\n target.splice(key, 1)\n return\n }\n delete target[key]\n}\n\nexport * from 'vue'\nexport {\n Vue,\n Vue2,\n isVue2,\n isVue3,\n install,\n}\n"],
5
- "mappings": ";AAEA,IAAI,SAAS;AACb,IAAI,SAAS;AAKN,SAAS,IAAI,QAAQ,KAAK,KAAK;AACpC,MAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,WAAO,SAAS,KAAK,IAAI,OAAO,QAAQ,GAAG;AAC3C,WAAO,OAAO,KAAK,GAAG,GAAG;AACzB,WAAO;AAAA,EACT;AACA,SAAO,GAAG,IAAI;AACd,SAAO;AACT;AAEO,SAAS,IAAI,QAAQ,KAAK;AAC/B,MAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,WAAO,OAAO,KAAK,CAAC;AACpB;AAAA,EACF;AACA,SAAO,OAAO,GAAG;AACnB;",
5
+ "mappings": ";AAEA,IAAI,SAAS;AACb,IAAI,SAAS;AAKN,SAAS,IAAI,QAAQ,KAAK,KAAK;AACpC,MAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,WAAO,SAAS,KAAK,IAAI,OAAO,QAAQ,GAAG;AAC3C,WAAO,OAAO,KAAK,GAAG,GAAG;AACzB,WAAO;AAAA,EACT;AACA,SAAO,GAAG,IAAI;AACd,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,11 +1,11 @@
1
- import {
2
- setupDevtoolsPlugin
3
- } from "./chunk-EBDM3ESC.js";
4
1
  import {
5
2
  del,
6
3
  isVue2,
7
4
  set
8
- } from "./chunk-SHNKM4NZ.js";
5
+ } from "./chunk-D36HXFYL.js";
6
+ import {
7
+ setupDevtoolsPlugin
8
+ } from "./chunk-EBDM3ESC.js";
9
9
  import {
10
10
  computed,
11
11
  effectScope,
@@ -1,4 +1,4 @@
1
- import "./chunk-SHNKM4NZ.js";
1
+ import "./chunk-TDI2FIXO.js";
2
2
  import {
3
3
  computed,
4
4
  inject,
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts"></script>
2
2
  <template>
3
- <router-link to="/form/query-demo"> 跳转 </router-link>
4
3
  <router-view v-slot="{ Component }">
5
4
  <keep-alive>
6
5
  <component :is="Component" />
@@ -0,0 +1,13 @@
1
+ import http from "../../utils/http";
2
+
3
+ export const getImgCode = () => {
4
+ return http.get("getVerifyCode");
5
+ };
6
+
7
+ export const doLogin = (params: any) => {
8
+ // const formData = new FormData();
9
+ // formData.append("username", params.username);
10
+ // formData.append("password", params.password);
11
+ // formData.append("verifyCode", params.verifyCode);
12
+ return http.post("login", params);
13
+ };
@@ -2,19 +2,59 @@
2
2
  /**
3
3
  * 登录
4
4
  */
5
+ import { ref } from "vue";
6
+ import { getImgCode, doLogin } from "../api/user";
7
+ const formState = ref({
8
+ username: "",
9
+ password: "",
10
+ verifyCode: "",
11
+ verifyCodeKey: ""
12
+ });
13
+ const src = ref("");
14
+ const onCode = () => {
15
+ getImgCode().then((res) => {
16
+ src.value = res.verifyCode;
17
+ formState.value.verifyCodeKey = res.verifyCodeKey
18
+ });
19
+ };
20
+
21
+ const onLogin = () => {
22
+ doLogin(formState.value).then((res) => {
23
+ console.log(res);
24
+ });
25
+ };
26
+ onCode();
5
27
  </script>
6
28
  <template>
7
29
  <div class="login-main">
8
30
  <div class="login-box">
9
31
  <a-form>
10
32
  <a-form-item>
11
- <a-input placeholder="请输入账号" />
33
+ <a-input
34
+ v-model:value="formState.username"
35
+ placeholder="请输入账号"
36
+ />
12
37
  </a-form-item>
13
38
  <a-form-item>
14
- <a-input type="password" placeholder="请输入密码" />
39
+ <a-input
40
+ v-model:value="formState.password"
41
+ type="password"
42
+ placeholder="请输入密码"
43
+ />
15
44
  </a-form-item>
16
45
  <a-form-item>
17
- <a-button type="primary" block>登录</a-button>
46
+ <a-input
47
+ v-model:value="formState.verifyCode"
48
+ placeholder="请输入密码"
49
+ />
50
+ <img
51
+ style="width: 120px; height: 40px"
52
+ :src="'data:image/jpg;base64,' + src"
53
+ @click="onCode"
54
+ />
55
+ </a-form-item>
56
+ <a-form-item>
57
+ <a-button type="primary" block @click="onLogin">登录</a-button>
18
58
  </a-form-item>
19
59
  </a-form>
20
60
  </div>
@@ -275,17 +275,23 @@ export default {
275
275
  <template #table="{ height }">
276
276
  <d-table
277
277
  v-model:keys="selectedRowKeys"
278
+ @change="
279
+ () => {
280
+ console.log('change');
281
+ }
282
+ "
278
283
  row-key="id"
279
284
  :loading="loading"
280
285
  :expanded-row-keys="['1', '2']"
281
286
  :data="data"
282
287
  :config="config"
283
- :height="height"
288
+ :height="height - 200"
284
289
  >
285
290
  <template #action>
286
291
  <a-button>ok</a-button>
287
292
  </template>
288
293
  </d-table>
294
+ <div style="height: 200px; background-color: red"></div>
289
295
  </template>
290
296
  <!-- <TestModal v-model:visible="visible" />-->
291
297
  </d-list-layout>
@@ -7,6 +7,7 @@ export const useTableConfig = () => {
7
7
  {
8
8
  title: "Id",
9
9
  dataIndex: "id",
10
+ sorter: true,
10
11
  width: 350
11
12
  },
12
13
  {
@@ -0,0 +1,107 @@
1
+ import axios from "axios";
2
+ import { message as Message, Modal } from "ant-design-vue";
3
+ import type {
4
+ AxiosInstance,
5
+ InternalAxiosRequestConfig,
6
+ AxiosResponse
7
+ } from "axios";
8
+
9
+ const cancelSource = axios.CancelToken.source();
10
+ const http: AxiosInstance = axios.create({
11
+ baseURL: "http://172.16.10.34:1243/",
12
+ timeout: 1000 * 10 * 60,
13
+ cancelToken: cancelSource.token,
14
+ withCredentials: true
15
+ });
16
+
17
+ // 因为现在的后台接口状态码真是TMD没统一
18
+ const SUCCESS_CODE = ["200", "0"];
19
+ // 登录失效状态码
20
+ const EXPIRED_STATUS_CODE = ["401", "403"];
21
+ // 超额状态码
22
+ const OVER_AMOUNT_CODE = ["1056"];
23
+ const BLACK_URL = ["/login"];
24
+
25
+ http.interceptors.request.use((config: InternalAxiosRequestConfig) => {
26
+ if (!BLACK_URL.includes(config.url as any)) {
27
+ // 没有包含login的url 才添加token
28
+ // config.headers["Authorization"] = getToken;
29
+ }
30
+ return config;
31
+ });
32
+
33
+ http.interceptors.response.use(
34
+ async ({ data }: AxiosResponse) => {
35
+ const { code, data: content, message } = data;
36
+ const successStatus = SUCCESS_CODE.includes(code);
37
+
38
+ // 状态码在SUCCESS_CODE 里面表示成功
39
+ if (successStatus) {
40
+ // 返回响应内容
41
+ return content;
42
+ }
43
+
44
+ switch (code) {
45
+ case EXPIRED_STATUS_CODE[0]:
46
+ case EXPIRED_STATUS_CODE[1]:
47
+ handleExpiredToken();
48
+ break;
49
+ case OVER_AMOUNT_CODE[0]:
50
+ handleOverAmount(message);
51
+ break;
52
+ default:
53
+ handleDefaultError(message);
54
+ break;
55
+ }
56
+ return Promise.reject(data);
57
+ },
58
+ (error) => {
59
+ // 网络超时异常处理
60
+ if (
61
+ error.code === "ECONNABORTED" ||
62
+ error.message === "Network Error" ||
63
+ error.message.includes("timeout")
64
+ ) {
65
+ handleTimeoutError();
66
+ }
67
+ return Promise.reject(error);
68
+ }
69
+ );
70
+
71
+ function handleExpiredToken() {
72
+ cancelSource.cancel("token失效,取消后续请求");
73
+ sessionStorage.clear();
74
+ Message.warn({ content: "登录失效,请重新登录", duration: 5 });
75
+ setTimeout(() => {
76
+ location.href = (import.meta.env.VITE_APP_BASE_URL || "") + "/login";
77
+ }, 2000);
78
+ }
79
+
80
+ function handleOverAmount(message: string) {
81
+ Modal.confirm({
82
+ title: "超额提示",
83
+ content: message,
84
+ centered: true,
85
+ okText: "明白",
86
+ cancelText: "关闭",
87
+ onCancel() {
88
+ Modal.destroyAll();
89
+ }
90
+ });
91
+ }
92
+
93
+ function handleDefaultError(message: string) {
94
+ Message.warn({
95
+ content: message || "未知错误,请联系后台开发人员!!!",
96
+ duration: 6
97
+ });
98
+ }
99
+
100
+ function handleTimeoutError() {
101
+ Message.error({
102
+ content: "请求超时,请稍后重试",
103
+ duration: 6
104
+ });
105
+ }
106
+
107
+ export default http;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.1.28",
3
+ "version": "1.1.29",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -71,11 +71,13 @@ const basePageClassName = `${prefixName}-pagination`;
71
71
  */
72
72
  const DXTable = defineComponent({
73
73
  name: "DTable",
74
+ inheritAttrs: false,
74
75
  props: tableProps(),
75
76
  // emits: { "update:keys": (keys: []) => void }
76
77
  // TODO 需要做调整
77
78
  emits: ["update:keys"],
78
- setup: function (props, { emit, slots }) {
79
+ setup: function (props, { emit, slots, attrs }) {
80
+ console.log(attrs);
79
81
  //分页默认配置
80
82
  const paginationConfig = reactive({
81
83
  defaultPageSize: 20,
@@ -396,11 +398,12 @@ const DXTable = defineComponent({
396
398
  };
397
399
 
398
400
  return () => (
399
- <div ref={tableRootRef} style={{ height: "100%" }}>
401
+ <div ref={tableRootRef}>
400
402
  <Table
401
403
  ref={tableRef}
402
404
  row-key={props.rowKey}
403
405
  bordered={props.config.bordered}
406
+ {...attrs}
404
407
  columns={columns.value}
405
408
  dataSource={dataSource.value}
406
409
  loading={props.loading}