1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

api接口baseUrl通过全局变量引入;代码格式化

This commit is contained in:
2022-11-05 16:45:52 +08:00
parent 3e0c182bc9
commit 5cf1ed3a49
22 changed files with 477 additions and 406 deletions

View File

@@ -17,7 +17,9 @@ App({
scope: 'scope',
})
},
// 全局变量
globalData: {
baseUrl: "http://localhost:8080", // 不带最后的 /
userInfo: null
}
})

View File

@@ -1,4 +1,7 @@
// pages/apply/apply.js
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
var dateTimePicker = require('./dateTimePicker.js');
Page({
data: {
@@ -95,7 +98,7 @@ Page({
apply: function () {
var data = this.data;
wx.request({
url: 'http://127.0.0.1:8080/apply/applySub',
url: `${baseUrl}/apply/applySub`,
data: {
stu_id: data.id,
issue: data.issue,

View File

@@ -1,11 +1,13 @@
// pages/other/feedback.js
Page({
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
/**
* 页面的初始数据
*/
data: {
List:'',
List: '',
replay: [],
},
@@ -27,13 +29,13 @@ Page({
replay: e.detail.value
})
},
agree:function (event) {
agree: function (event) {
var that = this
wx.request({
url: 'http://127.0.0.1:8080/apply/applyReplay',
url: `${baseUrl}/apply/applyReplay`,
data: {
id:event.target.dataset.id,
replay:event.target.dataset.replay,
id: event.target.dataset.id,
replay: event.target.dataset.replay,
reasonId: 99
},
success: function (d) {
@@ -41,25 +43,24 @@ Page({
title: d.data.msg,
icon: 'success',
duration: 2000,
success: function () {
}
success: function () {}
})
that.onShow();
}
})
},
disagree:function (event) {
disagree: function (event) {
var that = this
wx.showActionSheet({
itemList: ['格式错误','出行地点不允许','时间填写错误'],
success:function (res) {
if(!res.cancel){
itemList: ['格式错误', '出行地点不允许', '时间填写错误'],
success: function (res) {
if (!res.cancel) {
wx.request({
url: 'http://127.0.0.1:8080/apply/applyReplay',
url: `${baseUrl}/apply/applyReplay`,
data: {
id:event.target.dataset.id,
replay:event.target.dataset.replay,
reasonId:res.tapIndex,
id: event.target.dataset.id,
replay: event.target.dataset.replay,
reasonId: res.tapIndex,
},
success: function (d) {
wx.showToast({
@@ -82,7 +83,7 @@ Page({
onShow: function () {
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/apply/applyListNoReplay',
url: `${baseUrl}/apply/applyListNoReplay`,
success: function (d) {
that.setData({
List: d.data.data
@@ -95,8 +96,7 @@ Page({
// var that = this
// console.log(event.target.dataset)
// wx.request({
// url: 'http://127.0.0.1:8080/apply/applyListNoReplay',
// url: `${baseUrl}/apply/applyListNoReplay`,
// })
// },
/**
@@ -133,4 +133,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -1,11 +1,14 @@
// pages/other/feedback.js
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
/**
* 页面的初始数据
*/
data: {
List:'',
List: '',
replay: [],
},
@@ -27,37 +30,37 @@ Page({
replay: e.detail.value
})
},
agree:function (event) {
agree: function (event) {
var that = this
wx.request({
url: 'http://127.0.0.1:8080/apply/applyReplay',
url: `${baseUrl}/apply/applyReplay`,
data: {
id:event.target.dataset.id,
replay:event.target.dataset.replay,
id: event.target.dataset.id,
replay: event.target.dataset.replay,
reasonId: 99
},
success: function (d) {
if(d.data.msg == "成功"){
if (d.data.msg == "成功") {
that.onshow();
}
}
})
},
disagree:function (event) {
disagree: function (event) {
var that = this
wx.showActionSheet({
itemList: ['格式错误','出行地点不允许','时间填写错误'],
success:function (res) {
if(!res.cancel){
itemList: ['格式错误', '出行地点不允许', '时间填写错误'],
success: function (res) {
if (!res.cancel) {
wx.request({
url: 'http://127.0.0.1:8080/apply/applyReplay',
url: `${baseUrl}/apply/applyReplay`,
data: {
id:event.target.dataset.id,
replay:event.target.dataset.replay,
reasonId:res.tapIndex,
id: event.target.dataset.id,
replay: event.target.dataset.replay,
reasonId: res.tapIndex,
},
success: function (d) {
if(d.data.msg == "成功"){
if (d.data.msg == "成功") {
that.onShow();
}
}
@@ -72,8 +75,10 @@ Page({
onShow: function () {
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/apply/myApply',
data:{id:wx.getStorageSync('id')},
url: `${baseUrl}/apply/myApply`,
data: {
id: wx.getStorageSync('id')
},
success: function (d) {
that.setData({
List: d.data.data
@@ -116,4 +121,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -1,8 +1,11 @@
// pages/home/code.js
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
var util = require('../../utils/util.js');
Page({
data: {
imgUrl:'../../img/code.jpg',
imgUrl: '../../img/code.jpg',
stuId: '',
name: wx.getStorageSync('name'),
isHealth: 0,
@@ -12,11 +15,11 @@ Page({
*/
onLoad: function (options) {
this.setData({
stuId : wx.getStorageSync('stuId'),
name : wx.getStorageSync('name')
stuId: wx.getStorageSync('stuId'),
name: wx.getStorageSync('name')
})
this.onShow()
},
/**
@@ -31,43 +34,43 @@ Page({
*/
onShow: function () {
this.setData({
stuId : wx.getStorageSync('stuId'),
name : wx.getStorageSync('name')
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())){
//为页面中time赋值
this.setData({
isHealth:1
time: time
})
}else{
}, 1000);
if (wx.getStorageSync("state") == this.formatDate(new Date())) {
this.setData({
isHealth:0
isHealth: 1
})
} else {
this.setData({
isHealth: 0
})
}
wx.request({
url: 'http://127.0.0.1:8080/code/showCode',
url: `${baseUrl}/code/showCode`,
data: {
stuId:this.data.stuId,
name:this.data.name,
stuId: this.data.stuId,
name: this.data.name,
isHealth: this.data.isHealth
},
success: function (d) {}
})
},
formatDate: function(date) {
formatDate: function (date) {
let year = date.getFullYear()
let month = date.getMonth() + 1
month = month.toString()
month[1] ? month=month :month='0' + month
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
},
})
day[1] ? day = day : day = '0' + day
return year + "-" + month + "-" + day
},
})

View File

@@ -1,18 +1,21 @@
// pages/home/home.js
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
/**
* 页面的初始数据
*/
data: {
isManager:false,
isStudent:false,
notice:''
isManager: false,
isStudent: false,
notice: ''
},
goWebPage: function (event) {
wx.navigateTo({
url: '../webPage/'+event.target.dataset.web,
url: '../webPage/' + event.target.dataset.web,
})
},
toRedList: function (event) {
@@ -20,7 +23,7 @@ Page({
url: '../other/redList'
})
},
goCode:function() {
goCode: function () {
wx.navigateTo({
url: '../other/redList2'
})
@@ -30,12 +33,12 @@ Page({
url: '../person/count'
})
},
goNotice:function () {
goNotice: function () {
wx.navigateTo({
url: '../notice/notice'
})
},
goVisitor:function () {
goVisitor: function () {
wx.navigateTo({
url: '../visitor/visitorReplay'
})
@@ -80,7 +83,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
@@ -94,17 +97,17 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
if(!wx.getStorageSync("username")){
if (!wx.getStorageSync("username")) {
wx.navigateTo({
url: '../login/login'
})
}
if(wx.getStorageSync("role") == 2){
if (wx.getStorageSync("role") == 2) {
this.setData({
isManager: false,
isStudent: true,
})
}else if(wx.getStorageSync("role") == 1){
} else if (wx.getStorageSync("role") == 1) {
this.setData({
isManager: true,
isStudent: false,
@@ -112,8 +115,10 @@ Page({
}
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/notice/noticeList',
data:{limit:3},
url: `${baseUrl}/notice/noticeList`,
data: {
limit: 3
},
success: function (d) {
that.setData({
notice: d.data.data
@@ -156,4 +161,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -1,74 +1,79 @@
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
data: {
username: '',
password: ''
},
data: {
username: '',
password: ''
},
// 获取输入账号
usernameInput: function (e) {
this.setData({
username: e.detail.value
})
},
// 获取输入账号
usernameInput: function (e) {
this.setData({
username: e.detail.value
})
},
// 获取输入密码
passwordInput: function (e) {
this.setData({
password: e.detail.value
})
},
// 获取输入密码
passwordInput: function (e) {
this.setData({
password: e.detail.value
})
},
// 登录
login: function () {
var username = this.data.username
if(this.data.username == '' || this.data.password == ''){
wx.showToast({
title: "请完善登录信息",
icon: 'error',
duration: 2000
})
}else{
wx.request({
url: 'http://127.0.0.1:8080/user/login',
data: {
username: this.data.username,
password: this.data.password,
},
success: function (d) {
if (d.data.msg == "成功") {
wx.setStorageSync("username",username);
if(d.data.data.stu_id){
wx.setStorageSync("stuId",d.data.data.stu_id);
}
wx.setStorageSync("id",d.data.data.id);
wx.setStorageSync("name",d.data.data.name);
wx.setStorageSync("role",d.data.data.role);
wx.setStorageSync("state",d.data.data.state)
wx.showToast({
title: "登录成功",
icon: 'success',
success: function () {
wx.switchTab({
url: '../home/home'
})
}
})
} else {
wx.showToast({
title: d.data.msg,
icon: 'error',
duration: 2000
// 登录
login: function () {
var username = this.data.username
var password = this.data.password
if (username == '' || password == '') {
wx.showToast({
title: "请完善登录信息",
icon: 'error',
duration: 2000
})
} else {
wx.request({
url: `${baseUrl}/user/login`,
data: {
username: this.data.username,
password: this.data.password,
},
success: function (d) {
if (d.data.msg == "成功") {
wx.setStorageSync("username", username);
if (d.data.data.stu_id) {
wx.setStorageSync("stuId", d.data.data.stu_id);
}
wx.setStorageSync("id", d.data.data.id);
wx.setStorageSync("name", d.data.data.name);
wx.setStorageSync("role", d.data.data.role);
wx.setStorageSync("state", d.data.data.state)
wx.showToast({
title: "登录成功",
icon: 'success',
success: function () {
wx.switchTab({
url: '../home/home'
})
}
}
})
})
} else {
wx.showToast({
title: d.data.msg,
icon: 'error',
duration: 2000
})
}
}
},
})
}
},
visitor: function () {
wx.navigateTo({
url: '../visitor/visitor',
success: function () {}, //成功后的回调;
})
},
})
visitor: function () {
wx.navigateTo({
url: '../visitor/visitor',
success: function () { }, //成功后的回调;
})
},
})

View File

@@ -1,12 +1,15 @@
//issues.js
//获取应用实例
var app = getApp();
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
var util = require('../../utils/util')
Page({
data: {
title: '',
content: '',
time:''
time: ''
},
titleInput: function (e) {
@@ -21,14 +24,14 @@ Page({
})
},
submit:function () {
submit: function () {
var TIME = util.formatTime(new Date());
wx.request({
url: 'http://127.0.0.1:8080/notice/addNotice',
url: `${baseUrl}/notice/addNotice`,
data: {
title: this.data.title,
content: this.data.content,
time:TIME,
time: TIME,
},
success: function (d) {
if (d.data != "提交失败") {
@@ -37,11 +40,11 @@ Page({
icon: 'success',
duration: 2000,
success: function () {
setTimeout(function() {
setTimeout(function () {
wx.switchTab({
url: '../home/home'
})
}, 2000);
}, 2000);
}
})
} else {
@@ -55,8 +58,8 @@ Page({
})
},
onLoad: function(){
onLoad: function () {
},
});
});

View File

@@ -1,11 +1,14 @@
// pages/other/feedback.js
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
/**
* 页面的初始数据
*/
data: {
feedbackList:'',
feedbackList: '',
},
/**
@@ -28,13 +31,13 @@ Page({
onShow: function () {
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/other/feedbackList',
url: `${baseUrl}/other/feedbackList`,
data: {
id:wx.getStorageSync('id')
id: wx.getStorageSync('id')
},
success: function (d) {
for (const iterator of d.data.data) {
if(!iterator.reply){
if (!iterator.reply) {
iterator.reply = "暂无"
}
}
@@ -79,4 +82,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -5,7 +5,7 @@ Page({
* 页面的初始数据
*/
data: {
feedbackList:'',
feedbackList: '',
replay: [],
},
@@ -33,13 +33,13 @@ Page({
onShow: function () {
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/other/feedbackListNoReplay',
url: `${baseUrl}/other/feedbackListNoReplay`,
data: {
id:wx.getStorageSync('id')
id: wx.getStorageSync('id')
},
success: function (d) {
for (const iterator of d.data.data) {
if(!iterator.reply){
if (!iterator.reply) {
iterator.reply = ""
}
}
@@ -54,10 +54,10 @@ Page({
var that = this
console.log(event.target.dataset)
wx.request({
url: 'http://127.0.0.1:8080/other/feedbackReplay',
url: `${baseUrl}/other/feedbackReplay`,
data: {
id:event.target.dataset.id,
replay:event.target.dataset.replay
id: event.target.dataset.id,
replay: event.target.dataset.replay
},
success: function (d) {
wx.showToast({
@@ -66,12 +66,12 @@ Page({
duration: 2000,
success: function () {
that.setData({
replay : ""
replay: ""
})
that.onShow()
}
})
}
})
},
@@ -109,4 +109,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -1,14 +1,17 @@
// pages/other/password.js
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
/**
* 页面的初始数据
*/
data: {
username:wx.getStorageSync('username'),
pwd1:'',
pwd2:'',
pwd3:''
username: wx.getStorageSync('username'),
pwd1: '',
pwd2: '',
pwd3: ''
},
pwd1: function (e) {
this.setData({
@@ -27,15 +30,15 @@ Page({
},
submit: function () {
if(this.data.pwd2 != this.data.pwd3){
if (this.data.pwd2 != this.data.pwd3) {
wx.showToast({
title: '新密码不一致',
icon: 'error',
duration: 2000
})
}else{
} else {
wx.request({
url: 'http://127.0.0.1:8080/user/updPwd',
url: `${baseUrl}/user/updPwd`,
data: {
username: this.data.username,
pwd1: this.data.pwd1,
@@ -48,12 +51,12 @@ Page({
icon: 'success',
duration: 2000,
success: function () {
setTimeout(function() {
setTimeout(function () {
wx.clearStorageSync()
wx.navigateTo({
url: '../login/login'
})
}, 2000);
}, 2000);
}
})
} else {
@@ -66,7 +69,7 @@ Page({
}
})
}
},
/**
* 生命周期函数--监听页面加载
@@ -123,4 +126,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -1,33 +1,33 @@
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
data:{
tableInfo: {},
count:''
data: {
tableInfo: {},
count: ''
},
onReady: function () {
// 生命周期函数--监听页面初次渲染完成
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/user/redCodeList',
success: function (d) {
let item = [];
for (const iterator of d.data.data) {
let item1 = [iterator.stu_id,iterator.name];
item.push(item1)
}
that.setData({
tableInfo:{
title:["学号","姓名"],
contentItem: item,
},
count: d.data.data.length
})
// 生命周期函数--监听页面初次渲染完成
var that = this;
wx.request({
url: `${baseUrl}/user/redCodeList`,
success: function (d) {
let item = [];
for (const iterator of d.data.data) {
let item1 = [iterator.stu_id, iterator.name];
item.push(item1)
}
})
},
})
that.setData({
tableInfo: {
title: ["学号", "姓名"],
contentItem: item,
},
count: d.data.data.length
})
}
})
},
})

View File

@@ -1,33 +1,32 @@
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
data:{
tableInfo: {},
count:''
data: {
tableInfo: {},
count: ''
},
onReady: function () {
// 生命周期函数--监听页面初次渲染完成
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/user/redCodeList2',
success: function (d) {
let item = [];
for (const iterator of d.data.data) {
let item1 = [iterator.stu_id,iterator.name];
item.push(item1)
}
that.setData({
tableInfo:{
title:["学号","姓名"],
contentItem: item,
},
count: d.data.data.length
})
// 生命周期函数--监听页面初次渲染完成
var that = this;
wx.request({
url: `${baseUrl}/user/redCodeList2`,
success: function (d) {
let item = [];
for (const iterator of d.data.data) {
let item1 = [iterator.stu_id, iterator.name];
item.push(item1)
}
})
},
})
that.setData({
tableInfo: {
title: ["学号", "姓名"],
contentItem: item,
},
count: d.data.data.length
})
}
})
},
})

View File

@@ -1,18 +1,28 @@
// pages/person/count.js
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
/**
* 页面的初始数据
*/
data: {
useranme:'',
name:'',
radio1: [{name:'管理员',value:'1'},{name:'学生',value:'2',checked: 'true'}],
role:'2'
useranme: '',
name: '',
radio1: [{
name: '管理员',
value: '1'
}, {
name: '学生',
value: '2',
checked: 'true'
}],
role: '2'
},
radioChange: function(e) {
radioChange: function (e) {
this.setData({
role:e.detail.value
role: e.detail.value
})
},
username: function (e) {
@@ -25,10 +35,10 @@ Page({
name: e.detail.value
})
},
submit:function () {
submit: function () {
var that = this
wx.request({
url: 'http://127.0.0.1:8080/user/addUser',
url: `${baseUrl}/user/addUser`,
data: {
username: this.data.username,
name: this.data.name,
@@ -42,7 +52,7 @@ Page({
duration: 2000,
})
that.onLoad();
}else{
} else {
wx.showToast({
title: d.data.data,
icon: 'error',
@@ -50,8 +60,8 @@ Page({
})
}
}
})
},
})
},
/**
* 生命周期函数--监听页面加载
*/
@@ -107,4 +117,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -1,23 +1,26 @@
// pages/person/info.js
Page({
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
/**
* 页面的初始数据
*/
data: {
id:wx.getStorageSync('id'),
name:wx.getStorageSync('name'),
stuId:wx.getStorageSync('stuId'),
img:''
id: wx.getStorageSync('id'),
name: wx.getStorageSync('name'),
stuId: wx.getStorageSync('stuId'),
img: ''
},
personInfo() {
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/user/person',
url: `${baseUrl}/user/person`,
data: {
username: wx.getStorageSync('username'),
},success: function (d) {
},
success: function (d) {
that.setData({
img: d.data.img,
name: wx.getStorageSync('name'),
@@ -32,7 +35,7 @@ Page({
count: 1,
sizeType: 'compressed',
sourceType: ['album', 'camera'],
success (res) {
success(res) {
let imgbase64 = 'data:image/png;base64,' + wx.getFileSystemManager().readFileSync(res.tempFilePaths[0], "base64")
that.setData({
img: imgbase64,
@@ -43,22 +46,23 @@ Page({
update: function () {
wx.request({
url: 'http://127.0.0.1:8080/user/updateImg',
url: `${baseUrl}/user/updateImg`,
data: {
id: this.data.id,
img: this.data.img
},success: function (d) {
},
success: function (d) {
if (d.data != "修改失败") {
wx.showToast({
title: d.data,
icon: 'success',
duration: 2000,
success: function () {
setTimeout(function() {
setTimeout(function () {
wx.switchTab({
url: '../person/person'
})
}, 2000);
}, 2000);
}
})
} else {
@@ -76,7 +80,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
@@ -90,7 +94,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
@@ -127,4 +131,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -1,12 +1,15 @@
//issues.js
//获取应用实例
var app = getApp();
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
var util = require('../../utils/util')
Page({
data: {
title: '',
content: '',
time:''
time: ''
},
titleInput: function (e) {
@@ -21,15 +24,15 @@ Page({
})
},
submit:function () {
submit: function () {
var TIME = util.formatTime(new Date());
wx.request({
url: 'http://127.0.0.1:8080/other/subFeedback',
url: `${baseUrl}/other/subFeedback`,
data: {
title: this.data.title,
content: this.data.content,
time:TIME,
id:wx.getStorageSync('id')
time: TIME,
id: wx.getStorageSync('id')
},
success: function (d) {
if (d.data != "提交失败") {
@@ -38,11 +41,11 @@ Page({
icon: 'success',
duration: 2000,
success: function () {
setTimeout(function() {
setTimeout(function () {
wx.switchTab({
url: '../person/person'
})
}, 2000);
}, 2000);
}
})
} else {
@@ -56,8 +59,8 @@ Page({
})
},
onLoad: function(){
onLoad: function () {
},
});
});

View File

@@ -1,18 +1,21 @@
// pages/person/person.js
var app = getApp();
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
data: {
name:wx.getStorageSync('name'),
img:''
name: wx.getStorageSync('name'),
img: ''
},
personInfo() {
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/user/person',
url: `${baseUrl}/user/person`,
data: {
username: wx.getStorageSync('username'),
},success: function (d) {
},
success: function (d) {
that.setData({
img: d.data.img,
name: wx.getStorageSync('name'),
@@ -36,18 +39,17 @@ Page({
icon: 'success',
duration: 1000
})
} else {
}
} else {}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
@@ -98,4 +100,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -1,36 +1,35 @@
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
data:{
tableInfo: {},
count:''
data: {
tableInfo: {},
count: ''
},
onReady: function () {
// 生命周期函数--监听页面初次渲染完成
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/report/myReport',
data: {
id:wx.getStorageSync('id')
},
success: function (d) {
let item = [];
for (const iterator of d.data.data) {
let item1 = [iterator.name,iterator.time,iterator.normal,iterator.address];
item.push(item1)
}
that.setData({
tableInfo:{
title:["姓名","填报时间","体温状况","位置"],
contentItem: item,
},
count: d.data.data.length
})
// 生命周期函数--监听页面初次渲染完成
var that = this;
wx.request({
url: `${baseUrl}/report/myReport`,
data: {
id: wx.getStorageSync('id')
},
success: function (d) {
let item = [];
for (const iterator of d.data.data) {
let item1 = [iterator.name, iterator.time, iterator.normal, iterator.address];
item.push(item1)
}
})
},
})
that.setData({
tableInfo: {
title: ["姓名", "填报时间", "体温状况", "位置"],
contentItem: item,
},
count: d.data.data.length
})
}
})
},
})

View File

@@ -1,4 +1,6 @@
// pages/report/report.js
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
var util = require('../../utils/util')
Page({
@@ -6,30 +8,44 @@ Page({
* 页面的初始数据
*/
data: {
id:'',
id: '',
address: '',
time: '',
radio1: [{value:'正常',checked: 'true'},{value:'发热'}],
radio2:[{value:'无需隔离',checked:'true'},{value:'居家隔离'},{value:'集中隔离'},{value:'入院隔离'}],
normal:'正常',
isolation:'无需隔离',
radio1: [{
value: '正常',
checked: 'true'
}, {
value: '发热'
}],
radio2: [{
value: '无需隔离',
checked: 'true'
}, {
value: '居家隔离'
}, {
value: '集中隔离'
}, {
value: '入院隔离'
}],
normal: '正常',
isolation: '无需隔离',
name: '',
stuId: '',
yes_noon_temp:36.2,
yes_night_temp:36.4,
today_morning_temp:36.2
yes_noon_temp: 36.2,
yes_night_temp: 36.4,
today_morning_temp: 36.2
},
radioChange1: function(e) {
radioChange1: function (e) {
this.setData({
normal:e.detail.value
normal: e.detail.value
})
},
radioChange2: function(e) {
radioChange2: function (e) {
this.setData({
isolation:e.detail.value
isolation: e.detail.value
})
},
chooseLocation: function () {
var that = this;
wx.getSetting({
@@ -37,7 +53,7 @@ Page({
if (!res.authSetting['scope.userLocation']) {
wx.authorize({
scope: 'scope.userLocationBackground',
success(){
success() {
that.location();
}
})
@@ -48,7 +64,7 @@ Page({
})
},
location:function () {
location: function () {
var that = this;
wx.chooseLocation({
success: function (res) {
@@ -65,7 +81,7 @@ Page({
})
},
myreport:function () {
myreport: function () {
wx.navigateTo({
url: './myreport'
})
@@ -73,39 +89,39 @@ Page({
report: function () {
var that = this
if(this.data.address==''){
if (this.data.address == '') {
wx.showToast({
title: '请先选择地址',
icon: 'none',
duration: 2000
})
}else{
} else {
wx.request({
url: 'http://127.0.0.1:8080/report/doReport',
url: `${baseUrl}/report/doReport`,
data: {
user_id:this.data.id,
name:this.data.name,
user_id: this.data.id,
name: this.data.name,
address: this.data.address,
time: this.data.time,
normal:this.data.normal,
yes_noon_temp:this.data.yes_noon_temp,
yes_night_temp:this.data.yes_night_temp,
today_morning_temp:this.data.today_morning_temp,
isolation:this.data.isolation
normal: this.data.normal,
yes_noon_temp: this.data.yes_noon_temp,
yes_night_temp: this.data.yes_night_temp,
today_morning_temp: this.data.today_morning_temp,
isolation: this.data.isolation
},
success: function (d) {
if (d.data == "填报成功") {
wx.showToast({
title: d.data,
icon: 'success',
success: function () {
if(that.data.normal != "发热" && that.data.isolation == "无需隔离"){
wx.setStorageSync("state",that.formatDate(new Date()))
}else{
wx.setStorageSync("state","1999-01-01")
if (that.data.normal != "发热" && that.data.isolation == "无需隔离") {
wx.setStorageSync("state", that.formatDate(new Date()))
} else {
wx.setStorageSync("state", "1999-01-01")
}
}
})
} else {
@@ -119,16 +135,16 @@ Page({
})
}
},
formatDate: function(date) {
formatDate: function (date) {
let year = date.getFullYear()
let month = date.getMonth() + 1
month = month.toString()
month[1] ? month=month :month='0' + month
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
},
day[1] ? day = day : day = '0' + day
return year + "-" + month + "-" + day
},
/**
* 生命周期函数--监听页面加载
*/
@@ -152,7 +168,7 @@ Page({
time: TIME,
name: wx.getStorageSync('name'),
stuId: wx.getStorageSync('stuId'),
id:wx.getStorageSync('id')
id: wx.getStorageSync('id')
});
},
@@ -190,4 +206,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -1,6 +1,8 @@
// pages/visitor/showMyVisitor.js
Page({
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
/**
* 页面的初始数据
*/
@@ -25,22 +27,22 @@ Page({
})
} else {
wx.request({
url: 'http://127.0.0.1:8080/visitor/showMyVisitor',
url: `${baseUrl}/visitor/showMyVisitor`,
data: {
phone: this.data.phone,
},
success: function (d) {
if (d.data == "审批通过") {
that.setData({
greenCode:true,
redCode:false,
msg:d.data
greenCode: true,
redCode: false,
msg: d.data
})
}else{
} else {
that.setData({
greenCode:false,
redCode:true,
msg:d.data
greenCode: false,
redCode: true,
msg: d.data
})
}
}
@@ -102,4 +104,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -1,15 +1,17 @@
// pages/visitor/visitor.js
Page({
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
/**
* 页面的初始数据
*/
data: {
date:'',
time:'',
phone:'',
issue:'',
meetName:''
date: '',
time: '',
phone: '',
issue: '',
meetName: ''
},
showMyVisitor: function () {
wx.navigateTo({
@@ -19,21 +21,21 @@ Page({
},
report: function () {
wx.request({
url: 'http://127.0.0.1:8080/visitor/visitorApply',
url: `${baseUrl}/visitor/visitorApply`,
data: {
phone: this.data.phone,
issue: this.data.issue,
meet_name: this.data.meetName,
time: this.data.date+" "+this.data.time
time: this.data.date + " " + this.data.time
},
success:function(d){
if(d.data == "您还有未审批的申请,不能重复申请"){
success: function (d) {
if (d.data == "您还有未审批的申请,不能重复申请") {
wx.showToast({
title:'不能重复申请',
title: '不能重复申请',
icon: 'error',
duration: 2000
})
}else{
} else {
wx.showToast({
title: d.data,
icon: 'success',
@@ -43,27 +45,27 @@ Page({
}
})
},
bindDateChange: function(e) {
bindDateChange: function (e) {
this.setData({
date: e.detail.value
})
},
bindTimeChange: function(e) {
bindTimeChange: function (e) {
this.setData({
time: e.detail.value
})
},
phoneChange: function(e) {
phoneChange: function (e) {
this.setData({
phone: e.detail.value
})
},
issueChange: function(e) {
issueChange: function (e) {
this.setData({
issue: e.detail.value
})
},
meetNameChange: function(e) {
meetNameChange: function (e) {
this.setData({
meetName: e.detail.value
})
@@ -123,4 +125,4 @@ Page({
onShareAppMessage: function () {
}
})
})

View File

@@ -1,11 +1,13 @@
// pages/other/feedback.js
Page({
const app = getApp()
const baseUrl = app.globalData.baseUrl
// console.log("baseUrl", baseUrl)
Page({
/**
* 页面的初始数据
*/
data: {
List:'',
List: '',
replay: [],
},
@@ -15,13 +17,13 @@ Page({
onLoad: function (options) {
},
replay:function (event) {
replay: function (event) {
var that = this
wx.request({
url: 'http://127.0.0.1:8080/visitor/visitorChangeState',
url: `${baseUrl}/visitor/visitorChangeState`,
data: {
id:event.target.dataset.id,
state:event.target.dataset.replay,
id: event.target.dataset.id,
state: event.target.dataset.replay,
},
success: function (d) {
wx.showToast({
@@ -52,7 +54,7 @@ Page({
onShow: function () {
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/visitor/showVisitorList',
url: `${baseUrl}/visitor/showVisitorList`,
success: function (d) {
that.setData({
List: d.data.data
@@ -95,4 +97,4 @@ Page({
onShareAppMessage: function () {
}
})
})