123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- // pages/ucenter/index/index.js
- var app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- userInfo: {},
- isLogin: false
- },
- tologin(e) {
- let url = '/pages/login/login';
- wx.navigateTo({
- url
- });
- },
- toUserCenter(e){
- let url = '/pages/ucenter/center/center';
- wx.navigateTo({
- url
- });
- },
- logout(e){
- if (this.data.isLogin) {
- wx.clearStorageSync();
- wx.reLaunch({
- url: '/pages/index/index',
- });
- }
- },
- phoneCall(e){
- wx.makePhoneCall({
- phoneNumber: getApp().globalData.helpPhoneNum
- });
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- //wx.setNavigationBarTitle({
- // title: '个人中心'
- //})
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- let userInfo = wx.getStorageSync('userInfo');
- let isLogin = wx.getStorageSync('isLogin');
- // 页面显示
- if (userInfo && isLogin) {
- //userInfo.flag = true;
- this.setData({
- userInfo: userInfo,
- isLogin: isLogin
- });
- } else {
- //未登录信息
- this.setData({
- userInfo: {}
- });
- }
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function() {
- },
- goCharginglog(e) {
- if (!this.data.isLogin) {
- let url = `/pages/login/login`;
- wx.navigateTo({
- url
- });
- return;
- }
- let url = '/pages/ucenter/charginglog/charginglog'
- wx.navigateTo({
- url
- });
- },
- goChargemoneylog(e) {
- if (!this.data.isLogin) {
- let url = `/pages/login/login`;
- wx.navigateTo({
- url
- });
- return;
- }
- let url = '/pages/ucenter/chargemoneylog/chargemoneylog'
- wx.navigateTo({
- url
- });
- },
- goPurse(e) {
- if (!this.data.isLogin) {
- let url = `/pages/login/login`;
- wx.navigateTo({
- url
- });
- return;
- }
- let url = '/pages/ucenter/purse/purse'
- wx.navigateTo({
- url
- });
- },
- goMyChargeSation(e) {
- let url = '/pages/ucenter/mychargestation/mychargestation'
- wx.navigateTo({
- url
- });
- },
- goChargpileMonitor(e) {
- let url = '/pages/ucenter/chargpilemonitor/chargpilemonitor'
- wx.navigateTo({
- url
- });
- },
- goMyWorksheet(e) {
- let url = '/pages/ucenter/myworksheet/myworksheet'
- wx.navigateTo({
- url
- });
- },
- goHelp(){
- // wx.downloadFile({
- // //url: getApp().globalData.postHeadAgreement + '/restapi/wechat/updateUser',//要预览的PDF的地址
- // url: 'http://localhost:8080/aiconfig/index/downloadTest',//要预览的PDF的地址
- // success: function (res) {
- // console.log(res);
- // if (res.statusCode === 200) { //成功
- // var Path = res.tempFilePath //返回的文件临时地址,用于后面打开本地预览所用
- // wx.openDocument({
- // filePath: Path, //要打开的文件路径
- // success: function (res) {
- // console.log('打开PDF成功');
- // }
- // });
- // }
- // },
- // fail: function (res) {
- // console.log(res); //失败
- // }
- // });
- },
- goNotice(){
- if (!this.data.isLogin) {
- let url = `/pages/login/login`;
- wx.navigateTo({
- url
- });
- return;
- }
- let url = '/pages/ucenter/notice/notice'
- wx.navigateTo({
- url
- });
- },
- /*,
- goLogin: function() {
- wx.navigateTo({
- url: '/pages/auth/tologin/tologin?from=ucenter',
- })
- },
- callService: function () {
- wx.makePhoneCall({
- phoneNumber: '17621230884'
- })
- },
- afterSale: function () {
- wx.showModal({
- title: '提示',
- content: '请在官网或APP中申请售后',
- showCancel: false,
- confirmColor: '#b4282d',
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- },
- toLogin: function () {
- wx.navigateTo({
- url: '/pages/auth/tologin/tologin',
- })
- },
- toOrder: function () {
- if (this.data.isLogin) {
- wx.navigateTo({
- url: '/pages/ucenter/order/order',
- })
- } else {
- this.toLogin()
- }
- },
- toCoupon: function () {
- if (this.data.isLogin) {
- wx.navigateTo({
- url: '/pages/ucenter/coupon/coupon',
- })
- } else {
- this.toLogin()
- }
- },
- toAddress: function () {
- if (this.data.isLogin) {
- wx.navigateTo({
- url: '/pages/ucenter/address/address',
- })
- } else {
- this.toLogin()
- }
- }*/
- })
|