@zfqh/uniapp 0.1.7 → 0.1.9

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/docs/api/apis/core.md +23 -0
  3. package/docs/api/configs/index.md +1 -3
  4. package/docs/api/index.md +4 -8
  5. package/docs/api/mixins/webview.md +1 -1
  6. package/docs/api/modules/dict.md +1 -1
  7. package/docs/api/modules/im.md +5 -2
  8. package/docs/api/modules/index.md +2 -11
  9. package/docs/api/modules/login.md +4 -0
  10. package/docs/api/modules/system.md +3 -1
  11. package/docs/api/utils/consts.md +13 -14
  12. package/docs/guide/getting-started.md +1 -5
  13. package/docs/guide/project-frame.md +1 -5
  14. package/lib/apis/core.d.ts +2 -0
  15. package/lib/apis/core.js +2 -0
  16. package/lib/components/g-page-container/g-page-container.vue +2 -2
  17. package/lib/components/g-trtc-tui/g-trtc-tui.vue +2 -2
  18. package/lib/configs/app.d.ts +2 -5
  19. package/lib/configs/index.d.ts +1 -12
  20. package/lib/configs/index.js +0 -3
  21. package/lib/configs/ver.js +3 -3
  22. package/lib/mixins/webview.d.ts +0 -2
  23. package/lib/mixins/webview.js +8 -15
  24. package/lib/modules/dict.d.ts +1 -6
  25. package/lib/modules/dict.js +6 -5
  26. package/lib/modules/im.d.ts +1 -4
  27. package/lib/modules/im.js +8 -4
  28. package/lib/modules/index.d.ts +0 -1
  29. package/lib/modules/index.js +0 -1
  30. package/lib/modules/login.js +12 -0
  31. package/lib/modules/system.js +8 -35
  32. package/lib/styles/flex-nvue.scss +65 -0
  33. package/lib/styles/{flex.scss → flex-vue.scss} +0 -9
  34. package/lib/styles/index.scss +5 -3
  35. package/lib/styles/layout-nvue.scss +12 -0
  36. package/lib/styles/{layout.scss → layout-vue.scss} +0 -4
  37. package/lib/utils/consts.d.ts +1 -1
  38. package/lib/utils/consts.js +1 -2
  39. package/lib/utils/uni.js +1 -3
  40. package/lib/utils/update.js +1 -1
  41. package/package.json +2 -1
  42. package/docs/api/modules/app.md +0 -28
  43. package/lib/configs/brand.d.ts +0 -22
  44. package/lib/configs/brand.js +0 -26
  45. package/lib/modules/app.d.ts +0 -5
  46. package/lib/modules/app.js +0 -19
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.1.9](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.1.8...@zfqh/uniapp@0.1.9) (2026-06-21)
7
+
8
+ **Note:** Version bump only for package @zfqh/uniapp
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.1.8](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.1.7...@zfqh/uniapp@0.1.8) (2026-06-20)
15
+
16
+ **Note:** Version bump only for package @zfqh/uniapp
17
+
18
+
19
+
20
+
21
+
6
22
  ## [0.1.7](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.1.6...@zfqh/uniapp@0.1.7) (2026-06-19)
7
23
 
8
24
  **Note:** Version bump only for package @zfqh/uniapp
@@ -10,6 +10,7 @@
10
10
  | `getCosUrls` | `POST` | `/app-api/infra/cos/getUrls` | 获取 COS 签名后的地址。 |
11
11
  | `postRefreshToken` | `POST` | `/app-api/robot/store/auth/refreshToken?refreshToken=:refreshToken` | 刷新 token。 |
12
12
  | `getDictData` | `GET` | `/app-api/system/dict-data/type` | 获取字典数据。 |
13
+ | `getImData` | `GET` | `/admin-api/system/im/buildApiConfig` | 获取 IM 配置(usersig、sdkappid 等)。 |
13
14
 
14
15
  ## 基本使用
15
16
 
@@ -173,6 +174,28 @@ const options = data.map((item) => ({
173
174
  | --- | --- |
174
175
  | `Promise<ApiResponse<DictItem[]>>` | 成功时 `data` 为字典项数组,字段以当前后端返回为准。 |
175
176
 
177
+ ### getImData
178
+
179
+ 获取 IM 配置(usersig、sdkappid 等),`im` 模块的 `getImInfo` action 内部会调用。
180
+
181
+ ```ts
182
+ import { getImData } from '@zfqh/uniapp/lib/apis';
183
+
184
+ const { data } = await getImData({
185
+ username: 'user_001',
186
+ userType: 1,
187
+ });
188
+ ```
189
+
190
+ | 参数 | 类型 | 必填 | 说明 |
191
+ | --- | --- | --- | --- |
192
+ | `data.username` | `string` | 是 | 业务用户标识,后端据此查询对应的 IM 配置。 |
193
+ | `data.userType` | `number` | 否 | 用户类型,默认 `1`,按后端约定传值。 |
194
+
195
+ | 返回值 | 说明 |
196
+ | --- | --- |
197
+ | `Promise<ApiResponse<ImConfig>>` | 成功时 `data` 包含 `userId`、`usersig`、`sdkappid` 等字段。 |
198
+
176
199
  ## 返回值约定
177
200
 
178
201
  以上接口都基于 `GET`、`POST` 封装,成功时返回后端响应对象,常见结构如下:
@@ -7,7 +7,6 @@
7
7
  ```ts
8
8
  import { defineConfig, createPages } from '@zfqh/uniapp';
9
9
  import { app } from '@zfqh/uniapp/lib/configs/app';
10
- import { brand } from '@zfqh/uniapp/lib/configs/brand';
11
10
  // #ifdef H5
12
11
  import pages from 'virtual:remove-json-comments@/pages.json';
13
12
  // #endif
@@ -17,7 +16,6 @@ import pages from '@/pages.json';
17
16
 
18
17
  defineConfig({
19
18
  app: app.patient,
20
- brand: brand.zfqh,
21
19
  page: createPages(pages),
22
20
  path: {
23
21
  index: '/pages/index/index',
@@ -27,7 +25,7 @@ defineConfig({
27
25
  });
28
26
  ```
29
27
 
30
- `defineConfig` 会修改包内部单例配置,业务配置文件只要被入口导入执行即可生效。内置 `app`、`brand` 预设不从根入口导出,需要从 `@zfqh/uniapp/lib/configs/app`、`@zfqh/uniapp/lib/configs/brand` 深度引用。
28
+ `defineConfig` 会修改包内部单例配置,业务配置文件只要被入口导入执行即可生效。内置 `app` 预设不从根入口导出,需要从 `@zfqh/uniapp/lib/configs/app` 深度引用。
31
29
 
32
30
  ## defineEnvConfig
33
31
 
package/docs/api/index.md CHANGED
@@ -103,7 +103,6 @@ import {
103
103
 
104
104
  - `@zfqh/uniapp/lib/apis`
105
105
  - `@zfqh/uniapp/lib/configs/app` 的 `app.patient/app.doctor/app.merchant`
106
- - `@zfqh/uniapp/lib/configs/brand` 的 `brand.zfqh`
107
106
  - `@zfqh/uniapp/lib/modules`
108
107
  - `@zfqh/uniapp/lib/mixins`
109
108
  - `@zfqh/uniapp/lib/components`
@@ -125,15 +124,13 @@ import { GET, POST, getTencentToken } from '@zfqh/uniapp/lib/apis';
125
124
 
126
125
  ## 配置预设
127
126
 
128
- `app.patient`、`app.doctor`、`app.merchant` 和 `brand.zfqh` 属于配置预设,不从根入口导出。业务配置文件中请从配置目录深度引用:
127
+ `app.patient`、`app.doctor`、`app.merchant` 属于配置预设,不从根入口导出。业务配置文件中请从配置目录深度引用:
129
128
 
130
129
  ```ts
131
130
  import { app } from '@zfqh/uniapp/lib/configs/app';
132
- import { brand } from '@zfqh/uniapp/lib/configs/brand';
133
131
 
134
132
  defineConfig({
135
133
  app: app.patient,
136
- brand: brand.zfqh,
137
134
  });
138
135
  ```
139
136
 
@@ -218,18 +215,17 @@ export const getOrderList = (...args) => GET('/app-api/order/page', ...args);
218
215
  ## Modules
219
216
 
220
217
  ```ts
221
- import { app, dict, launch, login, network, system, im, location } from '@zfqh/uniapp/lib/modules';
218
+ import { dict, launch, login, network, system, im, location } from '@zfqh/uniapp/lib/modules';
222
219
  ```
223
220
 
224
221
  | 模块 | 说明 |
225
222
  | --- | --- |
226
- | `app` | 应用状态,初始包含 config.app 和 config.brand |
227
- | `dict` | 字典数据,需注入 `dict.request` |
223
+ | `dict` | 字典数据(内置接口,无需额外配置) |
228
224
  | `launch` | 启动参数(id、path、query、scene 等) |
229
225
  | `login` | 登录态(token、userId、tenantId 等) |
230
226
  | `network` | 网络状态(type、isConnected) |
231
227
  | `system` | 系统信息(窗口、设备、App 基础信息) |
232
- | `im` | IM 状态(userId、userSig、isReady),需注入 `im.request` |
228
+ | `im` | IM 状态(userId、usersigsdkappid、isReady),内置接口无需额外配置 |
233
229
  | `location` | 定位状态(name、address、longitude、latitude) |
234
230
 
235
231
  这些模块通常用于 Vuex store 注册,具体示例见 [模块](./modules/)。
@@ -5,7 +5,7 @@ webview 承载页 mixin。发布路径:`@zfqh/uniapp/lib/mixins/webview`
5
5
  | 项 | 说明 |
6
6
  | --- | --- |
7
7
  | `data shareData/params/url/changed/webview` | 维护承载页参数、URL 和分享状态。 |
8
- | `computed queryString` | 把登录信息、queryInfo、app/brand、platform 合并为 webview query。 |
8
+ | `computed queryString` | 把登录信息、app、platform 合并为 webview query。 |
9
9
  | `method onMessage(e)` | 处理 SAVE_IMAGE、CHNAGE_TITLE、SHARE_PAGE、GET_LOCATION、OPEN_LOCATION 等宿主消息。 |
10
10
  | `method postMessage(data)` | 向 iframe/App webview 子页面发送 WEBVIEW_MESSAGE。 |
11
11
  | `method initUrl()` | 根据 params.url、link、web 配置生成实际 webview src。 |
@@ -5,7 +5,7 @@
5
5
  | 项 | 说明 |
6
6
  | --- | --- |
7
7
  | `state.info` | 按字典 name 缓存 options、values、labels、enums。 |
8
- | `action getDictInfo({ name, cache })` | 调用模块 request 获取字典,cache 为 true 时已有缓存不重复请求。 |
8
+ | `action getDictInfo({ name, cache })` | 调用内置 `getDictData` 接口获取字典,cache 为 true 时已有缓存不重复请求。 |
9
9
  | `mutation setDictInfo(data)` | 合并字典数据。 |
10
10
 
11
11
  ## 基本使用
@@ -4,16 +4,19 @@ IM 状态模块。发布路径:`@zfqh/uniapp/lib/modules/im`
4
4
 
5
5
  | 项 | 说明 |
6
6
  | --- | --- |
7
- | `state.info` | 包含 userId、userSigappId、isLogin、isReady。 |
7
+ | `state.info` | 包含 userId、usersigsdkappid、isLogin、isReady。 |
8
8
  | `getter isImLogin/isImReady` | 返回 Promise,等待 IM 登录或 SDK ready。 |
9
9
  | `mutation setImInfo(data)` | 更新 IM 状态,并 resolve/reject 等待中的 Promise。 |
10
- | `action getImInfo()` | 调用模块 request 获取 IM 信息,账号变化时先触发 logoutIm 再 loginIm。 |
10
+ | `action getImInfo({ username, userType })` | 调用内置 `getImData` 接口获取 IM 信息,账号变化时先触发 logoutIm 再 loginIm。 |
11
11
 
12
12
  ## 基本使用
13
13
 
14
14
  患者端登录后可等待 IM 登录和 SDK ready,再初始化会话列表或视频通话监听。
15
15
 
16
16
  ```ts
17
+ // 拉取 IM 配置(需传 username、userType)
18
+ await store.dispatch('getImInfo', { username, userType: 1 });
19
+
17
20
  // 等待 IM 登录完成后再初始化聊天
18
21
  await store.getters.isImLogin;
19
22
  await store.getters.isImReady;
@@ -10,17 +10,10 @@
10
10
 
11
11
  ```ts
12
12
  import { createStore } from 'vuex';
13
- import { getDictData } from '@zfqh/uniapp/lib/apis';
14
13
  import { app, dict, im, system } from '@zfqh/uniapp/lib/modules';
15
14
  import login from './modules/login';
16
15
  import setting from './modules/setting';
17
16
 
18
- // 注入请求函数到 dict 模块
19
- dict.request = ({ name: type }) => getDictData({ type });
20
-
21
- // 注入请求函数到 im 模块(获取 IM userSig)
22
- im.request = () => getImUserInfo();
23
-
24
17
  const store = createStore({
25
18
  modules: {
26
19
  app,
@@ -37,8 +30,6 @@ export default store;
37
30
 
38
31
  关键点:
39
32
 
40
- - `dict.request` 必须在 `createStore` 之前赋值,它是 `getDictInfo` action 内部调用的数据获取函数。
41
- - `getDictData` 已内置在 `@zfqh/uniapp/lib/apis`,直接导入即可,无需业务自行封装。
42
- - `im` 模块同样有可注入的 `request` 属性,用于获取 IM userSig,模式与 `dict` 一致。
43
- - `app` 模块读取 `config.app` 和 `config.brand` 作为初始 state,适合存储应用级信息,无需额外配置。
33
+ - `dict` 模块已内置字典接口(`getDictData`),无需额外配置。
34
+ - `im` 模块已内置 `getImData` 接口,业务方调用 `dispatch('getImInfo', { username, userType })` 即可,无需额外配置。
44
35
  - `system` 模块无需额外配置,注册后即可通过 `store.state.system.info` 读取系统信息。
@@ -9,6 +9,7 @@
9
9
  | `mutation setLoginInfo(data)` | 去掉 accessToken 中 bearer 前缀后合并并缓存。 |
10
10
  | `mutation resetState()` | 重置登录信息并删除缓存。 |
11
11
  | `action logout(reLaunch)` | 节流退出;reLaunch 为 true 时重启到登录页,否则走 navigate 登录拦截。 |
12
+ | `action refreshToken()` | 使用 state 中的 refreshToken 调用接口刷新令牌;成功后更新 accessToken、refreshToken、expiresTime;静默失败不抛异常。 |
12
13
 
13
14
  ## 基本使用
14
15
 
@@ -32,4 +33,7 @@ const tenantId = store.state.login.info.tenantId;
32
33
 
33
34
  // 退出登录
34
35
  await store.dispatch('logout');
36
+
37
+ // 刷新登录 token
38
+ await store.dispatch('refreshToken');
35
39
  ```
@@ -4,7 +4,7 @@
4
4
 
5
5
  | 项 | 说明 |
6
6
  | --- | --- |
7
- | `state.info` | uni.getWindowInfo、getDeviceInfo、getAppBaseInfo 合并结果,并补充 deviceOrientation、titleHeight、topStatusBarHeight、topBarTitleHeight、uaEnv。 |
7
+ | `state.info` | uni.getWindowInfo 结果,并补充 deviceOrientation、titleHeight、topStatusBarHeight、topBarTitleHeight。 |
8
8
  | `action getSystemInfo()` | 调用 uni.getSystemInfo 刷新系统信息。 |
9
9
  | `mutation setSystemInfo(info)` | 合并系统信息。 |
10
10
 
@@ -27,3 +27,5 @@ await store.dispatch('getSystemInfo');
27
27
  const { safeAreaInsets, titleHeight, deviceOrientation } = store.state.system.info;
28
28
  console.log(safeAreaInsets.bottom, titleHeight, deviceOrientation);
29
29
  ```
30
+
31
+ > **提示**:设备信息(platform、brand 等)和应用信息(appName、appVersion 等)请从 `SYSTEM_INFO` 常量获取,参见 [consts](../utils/consts.md)。
@@ -27,7 +27,7 @@ import { MENU_BUTTON, SYSTEM_INFO, WEBVIEW_ENV, IS_WEBVIEW_ENV, PLATFORM_CODE, M
27
27
  | 名称 | 签名/声明 | 说明 |
28
28
  | --- | --- | --- |
29
29
  | `MENU_BUTTON` | `export const MENU_BUTTON = { height: 0, width: 0, top: 0, bottom: 0, left: 0 };` | 小程序胶囊按钮信息,来自 uni.getMenuButtonBoundingClientRect。 |
30
- | `SYSTEM_INFO` | `export const SYSTEM_INFO = system.state.info;` | 系统、窗口、设备、App 基础信息的合并结果。 |
30
+ | `SYSTEM_INFO` | `export const SYSTEM_INFO = Object.assign({}, uni.getWindowInfo(), uni.getDeviceInfo(), uni.getAppBaseInfo());` | 系统、窗口、设备、App 基础信息的合并结果。 |
31
31
  | `WEBVIEW_ENV` | `export const WEBVIEW_ENV = {` | H5/webview 容器环境识别结果,例如 h5、app、mp 等。 |
32
32
  | `IS_WEBVIEW_ENV` | `export const IS_WEBVIEW_ENV = Object.values(WEBVIEW_ENV).some((ele) => ele === true);` | 是否运行在 webview 容器内。 |
33
33
  | `PLATFORM_CODE` | `export const PLATFORM_CODE = (() => {` | 当前平台代码,用于 webview 参数和业务统计。 |
@@ -36,7 +36,9 @@ import { MENU_BUTTON, SYSTEM_INFO, WEBVIEW_ENV, IS_WEBVIEW_ENV, PLATFORM_CODE, M
36
36
 
37
37
  ## SYSTEM_INFO 属性详情
38
38
 
39
- `SYSTEM_INFO` 是 `uni.getWindowInfo()`、`uni.getDeviceInfo()`、`uni.getAppBaseInfo()` 的合并结果,并补充了计算属性。常用于自定义导航栏、响应式布局等平台适配场景。
39
+ `SYSTEM_INFO` 是 `uni.getWindowInfo()`、`uni.getDeviceInfo()`、`uni.getAppBaseInfo()` 的合并结果。常用于平台判断、应用信息获取和响应式布局等场景。
40
+
41
+ > **提示**:导航栏布局计算属性(`titleHeight`、`topStatusBarHeight`、`topBarTitleHeight`、`deviceOrientation`)已移至 system store,请通过 `store.state.system.info` 获取。
40
42
 
41
43
  ### 窗口信息(来自 `uni.getWindowInfo()`)
42
44
 
@@ -58,7 +60,6 @@ import { MENU_BUTTON, SYSTEM_INFO, WEBVIEW_ENV, IS_WEBVIEW_ENV, PLATFORM_CODE, M
58
60
  | `model` | `string` | 设备型号 |
59
61
  | `system` | `string` | 操作系统版本 |
60
62
  | `platform` | `string` | 客户端平台(`ios`、`android`、`devtools` 等) |
61
- | `deviceOrientation` | `string` | 设备方向(`portrait`、`landscape`) |
62
63
 
63
64
  ### 应用信息(来自 `uni.getAppBaseInfo()`)
64
65
 
@@ -70,18 +71,9 @@ import { MENU_BUTTON, SYSTEM_INFO, WEBVIEW_ENV, IS_WEBVIEW_ENV, PLATFORM_CODE, M
70
71
  | `appVersionCode` | `string` | 应用版本号 |
71
72
  | `appLanguage` | `string` | 应用语言 |
72
73
 
73
- ### 计算属性
74
-
75
- | 属性 | 类型 | 说明 |
76
- | --- | --- | --- |
77
- | `titleHeight` | `number` | 导航栏标题高度,默认 44(小程序端根据胶囊计算) |
78
- | `topStatusBarHeight` | `number` | 状态栏高度(与 `statusBarHeight` 相同) |
79
- | `topBarTitleHeight` | `number` | 状态栏 + 导航栏总高度 |
80
- | `uaEnv` | `object` | 仅 H5:`{ weixin, alipay, browser, devtools }` 环境识别结果 |
81
-
82
74
  ### 常用场景
83
75
 
84
- 自定义导航栏高度计算:
76
+ 获取平台和状态栏信息:
85
77
 
86
78
  ```ts
87
79
  import { SYSTEM_INFO } from '@zfqh/uniapp';
@@ -89,8 +81,15 @@ import { SYSTEM_INFO } from '@zfqh/uniapp';
89
81
  // 状态栏高度
90
82
  const statusBarHeight = SYSTEM_INFO.statusBarHeight;
91
83
 
84
+ // 平台判断
85
+ const isIOS = SYSTEM_INFO.platform === 'ios';
86
+ ```
87
+
88
+ 导航栏布局计算(通过 store):
89
+
90
+ ```ts
92
91
  // 导航栏总高度 = 状态栏 + 标题栏
93
- const navBarHeight = SYSTEM_INFO.topBarTitleHeight;
92
+ const navBarHeight = store.state.system.info.topBarTitleHeight;
94
93
  ```
95
94
 
96
95
  响应式布局判断:
@@ -79,7 +79,6 @@ Store 使用入口请按上下文区分:
79
79
  ```ts
80
80
  import { defineConfig, createPages } from '@zfqh/uniapp';
81
81
  import { app } from '@zfqh/uniapp/lib/configs/app';
82
- import { brand } from '@zfqh/uniapp/lib/configs/brand';
83
82
  // #ifdef H5
84
83
  import pages from 'virtual:remove-json-comments@/pages.json';
85
84
  // #endif
@@ -90,7 +89,6 @@ import { getTencentToken } from '@zfqh/uniapp/lib/apis';
90
89
 
91
90
  defineConfig({
92
91
  app: app.patient,
93
- brand: brand.zfqh,
94
92
  page: createPages(pages),
95
93
  path: {
96
94
  index: '/pages/index/index',
@@ -122,12 +120,10 @@ defineConfig({
122
120
  ```ts
123
121
  import { defineConfig } from '@zfqh/uniapp';
124
122
  import { app } from '@zfqh/uniapp/lib/configs/app';
125
- import { brand } from '@zfqh/uniapp/lib/configs/brand';
126
123
  import { getTencentToken } from '@zfqh/uniapp/lib/apis';
127
124
 
128
125
  defineConfig({
129
126
  app: app.merchant,
130
- brand: brand.zfqh,
131
127
  path: {
132
128
  index: '/pages/home/home',
133
129
  webview: '/pages/webview/webview',
@@ -157,7 +153,7 @@ defineConfig({
157
153
 
158
154
  关键点:
159
155
 
160
- - `app.patient`、`app.merchant`、`brand.zfqh` 是内置预设,位于深度路径 `@zfqh/uniapp/lib/configs/app` 和 `@zfqh/uniapp/lib/configs/brand`。
156
+ - `app.patient`、`app.merchant` 是内置预设,位于深度路径 `@zfqh/uniapp/lib/configs/app`。
161
157
  - `page: createPages(pages)` 会从 `pages.json` 生成 `pages`、`tabBarPages`、`nativePages`、`needLoginPages`、`notRedirectPages`。
162
158
  - 如项目暂不需要自动页面集合,也可以不配置 `page`,只配置 `path`,由业务自行维护登录拦截页面集合。
163
159
  - H5 端如果 `pages.json` 带注释,可通过 `virtual:remove-json-comments@/pages.json` 导入;其他端直接导入 `@/pages.json`。
@@ -65,7 +65,6 @@ import './config';
65
65
  ```ts
66
66
  import { defineConfig, createPages } from '@zfqh/uniapp';
67
67
  import { app } from '@zfqh/uniapp/lib/configs/app';
68
- import { brand } from '@zfqh/uniapp/lib/configs/brand';
69
68
  // #ifdef H5
70
69
  import pages from 'virtual:remove-json-comments@/pages.json';
71
70
  // #endif
@@ -76,7 +75,6 @@ import { getTencentToken } from '@zfqh/uniapp/lib/apis';
76
75
 
77
76
  defineConfig({
78
77
  app: app.patient,
79
- brand: brand.zfqh,
80
78
  page: createPages(pages),
81
79
  path: {
82
80
  index: '/pages/index/index',
@@ -108,12 +106,10 @@ defineConfig({
108
106
  ```ts
109
107
  import { defineConfig } from '@zfqh/uniapp';
110
108
  import { app } from '@zfqh/uniapp/lib/configs/app';
111
- import { brand } from '@zfqh/uniapp/lib/configs/brand';
112
109
  import { getTencentToken } from '@zfqh/uniapp/lib/apis';
113
110
 
114
111
  defineConfig({
115
112
  app: app.merchant,
116
- brand: brand.zfqh,
117
113
  path: {
118
114
  index: '/pages/home/home',
119
115
  webview: '/pages/webview/webview',
@@ -144,7 +140,7 @@ defineConfig({
144
140
  配置要点:
145
141
 
146
142
  - `defineConfig` 修改的是包内部单例配置,配置文件被导入执行即可生效。
147
- - `app`、`brand` 预设需要从 `@zfqh/uniapp/lib/configs/...` 深度引用。
143
+ - `app` 预设需要从 `@zfqh/uniapp/lib/configs/app` 深度引用。
148
144
  - 推荐用 `createPages(pages)` 从 `pages.json` 自动生成页面集合,减少手写 `needLoginPages`、`tabBarPages` 的维护成本。
149
145
  - `path.index`、`path.login`、`path.webview` 分别影响首页、登录拦截和 webview 承载页。
150
146
  - `upload.request` 需要把后端字段映射成 COS 上传工具需要的字段名。
@@ -10,3 +10,5 @@ export declare const getCosUrls: (...args: any[]) => any;
10
10
  export declare const postRefreshToken: (...args: any[]) => any;
11
11
  /** 获取字典数据 */
12
12
  export declare const getDictData: (...args: any[]) => any;
13
+ /** 获取 IM 配置(IM userSig、SDKAppID 等) */
14
+ export declare const getImData: (...args: any[]) => any;
package/lib/apis/core.js CHANGED
@@ -11,3 +11,5 @@ export const getCosUrls = (...args) => POST('/app-api/infra/cos/getUrls', ...arg
11
11
  export const postRefreshToken = (...args) => POST('/app-api/robot/store/auth/refreshToken?refreshToken=:refreshToken', ...args);
12
12
  /** 获取字典数据 */
13
13
  export const getDictData = (...args) => GET('/app-api/system/dict-data/type', ...args);
14
+ /** 获取 IM 配置(IM userSig、SDKAppID 等) */
15
+ export const getImData = (...args) => GET('/admin-api/system/im/buildApiConfig', ...args);
@@ -64,7 +64,7 @@
64
64
  </template>
65
65
 
66
66
  <script>
67
- import system from '../../modules/system';
67
+ import { SYSTEM_INFO } from '../../utils/consts';
68
68
  import color from '../../configs/color';
69
69
 
70
70
  export default {
@@ -232,7 +232,7 @@ export default {
232
232
  scrollTop: 0,
233
233
  pulling: false,
234
234
  headerRect: {
235
- height: this.showHeader ? system.state.info.topBarTitleHeight : 0,
235
+ height: this.showHeader ? SYSTEM_INFO.topBarTitleHeight : 0,
236
236
  },
237
237
  };
238
238
  },
@@ -7,9 +7,9 @@
7
7
  :avatar="profile.avatar"
8
8
  :description="profile.description"
9
9
  :roomId="roomId"
10
- :appId="imInfo.appId"
10
+ :appId="imInfo.sdkappid"
11
11
  :userId="imInfo.userId"
12
- :userSig="imInfo.userSig"
12
+ :userSig="imInfo.usersig"
13
13
  :callType="callType"
14
14
  @zoom="zoom"
15
15
  @hangup="hangup"
@@ -13,13 +13,10 @@ declare const $app: {
13
13
  /** 小程序应用原始ID */
14
14
  weappOrigId: string;
15
15
  /** 应用渠道标识 */
16
- channel: number;
16
+ channel: number | string;
17
17
  };
18
18
  type App = typeof $app;
19
- type Keys = keyof App;
20
- export type AppConfig = {
21
- [key in Keys]?: string;
22
- };
19
+ export type AppConfig = Partial<App>;
23
20
  export declare const app: {
24
21
  [key in 'patient' | 'doctor' | 'merchant']: App;
25
22
  };
@@ -1,7 +1,6 @@
1
1
  import { ColorConfig } from './color';
2
2
  import { VerConfig } from './ver';
3
3
  import { AppConfig } from './app';
4
- import { BrandConfig } from './brand';
5
4
  import { TabbarConfig } from './tabbar';
6
5
  import { PathConfig } from './path';
7
6
  import { PageConfig } from './page';
@@ -15,8 +14,6 @@ import { StorageConfig } from './storage';
15
14
  export interface DefineBaseConfig {
16
15
  /** 应用配置 */
17
16
  app?: AppConfig;
18
- /** 品牌配置 */
19
- brand?: BrandConfig;
20
17
  /** 颜色配置 */
21
18
  color?: ColorConfig;
22
19
  /** tabbar配置 */
@@ -107,15 +104,7 @@ declare const conf: {
107
104
  appId: string;
108
105
  weappId: string;
109
106
  weappOrigId: string;
110
- channel: number;
111
- };
112
- /** 品牌配置 */
113
- brand: {
114
- code: string;
115
- name: string;
116
- telephone: string;
117
- company: string;
118
- primary: string;
107
+ channel: number | string;
119
108
  };
120
109
  /** tabbar配置 */
121
110
  tabbar: {
@@ -6,7 +6,6 @@ import api from './api';
6
6
  import cdn from './cdn';
7
7
  import ver from './ver';
8
8
  import app from './app';
9
- import brand from './brand';
10
9
  import tabbar from './tabbar';
11
10
  import path from './path';
12
11
  import page from './page';
@@ -34,8 +33,6 @@ const conf = {
34
33
  mp,
35
34
  /** 应用配置 */
36
35
  app,
37
- /** 品牌配置 */
38
- brand,
39
36
  /** tabbar配置 */
40
37
  tabbar,
41
38
  /** 路径配置 */
@@ -1,6 +1,6 @@
1
1
  import { reactive } from 'vue';
2
2
  // #ifndef APP-PLUS
3
- import system from '../modules/system';
3
+ import { SYSTEM_INFO } from '../utils/consts';
4
4
  // #endif
5
5
  /** 版本配置 */
6
6
  const ver = reactive({
@@ -22,7 +22,7 @@ plus.runtime.getProperty(plus.runtime.appid, (e) => {
22
22
  });
23
23
  // #endif
24
24
  // #ifndef APP-PLUS
25
- ver.code = Number(system.state.info.appVersionCode);
26
- ver.name = system.state.info.appVersion;
25
+ ver.code = Number(SYSTEM_INFO.appVersionCode);
26
+ ver.name = SYSTEM_INFO.appVersion;
27
27
  // #endif
28
28
  export default ver;
@@ -8,8 +8,6 @@ declare const _default: {
8
8
  };
9
9
  computed: {
10
10
  loginInfo(): any;
11
- queryInfo(): any;
12
- appInfo(): any;
13
11
  queryString(): string;
14
12
  };
15
13
  watch: {
@@ -1,13 +1,14 @@
1
1
  import Url from 'url-parse';
2
2
  import { stringify } from 'qs';
3
3
  import { TYPES } from '../utils/message';
4
- import system from '../modules/system';
5
- import { PLATFORM_CODE, IS_WEBVIEW_ENV } from '../utils/consts';
4
+ import { PLATFORM_CODE, IS_WEBVIEW_ENV, SYSTEM_INFO } from '../utils/consts';
5
+ import app from '../configs/app';
6
6
  import { requestPermission } from '../utils/permit';
7
7
  import web from '../configs/web';
8
8
  import link from '../configs/link';
9
9
  import path from '../configs/path';
10
10
  import { base64ToPath } from '../utils/file';
11
+ import query from '../utils/query';
11
12
  export default {
12
13
  data() {
13
14
  return {
@@ -22,19 +23,11 @@ export default {
22
23
  loginInfo() {
23
24
  return this.$store.state.login?.info || {};
24
25
  },
25
- queryInfo() {
26
- return this.$store.state.query?.info || {};
27
- },
28
- appInfo() {
29
- return this.$store.state.app?.info || {};
30
- },
31
26
  queryString() {
32
- const { loginInfo, queryInfo, appInfo } = this;
33
- const query = {
34
- ...queryInfo,
27
+ const { loginInfo } = this;
28
+ const q = {
35
29
  token: loginInfo.accessToken || '',
36
- brand: appInfo.brand?.code || '',
37
- app: appInfo.app?.code || '',
30
+ app: app.code,
38
31
  platform: PLATFORM_CODE,
39
32
  };
40
33
  if (query.primary) {
@@ -42,7 +35,7 @@ export default {
42
35
  query.primary = encodeURIComponent(query.primary);
43
36
  }
44
37
  }
45
- return stringify(query, { encode: false });
38
+ return stringify(q, { encode: false });
46
39
  },
47
40
  },
48
41
  watch: {
@@ -158,7 +151,7 @@ export default {
158
151
  let url = _url;
159
152
  let title = rest.title;
160
153
  let src = '';
161
- const queryString = `?${stringify({ _: Date.now(), safeBottom: system.state.info.safeAreaInsets.bottom, ...rest }, { encode: false })}&${this.queryString}`;
154
+ const queryString = `?${stringify({ _: Date.now(), safeBottom: SYSTEM_INFO.safeAreaInsets.bottom, ...rest }, { encode: false })}&${this.queryString}`;
162
155
  if (_app && web[_app]) {
163
156
  const sep = /\.html$/i.test(web[_app]) ? '' : '/';
164
157
  src = `${web[_app]}${sep}${queryString}#${url}`;
@@ -1,8 +1,3 @@
1
1
  import type { StoreOptions } from 'vuex';
2
- interface VuexStoreOptions extends StoreOptions<any> {
3
- request?: (params: {
4
- name: string;
5
- }) => Promise<any>;
6
- }
7
- declare const store: VuexStoreOptions;
2
+ declare const store: StoreOptions<any>;
8
3
  export default store;
@@ -1,3 +1,4 @@
1
+ import { getDictData } from '../apis/core';
1
2
  function getDefaultState() {
2
3
  return {
3
4
  info: {},
@@ -11,15 +12,15 @@ const store = {
11
12
  },
12
13
  },
13
14
  actions: {
14
- async getDictInfo({ commit, state }, options = {}) {
15
+ async getDictInfo({ commit, state }, params = {}) {
15
16
  try {
16
- const { name, cache } = options;
17
+ const { name, cache } = params;
17
18
  if (name && (!cache || (cache && !state.info[name]))) {
18
- const e = await store.request({ name });
19
+ const e = await getDictData({ type: name });
19
20
  const enums = {};
20
21
  const values = [];
21
22
  const labels = [];
22
- const options = e.data.map(({ label, value }) => {
23
+ const items = e.data.map(({ label, value }) => {
23
24
  values.push(value);
24
25
  labels.push(label);
25
26
  enums[label] = value;
@@ -28,7 +29,7 @@ const store = {
28
29
  });
29
30
  commit('setDictInfo', {
30
31
  [name]: {
31
- options,
32
+ options: items,
32
33
  values,
33
34
  labels,
34
35
  enums,
@@ -1,6 +1,3 @@
1
1
  import type { StoreOptions } from 'vuex';
2
- interface VuexStoreOptions extends StoreOptions<any> {
3
- request?: () => Promise<any>;
4
- }
5
- declare const store: VuexStoreOptions;
2
+ declare const store: StoreOptions<any>;
6
3
  export default store;
package/lib/modules/im.js CHANGED
@@ -1,9 +1,10 @@
1
+ import { getImData } from '../apis/core';
1
2
  function getDefaultState() {
2
3
  return {
3
4
  info: {
4
5
  userId: '',
5
- userSig: '',
6
- appId: 0,
6
+ usersig: '',
7
+ sdkappid: 0,
7
8
  isLogin: false,
8
9
  isReady: false,
9
10
  },
@@ -79,9 +80,12 @@ const store = {
79
80
  },
80
81
  },
81
82
  actions: {
82
- async getImInfo({ commit, state }) {
83
+ async getImInfo({ commit, state }, params = {}) {
83
84
  try {
84
- const { data } = await store.request();
85
+ const { username, userType = 1 } = params;
86
+ if (!username)
87
+ return;
88
+ const { data } = await getImData({ username, userType });
85
89
  // 防止登录其他账号,IM信息不变,先退出之前账号
86
90
  if (state.info.isLogin === true && state.info.userId !== data.userId) {
87
91
  uni.$emit('logoutIm');
@@ -1,4 +1,3 @@
1
- export { default as app } from './app';
2
1
  export { default as dict } from './dict';
3
2
  export { default as launch } from './launch';
4
3
  export { default as login } from './login';
@@ -1,4 +1,3 @@
1
- export { default as app } from './app';
2
1
  export { default as dict } from './dict';
3
2
  export { default as launch } from './launch';
4
3
  export { default as login } from './login';
@@ -3,6 +3,7 @@ import query from '../utils/query';
3
3
  import navigate from '../utils/navigate';
4
4
  import Throttle from '../utils/throttle';
5
5
  import { getPage } from '../utils/pages';
6
+ import { postRefreshToken } from '../apis/core';
6
7
  const throttle = new Throttle();
7
8
  // #ifdef H5
8
9
  const queryToken = query.accessToken || query.token;
@@ -68,6 +69,17 @@ const store = {
68
69
  }
69
70
  });
70
71
  },
72
+ async refreshToken({ state, commit }) {
73
+ const refreshToken = state.info.refreshToken;
74
+ if (!refreshToken)
75
+ return;
76
+ try {
77
+ const { data } = await postRefreshToken({ refreshToken });
78
+ const { refreshToken: newRefreshToken, accessToken, expiresTime } = data || {};
79
+ commit('setLoginInfo', { accessToken, refreshToken: newRefreshToken, expiresTime });
80
+ }
81
+ catch (e) { }
82
+ },
71
83
  },
72
84
  };
73
85
  export default store;
@@ -1,42 +1,25 @@
1
- function getInfo(info, extra = {}) {
1
+ import { MENU_BUTTON } from '../utils/consts';
2
+ function getInfo() {
3
+ const info = uni.getWindowInfo();
2
4
  let titleHeight = 44;
3
5
  let topStatusBarHeight = info.statusBarHeight;
4
6
  let topBarTitleHeight = 0;
5
7
  // #ifdef MP
6
- const { height, top } = uni.getMenuButtonBoundingClientRect();
8
+ const { height, top } = MENU_BUTTON;
7
9
  titleHeight = height + 16;
8
10
  topStatusBarHeight = top - 8;
9
11
  // #endif
10
12
  topBarTitleHeight = topStatusBarHeight + titleHeight;
11
- return Object.assign({}, info, extra, {
13
+ return Object.assign({}, info, {
12
14
  deviceOrientation: info.windowWidth > info.windowHeight ? 'landscape' : 'portrait',
13
15
  titleHeight,
14
16
  topStatusBarHeight,
15
17
  topBarTitleHeight,
16
18
  });
17
19
  }
18
- function getSystemInfo() {
19
- return Object.assign({}, uni.getWindowInfo(), uni.getDeviceInfo(), uni.getAppBaseInfo());
20
- }
21
- const systemInfo = getSystemInfo();
22
- const uaEnv = {};
23
- // #ifdef H5
24
- const { ua = '' } = systemInfo;
25
- if (/micromessenger/i.test(ua)) {
26
- uaEnv.weixin = true;
27
- uaEnv.devtools = /wechatdevtools/i.test(ua);
28
- }
29
- else if (/alipayclient/i.test(ua)) {
30
- uaEnv.alipay = true;
31
- uaEnv.devtools = /alipaydevtools/i.test(ua);
32
- }
33
- else {
34
- uaEnv.browser = true;
35
- }
36
- // #endif
37
20
  function getDefaultState() {
38
21
  return {
39
- info: getInfo(systemInfo, { uaEnv }),
22
+ info: getInfo(),
40
23
  };
41
24
  }
42
25
  const store = {
@@ -47,18 +30,8 @@ const store = {
47
30
  },
48
31
  },
49
32
  actions: {
50
- getSystemInfo({ commit }) {
51
- return new Promise((res) => {
52
- uni.getSystemInfo({
53
- success(e) {
54
- commit('setSystemInfo', getInfo(e));
55
- res();
56
- },
57
- fail() {
58
- res();
59
- },
60
- });
61
- });
33
+ async getSystemInfo({ commit }) {
34
+ commit('setSystemInfo', getInfo());
62
35
  },
63
36
  },
64
37
  };
@@ -0,0 +1,65 @@
1
+ .flex {
2
+ flex-direction: row;
3
+ }
4
+ .flex-inline {
5
+ flex-direction: row;
6
+ }
7
+ .flex-row {
8
+ flex-direction: row;
9
+ }
10
+ .flex-row-reverse {
11
+ flex-direction: row-reverse;
12
+ }
13
+ .flex-col {
14
+ flex-direction: column;
15
+ }
16
+ .flex-col-reverse {
17
+ flex-direction: column-reverse;
18
+ }
19
+ .flex-wrap {
20
+ flex-wrap: wrap;
21
+ }
22
+ .flex-nowrap {
23
+ flex-wrap: nowrap;
24
+ }
25
+ .flex-wrap-reverse {
26
+ flex-wrap: wrap-reverse;
27
+ }
28
+ @for $n from 0 through 8 {
29
+ .flex-#{$n} {
30
+ flex: $n;
31
+ }
32
+ }
33
+ .flex-none {
34
+ flex: 0;
35
+ }
36
+ .items-start {
37
+ align-items: flex-start;
38
+ }
39
+ .items-end {
40
+ align-items: flex-end;
41
+ }
42
+ .items-center {
43
+ align-items: center;
44
+ }
45
+ .items-stretch {
46
+ align-items: stretch;
47
+ }
48
+ .items-baseline {
49
+ align-items: baseline;
50
+ }
51
+ .justify-start {
52
+ justify-content: flex-start;
53
+ }
54
+ .justify-end {
55
+ justify-content: flex-end;
56
+ }
57
+ .justify-center {
58
+ justify-content: center;
59
+ }
60
+ .justify-between {
61
+ justify-content: space-between;
62
+ }
63
+ .justify-around {
64
+ justify-content: space-around;
65
+ }
@@ -1,16 +1,10 @@
1
- /* #ifdef H5 */
2
1
  page {
3
- /* #endif */
4
2
  .flex {
5
- /* #ifndef APP-NVUE */
6
3
  display: flex;
7
- /* #endif */
8
4
  flex-direction: row;
9
5
  }
10
6
  .flex-inline {
11
- /* #ifndef APP-NVUE */
12
7
  display: inline-flex;
13
- /* #endif */
14
8
  flex-direction: row;
15
9
  }
16
10
  .flex-row {
@@ -72,7 +66,4 @@ page {
72
66
  .justify-around {
73
67
  justify-content: space-around;
74
68
  }
75
- /* #ifdef H5 */
76
69
  }
77
- /* #endif */
78
-
@@ -2,12 +2,14 @@
2
2
  @import './border.scss';
3
3
  @import './bg.scss';
4
4
  @import './text.scss';
5
- @import './layout.scss';
6
- @import './flex.scss';
7
5
  /* #ifndef APP-NVUE */
8
6
  @import './reset-vue.scss';
9
7
  @import './text-vue.scss';
8
+ @import './layout-vue.scss';
9
+ @import './flex-vue.scss';
10
10
  /* #endif */
11
11
  /* #ifdef APP-NVUE */
12
- @import './text-nvue.scss';
12
+ @import './text-nvue.scss';
13
+ @import './layout-nvue.scss';
14
+ @import './flex-nvue.scss';
13
15
  /* #endif */
@@ -0,0 +1,12 @@
1
+ .relative {
2
+ position: relative;
3
+ }
4
+ .absolute {
5
+ position: absolute;
6
+ }
7
+ .fixed {
8
+ position: fixed;
9
+ }
10
+ .sticky {
11
+ position: sticky;
12
+ }
@@ -1,6 +1,4 @@
1
- /* #ifdef H5 */
2
1
  page {
3
- /* #endif */
4
2
  .relative {
5
3
  position: relative;
6
4
  }
@@ -13,6 +11,4 @@ page {
13
11
  .sticky {
14
12
  position: sticky;
15
13
  }
16
- /* #ifdef H5 */
17
14
  }
18
- /* #endif */
@@ -8,7 +8,7 @@ export declare const MENU_BUTTON: {
8
8
  bottom: number;
9
9
  left: number;
10
10
  };
11
- export declare const SYSTEM_INFO: any;
11
+ export declare const SYSTEM_INFO: UniApp.GetWindowInfoResult & UniApp.GetDeviceInfoResult & UniApp.GetAppBaseInfoResult;
12
12
  export declare const WEBVIEW_ENV: {
13
13
  h5: boolean;
14
14
  app: boolean;
@@ -1,14 +1,13 @@
1
1
  /**
2
2
  * 公共常量
3
3
  */
4
- import system from '../modules/system';
5
4
  import query from './query';
6
5
  // 小程序胶囊
7
6
  export const MENU_BUTTON = { height: 0, width: 0, top: 0, bottom: 0, left: 0 };
8
7
  // #ifdef MP
9
8
  Object.assign(MENU_BUTTON, uni.getMenuButtonBoundingClientRect());
10
9
  // #endif
11
- export const SYSTEM_INFO = system.state.info;
10
+ export const SYSTEM_INFO = Object.assign({}, uni.getWindowInfo(), uni.getDeviceInfo(), uni.getAppBaseInfo());
12
11
  // webview宿主环境
13
12
  export const WEBVIEW_ENV = {
14
13
  h5: false,
package/lib/utils/uni.js CHANGED
@@ -2,7 +2,6 @@
2
2
  import { colorGradient } from '@gmcb/uv-ui/libs/function/colorGradient';
3
3
  // #endif
4
4
  import { app } from '../configs/app';
5
- import { brand } from '../configs/brand';
6
5
  import mp from '../configs/mp';
7
6
  import color from '../configs/color';
8
7
  import { IS_WEBVIEW_ENV, SYSTEM_INFO } from './consts';
@@ -121,8 +120,7 @@ if (query) {
121
120
  }
122
121
  // 更新主题色
123
122
  const primary = String(query.primary ? `#${query.primary}`.replace(/^#+/, '#') : '') ||
124
- app[query.app]?.primary ||
125
- brand[query.brand]?.primary;
123
+ app[query.app]?.primary;
126
124
  if (primary) {
127
125
  const colors = colorGradient(primary, '#fff', 10);
128
126
  document.documentElement.style.setProperty('--primary', (color.primary = colors[0]));
@@ -226,7 +226,7 @@ function fileDownload(url, restart = true) {
226
226
  }
227
227
  async function checkUpdate(immediate = false) {
228
228
  return new Promise((resolve, reject) => {
229
- const { platform, appName, appId, appVersion: versionName, versionCode } = SYSTEM_INFO;
229
+ const { platform, appName, appId, appVersion: versionName, appVersionCode: versionCode } = SYSTEM_INFO;
230
230
  const params = {
231
231
  appId: app.appId || appId,
232
232
  appName: app.name || appName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zfqh/uniapp",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "uniapp公共模块",
5
5
  "author": "yinjiazeng@163.com",
6
6
  "license": "MIT",
@@ -32,6 +32,7 @@
32
32
  "@tencentcloud/tui-core": "^2.3.2",
33
33
  "crypto-js": "^4.2.0",
34
34
  "html2canvas": "^1.4.1",
35
+ "pinia": "2.1.7",
35
36
  "qs": "^6.13.0",
36
37
  "trtc-wx-sdk": "^1.1.12",
37
38
  "url-parse": "^1.5.10",
@@ -1,28 +0,0 @@
1
- # app
2
-
3
- 应用信息模块。发布路径:`@zfqh/uniapp/lib/modules/app`
4
-
5
- | 项 | 说明 |
6
- | --- | --- |
7
- | `state.info` | 默认包含 config.app 和 config.brand。 |
8
- | `mutation setAppInfo(data)` | 合并更新应用信息。 |
9
-
10
- ## 基本使用
11
-
12
- 在业务 Vuex store 中注册模块后,页面可读取当前应用和品牌信息。
13
-
14
- ```ts
15
- import { createStore } from 'vuex';
16
- import { app } from '@zfqh/uniapp/lib/modules';
17
-
18
- const store = createStore({
19
- modules: {
20
- app,
21
- },
22
- });
23
- ```
24
-
25
- ```ts
26
- const appInfo = store.state.app.info.app;
27
- const brandInfo = store.state.app.info.brand;
28
- ```
@@ -1,22 +0,0 @@
1
- /** 品牌配置 */
2
- declare const $brand: {
3
- /** 品牌标识 */
4
- code: string;
5
- /** 品牌名称 */
6
- name: string;
7
- /** 企业联系电话 */
8
- telephone: string;
9
- /** 所属企业 */
10
- company: string;
11
- /** 品牌主题色 */
12
- primary: string;
13
- };
14
- type Brand = typeof $brand;
15
- type Keys = keyof Brand;
16
- export type BrandConfig = {
17
- [key in Keys]?: string;
18
- };
19
- export declare const brand: {
20
- [key in 'zfqh']: Brand;
21
- };
22
- export default $brand;
@@ -1,26 +0,0 @@
1
- /** 品牌配置 */
2
- const $brand = {
3
- /** 品牌标识 */
4
- code: '',
5
- /** 品牌名称 */
6
- name: '',
7
- /** 企业联系电话 */
8
- telephone: '',
9
- /** 所属企业 */
10
- company: '',
11
- /** 品牌主题色 */
12
- primary: '',
13
- };
14
- export const brand = {
15
- zfqh: {
16
- code: '',
17
- name: '智赋岐黄',
18
- telephone: '',
19
- company: '天津智赋岐黄医疗科技有限公司',
20
- primary: '#00B4C3',
21
- },
22
- };
23
- Object.keys(brand).forEach((code) => {
24
- Object.assign(brand[code], { code });
25
- });
26
- export default $brand;
@@ -1,5 +0,0 @@
1
- import type { StoreOptions } from 'vuex';
2
- interface VuexStoreOptions extends StoreOptions<any> {
3
- }
4
- declare const store: VuexStoreOptions;
5
- export default store;
@@ -1,19 +0,0 @@
1
- import config from '../configs';
2
- function getDefaultState() {
3
- const appInfo = { app: config.app, brand: config.brand };
4
- return {
5
- info: appInfo,
6
- };
7
- }
8
- const store = {
9
- state: getDefaultState(),
10
- mutations: {
11
- setAppInfo(state, data) {
12
- state.info = {
13
- ...state.info,
14
- ...data,
15
- };
16
- },
17
- },
18
- };
19
- export default store;