109 lines
2.2 KiB
JavaScript
109 lines
2.2 KiB
JavaScript
// packageG/integral_shop/integral_shop.js
|
|
var app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
console.log(app.globalData.integralOtherMiniData, "integralOtherMiniData");
|
|
try {
|
|
if(app.globalData.integralOtherMiniData.app_id) {
|
|
wx.showLoading({
|
|
title: '正在加载',
|
|
});
|
|
this.checkLogin();
|
|
}else {
|
|
wx.reLaunch({
|
|
url: '/packageG/index/index',
|
|
});
|
|
}
|
|
} catch (e) {
|
|
console.log(e);
|
|
wx.reLaunch({
|
|
url: '/packageG/index/index',
|
|
});
|
|
}
|
|
|
|
},
|
|
goHome() {
|
|
const Url = app.getNetAddresss("plugin.credit-link.frontend.login.index");
|
|
app._postNetWork({
|
|
url: Url,
|
|
data: app.globalData.integralOtherMiniData,
|
|
success: ({ data: { data: response, result, msg } }) => {
|
|
if(result === 0) {
|
|
app.tips(msg);
|
|
}
|
|
wx.reLaunch({
|
|
url: '/packageG/index/index',
|
|
});
|
|
},
|
|
fail: ()=> {
|
|
wx.reLaunch({
|
|
url: '/packageG/index/index',
|
|
});
|
|
}
|
|
});
|
|
},
|
|
checkLogin() {
|
|
let urlStr = app.getNetAddresss("member.member.isValidatePage");
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (resdata)=> {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
let data = res.data;
|
|
try {
|
|
if (data.is_login === 1) {
|
|
// 登录
|
|
this.goHome();
|
|
} else {
|
|
app.seyzredirect();
|
|
wx.redirectTo({
|
|
url: "/pages/login/login",
|
|
});
|
|
}
|
|
} catch (e) {
|
|
wx.reLaunch({
|
|
url: '/packageG/index/index',
|
|
});
|
|
}
|
|
|
|
}else {
|
|
wx.reLaunch({
|
|
url: '/packageG/index/index',
|
|
});
|
|
}
|
|
},
|
|
fail: (res)=> {
|
|
wx.reLaunch({
|
|
url: '/packageG/index/index',
|
|
});
|
|
console.log(res);
|
|
},
|
|
});
|
|
},
|
|
});
|