@zfqh/uniapp 0.1.1
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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +39 -0
- package/docs/api/apis/core.md +189 -0
- package/docs/api/apis/index.md +82 -0
- package/docs/api/apis/request.md +369 -0
- package/docs/api/configs/api.md +32 -0
- package/docs/api/configs/app.md +43 -0
- package/docs/api/configs/brand.md +43 -0
- package/docs/api/configs/cdn.md +35 -0
- package/docs/api/configs/color.md +144 -0
- package/docs/api/configs/env.md +120 -0
- package/docs/api/configs/index.md +394 -0
- package/docs/api/configs/link.md +33 -0
- package/docs/api/configs/log.md +27 -0
- package/docs/api/configs/mp.md +34 -0
- package/docs/api/configs/navigate.md +27 -0
- package/docs/api/configs/page.md +32 -0
- package/docs/api/configs/path.md +27 -0
- package/docs/api/configs/storage.md +24 -0
- package/docs/api/configs/tabbar.md +29 -0
- package/docs/api/configs/toast.md +35 -0
- package/docs/api/configs/update.md +25 -0
- package/docs/api/configs/upload.md +45 -0
- package/docs/api/configs/ver.md +32 -0
- package/docs/api/configs/web.md +28 -0
- package/docs/api/hooks/index.md +182 -0
- package/docs/api/hooks/useI18n.md +27 -0
- package/docs/api/hooks/useOverlay.md +37 -0
- package/docs/api/hooks/usePopup.md +35 -0
- package/docs/api/hooks/useVersion.md +23 -0
- package/docs/api/index.md +269 -0
- package/docs/api/mixins/app.md +29 -0
- package/docs/api/mixins/badge.md +23 -0
- package/docs/api/mixins/debounce.md +32 -0
- package/docs/api/mixins/deep.md +29 -0
- package/docs/api/mixins/index.md +23 -0
- package/docs/api/mixins/login.md +22 -0
- package/docs/api/mixins/model.md +26 -0
- package/docs/api/mixins/redirect.md +26 -0
- package/docs/api/mixins/share.md +29 -0
- package/docs/api/mixins/show.md +27 -0
- package/docs/api/mixins/webview.md +27 -0
- package/docs/api/modules/app.md +30 -0
- package/docs/api/modules/dict.md +28 -0
- package/docs/api/modules/im.md +22 -0
- package/docs/api/modules/index.md +44 -0
- package/docs/api/modules/launch.md +26 -0
- package/docs/api/modules/location.md +25 -0
- package/docs/api/modules/login.md +35 -0
- package/docs/api/modules/network.md +26 -0
- package/docs/api/modules/system.md +29 -0
- package/docs/api/utils/audio.md +84 -0
- package/docs/api/utils/consts.md +201 -0
- package/docs/api/utils/cos.md +269 -0
- package/docs/api/utils/debounce.md +89 -0
- package/docs/api/utils/file.md +78 -0
- package/docs/api/utils/index.md +547 -0
- package/docs/api/utils/locale.md +32 -0
- package/docs/api/utils/message.md +81 -0
- package/docs/api/utils/navigate.md +267 -0
- package/docs/api/utils/pages.md +205 -0
- package/docs/api/utils/permission.md +28 -0
- package/docs/api/utils/permit.md +62 -0
- package/docs/api/utils/query.md +89 -0
- package/docs/api/utils/request.md +34 -0
- package/docs/api/utils/storage.md +145 -0
- package/docs/api/utils/subscribe.md +77 -0
- package/docs/api/utils/throttle.md +101 -0
- package/docs/api/utils/toast.md +164 -0
- package/docs/api/utils/uni.md +28 -0
- package/docs/api/utils/update.md +165 -0
- package/docs/components/g-back-button.md +76 -0
- package/docs/components/g-checkbox-list.md +101 -0
- package/docs/components/g-container.md +93 -0
- package/docs/components/g-data-list.md +106 -0
- package/docs/components/g-dot-text.md +79 -0
- package/docs/components/g-env.md +75 -0
- package/docs/components/g-float.md +83 -0
- package/docs/components/g-grid-image.md +91 -0
- package/docs/components/g-grid-swiper.md +99 -0
- package/docs/components/g-icon.md +106 -0
- package/docs/components/g-mask.md +82 -0
- package/docs/components/g-money.md +90 -0
- package/docs/components/g-more.md +78 -0
- package/docs/components/g-page-container.md +170 -0
- package/docs/components/g-permission-popup.md +117 -0
- package/docs/components/g-polyline-chat.md +102 -0
- package/docs/components/g-polyline-view.md +67 -0
- package/docs/components/g-popup.md +144 -0
- package/docs/components/g-refresh-view.md +118 -0
- package/docs/components/g-render-image.md +83 -0
- package/docs/components/g-search.md +120 -0
- package/docs/components/g-share-photo.md +77 -0
- package/docs/components/g-share-view.md +83 -0
- package/docs/components/g-share-weixin.md +81 -0
- package/docs/components/g-skeleton-view.md +71 -0
- package/docs/components/g-skeleton.md +64 -0
- package/docs/components/g-tag-editor.md +134 -0
- package/docs/components/g-timer.md +72 -0
- package/docs/components/g-trtc-room.md +116 -0
- package/docs/components/g-trtc-tui.md +84 -0
- package/docs/components/g-trtc.md +124 -0
- package/docs/components/g-upload.md +117 -0
- package/docs/components/g-waterfall.md +84 -0
- package/docs/components/index.md +109 -0
- package/docs/components/styles/base-styles.md +367 -0
- package/docs/components/styles/global-vars.md +150 -0
- package/docs/components/usage.md +112 -0
- package/docs/faq/index.md +78 -0
- package/docs/guide/getting-started.md +195 -0
- package/docs/guide/project-frame.md +297 -0
- package/docs/index.md +80 -0
- package/lib/apis/core.d.ts +12 -0
- package/lib/apis/core.js +13 -0
- package/lib/apis/index.d.ts +2 -0
- package/lib/apis/index.js +2 -0
- package/lib/apis/request.d.ts +4 -0
- package/lib/apis/request.js +27 -0
- package/lib/components/g-back-button/g-back-button.vue +141 -0
- package/lib/components/g-checkbox-list/g-checkbox-list.vue +156 -0
- package/lib/components/g-container/g-container.vue +159 -0
- package/lib/components/g-data-list/g-data-list.vue +192 -0
- package/lib/components/g-dot-text/g-dot-text.vue +114 -0
- package/lib/components/g-env/g-env.vue +123 -0
- package/lib/components/g-float/g-float.vue +131 -0
- package/lib/components/g-grid-image/g-grid-image.vue +84 -0
- package/lib/components/g-grid-swiper/g-grid-swiper.vue +224 -0
- package/lib/components/g-icon/g-icon.vue +72 -0
- package/lib/components/g-mask/g-mask.vue +126 -0
- package/lib/components/g-money/g-money.vue +174 -0
- package/lib/components/g-more/g-more.vue +68 -0
- package/lib/components/g-page-container/g-page-container.vue +470 -0
- package/lib/components/g-permission-popup/g-permission-popup.vue +80 -0
- package/lib/components/g-polyline-chat/g-polyline-chat.vue +255 -0
- package/lib/components/g-polyline-view/g-polyline-view.vue +104 -0
- package/lib/components/g-popup/g-popup.vue +449 -0
- package/lib/components/g-refresh-view/g-refresh-view.vue +213 -0
- package/lib/components/g-render-image/g-render-image.vue +222 -0
- package/lib/components/g-search/g-search.vue +274 -0
- package/lib/components/g-share-photo/g-share-photo.vue +75 -0
- package/lib/components/g-share-view/g-share-view.vue +157 -0
- package/lib/components/g-share-weixin/g-share-weixin.vue +106 -0
- package/lib/components/g-skeleton/g-skeleton.vue +55 -0
- package/lib/components/g-skeleton-view/g-skeleton-view.vue +78 -0
- package/lib/components/g-tag-editor/g-tag-editor.vue +482 -0
- package/lib/components/g-timer/g-timer.vue +61 -0
- package/lib/components/g-trtc/g-trtc.vue +347 -0
- package/lib/components/g-trtc-room/g-trtc-room.vue +524 -0
- package/lib/components/g-trtc-room/iconfont.scss +59 -0
- package/lib/components/g-trtc-tui/g-trtc-tui.vue +245 -0
- package/lib/components/g-upload/g-upload.vue +294 -0
- package/lib/components/g-waterfall/g-waterfall.vue +101 -0
- package/lib/configs/api.d.ts +7 -0
- package/lib/configs/api.js +6 -0
- package/lib/configs/app.d.ts +26 -0
- package/lib/configs/app.js +50 -0
- package/lib/configs/brand.d.ts +22 -0
- package/lib/configs/brand.js +26 -0
- package/lib/configs/cdn.d.ts +13 -0
- package/lib/configs/cdn.js +12 -0
- package/lib/configs/color.d.ts +62 -0
- package/lib/configs/color.js +66 -0
- package/lib/configs/env.d.ts +37 -0
- package/lib/configs/env.js +71 -0
- package/lib/configs/index.d.ts +170 -0
- package/lib/configs/index.js +82 -0
- package/lib/configs/link.d.ts +11 -0
- package/lib/configs/link.js +3 -0
- package/lib/configs/log.d.ts +9 -0
- package/lib/configs/log.js +8 -0
- package/lib/configs/mp.d.ts +15 -0
- package/lib/configs/mp.js +9 -0
- package/lib/configs/navigate.d.ts +17 -0
- package/lib/configs/navigate.js +5 -0
- package/lib/configs/page.d.ts +18 -0
- package/lib/configs/page.js +14 -0
- package/lib/configs/path.d.ts +11 -0
- package/lib/configs/path.js +10 -0
- package/lib/configs/storage.d.ts +7 -0
- package/lib/configs/storage.js +6 -0
- package/lib/configs/tabbar.d.ts +7 -0
- package/lib/configs/tabbar.js +6 -0
- package/lib/configs/toast.d.ts +18 -0
- package/lib/configs/toast.js +29 -0
- package/lib/configs/update.d.ts +45 -0
- package/lib/configs/update.js +6 -0
- package/lib/configs/upload.d.ts +30 -0
- package/lib/configs/upload.js +7 -0
- package/lib/configs/ver.d.ts +8 -0
- package/lib/configs/ver.js +28 -0
- package/lib/configs/web.d.ts +5 -0
- package/lib/configs/web.js +2 -0
- package/lib/hooks/index.d.ts +4 -0
- package/lib/hooks/index.js +4 -0
- package/lib/hooks/useI18n.d.ts +2 -0
- package/lib/hooks/useI18n.js +19 -0
- package/lib/hooks/useOverlay.d.ts +1 -0
- package/lib/hooks/useOverlay.js +17 -0
- package/lib/hooks/usePopup.d.ts +1 -0
- package/lib/hooks/usePopup.js +14 -0
- package/lib/hooks/useVersion.d.ts +6 -0
- package/lib/hooks/useVersion.js +21 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.js +33 -0
- package/lib/mixins/app.d.ts +14 -0
- package/lib/mixins/app.js +105 -0
- package/lib/mixins/badge.d.ts +24 -0
- package/lib/mixins/badge.js +44 -0
- package/lib/mixins/debounce.d.ts +6 -0
- package/lib/mixins/debounce.js +11 -0
- package/lib/mixins/deep.d.ts +6 -0
- package/lib/mixins/deep.js +8 -0
- package/lib/mixins/index.d.ts +8 -0
- package/lib/mixins/index.js +8 -0
- package/lib/mixins/login.d.ts +4 -0
- package/lib/mixins/login.js +25 -0
- package/lib/mixins/model.d.ts +22 -0
- package/lib/mixins/model.js +29 -0
- package/lib/mixins/redirect.d.ts +8 -0
- package/lib/mixins/redirect.js +94 -0
- package/lib/mixins/share.d.ts +15 -0
- package/lib/mixins/share.js +55 -0
- package/lib/mixins/show.d.ts +9 -0
- package/lib/mixins/show.js +16 -0
- package/lib/mixins/webview.d.ts +26 -0
- package/lib/mixins/webview.js +225 -0
- package/lib/modules/app.d.ts +5 -0
- package/lib/modules/app.js +19 -0
- package/lib/modules/dict.d.ts +8 -0
- package/lib/modules/dict.js +43 -0
- package/lib/modules/im.d.ts +6 -0
- package/lib/modules/im.js +105 -0
- package/lib/modules/index.d.ts +8 -0
- package/lib/modules/index.js +8 -0
- package/lib/modules/launch.d.ts +5 -0
- package/lib/modules/launch.js +32 -0
- package/lib/modules/location.d.ts +5 -0
- package/lib/modules/location.js +57 -0
- package/lib/modules/login.d.ts +5 -0
- package/lib/modules/login.js +72 -0
- package/lib/modules/network.d.ts +5 -0
- package/lib/modules/network.js +39 -0
- package/lib/modules/system.d.ts +5 -0
- package/lib/modules/system.js +65 -0
- package/lib/styles/animate-vue.scss +3 -0
- package/lib/styles/animate.scss +27 -0
- package/lib/styles/bg-vue.scss +21 -0
- package/lib/styles/bg.scss +93 -0
- package/lib/styles/border.scss +218 -0
- package/lib/styles/flex-nvue.scss +64 -0
- package/lib/styles/flex-vue.scss +75 -0
- package/lib/styles/font.scss +59 -0
- package/lib/styles/index.scss +25 -0
- package/lib/styles/layout-nvue.scss +24 -0
- package/lib/styles/layout-vue.scss +30 -0
- package/lib/styles/layout.scss +76 -0
- package/lib/styles/opacity.scss +10 -0
- package/lib/styles/reset-vue.scss +46 -0
- package/lib/styles/shadow.scss +12 -0
- package/lib/styles/sizing-vue.scss +21 -0
- package/lib/styles/sizing.scss +21 -0
- package/lib/styles/spacing.scss +234 -0
- package/lib/styles/text-nvue.scss +21 -0
- package/lib/styles/text-vue.scss +70 -0
- package/lib/styles/text.scss +122 -0
- package/lib/styles/var.module.scss +29 -0
- package/lib/utils/audio.d.ts +14 -0
- package/lib/utils/audio.js +43 -0
- package/lib/utils/consts.d.ts +30 -0
- package/lib/utils/consts.js +52 -0
- package/lib/utils/cos.d.ts +15 -0
- package/lib/utils/cos.js +140 -0
- package/lib/utils/debounce.d.ts +2 -0
- package/lib/utils/debounce.js +30 -0
- package/lib/utils/file.d.ts +28 -0
- package/lib/utils/file.js +292 -0
- package/lib/utils/index.d.ts +166 -0
- package/lib/utils/index.js +485 -0
- package/lib/utils/locale.d.ts +6 -0
- package/lib/utils/locale.js +19 -0
- package/lib/utils/message.d.ts +9 -0
- package/lib/utils/message.js +63 -0
- package/lib/utils/navigate.d.ts +27 -0
- package/lib/utils/navigate.js +183 -0
- package/lib/utils/pages.d.ts +21 -0
- package/lib/utils/pages.js +79 -0
- package/lib/utils/permission.d.ts +16 -0
- package/lib/utils/permission.js +291 -0
- package/lib/utils/permit.d.ts +30 -0
- package/lib/utils/permit.js +181 -0
- package/lib/utils/query.d.ts +13 -0
- package/lib/utils/query.js +14 -0
- package/lib/utils/request.d.ts +8 -0
- package/lib/utils/request.js +126 -0
- package/lib/utils/storage.d.ts +53 -0
- package/lib/utils/storage.js +145 -0
- package/lib/utils/subscribe.d.ts +7 -0
- package/lib/utils/subscribe.js +94 -0
- package/lib/utils/throttle.d.ts +2 -0
- package/lib/utils/throttle.js +32 -0
- package/lib/utils/toast.d.ts +17 -0
- package/lib/utils/toast.js +66 -0
- package/lib/utils/uni.d.ts +1 -0
- package/lib/utils/uni.js +147 -0
- package/lib/utils/update.d.ts +9 -0
- package/lib/utils/update.js +376 -0
- package/package.json +49 -0
- package/types/index.d.ts +25 -0
- package/types/virtual.d.ts +1 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type NavigateType = 'navigateTo' | 'reLaunch' | 'redirectTo';
|
|
2
|
+
export type ReferrerType = 'none' | 'target' | 'referrer' | 'combine';
|
|
3
|
+
/** 导航配置 */
|
|
4
|
+
type Navigate = {
|
|
5
|
+
/** 登录跳转类型 */
|
|
6
|
+
loginType: NavigateType;
|
|
7
|
+
/** 来源页面类型 */
|
|
8
|
+
referrerType: ReferrerType;
|
|
9
|
+
};
|
|
10
|
+
export type NavigateConfig = {
|
|
11
|
+
/** 登录跳转类型 */
|
|
12
|
+
loginType?: NavigateType;
|
|
13
|
+
/** 来源页面类型 */
|
|
14
|
+
referrerType?: ReferrerType;
|
|
15
|
+
};
|
|
16
|
+
declare const navigate: Navigate;
|
|
17
|
+
export default navigate;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** 页面集合配置 */
|
|
2
|
+
declare const page: {
|
|
3
|
+
/** 所有页面 */
|
|
4
|
+
pages: string[];
|
|
5
|
+
/** tabbar页面 */
|
|
6
|
+
tabBarPages: string[];
|
|
7
|
+
/** 原生页面 */
|
|
8
|
+
nativePages: string[];
|
|
9
|
+
/** 需要登录页面 */
|
|
10
|
+
needLoginPages: string[];
|
|
11
|
+
/** 无需重定向页面 */
|
|
12
|
+
notRedirectPages: string[];
|
|
13
|
+
};
|
|
14
|
+
type Keys = keyof typeof page;
|
|
15
|
+
export type PageConfig = {
|
|
16
|
+
[key in Keys]?: string[];
|
|
17
|
+
};
|
|
18
|
+
export default page;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** toast配置 */
|
|
2
|
+
declare const toast: {
|
|
3
|
+
/** 是否自定义 */
|
|
4
|
+
custom: boolean;
|
|
5
|
+
/** 自定义toast显式逻辑 */
|
|
6
|
+
show(options: UniNamespace.ShowToastOptions): boolean;
|
|
7
|
+
/** 自定义toast隐藏逻辑 */
|
|
8
|
+
hide(): boolean;
|
|
9
|
+
};
|
|
10
|
+
export type ToastConfig = {
|
|
11
|
+
/** 是否自定义 */
|
|
12
|
+
custom?: boolean;
|
|
13
|
+
/** 自定义toast显式逻辑 */
|
|
14
|
+
show?(options: UniNamespace.ShowToastOptions): boolean;
|
|
15
|
+
/** 自定义toast隐藏逻辑 */
|
|
16
|
+
hide?(): boolean;
|
|
17
|
+
};
|
|
18
|
+
export default toast;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** toast配置 */
|
|
2
|
+
const toast = {
|
|
3
|
+
/** 是否自定义 */
|
|
4
|
+
custom: false,
|
|
5
|
+
/** 自定义toast显式逻辑 */
|
|
6
|
+
show(options) {
|
|
7
|
+
const page = getCurrentPages().pop();
|
|
8
|
+
if (page?.$vm?.$refs?.toast?.show) {
|
|
9
|
+
const { icon, title, ...rest } = options;
|
|
10
|
+
page.$vm.$refs.toast.show({
|
|
11
|
+
type: ['error', 'success'].includes(icon) ? icon : 'default',
|
|
12
|
+
message: title,
|
|
13
|
+
...rest,
|
|
14
|
+
});
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
},
|
|
19
|
+
/** 自定义toast隐藏逻辑 */
|
|
20
|
+
hide() {
|
|
21
|
+
const page = getCurrentPages().pop();
|
|
22
|
+
if (page?.$vm?.$refs?.toast?.hide) {
|
|
23
|
+
page.$vm.$refs.toast.hide();
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export default toast;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
type UpdateRequestParams = {
|
|
2
|
+
/** 当前应用ID */
|
|
3
|
+
appId?: string;
|
|
4
|
+
/** 当前应用名称 */
|
|
5
|
+
appName?: string;
|
|
6
|
+
/** 当前应用资源版本号 */
|
|
7
|
+
versionCode?: number;
|
|
8
|
+
/** 当前应用资源版本名称 */
|
|
9
|
+
versionName?: string;
|
|
10
|
+
/** 当前应用程序版本号 */
|
|
11
|
+
appVersionCode?: number;
|
|
12
|
+
/** 当前应用程序版本名称 */
|
|
13
|
+
appVersionName?: string;
|
|
14
|
+
/** 应用平台 */
|
|
15
|
+
platform?: string;
|
|
16
|
+
};
|
|
17
|
+
type UpdateResponceData = {
|
|
18
|
+
/** 资源包热更新,0否 1是 */
|
|
19
|
+
hot_update?: number;
|
|
20
|
+
/** 新包版本号 */
|
|
21
|
+
version_code?: number;
|
|
22
|
+
/** 强制更新,0否 1是 */
|
|
23
|
+
force_update?: number;
|
|
24
|
+
/** 在APP外部安装 */
|
|
25
|
+
external_install?: number;
|
|
26
|
+
/** app资源包路径 */
|
|
27
|
+
wgt_url?: string;
|
|
28
|
+
/** 客户端资源包路径 */
|
|
29
|
+
zip_url?: string;
|
|
30
|
+
/** android包路径 */
|
|
31
|
+
apk_url?: string;
|
|
32
|
+
/** ios包路径 */
|
|
33
|
+
ipa_url?: string;
|
|
34
|
+
/** windows包路径 */
|
|
35
|
+
exe_url?: string;
|
|
36
|
+
/** macos包路径 */
|
|
37
|
+
dmg_url?: string;
|
|
38
|
+
};
|
|
39
|
+
export type UpdateConfig = {
|
|
40
|
+
/** 自动更新请求,获取最新更新资源 */
|
|
41
|
+
request: (data: UpdateRequestParams) => Promise<UpdateResponceData>;
|
|
42
|
+
};
|
|
43
|
+
/** 自动更新配置 */
|
|
44
|
+
declare const update: UpdateConfig;
|
|
45
|
+
export default update;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type UploadResponceData = {
|
|
2
|
+
/** 秘钥ID */
|
|
3
|
+
secret_id?: string;
|
|
4
|
+
/** 秘钥KEY */
|
|
5
|
+
secret_key?: string;
|
|
6
|
+
/** 上传Token */
|
|
7
|
+
session_token?: string;
|
|
8
|
+
/** Token生成时间 */
|
|
9
|
+
create_time?: number;
|
|
10
|
+
/** Token过期时间 */
|
|
11
|
+
expire_time?: number;
|
|
12
|
+
/** 空间别名 */
|
|
13
|
+
bucket?: string;
|
|
14
|
+
/** 空间所属区域别名 */
|
|
15
|
+
region?: string;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
type UploadParams = {
|
|
19
|
+
/** 上传类型 */
|
|
20
|
+
mode?: 'cos' | 'oss' | 'none';
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
/** 上传配置 */
|
|
24
|
+
export type UploadConfig = {
|
|
25
|
+
/** 上传请求,例如获取Token */
|
|
26
|
+
request: (params?: UploadParams) => Promise<UploadResponceData>;
|
|
27
|
+
};
|
|
28
|
+
/** 上传配置 */
|
|
29
|
+
declare const Upload: UploadConfig;
|
|
30
|
+
export default Upload;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { reactive } from 'vue';
|
|
2
|
+
// #ifndef APP-PLUS
|
|
3
|
+
import system from '../modules/system';
|
|
4
|
+
// #endif
|
|
5
|
+
/** 版本配置 */
|
|
6
|
+
const ver = reactive({
|
|
7
|
+
/** 版本号 */
|
|
8
|
+
code: 0,
|
|
9
|
+
/** 版本名 */
|
|
10
|
+
name: '',
|
|
11
|
+
/** 版本名后缀 */
|
|
12
|
+
suffix: '',
|
|
13
|
+
});
|
|
14
|
+
// #ifdef APP-PLUS
|
|
15
|
+
plus.runtime.getProperty(plus.runtime.appid, (e) => {
|
|
16
|
+
if (!ver.code) {
|
|
17
|
+
ver.code = Number(e.versionCode);
|
|
18
|
+
}
|
|
19
|
+
if (!ver.name) {
|
|
20
|
+
ver.name = e.version;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
// #endif
|
|
24
|
+
// #ifndef APP-PLUS
|
|
25
|
+
ver.code = Number(system.state.info.appVersionCode);
|
|
26
|
+
ver.name = system.state.info.appVersion;
|
|
27
|
+
// #endif
|
|
28
|
+
export default ver;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// #ifdef APP-NVUE
|
|
2
|
+
import { ref, inject } from 'vue';
|
|
3
|
+
import { showLocale, defaultLocale } from '../utils/locale';
|
|
4
|
+
// #endif
|
|
5
|
+
// #ifndef APP-NVUE
|
|
6
|
+
import { useI18n as vueUseI18n } from 'vue-i18n';
|
|
7
|
+
// #endif
|
|
8
|
+
let _useI18n;
|
|
9
|
+
// #ifdef APP-NVUE
|
|
10
|
+
_useI18n = function () {
|
|
11
|
+
const locale = ref(defaultLocale);
|
|
12
|
+
const t = inject('t', showLocale);
|
|
13
|
+
return { t, locale };
|
|
14
|
+
};
|
|
15
|
+
// #endif
|
|
16
|
+
// #ifndef APP-NVUE
|
|
17
|
+
_useI18n = vueUseI18n;
|
|
18
|
+
// #endif
|
|
19
|
+
export const useI18n = _useI18n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useOverlay(visible?: boolean, delay?: number): import("vue").Ref<boolean>[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ref, watch } from 'vue';
|
|
2
|
+
export function useOverlay(visible = false, delay = 300) {
|
|
3
|
+
const showOverlay = ref(visible);
|
|
4
|
+
const showChildren = ref(visible);
|
|
5
|
+
watch(showOverlay, (e) => {
|
|
6
|
+
if (e) {
|
|
7
|
+
showChildren.value = true;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
setTimeout(() => {
|
|
11
|
+
showChildren.value = false;
|
|
12
|
+
}, delay);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return [showOverlay, showChildren];
|
|
16
|
+
}
|
|
17
|
+
;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function usePopup(visible: any): import("vue").Ref<any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { reactive } from 'vue';
|
|
2
|
+
import ver from '../configs/ver';
|
|
3
|
+
export function useVersion() {
|
|
4
|
+
const version = reactive({
|
|
5
|
+
name: ver.name,
|
|
6
|
+
code: ver.code,
|
|
7
|
+
});
|
|
8
|
+
// #ifdef APP
|
|
9
|
+
plus.runtime.getProperty(plus.runtime.appid, (res) => {
|
|
10
|
+
if (!version.name) {
|
|
11
|
+
version.name = res.version;
|
|
12
|
+
}
|
|
13
|
+
if (!version.code) {
|
|
14
|
+
version.code = Number(res.versionCode);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
// #endif
|
|
18
|
+
return {
|
|
19
|
+
version,
|
|
20
|
+
};
|
|
21
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import toast from './utils/toast';
|
|
2
|
+
import navigate from './utils/navigate';
|
|
3
|
+
import config from './configs';
|
|
4
|
+
import cos from './utils/cos';
|
|
5
|
+
import './utils/uni';
|
|
6
|
+
export * from './hooks';
|
|
7
|
+
export * from './utils';
|
|
8
|
+
export * from './utils/file';
|
|
9
|
+
export * from './utils/storage';
|
|
10
|
+
export * from './utils/pages';
|
|
11
|
+
export * from './utils/consts';
|
|
12
|
+
export * from './utils/request';
|
|
13
|
+
export * from './utils/subscribe';
|
|
14
|
+
export * from './utils/permit';
|
|
15
|
+
export * from './utils/audio';
|
|
16
|
+
export { default as query } from './utils/query';
|
|
17
|
+
export { default as update } from './utils/update';
|
|
18
|
+
export { default as Debounce, debounce } from './utils/debounce';
|
|
19
|
+
export { default as Throttle, throttle } from './utils/throttle';
|
|
20
|
+
export { defineConfig, defineEnvConfig } from './configs';
|
|
21
|
+
export { default as color } from './configs/color';
|
|
22
|
+
export { cos, toast, navigate, config };
|
|
23
|
+
declare const _default: {
|
|
24
|
+
install: import("vue").FunctionPlugin<any[]>;
|
|
25
|
+
};
|
|
26
|
+
export default _default;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import toast from './utils/toast';
|
|
2
|
+
import navigate from './utils/navigate';
|
|
3
|
+
import deep from './mixins/deep';
|
|
4
|
+
import config from './configs';
|
|
5
|
+
import cos from './utils/cos';
|
|
6
|
+
import './utils/uni';
|
|
7
|
+
export * from './hooks';
|
|
8
|
+
export * from './utils';
|
|
9
|
+
export * from './utils/file';
|
|
10
|
+
export * from './utils/storage';
|
|
11
|
+
export * from './utils/pages';
|
|
12
|
+
export * from './utils/consts';
|
|
13
|
+
export * from './utils/request';
|
|
14
|
+
export * from './utils/subscribe';
|
|
15
|
+
export * from './utils/permit';
|
|
16
|
+
export * from './utils/audio';
|
|
17
|
+
export { default as query } from './utils/query';
|
|
18
|
+
export { default as update } from './utils/update';
|
|
19
|
+
export { default as Debounce, debounce } from './utils/debounce';
|
|
20
|
+
export { default as Throttle, throttle } from './utils/throttle';
|
|
21
|
+
export { defineConfig, defineEnvConfig } from './configs';
|
|
22
|
+
export { default as color } from './configs/color';
|
|
23
|
+
export { cos, toast, navigate, config };
|
|
24
|
+
const install = (app) => {
|
|
25
|
+
// #ifdef MP
|
|
26
|
+
app.mixin(deep);
|
|
27
|
+
// #endif
|
|
28
|
+
const { $store } = app.config.globalProperties;
|
|
29
|
+
uni.$store = $store;
|
|
30
|
+
};
|
|
31
|
+
export default {
|
|
32
|
+
install,
|
|
33
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
computed: {
|
|
3
|
+
isConnected(): boolean;
|
|
4
|
+
isLogin(): boolean;
|
|
5
|
+
unreadCount(): number;
|
|
6
|
+
};
|
|
7
|
+
watch: {
|
|
8
|
+
isConnected(connected: any): void;
|
|
9
|
+
unreadCount(e: any): void;
|
|
10
|
+
};
|
|
11
|
+
onLaunch(e: any): void;
|
|
12
|
+
onShow(e: any): void;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { IS_WEBVIEW_ENV } from '../utils/consts';
|
|
2
|
+
import update from '../utils/update';
|
|
3
|
+
import navigate from '../utils/navigate';
|
|
4
|
+
import { inPages } from '../utils/pages';
|
|
5
|
+
import page from '../configs/page';
|
|
6
|
+
export default {
|
|
7
|
+
computed: {
|
|
8
|
+
isConnected() {
|
|
9
|
+
return Boolean(this.$store.getters.isConnected);
|
|
10
|
+
},
|
|
11
|
+
isLogin() {
|
|
12
|
+
return Boolean(this.$store.getters.isLogin);
|
|
13
|
+
},
|
|
14
|
+
unreadCount() {
|
|
15
|
+
return Number(this.$store.getters.unreadCount);
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
watch: {
|
|
19
|
+
isConnected(connected) {
|
|
20
|
+
// 网络恢复后检测更新
|
|
21
|
+
if (connected) {
|
|
22
|
+
// #ifndef H5
|
|
23
|
+
update.check().catch(() => { });
|
|
24
|
+
// #endif
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
// #ifdef APP
|
|
28
|
+
unreadCount(e) {
|
|
29
|
+
if (isNaN(e)) {
|
|
30
|
+
e = 0;
|
|
31
|
+
}
|
|
32
|
+
plus.runtime.setBadgeNumber(e);
|
|
33
|
+
},
|
|
34
|
+
// #endif
|
|
35
|
+
},
|
|
36
|
+
onLaunch(e) {
|
|
37
|
+
if (this.$store.state.network) {
|
|
38
|
+
this.$store.dispatch('getNetworkInfo');
|
|
39
|
+
uni.onNetworkStatusChange((e) => {
|
|
40
|
+
this.$store.commit('setNetworkInfo', {
|
|
41
|
+
type: e.networkType,
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
// 检测启动页面是否需要登录
|
|
46
|
+
if (!this.isLogin) {
|
|
47
|
+
const path = `/${e.path}`;
|
|
48
|
+
const query = e.query;
|
|
49
|
+
if (inPages(page.needLoginPages, path)) {
|
|
50
|
+
(async () => {
|
|
51
|
+
// #ifdef H5
|
|
52
|
+
if (IS_WEBVIEW_ENV && !uni.webView) {
|
|
53
|
+
function checkWebView() {
|
|
54
|
+
if (!uni.webView) {
|
|
55
|
+
return new Promise((res) => {
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
res(checkWebView());
|
|
58
|
+
}, 100);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return Promise.resolve();
|
|
62
|
+
}
|
|
63
|
+
// 延迟处理,防止uni.webView不生效
|
|
64
|
+
await checkWebView();
|
|
65
|
+
}
|
|
66
|
+
// #endif
|
|
67
|
+
navigate({
|
|
68
|
+
url: path,
|
|
69
|
+
params: query,
|
|
70
|
+
});
|
|
71
|
+
})();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
onShow(e) {
|
|
76
|
+
// 为了防止无意义的多次onShow执行,如选择文件、授权
|
|
77
|
+
// 操作时会将uni.showAppFromBackground设置为false
|
|
78
|
+
if (!uni.showAppFromBackground) {
|
|
79
|
+
if (uni.showAppFromBackground === false) {
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
// 需异步设置为true,否则App.onShow即使加了uni.showAppFromBackground判断,还是会执行
|
|
82
|
+
uni.showAppFromBackground = true;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
if (this.$store.state.launch) {
|
|
88
|
+
// 部分设备可能为string
|
|
89
|
+
if (typeof e.referrerInfo?.extraData === 'string') {
|
|
90
|
+
e.referrerInfo.extraData = JSON.parse(e.referrerInfo.extraData);
|
|
91
|
+
}
|
|
92
|
+
// 设置启动信息
|
|
93
|
+
this.$store.commit('setLaunchInfo', e);
|
|
94
|
+
}
|
|
95
|
+
if (process.env.NODE_ENV !== 'development') {
|
|
96
|
+
// 检测更新
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
if (uni.showAppFromBackground) {
|
|
99
|
+
update.check().catch(() => { });
|
|
100
|
+
}
|
|
101
|
+
}, 1000);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
mixins: {
|
|
3
|
+
data(): {
|
|
4
|
+
pageShow: boolean;
|
|
5
|
+
};
|
|
6
|
+
onShow(): void;
|
|
7
|
+
onHide(): void;
|
|
8
|
+
onUnload(): void;
|
|
9
|
+
}[];
|
|
10
|
+
computed: {
|
|
11
|
+
unreadCount(): any;
|
|
12
|
+
};
|
|
13
|
+
watch: {
|
|
14
|
+
pageShow(e: any): void;
|
|
15
|
+
unreadCount: {
|
|
16
|
+
immediate: boolean;
|
|
17
|
+
handler(): void;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
methods: {
|
|
21
|
+
setTabBarBadge(): void;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import tabbar from '../configs/tabbar';
|
|
2
|
+
import show from './show';
|
|
3
|
+
export default {
|
|
4
|
+
mixins: [show],
|
|
5
|
+
computed: {
|
|
6
|
+
unreadCount() {
|
|
7
|
+
return this.$store.getters.unreadCount;
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
watch: {
|
|
11
|
+
pageShow(e) {
|
|
12
|
+
if (e) {
|
|
13
|
+
this.setTabBarBadge();
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
unreadCount: {
|
|
17
|
+
immediate: true,
|
|
18
|
+
handler() {
|
|
19
|
+
if (this.pageShow) {
|
|
20
|
+
this.setTabBarBadge();
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
methods: {
|
|
26
|
+
setTabBarBadge() {
|
|
27
|
+
if (tabbar.badgeIndex > 0) {
|
|
28
|
+
if (this.unreadCount) {
|
|
29
|
+
uni.setTabBarBadge({
|
|
30
|
+
index: tabbar.badgeIndex,
|
|
31
|
+
text: String(this.unreadCount),
|
|
32
|
+
fail() { },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
uni.removeTabBarBadge({
|
|
37
|
+
index: tabbar.badgeIndex,
|
|
38
|
+
fail() { },
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|