Commit d5ba6a73 by 高浩杰

登录注册修改密码加 enter 发布博客修改不能加网址 修改博客

parent 0a38bd70
<template>
<div>
<div class="select-container" v-if="selectType === '1'" style="min-height: 100px;width: 354px;">
<div class="select-container" v-if="selectType === '1'" @mouseleave="isShow2=false" style="min-height: 100px;width: 354px;">
<div class="select-container__input-box">
<div>
<input
......@@ -186,6 +186,7 @@ export default {
};
this.result.push(obj);
this.$popupbox.close();
this.$emit('handleTag', this.result);
this.$message({
type: 'success',
message: '标签创建成功'
......
......@@ -35,7 +35,7 @@ module.exports = {
*/
plugins: [
'~/plugins/axios',
{src:'~/plugins/mavonEditor.js',ssr:true},
{src:'~/plugins/mavonEditor.js',ssr:false},
{src:'~/plugins/cropper.js',ssr:false},
{src:'~/plugins/messageBox.js',ssr:true},
{src:'~/plugins/popupBox.js',ssr:true},
......
......@@ -8,7 +8,7 @@
>
<div class="blog-release_List" v-for="val in blogList" :key="val.blogId" :info="val">
<div style="width: 60%"><p @click="toDetail">{{val.blogTitle}}</p></div>
<div class="blog-release_List_r" @click="toDetail" >{{val.category}}</div>
<div class="blog-release_List_r" @click="toDetail">{{val.category}}</div>
</div>
</card-container>
<card-container
......@@ -33,7 +33,13 @@
<div class="header-content">
<div class="select__wrap">
<span>*</span>
<select-card selectType="2" :class-list="classList" @handleClass="handleBlogClass" ref="blogClass" placeholder="请选择文章分类" ></select-card>
<select-card
selectType="2"
:class-list="classList"
@handleClass="handleBlogClass"
ref="blogClass"
placeholder="请选择文章分类"
></select-card>
</div>
<input type="text" placeholder="相关链接" style="width: 461px;" v-model="originLink" ref="originLink">
</div>
......@@ -104,8 +110,8 @@
</div>
<div class="blog-release__footer">
<p class="footer__left">上传封面
<img :src="this.cover" alt="">
<input type="file" @change="(e)=>changeToUploadCover(e)" placeholder="上传项目封面图" >
<img :src="cover" alt="">
<input type="file" @change="(e)=>changeToUploadCover(e)" placeholder="上传项目封面图">
</p>
<div class="footer__right">
<p>已自动存为草稿</p>
......@@ -121,25 +127,55 @@
</template>
<script>
import CardContainer from "../../../components/pc/cardContainer";
import SelectCard from "../../../components/pc/select/selectCard";
import config from "../../../action/config";
import CardContainer from "../../../components/pc/cardContainer";
import SelectCard from "../../../components/pc/select/selectCard";
import config from "../../../action/config";
export default {
async asyncData ({ $axios }) {
const blogListRes = await $axios.$get(config.api.get.Blog.myList,{
params:{
page:1,
size:12,
export default {
async asyncData({$axios, query}) {
const blogListRes = await $axios.$get(config.api.get.Blog.myList, {
params: {
page: 1,
size: 12,
}
});
console.log(this);
if (query.hasOwnProperty('id')) {
const blogDetailRes = await $axios.$get(config.api.get.Blog.detail + query.id);
return {
detailContent: blogDetailRes.data,
blogList: blogListRes.data.dataList
}
} else {
return {
blogList:blogListRes.data.dataList
blogList: blogListRes.data.dataList
};
}
},
mounted() {
if (this.$route.query.id) {
this.blogTitle = this.detailContent.blogTitle;
this.originLink = this.detailContent.originLink;
this.blogAbstract = this.detailContent.blogAbstract;
this.content = this.detailContent.content;
this.cover = this.detailContent.cover;
this.allowComment = this.detailContent.allowComment;
this.allowForward = this.detailContent.allowForward;
this.way = this.detailContent.viewPrivileges;
this.$refs.blogClass.$refs.select.value = this.detailContent.category;
this.blogClass = this.detailContent.categoryId;
console.log(this.$refs.tagIds);
let tags = [];
this.tagList = new Set();
this.detailContent.tags.forEach(item => {
let obj = {
tag: item.tagName,
tagId: item.tagId
};
tags.push(obj);
this.tagList.add(item.tagId);
});
this.$refs.tagIds.result = tags;
}
},
components: {SelectCard, CardContainer},
data() {
......@@ -179,37 +215,37 @@
reprint: '',
lastSaveTime: new Date(),
blogClass: '',
addFile:{},
userCover:'',
cover:'无',
originLink:'',
way:1,
allowComment:true,
allowForward:true,
blogAbstract:'',
blogTitle:'',
blogDetail:'',
tagIds:'',
i:0,
tagList:[],
img:"",
classList: [{tagId:1,tag:"web"}, {tagId:2,tag:"java"},{tagId:3,tag:"javascript"}]
addFile: {},
userCover: '',
cover: '无',
originLink: '',
way: 1,
allowComment: true,
allowForward: true,
blogAbstract: '',
blogTitle: '',
blogDetail: '',
tagIds: '',
i: 0,
tagList: new Set(),
img: "",
classList: [{tagId: 1, tag: "web"}, {tagId: 2, tag: "java"}, {tagId: 3, tag: "javascript"}]
// classList:["web","java","javascript"]
}
},
methods: {
toDetail(){
toDetail() {
this.$router.push('/detail')
},
// 获得下拉框得内容
handleBlogClass(value) {
this.blogClass = value.tag;
if(value.tag==="web"){
this.blogClass=1;
}else if(value.tag==="java"){
this.blogClass=2
}else if(value.tag==="javascript"){
this.blogClass=3
if (value.tag === "web") {
this.blogClass = 1;
} else if (value.tag === "java") {
this.blogClass = 2
} else if (value.tag === "javascript") {
this.blogClass = 3
}
console.log(this.blogClass)
},
......@@ -219,12 +255,10 @@
},
// 获得得标签数组
handleTagList(tagList) {
this.tagIds=tagList;
console.log(this.tagIds);
console.log(this.tagIds.length);
for(this.i;this.i<this.tagIds.length;this.i++){
this.tagList+=this.tagIds[this.i].tag+" "
}
console.log(this.tagList);
tagList.forEach(item => {
this.tagList.add(item.tagId)
});
},
//上传图片
async changeToUploadCover(e) {
......@@ -257,7 +291,7 @@
//参数判断
dataPost() {
if(this.blogTitle===''){
if (this.blogTitle === '') {
this.$refs.blogTitle.focus();
this.$message({
message: "请输入文章标题",
......@@ -265,7 +299,7 @@
});
return false;
}
if(this.blogClass===''){
if (this.blogClass === '') {
this.$refs.blogClass.handleShow();
this.$refs.blogClass.$refs.select.focus();
this.$message({
......@@ -274,7 +308,7 @@
});
return false;
}
if(this.blogAbstract===''){
if (this.blogAbstract === '') {
this.$refs.blogAbstract.focus();
this.$message({
message: "请输入文章摘要(用一句话介绍该文章)",
......@@ -282,7 +316,7 @@
});
return false;
}
if(this.content===''){
if (this.content === '') {
this.$refs.content.textAreaFocus();
this.$message({
......@@ -291,7 +325,7 @@
});
return false;
}
if(this.tagIds===''){
if (this.tagList.size === '') {
//this.$refs.tagIds.focus();
this.$refs.tagIds.handleShow();
this.$refs.tagIds.$refs.tag.focus();
......@@ -301,28 +335,28 @@
});
return false;
}
if(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==="无" ) {
if (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 === "无" || reg.test(this.originLink)) {
this.dataPostSaveUserInfo();
return false;
} else if (!reg.test(this.originLink)) {
this.$refs.originLink.focus();
this.dataPostSaveUserInfo();
this.$message({
type: 'warning',
message: '请输入正确的网站地址'
});
return false
}
}else{
this.originLink='无';
} else {
this.originLink = '无';
this.dataPostSaveUserInfo()
}
},
dataPostSaveUserInfo(){
this.$axios.$post(config.api.post.Blog.release,{
dataPostSaveUserInfo() {
if (this.$route.query.id) {
this.$axios.$put(config.api.put.Blog.revise + this.$route.query.id, {
allowComment: this.allowComment,//评论权限
allowForward: this.allowForward,//转载权限
blogAbstract: this.blogAbstract,//摘要
......@@ -332,36 +366,66 @@
categoryId: this.blogClass,//文章类型
cover: this.cover,//封面图
originLink: this.originLink,
tagIds: [
this.tagList//标签id
tagIds: Array.from(this.tagList),
topicIds: [
"null"//话题id
],
viewPrivileges: this.way //1公开,0私有
})
.then((response) => {
if (response.code === 0) {
this.$message({
message: "修改博客成功",
type: 'success'
});
this.$router.push('/personal-center/home/blog')
} else {
this.$message({
message: response.msg,
type: 'warning'
})
}
})
} else {
this.$axios.$post(config.api.post.Blog.release, {
allowComment: this.allowComment,//评论权限
allowForward: this.allowForward,//转载权限
blogAbstract: this.blogAbstract,//摘要
content: this.content,//内容
contentHtml: this.blogDetail,// 内容的html
blogTitle: this.blogTitle,//标题
categoryId: this.blogClass,//文章类型
cover: this.cover,//封面图
originLink: this.originLink,
tagIds: Array.from(this.tagList),
topicIds: [
"null"//话题id
],
viewPrivileges: this.way //1公开,0私有
}).then((response)=>{
if(response.code===0){
})
.then((response) => {
if (response.code === 0) {
this.$message({
message:"提交成功",
type:'success'
message: "发布博客成功",
type: 'success'
});
/* setTimeout(() => {
this.$router.push('/personal-center/home/blog')
}, 500);*/
this.$router.push('/personal-center/home/blog')
}else{
} else {
this.$message({
message:response.msg,
type:'warning'
message: response.msg,
type: 'warning'
})
}
})
}
},
imgAdd(pos, file) {
// filename: 写在md中的文件名, File: File Object
// 第一步.将图片上传到服务器.
......@@ -405,58 +469,69 @@
this.zIndex = 8000
}
},
}
}
</script>
<style lang="scss" scoped>
input{
border:1*$length solid transparent;
input {
border: 1*$length solid transparent;
@extend %animate-transition;
&:focus{
border:1*$length solid #00AAE6;
&:focus {
border: 1*$length solid #00AAE6;
}
}
.blog-release-container {
width: $pageWidth;
margin: 24*$length auto 32*$length auto;
@extend %flex-row-spb;
align-items: start;
.blog-release-container__l {
.blog-release_List{
.blog-release_List {
width: 266*$length;
@extend %flex-row-spb;
margin-top: 5px;
padding-left: 18*$length;
padding-right: 18*$length;
font-size: 13*$length;
p{
p {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.blog-release_List_r{
.blog-release_List_r {
color: #999999
}
:hover{
:hover {
color: #00AAE6;
cursor:pointer
cursor: pointer
}
}
}
.blog-release-container__r {
.blog-release {
width: 748*$length;
margin: 0 auto;
.blog-release__header {
margin-top: 40*$length;
.header-content{
.header-content {
@extend %flex-row-spb;
margin-bottom: 32*$length;
> span {
color: #FF7474;
font-size: 6*$length;
}
> input {
width: 726*$length;
padding: 14*$length 16*$length;
......@@ -465,9 +540,11 @@
@include border-radius(4*$length);
@include fontStyle(14, 46, 500, #666, left);
}
.select__wrap{
.select__wrap {
@extend %flex-row-spb;
align-items: start;
> span {
color: #FF7474;
font-size: 6*$length;
......@@ -477,32 +554,39 @@
}
}
}
.blog-release__content {
@extend %flex-row-spb;
align-items: start;
> span {
display: inline-block;
margin-top: 18*$length;
color: #FF7474;
font-size: 6*$length;
}
.editor-container {
width: 723*$length;
height: 230*$length;
overflow: auto;
.editor {
min-height: 230*$length;
min-width: 723*$length;
}
}
}
.blog-release__select__wrap {
@extend %flex-row-spb;
align-items: start;
margin-top: 32*$length;
.select-content{
.select-content {
@extend %flex-row-spb;
align-items: start;
> span {
color: #FF7474;
font-size: 6*$length;
......@@ -511,25 +595,32 @@
}
}
}
.choose-container{
.choose-container {
@extend %flex-row-spb;
.input-box__wrap{
.input-box__wrap {
@extend %flex-row-spb;
> span {
margin-right: 16*$length;
color: #FF7474;
font-size: 6*$length;
}
.input-box {
margin-right: 40*$length;
line-height: 16*$length;
input[type="radio"] {
display: none;
}
label {
@include fontStyle(12, 16, 500, #999, left);
vertical-align: middle;
}
input[type="radio"] + label::before {
content: "\a0"; /*不换行空格*/
display: inline-block;
......@@ -544,6 +635,7 @@
background-color: #fff;
@include border-radius(2*$length);
}
input[type="radio"]:checked + label::before {
display: inline-block;
width: 12*$length;
......@@ -567,38 +659,44 @@
@extend %flex-row-spb;
align-items: flex-end;
margin-top: 35*$length;
.footer__left{
.footer__left {
overflow: hidden;
width:196*$length;
width: 196*$length;
background-color: #F4F8FA;
@extend %cursorPointer;
@include border-radius(4*$length);
@include fontStyle(12,130,500,#666,center);
& input{
@include fontStyle(12, 130, 500, #666, center);
& input {
float: left;
height:100%;
width:100%;
height: 100%;
width: 100%;
opacity: 0;
transform: translateY(-200%);
@extend %cursorPointer;
}
& img{
& img {
float: left;
height:100%;
width:100%;
height: 100%;
width: 100%;
transform: translateY(-100%);
object-fit: contain;
}
}
.footer__right{
.footer__right {
@extend %flex-row-spb;
justify-content: flex-end;
> p {
margin-right: 32*$length;
@include fontStyle(12,16,500,#999,left);
@include fontStyle(12, 16, 500, #999, left);
}
> button {
@include fontStyle(14,19,500,#fff,center);
@include fontStyle(14, 19, 500, #fff, center);
width: 100*$length;
height: 40*$length;
background-color: #00AAE6;
......@@ -606,12 +704,14 @@
@extend %cursorPointer;
@include border-radius(4*$length);
}
.preview{
.preview {
color: #666;
background-color: #fff;
margin-right: 16*$length;
@extend %animate-transition;
&:hover{
&:hover {
color: #fff;
background-color: #00AAE6;
}
......
......@@ -40,7 +40,7 @@
></login-input>
</template>
<template #mainFooter>
<login-button @handle="handleRegister" button="注册"></login-button>
<login-button @handle="handleRegister" button="注册" ref="registerButton"></login-button>
</template>
</login-wrap>
</div>
......@@ -164,12 +164,7 @@ export default {
}
},
handleRegisterEnter() {
console.log(123);
console.log(this);
this.$on('handle', (isAgree) => {
console.log(isAgree);
this.handleRegister(isAgree)
})
this.$refs.registerButton.handel();
},
async handleRegister(isAgree) {
this.checkAccount();
......
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