announcements.vue 1.7 KB

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