addq
<template>
<el-row id="AddRoom">
<el-col :xs="0" :sm="2" :md="3" :lg="4">.</el-col>
<el-col :xs="24" :sm="19" :md="16" :lg="13">
<el-card class="box-card"> <el-form ref="form" :model="form" >
<el-form-item label="标题" prop="title" :rules="[
{ required: true, message: '标题不能为空'},
{min: 5, max: 15, message: '长度在 5 到 80', trigger: 'blur' }
]">
<el-input v-model="form.title" style="width: 100%" placeholder="输入文章标题" ></el-input>
</el-form-item>
<el-form-item label="类型" >
<el-form-item prop="mainTag">
<el-select v-model="form.mainTag" style="width: 100%" placeholder="文章类型" >
<el-option label="预测" value="预测"></el-option>
<el-option label="讨论" value="讨论"></el-option>
<el-option label="知识" value="知识"></el-option>
<el-option label="不限" value="不限"></el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item >
<section class="container" style="margin-top: 10px">
<div class="quill-editor"
:content="content"
@change="onEditorChange($event)"
@blur="onEditorBlur($event)"
@focus="onEditorFocus($event)"
@ready="onEditorReady($event)"
v-quill:myQuillEditor="editorOption">
</div> <el-button type="primary" style="margin-top:20px;" @click="submitForm('form')">{{gonext}}</el-button> <el-button style="margin-top:20px;" @click="resetForm('form')">重置</el-button>
<el-button style="margin-top:20px;" @click="submit">提交</el-button>
</section>
</el-form-item>
</el-form>
</el-card>
</el-col> </el-row> </template> <style scoped>
/*
.container {
width: 60%;
margin: 0 auto;
padding: 50px 0; }
*/ .box-card{
margin-top:30px;
}
.quill-editor {
min-height: 350px;
/* max-height: 400px;*/
overflow-y: auto;
} </style> <script>
export default {
data () {
return {
content: '<p>I am Example</p>',
editorOption: {
// some quill options
modules: {
toolbar: [
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block', 'image']
]
}
},
gonext:"立即创建",
form: {
title:'',
content:'',
mainTag:'不限',
tags:'',
},
roomid:this.$route.params.id,
action:"api/room/upload/"+this.$route.params.id,
pantext:"添加", rules: {
title: [
{ required: true, message: '请输入标题', trigger: 'blur' },
{ min: 5, max: 64, message: '长度在 5 到 64 个字符', trigger: 'blur' }
],
} }
},
mounted() {
console.log('app init, my quill insrance object is:', this.myQuillEditor)
setTimeout(() => {
this.content = 'i am changed'
}, 3000) if(this.$route.params.id) {
this.getRoom();
//this.getFilelist();
this.pantext = "修改";
}
},
methods: {
submit(){ alert(this.content );
},
onEditorBlur(editor) {
console.log('editor blur!', editor)
},
onEditorFocus(editor) {
console.log('editor focus!', editor)
},
onEditorReady(editor) {
console.log('editor ready!', editor)
},
onEditorChange({ editor, html, text }) {
console.log('editor change!', editor, html, text)
this.content = html
}, //
getRoom(){
var id=this.$route.params.id;
this.editorContent='111';
var gvue=this;
this.$axios({
method: 'get',
url: 'api/article/one/'+id+'?time='+new Date().getTime(),
changeOrigin:true,
}).then(function (response) {
console.log(response.data);
gvue.form=response.data;//[0];
gvue.gonext="立即修改";
gvue.content=response.data.content;
editor.txt.html(response.data.content);
})
.catch(function (error) {
console.log(error);
});
}, submitForm(form) {//2表示是求组
console.log('submit!');
this.$refs[form].validate((valid) => {
if (valid) {
//alert('submit!');
var url = 'api/article/add?time='+new Date().getTime();
if(this.$route.params.id)
url = 'api/article/edit?time='+new Date().getTime();
var gvue=this;
this.form.content=this.content;
this.$axios({
method: 'post',
url:url ,
changeOrigin:true,
data: this.form//"courtname="+this.form.courtname+"&areaname="+this.form.areaname
}).then(function (response) {
console.log(response);
if(response.data=="00"){
gvue.$message({
showClose: true,
message: response.data.ret_msg+',操作成功1',
type: 'success'
});
//gvue.$router.push("/addroom2/"+response.data.ret_roomid);
gvue.$router.push("/postarticles");
} })
.catch(function (error) {
console.log(error);
});
} else {
console.log('error submit!!');
return false;
}
});
} }
}
</script>
addq的更多相关文章
- Golang汇编命令解读
我们可以很容易将一个golang程序转变成汇编语言. 比如我写了一个main.go: package main func g(p int) int { return p+1; } func main( ...
- 【教程】简易CDQ分治教程&学习笔记
前言 辣鸡蒟蒻__stdcall终于会CDQ分治啦! CDQ分治是我们处理各类问题的重要武器.它的优势在于可以顶替复杂的高级数据结构,而且常数比较小:缺点在于必须离线操作. CDQ分治的基 ...
- 数据结构 浙大MOOC 笔记二 线性结构
线性表及其表现 第二章的内容是关于三种最基本的数据结构 结合<DDSA>第三章 表.栈和队列做一个总结 首先简单说明一下各个数据结构的特点: 数组:连续存储,遍历快且方便,长度固定,缺点是 ...
- 06-图1 列出连通集 (25分)(C语言邻接表实现)
题目地址:https://pta.patest.cn/pta/test/558/exam/4/question/9495 由于边数E<(n*(n-1))/2 所以我选用了邻接表实现,优先队列用循 ...
- HDU 4757 Tree(可持久化Trie+Tarjan离线LCA)
Tree Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others) Total Su ...
- julia的优化?
julia> function fib1(n) if n==1 return n else return n+fib1(n-1) end end fib1 (generic function w ...
- TCP校验和的原理和实现
http://blog.csdn.net/zhangskd/article/details/11770647 分类: Linux TCP/IP Linux Kernel 2013-09-24 ...
- BZOJ4573 : [Zjoi2016]大森林
扫描线,从左到右依次处理每棵树. 用set按时间顺序维护影响了这棵树的所有操作,那么一个点的父亲就是它前面第一个操作1. 用Splay维护树的括号序列,那么两点间的距离就是括号数量减去匹配的括号个数. ...
- SPOJ 10628 Count on a tree(Tarjan离线LCA+主席树求树上第K小)
COT - Count on a tree #tree You are given a tree with N nodes.The tree nodes are numbered from 1 to ...
随机推荐
- qt cef嵌入web(二)
在qt cef嵌入web文章中已经讲述了怎么把cef页面嵌入到qt程序中,但是这样并不完美,因为如果需要在多个窗口上创建cef浏览器部件的话,在 消息监听部分没有办法做区分多个浏览器事件,在这篇文章中 ...
- 懵逼的this指向
请看以下代码: 以上的console.log打印出来的,如果你能完全知道,请忽略,如果你不知道,那就接下来看吧. console.log打印的结果: Google非常智能地把对象给打印出来了,看结果, ...
- Lucene 07 - 对Lucene的索引库进行增删改查
目录 1 添加索引 2 删除索引 2.1 根据Term删除索引 2.2 删除全部索引(慎用) 3 更新索引 数据保存在关系型数据库中, 需要实现增.删.改.查操作; 索引保存在索引库中, 也需要实现增 ...
- Android Native App自动化测试实战讲解(下)(基于python)
6.Appuim自动化测试框架API讲解与案例实践(三) 如图1,可以在主函数里通过TestSuite来指定执行某一个测试用例: 6.1,scroll():如图2 从图3中可以看到当前页面的所有元素r ...
- 使用mpvue开发小程序教程(三)
在上一篇文章中,我们熟悉了一下通过vue-cli生成的mpvue工程代码骨架的基本结构,大致了解了每一个部分的代码到底要放到何处.从本文起我们就开始涉及真正的编码部分,学习使用Vue的语法去编写小程序 ...
- Chapter 5 Blood Type——26
"I saw his face — I could tell." “我看到他的脸了 —— 我知道.” "How did you see me? I thought you ...
- HBase学习——4.HBase过滤器
1.过滤器 基础API中的查询操作在面对大量数据的时候是非常苍白的,这里Hbase提供了高级的查询方法:Filter.Filter可以根据簇.列.版本等更多的条件来对数据进行过滤,基于Hbase本身提 ...
- Asp.net Core 使用Jenkins + Dockor 实现持续集成、自动化部署(二):部署
前面又是废话 我之前写过: Asp.Net Core 程序部署到Linux(centos)生产环境(一):普通部署 Asp.Net Core 程序部署到Linux(centos)生产环境(二):doc ...
- Spring Cloud-微服务架构集大成者
本文不是讲解如何使用Spring Cloud的教程,而是探讨Spring Cloud是什么,以及它诞生的背景和意义. 1 背景 2008年以后,国内互联网行业飞速发展,我们对软件系统的需求已经不再是过 ...
- LeetCode专题-Python实现之第27题:Remove Element
导航页-LeetCode专题-Python实现 相关代码已经上传到github:https://github.com/exploitht/leetcode-python 文中代码为了不动官网提供的初始 ...