af-mobile-client-vue3 1.3.30 → 1.3.31
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/.claude/settings.local.json +10 -0
- package/.cursorrules +60 -60
- package/.editorconfig +9 -9
- package/.env +10 -10
- package/.env.development +1 -1
- package/.env.production +1 -1
- package/.node-version +1 -1
- package/.vscode/extensions.json +12 -12
- package/.vscode/settings.json +68 -66
- package/CLAUDE.md +218 -189
- package/README.md +182 -182
- package/af-example-mobile-vue-web.iml +9 -9
- package/build/vite/index.ts +98 -98
- package/build/vite/optimize.ts +34 -34
- package/build/vite/vconsole.ts +47 -47
- package/commitlint.config.ts +32 -32
- package/compress.js +36 -36
- package/eslint.config.ts +31 -30
- package/index.html +23 -23
- package/mock/data.ts +20 -20
- package/mock/index.ts +7 -7
- package/mock/modules/prose.mock.ts +13 -13
- package/mock/modules/user.mock.ts +95 -152
- package/mock/util.ts +19 -19
- package/netlify.toml +12 -12
- package/package.json +114 -114
- package/postcss.config.ts +27 -27
- package/public/favicon.svg +4 -4
- package/public/safari-pinned-tab.svg +4 -4
- package/scripts/verifyCommit.js +19 -19
- package/src/App.vue +79 -79
- package/src/api/auth/index.ts +77 -0
- package/src/api/auth/types.ts +200 -0
- package/src/api/mock/index.ts +30 -30
- package/src/api/user/index.ts +40 -40
- package/src/assets/img/user/login/background-shadow-1.svg +20 -20
- package/src/assets/img/user/login/logo-background.svg +20 -20
- package/src/bootstrap.ts +26 -26
- package/src/components/core/BeautifulLoading/index.vue +52 -52
- package/src/components/core/ImageUploader/index.vue +251 -251
- package/src/components/core/NavBar/index.vue +53 -53
- package/src/components/core/Tabbar/index.vue +32 -32
- package/src/components/core/Uploader/index.vue +124 -124
- package/src/components/core/XGridDropOption/index.vue +154 -154
- package/src/components/core/XMultiSelect/index.vue +183 -183
- package/src/components/core/XSelect/index.vue +149 -149
- package/src/components/data/CardContainer/CardContainer.vue +118 -118
- package/src/components/data/CardContainer/CardHeader.vue +99 -99
- package/src/components/data/InfoDisplay/index.vue +132 -132
- package/src/components/data/UserDetail/api.ts +24 -24
- package/src/components/data/UserDetail/index.vue +620 -620
- package/src/components/data/UserDetail/recordEntries.ts +159 -159
- package/src/components/data/UserDetail/types.ts +26 -26
- package/src/components/data/XBadge/index.vue +82 -82
- package/src/components/data/XCellDetail/index.vue +105 -105
- package/src/components/data/XCellList/XCellList.md +432 -432
- package/src/components/data/XCellList/index.vue +1436 -1436
- package/src/components/data/XCellListFilter/QrScanner/index.vue +207 -207
- package/src/components/data/XCellListFilter/QrScanner/startScanAnimation.ts +53 -53
- package/src/components/data/XCellListFilter/VpnRecognition/index.vue +119 -119
- package/src/components/data/XCellListFilter/index.vue +705 -705
- package/src/components/data/XForm/index.vue +659 -659
- package/src/components/data/XFormGroup/doc/DeviceForm.vue +122 -122
- package/src/components/data/XFormGroup/doc/FormGroupDemo.vue +56 -56
- package/src/components/data/XFormGroup/doc/README.md +286 -286
- package/src/components/data/XFormGroup/doc/UserForm.vue +102 -102
- package/src/components/data/XFormGroup/index.vue +240 -240
- package/src/components/data/XFormItem/index.vue +1310 -1310
- package/src/components/data/XOlMap/README.md +227 -227
- package/src/components/data/XOlMap/XLocationPicker/index.vue +226 -226
- package/src/components/data/XOlMap/index.vue +1490 -1490
- package/src/components/data/XOlMap/types.ts +149 -149
- package/src/components/data/XOlMap/utils/{wgs84ToGcj02.js → wgs84ToGcj02.ts} +171 -154
- package/src/components/data/XReportForm/DateTimeSecondsPicker.vue +208 -208
- package/src/components/data/XReportForm/XReportFormJsonRender.vue +220 -220
- package/src/components/data/XReportForm/index.vue +1393 -1393
- package/src/components/data/XReportGrid/XAddReport/XAddReport.vue +198 -198
- package/src/components/data/XReportGrid/XAddReport/index.js +3 -3
- package/src/components/data/XReportGrid/XAddReport/index.md +53 -53
- package/src/components/data/XReportGrid/XAddReport/index.ts +10 -10
- package/src/components/data/XReportGrid/XReport.vue +960 -960
- package/src/components/data/XReportGrid/XReportDemo.vue +33 -33
- package/src/components/data/XReportGrid/XReportDesign.vue +597 -597
- package/src/components/data/XReportGrid/XReportDrawer/XReportDrawer.vue +148 -148
- package/src/components/data/XReportGrid/XReportDrawer/index.js +3 -3
- package/src/components/data/XReportGrid/XReportDrawer/index.ts +10 -10
- package/src/components/data/XReportGrid/XReportJsonRender.vue +399 -399
- package/src/components/data/XReportGrid/XReportTrGroup.vue +592 -592
- package/src/components/data/XReportGrid/index.md +46 -46
- package/src/components/data/XReportGrid/print.js +184 -184
- package/src/components/data/XSignature/index.vue +284 -284
- package/src/components/data/XTag/index.vue +10 -10
- package/src/components/layout/NormalDataLayout/index.vue +69 -69
- package/src/components/layout/TabBarLayout/index.vue +40 -40
- package/src/composables/dark.ts +5 -5
- package/src/config/routes.ts +9 -9
- package/src/constants/index.ts +2 -2
- package/src/enums/requestEnum.ts +25 -25
- package/src/expression/ExpressionRunner.ts +28 -28
- package/src/expression/TestExpression.ts +510 -510
- package/src/expression/core/Delegate.ts +116 -116
- package/src/expression/core/Expression.ts +1359 -1359
- package/src/expression/core/Program.ts +985 -985
- package/src/expression/core/Token.ts +29 -29
- package/src/expression/enums/ExpressionType.ts +81 -81
- package/src/expression/enums/TokenType.ts +11 -11
- package/src/expression/exception/BreakWayException.ts +2 -2
- package/src/expression/exception/ContinueWayException.ts +2 -2
- package/src/expression/exception/ExpressionException.ts +29 -29
- package/src/expression/exception/ReturnWayException.ts +14 -14
- package/src/expression/exception/ServiceException.ts +22 -22
- package/src/expression/instances/JSONArray.ts +52 -52
- package/src/expression/instances/JSONObject.ts +118 -118
- package/src/expression/instances/LogicConsole.ts +31 -31
- package/src/font-style/font.css +4 -4
- package/src/hooks/useBoolean.ts +26 -26
- package/src/hooks/useCommon.ts +9 -9
- package/src/hooks/useLoading.ts +16 -16
- package/src/hooks/useLogin.ts +97 -97
- package/src/icons/svg/check-in.svg +32 -32
- package/src/icons/svg/dark.svg +4 -4
- package/src/icons/svg/github.svg +4 -4
- package/src/icons/svg/light.svg +4 -4
- package/src/icons/svg/link.svg +4 -4
- package/src/icons/svgo.yml +22 -22
- package/src/layout/GridView/index.vue +16 -16
- package/src/layout/PageLayout.vue +9 -9
- package/src/layout/SingleLayout.vue +9 -9
- package/src/locales/en-US.json +128 -128
- package/src/locales/zh-CN.json +128 -128
- package/src/logic/LogicRunner.ts +67 -67
- package/src/logic/TestLogic.ts +13 -13
- package/src/logic/plugins/common/DateTools.ts +35 -35
- package/src/logic/plugins/common/VueTools.ts +30 -30
- package/src/logic/plugins/index.ts +7 -7
- package/src/main.ts +44 -44
- package/src/plugins/AppData.ts +38 -38
- package/src/plugins/GetLoginInfoService.ts +10 -10
- package/src/plugins/collectIcons.ts +10 -10
- package/src/plugins/index.ts +11 -11
- package/src/router/README.md +8 -8
- package/src/router/external-routes.ts +60 -0
- package/src/router/guards.ts +131 -59
- package/src/router/index.ts +35 -35
- package/src/router/invoiceRoutes.ts +33 -33
- package/src/router/routes.ts +426 -347
- package/src/services/api/Login.ts +6 -6
- package/src/services/api/common.ts +109 -109
- package/src/services/api/index.ts +7 -7
- package/src/services/api/manage.ts +8 -8
- package/src/services/api/search.ts +16 -16
- package/src/services/api/user.ts +17 -17
- package/src/services/restTools.ts +56 -56
- package/src/services/v3Api.ts +147 -147
- package/src/stores/index.ts +13 -13
- package/src/stores/modules/counter.ts +19 -19
- package/src/stores/modules/homeApp.ts +55 -55
- package/src/stores/modules/routeCache.ts +22 -23
- package/src/stores/modules/setting.ts +87 -87
- package/src/stores/modules/user.ts +326 -235
- package/src/stores/mutation-type.ts +12 -7
- package/src/styles/app.less +36 -36
- package/src/styles/login.less +109 -109
- package/src/styles/var.less +25 -25
- package/src/types/auth.ts +85 -0
- package/src/types/env.d.ts +16 -16
- package/src/types/platform.ts +194 -0
- package/src/types/settings.ts +1 -1
- package/src/types/vue-router.d.ts +13 -9
- package/src/utils/Storage.ts +124 -124
- package/src/utils/authority-utils.ts +84 -84
- package/src/utils/common.ts +41 -41
- package/src/utils/crypto.ts +39 -39
- package/src/utils/dataUtil.ts +42 -42
- package/src/utils/dictUtil.ts +52 -52
- package/src/utils/http/index.ts +201 -199
- package/src/utils/i18n.ts +72 -72
- package/src/utils/indexedDB.ts +195 -195
- package/src/utils/inline-px-to-vw.ts +28 -28
- package/src/utils/mobileUtil.ts +33 -34
- package/src/utils/platform-auth.ts +134 -0
- package/src/utils/progress.ts +19 -19
- package/src/utils/routerUtil.ts +271 -271
- package/src/utils/runEvalFunction.ts +13 -13
- package/src/utils/secureStorage.ts +70 -71
- package/src/utils/set-page-title.ts +5 -5
- package/src/utils/validate.ts +6 -6
- package/src/views/chat/index.vue +153 -153
- package/src/views/common/Forbidden.vue +97 -0
- package/src/views/common/LoadError.vue +63 -63
- package/src/views/common/NotFound.vue +67 -67
- package/src/views/component/EvaluateRecordView/index.vue +40 -40
- package/src/views/component/IconifyView/index.vue +504 -504
- package/src/views/component/UserDetailView/UserDetailPage.vue +77 -77
- package/src/views/component/UserDetailView/index.vue +234 -234
- package/src/views/component/XCellDetailView/index.vue +217 -217
- package/src/views/component/XCellListView/index.vue +108 -129
- package/src/views/component/XFormAppraiseView/index.vue +174 -174
- package/src/views/component/XFormGroupView/index.vue +78 -82
- package/src/views/component/XFormView/index.vue +27 -27
- package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -118
- package/src/views/component/XOlMapView/index.vue +434 -434
- package/src/views/component/XOlMapView/testData.ts +64 -64
- package/src/views/component/XReportFormIframeView/index.vue +47 -47
- package/src/views/component/XReportFormView/index.vue +13 -13
- package/src/views/component/XReportGridView/index.vue +17 -17
- package/src/views/component/XRequestView/index.vue +234 -234
- package/src/views/component/XSignatureView/index.vue +50 -50
- package/src/views/component/index.vue +181 -181
- package/src/views/component/menu.vue +117 -117
- package/src/views/component/notice.vue +46 -46
- package/src/views/component/topNav.vue +36 -36
- package/src/views/external/index.vue +152 -0
- package/src/views/invoiceShow/index.vue +61 -61
- package/src/views/loading/AuthLoading.vue +345 -0
- package/src/views/user/login/ForgetPasswordForm.vue +94 -94
- package/src/views/user/login/LoginForm.vue +350 -347
- package/src/views/user/login/LoginTitle.vue +76 -76
- package/src/views/user/login/LoginWave.vue +109 -109
- package/src/views/user/login/index.vue +22 -22
- package/src/views/user/my/comm/ModifyPassword.vue +346 -346
- package/src/views/user/my/index.vue +507 -507
- package/src/views/user/register/index.vue +952 -952
- package/src/views/userRecords/AbnormalAlarmRecords.vue +21 -21
- package/src/views/userRecords/CardReplacementRecords.vue +21 -21
- package/src/views/userRecords/ChangeRecords.vue +19 -19
- package/src/views/userRecords/CommandViewRecords.vue +20 -20
- package/src/views/userRecords/GasCompensationRecords.vue +20 -20
- package/src/views/userRecords/InstrumentCollectionRecords.vue +21 -21
- package/src/views/userRecords/MeterRecords.vue +20 -20
- package/src/views/userRecords/OperateRecords.vue +51 -51
- package/src/views/userRecords/OtherChargeRecords.vue +19 -19
- package/src/views/userRecords/PaymentRecords.vue +28 -28
- package/src/views/userRecords/PriceAdjustmentRecords.vue +19 -19
- package/src/views/userRecords/ReplacementRecords.vue +19 -19
- package/src/views/userRecords/SafetyRecords.vue +19 -19
- package/src/views/userRecords/TransactionRecords.vue +21 -21
- package/src/views/userRecords/TransferRecords.vue +19 -19
- package/src/views/userRecords/operateRecordDetail/index.vue +316 -316
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/AddUserDetail.vue +124 -124
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/AdvanceDeliveryDetail.vue +88 -88
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/AutoAccountsCancelDetail.vue +205 -205
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/AutoAccountsDetail.vue +192 -192
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/BankDkDetail.vue +192 -192
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/BankPayDetail.vue +192 -192
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/BlacklistDetail.vue +153 -153
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/CancellationDetail.vue +101 -101
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/CardMeterCenterCancelDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/CardMeterCenterDetail.vue +153 -153
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/CardOverUserDetail.vue +153 -153
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/ChangeMeterCancelDetail.vue +166 -166
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/ChangeMeterDetail.vue +205 -205
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/DisableManageDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/EnableManageDetail.vue +114 -114
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/FaZheChangeDetail.vue +124 -124
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/FeeDeductionDetail.vue +153 -153
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/GasPriceChangeDetail.vue +126 -126
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/InputtorChangeDetail.vue +126 -126
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/IotMeterCenterCancelDetail.vue +114 -114
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/IotMeterCenterDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/IotOpenDetail.vue +88 -88
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/MachineCardDetail.vue +101 -101
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/MachineMeterCenterCancelDetail.vue +218 -218
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/MachineMeterCenterDetail.vue +153 -153
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/OffGasAddGasDetail.vue +140 -140
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/OtherChargeCancelDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/OtherChargeDetail.vue +114 -114
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/OverUserChangeDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/ReBillDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/RefundDetail.vue +114 -114
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/ReplaceCardManageCancelDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/ReplaceCardManageDetail.vue +114 -114
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/SaleCardGasDetail.vue +140 -140
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/TransferManageCancelDetail.vue +152 -152
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/TransferManageDetail.vue +178 -178
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/UserChangeDetail.vue +123 -123
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/WechatPayDetail.vue +192 -192
- package/src/views/userRecords/types.ts +66 -66
- package/tsconfig.json +39 -39
- package/uno.config.ts +82 -82
- package/vite.config.ts +119 -118
- package/src/router/types.ts +0 -7
- package/src/utils/wechatUtil.ts +0 -9
|
@@ -1,347 +1,350 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { FormInstance } from 'vant'
|
|
3
|
-
import { LoginStateEnum, useFormRules, useLoginState } from '@af-mobile-client-vue3/hooks/useLogin'
|
|
4
|
-
import GetAppDataService from '@af-mobile-client-vue3/plugins/AppData'
|
|
5
|
-
import { getUserPermissions } from '@af-mobile-client-vue3/services/api/search'
|
|
6
|
-
import { useSettingStore } from '@af-mobile-client-vue3/stores/modules/setting'
|
|
7
|
-
import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import {
|
|
27
|
-
import '
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const {
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
userState.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
window.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
window.
|
|
158
|
-
window.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
//
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
</VanCol>
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
</
|
|
328
|
-
<VanButton
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
</
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { FormInstance } from 'vant'
|
|
3
|
+
import { LoginStateEnum, useFormRules, useLoginState } from '@af-mobile-client-vue3/hooks/useLogin'
|
|
4
|
+
import GetAppDataService from '@af-mobile-client-vue3/plugins/AppData'
|
|
5
|
+
import { getUserPermissions } from '@af-mobile-client-vue3/services/api/search'
|
|
6
|
+
import { useSettingStore } from '@af-mobile-client-vue3/stores/modules/setting'
|
|
7
|
+
import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
|
|
8
|
+
import { UserType } from '@af-mobile-client-vue3/types/auth'
|
|
9
|
+
import { isWechat } from '@af-mobile-client-vue3/utils/platform-auth'
|
|
10
|
+
import { funcToRouter, loadRoutes } from '@af-mobile-client-vue3/utils/routerUtil'
|
|
11
|
+
import { secureStorageBatchWrite, secureStorageRead } from '@af-mobile-client-vue3/utils/secureStorage'
|
|
12
|
+
import {
|
|
13
|
+
closeToast,
|
|
14
|
+
showDialog,
|
|
15
|
+
showFailToast,
|
|
16
|
+
showLoadingToast,
|
|
17
|
+
Switch,
|
|
18
|
+
Button as VanButton,
|
|
19
|
+
Col as VanCol,
|
|
20
|
+
Field as VanField,
|
|
21
|
+
Form as VanForm,
|
|
22
|
+
Icon as VanIcon,
|
|
23
|
+
Loading as VanLoading,
|
|
24
|
+
Row as VanRow,
|
|
25
|
+
} from 'vant'
|
|
26
|
+
import { computed, inject, onBeforeMount, onMounted, reactive, ref, unref } from 'vue'
|
|
27
|
+
import { useRoute, useRouter } from 'vue-router'
|
|
28
|
+
import 'vant/lib/switch/index.css'
|
|
29
|
+
|
|
30
|
+
declare let WeixinJSBridge: any
|
|
31
|
+
const { setLoginState, getLoginState } = useLoginState()
|
|
32
|
+
const { getFormRules } = useFormRules()
|
|
33
|
+
const userState = useUserStore()
|
|
34
|
+
const router = useRouter()
|
|
35
|
+
|
|
36
|
+
const formRef = ref<FormInstance>()
|
|
37
|
+
const loading = ref(false)
|
|
38
|
+
const wxloading = ref(false)
|
|
39
|
+
const rememberMe = ref(false)
|
|
40
|
+
const switchPassType = ref(true)
|
|
41
|
+
const formData = reactive({
|
|
42
|
+
username: '',
|
|
43
|
+
password: '',
|
|
44
|
+
})
|
|
45
|
+
const route = useRoute()
|
|
46
|
+
const setting = useSettingStore()
|
|
47
|
+
|
|
48
|
+
const getShow = computed(() => (unref(getLoginState) === LoginStateEnum.LOGIN))
|
|
49
|
+
|
|
50
|
+
const login: any = inject('$login')
|
|
51
|
+
onBeforeMount(async () => {
|
|
52
|
+
if (isWechat() && setting.getSetting()?.wxAutoLogin) {
|
|
53
|
+
// 检测是否要开放微信登录
|
|
54
|
+
if (setting.getSetting()?.wechatLogin) {
|
|
55
|
+
try {
|
|
56
|
+
wxloading.value = true
|
|
57
|
+
if (route.query.code && route.query.state) {
|
|
58
|
+
const data = await userState.loginUnified({
|
|
59
|
+
unifiedCode: `${route.query.code}`,
|
|
60
|
+
tenantName: `${route.query.state}`,
|
|
61
|
+
loginMode: 'wechat',
|
|
62
|
+
resourceName: setting.getSetting()?.routerName || '智慧手机',
|
|
63
|
+
})
|
|
64
|
+
login.f = data
|
|
65
|
+
await Promise.all([GetAppDataService.load()])
|
|
66
|
+
const loginInfo = {
|
|
67
|
+
f: login.f,
|
|
68
|
+
jwt: login.f.id,
|
|
69
|
+
r: login.r,
|
|
70
|
+
}
|
|
71
|
+
userState.setLogin(loginInfo)
|
|
72
|
+
userState.setTenantName(Array.isArray(route.query.state) ? route.query.state[0] : route.query.state || '')
|
|
73
|
+
await afterGeneral(data.resources)
|
|
74
|
+
|
|
75
|
+
const toPath = decodeURIComponent((route.query?.redirect || '/') as string)
|
|
76
|
+
closeToast()
|
|
77
|
+
if (route.name === '/login')
|
|
78
|
+
await router.replace('/')
|
|
79
|
+
else await router.replace(toPath)
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
if (userState.getTenantName() !== '') {
|
|
83
|
+
closeWindows()
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
await showDialog({ message: '当前用户无登录权限' })
|
|
87
|
+
closeWindows()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
await showDialog({ message: '当前用户无登录权限' })
|
|
93
|
+
closeWindows()
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
wxloading.value = false
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
function handleSubmit() {
|
|
102
|
+
formRef.value
|
|
103
|
+
?.validate()
|
|
104
|
+
.then(async () => {
|
|
105
|
+
try {
|
|
106
|
+
loading.value = true
|
|
107
|
+
showLoadingToast('登录中...')
|
|
108
|
+
console.warn(setting)
|
|
109
|
+
const data: any = await userState.Login({
|
|
110
|
+
username: formData.username,
|
|
111
|
+
password: formData.password,
|
|
112
|
+
resourceName: setting.getSetting()?.routerName || '智慧手机',
|
|
113
|
+
})
|
|
114
|
+
login.f = data
|
|
115
|
+
await Promise.all([GetAppDataService.load()])
|
|
116
|
+
const loginInfo = {
|
|
117
|
+
f: login.f,
|
|
118
|
+
jwt: login.f.id,
|
|
119
|
+
r: login.r,
|
|
120
|
+
}
|
|
121
|
+
userState.setLogin(loginInfo)
|
|
122
|
+
const compatible = import.meta.env.VITE_APP_COMPATIBLE
|
|
123
|
+
if (compatible === 'OA')
|
|
124
|
+
await afterGeneral(data)
|
|
125
|
+
else
|
|
126
|
+
if (data.resources.data)
|
|
127
|
+
await afterGeneral(data.resources.data, data.access_token)
|
|
128
|
+
else
|
|
129
|
+
await afterGeneral(data.resources, data.access_token)
|
|
130
|
+
|
|
131
|
+
const toPath = decodeURIComponent((route.query?.redirect || '/') as string)
|
|
132
|
+
closeToast()
|
|
133
|
+
if (route.name === '/login')
|
|
134
|
+
await router.replace('/')
|
|
135
|
+
else await router.replace(toPath)
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
loading.value = false
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
.catch((e) => {
|
|
142
|
+
console.error(e)
|
|
143
|
+
showFailToast('用户名或密码错误')
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
function closeWindows() {
|
|
147
|
+
if (isWechat()) {
|
|
148
|
+
(window as any).WeixinJSBridge.call('closeWindow')
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
// 关闭页面
|
|
152
|
+
if (navigator.userAgent.includes('Firefox') || navigator.userAgent.includes('Chrome')) {
|
|
153
|
+
window.open('about:blank', '_self')
|
|
154
|
+
window.close()
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
window.opener = null
|
|
158
|
+
window.open('', '_self')
|
|
159
|
+
window.close()
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function afterGeneral(result, token = '') {
|
|
165
|
+
// 排序 functions 及其嵌套的 children
|
|
166
|
+
if (result.functions && Array.isArray(result.functions)) {
|
|
167
|
+
// 对顶层菜单进行排序
|
|
168
|
+
result.functions.sort((a, b) => (a.position || 0) - (b.position || 0))
|
|
169
|
+
|
|
170
|
+
// 对每个菜单的子项进行排序
|
|
171
|
+
for (const item of result.functions) {
|
|
172
|
+
if (item.children && Array.isArray(item.children)) {
|
|
173
|
+
item.children.sort((a, b) => (a.position || 0) - (b.position || 0))
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const user: any = {
|
|
179
|
+
...result,
|
|
180
|
+
username: result.ename,
|
|
181
|
+
avatar: result.avatar ? result.avatar : setting.getSetting()?.defaultAvatarUrl,
|
|
182
|
+
}
|
|
183
|
+
userState.setUserInfo(user)
|
|
184
|
+
// 设置用户类型为系统用户(传统登录方式)
|
|
185
|
+
userState.setUserType(UserType.SYSTEM)
|
|
186
|
+
// 如果result中没有返回 权限 需要主动获取权限列表
|
|
187
|
+
if (!result.permissions) {
|
|
188
|
+
result.permissions = await getUserPermissions(result.id)
|
|
189
|
+
}
|
|
190
|
+
userState.setPermissions(result.permissions)
|
|
191
|
+
userState.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
|
|
192
|
+
// 加载路由
|
|
193
|
+
loadRoutes(funcToRouter(user.functions))
|
|
194
|
+
|
|
195
|
+
// 存储登录数据到本地缓存
|
|
196
|
+
secureStorageBatchWrite([
|
|
197
|
+
{
|
|
198
|
+
key: 'loginData',
|
|
199
|
+
value: {
|
|
200
|
+
username: formData.username,
|
|
201
|
+
password: formData.password,
|
|
202
|
+
rememberMe: rememberMe.value,
|
|
203
|
+
token,
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
key: 'userData',
|
|
208
|
+
value: result,
|
|
209
|
+
},
|
|
210
|
+
])
|
|
211
|
+
|
|
212
|
+
// 每次重新登录时,清除indexedDB缓存
|
|
213
|
+
// indexedDB.clear()
|
|
214
|
+
}
|
|
215
|
+
async function wxLoginFun() {
|
|
216
|
+
await localStorage.setItem('wechatLoginPending', 'true')
|
|
217
|
+
userState.getCode(setting.getSetting()?.tenantName)
|
|
218
|
+
}
|
|
219
|
+
async function wxLoginFunContinue(code, state) {
|
|
220
|
+
try {
|
|
221
|
+
wxloading.value = true
|
|
222
|
+
const data = await userState.loginUnified({
|
|
223
|
+
unifiedCode: `${code}`,
|
|
224
|
+
tenantName: `${state}`,
|
|
225
|
+
loginMode: 'wechat',
|
|
226
|
+
resourceName: setting.getSetting()?.routerName || '智慧手机',
|
|
227
|
+
})
|
|
228
|
+
login.f = data
|
|
229
|
+
await Promise.all([GetAppDataService.load()])
|
|
230
|
+
const loginInfo = {
|
|
231
|
+
f: login.f,
|
|
232
|
+
jwt: login.f.id,
|
|
233
|
+
r: login.r,
|
|
234
|
+
}
|
|
235
|
+
userState.setLogin(loginInfo)
|
|
236
|
+
userState.setTenantName(Array.isArray(route.query.state) ? route.query.state[0] : route.query.state || '')
|
|
237
|
+
await afterGeneral(data.resources)
|
|
238
|
+
const toPath = decodeURIComponent((route.query?.redirect || '/') as string)
|
|
239
|
+
closeToast()
|
|
240
|
+
if (route.name === '/login')
|
|
241
|
+
await router.replace('/')
|
|
242
|
+
else await router.replace(toPath)
|
|
243
|
+
}
|
|
244
|
+
finally {
|
|
245
|
+
wxloading.value = false
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function getQueryParam(param: string): string | null {
|
|
249
|
+
const search = window.location.search || window.location.hash.split('?')[1] || ''
|
|
250
|
+
const params = new URLSearchParams(search)
|
|
251
|
+
return params.get(param)
|
|
252
|
+
}
|
|
253
|
+
onMounted(() => {
|
|
254
|
+
const pending = localStorage.getItem('wechatLoginPending')
|
|
255
|
+
const code = getQueryParam('code')
|
|
256
|
+
const state = getQueryParam('state')
|
|
257
|
+
if (pending && code && state) {
|
|
258
|
+
localStorage.removeItem('wechatLoginPending')
|
|
259
|
+
wxLoginFunContinue(code, state)
|
|
260
|
+
}
|
|
261
|
+
try {
|
|
262
|
+
// 手机登录获取本地缓存的登录数据
|
|
263
|
+
secureStorageRead('loginData', (result: any) => {
|
|
264
|
+
if (result.status === 'success') {
|
|
265
|
+
const res = JSON.parse(result.data.value)
|
|
266
|
+
if (res.rememberMe) {
|
|
267
|
+
formData.username = res.username
|
|
268
|
+
formData.password = res.password
|
|
269
|
+
rememberMe.value = res.rememberMe
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
}
|
|
274
|
+
catch (e) {
|
|
275
|
+
console.warn('读取本地缓存失败', e)
|
|
276
|
+
// 未拿到跳过
|
|
277
|
+
}
|
|
278
|
+
})
|
|
279
|
+
</script>
|
|
280
|
+
|
|
281
|
+
<template>
|
|
282
|
+
<div v-show="wxloading" class="login_form">
|
|
283
|
+
<VanRow justify="center">
|
|
284
|
+
<VanLoading type="spinner" size="30px" vertical color="#1989fa">
|
|
285
|
+
自动登录中...
|
|
286
|
+
</VanLoading>
|
|
287
|
+
</VanRow>
|
|
288
|
+
</div>
|
|
289
|
+
<div v-if="getShow && !wxloading" class="login_form form">
|
|
290
|
+
<VanForm ref="formRef" @submit="handleSubmit">
|
|
291
|
+
<VanField
|
|
292
|
+
v-model="formData.username"
|
|
293
|
+
class="form_field"
|
|
294
|
+
name="username"
|
|
295
|
+
label="账号"
|
|
296
|
+
placeholder="请输入账号"
|
|
297
|
+
label-align="top"
|
|
298
|
+
:rules="getFormRules.username"
|
|
299
|
+
/>
|
|
300
|
+
<VanField
|
|
301
|
+
v-model="formData.password"
|
|
302
|
+
class="form_field"
|
|
303
|
+
:type="switchPassType ? 'password' : 'text'"
|
|
304
|
+
name="password"
|
|
305
|
+
label="密码"
|
|
306
|
+
placeholder="请输入密码"
|
|
307
|
+
label-align="top"
|
|
308
|
+
:rules="getFormRules.password"
|
|
309
|
+
@click-right-icon="switchPassType = !switchPassType"
|
|
310
|
+
>
|
|
311
|
+
<template #right-icon>
|
|
312
|
+
<VanIcon v-if="switchPassType" name="closed-eye" color="rgb(56, 149, 250)" />
|
|
313
|
+
<VanIcon v-else name="eye-o" color="rgb(56, 149, 250)" />
|
|
314
|
+
</template>
|
|
315
|
+
</VanField>
|
|
316
|
+
|
|
317
|
+
<VanRow justify="space-between" class="extra_setting">
|
|
318
|
+
<VanCol>
|
|
319
|
+
<div class="extra_setting_for_remember_password">
|
|
320
|
+
<Switch v-model="rememberMe" size="12px" />
|
|
321
|
+
<span>记住密码</span>
|
|
322
|
+
</div>
|
|
323
|
+
</VanCol>
|
|
324
|
+
<!-- <VanCol>
|
|
325
|
+
<a class="extra_setting_for_reset_password" @click="setLoginState(LoginStateEnum.RESET_PASSWORD)">忘记密码?</a>
|
|
326
|
+
</VanCol> -->
|
|
327
|
+
</VanRow>
|
|
328
|
+
<VanButton class="login_btn btn" type="primary" block native-type="submit" :loading="loading">
|
|
329
|
+
登 录
|
|
330
|
+
</VanButton>
|
|
331
|
+
<VanButton
|
|
332
|
+
v-show="setting.getSetting()?.wxLoginAge && isWechat()"
|
|
333
|
+
class="wechat-login-btn btn"
|
|
334
|
+
type="primary"
|
|
335
|
+
block
|
|
336
|
+
native-type="button"
|
|
337
|
+
:loading="wxloading"
|
|
338
|
+
style="background-color: #07C160; border-color: #07C160; margin-top: 15px"
|
|
339
|
+
@click="wxLoginFun"
|
|
340
|
+
>
|
|
341
|
+
<VanIcon name="wechat" size="20px" />
|
|
342
|
+
微信登录
|
|
343
|
+
</VanButton>
|
|
344
|
+
</VanForm>
|
|
345
|
+
</div>
|
|
346
|
+
</template>
|
|
347
|
+
|
|
348
|
+
<style scoped lang="less">
|
|
349
|
+
@import '@af-mobile-client-vue3/styles/login.less';
|
|
350
|
+
</style>
|