shubanxinxi.vue
9.4 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
<template>
<view class="box">
<view class="infobox" v-if="showtrue" v-for="(item,index) in now_data" :key="index">
<view class="shubanitemleft time">{{item.createtime}}</view>
<view class="shubanitemleft num">{{item.papers}}</view>
<view class="shubanitemleft des">{{item.description}}</view>
<view class="shubanitemrow">
<image src="/static/img/rowright.png"></image>
</view>
</view>
<view class="infotou">
<view class="shubaninfohead">
<view class="shubaninfoleft">设备编号:{{number}}</view>
<view class="shubaninforight">
<image src="/static/img/fenxiang.png"></image>
<button open-type="share">享</button>
</view>
</view>
<view class="shucompany">
<view class="shuimg">
<image src="/static/img/company.png"></image>
</view>
<!-- <view class="companyname">所属公司:银河集团</view> -->
<view class="companyname">所属公司:{{equipment.name}}</view>
</view>
<view class="shucompany weizhi">
<view class="shuimg">
<image src="/static/img/weizhi.png"></image>
</view>
<!-- <view class="companyname">所在位置:天津银河百荣公司</view> -->
<view class="companyname">所在位置:{{equipment.address}}</view>
</view>
</view>
<view class="remaintime">
<view class="remainleft">剩余可用时间:{{shengyu_time}}</view>
<view class="remainright">
<image src="/static/img/row.png"></image>
</view>
</view>
<view class="shubanbox">
<view class="shubanhead">
<view class="shubanitem">数板时间</view>
<view class="shubanitem">仪器读数</view>
<view class="shubanitem">业务描述</view>
</view>
<view class="shubanlist">
<view class="shubanlistitem" @click="shubandetail(item)" v-for="(item,index) in equipment_log" :key="index">
<view class="shubanitemleft time">{{item.createtime}}</view>
<view class="shubanitemleft num">{{item.papers}}</view>
<view class="shubanitemleft des">{{item.description}}</view>
<view class="shubanitemrow">
<image src="/static/img/rowright.png"></image>
</view>
</view>
</view>
</view>
<view class="register" v-if="showketime">
<view class="timewrap">
<view class="keyongimg">
<image src="/static/img/sun.png"></image>
</view>
<view class="keyongtime">可用时间不足,请前去缴费!</view>
<view class='queding'>确定</view>
</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue"
export default {
data() {
return {
showketime: false,
showtrue: false,
// 数板数据
is_over: "",
equipment: "",
shengyu_time: "",
equipment_log: "",
// 获取当前时间
now_time: "",
// 获取最新的数板信息
now_data: "",
number: '',
is_share: 0,
page: 1
}
},
methods: {
shubandetail(e) {
uni.navigateTo({
url: '/pages/shubandetail/shubandetail?id=' + e.id + '&number=' + this.number
})
},
// 获取当前时间
get_nowtime() {
let t = this;
let timestamp = parseInt((new Date()).getTime() / 1000);
console.log(timestamp); //1495302061441
t.now_time = timestamp
},
// 获取最新的数板信息
get_newdata() {
let t = this;
console.log('9999988888', t.number)
let url = "api/equipment/getNewEquipment";
let param = {
number: t.number,
// number:this.number,
time: t.now_time
};
app.post(url, param, 'post').then(r => {
console.log(r, "最新的数板消息");
t.now_data = r.equipment_log;
console.log('1234567', t.now_data)
}).catch(err => {
console.log(err)
})
},
// 获取数板信息
get_shuban_infor() {
let t = this;
let url = "api/equipment/getEquipment";
let param = {
number: t.number,
is_share: t.is_share,
page: t.page
// number:this.number
};
app.post(url, param, 'post').then(r => {
console.log(r, "获取数板信息");
t.is_over = r.is_over;
t.equipment = r.equipment;
t.shengyu_time = r.shengyu;
t.equipment_log = t.equipment_log.concat(r.equipment_log);
t.get();
}).catch(err => {
console.log(err)
})
},
get() {
console.log('999999999')
let number = this.shengyu_time;
// // 时间戳处理
var totalSecond = number;
var second = totalSecond;
// // 秒数
// var second = totalSecond;
var day = Math.floor(second / 3600 / 24);
var dayStr = day.toString();
if (dayStr.length == 1) dayStr = dayStr;
// 小时位
var hr = Math.floor((second - day * 3600 * 24) / 3600);
var hrStr = hr.toString();
if (hrStr.length == 1) hrStr = hrStr;
// 分钟位
var min = Math.floor((second - day * 3600 * 24 - hr * 3600) / 60);
var minStr = min.toString();
if (minStr.length == 1) minStr = minStr;
// 秒位
var sec = second - day * 3600 * 24 - hr * 3600 - min * 60;
var secStr = sec.toString();
if (secStr.length == 1) secStr = secStr;
this.shengyu_time = dayStr + '天' + hrStr + '小时' + minStr + "分钟"
console.log('999999', this.shengyu_time)
},
},
mounted() {
let that = this
// this.showtrue=true
setTimeout(function() {
that.showtrue = true
}, 3000);
},
onLoad(options) {
console.log('9999900000', options)
this.number = options.num;
if (options.type == 1) {
this.is_share = 1
} else {
this.is_share = 0
}
// 获取当前时间
this.get_nowtime()
},
onShow() {
let that = this;
this.page=1;
this.equipment_log=[]
// 获取数板信息
this.get_shuban_infor();
// 获取最新的数板消息
// this.get_newdata()
setInterval(function() {
that.get_newdata()
}, 2000)
},
//上拉触底事件
onReachBottom: function() {
let page=this.page;
page++;
this.page=page;
this.get_shuban_infor()
},
onShareAppMessage: function(res) {
if (res.from === 'button') {
// 来自页面内转发按钮
}
return {
title: "钢聚人小程序",
path: 'pages/shubanxinxi/shubanxinxi?share=' + 'true' + '&type=' + 1 + '&num=' + this.number
}
},
}
</script>
<style>
.infotou {
background: #fff;
padding: 34rpx 32rpx;
box-sizing: border-box;
}
.shubaninfohead {
display: flex;
align-items: center;
justify-content: space-between;
}
image {
width: 100%;
height: 100%;
}
.shubaninforight {
width: 31rpx;
height: 31rpx;
font-size: 0;
position: relative;
}
.shubaninforight button {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.shubaninfoleft {
color: #0A0808;
font-size: 36rpx;
font-weight: bold;
}
.shucompany {
display: flex;
align-items: center;
margin-top: 30rpx;
}
.shuimg {
width: 30rpx;
height: 30rpx;
font-size: 0;
}
.companyname {
color: #7F8389;
font-size: 28rpx;
margin-left: 30rpx;
}
.weizhi {
margin-top: 18rpx;
}
.remaintime {
display: flex;
justify-content: space-between;
align-items: center;
width: 686rpx;
height: 100rpx;
background: rgba(62, 58, 57, 1);
box-shadow: 0rpx 4rpx 18rpx rgba(0, 0, 0, 0.04);
opacity: 1;
border-radius: 10rpx;
margin: 24rpx auto 0;
padding: 0 18rpx 0 32rpx;
}
.remainleft {
color: #fff;
font-size: 28rpx;
}
.remainright {
width: 48rpx;
height: 48rpx;
font-size: 0;
}
.shubanbox {
padding: 28rpx 22rpx 28rpx 32rpx;
box-sizing: border-box;
background: #fff;
}
.shubanhead {
display: flex;
align-items: center;
justify-content: space-around;
padding: 28rpx 0;
}
.shubanitem {
color: #0A0808;
font-size: 28rpx;
}
.shubanlistitem {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 36rpx;
}
.shubanlistitem:first-child {
margin-top: 18rpx;
}
.shubanitemrow {
width: 48rpx;
height: 48rpx;
font-size: 0;
margin-left: 20rpx;
}
.shubanitemleft {
color: #7F8389;
font-size: 26rpx;
}
.des {
width: 176rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-left: 20rpx;
text-align: center;
}
.time {
width: 156rpx;
margin-left: 30rpx;
}
.num {
width: 100rpx;
text-align: center;
margin-left: 78rpx;
}
.timewrap {
width: 492rpx;
height: 588rpx;
background: rgba(255, 255, 255, 1);
opacity: 1;
border-radius: 14rpx;
position: absolute;
top: 50%;
left: 50%;
right: 50%;
transform: translate(-50%, -50%)
}
.keyongimg {
width: 186rpx;
height: 166rpx;
font-size: 0;
margin: 54rpx auto 0;
}
.remaintime {
color: #0A0808;
font-size: 30rpx;
}
.queding {
width: 382rpx;
height: 100rpx;
background: rgba(243, 152, 0, 1);
box-shadow: 0rpx 4rpx 18rpx rgba(0, 0, 0, 0.04);
opacity: 1;
border-radius: 10rpx;
color: #fff;
font-size: 32rpx;
text-align: center;
line-height: 100rpx;
margin: 98rpx auto 0;
text-align: center;
}
.keyongtime {
color: #0A0808;
font-size: 30rpx;
text-align: center;
margin-top: 60rpx;
}
/* .infobox {
width: 100rpx;
height: 100rpx;
background: #fff;
pos-bottom: absolute;
}
*/
.infobox {
width: 750rpx;
height: 150rpx;
display: flex;
opacity: 1;
align-items: center;
justify-content: space-between;
/* height: 100rpx; */
background: #fff;
position: absolute;
top: -184rpx;
animation: myfirst 1s;
-moz-animation: myfirst 1s;
/* Firefox */
-webkit-animation: myfirst 1s;
/* Safari and Chrome */
-o-animation: myfirst 1s;
/* Opera */
}
@keyframes myfirst {
from {
top: -110rpx;
}
to {
top: 0;
}
}
</style>