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