156 lines
3.4 KiB
JavaScript
156 lines
3.4 KiB
JavaScript
// welcome/login/login.js
|
||
import { DBPost } from '../../db/DBpost.js';
|
||
Page({
|
||
|
||
/**
|
||
* 页面的初始数据
|
||
*/
|
||
data: {
|
||
xuehao:0,
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面加载
|
||
*/
|
||
onLoad: function (options) {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面初次渲染完成
|
||
*/
|
||
onReady: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面显示
|
||
*/
|
||
onShow: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面隐藏
|
||
*/
|
||
onHide: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面卸载
|
||
*/
|
||
onUnload: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面相关事件处理函数--监听用户下拉动作
|
||
*/
|
||
onPullDownRefresh: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面上拉触底事件的处理函数
|
||
*/
|
||
onReachBottom: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 用户点击右上角分享
|
||
*/
|
||
onShareAppMessage: function () {
|
||
|
||
},
|
||
zhuce:function(){
|
||
wx.navigateTo({
|
||
url: '../signin/signin'
|
||
})
|
||
},
|
||
denglu: function () {
|
||
wx.showLoading({
|
||
title: '登录中',
|
||
})
|
||
var that = this;
|
||
var dbPost = new DBPost();
|
||
wx.login({
|
||
success: function (res) {
|
||
if (res.code) {
|
||
wx.request({
|
||
url: 'http://maoye.club/yingbo/rcs/API/login.php',
|
||
data: {
|
||
code: res.code
|
||
},
|
||
success: function (result) {
|
||
console.log(result);
|
||
if (result.data != null) {
|
||
dbPost.newxuehao(result.data.xueHao);
|
||
dbPost.newxingming(result.data.xingMing);
|
||
dbPost.newzhuanye(result.data.zhuanYe);
|
||
dbPost.newxueyuan(result.data.xueYuan);
|
||
dbPost.newadmin(result.data.admin);
|
||
that.data.xuehao = result.data.xueHao;
|
||
console.log(that.data.xuehao);
|
||
}
|
||
if (!that.data.xuehao) {
|
||
wx.hideLoading()
|
||
wx.showModal({
|
||
title: '警告',
|
||
content: '您还未曾注册过~',
|
||
confirmText: '注册账号',
|
||
cancelText: '联系客服',
|
||
confirmColor: '#10aeff',
|
||
success: function (res) {
|
||
if (res.confirm) {
|
||
wx.navigateTo({
|
||
url: '../signin/signin'
|
||
})
|
||
console.log('用户点击注册')
|
||
} else if (res.cancel) {
|
||
wx.showModal({
|
||
title: '联系客服',
|
||
content: 'QQ:1144131090',
|
||
confirmColor: '#10aeff',
|
||
success: function (res) {
|
||
if (res.confirm) {
|
||
console.log('用户点击确定')
|
||
} else if (res.cancel) {
|
||
console.log('用户点击取消')
|
||
}
|
||
}
|
||
})
|
||
console.log('用户点击联系客服')
|
||
}
|
||
}
|
||
})
|
||
|
||
}
|
||
else {
|
||
wx.hideLoading()
|
||
wx.switchTab({
|
||
url: '../../pages/post/post'
|
||
})
|
||
}
|
||
}
|
||
})
|
||
} else {
|
||
console.log('获取失败' + res.errMsg)
|
||
}
|
||
}
|
||
});
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
}) |