cosey 0.2.1 → 0.2.3

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
@@ -59,3 +59,13 @@ Cosey 基于 element-plus 并补充了众多组件,意在使开发者更加专
59
59
  ## 开源协议
60
60
 
61
61
  本项目基于 [MIT](https://zh.wikipedia.org/wiki/MIT%E8%A8%B1%E5%8F%AF%E8%AD%89) 协议,请自由地享受和参与开源。
62
+
63
+ ## 构建流程
64
+
65
+ - 更新版本 `npm run cosey:version`
66
+ - 构建库 `npm run cosey:build`
67
+ - 发布库 `npm run cosey:publish`
68
+ - 打包案例 `npm run build`
69
+ - 打包文档 `npm run docs:build`
70
+ - 部署案例和文档 `npm run cosey:deploy`
71
+ - 暂存提交代码
package/config/http.d.ts CHANGED
@@ -19,6 +19,10 @@ export declare const defaultHttpConfig: {
19
19
  * HTTP 认证方案
20
20
  */
21
21
  authScheme: string;
22
+ /**
23
+ * Token 添加到的请求头字段的键名
24
+ */
25
+ authHeaderKey: string;
22
26
  /**
23
27
  * 获取属性的路径
24
28
  */
package/config/http.js CHANGED
@@ -15,6 +15,10 @@ const defaultHttpConfig = {
15
15
  * HTTP 认证方案
16
16
  */
17
17
  authScheme: "Bearer",
18
+ /**
19
+ * Token 添加到的请求头字段的键名
20
+ */
21
+ authHeaderKey: "Authorization",
18
22
  /**
19
23
  * 获取属性的路径
20
24
  */
@@ -1,4 +1,4 @@
1
- import { defineComponent, resolveComponent, createBlock, openBlock, withCtx, createElementVNode, normalizeClass, unref, createVNode, toDisplayString, resolveDynamicComponent } from 'vue';
1
+ import { defineComponent, resolveComponent, createBlock, openBlock, withCtx, createElementVNode, normalizeClass, unref, createVNode, toDisplayString, createCommentVNode, resolveDynamicComponent } from 'vue';
2
2
  import { useRouter } from 'vue-router';
3
3
  import { useGlobalConfig } from '../../config/index.js';
4
4
  import { useUserStore } from '../../store/user.js';
@@ -27,7 +27,8 @@ var stdin_default = /* @__PURE__ */defineComponent({
27
27
  const userStore = useUserStore();
28
28
  const {
29
29
  router: routerConfig,
30
- slots: slotsConfig
30
+ slots: slotsConfig,
31
+ api: apiConfig
31
32
  } = useGlobalConfig();
32
33
  const UserMenu = defineTemplate(() => slotsConfig.userMenu?.());
33
34
  const toHome = () => {
@@ -62,7 +63,8 @@ var stdin_default = /* @__PURE__ */defineComponent({
62
63
  /* TEXT, CLASS */)]),
63
64
  _: 1
64
65
  /* STABLE */
65
- }), (openBlock(), createBlock(resolveDynamicComponent(unref(UserMenu)))), createVNode(_component_el_dropdown_item, {
66
+ }), (openBlock(), createBlock(resolveDynamicComponent(unref(UserMenu)))), unref(apiConfig).changePassword ? (openBlock(), createBlock(_component_el_dropdown_item, {
67
+ key: 0,
66
68
  onClick: toChangePassword
67
69
  }, {
68
70
  default: withCtx(() => [createVNode(unref(_Icon), {
@@ -74,7 +76,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
74
76
  /* TEXT, CLASS */)]),
75
77
  _: 1
76
78
  /* STABLE */
77
- }), createVNode(_component_el_dropdown_item, {
79
+ })) : createCommentVNode("v-if", true), createVNode(_component_el_dropdown_item, {
78
80
  divided: "",
79
81
  onClick: logout
80
82
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -45,7 +45,7 @@ function useRequest(config = {}) {
45
45
  Object.assign(config2, httpConfig.headers);
46
46
  const token = persist.get(TOKEN_NAME);
47
47
  if (token) {
48
- config2.headers.Authorization = httpConfig.authScheme ? `${httpConfig.authScheme} ${token}` : token;
48
+ config2.headers[httpConfig.authHeaderKey] = httpConfig.authScheme ? `${httpConfig.authScheme} ${token}` : token;
49
49
  }
50
50
  return config2;
51
51
  },