af-mobile-client-vue3 1.2.56 → 1.2.57

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.
@@ -1,57 +1,57 @@
1
- /**
2
- * 根据类型获取日期区间字符串
3
- * @param type '当年' | 'curMonth' | '当日'
4
- * @param show 区分实际值还是显示值, true为实际值, false为显示值
5
- * @returns [start, end] 例:['2024-01-01 00:00:00', '2024-12-31 23:59:59']
6
- */
7
- export function getRangeByType(type: string, show: boolean): [string, string] {
8
- const now = new Date()
9
- const year = now.getFullYear()
10
- const month = (now.getMonth() + 1).toString().padStart(2, '0')
11
- const day = now.getDate().toString().padStart(2, '0')
12
-
13
- if (!show) {
14
- if (type === 'curYear') {
15
- return [
16
- `${year}-01-01 00:00:00`,
17
- `${year}-12-31 23:59:59`,
18
- ]
19
- }
20
- if (type === 'curMonth') {
21
- const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
22
- return [
23
- `${year}-${month}-01 00:00:00`,
24
- `${year}-${month}-${lastDay.toString().padStart(2, '0')} 23:59:59`,
25
- ]
26
- }
27
- if (type === 'curDay') {
28
- return [
29
- `${year}-${month}-${day} 00:00:00`,
30
- `${year}-${month}-${day} 23:59:59`,
31
- ]
32
- }
33
- }
34
- if (show) {
35
- if (type === 'curYear') {
36
- return [
37
- `${year}-01-01`,
38
- `${year}-12-31`,
39
- ]
40
- }
41
- if (type === 'curMonth') {
42
- const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
43
- return [
44
- `${year}-${month}-01`,
45
- `${year}-${month}-${lastDay.toString().padStart(2, '0')}`,
46
- ]
47
- }
48
- if (type === 'curDay') {
49
- return [
50
- `${year}-${month}-${day}`,
51
- `${year}-${month}-${day}`,
52
- ]
53
- }
54
- }
55
- // 兜底返回空字符串数组
56
- return ['', '']
57
- }
1
+ /**
2
+ * 根据类型获取日期区间字符串
3
+ * @param type '当年' | 'curMonth' | '当日'
4
+ * @param show 区分实际值还是显示值, true为实际值, false为显示值
5
+ * @returns [start, end] 例:['2024-01-01 00:00:00', '2024-12-31 23:59:59']
6
+ */
7
+ export function getRangeByType(type: string, show: boolean): [string, string] {
8
+ const now = new Date()
9
+ const year = now.getFullYear()
10
+ const month = (now.getMonth() + 1).toString().padStart(2, '0')
11
+ const day = now.getDate().toString().padStart(2, '0')
12
+
13
+ if (!show) {
14
+ if (type === 'curYear') {
15
+ return [
16
+ `${year}-01-01 00:00:00`,
17
+ `${year}-12-31 23:59:59`,
18
+ ]
19
+ }
20
+ if (type === 'curMonth') {
21
+ const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
22
+ return [
23
+ `${year}-${month}-01 00:00:00`,
24
+ `${year}-${month}-${lastDay.toString().padStart(2, '0')} 23:59:59`,
25
+ ]
26
+ }
27
+ if (type === 'curDay') {
28
+ return [
29
+ `${year}-${month}-${day} 00:00:00`,
30
+ `${year}-${month}-${day} 23:59:59`,
31
+ ]
32
+ }
33
+ }
34
+ if (show) {
35
+ if (type === 'curYear') {
36
+ return [
37
+ `${year}-01-01`,
38
+ `${year}-12-31`,
39
+ ]
40
+ }
41
+ if (type === 'curMonth') {
42
+ const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
43
+ return [
44
+ `${year}-${month}-01`,
45
+ `${year}-${month}-${lastDay.toString().padStart(2, '0')}`,
46
+ ]
47
+ }
48
+ if (type === 'curDay') {
49
+ return [
50
+ `${year}-${month}-${day}`,
51
+ `${year}-${month}-${day}`,
52
+ ]
53
+ }
54
+ }
55
+ // 兜底返回空字符串数组
56
+ return ['', '']
57
+ }
@@ -1,157 +1,147 @@
1
1
  <script setup lang="ts">
2
2
  import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
