This commit is contained in:
张慢慢
2021-05-24 13:56:00 +08:00
commit a7995d90bc
208 changed files with 13143 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
carmi: '' //卡密
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
},
/**
* 卡激活
*/
cardform(e) {
let code = e.detail.value.code,
pass = this.data.carmi
wx.$api.user.cards(code, pass).then(res=>{
if(res.data.type == "silver") {
app.globalData.userCurrent = 0
}else if(res.data.type == "gold") {
app.globalData.userCurrent = 1
}else if(res.data.type == "drill") {
app.globalData.userCurrent = 2
}else {
return
}
// 写入缓存
wx.setStorage({
key : 'current',
data : app.globalData.userCurrent
})
wx.showToast({
title: res.data.message,
icon : 'none'
})
setTimeout(()=>{
wx.switchTab({
url: '/pages/user/user'
})
},2000)
})
},
/**
* 获取卡密
*/
carmiTab(e){
var number = e.detail.value
var change = number.replace(/(\d{4})(?=\d)/g, "$1-");//replace(/\s/g,'');
this.setData({
carmi: change
})
}
})