|
@@ -1,131 +1,277 @@
|
1
|
1
|
<template>
|
2
|
|
- <div>
|
3
|
|
- <Button @click="modal = true">添加试卷</Button>
|
4
|
|
- <Modal
|
5
|
|
- width="980"
|
6
|
|
- v-model="modal"
|
7
|
|
- title="试题上传"
|
8
|
|
- @on-ok="ok"
|
9
|
|
- @on-cancel="cancel">
|
|
2
|
+ <div class="calender">
|
|
3
|
+ <div class="top">
|
|
4
|
+ <div class="top_date">
|
10
|
5
|
<div>
|
11
|
|
- <Select v-model="select" style="width:200px">
|
12
|
|
- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
13
|
|
- </Select>
|
14
|
|
- <div>
|
15
|
|
- <question @question="getquestion" v-if="select==1"></question>
|
16
|
|
- <exercise @exercise="getexercise" v-if="select==2"></exercise>
|
17
|
|
- <gestalts @gestalts="getGestalts" v-if="select==3"></gestalts>
|
18
|
|
- </div>
|
|
6
|
+ {{new Date().getDate()}}
|
19
|
7
|
</div>
|
20
|
|
- <div slot="footer"></div>
|
21
|
|
- </Modal>
|
22
|
|
- <div v-show="getGestaltList.length>0">
|
23
|
|
- 一.单选题
|
24
|
|
- <div v-for="(gest,i) in getGestaltList" :key="i">
|
25
|
|
- <div @click="revise(i,gest)">
|
26
|
|
- {{i+1}}.{{gest.title}}
|
27
|
|
- <div v-for="(item,id) in gest.questions" :key="id">
|
28
|
|
- ({{id+1}})
|
29
|
|
- <div v-for="(obj,ip) in item.obj" :key="ip" class="erji">
|
30
|
|
- <span>{{ip}}.</span><span>{{obj}}</span>
|
31
|
|
- </div>
|
32
|
|
- </div>
|
|
8
|
+ <div>
|
|
9
|
+ 星期{{week[new Date().getDay()]}}
|
33
|
10
|
</div>
|
34
|
11
|
</div>
|
|
12
|
+ <div class="btn_wrap">
|
|
13
|
+ <ul>
|
|
14
|
+ <li @click="handleShowNextMonth">
|
|
15
|
+ 下个月
|
|
16
|
+ </li>
|
|
17
|
+ <li @click="handleShowToday">
|
|
18
|
+ {{year}}年{{month}}月
|
|
19
|
+ </li>
|
|
20
|
+ <li @click="handleShowLastMonth">
|
|
21
|
+ 上个月
|
|
22
|
+ </li>
|
|
23
|
+ </ul>
|
|
24
|
+ </div>
|
|
25
|
+ </div>
|
|
26
|
+ <div class="date_wrap">
|
|
27
|
+ <ul class="week">
|
|
28
|
+ <li v-for="(day,d_index) in week" :key="d_index+'d'">{{day}}</li>
|
|
29
|
+ </ul>
|
|
30
|
+ <ul class="day">
|
|
31
|
+ <li v-for="(last,l_index) in days.last_list" :key="l_index+'l'" class="last">
|
|
32
|
+ {{last}}
|
|
33
|
+ </li>
|
|
34
|
+ <li v-for="(when,w_index) in days.when_list" :key="w_index+'w'" :class="{now:nowLi==year.toString()+month.toString()+when}">
|
|
35
|
+ {{when}}
|
|
36
|
+ </li>
|
|
37
|
+ <li v-for="(next,n_index) in days.next_list" :key="n_index+'n'" class="last">
|
|
38
|
+ {{next}}
|
|
39
|
+ <div class="active-time"></div>
|
|
40
|
+ </li>
|
|
41
|
+ </ul>
|
35
|
42
|
</div>
|
|
43
|
+ <div v-if="incident">
|
|
44
|
+ {{incident}}
|
|
45
|
+ </div>
|
|
46
|
+ <Button>+</Button>
|
36
|
47
|
</div>
|
37
|
48
|
</template>
|
|
49
|
+
|
38
|
50
|
<script>
|
39
|
|
-import question from "./components/question/question.vue";
|
40
|
|
-import exercise from "./components/exercise/exercise.vue"
|
41
|
|
-import gestalts from "./components/gestalts/gestalts.vue"
|
42
|
51
|
export default {
|
|
52
|
+ name: 'calender',
|
43
|
53
|
data () {
|
44
|
54
|
return {
|
45
|
|
- modal: false,
|
46
|
|
- select:'1',
|
47
|
|
- cityList: [
|
48
|
|
- {
|
49
|
|
- value: '1',
|
50
|
|
- label: '选择题'
|
51
|
|
- },
|
52
|
|
- {
|
53
|
|
- value: '2',
|
54
|
|
- label: '填空题'
|
55
|
|
- },
|
56
|
|
- {
|
57
|
|
- value: '3',
|
58
|
|
- label: '完形填空'
|
59
|
|
- }
|
60
|
|
- ],
|
61
|
|
- // selectList:[],
|
62
|
|
- getquestionList:[],
|
63
|
|
- getexerciseList:[],
|
64
|
|
- getGestaltList:[],
|
65
|
|
- char:["A","B","C","D","E","F","G","H","I","J","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
|
66
|
|
- }
|
67
|
|
- },
|
68
|
|
- components:{
|
69
|
|
- question,
|
70
|
|
- exercise,
|
71
|
|
- gestalts
|
72
|
|
- },
|
73
|
|
- watch:{
|
74
|
|
- modal(){
|
75
|
|
- var modal=this.modal
|
76
|
|
- if(this.modal==false){
|
77
|
|
- localStorage.clear();
|
78
|
|
- }
|
|
55
|
+ year:'',
|
|
56
|
+ month:'',
|
|
57
|
+ days:{},
|
|
58
|
+ nowLi:'',
|
|
59
|
+ week:['日','一','二','三','四','五','六'],
|
|
60
|
+ incident:"代办事项",
|
|
61
|
+ active:[{
|
|
62
|
+ time:'9:00',
|
|
63
|
+ day:'528',
|
|
64
|
+ title:'校长找我'
|
|
65
|
+ },
|
|
66
|
+ {
|
|
67
|
+ time:'10:00',
|
|
68
|
+ day:'529',
|
|
69
|
+ title:'教导主任找我'
|
|
70
|
+ },
|
|
71
|
+ {
|
|
72
|
+ time:'11:00',
|
|
73
|
+ day:'520',
|
|
74
|
+ title:'学生家长找我'
|
|
75
|
+ }]
|
79
|
76
|
}
|
80
|
77
|
},
|
81
|
|
- methods: {
|
82
|
|
- revise(index,list){
|
83
|
|
- // console.log(index,list)
|
84
|
|
- var data={index,list};
|
85
|
|
- var obj=JSON.stringify(data)
|
86
|
|
- localStorage.setItem('gestList',obj)
|
87
|
|
- var list = localStorage.getItem('gestList')
|
88
|
|
- console.log(list)
|
89
|
|
- var arr=JSON.parse(list)
|
90
|
|
- console.log(arr)
|
91
|
|
- this.modal=true;
|
92
|
|
- this.select="3"
|
|
78
|
+ methods:{
|
|
79
|
+ //控制当前日期显示特殊样式
|
|
80
|
+ handleShowDateStyle(){
|
|
81
|
+ let now = new Date()
|
|
82
|
+ this.nowLi=now.getFullYear().toString()+(now.getMonth()+1).toString()+now.getDate().toString()
|
93
|
83
|
},
|
94
|
|
- getquestion(data){
|
95
|
|
- this.getquestionList.push(data);
|
96
|
|
- console.log(data)
|
97
|
|
- this.modal=false;
|
98
|
|
- this.select="1"
|
99
|
|
- localStorage.clear();
|
|
84
|
+ //得到当前年这个月分有多少天
|
|
85
|
+ getDays(Y,M){
|
|
86
|
+ let day = new Date(Y, M, 0).getDate()
|
|
87
|
+ return day;
|
100
|
88
|
},
|
101
|
|
- getexercise(data){
|
102
|
|
- this.getexerciseList.push(data);
|
103
|
|
- this.modal=false;
|
104
|
|
- this.select="1"
|
105
|
|
- localStorage.clear();
|
|
89
|
+ //得到当前年,这个月的一号是周几
|
|
90
|
+ getWeek(Y,M){
|
|
91
|
+ let now = new Date()
|
|
92
|
+ now.setFullYear(this.year)
|
|
93
|
+ now.setMonth(this.month-1)
|
|
94
|
+ now.setDate(1);
|
|
95
|
+ let week = now.getDay();
|
|
96
|
+ return week;
|
106
|
97
|
},
|
107
|
|
- getGestalts(data){
|
108
|
|
- this.getGestaltList.push(data);
|
109
|
|
- console.log(this.getGestaltList)
|
110
|
|
- this.modal=false;
|
111
|
|
- this.select="1"
|
112
|
|
- localStorage.clear();
|
|
98
|
+ getaddWeek(Y,M){
|
|
99
|
+ let now = new Date()
|
|
100
|
+ now.setFullYear(this.year)
|
|
101
|
+ now.setMonth(this.month)
|
|
102
|
+ now.setDate(1);
|
|
103
|
+ let week = now.getDay();
|
|
104
|
+ return week;
|
113
|
105
|
},
|
114
|
|
- ok () {
|
115
|
|
- this.$Message.info('Clicked ok');
|
|
106
|
+ pushDays(){
|
|
107
|
+ //将这个月多少天加入数组days
|
|
108
|
+ let when_list=[];
|
|
109
|
+ for(let i = 1; i<=this.getDays(this.year,this.month);i++){
|
|
110
|
+ when_list.push(i)
|
|
111
|
+ }
|
|
112
|
+ //将下个月要显示的天数加入days
|
|
113
|
+ let week_day=1;
|
|
114
|
+ let next_list=[];
|
|
115
|
+ for(let i=this.getaddWeek(this.year,this.month);i<7;i++){
|
|
116
|
+ next_list.push(week_day++)
|
|
117
|
+ }
|
|
118
|
+ //将上个月要显示的天数加入days
|
|
119
|
+ let last_list=[];
|
|
120
|
+ for(let i=0;i<this.getWeek(this.year,this.month);i++){
|
|
121
|
+ var lastMonthDays=this.getDays(this.year,this.month-1)
|
|
122
|
+ last_list.unshift(lastMonthDays-i)
|
|
123
|
+ }
|
|
124
|
+ this.days={last_list,when_list,next_list}
|
|
125
|
+ console.log(this.days)
|
|
126
|
+ },
|
|
127
|
+ getDate(){
|
|
128
|
+ let now = new Date();
|
|
129
|
+ this.year = now.getFullYear();
|
|
130
|
+ this.month = now.getMonth()+1;
|
|
131
|
+ this.pushDays();
|
|
132
|
+
|
|
133
|
+ },
|
|
134
|
+ handleShowNextMonth(){
|
|
135
|
+ this.days=[];
|
|
136
|
+ if(this.month<12){
|
|
137
|
+ this.month=this.month+1;
|
|
138
|
+ this.pushDays();
|
|
139
|
+ }else{
|
|
140
|
+ this.month= this.month=1;
|
|
141
|
+ this.year=this.year+1;
|
|
142
|
+ this.pushDays();
|
|
143
|
+ }
|
|
144
|
+
|
|
145
|
+ },
|
|
146
|
+ handleShowToday(){
|
|
147
|
+ this.days=[];
|
|
148
|
+ let now = new Date();
|
|
149
|
+ this.year=now.getFullYear();
|
|
150
|
+ this.month=now.getMonth()+1;
|
|
151
|
+ this.pushDays();
|
116
|
152
|
},
|
117
|
|
- cancel () {
|
118
|
|
- this.$Message.info('Clicked cancel');
|
|
153
|
+ handleShowLastMonth(){
|
|
154
|
+ this.days=[];
|
|
155
|
+ if(this.month>1){
|
|
156
|
+ this.month=this.month-1;
|
|
157
|
+ this.pushDays();
|
|
158
|
+ }else if( this.year>1970){
|
|
159
|
+ this.month=12;
|
|
160
|
+ this.year=this.year-1;
|
|
161
|
+ this.pushDays();
|
|
162
|
+ }else{
|
|
163
|
+ alert("不能查找更远的日期")
|
|
164
|
+ }
|
|
165
|
+
|
119
|
166
|
}
|
|
167
|
+ },
|
|
168
|
+ mounted(){
|
|
169
|
+ this.getDate();
|
|
170
|
+ this.handleShowDateStyle();
|
120
|
171
|
}
|
121
|
172
|
}
|
122
|
173
|
</script>
|
123
|
174
|
<style scoped>
|
124
|
|
-.yiji{
|
|
175
|
+.calender{
|
|
176
|
+ width: 600px;
|
|
177
|
+ position: relative;
|
|
178
|
+ margin: 0 auto;
|
|
179
|
+ margin-top: 50px;
|
|
180
|
+ border: 1px solid #ddd;
|
|
181
|
+ padding: 20px;
|
|
182
|
+ color: #333;
|
|
183
|
+}
|
|
184
|
+.top{
|
|
185
|
+ width: 100%;
|
|
186
|
+ position: relative;
|
|
187
|
+ display: flex;
|
|
188
|
+ border-bottom: 1px solid #ddd;
|
|
189
|
+ padding-bottom: 20px;
|
|
190
|
+}
|
|
191
|
+.top_date{
|
|
192
|
+ width: 100px;
|
|
193
|
+ text-align: left;
|
|
194
|
+ line-height: 42px;
|
|
195
|
+}
|
|
196
|
+.btn_wrap{
|
|
197
|
+ flex: 1;
|
|
198
|
+ text-align: right
|
|
199
|
+}
|
|
200
|
+ul{
|
|
201
|
+ list-style: none;
|
|
202
|
+}
|
|
203
|
+.btn_wrap ul{
|
125
|
204
|
display: flex;
|
126
|
|
- justify-content: flex-start;
|
|
205
|
+ flex-direction: row-reverse
|
|
206
|
+}
|
|
207
|
+.btn_wrap ul li{
|
|
208
|
+ padding: 10px 20px;
|
|
209
|
+ border: 1px solid #ddd;
|
|
210
|
+ font-size: 14px;
|
|
211
|
+ line-height: 20px;
|
|
212
|
+ cursor: pointer;
|
|
213
|
+}
|
|
214
|
+.btn_wrap ul li:hover{
|
|
215
|
+ background: #ddd;
|
|
216
|
+ color:red;
|
|
217
|
+}
|
|
218
|
+.btn_wrap ul li:first-child{
|
|
219
|
+ border-left: none;
|
|
220
|
+}
|
|
221
|
+.btn_wrap ul li:last-child{
|
|
222
|
+ border-right: none;
|
|
223
|
+}
|
|
224
|
+.date_wrap{
|
|
225
|
+ position: relative;
|
|
226
|
+}
|
|
227
|
+.week{
|
|
228
|
+ display: flex;
|
|
229
|
+ flex-direction: row;
|
|
230
|
+ padding: 20px;
|
|
231
|
+ font-size: 16px;
|
|
232
|
+}
|
|
233
|
+.week li{
|
|
234
|
+ text-align: center;
|
|
235
|
+ width: 14.28%;
|
|
236
|
+}
|
|
237
|
+.day{
|
|
238
|
+ display: flex;
|
|
239
|
+ flex-direction: row;
|
|
240
|
+ padding: 20px;
|
|
241
|
+ font-size: 16px;
|
|
242
|
+ flex-wrap: wrap;
|
|
243
|
+}
|
|
244
|
+.day li{
|
|
245
|
+ width: 14.28%;
|
|
246
|
+ padding: 20px;
|
|
247
|
+ text-align: center;
|
|
248
|
+ box-sizing: border-box;
|
|
249
|
+ cursor: pointer;
|
|
250
|
+ position: relative;
|
|
251
|
+ /* border: 1px solid #ddd */
|
|
252
|
+}
|
|
253
|
+.day li:nth-child(n+8){
|
|
254
|
+ border-top:none;
|
|
255
|
+}
|
|
256
|
+.day li:nth-child(n+1){
|
|
257
|
+ border-right: none;
|
|
258
|
+}
|
|
259
|
+/* .day li:nth-child(7n){
|
|
260
|
+ border-right: 1px solid #ddd
|
|
261
|
+} */
|
|
262
|
+.now{
|
|
263
|
+ color: #f2f8fe;
|
|
264
|
+ background:#1989fa;
|
|
265
|
+ border-radius: 50%;
|
|
266
|
+}
|
|
267
|
+.last{
|
|
268
|
+ color: #CBD1DA;
|
127
|
269
|
}
|
128
|
|
-.erji{
|
129
|
|
- display: inline-block;
|
|
270
|
+.active-time{
|
|
271
|
+ border:6px solid #ff0000;
|
|
272
|
+ border-radius: 50%;
|
|
273
|
+ position: absolute;
|
|
274
|
+ bottom: 4px;
|
|
275
|
+ right: 6px;
|
130
|
276
|
}
|
131
|
277
|
</style>
|