- import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
- import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
5
- import { defineEmits, ref } from 'vue'
3
+ import { defineOptions, onActivated, onMounted, ref } from 'vue'
6
4
  import { useRouter } from 'vue-router'
7
5
 
8
- // 定义事件
9
- const emit = defineEmits(['deleteRow'])
10
- const userInfo = useUserStore().getUserInfo()
11
- // 访问路由
6
+ defineOptions({ name: 'XCellListView' })
7
+ const configName = ref('ApplyMobileProcessCRUD')
8
+ const serviceName = ref('af-apply')
12
9
  const router = useRouter()
13
- // 获取默认值
14
- const idKey = ref('o_id')
15
-
16
- // 简易crud表单测试
17
- // const configName = ref('orderCarInMobileCRUD')
18
- // const serviceName = ref('af-gaslink')
19
- // const configName = ref('lngPriceManageMobileCRUD')
20
- const configName = ref('测试2')
21
- const serviceName = ref('af-gaslink')
22
- // const configName = ref('mobile_liushuiQueryCRUD')
23
- // const serviceName = ref('af-revenue')
24
-
25
- // 资源权限测试
26
- // const configName = ref('crud_sources_test')
27
- // const serviceName = ref('af-system')
28
-
29
- // 实际业务测试
30
- // const configName = ref('lngChargeAuditMobileCRUD')
31
- // const serviceName = ref('af-gaslink')
32
-
33
- // 跳转到详情页面
34
- // function toDetail(item) {
35
- // router.push({
36
- // name: 'XCellDetailView',
37
- // params: { id: item[idKey.value] }, // 如果使用命名路由,推荐使用路由参数而不是直接构建 URL
38
- // query: {
39
- // operName: item[operNameKey.value],
40
- // method:item[methodKey.value],
41
- // requestMethod:item[requestMethodKey.value],
42
- // operatorType:item[operatorTypeKey.value],
43
- // operUrl:item[operUrlKey.value],
44
- // operIp:item[operIpKey.value],
45
- // costTime:item[costTimeKey.value],
46
- // operTime:item[operTimeKey.value],
47
- //
48
- // title: item[titleKey.value],
49
- // businessType: item[businessTypeKey.value],
50
- // status:item[statusKey.value]
51
- // }
52
- // })
53
- // }
54
-
55
- // 跳转到表单——以表单组来渲染纯表单
56
- function toDetail(item) {
57
- router.push({
58
- name: 'xformgroup222',
59
- // query: {
60
- // id: item[idKey.value],
61
- // id: item.rr_id,
62
- // o_id: item.o_id,
63
- // },
64
- })
10
+ // 删除功能
11
+ function phone(result) {
12
+ // todo 调用真机进行通话
65
13
  }
66
-
67
- // 新增功能
68
- // function addOption(totalCount) {
69
- // router.push({
70
- // name: 'XFormView',
71
- // params: { id: totalCount, openid: totalCount },
72
- // query: {
73
- // configName: configName.value,
74
- // serviceName: serviceName.value,
75
- // mode: '新增',
76
- // },
77
- // })
78
- // }
79
- function addOption() {
80
- console.log('用户----', userInfo)
81
- router.push({
82
- name: 'XFormGroupView',
83
- // params: { id: totalCount.value },
84
- // query: {
85
- // configName: configName.value,
86
- // serviceName: serviceName.value,
87
- // mode: '新增',
88
- // },
89
- })
90
- // 如果存在回调函数,调用它并传递true表示已处理
91
- // if (typeof callback === 'function') {
92
- // callback(true)
93
- // }
14
+ // 跳转流程处理
15
+ function action(row) {
16
+ router.push({ name: 'XFormGroupView', query: { workflowId: row.ab_f_workflow_id, stepId: row.ws_f_step_id } })
94
17
  }
95
-
96
- // 修改功能
97
- function updateRow(result) {
98
- console.log('用户----', userInfo)
99
- router.push({
100
- name: 'XFormView',
101
- params: { id: 1, openid: 2 },
102
- query: {
103
- configName: configName.value,
104
- serviceName: serviceName.value,
105
- mode: '修改',
106
- },
107
- })
108
- }
109
-
110
- // 删除功能
111
- function deleteRow(result) {
112
- emit('deleteRow', result.o_id)
18
+ // 工作日志
19
+ function worklog(row) {
20
+ router.push({ name: 'worklog', query: { workflowid: row.ab_f_workflow_id, defname: row.ws_f_name } })
113
21
  }
22
+ onMounted(() => {
23
+ console.log('初始化页面===')
24
+ })
25
+ onActivated(() => {
26
+ // 每次回到页面都会触发
27
+ console.log('activated: 每次回到页面都会触发')
28
+ })
114
29
  </script>
115
30
 
116
31
  <template>
117
- <NormalDataLayout id="XCellListView" title="工作计划">
118
- <template #layout_content>
119
- <!-- <XCellList -->
120
- <!-- :config-name="configName" -->
121
- <!-- :service-name="serviceName" -->
122
- <!-- :custom-add="true" -->
123
- <!-- :custom-edit="true" -->
124
- <!-- :id-key="idKey" -->
125
- <!-- @to-detail="toDetail" -->
126
- <!-- @delete-row="deleteRow" -->
127
- <!-- @update="updateRow" -->
128
- <!-- @add="addOption" -->
129
- <!-- /> -->
130
-
131
- <!-- :fix-query-form="{ u_f_price_state: ['生效', '待生效'] }" -->
132
-
133
- <!-- <XCellList -->
134
- <!-- config-name="ApplyMobileSuperviseCRUD" -->
135
- <!-- service-name="af-apply" -->
136
- <!-- @to-detail="toDetail" -->
137
- <!-- @delete-row="deleteRow" -->
138
- <!-- /> -->
139
-
140
- <!-- <XCellList -->
141
- <!-- service-name="af-revenue" -->
142
- <!-- config-name="userfiles_sel_address" -->
143
- <!-- @to-detail="toDetail" -->
144
- <!-- /> -->
145
- <XCellList
146
- service-name="af-apply"
147
- config-name="ApplyMobileProcessCRUD"
148
- :custom-add="true"
149
- @to-detail="toDetail"
150
- @add="addOption"
151
- />
152
- </template>
153
- </NormalDataLayout>
32
+ <XCellList
33
+ :config-name="configName"
34
+ :service-name="serviceName"
35
+ @phone="phone"
36
+ @action="action"
37
+ @worklog="worklog"
38
+ />
154
39
  </template>
155
40
 
156
41
  <style scoped lang="less">
42
+ .cell-search-after {
43
+ padding: 0 12px 12px 12px;
44
+ background-color: #fff;
45
+ .van-row:first-child {
46
+ align-items: center;
47
+ margin-bottom: 8px;
48
+ padding: 0 2px;
49
+ h4 {
50
+ font-size: 1.08rem;
51
+ font-weight: 600;
52
+ margin: 0;
53
+ color: #222;
54
+ letter-spacing: 1px;
55
+ }
56
+ .stat-date-range {
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: flex-end;
60
+ font-size: 0.92rem;
61
+ color: #b0b3b8;
62
+ font-weight: 400;
63
+ span {
64
+ margin-left: 4px;
65
+ font-size: 0.92rem;
66
+ color: #b0b3b8;
67
+ }
68
+ .van-icon {
69
+ font-size: 1rem;
70
+ color: #b0b3b8;
71
+ margin-right: 2px;
72
+ }
73
+ }
74
+ }
75
+ .van-row:nth-child(2) {
76
+ margin-top: 8px;
77
+ // 统计卡片间距由gutter控制
78
+ .van-col {
79
+ // 让卡片宽度自适应
80
+ .stat-card {
81
+ width: 100%;
82
+ }
83
+ }
84
+ }
85
+ .stat-card {
86
+ display: flex;
87
+ flex-direction: column;
88
+ align-items: center;
89
+ justify-content: center;
90
+ border-radius: 12px;
91
+ padding: 6px 0 4px 0; // 压缩高度
92
+ min-height: 44px; // 压缩高度
93
+ position: relative;
94
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
95
+ background: #f7f8fa;
96
+ .stat-num {
97
+ font-size: 1.08rem; // 缩小字体
98
+ font-weight: 600;
99
+ margin-bottom: 2px;
100
+ }
101
+ .stat-label {
102
+ font-size: 0.82rem; // 缩小字体
103
+ margin-bottom: 2px;
104
+ }
105
+ .stat-icon {
106
+ position: absolute;
107
+ top: 6px;
108
+ right: 8px;
109
+ font-size: 1rem;
110
+ opacity: 0.4;
111
+ }
112
+ }
113
+ .stat-total {
114
+ background: #f0f5ff;
115
+ color: #2f54eb;
116
+ .stat-num,
117
+ .stat-label {
118
+ color: #2f54eb;
119
+ }
120
+ .stat-icon {
121
+ color: #2f54eb;
122
+ }
123
+ }
124
+ .stat-done {
125
+ background: #e6fffb;
126
+ color: #13c2c2;
127
+ .stat-num,
128
+ .stat-label {
129
+ color: #13c2c2;
130
+ }
131
+ .stat-icon {
132
+ color: #13c2c2;
133
+ }
134
+ }
135
+ .stat-processing {
136
+ background: #f9f0ff;
137
+ color: #b37feb;
138
+ .stat-num,
139
+ .stat-label {
140
+ color: #b37feb;
141
+ }
142
+ .stat-icon {
143
+ color: #b37feb;
144
+ }
145
+ }
146
+ }
157
147
  </style>
@@ -1,35 +1,36 @@
1
1
  <script setup lang="ts">
2
2
  import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
+ import XFormView from '@af-mobile-client-vue3/views/component/XFormView/index.vue'
3
4
  import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
5
  import { showDialog } from 'vant'
5
6
  import { ref } from 'vue'
6
7
  import { useRoute } from 'vue-router'
7
8
 
8
- // const configName = ref('reviewFormGroup')
9
- // const serviceName = ref('af-revenue')
10
-
11
9
  // 纯表单
12
- // const configName = ref('form_check_test')
13
- // const serviceName = ref('af-system')
10
+ const configName = ref('appapplyuserinfoFormGroup')
11
+ const serviceName = ref('af-apply')
14
12
 
15
13
  // const configName = ref("计划下发Form")
16
14
  // const serviceName = ref("af-linepatrol")
17
15
 
18
16
  // 表单组
19
- const configName = ref('lngChargeAuditMobileFormGroup')
20
- const serviceName = ref('af-gaslink')
17
+ // const configName = ref('lngChargeAuditMobileFormGroup')
18
+ // const serviceName = ref('af-gaslink')
21
19
 
22
20
  const formData = ref({})
23
21
  const formGroup = ref(null)
24
22
  const route = useRoute()
25
23
  const isInit = ref(false)
26
24
  function submit(_result) {
27
- showDialog({ message: '提交成功' }).then(() => {
28
- console.log('12121')
29
- // history.back()
30
- })
25
+ showDialog({ message: '提交成功' })
26
+ history.back()
27
+ }
28
+ const myXForm = ref([])
29
+ function setRef(value: any) {
30
+ console.log('myXForm', myXForm)
31
+ formGroup.value.setRef(myXForm.value)
32
+ console.log(formGroup)
31
33
  }
32
-
33
34
  // 表单组——数据
34
35
  // function initComponents () {
35
36
  // runLogic('getlngChargeAuditMobileFormGroupData', {id: 29}, 'af-gaslink').then((res) => {
@@ -67,12 +68,16 @@ function submit(_result) {
67
68
  <!-- v-if="isInit" -->
68
69
  <XFormGroup
69
70
  ref="formGroup"
70
- config-name="ceshi11111FormGroup"
71
- service-name="af-apply"
71
+ :config-name="configName"
72
+ :service-name="serviceName"
72
73
  :group-form-data="formData"
73
74
  mode="新增"
74
75
  @submit="submit"
75
- />
76
+ >
77
+ <!-- <template #device="{ setRef, removeRef, item, formData }">
78
+ <XFormView :setRef="setRef" :formGroupName="'myXForm'"/>
79
+ </template>-->
80
+ </XFormGroup>
76
81
  </template>
77
82
  </NormalDataLayout>
78
83
  </template>
@@ -1,25 +1,105 @@
1
1
  <script setup lang="ts">
2
+ // 组件顶部功能说明:本组件为表单视图,支持通过 setRef 注册自身到父组件
2
3
  import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
3
- import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
- import { ref } from 'vue'
4
+ import { post } from '@af-mobile-client-vue3/services/restTools'
5
+ import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
6
+ import dayjs from 'dayjs/esm/index'
7
+ import { showFailToast, showToast } from 'vant'
8
+ import {computed, defineExpose, defineProps, onMounted, onUnmounted, ref} from 'vue'
9
+ import { useRoute } from 'vue-router'
5
10
 
6
- const configName = ref('addappapplychargeForm')
11
+ const props = withDefaults(defineProps<{
12
+ setRef?: (refValue: any) => void
13
+ removeRef?: (refValue: any) => void
14
+ formGroupName?: string
15
+ }>(), {
16
+ setRef: () => {},
17
+ removeRef: () => {},
18
+ formGroupName: '',
19
+ })
20
+ const configName = ref('mobile_OtherChargeCancelForm')
7
21
  const serviceName = ref('af-apply')
22
+ const route = useRoute()
23
+ const userInfo = useUserStore().getUserInfo()
24
+ const workflowId = computed(() => route.query.workflowid)
25
+ const formData = ref({
26
+ f_cancel_reason: '1111',
27
+ })
8
28
 
9
- const formGroupAddConstruction = ref(null)
29
+ const xFormRef = ref()
30
+ const aaa = ref({})
31
+ function submit(res: any) {
32
+ if (Number(res.charge_money) > Number(res.surplus_money)) {
33
+ showFailToast('收费金额不能大于未结金额!!')
34
+ return
35
+ }
36
+ const saveData = {
37
+ f_payment_type: res.payment_type,
38
+ f_charge_money: res.charge_money,
39
+ f_amount_words: res.amount_words,
40
+ f_payment_method: res.payment_method,
41
+ f_actual_date: res.actual_date,
42
+ f_charge_status: '有效',
43
+ f_workflow_id: workflowId.value,
44
+ f_charge_collectors: userInfo.f_operator,
45
+ f_charge_collectors_id: userInfo.f_operatorid,
46
+ f_charge_date: dayjs().format('YYYY-MM-DD HH:mm:ss'),
47
+ f_filialeid: userInfo.f_orgid,
48
+ f_filiale: userInfo.f_orgname,
49
+ }
50
+ post('api/af-apply/entity/save/t_charge_record', saveData).then((_res) => {
51
+ showToast('提交成功!')
52
+ history.back()
53
+ })
54
+ }
55
+ function init() {
56
+ // runLogic('getApplyBusinessrecode', { f_workflow_id: 854 }, 'af-apply').then((res) => {
57
+ // // formData.value = res
58
+ // console.log('res==', res)
59
+ // }).catch((err) => {
60
+ //
61
+ // })
62
+ setTimeout(() => {
63
+ Object.assign(formData.value, { f_cancel_reason: '2222222' })
64
+ }, 5000)
65
+ }
66
+ function validate() {
67
+ // 调用 XForm 的 validate 方法
68
+ return xFormRef.value?.validate?.() ?? Promise.resolve()
69
+ }
70
+ function getFormData() {
71
+ console.log('自定义表单=====', xFormRef.value.getFormData())
72
+ // 获取 XForm 的表单数据
73
+ return xFormRef.value?.getFormData?.() ?? {}
74
+ }
75
+ onMounted(() => {
76
+ init()
77
+ })
78
+ const exposeObj = { validate, getFormData, init, formGroupName: props.formGroupName }
79
+ defineExpose(exposeObj)
80
+ onMounted(() => {
81
+ props.setRef && props.setRef(exposeObj)
82
+ })
83
+ onUnmounted(() => {
84
+ props.removeRef && props.removeRef(exposeObj)
85
+ })
86
+ // watch(() => props.formData, (newVal) => {
87
+ // console.log('变更了===', newVal)
88
+ // if (newVal) {
89
+ // Object.assign(form, newVal)
90
+ // }
91
+ // })
10
92
  </script>
11
93
 
12
94
  <template>
13
- <NormalDataLayout id="XFormGroupView" title="纯表单">
14
- <template #layout_content>
15
- <XForm
16
- ref="formGroupAddConstruction"
17
- mode="新增"
18
- :config-name="configName"
19
- :service-name="serviceName"
20
- />
21
- </template>
22
- </NormalDataLayout>
95
+ <XForm
96
+ ref="xFormRef"
97
+ mode="新增"
98
+ :config-name="configName"
99
+ :service-name="serviceName"
100
+ :form-data="formData"
101
+ @on-submit="submit"
102
+ />
23
103
  </template>
24
104
 
25
105
  <style scoped lang="less">
@@ -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.debug('读取本地缓存失败', e)
272
+ // 未拿到跳过
273
+ }
224
274
  })
225
275
  </script>
226
276