Quellcode durchsuchen

feat: 添加消息类型处理逻辑,优化消息卡片组件的点击跳转功能

EvilDragon vor 4 Monaten
Ursprung
Commit
05b78565af

+ 92 - 0
packages/app/src/core/libs/message-types.ts

@@ -0,0 +1,92 @@
+// SYSTEM_WELCOME_JOIN(1, "欢迎加入"),
+//     SYSTEM_APPROVE_REJECT(2, "认证驳回"),
+//     SYSTEM_MATERIAL_JOIN(3, "材料商入住"),
+//     SYSTEM_DATA_DRIVE(4, "数据仓驾驶"),
+//     SYSTEM_MESSAGE_NOTICE(5, "消息通知"),
+//     SYSTEM_CUSTOMER_ORDER(6, "客户预约"),
+//     SYSTEM_SHARE_DATA(7, "分享数据"),
+//     SYSTEM_MEMBER_CHANGE(8, "会员变动通知"),
+//     SYSTEM_SIGN_START(9, "开始报名"),
+//     SYSTEM_ACCOUNT_RECOVERY(10, "账号恢复通知"),
+//     SYSTEM_ACCOUNT_FROZEN(11, "账号冻结通知"),
+
+//     SYSTEM_MEMBER_UP(12, "会员升级"),
+//     SYSTEM_MEMBER_DOWN(13, "会员降级"),
+//     SYSTEM_COUPON_GET(14, "优惠卷获取"),
+//     SYSTEM_COUPON_EXPIRE(15, "优惠卷过期"),
+//     SYSTEM_CERTIFICATE(16, "证书获取"),
+//     SYSTEM_BADGE(17, "徽章获取"),
+
+//     INTEGRAL_SIGN_STUDY_TOUR(18, "报名游学"),
+//     INTEGRAL_SIGN_ACTIVITY(19, "报名活动"),
+//     INTEGRAL_CHANGE_COMMODITY(20, "兑换商品"),
+//     INTEGRAL_BACKSTAGE_UP(21, "后台增加"),
+//     INTEGRAL_BACKSTAGE_DOWN(22, "后台减少"),
+//     INTEGRAL_PAY_TO_SUPPLIERS(23, "向供应商支付"),
+//     INTEGRAL_REWARD_CIRCLES(24, "发圈子奖励"),
+//     INTEGRAL_REWARD_CLOCK_IN(25, "用户到店打卡奖励"),
+//     INTEGRAL_REWARD_CLOCK_IN_ONCE(26, "用户到店打卡奖励"),
+//     INTEGRAL_REWARD_FOLLOW(27, "关注公众号奖励"),
+//     INTEGRAL_REWARD_INVITATION(28, "邀请成功奖励"),
+//     INTEGRAL_CANCEL_STUDY_TOUR_ACTIVITY(29, "取消游学/报名"),
+//     INTEGRAL_CANCEL_ORDER(30, "取消订单"),
+
+//     INTEGRAL_ODDER_CONFIRM(31, "积分订单确认"),
+
+//     ACTIVE_COMMENT_MESSAGE(32, "评论"),
+//     ACTIVE_REPLY_MESSAGE(33, "回复"),
+//     ACTIVE_CLICK_MESSAGE(34, "点赞圈子"),
+//     ACTIVE_CLICK_COMMENT_MESSAGE(35, "点赞评论"),
+//     ACTIVE_SHARE_MESSAGE(36, "分享");
+export const messageTypes = [
+  { subType: 1, desc: '欢迎加入', path: '/pages/home/about/index' },
+  { subType: 2, desc: '认证驳回', path: '/pages/mine/authentication/index' },
+  { subType: 3, desc: '材料商入住', path: '/pages/material/detail/index?id=0' },
+  { subType: 4, desc: '数据仓驾驶' },
+  { subType: 5, desc: '消息通知', path: '' },
+  { subType: 6, desc: '客户预约' },
+  { subType: 7, desc: '分享数据' },
+  { subType: 8, desc: '会员变动通知', path: '/pages/mine/levels/index' },
+  {
+    subType: 9,
+    desc: '开始报名',
+    path: '/pages/home/activity/detail/index?id=29898&type=studyTour',
+  },
+  { subType: 10, desc: '账号恢复通知' },
+  { subType: 11, desc: '账号冻结通知' },
+  { subType: 12, desc: '会员升级', path: '/pages/mine/levels/index' },
+  { subType: 13, desc: '会员降级', path: '/pages/mine/levels/index' },
+  { subType: 14, desc: '优惠卷获取', path: '/pages/mine/coupon/index' },
+  { subType: 15, desc: '优惠卷过期', path: '/pages/mine/coupon/index' },
+  { subType: 16, desc: '证书获取', path: '/pages/mine/honors/index' },
+  { subType: 17, desc: '徽章获取', path: '/pages/mine/honors/index' },
+  {
+    subType: 18,
+    desc: '报名游学',
+    path: '/pages/home/activity/detail/index?id=29898&type=studyTour',
+  },
+  {
+    subType: 19,
+    desc: '报名活动',
+    path: '/pages/home/activity/detail/index?id=29898&type=studyTour',
+  },
+  { subType: 20, desc: '兑换商品' },
+  { subType: 21, desc: '后台增加' },
+  { subType: 22, desc: '后台减少' },
+  { subType: 23, desc: '向供应商支付' },
+  { subType: 24, desc: '发圈子奖励' },
+  { subType: 25, desc: '用户到店打卡奖励' },
+  { subType: 26, desc: '用户到店打卡奖励' },
+  { subType: 27, desc: '关注公众号奖励' },
+  { subType: 28, desc: '邀请成功奖励' },
+  { subType: 29, desc: '取消游学/报名' },
+  { subType: 30, desc: '取消订单' },
+  { subType: 31, desc: '积分订单确认' },
+  { subType: 32, desc: '评论', path: '/pages/home/moment/index' },
+  { subType: 33, desc: '回复', path: '/pages/home/moment/index' },
+  { subType: 34, desc: '点赞圈子', path: '/pages/home/moment/index' },
+  { subType: 35, desc: '点赞评论', path: '/pages/home/moment/index' },
+  { subType: 36, desc: '分享', path: '/pages/home/moment/index' },
+]
+export const getMessageType = (subType: number) =>
+  messageTypes.find((item) => item.subType === subType)

