af-mobile-client-vue3 1.2.56 → 1.2.59

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.2.56",
4
+ "version": "1.2.59",
5
5
  "packageManager": "pnpm@10.12.3",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -1,10 +1,12 @@
1
1
  import { getConfigByNameAsync } from '@af-mobile-client-vue3/services/api/common'
2
2
  import { APP_WEB_CONFIG_KEY } from '@af-mobile-client-vue3/stores/mutation-type'
3
+ import { secureStorageBatchWrite } from '@af-mobile-client-vue3/utils/secureStorage'
3
4
  import { createStorage } from '@af-mobile-client-vue3/utils/Storage'
4
5
  import { defineStore } from 'pinia'
5
6
  import { ref } from 'vue'
6
7
 
7
8
  export interface WebConfig {
9
+ isAttendance: boolean | false
8
10
  systemName: string
9
11
  routerName: string
10
12
  systemDesc: string
@@ -14,6 +16,9 @@ export interface WebConfig {
14
16
  wxLoginAge: boolean
15
17
  wxAutoLogin: string
16
18
  tenantName: string
19
+ systemLogo: string
20
+ homeAppList: Array<any>
21
+ slideshowList: Array<any>
17
22
  }
18
23
 
19
24
  // 存放 webConfig 中的 setting 配置
@@ -45,6 +50,15 @@ export const useSettingStore = defineStore('setting', () => {
45
50
  useStore.set(APP_WEB_CONFIG_KEY, res)
46
51
  console.log('res.setting', res.setting)
47
52
  setSetting(res.setting)
53
+ // 如果有pos相关的配置存储到app安全存储中
54
+ if (res.setting.posConfig) {
55
+ secureStorageBatchWrite([
56
+ {
57
+ key: 'posConfig',
58
+ value: res.setting.posConfig,
59
+ },
60
+ ])
61
+ }
48
62
  }
49
63
  }
50
64
 
@@ -1,97 +1,97 @@
1
- <script setup lang="ts">
2
- import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
- import { runLogic } from '@af-mobile-client-vue3/services/api/common'
4
- import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
5
- import dayjs from 'dayjs/esm/index'
6
- import { showToast } from 'vant'
7
- import { onMounted, ref } from 'vue'
8
- import { useRoute } from 'vue-router'
9
-
10
- const configName = ref('appapplyuserinfoFormGroup')
11
- const serviceName = ref('af-apply')
12
- const route = useRoute()
13
- const userInfo = useUserStore().getUserInfo()
14
- const workflowId = ref('3045')
15
- const userinfoid = ref('93116')
16
- const model = ref('编辑')
17
- const groupFormData = ref({})
18
-
19
- function submit(res) {
20
- if (model.value === '新增') {
21
- res.t_userinfo.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
22
- res.t_userinfo.f_orgid = userInfo.f_orgid
23
- res.t_userinfo.f_orgname = userInfo.f_orgname
24
- res.t_userinfo.f_depid = userInfo.f_depid
25
- res.t_userinfo.f_depname = userInfo.f_depname
26
- res.t_userinfo.f_operatorid = userInfo.f_operatorid
27
- res.t_userinfo.f_operator = userInfo.f_operator
28
- res.t_userinfo.f_workflow_id = this.f_workflow_id
29
- res.t_userinfo.f_user_state = '预备'
30
-
31
- res.t_userfiles.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
32
- res.t_userfiles.f_orgid = userInfo.f_orgid
33
- res.t_userfiles.f_orgname = userInfo.f_orgname
34
- res.t_userfiles.f_depid = userInfo.f_depid
35
- res.t_userfiles.f_depname = userInfo.f_depname
36
- res.t_userfiles.f_operatorid = userInfo.f_operatorid
37
- res.t_userfiles.f_operator = userInfo.f_operator
38
- res.t_userfiles.f_workflow_id = this.f_workflow_id
39
- res.t_userfiles.f_table_state = '待开通'
40
- }
41
- let saveData = res
42
- if (saveData.t_userfiles.f_gasbrand_id.length > 0) {
43
- saveData.t_userfiles.f_gasbrand_id = saveData.t_userfiles.f_gasbrand_id[0]
44
- }
45
- if (saveData.t_userfiles.f_price_id.length > 0) {
46
- saveData.t_userfiles.f_price_id = saveData.t_userfiles.f_price_id[0]
47
- }
48
- if (model.value === '编辑') {
49
- saveData = Object.assign(saveData, {
50
- f_operator_record: userInfo.f_operator,
51
- f_operatorid_record: userInfo.f_operatorid,
52
- f_orgid_record: userInfo.f_orgid,
53
- f_orgname_record: userInfo.f_orgname,
54
- f_depid_record: userInfo.f_depid,
55
- f_depname_record: userInfo.f_depname,
56
- })
57
- }
58
- runLogic('userFIleSaveLogic', saveData, 'af-revenue').then((res) => {
59
- showToast('操作成功!')
60
- history.back()
61
- })
62
- }
63
- const isInit = ref(false)
64
- function init() {
65
- if (model.value === '编辑') {
66
- runLogic('getFileDetailForEdit', { f_userinfo_id: userinfoid.value }, 'af-revenue').then((res) => {
67
- // if (res.t_userfiles.f_gasmodel_id) {
68
- // res.t_userfiles.f_gasmodel_id = 76
69
- // }
70
- // if (res.t_userfiles.f_price_id) {
71
- // res.t_userfiles.f_price_id = [res.t_userfiles.f_price_id]
72
- // }
73
- console.log('1111111----,', res)
74
- groupFormData.value = res
75
- isInit.value = true
76
- })
77
- }
78
- }
79
- onMounted(() => {
80
- init()
81
- })
82
- </script>
83
-
84
- <template>
85
- <XFormGroup
86
- v-if="isInit"
87
- mode="修改"
88
- :config-name="configName"
89
- :service-name="serviceName"
90
- :group-form-data="groupFormData"
91
- @submit="submit"
92
- />
93
- </template>
94
-
95
- <style scoped lang="less">
96
-
97
- </style>
1
+ <script setup lang="ts">
2
+ import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
+ import { runLogic } from '@af-mobile-client-vue3/services/api/common'
4
+ import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
5
+ import dayjs from 'dayjs/esm/index'
6
+ import { showToast } from 'vant'
7
+ import { onMounted, ref } from 'vue'
8
+ import { useRoute } from 'vue-router'
9
+
10
+ const configName = ref('appapplyuserinfoFormGroup')
11
+ const serviceName = ref('af-apply')
12
+ const route = useRoute()
13
+ const userInfo = useUserStore().getUserInfo()
14
+ const workflowId = ref('3045')
15
+ const userinfoid = ref('93116')
16
+ const model = ref('编辑')
17
+ const groupFormData = ref({})
18
+
19
+ function submit(res) {
20
+ if (model.value === '新增') {
21
+ res.t_userinfo.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
22
+ res.t_userinfo.f_orgid = userInfo.f_orgid
23
+ res.t_userinfo.f_orgname = userInfo.f_orgname
24
+ res.t_userinfo.f_depid = userInfo.f_depid
25
+ res.t_userinfo.f_depname = userInfo.f_depname
26
+ res.t_userinfo.f_operatorid = userInfo.f_operatorid
27
+ res.t_userinfo.f_operator = userInfo.f_operator
28
+ res.t_userinfo.f_workflow_id = this.f_workflow_id
29
+ res.t_userinfo.f_user_state = '预备'
30
+
31
+ res.t_userfiles.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
32
+ res.t_userfiles.f_orgid = userInfo.f_orgid
33
+ res.t_userfiles.f_orgname = userInfo.f_orgname
34
+ res.t_userfiles.f_depid = userInfo.f_depid
35
+ res.t_userfiles.f_depname = userInfo.f_depname
36
+ res.t_userfiles.f_operatorid = userInfo.f_operatorid
37
+ res.t_userfiles.f_operator = userInfo.f_operator
38
+ res.t_userfiles.f_workflow_id = this.f_workflow_id
39
+ res.t_userfiles.f_table_state = '待开通'
40
+ }
41
+ let saveData = res
42
+ if (saveData.t_userfiles.f_gasbrand_id.length > 0) {
43
+ saveData.t_userfiles.f_gasbrand_id = saveData.t_userfiles.f_gasbrand_id[0]
44
+ }
45
+ if (saveData.t_userfiles.f_price_id.length > 0) {
46
+ saveData.t_userfiles.f_price_id = saveData.t_userfiles.f_price_id[0]
47
+ }
48
+ if (model.value === '编辑') {
49
+ saveData = Object.assign(saveData, {
50
+ f_operator_record: userInfo.f_operator,
51
+ f_operatorid_record: userInfo.f_operatorid,
52
+ f_orgid_record: userInfo.f_orgid,
53
+ f_orgname_record: userInfo.f_orgname,
54
+ f_depid_record: userInfo.f_depid,
55
+ f_depname_record: userInfo.f_depname,
56
+ })
57
+ }
58
+ runLogic('userFIleSaveLogic', saveData, 'af-revenue').then((res) => {
59
+ showToast('操作成功!')
60
+ history.back()
61
+ })
62
+ }
63
+ const isInit = ref(false)
64
+ function init() {
65
+ if (model.value === '编辑') {
66
+ runLogic('getFileDetailForEdit', { f_userinfo_id: userinfoid.value }, 'af-revenue').then((res) => {
67
+ // if (res.t_userfiles.f_gasmodel_id) {
68
+ // res.t_userfiles.f_gasmodel_id = 76
69
+ // }
70
+ // if (res.t_userfiles.f_price_id) {
71
+ // res.t_userfiles.f_price_id = [res.t_userfiles.f_price_id]
72
+ // }
73
+ console.log('1111111----,', res)
74
+ groupFormData.value = res
75
+ isInit.value = true
76
+ })
77
+ }
78
+ }
79
+ onMounted(() => {
80
+ init()
81
+ })
82
+ </script>
83
+
84
+ <template>
85
+ <XFormGroup
86
+ v-if="isInit"
87
+ mode="修改"
88
+ :config-name="configName"
89
+ :service-name="serviceName"
90
+ :group-form-data="groupFormData"
91
+ @submit="submit"
92
+ />
93
+ </template>
94
+
95
+ <style scoped lang="less">
96
+
97
+ </style>
@@ -5,13 +5,14 @@ import GetAppDataService from '@af-mobile-client-vue3/plugins/AppData'
5
5
  import { getUserPermissions } from '@af-mobile-client-vue3/services/api/search'
6
6
  import { useSettingStore } from '@af-mobile-client-vue3/stores/modules/setting'
7
7
  import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
8
- import { indexedDB } from '@af-mobile-client-vue3/utils/indexedDB'
9
8
  import { funcToRouter, loadRoutes } from '@af-mobile-client-vue3/utils/routerUtil'
9
+ import { secureStorageBatchWrite, secureStorageRead } from '@af-mobile-client-vue3/utils/secureStorage'
10
10
  import { isWechat } from '@af-mobile-client-vue3/utils/wechatUtil'
11
11
  import {
12
12
  closeToast,
13
13
  showDialog,
14
14
  showFailToast,
15
+ showLoadingToast,
15
16
  Switch,
16
17
  Button as VanButton,
17
18
  Col as VanCol,
@@ -102,6 +103,8 @@ function handleSubmit() {
102
103
  .then(async () => {
103
104
  try {
104
105
  loading.value = true
106
+ showLoadingToast('登录中...')
107
+ console.warn(setting)
105
108
  const data: any = await userState.Login({
106
109
  username: formData.username,
107
110
  password: formData.password,
@@ -158,6 +161,19 @@ function closeWindows() {
158
161
  }
159
162
 
160
163
  async function afterGeneral(result) {
164
+ // 排序 functions 及其嵌套的 children
165
+ if (result.functions && Array.isArray(result.functions)) {
166
+ // 对顶层菜单进行排序
167
+ result.functions.sort((a, b) => (a.position || 0) - (b.position || 0))
168
+
169
+ // 对每个菜单的子项进行排序
170
+ for (const item of result.functions) {
171
+ if (item.children && Array.isArray(item.children)) {
172
+ item.children.sort((a, b) => (a.position || 0) - (b.position || 0))
173
+ }
174
+ }
175
+ }
176
+
161
177
  const user: any = {
162
178
  ...result,
163
179
  username: result.ename,
@@ -172,8 +188,25 @@ async function afterGeneral(result) {
172
188
  userState.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
173
189
  // 加载路由
174
190
  loadRoutes(funcToRouter(user.functions))
191
+
192
+ // 存储登录数据到本地缓存
193
+ secureStorageBatchWrite([
194
+ {
195
+ key: 'loginData',
196
+ value: {
197
+ username: formData.username,
198
+ password: formData.password,
199
+ rememberMe: rememberMe.value,
200
+ },
201
+ },
202
+ {
203
+ key: 'userData',
204
+ value: result,
205
+ },
206
+ ])
207
+
175
208
  // 每次重新登录时,清除indexedDB缓存
176
- indexedDB.clear()
209
+ // indexedDB.clear()
177
210
  }
178
211
  async function wxLoginFun() {
179
212
  await localStorage.setItem('wechatLoginPending', 'true')
@@ -221,6 +254,23 @@ onMounted(() => {
221
254
  localStorage.removeItem('wechatLoginPending')
222
255
  wxLoginFunContinue(code, state)
223
256
  }
257
+ try {
258
+ // 手机登录获取本地缓存的登录数据
259
+ secureStorageRead('loginData', (result: any) => {
260
+ if (result.status === 'success') {
261
+ const res = JSON.parse(result.data.value)
262
+ if (res.rememberMe) {
263
+ formData.username = res.username
264
+ formData.password = res.password
265
+ rememberMe.value = res.rememberMe
266
+ }
267
+ }
268
+ })
269
+ }
270
+ catch (e) {
271
+ console.warn('读取本地缓存失败', e)
272
+ // 未拿到跳过
273
+ }
224
274
  })
225
275
  </script>
226
276
 
@@ -267,9 +317,9 @@ onMounted(() => {
267
317
  <span>记住密码</span>
268
318
  </div>
269
319
  </VanCol>
270
- <VanCol>
320
+ <!-- <VanCol>
271
321
  <a class="extra_setting_for_reset_password" @click="setLoginState(LoginStateEnum.RESET_PASSWORD)">忘记密码?</a>
272
- </VanCol>
322
+ </VanCol> -->
273
323
  </VanRow>
274
324
  <VanButton class="login_btn btn" type="primary" block native-type="submit" :loading="loading">
275
325
  登 录