af-mobile-client-vue3 1.0.54
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/.editorconfig +38 -0
- package/.env +7 -0
- package/.env.development +4 -0
- package/.env.envoiceShow +7 -0
- package/.env.production +7 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/.vscode/extensions.json +7 -0
- package/.vscode/settings.json +61 -0
- package/LICENSE +21 -0
- package/README.md +181 -0
- package/af-example-mobile-vue-web.iml +9 -0
- package/build/vite/index.ts +91 -0
- package/build/vite/vconsole.ts +44 -0
- package/eslint.config.js +7 -0
- package/index.html +17 -0
- package/mock/data.ts +20 -0
- package/mock/index.ts +5 -0
- package/mock/modules/prose.mock.ts +16 -0
- package/mock/modules/user.mock.ts +152 -0
- package/netlify.toml +12 -0
- package/package.json +107 -0
- package/public/favicon-dark.svg +4 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.svg +4 -0
- package/public/pwa-192x192.png +0 -0
- package/public/pwa-512x512.png +0 -0
- package/public/safari-pinned-tab.svg +32 -0
- package/scripts/verifyCommit.js +19 -0
- package/src/App.vue +43 -0
- package/src/api/mock/index.ts +30 -0
- package/src/api/user/index.ts +40 -0
- package/src/assets/common/default-user-profile.png +0 -0
- package/src/assets/img/apps/apply-web.png +0 -0
- package/src/assets/img/apps/example-web.png +0 -0
- package/src/assets/img/apps/iot-web.png +0 -0
- package/src/assets/img/apps/linepatrol-web.png +0 -0
- package/src/assets/img/apps/monitor-web.png +0 -0
- package/src/assets/img/apps/oa-web.png +0 -0
- package/src/assets/img/apps/revenue-web.png +0 -0
- package/src/assets/img/apps/safe-check-web.png +0 -0
- package/src/assets/img/component/logo.png +0 -0
- package/src/assets/img/home/banner1.png +0 -0
- package/src/assets/img/home/banner2.png +0 -0
- package/src/assets/img/home/banner3.png +0 -0
- package/src/assets/img/home/banner4.png +0 -0
- package/src/assets/img/home/notice/icon.png +0 -0
- package/src/assets/img/user/login/background-shadow-1.svg +20 -0
- package/src/assets/img/user/login/logo-background.svg +20 -0
- package/src/assets/img/user/login/logo.png +0 -0
- package/src/assets/img/user/my/exit-login.png +0 -0
- package/src/assets/img/user/my/setting-arrow.png +0 -0
- package/src/assets/img/user/my/setting.png +0 -0
- package/src/bootstrap.ts +32 -0
- package/src/components/core/App/MicroAppView.vue +59 -0
- package/src/components/core/BeautifulLoading/index.vue +47 -0
- package/src/components/core/NavBar/index.vue +12 -0
- package/src/components/core/SvgIcon/index.vue +61 -0
- package/src/components/core/Tabbar/index.vue +38 -0
- package/src/components/core/Uploader/index.vue +104 -0
- package/src/components/core/XMultiSelect/index.vue +196 -0
- package/src/components/core/XSelect/index.vue +130 -0
- package/src/components/data/XBadge/index.vue +85 -0
- package/src/components/data/XCellDetail/index.vue +106 -0
- package/src/components/data/XCellList/index.vue +358 -0
- package/src/components/data/XCellListFilter/index.vue +392 -0
- package/src/components/data/XForm/index.vue +127 -0
- package/src/components/data/XFormItem/index.vue +472 -0
- package/src/components/data/XReportForm/XReportFormJsonRender.vue +220 -0
- package/src/components/data/XReportForm/index.vue +1058 -0
- package/src/components/layout/NormalDataLayout/index.vue +70 -0
- package/src/components/layout/TabBarLayout/index.vue +40 -0
- package/src/components.d.ts +53 -0
- package/src/enums/requestEnum.ts +25 -0
- package/src/env.d.ts +16 -0
- package/src/font-style/PingFangSC-Regular.woff2 +0 -0
- package/src/font-style/font.css +4 -0
- package/src/hooks/useCommon.ts +9 -0
- package/src/hooks/useLogin.ts +97 -0
- package/src/icons/svg/bird.svg +1 -0
- package/src/icons/svg/check-in.svg +33 -0
- package/src/icons/svg/dark.svg +5 -0
- package/src/icons/svg/github.svg +5 -0
- package/src/icons/svg/light.svg +5 -0
- package/src/icons/svg/link.svg +5 -0
- package/src/icons/svg/loadError.svg +1 -0
- package/src/icons/svg/notFound.svg +1 -0
- package/src/icons/svgo.yml +22 -0
- package/src/layout/PageLayout.vue +51 -0
- package/src/layout/SingleLayout.vue +35 -0
- package/src/locales/en-US.json +25 -0
- package/src/locales/zh-CN.json +25 -0
- package/src/main.ts +48 -0
- package/src/plugins/AppData.ts +38 -0
- package/src/plugins/GetLoginInfoService.ts +10 -0
- package/src/plugins/index.ts +11 -0
- package/src/router/README.md +8 -0
- package/src/router/guards.ts +60 -0
- package/src/router/index.ts +60 -0
- package/src/router/invoiceRoutes.ts +33 -0
- package/src/router/routes.ts +84 -0
- package/src/services/api/Login.ts +6 -0
- package/src/services/api/common.ts +98 -0
- package/src/services/api/index.ts +7 -0
- package/src/services/api/manage.ts +8 -0
- package/src/services/restTools.ts +37 -0
- package/src/settings.ts +1 -0
- package/src/stores/index.ts +7 -0
- package/src/stores/modules/cachedView.ts +31 -0
- package/src/stores/modules/counter.ts +19 -0
- package/src/stores/modules/routeTransitionName.ts +26 -0
- package/src/stores/modules/setting.ts +28 -0
- package/src/stores/modules/user.ts +180 -0
- package/src/stores/mutation-type.ts +7 -0
- package/src/styles/app.less +67 -0
- package/src/styles/login.less +81 -0
- package/src/typing.ts +3 -0
- package/src/utils/Storage.ts +124 -0
- package/src/utils/authority-utils.ts +87 -0
- package/src/utils/common.ts +41 -0
- package/src/utils/crypto.ts +39 -0
- package/src/utils/dataUtil.ts +42 -0
- package/src/utils/dictUtil.ts +51 -0
- package/src/utils/http/index.ts +158 -0
- package/src/utils/i18n.ts +41 -0
- package/src/utils/indexedDB.ts +180 -0
- package/src/utils/local-storage.ts +9 -0
- package/src/utils/mobileUtil.ts +26 -0
- package/src/utils/progress.ts +19 -0
- package/src/utils/routerUtil.ts +271 -0
- package/src/utils/set-page-title.ts +7 -0
- package/src/utils/validate.ts +6 -0
- package/src/views/chat/index.vue +153 -0
- package/src/views/common/LoadError.vue +64 -0
- package/src/views/common/NotFound.vue +68 -0
- package/src/views/component/EvaluateRecordView/index.vue +40 -0
- package/src/views/component/XCellDetailView/index.vue +216 -0
- package/src/views/component/XCellListView/index.vue +36 -0
- package/src/views/component/XFormView/index.vue +478 -0
- package/src/views/component/XReportFormIframeView/index.vue +45 -0
- package/src/views/component/XReportFormView/index.vue +295 -0
- package/src/views/component/index.vue +111 -0
- package/src/views/component/menu.vue +117 -0
- package/src/views/component/notice.vue +46 -0
- package/src/views/component/topNav.vue +36 -0
- package/src/views/invoiceShow/index.vue +62 -0
- package/src/views/user/login/ForgetPasswordForm.vue +93 -0
- package/src/views/user/login/LoginForm.vue +145 -0
- package/src/views/user/login/LoginTitle.vue +68 -0
- package/src/views/user/login/LoginWave.vue +109 -0
- package/src/views/user/login/index.vue +22 -0
- package/src/views/user/my/index.vue +230 -0
- package/src/vue-router.d.ts +9 -0
- package/tsconfig.json +43 -0
- package/uno.config.ts +32 -0
- package/vite.config.ts +110 -0
package/src/main.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createApp } from 'vue'
|
|
2
|
+
import { createHead } from '@unhead/vue'
|
|
3
|
+
import bootstrap from '@af-mobile-client-vue3/bootstrap'
|
|
4
|
+
import App from '@af-mobile-client-vue3/App.vue'
|
|
5
|
+
import router from '@af-mobile-client-vue3/router'
|
|
6
|
+
import pinia from '@af-mobile-client-vue3/stores'
|
|
7
|
+
import 'virtual:uno.css'
|
|
8
|
+
import '@af-mobile-client-vue3/styles/app.less'
|
|
9
|
+
import 'vant/lib/index.css'
|
|
10
|
+
import 'vant/lib/tabbar/index.css'
|
|
11
|
+
import 'vant/lib/tabbar-item/index.css'
|
|
12
|
+
|
|
13
|
+
// svg icon
|
|
14
|
+
import 'virtual:svg-icons-register'
|
|
15
|
+
|
|
16
|
+
// Vant 桌面端适配
|
|
17
|
+
import '@vant/touch-emulator'
|
|
18
|
+
|
|
19
|
+
/* --------------------------------
|
|
20
|
+
Vant 中有个别组件是以函数的形式提供的,
|
|
21
|
+
包括 Toast,Dialog,Notify 和 ImagePreview 组件。
|
|
22
|
+
在使用函数组件时,unplugin-vue-components
|
|
23
|
+
无法自动引入对应的样式,因此需要手动引入样式。
|
|
24
|
+
------------------------------------- */
|
|
25
|
+
import 'vant/es/toast/style'
|
|
26
|
+
import 'vant/es/dialog/style'
|
|
27
|
+
import 'vant/es/notify/style'
|
|
28
|
+
import 'vant/es/image-preview/style'
|
|
29
|
+
import Plugins from '@af-mobile-client-vue3/plugins'
|
|
30
|
+
|
|
31
|
+
const app = createApp(App)
|
|
32
|
+
const head = createHead()
|
|
33
|
+
|
|
34
|
+
app.use(head)
|
|
35
|
+
app.use(router)
|
|
36
|
+
app.use(pinia)
|
|
37
|
+
app.use(Plugins)
|
|
38
|
+
|
|
39
|
+
async function main() {
|
|
40
|
+
await bootstrap(router)
|
|
41
|
+
app.mount('#system-app')
|
|
42
|
+
}
|
|
43
|
+
main().then((_r) => {})
|
|
44
|
+
|
|
45
|
+
// 👇 将卸载操作放入 unmount 函数,就是上面步骤2中的卸载函数
|
|
46
|
+
window.unmount = () => {
|
|
47
|
+
app.unmount()
|
|
48
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { App } from 'vue'
|
|
2
|
+
import { manageApi } from '@af-mobile-client-vue3/services/api/manage'
|
|
3
|
+
import { indexedDB } from '@af-mobile-client-vue3/utils/indexedDB'
|
|
4
|
+
import { handleTree } from '@af-mobile-client-vue3/utils/dataUtil'
|
|
5
|
+
import { createStorage } from '@af-mobile-client-vue3/utils/Storage'
|
|
6
|
+
import { APP_WEB_CONFIG_KEY } from '@af-mobile-client-vue3/stores/mutation-type'
|
|
7
|
+
|
|
8
|
+
const Storage = createStorage({ storage: localStorage })
|
|
9
|
+
|
|
10
|
+
export const GetAppDataService = {
|
|
11
|
+
install(app: App<Element>) {
|
|
12
|
+
app.provide('$appdata', GetAppDataService)
|
|
13
|
+
},
|
|
14
|
+
async load() {
|
|
15
|
+
},
|
|
16
|
+
// 返回树形省市区
|
|
17
|
+
async getDivisionsOhChinaForTree() {
|
|
18
|
+
// 获取省市区数据
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
try {
|
|
21
|
+
indexedDB.getByWeb('divisionsOhChina', manageApi.getDivisionsOhChina, {}, (res) => {
|
|
22
|
+
resolve(res)
|
|
23
|
+
}, (processRes) => {
|
|
24
|
+
return handleTree(processRes, 'code', 'parentcode', null)
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
reject(e)
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
getWebConfigByKey(key: string) {
|
|
33
|
+
const object = Storage.get(APP_WEB_CONFIG_KEY)
|
|
34
|
+
return object[key]
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default GetAppDataService
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { App } from 'vue'
|
|
2
|
+
import GetLoginInfoService from '@af-mobile-client-vue3/plugins/GetLoginInfoService'
|
|
3
|
+
import GetAppDataService from '@af-mobile-client-vue3/plugins/AppData'
|
|
4
|
+
|
|
5
|
+
const Plugins = {
|
|
6
|
+
install(app: App<Element>) {
|
|
7
|
+
app.use(GetLoginInfoService)
|
|
8
|
+
app.use(GetAppDataService)
|
|
9
|
+
},
|
|
10
|
+
}
|
|
11
|
+
export default Plugins
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# `File-based Routing`
|
|
2
|
+
|
|
3
|
+
Routes will be auto-generated for Vue files in the **src/views** dir with the same file structure.
|
|
4
|
+
Check out [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router) for more details.
|
|
5
|
+
|
|
6
|
+
在 **src/views** 目录下的 Vue 文件会自动生成相同结构的路由。
|
|
7
|
+
|
|
8
|
+
查看[`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router)了解更多细节。
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { showToast } from 'vant'
|
|
2
|
+
import useUserStore from '@af-mobile-client-vue3/stores/modules/user'
|
|
3
|
+
import { hasAuthority } from '@af-mobile-client-vue3/utils/authority-utils'
|
|
4
|
+
|
|
5
|
+
// 不需要登录拦截的路由配置
|
|
6
|
+
const loginIgnore = {
|
|
7
|
+
names: ['404', '403'], // 根据路由名称匹配
|
|
8
|
+
paths: ['/login', '/XReportFormIframeView', '/invoiceShow'], // 根据路由fullPath匹配
|
|
9
|
+
/**
|
|
10
|
+
* 判断路由是否包含在该配置中
|
|
11
|
+
* @param route vue-router 的 route 对象
|
|
12
|
+
*/
|
|
13
|
+
includes(route) {
|
|
14
|
+
return this.names.includes(route.name) || this.paths.includes(route.path)
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 登录守卫
|
|
20
|
+
* @param to
|
|
21
|
+
* @param form
|
|
22
|
+
* @param next
|
|
23
|
+
* @param options
|
|
24
|
+
*/
|
|
25
|
+
function loginGuard(to, from, next?) {
|
|
26
|
+
if (!loginIgnore.includes(to) && !useUserStore().getToken()) {
|
|
27
|
+
showToast({
|
|
28
|
+
message: '登录态已失效,请重新登录',
|
|
29
|
+
position: 'bottom',
|
|
30
|
+
})
|
|
31
|
+
next({ path: '/login' })
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
if (to.path === '/login' && useUserStore().getToken())
|
|
35
|
+
next({ path: '/' })
|
|
36
|
+
|
|
37
|
+
next()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 权限守卫
|
|
43
|
+
* @param to
|
|
44
|
+
* @param form
|
|
45
|
+
* @param next
|
|
46
|
+
*/
|
|
47
|
+
function authorityGuard(to, from, next?) {
|
|
48
|
+
const permissions = useUserStore().getPermissions()
|
|
49
|
+
const roles = useUserStore().getRoles()
|
|
50
|
+
if (!hasAuthority(to, permissions, roles))
|
|
51
|
+
next({ path: '/' })
|
|
52
|
+
|
|
53
|
+
else
|
|
54
|
+
next()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default {
|
|
58
|
+
beforeEach: [loginGuard, authorityGuard],
|
|
59
|
+
afterEach: [],
|
|
60
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// https://router.vuejs.org/zh/
|
|
2
|
+
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
|
|
3
|
+
import 'nprogress/nprogress.css'
|
|
4
|
+
import type { RouteLocationNormalized } from 'vue-router'
|
|
5
|
+
import setPageTitle from '@af-mobile-client-vue3/utils/set-page-title'
|
|
6
|
+
import useCachedViewStore from '@af-mobile-client-vue3/stores/modules/cachedView'
|
|
7
|
+
import useRouteTransitionNameStore from '@af-mobile-client-vue3/stores/modules/routeTransitionName'
|
|
8
|
+
import routes from '@af-mobile-client-vue3/router/routes'
|
|
9
|
+
const baseUrl = import.meta.env.VITE_APP_PUBLIC_PATH
|
|
10
|
+
// 创建路由实例并传递 `routes` 配置
|
|
11
|
+
const router = createRouter({
|
|
12
|
+
history: import.meta.env.NODE_ENV === 'development' ? createWebHistory(baseUrl) : createWebHashHistory(baseUrl),
|
|
13
|
+
routes,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export interface toRouteType extends RouteLocationNormalized {
|
|
17
|
+
meta: {
|
|
18
|
+
title?: string
|
|
19
|
+
noCache?: boolean
|
|
20
|
+
index?: number
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
router.beforeEach((to: toRouteType, _from: toRouteType, next) => {
|
|
25
|
+
const toDepth = to.path.split('/').length
|
|
26
|
+
const fromDepth = _from.path.split('/').length
|
|
27
|
+
// 路由过渡动画
|
|
28
|
+
const routeTransitionNameStore = useRouteTransitionNameStore()
|
|
29
|
+
let name: string
|
|
30
|
+
if (toDepth > fromDepth || to.name === '404') {
|
|
31
|
+
console.warn('in')
|
|
32
|
+
// 进入动画
|
|
33
|
+
name = 'slide-fadein-left'
|
|
34
|
+
}
|
|
35
|
+
else if (toDepth < fromDepth) {
|
|
36
|
+
// 返回动画
|
|
37
|
+
name = 'slide-fadein-right'
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const toIndex = to.meta.index ? to.meta.index : 0
|
|
41
|
+
const fromIndex = _from.meta.index ? _from.meta.index : 0
|
|
42
|
+
if (toIndex > fromIndex)
|
|
43
|
+
name = 'slide-right'
|
|
44
|
+
else if (toIndex < fromIndex)
|
|
45
|
+
name = 'slide-left'
|
|
46
|
+
else
|
|
47
|
+
name = ''
|
|
48
|
+
}
|
|
49
|
+
routeTransitionNameStore.setName(name)
|
|
50
|
+
// 路由缓存
|
|
51
|
+
useCachedViewStore().addCachedView(to)
|
|
52
|
+
// 页面 title
|
|
53
|
+
setPageTitle(to.meta.title)
|
|
54
|
+
next()
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
router.afterEach(() => {})
|
|
58
|
+
|
|
59
|
+
// 导出路由实例,并在 `main.ts` 挂载
|
|
60
|
+
export default router
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { RouteRecordRaw } from 'vue-router'
|
|
2
|
+
import PageLayout from '@af-mobile-client-vue3/layout/PageLayout.vue'
|
|
3
|
+
import NotFound from '@af-mobile-client-vue3/views/common/NotFound.vue'
|
|
4
|
+
import invoiceShow from '@af-mobile-client-vue3/views/invoiceShow/index.vue'
|
|
5
|
+
|
|
6
|
+
const routes: Array<RouteRecordRaw> = [
|
|
7
|
+
{
|
|
8
|
+
path: '/',
|
|
9
|
+
name: 'root',
|
|
10
|
+
component: PageLayout,
|
|
11
|
+
redirect: { name: 'Component' },
|
|
12
|
+
children: [
|
|
13
|
+
{
|
|
14
|
+
path: '/invoiceShow',
|
|
15
|
+
name: 'invoiceShow',
|
|
16
|
+
component: invoiceShow,
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
path: '/404',
|
|
22
|
+
name: '404',
|
|
23
|
+
component: NotFound,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
path: '/:pathMatch(.*)',
|
|
27
|
+
redirect: {
|
|
28
|
+
name: '404',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
export default routes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { RouteRecordRaw } from 'vue-router'
|
|
2
|
+
import ComponentView from '@af-mobile-client-vue3/views/component/index.vue'
|
|
3
|
+
import XCellListView from '@af-mobile-client-vue3/views/component/XCellListView/index.vue'
|
|
4
|
+
import XCellDetailView from '@af-mobile-client-vue3/views/component/XCellDetailView/index.vue'
|
|
5
|
+
import XReportFormView from '@af-mobile-client-vue3/views/component/XReportFormView/index.vue'
|
|
6
|
+
import XFormView from '@af-mobile-client-vue3/views/component/XFormView/index.vue'
|
|
7
|
+
import EvaluateRecordView from '@af-mobile-client-vue3/views/component/EvaluateRecordView/index.vue'
|
|
8
|
+
import XReportFormIframeView from '@af-mobile-client-vue3/views/component/XReportFormIframeView/index.vue'
|
|
9
|
+
import PageLayout from '@af-mobile-client-vue3/layout/PageLayout.vue'
|
|
10
|
+
import login from '@af-mobile-client-vue3/views/user/login/index.vue'
|
|
11
|
+
import NotFound from '@af-mobile-client-vue3/views/common/NotFound.vue'
|
|
12
|
+
import SingleLayout from '@af-mobile-client-vue3/layout/SingleLayout.vue'
|
|
13
|
+
|
|
14
|
+
const routes: Array<RouteRecordRaw> = [
|
|
15
|
+
{
|
|
16
|
+
path: '/',
|
|
17
|
+
name: 'root',
|
|
18
|
+
component: PageLayout,
|
|
19
|
+
redirect: { name: 'Component' },
|
|
20
|
+
children: [
|
|
21
|
+
{
|
|
22
|
+
path: '/XReportFormIframeView',
|
|
23
|
+
name: 'XReportFormIframeView',
|
|
24
|
+
component: XReportFormIframeView,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
path: '/Component',
|
|
30
|
+
name: 'Component',
|
|
31
|
+
component: SingleLayout,
|
|
32
|
+
redirect: { name: 'ComponentView' },
|
|
33
|
+
children: [
|
|
34
|
+
{
|
|
35
|
+
path: '/Component/main',
|
|
36
|
+
name: 'ComponentView',
|
|
37
|
+
component: ComponentView,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
path: '/Component/XCellListView',
|
|
41
|
+
name: 'XCellListView',
|
|
42
|
+
component: XCellListView,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
path: '/Component/XCellDetailView/:id',
|
|
46
|
+
name: 'XCellDetailView',
|
|
47
|
+
component: XCellDetailView,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
path: '/Component/XReportFormView',
|
|
51
|
+
name: 'XReportFormView',
|
|
52
|
+
component: XReportFormView,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
path: '/Component/XFormView/:id/:openid',
|
|
56
|
+
name: 'XFormView',
|
|
57
|
+
component: XFormView,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
path: '/Component/EvaluateRecordView',
|
|
61
|
+
name: 'EvaluateRecordView',
|
|
62
|
+
component: EvaluateRecordView
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
path: '/login',
|
|
68
|
+
name: 'login',
|
|
69
|
+
component: login,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
path: '/404',
|
|
73
|
+
name: '404',
|
|
74
|
+
component: NotFound,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
path: '/:pathMatch(.*)',
|
|
78
|
+
redirect: {
|
|
79
|
+
name: '404',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
export default routes
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { indexedDB } from '@af-mobile-client-vue3/utils/indexedDB'
|
|
2
|
+
import { post, postWithConfig } from '@af-mobile-client-vue3/services/restTools'
|
|
3
|
+
|
|
4
|
+
const commonApi = {
|
|
5
|
+
// 获取配置
|
|
6
|
+
getConfig: 'logic/openapi/getLiuliConfiguration',
|
|
7
|
+
// 通用查询
|
|
8
|
+
query: 'logic/commonQuery',
|
|
9
|
+
// 编辑前查询
|
|
10
|
+
queryWithResource: 'logic/commonQueryWithResource',
|
|
11
|
+
// 通用新增/修改
|
|
12
|
+
addOrModify: 'logic/commonAddOrModify',
|
|
13
|
+
// 通用删除
|
|
14
|
+
delete: 'logic/commonDelete',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getConfigByName(configName: string, callback: Function): void
|
|
18
|
+
/**
|
|
19
|
+
* 根据配置名获取配置内容
|
|
20
|
+
* @param configName 配置名称
|
|
21
|
+
* @param callback 回调函数
|
|
22
|
+
* @param serviceName 服务名
|
|
23
|
+
*/
|
|
24
|
+
export function getConfigByName(configName: string, callback: Function, serviceName?: string): void {
|
|
25
|
+
const namespaceName = serviceName || import.meta.env.VITE_APP_SYSTEM_NAME
|
|
26
|
+
indexedDB.getByWeb(configName, `/${namespaceName}/${commonApi.getConfig}`, { configName }, callback, null)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 临时使用
|
|
31
|
+
* 获取琉璃配置,不走indexedDB缓存
|
|
32
|
+
* @param configName
|
|
33
|
+
* @param serviceName
|
|
34
|
+
*/
|
|
35
|
+
export function getConfigByNameWithoutIndexedDB(configName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
36
|
+
return post(`/${serviceName}/${commonApi.getConfig}`, { configName })
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 通用执行业务逻辑
|
|
41
|
+
*/
|
|
42
|
+
export function runLogic(logicName: string, parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
43
|
+
return post(`/${serviceName}/logic/${logicName}`, parameter)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 通用查询
|
|
48
|
+
*/
|
|
49
|
+
export function query(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
50
|
+
return post(`/${serviceName}/${commonApi.query}`, parameter)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 编辑前查询
|
|
55
|
+
*/
|
|
56
|
+
export function queryWithResource(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
57
|
+
return post(`/${serviceName}/${commonApi.queryWithResource}`, parameter)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 通用新增/修改
|
|
62
|
+
*/
|
|
63
|
+
export function addOrModify(parameter: object, tableName = 't_files', serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
64
|
+
return post(`/${serviceName}/entity/${tableName}`, parameter)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 通用新增/修改
|
|
69
|
+
*/
|
|
70
|
+
export function addOrModifyEntity(parameter: object, tableName: String, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
71
|
+
return post(`/${serviceName}/entity/save/${tableName}`, parameter)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 通用删除
|
|
76
|
+
*/
|
|
77
|
+
export function remove(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
78
|
+
return post(`/${serviceName}/${commonApi.delete}`, parameter)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @description: 上传
|
|
83
|
+
*/
|
|
84
|
+
export function upload(parameter, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME, config) {
|
|
85
|
+
return postWithConfig(`/${serviceName}/resource/upload`, parameter, config)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @description: 删除
|
|
90
|
+
*/
|
|
91
|
+
export function deleteFile(parameter, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
92
|
+
return post(`/${serviceName}/entity/t_files`, parameter)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function openApiLogic(parameter, logicName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
96
|
+
return post(`/${serviceName}/logic/openapi/${logicName}`, parameter)
|
|
97
|
+
}
|
|
98
|
+
export { commonApi }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { http } from '@af-mobile-client-vue3/utils/http'
|
|
2
|
+
import type { BasicResponseModel } from '@af-mobile-client-vue3/api/user'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* GET请求
|
|
6
|
+
* @param url 请求地址
|
|
7
|
+
* @param params 路径参数
|
|
8
|
+
*/
|
|
9
|
+
export function get(url: string, params?: any) {
|
|
10
|
+
return http.request<BasicResponseModel>({
|
|
11
|
+
url,
|
|
12
|
+
method: 'GET',
|
|
13
|
+
params,
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* POST请求
|
|
19
|
+
* @param url 请求地址
|
|
20
|
+
* @param data 请求参数
|
|
21
|
+
*/
|
|
22
|
+
export function post(url: string, data: any) {
|
|
23
|
+
return http.request<BasicResponseModel>({
|
|
24
|
+
url,
|
|
25
|
+
method: 'POST',
|
|
26
|
+
data,
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function postWithConfig(url: string, data: any, config: any) {
|
|
31
|
+
return http.request<BasicResponseModel>({
|
|
32
|
+
url,
|
|
33
|
+
method: 'POST',
|
|
34
|
+
data,
|
|
35
|
+
headers: { ...config },
|
|
36
|
+
})
|
|
37
|
+
}
|
package/src/settings.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const pageDefaultTitle = '智慧燃气'
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import type { toRouteType } from '@af-mobile-client-vue3/router'
|
|
4
|
+
|
|
5
|
+
const useCachedViewStore = defineStore('cached-view', () => {
|
|
6
|
+
// 缓存页面 keepAlive
|
|
7
|
+
const cachedViewList = ref([] as string[])
|
|
8
|
+
const addCachedView = (view: toRouteType) => {
|
|
9
|
+
// 不重复添加
|
|
10
|
+
if (cachedViewList.value.includes(view.name as string))
|
|
11
|
+
return
|
|
12
|
+
if (!view?.meta?.noCache)
|
|
13
|
+
cachedViewList.value.push(view.name as string)
|
|
14
|
+
}
|
|
15
|
+
const delCachedView = (view: toRouteType) => {
|
|
16
|
+
const index = cachedViewList.value.indexOf(view.name as string)
|
|
17
|
+
index > -1 && cachedViewList.value.splice(index, 1)
|
|
18
|
+
}
|
|
19
|
+
const delAllCachedViews = () => {
|
|
20
|
+
cachedViewList.value = [] as string[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
cachedViewList,
|
|
25
|
+
addCachedView,
|
|
26
|
+
delCachedView,
|
|
27
|
+
delAllCachedViews,
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export default useCachedViewStore
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const useCounterStore = defineStore('counter', () => {
|
|
5
|
+
const counter = ref(0)
|
|
6
|
+
|
|
7
|
+
const increment = () => {
|
|
8
|
+
counter.value++
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
counter,
|
|
13
|
+
increment,
|
|
14
|
+
}
|
|
15
|
+
}, {
|
|
16
|
+
persist: true,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export default useCounterStore
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const useRouteTransitionNameStore = defineStore('route-transition-name', () => {
|
|
5
|
+
// 过渡动画名称
|
|
6
|
+
const routeTransitionName = ref('')
|
|
7
|
+
// homeLayout动画名称
|
|
8
|
+
const routeTransitionHomeName = ref('')
|
|
9
|
+
|
|
10
|
+
const setName = (name: string) => {
|
|
11
|
+
routeTransitionName.value = name
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const setHomeName = (name: string) => {
|
|
15
|
+
routeTransitionHomeName.value = name
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
routeTransitionName,
|
|
20
|
+
routeTransitionHomeName,
|
|
21
|
+
setName,
|
|
22
|
+
setHomeName,
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
export default useRouteTransitionNameStore
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
export interface WebConfig {
|
|
5
|
+
systemName: string
|
|
6
|
+
routerName: string
|
|
7
|
+
systemDesc: string
|
|
8
|
+
homePage: string
|
|
9
|
+
defaultAvatarUrl: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// 存放 webConfig 中的 setting 配置
|
|
13
|
+
export const useSettingStore = defineStore('setting', () => {
|
|
14
|
+
const setting = ref<WebConfig>(undefined)
|
|
15
|
+
const setSetting = (newSetting: WebConfig) => {
|
|
16
|
+
setting.value = newSetting
|
|
17
|
+
}
|
|
18
|
+
const getSetting = () => {
|
|
19
|
+
return setting.value
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
setSetting,
|
|
24
|
+
getSetting,
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export default useSettingStore
|