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