@uxda/appkit 4.0.3 → 4.0.14

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.
Files changed (116) hide show
  1. package/.eslintrc.mjs +7 -7
  2. package/README.md +187 -187
  3. package/babel.config.js +12 -12
  4. package/package.json +75 -80
  5. package/project.config.json +15 -15
  6. package/project.tt.json +13 -13
  7. package/rollup.config.mjs +56 -56
  8. package/src/Appkit.ts +65 -65
  9. package/src/balance/api/endpoints.ts +126 -126
  10. package/src/balance/api/index.ts +82 -82
  11. package/src/balance/components/AccountView.vue +748 -748
  12. package/src/balance/components/BalanceCard.vue +205 -209
  13. package/src/balance/components/BalanceReminder.vue +85 -85
  14. package/src/balance/components/ConsumptionFilter.vue +218 -218
  15. package/src/balance/components/ConsumptionRules.vue +68 -68
  16. package/src/balance/components/DateFilter.vue +227 -226
  17. package/src/balance/components/DateRange.vue +78 -0
  18. package/src/balance/components/ListFilter.vue +64 -0
  19. package/src/balance/components/ListFilterPicker.vue +187 -0
  20. package/src/balance/components/SecondBalance.vue +71 -71
  21. package/src/balance/components/Tip.vue +45 -45
  22. package/src/balance/components/index.ts +13 -9
  23. package/src/balance/types.ts +91 -90
  24. package/src/components/bt-cropper/index.vue +774 -774
  25. package/src/components/bt-cropper/utils/calcCropper.js +42 -42
  26. package/src/components/bt-cropper/utils/calcImagePosition.js +23 -23
  27. package/src/components/bt-cropper/utils/calcImageSize.js +37 -37
  28. package/src/components/bt-cropper/utils/calcPointDistance.js +12 -12
  29. package/src/components/bt-cropper/utils/calcRightAndBottom.js +7 -7
  30. package/src/components/bt-cropper/utils/ratio.js +3 -3
  31. package/src/components/bt-cropper/utils/tools.js +25 -25
  32. package/src/components/dd-area/index.vue +225 -225
  33. package/src/components/dd-icon/doc.md +21 -21
  34. package/src/components/dd-icon/index.vue +23 -23
  35. package/src/components/dd-notice-bar/index.vue +78 -78
  36. package/src/components/dd-search/doc.md +34 -34
  37. package/src/components/dd-search/index.vue +168 -168
  38. package/src/components/dd-selector/index.vue +124 -124
  39. package/src/components/dd-skeleton/doc.md +19 -19
  40. package/src/components/dd-skeleton/index.vue +36 -36
  41. package/src/components/ocr-id/index.vue +114 -114
  42. package/src/components/ocr-id/types.d.ts +12 -12
  43. package/src/global.ts +6 -6
  44. package/src/index.ts +89 -89
  45. package/src/main.scss +1 -1
  46. package/src/notice/api/endpoints.ts +17 -17
  47. package/src/notice/api/index.ts +82 -82
  48. package/src/notice/components/NoticeBanner.vue +243 -243
  49. package/src/notice/components/NoticeEntry.vue +99 -99
  50. package/src/notice/components/NoticeList.vue +315 -315
  51. package/src/notice/components/NoticePopup.vue +161 -161
  52. package/src/notice/components/index.ts +5 -5
  53. package/src/notice/components/useCommonList.ts +86 -86
  54. package/src/notice/components/useNotice.ts +35 -35
  55. package/src/notice/index.ts +1 -1
  56. package/src/notice/types.ts +25 -25
  57. package/src/payment/api/config.ts +7 -7
  58. package/src/payment/api/endpoints.ts +103 -103
  59. package/src/payment/api/index.ts +71 -71
  60. package/src/payment/components/AmountPicker.vue +93 -93
  61. package/src/payment/components/RechargeResult.vue +69 -69
  62. package/src/payment/components/RechargeView.vue +154 -154
  63. package/src/payment/components/RightsPicker.vue +105 -105
  64. package/src/payment/components/TradeView.vue +298 -298
  65. package/src/payment/components/UserAgreement.vue +234 -234
  66. package/src/payment/components/index.ts +22 -22
  67. package/src/payment/index.ts +5 -5
  68. package/src/payment/services/index.ts +16 -16
  69. package/src/payment/services/invoke-recharge.ts +25 -25
  70. package/src/payment/services/request-payment.ts +58 -58
  71. package/src/payment/types.ts +28 -28
  72. package/src/register/components/SelfRegistration.vue +254 -254
  73. package/src/register/components/index.ts +2 -2
  74. package/src/shared/components/AppDrawer.vue +58 -58
  75. package/src/shared/components/AppVerify.vue +98 -0
  76. package/src/shared/components/DeviceVersion.vue +68 -68
  77. package/src/shared/components/EmptyView.vue +33 -33
  78. package/src/shared/components/OcrIcon.vue +119 -0
  79. package/src/shared/components/PageHeader.vue +79 -79
  80. package/src/shared/components/index.ts +7 -5
  81. package/src/shared/composables/index.ts +7 -5
  82. package/src/shared/composables/useCountdown.ts +46 -46
  83. package/src/shared/composables/useCrypto.ts +76 -0
  84. package/src/shared/composables/useDragBox.ts +97 -97
  85. package/src/shared/composables/useEncode.ts +43 -43
  86. package/src/shared/composables/useSafeArea.ts +46 -46
  87. package/src/shared/composables/useTabbar.ts +24 -24
  88. package/src/shared/composables/useUpload.ts +55 -0
  89. package/src/shared/composables/useValidator.ts +31 -31
  90. package/src/shared/http/Http.ts +136 -136
  91. package/src/shared/http/index.ts +1 -1
  92. package/src/shared/http/types.ts +157 -157
  93. package/src/shared/index.ts +3 -3
  94. package/src/shared/weixin/payment.ts +38 -38
  95. package/src/styles/fonts.scss +2 -2
  96. package/src/styles/vars.scss +3 -3
  97. package/src/user/api/endpoints.ts +17 -17
  98. package/src/user/api/index.ts +87 -87
  99. package/src/user/components/LoginSetting.vue +114 -114
  100. package/src/user/components/UserBinding.vue +307 -307
  101. package/src/user/components/UserBindingSuccess.vue +80 -80
  102. package/src/user/components/UserEntry.vue +137 -142
  103. package/src/user/components/UserFeedback.vue +440 -440
  104. package/src/user/components/UserFeedbackEntry.vue +192 -192
  105. package/src/user/components/UserHeadCrop.vue +65 -65
  106. package/src/user/components/UserInfo.vue +632 -632
  107. package/src/user/components/UserResourceEmpty.vue +75 -75
  108. package/src/user/components/index.ts +21 -21
  109. package/src/user/index.ts +1 -1
  110. package/tsconfig.json +30 -30
  111. package/types/global.d.ts +21 -21
  112. package/types/vue.d.ts +10 -10
  113. package/dist/appkit.css +0 -2331
  114. package/dist/assets/asset-3B_CoPto +0 -1
  115. package/dist/assets/asset-DcH8Kg-2 +0 -1
  116. package/dist/index.js +0 -7176
