Blame view

src/views/system/meal.vue 1.4 KB
2d21111e   wangming   项目初始化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  <template>
  	<div class="container">
  		<el-input type="text" placeholder="请输入套餐标题" style="width: 100%;" v-model="model.title" maxlength="15" ref="title"></el-input>
  		<textarea v-model="model.meal" placeholder="请输入套餐内容"
  			style="width: 100%;height: 100px;margin-top: 10px;border: 1px solid #EEEEEE;" ref="meal"></textarea>
  		<el-button type="primary" @click="BtnClick" style=" margin:10px 0px 10px 10px">发布介绍</el-button>
  	</div>
  </template>
  
  <script>
  	import {
  		AddOrUpdRichTextmeal,
  		DelRichTextmeal,
  		GetListRichTextmeal
  	} from '../../api/meal.js'
  	export default {
  		data() {
  			return {
  
  				model: {
  					"id": 0,
  					"title": "",
  					"meal": "",
  					"add_time": "2022-01-05T10:45:05.324Z",
  					"update_time": "2022-01-05T10:45:05.324Z",
  					"status": 0
  				}
  			}
  		},
  		created() {
  
  		},
  		methods: {
  			BtnClick() {
  				if (this.model.title == '') {
  					this.$message.error('请输入套餐标题')
  					this.$refs.title.focus()
  				} else if(this.model.meal==''){
  					this.$message.error('请输入套餐内容')
  					this.$refs.meal.focus()
  				} else{
  					AddOrUpdRichTextmeal(this.model).then(res => {
  						console.log('res', res)
  						if (res.data.code == 200) {
  							this.$message.success('发布成功')
  							this.model.meal=this.model.title=''
  						} else {
  							this.$message.error('发布失败')
  						}
  					})
  				}
  			}
  
  		}
  	}
  </script>
  
  <style>
  </style>