api接口baseUrl通过全局变量引入;代码格式化
This commit is contained in:
@@ -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 () {
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user