|
@@ -2,6 +2,7 @@
|
|
|
import {ref} from 'vue'
|
|
|
import { useRoute } from "vue-router";
|
|
|
import apiReport from '@/api/report'
|
|
|
+import { showToast,showDialog } from 'vant';
|
|
|
|
|
|
const route=useRoute()
|
|
|
|
|
@@ -16,16 +17,103 @@ async function getReportDetail(){
|
|
|
}
|
|
|
getReportDetail()
|
|
|
|
|
|
+
|
|
|
+// 发布报告
|
|
|
+const showPublishPop=ref(false)
|
|
|
+// 确认发布报告
|
|
|
+// type 1 仅发布 2发布且推送
|
|
|
+function handleConfirmPublish(type){
|
|
|
+ apiReport.reportPublish({
|
|
|
+ ReportIds:route.query.id
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.Ret==200){
|
|
|
+ if(type===2){
|
|
|
+ handleReportMessageSend(true)
|
|
|
+ }else{
|
|
|
+ if(res.Data){
|
|
|
+ showDialog({
|
|
|
+ title: '发布提示',
|
|
|
+ message: res.Data,
|
|
|
+ }).then(()=>{
|
|
|
+
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ showToast('发布成功')
|
|
|
+ }
|
|
|
+ showPublishPop.value=false
|
|
|
+ getReportDetail()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 推送消息
|
|
|
+function handleReportMessageSend(publish){
|
|
|
+ apiReport.reportMessageSend({
|
|
|
+ ReportId:Number(route.query.id)
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.Ret===200){
|
|
|
+ if(publish){
|
|
|
+ showToast('发布且推送成功')
|
|
|
+ }else{
|
|
|
+ showToast('推送成功')
|
|
|
+ }
|
|
|
+ getReportDetail()
|
|
|
+ showPublishPop.value=false
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 取消发布
|
|
|
+function handleReportPublishCancle(){
|
|
|
+ showDialog({
|
|
|
+ title: '提示',
|
|
|
+ message: `是否确认取消发布?`,
|
|
|
+ showCancelButton:true
|
|
|
+ }).then(()=>{
|
|
|
+ apiReport.reportPublishCancle({ReportIds:Number(route.query.id)}).then(res=>{
|
|
|
+ if(res.Ret===200){
|
|
|
+ getReportDetail()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="report-detail-page" v-if="reportInfo">
|
|
|
+ <template v-if="reportInfo.State===1">
|
|
|
+ <van-button type="primary" @click="showPublishPop=true">发布</van-button>
|
|
|
+ <van-button type="primary">删除</van-button>
|
|
|
+ </template>
|
|
|
+ <template v-if="reportInfo.State===2">
|
|
|
+ <van-button type="primary" @click="handleReportPublishCancle">取消发布</van-button>
|
|
|
+ <van-button type="primary" @click="handleReportMessageSend">推送消息</van-button>
|
|
|
+ </template>
|
|
|
+
|
|
|
<span>第{{reportInfo.Stage}}期/{{reportInfo.Frequency}}</span>
|
|
|
<div>{{reportInfo.Title}}</div>
|
|
|
<div><span>{{reportInfo.Author}}</span><span>{{reportInfo.PublishTime}}</span></div>
|
|
|
<div>{{reportInfo.Abstract}}</div>
|
|
|
<div v-html="reportInfo.Content"></div>
|
|
|
</div>
|
|
|
+ <!-- 报告发布弹窗 -->
|
|
|
+ <van-popup
|
|
|
+ v-model:show="showPublishPop"
|
|
|
+ position="center"
|
|
|
+ round
|
|
|
+ >
|
|
|
+ <div class="publish-report-pop-box">
|
|
|
+ <div>发布提示</div>
|
|
|
+ <p>是否发布报告,且推送模板消息和客户群?</p>
|
|
|
+ <div>
|
|
|
+ <van-button square type="primary" text="取消发布" @click="showPublishPop=false"/>
|
|
|
+ <van-button square type="primary" text="仅发布" @click="handleConfirmPublish(1)"/>
|
|
|
+ <van-button square type="primary" text="发布&推送" @click="handleConfirmPublish(2)"/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-popup>
|
|
|
</template>
|
|
|
|
|
|
<style lang="scss" scoped>
|