ft_add.vue
11.7 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
<template>
<view>
<view class="stu_list">
<!-- datas_stu -->
<view class="add_li">
<picker mode="selector" :range="datas_stu" range-key="name" @change="stu_change">
<view class="add_li_box">
<view class="">
学员姓名
</view>
<input type="text" placeholder="请选择" v-model="name" disabled="true">
</view>
</picker>
</view>
<view class="add_li">
<picker mode="date" :value="sx_time" :start="startDate" :end="endDate" @change="bindDateChange">
<view class="add_li_box">
<view class="">
访谈时间
</view>
<view class="">
{{sx_time?sx_time:'请选择'}}
</view>
</view>
</picker>
</view>
<view class="add_li">
<view class="add_li_box">
<view class="">
班主任自我介绍
</view>
<view class="sf_v_btn_b" :class="{active:is_teacher==1}" @click="set_tch">
<text class="icon icon-duigou"></text>
</view>
</view>
</view>
<view class="add_li">
<view class="add_li_tit">
了解学生信息(专业、学校、政治面貌、籍贯)
</view>
<textarea class="add_li_content" placeholder="请输入" v-model="content_one"></textarea>
</view>
<view class="add_li">
<view class="add_li_tit">
第几次考编,之前有没有参加培训,有没有短板模块
</view>
<textarea class="add_li_content" placeholder="请输入" v-model="content_two"></textarea>
</view>
<view class="add_li">
<view class="add_li_box">
<view class="">
介绍近期课程安排、纪律要求
</view>
<view class="sf_v_btn_b" :class="{active:is_introduce==1}" @click="set_tch1">
<text class="icon icon-duigou"></text>
</view>
</view>
</view>
<view class="add_li">
<view class="add_li_tit">
有无什么要求,是否适应
</view>
<textarea class="add_li_content" placeholder="请输入" v-model="content_three"></textarea>
</view>
<view class="add_li">
<view class="add_li_box">
<view class="">
入学测评成绩分析
</view>
<view class="sf_v_btn_b" :class="{active:is_result==1}" @click="set_tch2">
<text class="icon icon-duigou"></text>
</view>
</view>
</view>
</view>
<view class="bz_add" >
<view class="" @click="save_fuc">
保存
</view>
<view v-if="options.id" class="del_btn" @click="del_fuc(options)">
删除
</view>
</view>
</view>
</template>
<script>
import Vue from 'vue'
import {
mapState,
mapMutations
} from 'vuex'
var that1
export default {
name:"ft_add",
props: {
options:{
type: Object,
default: function () {
return {}
}
}
},
data() {
return {
id:'',
uid:'',
name:'',
sx_time:'',
is_teacher:2,
is_introduce:2,
is_result:0,
content_one:'',
content_two:'',
content_three:'',
datas_stu:'',
datas:'',
};
},
computed: {
...mapState(['hasLogin', 'forcedLogin', 'userName', 'userinfo', 'nowtime']),
startDate() {
return this.getDate('start');
},
endDate() {
return this.getDate('end');
}
},
mounted() {
that1=this
that1.getdata_stu()
},
methods:{
del_fuc(item){
//teacher/interviewr_del 常规访谈删除接口
//teacher/interview_del 入学关怀删除接口
uni.showModal({
title: '提示',
content: '是否删除该记录',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
var jkurl='/teacher/interview_del'
// if(that.active==1){
// kurl='teacher/interview_del'
// }
var datas={
id:item.id
// address_id:''
}
var header={
'content-type': 'application/json',
}
// that.$service.P_post(jkurl, datas,header).then(res => {
that1.$service.P_post(jkurl, datas).then(res => {
that1.btnkg = 0
console.log(res)
if (res.code == 1){
that1.htmlReset = 0
var datas = res.data
console.log(typeof datas)
if (typeof datas == 'string') {
datas = JSON.parse(datas)
}
console.log(res)
uni.showToast({
icon:'none',
title:'删除成功'
})
// that1.datas.splice(index,1)
setTimeout(()=>{
uni.navigateBack({
delta:1
})
},1000)
} else {
if (res.msg) {
uni.showToast({
icon: 'none',
title: res.msg
})
} else {
uni.showToast({
icon: 'none',
title: '获取数据失败'
})
}
}
}).catch(e => {
that1.htmlReset = 1
that1.btnkg = 0
// that1.$refs.htmlLoading.htmlReset_fuc(1)
console.log(e)
uni.showToast({
icon: 'none',
title: '获取数据失败,请检查您的网络连接'
})
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
stu_change(e){
var index=e.detail.value
this.name = that1.datas_stu[index].name
this.uid = that1.datas_stu[index].id
},
set_tch(){
if(that1.is_teacher==1){
that1.is_teacher=2
}else{
that1.is_teacher=1
}
},
set_tch1(){
if(that1.is_introduce==1){
that1.is_introduce=2
}else{
that1.is_introduce=1
}
},
set_tch2(){
if(that1.is_result==1){
that1.is_result=2
}else{
that1.is_result=1
}
},
getdata_stu() {
var jkurl="/teacher/student"
var datas={
is_interview: 1
// page:that1.page,
}
// if(that1.data_last == true){
// return
// }
if (that1.btnkg == 1) {
return
} else {
that1.btnkg = 1
}
var page_now=1
that1.$service.P_post(jkurl, datas).then(res => {
that1.btnkg = 0
console.log(res)
if (res.code == 1) {
var datas = res.data
console.log(typeof datas)
if (typeof datas == 'string') {
datas = JSON.parse(datas)
}
if (page_now == 1) {
that1.datas_stu = datas
if(that1.options&&that1.options.id){
that1.getdata()
}
} else {
// if (datas.data.length == 0) {
// that.data_last = true
// return
// }
// that.data_last = false
// that.datas = that.datas.concat(datas.data)
}
// that1.page++
} else {
if (res.msg) {
uni.showToast({
icon: 'none',
title: res.msg
})
} else {
uni.showToast({
icon: 'none',
title: '操作失败'
})
}
}
}).catch(e => {
that1.btnkg = 0
console.log(e)
uni.showToast({
icon: 'none',
title: '操作失败'
})
})
},
getdata() {
var jkurl="/teacher/interview_show"
var datas={
id:that1.options.id,
}
// if(that1.data_last == true){
// return
// }
if (that1.btnkg == 1) {
return
} else {
that1.btnkg = 1
}
var page_now=that1.page
that1.$service.P_post(jkurl, datas).then(res => {
that1.btnkg = 0
console.log(res)
if (res.code == 1) {
var datas = res.data
console.log(typeof datas)
if (typeof datas == 'string') {
datas = JSON.parse(datas)
}
that1.datas=datas
that1.id=datas.id
that1.uid=datas.uid
that1.name=datas.name
that1.is_teacher=datas.is_teacher
that1.content_one=datas.content_one
that1.content_two=datas.content_two
that1.is_introduce=datas.is_introduce
that1.content_three=datas.content_three
that1.is_result=datas.is_result
that1.sx_time=datas.add_time
} else {
if (res.msg) {
uni.showToast({
icon: 'none',
title: res.msg
})
} else {
uni.showToast({
icon: 'none',
title: '操作失败'
})
}
}
}).catch(e => {
that1.btnkg = 0
console.log(e)
uni.showToast({
icon: 'none',
title: '操作失败'
})
})
},
bindDateChange(e) {
var sx_time = e.detail.value
sx_time=sx_time.split('-')
sx_time=sx_time.join('/')
that1.sx_time=sx_time
},
save_fuc() {
var jkurl="/teacher/interview_add"
var datas={
uid:that1.uid,
name:that1.name,
is_teacher:that1.is_teacher,
content_one:that1.content_one,
content_two:that1.content_two,
is_introduce:that1.is_introduce,
content_three:that1.content_three,
is_result:that1.is_result,
add_time:that1.sx_time
}
if(that1.id){
jkurl="/teacher/interview_edit"
datas={
id:that1.id,
...datas
}
}
that1.$service.P_post(jkurl, datas).then(res => {
that1.btnkg = 0
console.log(res)
if (res.code == 1) {
var datas = res.data
console.log(typeof datas)
if (typeof datas == 'string') {
datas = JSON.parse(datas)
}
uni.showToast({
icon: 'none',
title: '保存成功'
})
setTimeout(function() {
uni.navigateBack({
delta: 1
})
}, 1000)
} else {
if (res.msg) {
uni.showToast({
icon: 'none',
title: res.msg
})
} else {
uni.showToast({
icon: 'none',
title: '操作失败'
})
}
}
}).catch(e => {
that1.btnkg = 0
console.log(e)
uni.showToast({
icon: 'none',
title: '操作失败'
})
})
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
},
}
}
</script>
<style lang="less" scoped>
.stu_list {
width: 100%;
min-height: 100rpx;
background: #FFFFFF;
border-radius: 10rpx;
.add_li{
width: 100%;
min-height: 90rpx;
padding:28rpx 30rpx;
&+.add_li{
border-top: 1px solid #eee;
}
.add_li_box{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 30rpx;
color: #545d71;
input{
text-align: right;
min-width: 0;
font-size: 30rpx;
}
.sf_v_btn_b{
display: flex;
align-items: center;
justify-content: center;
font-size: 18rpx;
color: #fff;
width: 32rpx;
height: 32rpx;
border: 1px solid #DEDEDE;
border-radius: 8rpx;
&.active{
background: #2D81FF;
border: 1px solid #2D81FF;
}
text{
font-size: 18rpx;
line-height: 20rpx;
}
}
}
.add_li_tit{
font-size: 30rpx;
color: #545D71;
line-height: 43rpx;
margin-bottom: 12rpx;
}
.add_li_content{
font-size: 30rpx;
color: #A6A9B1;
line-height: 43rpx;
width: 100%;
height: 120rpx;
letter-spacing:0;
}
}
}
.bz_add{
width: 100%;
// position: fixed;
// bottom: 0;
// background: #f8f8f8;
// z-index: 800;
// left: 0;
padding: 30rpx 0;
view{
font-size: 32rpx;
color: #FFFFFF;
width: 100%;
height: 90rpx;
background: #2D81FF;
border-radius: 10rpx;
display: flex;
align-items: center;
justify-content: center;
}
.del_btn{
margin-top: 20rpx;
}
}
</style>