yuminge-app/yun-min-program-plugin-master/packageG/cps/cpsTransfer/cpsTransfer.js

108 lines
1.9 KiB
JavaScript

// packageG/cps/cpsTransfer/cpsTransfer.js
var cpsApi = require("../component/cpsApi");
Page({
behaviors: [cpsApi],
/**
* 页面的初始数据
*/
data: {
id: '',
phone: '',
need_mobile: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
id: options.plat_id,
need_mobile: options.need_mobile
});
if (this.data.need_mobile == 1) {
// 需要获取手机号
this.getPhone();
} else {
this.getCPSLogin('link');
}
},
getPhone() {
let _url = app.getNetAddresss("plugin.aggregation-cps.api.web.getMobile");
app._getNetWork({
url: _url,
success: (res) => {
let resData = res.data.mobile;
if (resData.result == 1) {
this.setData({
phone: resData.data,
});
if (this.data.phone) {
this.getCPSLogin('link');
} else {
wx.navigateTo({
url: "/packageA/member/editmobile/editmobile",
});
}
} else {
wx.showToast({
title: resData.msg,
icon: "none",
});
}
},
fail: (error) => {
console.log(error, "错误");
},
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
});