<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. 『Tarjan算法 有向图的强连通分量』

    有向图的强连通分量 定义:在有向图\(G\)中,如果两个顶点\(v_i,v_j\)间\((v_i>v_j)\)有一条从\(v_i\)到\(v_j\)的有向路径,同时还有一条从\(v_j\)到\( ...

  2. C#版 - Leetcode 201. 数字范围按位与(bitwise AND) - 题解

    C#版 - Leetcode 201. 数字范围按位与(bitwise AND) - 题解 在线提交: https://leetcode.com/problems/bitwise-and-of-num ...

  3. centos7安装xfce桌面

    用了centos自带的gnome桌面 太重了 启动超慢 内存占用近2G 因此打算换一个轻量级的桌面xfce 先安装桌面协议yum groupinstall "X Window system& ...

  4. RabbitMQ消息队列(六)-消息任务分发与消息ACK确认机制(.Net Core版)

    在前面一章介绍了在.Net Core中如何使用RabbitMQ,至此入门的的部分就完成了,我们内心中一定还有很多疑问:如果多个消费者消费同一个队列怎么办?如果这几个消费者分任务的权重不同怎么办?怎么把 ...

  5. 补习系列(8)-springboot 单元测试之道

    目录 目标 一.About 单元测试 二.About Junit 三.SpringBoot-单元测试 项目依赖 测试样例 四.Mock测试 五.最后 目标 了解 单元测试的背景 了解如何 利用 spr ...

  6. 禁止用户打开HTML页面调试

    有些时候,我们可能想要禁止用户修改或者调试我们HTML页面的代码,这个时候需要组织用户打开调试窗口,下面介绍一些能够阻止用户在浏览器中打开调试窗口的方法,这些方法只能一定程度的提高打开调试的门槛,并不 ...

  7. #4 Python面向对象(三)

    前言 前两节讲解了Python面向对象的思想和Python类中各种变量的含义以及区别.肯定有小伙伴会问,类初始化时是否可以传入参数?如果有多个类中含有共同的函数方法,是否可以重复利用?本节就带着这些问 ...

  8. 第8章 概述 - Identity Server 4 中文文档(v1.0.0)

    快速入门提供了各种常见IdentityServer方案的分步说明.他们从基础到复杂 - 建议您按顺序完成它们. 将IdentityServer添加到ASP.NET Core应用程序 配置Identit ...

  9. 【.Net Core】获取绝对路径、相对路径

    一.绝对路径 1.获取应用程序运行当前目录Directory.GetCurrentDirectory(). System.IO命名空间中存在Directory类,提供了获取应用程序运行当前目录的静态方 ...

  10. 关闭open页面时刷新父页面列表

    var winObjEI = window.open("/Invoice/InvoiceViewEI?invoiceid=" + data.InvoiceId); ; //关闭op ...