Detail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <script setup name="reportDetail">
  2. import {ref} from 'vue'
  3. import { useRoute } from "vue-router";
  4. import apiReport from '@/api/report'
  5. import ReportPublishPop from './components/ReportPublishPop.vue'
  6. import { showToast,showDialog } from 'vant';
  7. const route=useRoute()
  8. // 获取报告详情
  9. let reportInfo=ref(null)
  10. async function getReportDetail(){
  11. const res=await apiReport.getReportDetail({ReportId:Number(route.query.id)})
  12. if(res.Ret===200){
  13. reportInfo.value=res.Data
  14. document.title=res.Data.Title
  15. }
  16. }
  17. getReportDetail()
  18. // 发布报告
  19. const showPublishPop=ref(false)
  20. // 取消发布
  21. function handleReportPublishCancle(){
  22. showDialog({
  23. title: '提示',
  24. message: `是否确认取消发布?`,
  25. showCancelButton:true
  26. }).then(()=>{
  27. apiReport.reportPublishCancle({ReportIds:Number(route.query.id)}).then(res=>{
  28. if(res.Ret===200){
  29. getReportDetail()
  30. }
  31. })
  32. })
  33. }
  34. // 发布弹窗关闭
  35. function handlePublishPopClose(refresh){
  36. if(refresh){
  37. getReportDetail()
  38. }
  39. showPublishPop.value=false
  40. }
  41. // 删除报告
  42. function handleDelReport(){
  43. showDialog({
  44. title: '提示',
  45. message: '删除操作不可恢复,确认删除吗?',
  46. showCancelButton:true
  47. }).then(() => {
  48. // on close
  49. apiReport.reportDel({ReportIds:Number(route.query.id)}).then(res=>{
  50. if(res.Ret===200){
  51. showToast('删除成功')
  52. setTimeout(() => {
  53. window.close()
  54. }, 1500);
  55. }
  56. })
  57. }).catch(()=>{})
  58. }
  59. // 推送消息
  60. function handleReportSendMsg(){
  61. }
  62. </script>
  63. <template>
  64. <div class="report-detail-page" v-if="reportInfo">
  65. <div class="top-stage-box">
  66. <span class="stage">第{{reportInfo.Stage}}期 / {{reportInfo.Frequency}}</span>
  67. <template v-if="reportInfo.State===1">
  68. <!-- 删除 -->
  69. <div class="btn-item" @click="handleDelReport">
  70. <img src="@/assets/imgs/icon_del.png" alt="">
  71. </div>
  72. <!-- 发布 -->
  73. <div class="btn-item" @click="showPublishPop=true">
  74. <img src="@/assets/imgs/report/icon_publish.png" alt="">
  75. </div>
  76. </template>
  77. <template v-if="reportInfo.State===2">
  78. <!-- 推送消息 -->
  79. <div class="btn-item" @click="handleReportSendMsg">
  80. <img src="@/assets/imgs/icon_publish.png" alt="">
  81. </div>
  82. <!-- 取消发布 -->
  83. <div class="btn-item" @click="showPublishPop=true">
  84. <img src="@/assets/imgs/report/icon_publish.png" alt="">
  85. </div>
  86. </template>
  87. </div>
  88. <h1 class="report-title">{{reportInfo.Title}}</h1>
  89. <div class="auth-box">
  90. <span>{{reportInfo.Author}}</span>
  91. <span>{{reportInfo.PublishTime}}</span>
  92. </div>
  93. <div class="report-abstract">{{reportInfo.Abstract}}</div>
  94. <div class="report-html-wrap" v-html="reportInfo.Content"></div>
  95. </div>
  96. <!-- 报告发布弹窗 -->
  97. <van-popup
  98. v-model:show="showPublishPop"
  99. position="center"
  100. round
  101. >
  102. <ReportPublishPop :reportId="$route.query.id" @close="handlePublishPopClose"/>
  103. </van-popup>
  104. </template>
  105. <style lang="scss" scoped>
  106. .report-detail-page{
  107. padding: 30px 34px;
  108. .report-title{
  109. margin: 30px 0;
  110. font-weight: 600;
  111. font-size: 42px;
  112. line-height: 56px;
  113. }
  114. .auth-box{
  115. display: flex;
  116. justify-content: space-between;
  117. font-size: $font-grey;
  118. font-size: 36px;
  119. padding-bottom: 40px;
  120. border-bottom: 1px solid $border-color;
  121. }
  122. .report-abstract{
  123. font-size: 34px;
  124. line-height: 54px;
  125. margin: 40px 0;
  126. }
  127. }
  128. .top-stage-box{
  129. .stage{
  130. display: inline-block;
  131. background-color: #F2F3FF;
  132. border-radius: 8px;
  133. height: 72px;
  134. line-height: 72px;
  135. padding: 0 20px;
  136. font-size: 28px;
  137. }
  138. .btn-item{
  139. float: right;
  140. width: 70px;
  141. height: 70px;
  142. border-radius: 50%;
  143. display: flex;
  144. justify-content: center;
  145. align-items: center;
  146. background-color: #F2F3FF;
  147. margin-left: 40px;
  148. img{
  149. width: 48px;
  150. height: 48px;
  151. }
  152. }
  153. }
  154. </style>