@uxda/appkit 1.2.69 → 1.2.70

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
@@ -4227,7 +4227,9 @@ var script = /* @__PURE__ */ defineComponent({
4227
4227
  props: {
4228
4228
  app: { type: String, required: true, default: "" },
4229
4229
  userId: { type: String, required: true, default: "" },
4230
- showAppLabel: { type: Boolean, required: false, default: false }
4230
+ showApp: { type: Boolean, required: false, default: false },
4231
+ showTitle: { type: Boolean, required: false, default: true },
4232
+ checkBeforeRead: { type: Function, required: false }
4231
4233
  },
4232
4234
  emits: ["view"],
4233
4235
  setup(__props, { emit: __emit }) {
@@ -4259,12 +4261,16 @@ var script = /* @__PURE__ */ defineComponent({
4259
4261
  const start = dayjs(time);
4260
4262
  const end = dayjs();
4261
4263
  const diffInMinutes = end.diff(start, "minute");
4262
- if (diffInMinutes < 60 && 0 > diffInMinutes) {
4264
+ if (diffInMinutes < 60 && diffInMinutes > 0) {
4263
4265
  return `${diffInMinutes}\u5206\u949F\u524D`;
4264
4266
  }
4265
4267
  return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
4266
4268
  }
4267
4269
  async function notifyRead(notice, index) {
4270
+ if (props.checkBeforeRead) {
4271
+ if (!props.checkBeforeRead(notice, index))
4272
+ return;
4273
+ }
4268
4274
  if (notice.isRead == "0") {
4269
4275
  const res = await toReadFun([notice.id]);
4270
4276
  if (res) {
@@ -4330,9 +4336,10 @@ var script = /* @__PURE__ */ defineComponent({
4330
4336
  1
4331
4337
  /* TEXT */
4332
4338
  ),
4333
- createElementVNode(
4339
+ _ctx.showTitle ? (openBlock(), createElementBlock(
4334
4340
  "div",
4335
4341
  {
4342
+ key: 0,
4336
4343
  class: normalizeClass(["text tit", { gray: item.isRead == "1" }]),
4337
4344
  style: { "display": "flex", "align-items": "center" }
4338
4345
  },
@@ -4342,7 +4349,7 @@ var script = /* @__PURE__ */ defineComponent({
4342
4349
  1
4343
4350
  /* TEXT */
4344
4351
  ),
4345
- _ctx.showAppLabel && appMap[item.appCode] ? (openBlock(), createElementBlock(
4352
+ _ctx.showApp && appMap[item.appCode] ? (openBlock(), createElementBlock(
4346
4353
  "div",
4347
4354
  _hoisted_7,
4348
4355
  toDisplayString(appMap[item.appCode]),
@@ -4352,7 +4359,7 @@ var script = /* @__PURE__ */ defineComponent({
4352
4359
  ],
4353
4360
  2
4354
4361
  /* CLASS */
4355
- ),
4362
+ )) : createCommentVNode("v-if", true),
4356
4363
  createElementVNode(
4357
4364
  "div",
4358
4365
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "1.2.69",
3
+ "version": "1.2.70",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -29,16 +29,15 @@
29
29
  >
30
30
  <div class="point"></div>
31
31
  <div>
32
- <div class="time">
33
- {{ formatMinutes(item.receiveTime) }}
34
- </div>
32
+ <div class="time">{{ formatMinutes(item.receiveTime) }}</div>
35
33
  <div
34
+ v-if="showTitle"
36
35
  class="text tit"
37
36
  style="display: flex; align-items: center"
38
37
  :class="{ gray: item.isRead == '1' }"
39
38
  >
40
39
  {{ item.title }}
41
- <div class="notice-list-label" v-if="showAppLabel && appMap[item.appCode]">
40
+ <div class="notice-list-label" v-if="showApp && appMap[item.appCode]">
42
41
  {{ appMap[item.appCode] }}
43
42
  </div>
44
43
  </div>
@@ -85,12 +84,15 @@ const props = withDefaults(
85
84
  defineProps<{
86
85
  app: string
87
86
  userId: string
88
- showAppLabel?: boolean
87
+ showApp?: boolean
88
+ showTitle?: boolean
89
+ checkBeforeRead?: Function
89
90
  }>(),
90
91
  {
91
92
  app: '',
92
93
  userId: '',
93
- showAppLabel: false,
94
+ showApp: false,
95
+ showTitle: true,
94
96
  }
95
97
  )
96
98
 
@@ -130,7 +132,7 @@ function formatMinutes(time: number) {
130
132
 
131
133
  // 使用diff方法计算差异,单位为分钟
132
134
  const diffInMinutes = end.diff(start, 'minute')
133
- if (diffInMinutes < 60 && 0 > diffInMinutes) {
135
+ if (diffInMinutes < 60 && diffInMinutes > 0) {
134
136
  return `${diffInMinutes}分钟前`
135
137
  }
136
138
 
@@ -139,6 +141,10 @@ function formatMinutes(time: number) {
139
141
 
140
142
  // 消息读取
141
143
  async function notifyRead(notice: any, index) {
144
+ if (props.checkBeforeRead) {
145
+ if (!props.checkBeforeRead(notice, index)) return
146
+ }
147
+
142
148
  if (notice.isRead == '0') {
143
149
  const res = await toReadFun([notice.id])
144
150