-
Notifications
You must be signed in to change notification settings - Fork 11
/
history.html
144 lines (135 loc) · 3.74 KB
/
history.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html">
<title>Windows发展史</title>
<meta name="author" content="Jake Rocheleau">
<link rel="stylesheet" type="text/css" media="all" href="https://neusoftware.top/revolution/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="all" href="https://neusoftware.top/revolution/css/bootstrap-glyphicons.css">
<link rel="stylesheet" type="text/css" media="all" href="https://neusoftware.top/revolution/css/styles.css">
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>
<div class="container" id="app">
<header class="page-header">
<h1>Windows发展史</h1>
</header>
<ul class="timeline">
<div v-for="(data,index) in datas">
<li><div v-bind:class="['tldate',isHidden(data)]">{{data.date}}</div></li>
<li v-bind:class="isInverted(index)">
<div class="timeline-panel">
<div class="tl-heading">
<h4>{{data.heading}}</h4>
<p></p>
</div>
<div class="tl-body">
<p>{{data.body}}</p>
</div>
</div>
</li>
</div>
</ul>
<h2 style="position: relative;color: white" class="text-center">添加新事件</h2>
<ul class="timeline">
<li><div class="tldate"><input type="number" class="form-control text-center" placeholder="年份" v-model="newDate"></div></li>
<li>
<div class="timeline-panel">
<div class="tl-heading">
<input type="text" class="form-control" placeholder="标题" v-model="newHeading">
<p></p>
</div>
<div class="tl-body">
<textarea class="form-control" placeholder="详情" v-model="newBody"></textarea>
</div>
<p></p>
<button class="btn btn-primary" @click="newThing();">提交</button>
</div>
</li>
</ul>
</div>
<script>
var vm=new Vue({
el: '#app',
data: {
datas:[],
year:0,
newDate:'',
newHeading:'',
newBody:''
},
mounted(){
axios.get('https://neusoftware.top/History/GetBigThings')
.then((response)=> {
this.datas=response.data;
})
.catch(function (error) {
console.log(error);
});
},
methods: {
isInverted(index) {
if(index%2===0){
return "";
}
else{
return "timeline-inverted";
}
},
isHidden(data){
if(data.date==this.year){
return "hidden";
}
else{
this.year=data.date;
return "";
}
},
newThing(){
if(this.newDate!==''&&this.newHeading!==''&&this.newBody!==''){
axios.get('https://neusoftware.top/History/NewBigThing',{
params:{
date:this.newDate,
heading:this.newHeading,
body:this.newBody
}
})
.then((response)=> {
window.alert('添加成功');
window.location.reload();
})
.catch(function (error) {
console.log(error);
window.alert('添加失败');
return;
});
}
else{
window.alert('输入信息不全');
}
},
deleteThing(id,index){
axios.get('https://neusoftware.top/History/DeleteBigThing',{
params:{
id:id
}
})
.then((response)=> {
window.alert('删除成功');
window.location.reload();
})
.catch(function (error) {
window.alert('删除失败');
console.log(error);
return;
});
}
},
deleteThing(id){
}
})
</script>
</body>
</html>