jwyu 1 yıl önce
ebeveyn
işleme
53523c556b

+ 14 - 1
src/hooks/useFroalaEditor.js

@@ -3,6 +3,7 @@ import { ref,nextTick } from "vue";
 export function useInitFroalaEditor() {
 	let frolaEditorContentChange=ref(false)//富文本内容是否改变
 	let lastFocusPosition=ref(null)//最后焦点位置
+	let imgUploadFlag=ref(true)//图片是否上传完成
 
 	const options = {
 		toolbarButtons: [
@@ -62,7 +63,18 @@ export function useInitFroalaEditor() {
 					getSelection().rangeCount&&(lastFocusPosition.value=getSelection().getRangeAt(0))
 				})
 			},
-
+			'image.beforePasteUpload':function(){
+				imgUploadFlag.value=false
+			},
+			'image.beforeUpload':function(){
+				imgUploadFlag.value=false
+			},
+			'image.inserted':function(){
+				imgUploadFlag.value=true
+			},
+			'image.error':function(){
+				imgUploadFlag.value=true
+			},
 		}
 	};
 
@@ -96,6 +108,7 @@ export function useInitFroalaEditor() {
 	return {
 		lastFocusPosition,
 		frolaEditorContentChange,
+		imgUploadFlag,
 		initFroalaEditor,
 	}
 }

+ 2 - 0
src/views/report/AddReport.vue

@@ -148,6 +148,8 @@ async function handleReportOpt(type){
         showToast('请填写报告标题')
         return
     }
