Commit 5dabf285 by yanju

Merge branch 'master' of coding.yundingshuyuan.com:pigbigbig/beyond-clouds-front

parents 3872a944 0ba564f5
......@@ -18,7 +18,7 @@
:canMove="option.canMove"
:canMoveBox="option.canMoveBox"
:original="option.original"
:autoCrop="option.autoCrop"
:autoCrop="autoCrop"
:fixed="option.fixed"
:fixedNumber="[cropperW, cropperH]"
:centerBox="option.centerBox"
......@@ -83,6 +83,10 @@
type:Number,
default: 1,
},
autoCrop:{
type:Boolean,
default:1,
},
addImg:Function
},
computed:{
......
<template>
<div>
<div class="select-container" v-if="selectType === '1'" style="height: 100px;">
<div class="select-container" v-if="selectType === '1'" style="min-height: 100px;width: 354px;">
<div class="select-container__input-box">
<div>
<!--@focus="handleShow"-->
......@@ -9,8 +9,8 @@
@blur="isShow=false"
@keyup.enter="handleSearch"
v-model="value.tag"
ref="tag"
>
<span>{{list.length ? list.length : 0}}</span>
<transition name="fade">
<div class="label-list__wrap" v-if="isShow || isShow2" @mouseleave="isShow2=false">
<div class="label-list">
......@@ -41,9 +41,9 @@
></label-wrap>
</div>
</div>
<div class="select-container" v-if="selectType === '2'" style="width: 196px">
<div class="select-container" v-if="selectType === '2'" style="width: 196px" @mouseleave="isShow=false">
<div class="input-box" @click="handleShow">
<input type="text" v-model="value.tag" disabled="true" :placeholder="placeholder">
<input type="text" v-model="value.tag" :placeholder="placeholder" ref="select">
<div class="icon-box">
<yun-icon name="down_arrow" size="10px" color="#999"></yun-icon>
</div>
......@@ -82,7 +82,6 @@ export default {
tag: 'web'
}],
searchList: [],
arr: [],
result: [],
value: {
tagId: '',
......@@ -124,6 +123,7 @@ export default {
// 删除选中的标签
handleDelete(index){
this.result.splice(index, 1);
this.$emit('handleTag', this.result);
},
// 回车后,进行搜索
async handleSearch(){
......@@ -154,9 +154,9 @@ export default {
},
// 点击 标签 自动选择
handleTags(){
this.arr.push(this.value);
this.result.push(this.value);
let map = new Map();
for (let item of this.arr) {
for (let item of this.result) {
console.log(item);
if (!map.has(item.tag)) {
map.set(item.tag, item)
......@@ -182,8 +182,13 @@ export default {
tagName: value,
tagType: 0
}).then(res => {
console.log(res);
if (res.code === 0) {
let obj = {
tagId: res.data.tagId,
tag: res.data.tagName
};
this.result.push(obj);
this.$popupbox.close();
this.$message({
type: 'success',
message: '标签创建成功'
......@@ -221,13 +226,6 @@ export default {
background-color: #F4F8FA;
@include border-radius(4*$length);
}
> span {
position: absolute;
right: 16*$length;
top: 14*$length;
@extend %cursorPointer;
@include fontStyle(14,19,500,#666,left);
}
.label-list{
position: absolute;
top:56*$length;
......
......@@ -64,7 +64,7 @@
<span>*</span>
<select-card selectType="1" @handleTag="handleTagList"></select-card>
</div>
<select-card selectType="2" :class-list="classList" @handleClass="handleQuestionClass" placeholder="请选择问题分类"></select-card>
<select-card selectType="2" :class-list="classList.title" @handleClass="handleQuestionClass" placeholder="请选择问题分类"></select-card>
</div>
<div class="choose-container">
<div class="input-box__wrap">
......@@ -103,17 +103,18 @@
</div>
<div class="blog-release__footer">
<p class="footer__left">上传封面
<img :src="imgSrc" alt="">
<input type="file" @change="changeToUploadCover(e)" placeholder="上传项目封面图" accept="image/png,image/gif,image/jpeg" >
<img :src="this.userCover" alt="">
<input type="file" @change="(e)=>openCropper(e)" placeholder="上传项目封面图" accept="image/png,image/gif,image/jpeg" >
</p>
<div class="footer__right">
<p>已自动存为草稿</p>
<button class="preview" @click="readScreen">预览</button>
<button class="submit" v-on:click="postBlog">提交</button>
<button class="submit" v-on:click="dataPost">提交</button>
</div>
</div>
</div>
</card-container>
<yun-cropper :type="1" :autoCrop="false" :file="addFile" v-on:listenCropperPic="getCroppedPic"></yun-cropper>
</div>
</div>
</template>
......@@ -170,13 +171,17 @@
way: '',
comment: '',
reprint: '',
imgSrc: '',
lastSaveTime: new Date(),
blogClass: '',
addFile:{},
userCover:'',
cover:'',
originLink:'',
blogAbstract:'',
//blogAbstract:'',
questionClass: '',
classList: ['web', 'java', 'javascript']
img:"",
//classList: [{id:1,title:"web"}, {id:2,title:"java"},{id:3,title:"javascript"}]
classList:["web","java","javascript"]
}
},
methods: {
......@@ -185,15 +190,15 @@
},
// 获得下拉框得内容
handleBlogClass(value) {
this.blogClass = value;
if(value=="web"){
this.blogClass=1
}else if(value=="java"){
this.blogClass = value.tag;
if(value.tag==="web"){
this.blogClass=1;
}else if(value.tag==="java"){
this.blogClass=2
}else if(value=="javascript"){
}else if(value.tag==="javascript"){
this.blogClass=3
}
console.log(this.blogClass);
console.log(this.blogClass)
},
handleQuestionClass(value) {
this.class = value;
......@@ -204,14 +209,63 @@
console.log(tagList);
},
postBlog(){
//this.handleTag();
this.$axios.$post(config.api.post.Blog.release,{
openCropper(e){
this.addFile = e.target.files[0];
},
getCroppedPic(pic){
if(pic){
this.userCover = pic;
console.log(this.cover)
//this.dataPostSaveUserInfo(1);
}
},
dataPost() {
this.cover = this.userCover;
if (this.originLink.slice(0, 12) === "https://www." || this.originLink.length === 0) {
if (this.originLink.length === 0) {
this.originLink = "null";
}
if (this.cover === '') {
this.dataPostSaveUserInfo(2)
} else {
this.dataPostSaveUserInfo(1)
}
} else {
this.$message({
message: "请输入开头为https://www.的有效网址",
type: 'warning'
})
}
},
dataPostSaveUserInfo(type){
let userInfo1 = {
allowComment: this.allowComment,//评论权限
allowForward: this.allowForward,//转载权限
blogAbstract: this.blogAbstract,
content: this.content,
blogTitle: this.blogTitle,
blogAbstract: this.blogAbstract,//摘要
content: this.content,//内容
blogTitle: this.blogTitle,//标题
categoryId: this.blogClass,//文章类型
cover: this.cover,//封面图
originLink: this.originLink,
tagIds: [
"Java"//标签id
],
topicIds: [
"Java"//话题id
],
viewPrivileges: this.way //1公开,0私有
};
let userInfo2 = {
allowComment: this.allowComment,//评论权限
allowForward: this.allowForward,//转载权限
blogAbstract: this.blogAbstract,//摘要
content: this.content,//内容
blogTitle: this.blogTitle,//标题
categoryId: this.blogClass,//文章类型
cover: "string",//封面图
originLink: this.originLink,
......@@ -222,23 +276,33 @@
"Java"//话题id
],
viewPrivileges: this.way //1公开,0私有
}).then((response)=>{
//处理response
if(response.code===0) {
};
this.$axios.$post(config.api.post.Blog.release,type===1?userInfo1:userInfo2).then((response)=>{
if(response.code===0){
let user = {userAvatar:this.userAvatar}
this.$store.commit('userProfile/setUser', user);
this.$message({
type: 'success',
message: '提交成功!'
});
message:response.msg,
type:'success'
})
}else{
this.$message({
message:"提交失败 "+response.data.errMsg,
type:'error'
message:response.data.errMsg,
type:'warning'
})
}
})
},
imgAdd(pos, file) {
//添加图片,pos为位置
// 第一步.将图片上传到服务器.
......@@ -257,7 +321,8 @@
* 2. 通过$refs获取: html声明ref : `<mavon-editor ref=md ></mavon-editor>,`$vm`为 `this.$refs.md`
*
*/
$vm.$img2Url(pos, url);
//$vm.$img2Url(pos, url);
console.log(url)
})
},
imgDel(pos, url) { //删除图片,并不是修改就会触发,仅支持工具栏操作
......
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