@uxda/appkit 4.2.24 → 4.2.28

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/dist/appkit.css +3 -3
  5. package/dist/index.js +13 -13
  6. package/package.json +79 -79
  7. package/project.config.json +15 -15
  8. package/project.tt.json +13 -13
  9. package/rollup.config.mjs +67 -67
  10. package/src/Appkit.ts +66 -66
  11. package/src/balance/api/endpoints.ts +133 -133
  12. package/src/balance/api/index.ts +106 -106
  13. package/src/balance/components/AccountView.vue +760 -760
  14. package/src/balance/components/BalanceCard.vue +215 -215
  15. package/src/balance/components/BalanceReminder.vue +85 -85
  16. package/src/balance/components/ConsumptionFilter.vue +218 -218
  17. package/src/balance/components/ConsumptionRules.vue +68 -68
  18. package/src/balance/components/DateFilter.vue +250 -250
  19. package/src/balance/components/DateRange.vue +80 -80
  20. package/src/balance/components/ListFilter.vue +62 -62
  21. package/src/balance/components/ListFilterPicker.vue +191 -191
  22. package/src/balance/components/PromoterCard.vue +237 -237
  23. package/src/balance/components/SecondBalance.vue +71 -71
  24. package/src/balance/components/Tip.vue +45 -45
  25. package/src/balance/components/index.ts +8 -8
  26. package/src/balance/types.ts +97 -97
  27. package/src/components/bt-cropper/index.vue +730 -774
  28. package/src/components/bt-cropper/utils/calcCropper.js +42 -42
  29. package/src/components/bt-cropper/utils/calcImagePosition.js +23 -23
  30. package/src/components/bt-cropper/utils/calcImageSize.js +37 -37
  31. package/src/components/bt-cropper/utils/calcPointDistance.js +12 -12
  32. package/src/components/bt-cropper/utils/calcRightAndBottom.js +7 -7
  33. package/src/components/bt-cropper/utils/ratio.js +3 -3
  34. package/src/components/bt-cropper/utils/tools.js +25 -25
  35. package/src/components/dd-area/index.vue +225 -225
  36. package/src/components/dd-icon/doc.md +21 -21
  37. package/src/components/dd-icon/index.vue +23 -23
  38. package/src/components/dd-notice-bar/index.vue +78 -78
  39. package/src/components/dd-search/doc.md +34 -34
  40. package/src/components/dd-search/index.vue +168 -168
  41. package/src/components/dd-selector/index.vue +124 -124
  42. package/src/components/dd-skeleton/doc.md +19 -19
  43. package/src/components/dd-skeleton/index.vue +36 -36
  44. package/src/global.ts +6 -6
  45. package/src/index.ts +89 -89
  46. package/src/main.scss +1 -1
  47. package/src/notice/api/endpoints.ts +17 -17
  48. package/src/notice/api/index.ts +106 -106
  49. package/src/notice/components/NoticeBanner.vue +243 -243
  50. package/src/notice/components/NoticeEntry.vue +99 -99
  51. package/src/notice/components/NoticeList.vue +315 -315
  52. package/src/notice/components/NoticePopup.vue +162 -162
  53. package/src/notice/components/index.ts +5 -5
  54. package/src/notice/components/useCommonList.ts +86 -86
  55. package/src/notice/components/useNotice.ts +35 -35
  56. package/src/notice/index.ts +1 -1
  57. package/src/notice/types.ts +25 -25
  58. package/src/payment/api/config.ts +7 -7
  59. package/src/payment/api/endpoints.ts +103 -103
  60. package/src/payment/api/index.ts +100 -100
  61. package/src/payment/components/AmountPicker.vue +90 -90
  62. package/src/payment/components/RechargeResult.vue +69 -69
  63. package/src/payment/components/RechargeView.vue +155 -155
  64. package/src/payment/components/RightsPicker.vue +105 -105
  65. package/src/payment/components/TradeView.vue +317 -317
  66. package/src/payment/components/UserAgreement.vue +234 -234
  67. package/src/payment/components/index.ts +22 -22
  68. package/src/payment/index.ts +5 -5
  69. package/src/payment/services/index.ts +16 -16
  70. package/src/payment/services/invoke-recharge.ts +25 -25
  71. package/src/payment/services/request-payment.ts +58 -58
  72. package/src/payment/types.ts +28 -28
  73. package/src/register/components/SelfRegistration.vue +233 -233
  74. package/src/register/components/index.ts +2 -2
  75. package/src/shared/components/AppDrawer.vue +54 -54
  76. package/src/shared/components/AppVerify.vue +128 -128
  77. package/src/shared/components/DeviceVersion.vue +63 -68
  78. package/src/shared/components/EmptyView.vue +33 -33
  79. package/src/shared/components/OcrBusinessLicense.vue +130 -130
  80. package/src/shared/components/OcrIcon.vue +202 -202
  81. package/src/shared/components/PageHeader.vue +84 -84
  82. package/src/shared/components/index.ts +8 -8
  83. package/src/shared/composables/index.ts +8 -8
  84. package/src/shared/composables/useAmount.ts +46 -46
  85. package/src/shared/composables/useCountdown.ts +46 -46
  86. package/src/shared/composables/useCrypto.ts +76 -76
  87. package/src/shared/composables/useDragBox.ts +97 -97
  88. package/src/shared/composables/useEncode.ts +43 -43
  89. package/src/shared/composables/useLogger.ts +124 -124
  90. package/src/shared/composables/useSafeArea.ts +46 -46
  91. package/src/shared/composables/useTabbar.ts +24 -24
  92. package/src/shared/composables/useUpload.ts +54 -54
  93. package/src/shared/composables/useValidator.ts +32 -32
  94. package/src/shared/http/Http.ts +136 -136
  95. package/src/shared/http/index.ts +1 -1
  96. package/src/shared/http/types.ts +157 -157
  97. package/src/shared/index.ts +3 -3
  98. package/src/shared/weixin/payment.ts +38 -38
  99. package/src/styles/vars.scss +3 -3
  100. package/src/user/api/endpoints.ts +17 -17
  101. package/src/user/api/index.ts +111 -111
  102. package/src/user/components/LoginSetting.vue +114 -114
  103. package/src/user/components/UserAuth.vue +257 -257
  104. package/src/user/components/UserBinding.vue +307 -307
  105. package/src/user/components/UserBindingSuccess.vue +80 -80
  106. package/src/user/components/UserEntry.vue +133 -133
  107. package/src/user/components/UserFeedback.vue +431 -431
  108. package/src/user/components/UserFeedbackEntry.vue +175 -192
  109. package/src/user/components/UserHeadCrop.vue +65 -65
  110. package/src/user/components/UserInfo.vue +826 -826
  111. package/src/user/components/UserResourceEmpty.vue +75 -75
  112. package/src/user/components/index.ts +23 -23
  113. package/src/user/index.ts +1 -1
  114. package/tsconfig.json +30 -30
  115. package/types/global.d.ts +21 -21
  116. package/types/vue.d.ts +10 -10
@@ -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-es/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-es/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-es/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: absolute;
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-es/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: absolute;
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>