api接口baseUrl通过全局变量引入;代码格式化
This commit is contained in:
@@ -17,7 +17,9 @@ App({
|
||||
scope: 'scope',
|
||||
})
|
||||
},
|
||||
// 全局变量
|
||||
globalData: {
|
||||
baseUrl: "http://localhost:8080", // 不带最后的 /
|
||||
userInfo: null
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// pages/other/feedback.js
|
||||
Page({
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
@@ -30,7 +32,7 @@ Page({
|
||||
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,
|
||||
@@ -41,8 +43,7 @@ Page({
|
||||
title: d.data.msg,
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
success: function () {
|
||||
}
|
||||
success: function () {}
|
||||
})
|
||||
that.onShow();
|
||||
}
|
||||
@@ -55,7 +56,7 @@ Page({
|
||||
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,
|
||||
@@ -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`,
|
||||
// })
|
||||
// },
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// pages/other/feedback.js
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
@@ -30,7 +33,7 @@ Page({
|
||||
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,
|
||||
@@ -50,7 +53,7 @@ Page({
|
||||
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,
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// pages/home/code.js
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
var util = require('../../utils/util.js');
|
||||
Page({
|
||||
data: {
|
||||
@@ -51,7 +54,7 @@ Page({
|
||||
})
|
||||
}
|
||||
wx.request({
|
||||
url: 'http://127.0.0.1:8080/code/showCode',
|
||||
url: `${baseUrl}/code/showCode`,
|
||||
data: {
|
||||
stuId: this.data.stuId,
|
||||
name: this.data.name,
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// pages/home/home.js
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
@@ -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
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
data: {
|
||||
username: '',
|
||||
@@ -21,7 +25,8 @@ Page({
|
||||
// 登录
|
||||
login: function () {
|
||||
var username = this.data.username
|
||||
if(this.data.username == '' || this.data.password == ''){
|
||||
var password = this.data.password
|
||||
if (username == '' || password == '') {
|
||||
wx.showToast({
|
||||
title: "请完善登录信息",
|
||||
icon: 'error',
|
||||
@@ -29,7 +34,7 @@ Page({
|
||||
})
|
||||
} else {
|
||||
wx.request({
|
||||
url: 'http://127.0.0.1:8080/user/login',
|
||||
url: `${baseUrl}/user/login`,
|
||||
data: {
|
||||
username: this.data.username,
|
||||
password: this.data.password,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
//issues.js
|
||||
//获取应用实例
|
||||
var app = getApp();
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
var util = require('../../utils/util')
|
||||
Page({
|
||||
data: {
|
||||
@@ -24,7 +27,7 @@ Page({
|
||||
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,
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// pages/other/feedback.js
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
@@ -28,7 +31,7 @@ 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')
|
||||
},
|
||||
|
||||
@@ -33,7 +33,7 @@ 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')
|
||||
},
|
||||
@@ -54,7 +54,7 @@ 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
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// pages/other/password.js
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
@@ -35,7 +38,7 @@ Page({
|
||||
})
|
||||
} 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,
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
|
||||
data: {
|
||||
|
||||
tableInfo: {},
|
||||
count: ''
|
||||
},
|
||||
|
||||
|
||||
onReady: function () {
|
||||
// 生命周期函数--监听页面初次渲染完成
|
||||
var that = this;
|
||||
wx.request({
|
||||
url: 'http://127.0.0.1:8080/user/redCodeList',
|
||||
url: `${baseUrl}/user/redCodeList`,
|
||||
success: function (d) {
|
||||
let item = [];
|
||||
for (const iterator of d.data.data) {
|
||||
@@ -27,7 +29,5 @@ Page({
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
})
|
||||
@@ -1,17 +1,18 @@
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
|
||||
data: {
|
||||
|
||||
tableInfo: {},
|
||||
count: ''
|
||||
},
|
||||
|
||||
|
||||
onReady: function () {
|
||||
// 生命周期函数--监听页面初次渲染完成
|
||||
var that = this;
|
||||
wx.request({
|
||||
url: 'http://127.0.0.1:8080/user/redCodeList2',
|
||||
url: `${baseUrl}/user/redCodeList2`,
|
||||
success: function (d) {
|
||||
let item = [];
|
||||
for (const iterator of d.data.data) {
|
||||
@@ -27,7 +28,5 @@ Page({
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
})
|
||||
@@ -1,4 +1,7 @@
|
||||
// pages/person/count.js
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
@@ -7,7 +10,14 @@ Page({
|
||||
data: {
|
||||
useranme: '',
|
||||
name: '',
|
||||
radio1: [{name:'管理员',value:'1'},{name:'学生',value:'2',checked: 'true'}],
|
||||
radio1: [{
|
||||
name: '管理员',
|
||||
value: '1'
|
||||
}, {
|
||||
name: '学生',
|
||||
value: '2',
|
||||
checked: 'true'
|
||||
}],
|
||||
role: '2'
|
||||
},
|
||||
radioChange: function (e) {
|
||||
@@ -28,7 +38,7 @@ Page({
|
||||
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,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// pages/person/info.js
|
||||
Page({
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
@@ -14,10 +16,11 @@ Page({
|
||||
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'),
|
||||
@@ -43,11 +46,12 @@ 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,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
//issues.js
|
||||
//获取应用实例
|
||||
var app = getApp();
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
var util = require('../../utils/util')
|
||||
Page({
|
||||
data: {
|
||||
@@ -24,7 +27,7 @@ Page({
|
||||
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,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// 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'),
|
||||
@@ -9,10 +11,11 @@ Page({
|
||||
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,8 +39,7 @@ Page({
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
} else {
|
||||
}
|
||||
} else {}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
|
||||
data: {
|
||||
|
||||
tableInfo: {},
|
||||
count: ''
|
||||
},
|
||||
|
||||
|
||||
onReady: function () {
|
||||
// 生命周期函数--监听页面初次渲染完成
|
||||
var that = this;
|
||||
wx.request({
|
||||
url: 'http://127.0.0.1:8080/report/myReport',
|
||||
url: `${baseUrl}/report/myReport`,
|
||||
data: {
|
||||
id: wx.getStorageSync('id')
|
||||
},
|
||||
@@ -30,7 +31,5 @@ Page({
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
})
|
||||
@@ -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({
|
||||
@@ -9,8 +11,22 @@ Page({
|
||||
id: '',
|
||||
address: '',
|
||||
time: '',
|
||||
radio1: [{value:'正常',checked: 'true'},{value:'发热'}],
|
||||
radio2:[{value:'无需隔离',checked:'true'},{value:'居家隔离'},{value:'集中隔离'},{value:'入院隔离'}],
|
||||
radio1: [{
|
||||
value: '正常',
|
||||
checked: 'true'
|
||||
}, {
|
||||
value: '发热'
|
||||
}],
|
||||
radio2: [{
|
||||
value: '无需隔离',
|
||||
checked: 'true'
|
||||
}, {
|
||||
value: '居家隔离'
|
||||
}, {
|
||||
value: '集中隔离'
|
||||
}, {
|
||||
value: '入院隔离'
|
||||
}],
|
||||
normal: '正常',
|
||||
isolation: '无需隔离',
|
||||
name: '',
|
||||
@@ -81,7 +97,7 @@ Page({
|
||||
})
|
||||
} 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,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// pages/visitor/showMyVisitor.js
|
||||
Page({
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
@@ -25,7 +27,7 @@ Page({
|
||||
})
|
||||
} else {
|
||||
wx.request({
|
||||
url: 'http://127.0.0.1:8080/visitor/showMyVisitor',
|
||||
url: `${baseUrl}/visitor/showMyVisitor`,
|
||||
data: {
|
||||
phone: this.data.phone,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// pages/visitor/visitor.js
|
||||
Page({
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
@@ -19,7 +21,7 @@ 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,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// pages/other/feedback.js
|
||||
Page({
|
||||
const app = getApp()
|
||||
const baseUrl = app.globalData.baseUrl
|
||||
// console.log("baseUrl", baseUrl)
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
@@ -18,7 +20,7 @@ Page({
|
||||
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,
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user