+    //如果富文本中有未上传完成的图片,去除这个dom
+    $('.fr-element').find('img.fr-uploading').length&&$('.fr-element').find('img.fr-uploading').remove()
     const params={
         AddType: reportBaseInfoData.addType,
 		ClassifyIdFirst: reportBaseInfoData.classifyName[0].id,

+ 6 - 1
src/views/report/EditReport.vue

@@ -15,7 +15,7 @@ const router=useRouter()
 const route=useRoute()
 
 
-const {lastFocusPosition,initFroalaEditor,frolaEditorContentChange}=useInitFroalaEditor()
+const {lastFocusPosition,initFroalaEditor,imgUploadFlag,frolaEditorContentChange}=useInitFroalaEditor()
 let reportContentEditorIns=null//报告内容编辑器实例
 
 let autoSaveTimer=null
@@ -34,6 +34,9 @@ onUnmounted(()=>{
 
 // 自动保存报告
 async function autoSaveReportContent(){
+    if(!imgUploadFlag.value)return
+    //如果富文本中有未上传完成的图片,去除这个dom
+    $('.fr-element').find('img.fr-uploading').length&&$('.fr-element').find('img.fr-uploading').remove()
     const res=await apiReport.reportContentSave({
         ReportId:Number(route.query.id),
         Content:$('.fr-element').html(),
@@ -220,6 +223,8 @@ async function handleReportOpt(type){
         showToast('请填写报告标题')
         return
     }
+    //如果富文本中有未上传完成的图片,去除这个dom
+    $('.fr-element').find('img.fr-uploading').length&&$('.fr-element').find('img.fr-uploading').remove()
     const params={
         ReportId:Number(route.query.id),
         AddType: reportBaseInfoData.addType,

+ 17 - 2
src/views/report/List.vue

@@ -448,11 +448,15 @@ async function handleReportEdit(e){
                     </h2>
                     <p class="van-multi-ellipsis--l2 des">{{item.Abstract}}</p>
                     <div class="bot-info">
-                        <div>
+                        <div class="time">
                             <span style="margin-right:10px">{{moment(item.ModifyTime).format('YYYY-MM-DD')}}</span>
                             <span>{{item.AdminRealName}}</span>
                         </div>
-                        <div>
+                        <div class="read-count">
+                            <span>PV:{{item.Pv}}</span>
+                            <span>UV:{{item.Uv}}</span>
+                        </div>
+                        <div class="status">
                             <span v-if="item.State===1">未发布</span>
                             <span v-if="item.State===2" class="active-status">已发布</span>
                         </div>
@@ -742,9 +746,20 @@ async function handleReportEdit(e){
             justify-content: space-between;
             color: $font-grey;
             font-size: 28px;
+            .time{
+                flex: 1;
+            }
             .active-status{
                 color: $font-success;
             }
+            .read-count{
+                color: $theme-warning;
+                margin-right: 30px;
+                span{
+                    display: inline-block;
+                    margin: 0 10px;
+                }
+            }
         }
     }
 }

+ 9 - 1
src/views/report/chapter/Detail.vue

@@ -18,7 +18,7 @@ const router=useRouter()
 
 const userInfo=useUserInfo()
 
-const {lastFocusPosition,initFroalaEditor,frolaEditorContentChange}=useInitFroalaEditor()
+const {lastFocusPosition,initFroalaEditor,imgUploadFlag,frolaEditorContentChange}=useInitFroalaEditor()
 let reportContentEditorIns=null//报告内容编辑器实例
 
 let autoSaveTimer=null
@@ -35,6 +35,10 @@ onUnmounted(()=>{
 // 自动保存
 function autoSaveReportContent(e){
     if(!e&&!frolaEditorContentChange.value) return
+    if(!imgUploadFlag.value){
+        e==='cg'&&showToast('有图片未上传完成,请稍等')
+        return
+    }
     let arr=[]
     ticketList.value.forEach(item=>{
         let obj={
@@ -49,6 +53,8 @@ function autoSaveReportContent(e){
 			arr.push(obj)
         }
     })
+    //如果富文本中有未上传完成的图片,去除这个dom
+	$('.fr-element').find('img.fr-uploading').length&&$('.fr-element').find('img.fr-uploading').remove()
     apiReport.chapterDetailSave({
         ReportChapterId: Number(route.query.id),
 		Title:chapterBaseInfo.title,
@@ -339,6 +345,8 @@ async function chapterReportPublish(PublishReport){
 			arr.push(obj)
         }
     })
+    //如果富文本中有未上传完成的图片,去除这个dom
+	$('.fr-element').find('img.fr-uploading').length&&$('.fr-element').find('img.fr-uploading').remove()
     const res=await apiReport.chapterReportPublish({
         ReportChapterId: Number(route.query.id),
 		Title:chapterBaseInfo.title,

+ 1 - 1
src/views/report/chapter/List.vue

@@ -302,7 +302,7 @@ async function handleShowPoster(item){
 
 <style lang="scss" scoped>
 .report-chapterlist-page{
-    height: 100%;
+    height: 100dvh;
     display: flex;
     flex-direction: column;
     .bot-btns{

+ 6 - 1
src/views/reportEn/AddReport.vue

@@ -14,7 +14,7 @@ const cachedViewsStore=useCachedViewsStore()
 const router=useRouter()
 const route=useRoute()
 
-const {lastFocusPosition,frolaEditorContentChange,initFroalaEditor}=useInitFroalaEditor()
+const {lastFocusPosition,frolaEditorContentChange,imgUploadFlag,initFroalaEditor}=useInitFroalaEditor()
 
 let reportContentIns=null//报告内容编辑器实例
 let overviewContentIns=null//overview内容编辑器实例
@@ -38,6 +38,9 @@ onUnmounted(()=>{
 
 // 自动保存报告
 async function autoSaveReportContent(){
+    if(!imgUploadFlag.value)return
+    //如果富文本中有未上传完成的图片,去除这个dom
+    $('#editor .fr-element').find('img.fr-uploading').length&&$('#editor .fr-element').find('img.fr-uploading').remove()
     const res=await apiReportEn.reportContentSave({
         ReportId:Number(route.query.id),
         Content:$('#editor .fr-element').html(),
@@ -212,6 +215,8 @@ async function handleRefreshAllChart(){
 
 // 报告操作
 async function handleReportOpt(e){
+    //如果富文本中有未上传完成的图片,去除这个dom
+    $('#editor .fr-element').find('img.fr-uploading').length&&$('#editor .fr-element').find('img.fr-uploading').remove()
     const params={
         AddType:reportBaseInfoData.addType,
         ClassifyIdFirst:reportBaseInfoData.classifyName[0]?.id,

+ 12 - 1
src/views/reportEn/List.vue

@@ -447,10 +447,13 @@ function handleGoEmailLog(e){
                     <h2 :class="['van-ellipsis title',item.Title.startsWith('【')?'inline-title':'']">{{item.Title}}</h2>
                     <p class="van-multi-ellipsis--l2 des">{{item.Abstract}}</p>
                     <div class="bot-info">
-                        <div>
+                        <div style="flex:1">
                             <span style="margin-right:10px">{{moment(item.ModifyTime).format('YYYY-MM-DD')}}</span>
                             <span>{{item.AdminRealName}}</span>
                         </div>
+                        <div class="read-count">
+                            <span>PV:{{item.Pv}}</span>
+                        </div>
                         <div>
                             <span v-if="item.State===1">未发布</span>
                             <span v-if="item.State===2" class="active-status">已发布</span>
@@ -727,6 +730,14 @@ function handleGoEmailLog(e){
             .active-status{
                 color: $font-success;
             }
+            .read-count{
+                color: $theme-warning;
+                margin-right: 30px;
+                span{
+                    display: inline-block;
+                    margin: 0 10px;
+                }
+            }
         }
     }
 }