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>
 

 

转载于:https://www.cnblogs.com/cnchengv/p/10216744.html

完善如下代码:#include<stdio.h> #include<stdlib.h> #define MAXSIZE 100 #define ERROR 0 #define OK 1 typedef int Status; typedef char ElementType; typedef struct TNode{ ElementType Data; struct TNode * Left; struct TNode * Right; }BiTNode,* BinTree; typedef struct QNode{ BinTree Data[MAXSIZE]; int front,rear; }* Queue; void LevelorderTraversal ( BinTree BT ); Queue CreatQueue(); Status IsFullQ(Queue Q); Status AddQ(Queue Q,BinTree X); Status IsEmptyQ(Queue Q); BinTree DeleteQ(Queue Q); BinTree CreatBinTree() { ElementType Data; BinTree BT, T; Queue Q = CreatQueue(); scanf("%c",&Data); if( Data != '@'){ BT = (BinTree)malloc(sizeof(struct TNode)); BT->Data = Data; BT->Left = BT->Right = NULL; AddQ(Q,BT); } else return NULL; while(!IsEmptyQ(Q)){ T = DeleteQ(Q); scanf("%c",&Data); if( Data == '@') T->Left = NULL; else{ T->Left = (BinTree)malloc(sizeof(struct TNode)); T->Left->Data = Data; T->Left->Left = T->Left->Right = NULL; AddQ(Q,T->Left); } scanf("%c",&Data); if(Data == '@') T->Right = NULL; else{ T->Right = (BinTree)malloc(sizeof(struct TNode)); T->Right->Data = Data; T->Right->Left = T->Right->Right = NULL; AddQ(Q,T->Right); } } return BT; } Queue CreatQueue() { Queue Q = (Queue)malloc(sizeof(struct QNode)); Q->front = Q->rear = 0; return Q; } Status IsFullQ(Queue Q) { if( (Q->rear+1)%MAXSIZE == Q->front ) return OK; else return ERROR; } Status AddQ(Queue Q,BinTree X) { if ( IsFullQ(Q) ) { printf("队列满"); return ERROR; } else { Q->rear = (Q->rear+1)%MAXSIZE; Q->Data[Q->rear] = X; return OK; } } Status IsEmptyQ(Queue Q) { if( Q->front == Q->rear ) return OK; else return ERROR; } BinTree DeleteQ(Queue Q) { if ( IsEmptyQ(Q) ) { printf("队列空"); return NULL; } else { Q->front = (Q->front+1)%MAXSIZE; return Q->Data[Q->front]; } } int main() { BinTree BT; BT = CreatBinTree(); if(BT == NULL){ printf("\n空树!\n"); }else{ printf("层序遍历的结果为:"); LevelorderTraversal ( BT ); } return 0; }
05-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值