123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- // pages/ucenter/index/index.js
- var app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- userInfo: {},
- isLogin: false
- },
- tologin(e) {
- let url = '/pages/login/phone_login/phone_login';
- wx.navigateTo({
- url
- });
- },
- toUserCenter(e){
- if (this.phoneCheck()) {
- 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
- });
- },
- phoneCheck(){
- if (this.data.userInfo.bindingPhone==0 && !this.data.userInfo.flag) {
- wx.showModal({
- title: '提示',
- content: '当前账户未绑定手机号,请您进行手机号绑定操作',
- showCancel:false,
- confirmText: '去绑定',
- confirmColor:'#00AADD',
- success: function (res1) {
- let url = `/pages/bindPhone/bindPhone`;
- wx.navigateTo({
- url
- });
- }
- })
- return false;
- }else{
- return true;
- }
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- //wx.setNavigationBarTitle({
- // title: '个人中心'
- //})
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- let userInfo = wx.getStorageSync('userInfo');
- let isLogin = wx.getStorageSync('isLogin');
- // console.log(userInfo.flag);
- // 页面显示
- if (userInfo && isLogin) {
- //userInfo.flag = true;
- this.setData({
- userInfo: userInfo,
- isLogin: isLogin
- });
- } else {
- //未登录信息
- this.setData({
- userInfo: {},
- isLogin: false
- });
- }
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function() {
- },
- goCharginglog(e) {
- if (!this.data.isLogin) {
- let url = `/pages/login/phone_login/phone_login`;
- wx.navigateTo({
- url
- });
- return;
- }
- let url = '/pages/ucenter/charginglog/charginglog'
- wx.navigateTo({
- url
- });
- },
- goChargemoneylog(e) {
- if (!this.data.isLogin) {
- let url = `/pages/login/phone_login/phone_login`;
- wx.navigateTo({
- url
- });
- return;
- }
- let url = '/pages/ucenter/chargemoneylog/chargemoneylog'
- wx.navigateTo({
- url
- });
- },
- goyuyt(e){
- if (!this.data.isLogin) {
- let url = `/pages/login/phone_login/phone_login`;
- wx.navigateTo({
- url
- });
- return;
- }
- let url = '/pages/ucenter/yuyt/yuyt'
- wx.navigateTo({
- url
- });
- },
- goPurse(e) {
- if (!this.data.isLogin) {
- let url = `/pages/login/phone_login/phone_login`;
- wx.navigateTo({
- url
- });
- return;
- }
- let url = '/pages/ucenter/purse/purse'
- wx.navigateTo({
- url
- });
- },
- goCar(e) {
- if (!this.data.isLogin) {
- let url = `/pages/login/phone_login/phone_login`;
- wx.navigateTo({
- url
- });
- return;
- }
- let url = '/pages/ucenter/car/car'
- 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
- });
- },
- goAccountSecrity(e){
- if (!this.data.isLogin) {
- let url = `/pages/login/phone_login/phone_login`;
- wx.navigateTo({
- url
- });
- return;
- }
- if (this.phoneCheck()) {
- let url = '/pages/ucenter/accountsecurity/index/index'
- wx.navigateTo({
- url
- });
- }
- },
- goAgreement(){
- let url = '/pages/agreement/list'
- 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); //失败
- // }
- // });
- let url = '/pages/ucenter/help/help'
- wx.navigateTo({
- url
- });
- },
- goNotice(){
- if (!this.data.isLogin) {
- let url = `/pages/login/phone_login/phone_login`;
- wx.navigateTo({
- url
- });
- return;
- }
- let url = '/pages/ucenter/notice/notice'
- wx.navigateTo({
- url
- });
- },
- toindex(e) {
- let url = '/pages/index/index';
- // wx.reLaunch({
- // url
- // });
- wx.navigateBack();
- },
- goCarControl(){
- wx.navigateTo({
- url: '/pages/ucenter/control/carControl',
- })
- },
- goBatteryControl(){
- // wx.scanCode({
- // success (res) {
- // wx.navigateTo({
- // url: '/pages/ucenter/control/batteryControl?code=' + res.result,
- // })
- // }
- // })
- wx.navigateTo({
- url: '/pages/ucenter/control/batteryControl',
- })
- }
- /*,
- 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()
- }
- }*/
- })
|