announcements.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view>
  3. <view class="header">
  4. <view>{{ memberName }}</view>
  5. <text class="warning">计划阅读:{{ option.ExecDate }}前</text>
  6. <text class="warning" wx:if="{{option.IsRead}}">实际阅读:{{ option.ReadTime }}</text>
  7. </view>
  8. <view class="body">
  9. <view class="title">注意事项</view>
  10. <rich-text :nodes="pushContent"></rich-text>
  11. </view>
  12. </view>
  13. </template>
  14. <script lang="ts" setup>
  15. import { ref, watch } from 'vue';
  16. import Props from './props';
  17. import { PatientRead } from '../../../service';
  18. const props = defineProps(Props);
  19. const list = ref([]);
  20. const option = ref({} as any);
  21. const isAllRead = ref(1);
  22. const pushContent = ref('');
  23. const init = async (datas) => {
  24. if (datas && !datas.length) return;
  25. pushContent.value = datas[0].PushContent;
  26. option.value = datas[0];
  27. let readRes = datas[0].IsRead;
  28. if (!readRes) {
  29. const resp = await PatientRead({
  30. Id: datas[0].Id,
  31. });
  32. readRes = !!resp;
  33. const pages = getCurrentPages();
  34. const homePage = pages.find((p: any) => p && p.route && p.route.indexOf('pagesCrm/business/home/home') !== -1);
  35. const target: any = homePage || (pages.length >= 2 ? pages[pages.length - 2] : undefined);
  36. const vm = target && (target as any).$vm;
  37. if (vm && typeof vm.changeItemReadStatus === 'function') {
  38. vm.changeItemReadStatus(props.date, props.index, 1);
  39. } else {
  40. uni.$emit('changeItemReadStatus', { date: props.date, index: props.index, status: 1 });
  41. }
  42. }
  43. };
  44. watch(
  45. () => props.content,
  46. (v) => {
  47. init(v);
  48. },
  49. {
  50. immediate: true,
  51. deep: true,
  52. }
  53. );
  54. </script>
  55. <style lang="scss" scoped>
  56. @import './common.scss';
  57. .title {
  58. font-family: PingFang-SC, PingFang-SC;
  59. font-weight: bold;
  60. font-size: 36rpx;
  61. text-align: center;
  62. padding: 42rpx 0;
  63. }
  64. </style>