@uxda/appkit 4.2.77 → 4.2.79

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/dist/index.js CHANGED
@@ -4990,7 +4990,8 @@ const _hoisted_2$c = { style: { "white-space": "pre-wrap" } };
4990
4990
  var script$i = /* @__PURE__ */ defineComponent({
4991
4991
  __name: "NoticePopup",
4992
4992
  props: {
4993
- message: { type: null, required: true, default: {} }
4993
+ message: { type: null, required: true, default: {} },
4994
+ device: { type: String, required: false, default: "MINI" }
4994
4995
  },
4995
4996
  emits: ["close", "view"],
4996
4997
  setup(__props, { emit: __emit }) {
@@ -5009,7 +5010,7 @@ var script$i = /* @__PURE__ */ defineComponent({
5009
5010
  async function onClose() {
5010
5011
  const $http = useHttp$1();
5011
5012
  $http.post("/cas/msg/setMsgStatus", {
5012
- device: "MINI",
5013
+ device: props.device || "MINI",
5013
5014
  noticeStatus: 0,
5014
5015
  receiveId: props.message.id
5015
5016
  }).then(() => {
@@ -5104,9 +5105,10 @@ var script$h = /* @__PURE__ */ defineComponent({
5104
5105
  props: {
5105
5106
  app: { type: String, required: true, default: "" },
5106
5107
  bannerStyle: { type: null, required: false, default: "" },
5107
- fixed: { type: Boolean, required: false, default: false }
5108
+ fixed: { type: Boolean, required: false, default: false },
5109
+ device: { type: String, required: false, default: "MINI" }
5108
5110
  },
5109
- emits: ["detail", "close", "view", "popup"],
5111
+ emits: ["detail", "close", "view", "popup", "hasBanner"],
5110
5112
  setup(__props, { emit: __emit }) {
5111
5113
  const props = __props;
5112
5114
  const { noticeClick } = useNotice();
@@ -5130,11 +5132,17 @@ var script$h = /* @__PURE__ */ defineComponent({
5130
5132
  emits("popup", !!popMessages.value.length);
5131
5133
  }
5132
5134
  );
5135
+ watch(
5136
+ () => bannerMessages.value,
5137
+ () => {
5138
+ emits("hasBanner", !!bannerMessages.value.length);
5139
+ }
5140
+ );
5133
5141
  async function queryNoticeMsg() {
5134
5142
  const appkitOptions = useAppKitOptions();
5135
5143
  const $http = useHttp$1();
5136
5144
  $http.post("/cas/msg/queryNoticeMsg", {
5137
- device: "MINI",
5145
+ device: props.device || "MINI",
5138
5146
  deviceType: 2,
5139
5147
  msgType: 3,
5140
5148
  appCode: props.app || appkitOptions.app(),
@@ -5174,8 +5182,7 @@ var script$h = /* @__PURE__ */ defineComponent({
5174
5182
  stopMessageCarousel();
5175
5183
  const $http = useHttp$1();
5176
5184
  $http.post("/cas/msg/setMsgStatus", {
5177
- device: "MINI",
5178
- deviceType: 0,
5185
+ device: props.device || "MINI",
5179
5186
  noticeStatus: 1,
5180
5187
  receiveId: item.id
5181
5188
  }).then(() => {
@@ -5203,6 +5210,11 @@ var script$h = /* @__PURE__ */ defineComponent({
5203
5210
  startMessageCarousel();
5204
5211
  }, 100);
5205
5212
  const emits = __emit;
5213
+ function onPopupClose() {
5214
+ setTimeout(() => {
5215
+ popMessages.value.splice(0, 1);
5216
+ }, 100);
5217
+ }
5206
5218
  return (_ctx, _cache) => {
5207
5219
  return openBlock(), createElementBlock(
5208
5220
  Fragment,
@@ -5230,7 +5242,7 @@ var script$h = /* @__PURE__ */ defineComponent({
5230
5242
  onClose: ($event) => unref(onClose)(item, key)
5231
5243
  }, {
5232
5244
  default: withCtx(() => [
5233
- _cache[1] || (_cache[1] = createElementVNode(
5245
+ _cache[2] || (_cache[2] = createElementVNode(
5234
5246
  "img",
5235
5247
  {
5236
5248
  class: "notice-banner-icon",
@@ -5265,20 +5277,13 @@ var script$h = /* @__PURE__ */ defineComponent({
5265
5277
  /* CLASS, STYLE, NEED_HYDRATION */
5266
5278
  )) : createCommentVNode("v-if", true),
5267
5279
  createCommentVNode(" \u7CFB\u7EDF\u516C\u544A\u5F3A\u5236\u5F39\u6846 "),
5268
- (openBlock(true), createElementBlock(
5269
- Fragment,
5270
- null,
5271
- renderList(popMessages.value, (item, key) => {
5272
- return openBlock(), createBlock(script$i, {
5273
- key,
5274
- message: item,
5275
- onClose: ($event) => popMessages.value.splice(key, 1),
5276
- onView: ($event) => onView(item)
5277
- }, null, 8, ["message", "onClose", "onView"]);
5278
- }),
5279
- 128
5280
- /* KEYED_FRAGMENT */
5281
- ))
5280
+ popMessages.value.length ? (openBlock(), createBlock(script$i, {
5281
+ key: 1,
5282
+ device: _ctx.device,
5283
+ message: popMessages.value[0],
5284
+ onClose: onPopupClose,
5285
+ onView: _cache[1] || (_cache[1] = ($event) => onView(popMessages.value[0]))
5286
+ }, null, 8, ["device", "message"])) : createCommentVNode("v-if", true)
5282
5287
  ],
5283
5288
  64
5284
5289
  /* STABLE_FRAGMENT */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.2.77",
3
+ "version": "4.2.79",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -12,9 +12,8 @@
12
12
  </div>
13
13
 
14
14
  <!-- 系统公告强制弹框 -->
15
- <template v-for="(item, key) in popMessages" :key="key">
16
- <NoticePopup :message="item" @close="popMessages.splice(key, 1)" @view="onView(item)" />
17
- </template>
15
+ <NoticePopup v-if="popMessages.length" :device="device" :message="popMessages[0]" @close="onPopupClose"
16
+ @view="onView(popMessages[0])" />
18
17
  </template>
19
18
 
20
19
  <script lang="ts" setup>
@@ -33,11 +32,13 @@ const props = withDefaults(
33
32
  app: string
34
33
  bannerStyle?: any
35
34
  fixed?: boolean
35
+ device?: string
36
36
  }>(),
37
37
  {
38
38
  app: '',
39
39
  bannerStyle: '',
40
40
  fixed: false,
41
+ device: 'MINI',
41
42
  }
42
43
  )
43
44
 
@@ -65,6 +66,12 @@ watch(
65
66
  emits('popup', !!popMessages.value.length)
66
67
  }
67
68
  )
69
+ watch(
70
+ () => bannerMessages.value,
71
+ () => {
72
+ emits('hasBanner', !!bannerMessages.value.length)
73
+ }
74
+ )
68
75
 
69
76
  // 查询当前用户当前应用系统消息
70
77
  async function queryNoticeMsg() {
@@ -73,7 +80,7 @@ async function queryNoticeMsg() {
73
80
  const $http = useHttp()
74
81
  $http
75
82
  .post('/cas/msg/queryNoticeMsg', {
76
- device: 'MINI',
83
+ device: props.device || 'MINI',
77
84
  deviceType: 2,
78
85
  msgType: 3,
79
86
  appCode: props.app || appkitOptions.app(),
@@ -123,8 +130,7 @@ const onClose = debounce((item: any, index: number) => {
123
130
  const $http = useHttp()
124
131
  $http
125
132
  .post('/cas/msg/setMsgStatus', {
126
- device: 'MINI',
127
- deviceType: 0,
133
+ device: props.device || 'MINI',
128
134
  noticeStatus: 1,
129
135
  receiveId: item.id,
130
136
  })
@@ -167,7 +173,13 @@ const onTouchEnd = debounce(() => {
167
173
  }, 100)
168
174
 
169
175
  // 父组件事件
170
- const emits = defineEmits(['detail', 'close', 'view', 'popup'])
176
+ const emits = defineEmits(['detail', 'close', 'view', 'popup', 'hasBanner'])
177
+
178
+ function onPopupClose() {
179
+ setTimeout(() => {
180
+ popMessages.value.splice(0, 1)
181
+ }, 100);
182
+ }
171
183
  </script>
172
184
 
173
185
  <style lang="scss">
@@ -23,9 +23,11 @@ import { useHttp } from '../api'
23
23
  const props = withDefaults(
24
24
  defineProps<{
25
25
  message: any
26
+ device?: string
26
27
  }>(),
27
28
  {
28
29
  message: {},
30
+ device: 'MINI',
29
31
  }
30
32
  )
31
33
 
@@ -53,7 +55,7 @@ async function onClose() {
53
55
 
54
56
  $http
55
57
  .post('/cas/msg/setMsgStatus', {
56
- device: 'MINI',
58
+ device: props.device || 'MINI',
57
59
  noticeStatus: 0,
58
60
  receiveId: props.message.id,
59
61
  })