+ 9 - 3
packages/app/src/pages/messages/components/message-card.vue

@@ -6,6 +6,8 @@ import { beforeNow } from '../../../utils/date-util'
 import dayjs from 'dayjs'
 import { MessageType, PointStatus } from '../../../core/libs/enums'
 import { getPointsCoupons } from '../../../core/libs/requests'
+import { getMessageType } from '../../../core/libs/message-types'
+import { useRouter } from '../../../core/utils/router'
 
 const props = withDefaults(defineProps<{ options?: Message }>(), {})
 const emits = defineEmits<{
@@ -13,6 +15,7 @@ const emits = defineEmits<{
   cancel: [message: Message]
   selectCoupon: [message: Message, coupons: any[]]
 }>()
+const router = useRouter()
 const { data: coupons, run: setCoupons } = useRequest(
   () =>
     getPointsCoupons({ userId: props.options.designerId, businessId: props.options.businessId }),
@@ -137,10 +140,13 @@ onMounted(async () => {
           >
             如有问题请您联系官方客服!
           </template>
-          <template v-else>
-            <div class="flex items-center text-black">
+          <template v-if="getMessageType(options.messageSubType)?.path">
+            <div
+              @click="router.push(getMessageType(options.messageSubType)?.path)"
+              class="flex items-center text-[rgba(0,0,0,0.85)] text-xs font-normal font-['PingFang_SC'] leading-[25px]"
+            >
               查看详情
-              <wd-icon name="arrow-right" size="16"></wd-icon>
+              <wd-icon name="arrow-right" size="12" color="rgba(0,0,0,0.85)"></wd-icon>
             </div>
           </template>
         </div>