xcx/pages/address/address.js

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// pages/address/address.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    hostUrl: app.globalData.hostUrl,
    consignee:'',
    cellphone:'',
    address:'',
    id:0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  var that=this;
  if (options.id>0){
    that.getAddress(options.id);
  }
  },
  getAddress: function (id) {//读取地址
    var that = this;
    wx.request({
      url: app.globalData.apiUrl,
      data: {
        opt: 'getAddress',
        userId: wx.getStorageSync('userId'),
        id: id,
      },
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        if (res.data != null) {
          that.setData({
            consignee: res.data.consignee,
            cellphone: res.data.cellphone,
            address: res.data.address,
            id: res.data.id,
          })
        }
      }
    })
  },
  formSubmit: function (e) {//提交
    var that = this;
    if (e.detail.value.consignee.length == 0 || e.detail.value.cellphone.length == 0) {
      wx.showToast({
        title: '不得为空!',
        icon: 'loading',
        duration: 1500
      })
    } else {
      wx.request({
        url: app.globalData.apiUrl, //接口地址
        data: {
后面还有 83 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。