<template>
	<div class="container">
		<textarea v-model="model.texts" placeholder="请输入规则" style="width: 100%;height: 100px;margin: 10px;"></textarea>
		<el-button type="primary" @click="BtnClick" style=" margin:10px 0px 10px 10px">发布介绍</el-button>
	</div>
</template>

<script>
	
	import {
		AddOrUpdRichTextrule,
		DelRichTextrule,
		GetListRichTextrule
	} from '../../api/rulestext.js'
	export default {
		data() {
			return {
				
				model: {
					"id": 0,
					"texts": "",
					"add_time": "2022-01-05T10:06:43.243Z",
					"update_time": "2022-01-05T10:06:43.243Z",
					"status": 0
				}
			}
		},
		created() {

		},
		methods: {
			BtnClick() {
				if (this.model.texts == '') {
					this.$message.error('请输入规则')
				} else {
					AddOrUpdRichTextrule(this.model).then(res => {
						console.log('res', res)
						if (res.data.code == 200) {
							this.$message.success('发布成功')
							this.model.texts = ''
						} else {
							this.$message.error('发布失败')
						}
					})
				}
			}

		}
	}
</script>

<style>
</style>
