|
@@ -9,35 +9,41 @@
|
|
|
v-model="addDocForm.Content"
|
|
|
></froala>
|
|
|
</div>
|
|
|
- <div class="edit-container-document-options">
|
|
|
- <div class="document-options-button-box">
|
|
|
- <el-button type="primary" class="document-options-button" @click="previewDocument" v-loading="isSubmiting">预览</el-button>
|
|
|
- <el-button type="primary" class="document-options-button" @click="saveDocument('保存')" v-loading="isSubmiting">保存</el-button>
|
|
|
- <el-button type="primary" class="document-options-button" @click="saveDocument('发布')" v-loading="isSubmiting">发布</el-button>
|
|
|
+ <div class="right-area">
|
|
|
+ <div class="save-time" v-if="modifyTime">
|
|
|
+ 最近保存时间:{{ modifyTime }}
|
|
|
</div>
|
|
|
- <div class="document-options-form">
|
|
|
- <el-form :model="addDocForm" ref="addDocForm" :rules="addDocRules">
|
|
|
- <el-form-item label="文章标题" prop="Title">
|
|
|
- <el-input v-model="addDocForm.Title" placeholder="请输入文章标题"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="所属分类" prop="ClassifyId">
|
|
|
- <el-cascader style="width: 100%;"
|
|
|
- v-model="addDocForm.ClassifyId" :options="classifyList"
|
|
|
- :props="{value:'ClassifyId',label:'ClassifyName',children:'Children',emitPath:false,disabled:'Disabled'}" placeholder="所属分类"/>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="文章作者" prop="Author">
|
|
|
- <el-input v-model="addDocForm.Author" placeholder="请输入文章作者"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="相关推荐">
|
|
|
- <div v-for="(item,index) in addDocForm.RecommendData" :key="index" class="form-item-recommendedLink">
|
|
|
- <el-input v-model="item.Name" placeholder="请输入链接名称" style="width: 190px;"></el-input>
|
|
|
- <div class="recommendedLink-line"></div>
|
|
|
- <el-input v-model="item.Url" placeholder="请输入链接" style="width: 190px;"></el-input>
|
|
|
- </div>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
+ <div class="edit-container-document-options">
|
|
|
+ <div class="document-options-button-box">
|
|
|
+ <el-button type="primary" class="document-options-button" @click="previewDocument" v-loading="isSubmiting">预览</el-button>
|
|
|
+ <el-button type="primary" class="document-options-button" @click="saveDocument('保存')" v-loading="isSubmiting">保存</el-button>
|
|
|
+ <el-button type="primary" class="document-options-button" @click="saveDocument('发布')" v-loading="isSubmiting">发布</el-button>
|
|
|
+ </div>
|
|
|
+ <div class="document-options-form">
|
|
|
+ <el-form :model="addDocForm" ref="addDocForm" :rules="addDocRules">
|
|
|
+ <el-form-item label="文章标题" prop="Title">
|
|
|
+ <el-input v-model="addDocForm.Title" placeholder="请输入文章标题"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属分类" prop="ClassifyId">
|
|
|
+ <el-cascader style="width: 100%;"
|
|
|
+ v-model="addDocForm.ClassifyId" :options="classifyList"
|
|
|
+ :props="{value:'ClassifyId',label:'ClassifyName',children:'Children',emitPath:false,disabled:'Disabled'}" placeholder="所属分类"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="文章作者" prop="Author">
|
|
|
+ <el-input v-model="addDocForm.Author" placeholder="请输入文章作者"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="相关推荐">
|
|
|
+ <div v-for="(item,index) in addDocForm.RecommendData" :key="index" class="form-item-recommendedLink">
|
|
|
+ <el-input v-model="item.Name" placeholder="请输入链接名称" style="width: 190px;"></el-input>
|
|
|
+ <div class="recommendedLink-line"></div>
|
|
|
+ <el-input v-model="item.Url" placeholder="请输入链接" style="width: 190px;"></el-input>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -145,6 +151,18 @@ import {createBottomHref} from "./utils/common"
|
|
|
},
|
|
|
anchorData:[],
|
|
|
isSubmiting:false,
|
|
|
+ autoSaveTimer:null,
|
|
|
+ modifyTime:'',
|
|
|
+ contentChange:false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ addDocForm:{
|
|
|
+ handler:function(){
|
|
|
+ console.log('内容改变');
|
|
|
+ this.contentChange=true
|
|
|
+ },
|
|
|
+ deep:true
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -161,10 +179,19 @@ import {createBottomHref} from "./utils/common"
|
|
|
Content:res.Data.Content,
|
|
|
RecommendData:res.Data.Recommend || [{Name:"",Url:""},{Name:"",Url:""}]
|
|
|
}
|
|
|
-
|
|
|
+ this.modifyTime=res.Data.ModifyTime
|
|
|
+ if((!this.autoSaveTimer) && this.addDocForm.Id){
|
|
|
+ this.autoSaveTimer=setInterval(()=>{
|
|
|
+ this.saveDocument('保存',true)
|
|
|
+ },6000)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ destroyed(){
|
|
|
+ clearInterval(this.autoSaveTimer)
|
|
|
+ this.autoSaveTimer=null
|
|
|
},
|
|
|
mounted(){
|
|
|
this.addDocForm.Content=""
|
|
@@ -256,7 +283,6 @@ import {createBottomHref} from "./utils/common"
|
|
|
}
|
|
|
},
|
|
|
previewDocument(){
|
|
|
- // this.addDocForm.Content=`<p>范德萨发的刚发的</p><p>刚发的g梵蒂冈</p><p>割发代首刚发的</p><hr><h1>1. 个刚发的施工方</h1><p>刚发的刚发的g规范的施工方都是割发代首规范</p><h2>1.1. 规范的三个富士达割发代首</h2><p>个梵蒂冈是梵蒂冈讽德诵功范德萨割发代首个割发代首</p><p>刚分手的割发代首割发代首高富帅d</p><p>刚分手的刚分手的</p><p>割发代首刚分手的</p><p>刚分手的公司发的</p><p>刚发的事故发生的</p><p><br></p><p>割发代首刚分手的刚分手的</p><h2>1.2. 噶规范十多个范德萨刚发的施工方多少公分</h2><p>个讽德诵功范德萨</p><p>割发代首割发代首刚发的s规范的三个</p><h1>2.讽德诵功是反的</h1><p>割发代首割发代首个人的施工方都是</p><p>范德萨个人东方闪电方式</p><p>割发代首割发代首</p><h2>2.1.个梵蒂冈</h2><p>讽德诵功范德萨规范的三个范德萨讽德诵功放大s</p><h2>2.2.刚发的广泛地个</h2><p>刚分手的割发代首</p><p>割发代首割发代首割发代首</p><p><br></p><p>范德萨割发代首</p><h2>2.3.辅导费是的</h2><p>范甘迪个放大割发代首个</p><p>刚发的刚发的</p><h1>3. 个梵蒂冈放大</h1>`
|
|
|
if(this.isSubmiting) return
|
|
|
if(!this.addDocForm.Content){
|
|
|
this.$message.error("文章内容不能为空")
|
|
@@ -268,7 +294,7 @@ import {createBottomHref} from "./utils/common"
|
|
|
let { href } = this.$router.resolve({ path: "/assistanceDocDetail" });
|
|
|
window.open(href, "_blank");
|
|
|
},
|
|
|
- saveDocument(type){
|
|
|
+ saveDocument(type,isAuto){
|
|
|
if(this.isSubmiting) return
|
|
|
this.$refs.addDocForm.validate(valid=>{
|
|
|
if(valid){
|
|
@@ -276,24 +302,41 @@ import {createBottomHref} from "./utils/common"
|
|
|
this.$message.error("文章内容不能为空")
|
|
|
return
|
|
|
}
|
|
|
- // console.log(this.addDocForm);
|
|
|
- this.isSubmiting=true
|
|
|
+ if(!isAuto) this.isSubmiting=true
|
|
|
if(type=="发布") this.addDocForm.Status=2
|
|
|
|
|
|
this.generateAnchor()
|
|
|
this.addDocForm.AnchorData = this.anchorData
|
|
|
//保存
|
|
|
- assistanceDocInterence.addAssistanceDoc(this.addDocForm).then(res=>{
|
|
|
+ assistanceDocInterence.addAssistanceDoc({...this.addDocForm,IsChange:this.contentChange}).then(res=>{
|
|
|
if(res.Ret == 200){
|
|
|
- this.$message({
|
|
|
+ this.contentChange=false
|
|
|
+
|
|
|
+ !isAuto && this.$message({
|
|
|
type:'success',
|
|
|
message:'操作成功',
|
|
|
- duration:2000
|
|
|
+ duration:1000
|
|
|
})
|
|
|
- setTimeout(()=>{
|
|
|
- this.$router.back()
|
|
|
+ if(type=="发布"){
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.$router.back()
|
|
|
+ },1000)
|
|
|
+ }else{
|
|
|
this.isSubmiting=false
|
|
|
- },2000)
|
|
|
+ this.modifyTime=res.Data.ModifyTime
|
|
|
+ if(!this.addDocForm.Id){
|
|
|
+ //新增
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.$router.replace("/assistanceDocAdd?DocId="+res.Data.HelpDocId)
|
|
|
+ this.addDocForm.Id = res.Data.HelpDocId
|
|
|
+ if((!this.autoSaveTimer) && this.addDocForm.Id){
|
|
|
+ this.autoSaveTimer=setInterval(()=>{
|
|
|
+ this.saveDocument('保存',true)
|
|
|
+ },6000)
|
|
|
+ }
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}).catch(()=>{
|
|
|
this.isSubmiting=false
|
|
@@ -316,41 +359,52 @@ import {createBottomHref} from "./utils/common"
|
|
|
border:solid 1px #ECECEC;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
- .edit-container-document-options{
|
|
|
- background-color: white;
|
|
|
+ .right-area{
|
|
|
margin-left: 20px;
|
|
|
- min-height: calc(100vh - 110px);
|
|
|
- border:solid 1px #ECECEC;
|
|
|
- box-sizing: border-box;
|
|
|
- width: 440px;
|
|
|
- min-width: 440px;
|
|
|
- .document-options-button-box{
|
|
|
- width: 100%;
|
|
|
- height: 80px;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 20px;
|
|
|
- box-shadow: 0px 5px 10px #ECECEC;
|
|
|
- border-bottom: solid 1px #ECECEC;
|
|
|
- .document-options-button{
|
|
|
- height: 40px;
|
|
|
- width: 120px;
|
|
|
- }
|
|
|
+ min-height: calc(100vh - 112px);
|
|
|
+ .save-time{
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 22px;
|
|
|
+ color: #000000;
|
|
|
+ font-weight: 400;
|
|
|
+ background-color: unset;
|
|
|
+ margin-bottom: 10px;
|
|
|
}
|
|
|
- .document-options-form{
|
|
|
- padding: 30px 20px;
|
|
|
- .form-item-recommendedLink{
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: flex-start;
|
|
|
+ .edit-container-document-options{
|
|
|
+ min-height: calc(100% - 32px);
|
|
|
+ background-color: white;
|
|
|
+ border:solid 1px #ECECEC;
|
|
|
+ box-sizing: border-box;
|
|
|
+ width: 440px;
|
|
|
+ min-width: 440px;
|
|
|
+ .document-options-button-box{
|
|
|
width: 100%;
|
|
|
- margin-bottom: 20px;
|
|
|
- &:last-child{
|
|
|
- margin-bottom: 0;
|
|
|
+ height: 80px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 20px;
|
|
|
+ box-shadow: 0px 5px 10px #ECECEC;
|
|
|
+ border-bottom: solid 1px #ECECEC;
|
|
|
+ .document-options-button{
|
|
|
+ height: 40px;
|
|
|
+ width: 120px;
|
|
|
}
|
|
|
- .recommendedLink-line{
|
|
|
- flex: 1;
|
|
|
- height: 1px;
|
|
|
- background-color:#DCDFE6 ;
|
|
|
+ }
|
|
|
+ .document-options-form{
|
|
|
+ padding: 30px 20px;
|
|
|
+ .form-item-recommendedLink{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-start;
|
|
|
+ width: 100%;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ &:last-child{
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+ .recommendedLink-line{
|
|
|
+ flex: 1;
|
|
|
+ height: 1px;
|
|
|
+ background-color:#DCDFE6 ;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|