<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的更多相关文章

  1. Golang汇编命令解读

    我们可以很容易将一个golang程序转变成汇编语言. 比如我写了一个main.go: package main func g(p int) int { return p+1; } func main( ...

  2. 【教程】简易CDQ分治教程&学习笔记

    前言 辣鸡蒟蒻__stdcall终于会CDQ分治啦!       CDQ分治是我们处理各类问题的重要武器.它的优势在于可以顶替复杂的高级数据结构,而且常数比较小:缺点在于必须离线操作. CDQ分治的基 ...

  3. 数据结构 浙大MOOC 笔记二 线性结构

    线性表及其表现 第二章的内容是关于三种最基本的数据结构 结合<DDSA>第三章 表.栈和队列做一个总结 首先简单说明一下各个数据结构的特点: 数组:连续存储,遍历快且方便,长度固定,缺点是 ...

  4. 06-图1 列出连通集 (25分)(C语言邻接表实现)

    题目地址:https://pta.patest.cn/pta/test/558/exam/4/question/9495 由于边数E<(n*(n-1))/2 所以我选用了邻接表实现,优先队列用循 ...

  5. HDU 4757 Tree(可持久化Trie+Tarjan离线LCA)

    Tree Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others) Total Su ...

  6. julia的优化?

    julia> function fib1(n) if n==1 return n else return n+fib1(n-1) end end fib1 (generic function w ...

  7. TCP校验和的原理和实现

        http://blog.csdn.net/zhangskd/article/details/11770647 分类: Linux TCP/IP Linux Kernel 2013-09-24 ...

  8. BZOJ4573 : [Zjoi2016]大森林

    扫描线,从左到右依次处理每棵树. 用set按时间顺序维护影响了这棵树的所有操作,那么一个点的父亲就是它前面第一个操作1. 用Splay维护树的括号序列,那么两点间的距离就是括号数量减去匹配的括号个数. ...

  9. 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  ...

随机推荐

  1. 把路由器改装成git服务器(OpenWRT环境的GIT服务器搭建)

    在单位中,通常都标配了git服务器用来管理代码. 对于家庭或者小办公室,这种方式有点不经济.当然如果是开源项目就简单了,刚刚被微软收购的github是理想选择.但如果没有打算开源,我今天的话题可能对你 ...

  2. [Leetcode]695. Max Area of Island

    Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) conn ...

  3. 基于N-Gram判断句子是否通顺

    完整代码实现及训练与测试数据:click me 一.任务描述         自然语言通顺与否的判定,即给定一个句子,要求判定所给的句子是否通顺. 二.问题探索与分析         拿到这个问题便开 ...

  4. 痞子衡嵌入式:飞思卡尔i.MX RT系列MCU启动那些事(9)- 从Parallel NOR启动

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是飞思卡尔i.MX RT系列MCU的Parallel NOR启动. 上一篇讲i.MXRT从Raw NAND启动的文章 从Raw NAND启 ...

  5. Perl IO:文件锁

    文件锁 当多个进程或多个程序都想要修同一个文件的时候,如果不加控制,多进程或多程序将可能导致文件更新的丢失. 例如进程1和进程2都要写入数据到a.txt中,进程1获取到了文件句柄,进程2也获取到了文件 ...

  6. 详解什么是平衡二叉树(AVL)(修订补充版)

    详解什么是平衡二叉树(AVL)(修订补充版) 前言 Wiki:在计算机科学中,AVL树是最早被发明的自平衡二叉查找树.在AVL树中,任一节点对应的两棵子树的最大高度差为1,因此它也被称为高度平衡树.查 ...

  7. shell32.dll 控制网络

    //禁用 SetNetworkAdapter(False) //启用 SetNetworkAdapter(True) //添加引用system32/shell32.dll private static ...

  8. [我还会回来的]asp.net core再战iris

    废话不多说,直接开干! 硬件配置 处理器: Intel(R) Core(TM) i5-4690k CPU @3.90GHz 内存容量: 8.00 GB 软件版本 OS: Microsoft Windo ...

  9. JavaScript 基础结构

    注释      代码注释可以使用//或者/* */ // 这是一个单行注释 /* * 这是 * 一个 * 多行 * 注释 */ 变量      变量用于存储数据,在同一作用域内变量不得重名,定义语法: ...

  10. .net 用ajaxFileUpload 上传超过20M文件设置

    1.在web.config的 <system.web>  节点里面添加   <httpRuntime targetFramework="4.5.2"  execu ...