select-country.js 801 Bytes
// login/select-country/select-country.js
import { getCountryArea, getGlobalData } from '../../libs/login/login.js';
import Yas from '../../utils/yas';

let yas;

Page({

  /**
   * 页面的初始数据
   */
  data: {
    country: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    yas = new Yas(this);
    yas.pageOpenReport();
    this.getCountryArea();
  },

  onShow: function () {
  },
  async getCountryArea() {
    try {
      let country = await getCountryArea();
      this.setData({
        country
      })
    } catch (error) {

    }
  },

  selectCountry(e) {
    let country = e.currentTarget.dataset.country;
    let globalData = getGlobalData();
    globalData.country = country;
    wx.navigateBack({
      delta: 1
    });
  },
})