@@ -1,243 +1,243 @@
1
- <template>
2
- <div
3
- class="notice-banner"
4
- :class="{ fixed: fixed }"
5
- :style="topStype"
6
- v-if="bannerMessages.length"
7
- @touchstart="onTouchStart"
8
- @touchend="onTouchEnd"
9
- >
10
- <DdNoticeBar
11
- :class="{ show: key === activeKey }"
12
- v-for="(item, key) in bannerMessages"
13
- :key="key"
14
- :showClose="item.noticeType === 0"
15
- @close="onClose(item, key)"
16
- >
17
- <img
18
- class="notice-banner-icon"
19
- src="https://cdn.ddjf.com/static/images/customer-center/notice-icon.png"
20
- alt=""
21
- />
22
- <div class="notice-banner-text">
23
- {{ item.context }}
24
- </div>
25
- <div class="notice-banner-btn" @click="onDetail(item)">详情</div>
26
- </DdNoticeBar>
27
- </div>
28
-
29
- <!-- 系统公告强制弹框 -->
30
- <template v-for="(item, key) in popMessages" :key="key">
31
- <NoticePopup :message="item" @close="popMessages.splice(key, 1)" @view="onView(item)" />
32
- </template>
33
- </template>
34
-
35
- <script lang="ts" setup>
36
- import { computed, onMounted, ref, watch } from 'vue'
37
- import { useHttp } from '../api'
38
- import { useAppKitOptions } from '../../Appkit'
39
- import DdNoticeBar from '../../components/dd-notice-bar/index.vue'
40
- import NoticePopup from './NoticePopup.vue'
41
- import Taro from '@tarojs/taro'
42
- import { useNotice } from './useNotice'
43
- import debounce from 'lodash/debounce'
44
- import { useSafeArea } from '../../shared/composables'
45
-
46
- const props = withDefaults(
47
- defineProps<{
48
- app: string
49
- bannerStyle?: any
50
- fixed?: boolean
51
- }>(),
52
- {
53
- app: '',
54
- bannerStyle: '',
55
- fixed: false,
56
- }
57
- )
58
-
59
- const { toReadFun, noticeClick } = useNotice()
60
- const bannerMessages = ref<any[]>([]) // 横幅消息
61
- const popMessages = ref<any[]>([]) // 弹窗消息
62
- const activeKey = ref(0)
63
- const safeArea = useSafeArea()
64
-
65
- const topStype = computed(() => {
66
- if (!props.fixed) {
67
- return props.bannerStyle
68
- } else {
69
- return `top: ${safeArea.nav + safeArea.status}px; ${props.bannerStyle}}`
70
- }
71
- })
72
-
73
- onMounted(() => {
74
- queryNoticeMsg()
75
- })
76
-
77
- watch(
78
- () => popMessages.value,
79
- () => {
80
- emits('popup', !!popMessages.value.length)
81
- }
82
- )
83
-
84
- // 查询当前用户当前应用系统消息
85
- async function queryNoticeMsg() {
86
- const appkitOptions = useAppKitOptions()
87
-
88
- const $http = useHttp()
89
- $http
90
- .post('/cas/msg/queryNoticeMsg', {
91
- device: 'MINI',
92
- deviceType: 2,
93
- msgType: 3,
94
- appCode: props.app || appkitOptions.app(),
95
- tenantId: appkitOptions.tenant(),
96
- })
97
- .then((result) => {
98
- if (!Array.isArray(result)) return
99
-
100
- bannerMessages.value = result.filter((item: any) => item.noticeType !== undefined)
101
- popMessages.value = result.filter((item: any) => item.isPop)
102
-
103
- startMessageCarousel()
104
- })
105
- }
106
-
107
- let interval: any = null
108
- // 启动消息轮播
109
- function startMessageCarousel() {
110
- stopMessageCarousel()
111
- if (bannerMessages.value.length > 1) {
112
- interval = setInterval(() => {
113
- startMessageCalc()
114
- if (bannerMessages.value.length <= 1) {
115
- stopMessageCarousel()
116
- }
117
- }, 3000)
118
- } else {
119
- activeKey.value = 0
120
- }
121
- }
122
- function startMessageCalc() {
123
- if (activeKey.value < bannerMessages.value.length - 1) {
124
- activeKey.value++
125
- } else {
126
- activeKey.value = 0
127
- }
128
- }
129
- // 停止消息轮播
130
- function stopMessageCarousel() {
131
- clearInterval(interval)
132
- }
133
-
134
- // 关闭横幅
135
- const onClose = debounce((item: any, index: number) => {
136
- stopMessageCarousel()
137
-
138
- const $http = useHttp()
139
- $http
140
- .post('/cas/msg/setMsgStatus', {
141
- device: 'MINI',
142
- deviceType: 0,
143
- noticeStatus: 1,
144
- receiveId: item.id,
145
- })
146
- .then(() => {
147
- Taro.showToast({
148
- title: '消息已关闭',
149
- icon: 'none',
150
- })
151
- bannerMessages.value.splice(index, 1)
152
-
153
- startMessageCarousel()
154
-
155
- // if (item.isRead === 0) {
156
- // toReadFun([item.id])
157
- // }
158
- })
159
- .catch(() => {
160
- startMessageCarousel()
161
- })
162
- }, 350)
163
-
164
- // 跳转详情
165
- async function onDetail(item) {
166
- await noticeClick(item)
167
-
168
- emits('detail', item)
169
- }
170
-
171
- // 查看附件(webview跳转)
172
- function onView(item) {
173
- emits('view', item.link)
174
- }
175
-
176
- // 处理手势移入/移出
177
- function onTouchStart() {
178
- stopMessageCarousel()
179
- }
180
- const onTouchEnd = debounce(() => {
181
- startMessageCarousel()
182
- }, 100)
183
-
184
- // 父组件事件
185
- const emits = defineEmits(['detail', 'close', 'view', 'popup'])
186
- </script>
187
-
188
- <style lang="scss">
189
- .notice-banner {
190
- background: #e6f2ff;
191
- height: 30px;
192
- margin-bottom: 8px;
193
- &.fixed {
194
- position: fixed;
195
- z-index: 10;
196
- width: 100%;
197
- }
198
-
199
- .dd-notice-bar {
200
- position: relative;
201
- background: #e6f2ff;
202
- font-size: 10px;
203
- color: #000000e5;
204
- padding: 0 8px;
205
- height: 0;
206
- min-height: auto;
207
- transition: all 0.2s;
208
- opacity: 0;
209
- &.show {
210
- height: 30px;
211
- opacity: 1;
212
- }
213
- }
214
- &-icon {
215
- width: 22px;
216
- height: 22px;
217
- margin-right: 8px;
218
- }
219
- .dd-notice-bar__close-img {
220
- display: none;
221
- }
222
- .dd-notice-bar__close {
223
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E %3Cpath d='M3.3335 3.33331L16.6668 16.6666' stroke='%23353535' stroke-width='1.66667' stroke-linecap='round' stroke-linejoin='round'/%3E %3Cpath d='M3.3335 16.6666L16.6668 3.33331' stroke='%23353535' stroke-width='1.66667' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
224
- background-position: center;
225
- background-repeat: no-repeat;
226
- background-size: 12px 12px;
227
- opacity: 0.6;
228
- }
229
- &-text {
230
- flex: 1;
231
- overflow: hidden;
232
- text-overflow: ellipsis;
233
- display: -webkit-box;
234
- -webkit-line-clamp: 1;
235
- -webkit-box-orient: vertical;
236
- text-align: left;
237
- }
238
- &-btn {
239
- color: var(--app-primary-color, #017fff);
240
- padding-left: 6px;
241
- }
242
- }
243
- </style>
1
+ <template>
2
+ <div
3
+ class="notice-banner"
4
+ :class="{ fixed: fixed }"
5
+ :style="topStype"
6
+ v-if="bannerMessages.length"
7
+ @touchstart="onTouchStart"
8
+ @touchend="onTouchEnd"
9
+ >
10
+ <DdNoticeBar
11
+ :class="{ show: key === activeKey }"
12
+ v-for="(item, key) in bannerMessages"
13
+ :key="key"
14
+ :showClose="item.noticeType === 0"
15
+ @close="onClose(item, key)"
16
+ >
17
+ <img
18
+ class="notice-banner-icon"
19
+ src="https://cdn.ddjf.com/static/images/customer-center/notice-icon.png"
20
+ alt=""
21
+ />
22
+ <div class="notice-banner-text">
23
+ {{ item.context }}
24
+ </div>
25
+ <div class="notice-banner-btn" @click="onDetail(item)">详情</div>
26
+ </DdNoticeBar>
27
+ </div>
28
+
29
+ <!-- 系统公告强制弹框 -->
30
+ <template v-for="(item, key) in popMessages" :key="key">
31
+ <NoticePopup :message="item" @close="popMessages.splice(key, 1)" @view="onView(item)" />
32
+ </template>
33
+ </template>
34
+
35
+ <script lang="ts" setup>
36
+ import { computed, onMounted, ref, watch } from 'vue'
37
+ import { useHttp } from '../api'
38
+ import { useAppKitOptions } from '../../Appkit'
39
+ import DdNoticeBar from '../../components/dd-notice-bar/index.vue'
40
+ import NoticePopup from './NoticePopup.vue'
41
+ import Taro from '@tarojs/taro'
42
+ import { useNotice } from './useNotice'
43
+ import debounce from 'lodash/debounce'
44
+ import { useSafeArea } from '../../shared/composables'
45
+
46
+ const props = withDefaults(
47
+ defineProps<{
48
+ app: string
49
+ bannerStyle?: any
50
+ fixed?: boolean
51
+ }>(),
52
+ {
53
+ app: '',
54
+ bannerStyle: '',
55
+ fixed: false,
56
+ }
57
+ )
58
+
59
+ const { toReadFun, noticeClick } = useNotice()
60
+ const bannerMessages = ref<any[]>([]) // 横幅消息
61
+ const popMessages = ref<any[]>([]) // 弹窗消息
62
+ const activeKey = ref(0)
63
+ const safeArea = useSafeArea()
64
+
65
+ const topStype = computed(() => {
66
+ if (!props.fixed) {
67
+ return props.bannerStyle
68
+ } else {
69
+ return `top: ${safeArea.nav + safeArea.status}px; ${props.bannerStyle}}`
70
+ }
71
+ })
72
+
73
+ onMounted(() => {
74
+ queryNoticeMsg()
75
+ })
76
+
77
+ watch(
78
+ () => popMessages.value,
79
+ () => {
80
+ emits('popup', !!popMessages.value.length)
81
+ }
82
+ )
83
+
84
+ // 查询当前用户当前应用系统消息
85
+ async function queryNoticeMsg() {
86
+ const appkitOptions = useAppKitOptions()
87
+
88
+ const $http = useHttp()
89
+ $http
90
+ .post('/cas/msg/queryNoticeMsg', {
91
+ device: 'MINI',
92
+ deviceType: 2,
93
+ msgType: 3,
94
+ appCode: props.app || appkitOptions.app(),
95
+ tenantId: appkitOptions.tenant(),
96
+ })
97
+ .then((result) => {
98
+ if (!Array.isArray(result)) return
99
+
100
+ bannerMessages.value = result.filter((item: any) => item.noticeType !== undefined)
101
+ popMessages.value = result.filter((item: any) => item.isPop)
102
+
103
+ startMessageCarousel()
104
+ })
105
+ }
106
+
107
+ let interval: any = null
108
+ // 启动消息轮播
109
+ function startMessageCarousel() {
110
+ stopMessageCarousel()
111
+ if (bannerMessages.value.length > 1) {
112
+ interval = setInterval(() => {
113
+ startMessageCalc()
114
+ if (bannerMessages.value.length <= 1) {
115
+ stopMessageCarousel()
116
+ }
117
+ }, 3000)
118
+ } else {
119
+ activeKey.value = 0
120
+ }
121
+ }
122
+ function startMessageCalc() {
123
+ if (activeKey.value < bannerMessages.value.length - 1) {
124
+ activeKey.value++
125
+ } else {
126
+ activeKey.value = 0
127
+ }
128
+ }
129
+ // 停止消息轮播
130
+ function stopMessageCarousel() {
131
+ clearInterval(interval)
132
+ }
133
+
134
+ // 关闭横幅
135
+ const onClose = debounce((item: any, index: number) => {
136
+ stopMessageCarousel()
137
+
138
+ const $http = useHttp()
139
+ $http
140
+ .post('/cas/msg/setMsgStatus', {
141
+ device: 'MINI',
142
+ deviceType: 0,
143
+ noticeStatus: 1,
144
+ receiveId: item.id,
145
+ })
146
+ .then(() => {
147
+ Taro.showToast({
148
+ title: '消息已关闭',
149
+ icon: 'none',
150
+ })
151
+ bannerMessages.value.splice(index, 1)
152
+
153
+ startMessageCarousel()
154
+
155
+ // if (item.isRead === 0) {
156
+ // toReadFun([item.id])
157
+ // }
158
+ })
159
+ .catch(() => {
160
+ startMessageCarousel()
161
+ })
162
+ }, 350)
163
+
164
+ // 跳转详情
165
+ async function onDetail(item) {
166
+ await noticeClick(item)
167
+
168
+ emits('detail', item)
169
+ }
170
+
171
+ // 查看附件(webview跳转)
172
+ function onView(item) {
173
+ emits('view', item.link)
174
+ }
175
+
176
+ // 处理手势移入/移出
177
+ function onTouchStart() {
178
+ stopMessageCarousel()
179
+ }
180
+ const onTouchEnd = debounce(() => {
181
+ startMessageCarousel()
182
+ }, 100)
183
+
184
+ // 父组件事件
185
+ const emits = defineEmits(['detail', 'close', 'view', 'popup'])
186
+ </script>
187
+
188
+ <style lang="scss">
189
+ .notice-banner {
190
+ background: #e6f2ff;
191
+ height: 30px;
192
+ margin-bottom: 8px;
193
+ &.fixed {
194
+ position: fixed;
195
+ z-index: 10;
196
+ width: 100%;
197
+ }
198
+
199
+ .dd-notice-bar {
200
+ position: relative;
201
+ background: #e6f2ff;
202
+ font-size: 10px;
203
+ color: #000000e5;
204
+ padding: 0 8px;
205
+ height: 0;
206
+ min-height: auto;
207
+ transition: all 0.2s;
208
+ opacity: 0;
209
+ &.show {
210
+ height: 30px;
211
+ opacity: 1;
212
+ }
213
+ }
214
+ &-icon {
215
+ width: 22px;
216
+ height: 22px;
217
+ margin-right: 8px;
218
+ }
219
+ .dd-notice-bar__close-img {
220
+ display: none;
221
+ }
222
+ .dd-notice-bar__close {
223
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E %3Cpath d='M3.3335 3.33331L16.6668 16.6666' stroke='%23353535' stroke-width='1.66667' stroke-linecap='round' stroke-linejoin='round'/%3E %3Cpath d='M3.3335 16.6666L16.6668 3.33331' stroke='%23353535' stroke-width='1.66667' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
224
+ background-position: center;
225
+ background-repeat: no-repeat;
226
+ background-size: 12px 12px;
227
+ opacity: 0.6;
228
+ }
229
+ &-text {
230
+ flex: 1;
231
+ overflow: hidden;
232
+ text-overflow: ellipsis;
233
+ display: -webkit-box;
234
+ -webkit-line-clamp: 1;
235
+ -webkit-box-orient: vertical;
236
+ text-align: left;
237
+ }
238
+ &-btn {
239
+ color: var(--app-primary-color, #017fff);
240
+ padding-left: 6px;
241
+ }
242
+ }
243
+ </style>
@@ -1,99 +1,99 @@
1
- <template>
2
- <div class="notice-entry">
3
- <img
4
- class="notice-entry-img"
5
- src="https://cdn.ddjf.com/static/images/loan-manage/notice-icon.png"
6
- alt=""
7
- />
8
- <span>通知</span>
9
- <div v-if="noticeShow" class="notice-entry-icon"></div>
10
- </div>
11
- </template>
12
-
13
- <script lang="ts" setup>
14
- import { ref } from 'vue'
15
- import { useHttp } from '../api'
16
- import { useAppKitOptions } from '../../Appkit'
17
- import Taro, { useDidShow } from '@tarojs/taro'
18
- import debounce from 'lodash/debounce'
19
-
20
- const props = withDefaults(
21
- defineProps<{
22
- app: string
23
- userId: string
24
- }>(),
25
- {
26
- app: '',
27
- userId: '',
28
- }
29
- )
30
-
31
- const init = debounce(() => {
32
- if (!props.app) {
33
- return Taro.showToast({
34
- title: 'NoticeEntry组件缺少appcode',
35
- icon: 'none',
36
- })
37
- }
38
- getNotice()
39
- }, 300)
40
-
41
- init()
42
- useDidShow(() => {
43
- init()
44
- })
45
-
46
- // 通知红点
47
- const noticeShow = ref(false)
48
- async function getNotice() {
49
- const appkitOptions = useAppKitOptions()
50
- const $http = useHttp()
51
-
52
- $http
53
- .get('/cas/msg/count-unread', {
54
- deviceType: 2,
55
- appCode: props.app,
56
- tenantId: appkitOptions.tenant(),
57
- userId: props.userId,
58
- })
59
- .then((result: any) => {
60
- if (typeof result === 'object') return
61
-
62
- noticeShow.value = result > 0
63
- })
64
- }
65
- </script>
66
-
67
- <style lang="scss">
68
- .notice-entry {
69
- position: fixed;
70
- right: 0;
71
- top: 120px;
72
- min-width: 66px;
73
- padding: 0 12px 0 15px;
74
- text-align: center;
75
- box-sizing: border-box;
76
- height: 25px;
77
- line-height: 11px;
78
- color: #855f0b;
79
- font-size: 13px;
80
- background: #ffdf68;
81
- border-radius: 50px 0 0 50px;
82
- display: flex;
83
- align-items: center;
84
- justify-content: center;
85
- &-img {
86
- width: 20px;
87
- height: 20px;
88
- }
89
- &-icon {
90
- position: absolute;
91
- background-color: red;
92
- width: 6px;
93
- height: 6px;
94
- border-radius: 50%;
95
- top: 1px;
96
- left: 27px;
97
- }
98
- }
99
- </style>
1
+ <template>
2
+ <div class="notice-entry">
3
+ <img
4
+ class="notice-entry-img"
5
+ src="https://cdn.ddjf.com/static/images/loan-manage/notice-icon.png"
6
+ alt=""
7
+ />
8
+ <span>通知</span>
9
+ <div v-if="noticeShow" class="notice-entry-icon"></div>
10
+ </div>
11
+ </template>
12
+
13
+ <script lang="ts" setup>
14
+ import { ref } from 'vue'
15
+ import { useHttp } from '../api'
16
+ import { useAppKitOptions } from '../../Appkit'
17
+ import Taro, { useDidShow } from '@tarojs/taro'
18
+ import debounce from 'lodash/debounce'
19
+
20
+ const props = withDefaults(
21
+ defineProps<{
22
+ app: string
23
+ userId: string
24
+ }>(),
25
+ {
26
+ app: '',
27
+ userId: '',
28
+ }
29
+ )
30
+
31
+ const init = debounce(() => {
32
+ if (!props.app) {
33
+ return Taro.showToast({
34
+ title: 'NoticeEntry组件缺少appcode',
35
+ icon: 'none',
36
+ })
37
+ }
38
+ getNotice()
39
+ }, 300)
40
+
41
+ init()
42
+ useDidShow(() => {
43
+ init()
44
+ })
45
+
46
+ // 通知红点
47
+ const noticeShow = ref(false)
48
+ async function getNotice() {
49
+ const appkitOptions = useAppKitOptions()
50
+ const $http = useHttp()
51
+
52
+ $http
53
+ .get('/cas/msg/count-unread', {
54
+ deviceType: 2,
55
+ appCode: props.app,
56
+ tenantId: appkitOptions.tenant(),
57
+ userId: props.userId,
58
+ })
59
+ .then((result: any) => {
60
+ if (typeof result === 'object') return
61
+
62
+ noticeShow.value = result > 0
63
+ })
64
+ }
65
+ </script>
66
+
67
+ <style lang="scss">
68
+ .notice-entry {
69
+ position: fixed;
70
+ right: 0;
71
+ top: 120px;
72
+ min-width: 66px;
73
+ padding: 0 12px 0 15px;
74
+ text-align: center;
75
+ box-sizing: border-box;
76
+ height: 25px;
77
+ line-height: 11px;
78
+ color: #855f0b;
79
+ font-size: 13px;
80
+ background: #ffdf68;
81
+ border-radius: 50px 0 0 50px;
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ &-img {
86
+ width: 20px;
87
+ height: 20px;
88
+ }
89
+ &-icon {
90
+ position: absolute;
91
+ background-color: red;
92
+ width: 6px;
93
+ height: 6px;
94
+ border-radius: 50%;
95
+ top: 1px;
96
+ left: 27px;
97
+ }
98
+ }
99
+ </style>