yuminge-app/yun-min-program-plugin-master/packageE/newteamCode/newteamCode.js

147 lines
2.6 KiB
JavaScript

// pages/member/rankingListSecond/rankingListSecond.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
codes: [],
value: '',
show: false,
show1: false,
username: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.getData();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {},
// 获取数据
getData() {
let urlStr = app.getNetAddresss('plugin.team-fjyx.api.index.getCode');
app._getNetWork({
url: urlStr,
success: (res) => {
let resData = res.data;
if (resData.result === 1) {
this.setData({
codes: resData.data.code
});
} else {
wx.showToast({
title: resData.msg,
icon: 'none'
});
}
},
fail: function(res) {
console.log(res);
}
});
},
// 返回
goBack() {
wx.navigateBack({
delta: 1
});
},
// 跳转到使用记录
codeHistory() {
wx.navigateTo({
url: '/packageE/newcodeHistory/newcodeHistory'
});
},
// 验证对话
openDialog() {
this.setData({
show1: true
});
},
onChange(val) {
this.setData({
username: val.detail.value
});
},
// 取消
onClose() {
this.setData({
show1: false
});
},
// 验证激活码
getUserInfo() {
if (this.data.username == '') {
wx.showToast({
title: '请输入激活码',
icon: 'none'
});
return;
}
let urlStr = app.getNetAddresss('plugin.team-fjyx.api.index.useCode');
urlStr += '&code=' + this.data.username;
app._getNetWork({
url: urlStr,
success: (res) => {
if (res.data.result === 1) {
this.getData();
this.setData({
show1: false
});
} else {
wx.showToast({
title: res.data.msg,
icon: 'none'
});
this.setData({
show1: false
});
}
},
fail: function(res) {
console.log(res);
}
});
}
});