This repository has been archived by the owner on Aug 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
hitokoto.html
119 lines (110 loc) · 3.67 KB
/
hitokoto.html
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<meta name="HandheldFriendly" content="true" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>高三八班一言库编辑器</title>
<!-- import CSS -->
<link rel="stylesheet" href="assets/index.css" />
<style>
pre {
font-family: "Microsoft YaHei", 微软雅黑, "MicrosoftJhengHei", 华文细黑, STHeiti, MingLiu;
}
div#app {
color: rgb(74, 74, 74);
}
#slogan pre {
color: red;
margin-top: 30px;
margin-bottom: 30px;
}
#slogan p {
margin-top: 30px;
}
pre {
word-wrap: break-word;
white-space: pre-wrap;
}
</style>
</head>
<body>
<div id="app" v-loading="loading">
<el-row type="flex" justify="center" :gutter="15">
<el-col :span="12">
<p>句子内容</p>
<el-input v-model="hitokoto.text" placeholder="句子内容" type="textarea" autosize></el-input>
<p>作者</p>
<el-input v-model="hitokoto.author" placeholder="作者"></el-input>
<p>投稿人</p>
<el-input v-model="hitokoto.contributor" placeholder="投稿人"></el-input>
</el-col>
<el-col :span="4">
<p>
<el-button type="success" icon="el-icon-check" round @click="save">添加</el-button>
</p>
</el-col>
</el-row>
</div>
</body>
<script type="text/javascript" src="assets/vue.js"></script>
<script type="text/javascript" src="assets/element.js"></script>
<script src="assets/axios.min.js"></script>
<script>
var full = false;
var vdata = {
loading: false,
hitokoto: {
text: "",
author: "",
contributor: ""
}
}
var v = new Vue({
el: '#app',
data: vdata,
methods: {
save: function () {
vdata.loading = true;
ax.post('/api/hitokoto', vdata.hitokoto)
.then(function (response) {
vdata.loading = false;
vdata.hitokoto = {
text: "",
author: "",
contributor: ""
}
if (response.data.code == 200)
v.$notify({
title: '保存成功',
message: "200, OK!",
type: 'success'
});
else
v.$notify({
title: '保存失败',
message: response.data,
type: 'error',
duration: 0
});
})
.catch(function (error) {
vdata.loading = false;
v.$notify({
title: '保存失败',
message: error,
type: 'error',
duration: 0
});
});
}
}
});
var ax = axios.create({
baseURL: 'http://127.0.0.1:8308/',
timeout: 5000,
});
</script>
</html>