add miniprogram
This commit is contained in:
73
miniprogram/pages/code/code.js
Normal file
73
miniprogram/pages/code/code.js
Normal file
@@ -0,0 +1,73 @@
|
||||
// pages/home/code.js
|
||||
var util = require('../../utils/util.js');
|
||||
Page({
|
||||
data: {
|
||||
imgUrl:'../../img/code.jpg',
|
||||
stuId: '',
|
||||
name: wx.getStorageSync('name'),
|
||||
isHealth: 0,
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
stuId : wx.getStorageSync('stuId'),
|
||||
name : wx.getStorageSync('name')
|
||||
})
|
||||
this.onShow()
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
this.setData({
|
||||
stuId : wx.getStorageSync('stuId'),
|
||||
name : wx.getStorageSync('name')
|
||||
})
|
||||
setInterval(() => {
|
||||
var time = util.formatTime(new Date())
|
||||
//为页面中time赋值
|
||||
this.setData({
|
||||
time: time
|
||||
})
|
||||
}, 1000);
|
||||
if(wx.getStorageSync("state") == this.formatDate(new Date())){
|
||||
this.setData({
|
||||
isHealth:1
|
||||
})
|
||||
}else{
|
||||
this.setData({
|
||||
isHealth:0
|
||||
})
|
||||
}
|
||||
wx.request({
|
||||
url: 'http://127.0.0.1:8080/code/showCode',
|
||||
data: {
|
||||
stuId:this.data.stuId,
|
||||
name:this.data.name,
|
||||
isHealth: this.data.isHealth
|
||||
},
|
||||
success: function (d) {}
|
||||
})
|
||||
},
|
||||
formatDate: function(date) {
|
||||
let year = date.getFullYear()
|
||||
let month = date.getMonth() + 1
|
||||
month = month.toString()
|
||||
month[1] ? month=month :month='0' + month
|
||||
let day = date.getDate()
|
||||
day = day.toString()
|
||||
day[1] ? day=day : day='0' + day
|
||||
return year+"-"+month+"-"+day
|
||||
},
|
||||
})
|
3
miniprogram/pages/code/code.json
Normal file
3
miniprogram/pages/code/code.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
6
miniprogram/pages/code/code.wxml
Normal file
6
miniprogram/pages/code/code.wxml
Normal file
@@ -0,0 +1,6 @@
|
||||
<view style="text-align: center;margin-top: 100px;">
|
||||
<image src="{{imgUrl}}"></image>
|
||||
<view><text class="user-motto">{{stuId}}</text></view>
|
||||
<view><text class="user-motto">{{name}}</text></view>
|
||||
<view><text class="user-motto">{{time}}</text></view>
|
||||
</view>
|
1
miniprogram/pages/code/code.wxss
Normal file
1
miniprogram/pages/code/code.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* pages/home/code.wxss */
|
Reference in New Issue
Block a user