Files
HnyhuaXCX/pages/myto/index.js

120 lines
3.1 KiB
JavaScript
Raw Normal View History

var app = getApp()
var that=null
var sopenFrame=null
Page( {
data: {
userListInfo: [{
icon: '../../images/iconfont-mydata.png',
url:'../mydata/index',
text: '会员资料'
},{
icon: '../../images/iconfont-mydata.png',
url:'../mybankdata/index',
text: '绑定收款账号'
}, {
icon: '../../images/iconfont-mypassword.png',
url:'../mypassword/index',
text: '修改登录密码'
}, {
icon: '../../images/iconfont-mypassword.png',
url:'../mypassword2/index',
text: '修改安全密码'
}, {
icon: '../../images/iconfont-shouhuodizhi.png',
url:'../myaddress/index',
text: '收货地址'
}],
logout:"安全退出"
},
onLoad: function() {
that = this
that.rdata()
},rdata: function() {
var userInfodata = wx.getStorageSync("userInfo")
var userInfo = JSON.parse(userInfodata)
},gotourl: function(e) {
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
if(userId&&LoginId){
var index = e.currentTarget.dataset.id
if(index==2||index==5){
wx.removeStorageSync("qygm")
wx.navigateTo({
url: that.data.userListInfo[index].url
})
}else{
wx.navigateTo({
url: that.data.userListInfo[index].url
})
}
}else{
wx.navigateTo({
url: "../login/index"
})
}
},gouserinfo: function(e) {
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
if(userId&&LoginId){
wx.navigateTo({
url: "../mydata/index"
})
}else{
wx.navigateTo({
url: "../login/index"
})
}
},
logout:function(e) {
wx.showModal({
title: '安全提示',
content: '您确认要退出系统吗?',
success (res0) {
if (res0.confirm) {
that.setData({
logout:"请稍候..."
})
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"logout",
userId:(!userId?"":userId),
LoginId:(!LoginId?"":LoginId)
},
method:"POST",
dataType:"json",
header: {
"content-type": "application/x-www-form-urlencoded" // 默认值
},
success (res) {
wx.removeStorageSync('userId')
wx.removeStorageSync('LoginId')
wx.removeStorageSync('userInfo')
app.globalData.IFLogin=0
app.globalData.IFRefreshmy=1
app.globalData.IFRefreshindex=1
sopenFrame=setInterval(function (){
clearInterval(sopenFrame);
that.setData({
logout:"安全退出"
})
wx.navigateBack({})
}, 1000)
}
})
}
}
})
}
})