Commit 78603154 by yanju

Merge branch 'yoona' into 'master'

博客发布新加字段

See merge request pigbigbig/beyond-clouds-front!46
parents 9fc3687e beaf8b1b
...@@ -312,7 +312,8 @@ export default { ...@@ -312,7 +312,8 @@ export default {
position: absolute; position: absolute;
width: 196*$length; width: 196*$length;
height: 122*$length; height: 122*$length;
overflow: auto; overflow-y: auto;
overflow-x: hidden;
z-index: 999; z-index: 999;
border: 1*$length solid #F4F8FA; border: 1*$length solid #F4F8FA;
@include border-radius(4*$length); @include border-radius(4*$length);
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
<div class="editor-container"> <div class="editor-container">
<mavon-editor <mavon-editor
ref="content" ref="content"
v-model="content"
:toolbars="markdownOption" :toolbars="markdownOption"
class="editor" class="editor"
placeholder="博客正文...." placeholder="博客正文...."
...@@ -123,15 +124,22 @@ ...@@ -123,15 +124,22 @@
import CardContainer from "../../../components/pc/cardContainer"; import CardContainer from "../../../components/pc/cardContainer";
import SelectCard from "../../../components/pc/select/selectCard"; import SelectCard from "../../../components/pc/select/selectCard";
import config from "../../../action/config"; import config from "../../../action/config";
export default { export default {
async asyncData ({ $axios }) { async asyncData ({ $axios }) {
const blogList = await $axios.$get(config.api.get.Blog.myList,{ const blogListRes = await $axios.$get(config.api.get.Blog.myList,{
params:{ params:{
page:1, page:1,
size:12, size:12,
} }
}); });
return {blogList:blogList.data.dataList}
// console.log(this);
return {
blogList:blogListRes.data.dataList
};
}, },
components: {SelectCard, CardContainer}, components: {SelectCard, CardContainer},
data() { data() {
...@@ -166,7 +174,7 @@ ...@@ -166,7 +174,7 @@
preview: true // 预览 preview: true // 预览
}, },
zIndex: 100, // 控制全屏时 zIndex: 100, // 控制全屏时
value: '', content: '',
comment: '', comment: '',
reprint: '', reprint: '',
lastSaveTime: new Date(), lastSaveTime: new Date(),
...@@ -180,13 +188,13 @@ ...@@ -180,13 +188,13 @@
allowForward:true, allowForward:true,
blogAbstract:'', blogAbstract:'',
blogTitle:'', blogTitle:'',
content:'', blogDetail:'',
tagIds:'', tagIds:'',
i:0, i:0,
tagList:[], tagList:[],
img:"", img:"",
//classList: [{id:1,title:"web"}, {id:2,title:"java"},{id:3,title:"javascript"}] classList: [{tagId:1,tag:"web"}, {tagId:2,tag:"java"},{tagId:3,tag:"javascript"}]
classList:["web","java","javascript"] // classList:["web","java","javascript"]
} }
}, },
methods: { methods: {
...@@ -217,8 +225,6 @@ ...@@ -217,8 +225,6 @@
for(this.i;this.i<this.tagIds.length;this.i++){ for(this.i;this.i<this.tagIds.length;this.i++){
this.tagList+=this.tagIds[this.i].tag+" " this.tagList+=this.tagIds[this.i].tag+" "
} }
}, },
//上传图片 //上传图片
async changeToUploadCover(e) { async changeToUploadCover(e) {
...@@ -296,22 +302,22 @@ ...@@ -296,22 +302,22 @@
return false; return false;
} }
if(this.originLink!==''){ if(this.originLink!==''){
if(this.originLink.slice(0, 12) === "https://www."||this.originLink==="无" ){ let reg =/^(?=^.{3,255}$)((http|https|ftp)?:\/\/)?(www\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:\d+)*(\/)?(?:\/(.+)\/?$)?(\/\w+\.\w+)*([\?&]\w+=\w*|[\u4e00-\u9fa5]+)*$/;
if (this.originLink==="无" ) {
this.dataPostSaveUserInfo(); this.dataPostSaveUserInfo();
return false; return false;
}else if(this.originLink.slice(0, 12) !== "https://www."){ } else if (!reg.test(this.originLink)) {
this.$refs.originLink.focus(); this.$refs.originLink.focus();
this.$message({ this.$message({
message: "请输入开头为https://www.的有效相关链接", type: 'warning',
type: 'warning' message: '请输入正确的网站地址'
}); });
return false; return false
} }
}else{ }else{
this.originLink='无'; this.originLink='无';
this.dataPostSaveUserInfo() this.dataPostSaveUserInfo()
} }
}, },
dataPostSaveUserInfo(){ dataPostSaveUserInfo(){
...@@ -320,6 +326,7 @@ ...@@ -320,6 +326,7 @@
allowForward: this.allowForward,//转载权限 allowForward: this.allowForward,//转载权限
blogAbstract: this.blogAbstract,//摘要 blogAbstract: this.blogAbstract,//摘要
content: this.content,//内容 content: this.content,//内容
contentHtml: this.blogDetail,// 内容的html
blogTitle: this.blogTitle,//标题 blogTitle: this.blogTitle,//标题
categoryId: this.blogClass,//文章类型 categoryId: this.blogClass,//文章类型
cover: this.cover,//封面图 cover: this.cover,//封面图
...@@ -383,16 +390,15 @@ ...@@ -383,16 +390,15 @@
console.log(pos); console.log(pos);
}, },
save(value, render) { //保存文章内容 save(value, render) { //保存文章内容
this.content = render; this.blogDetail = render;
}, },
intervalSave(value, render) { intervalSave(value, render) {
// 自动保存 // 自动保存
// render: value 经过markdown解析后的结果 // render: value 经过markdown解析后的结果
let now = new Date(); // this.lastSaveTime = now;
if (now - this.lastSaveTime >= 2 * 1000) { this.blogDetail = render;
this.lastSaveTime = now; // let now = new Date();
this.content = render; // if (now - this.lastSaveTime >= 2 * 1000) {}
}
}, },
readScreen(boolean, str) { // 预览 readScreen(boolean, str) { // 预览
this.zIndex = 8000 this.zIndex = 8000
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment