zoukankan      html  css  js  c++  java
  • mui退出登录

    html部分:

    <button id='promptBtn' type="button" class="mui-btn mui-btn-block mui-btn-primary gz_btn_a " >退出登录</button>

    js部分:

    //退出登录
    document.getElementById("promptBtn").addEventListener('tap', function(e) {
    e.detail.gesture.preventDefault(); //修复iOS 8.x平台存在的bug,使用plus.nativeUI.prompt会造成输入法闪一下又没了
    mui.prompt('', '', '您确定退出登录吗?', ["取消", "退出登录"], function(e) {}, 'div');
    $('.mui-popup-input').html('');
    mui('.mui-popup-buttons').on('tap', '.mui-popup-button-bold', function() {
    mui.ajax(site_url + '/Home/Business/logout', {
    data: {
    token: plus.storage.getItem('token'),
    },
    dataType: 'json', //服务器返回json格式数据
    type: 'post', //HTTP请求类型
    timeout: 10000, //超时时间设置为10秒;
    headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
    },
    success: function(data) {
    mui.toast(data.msg)
    },
    error: function(xhr, type, errorThrown) {

    }
    });
    plus.storage.removeItem('token');
    mui.openWindow({
    url: '../login/login.html',
    id: 'login.html',
    extras: {
    from_page: 'logout'
    }
    });
    })
    });

    注意:

    html是不是写了两个id,地址信息是不是修改了,名字是不是对应,如果这个方法是个null那就console一下,找找

  • 相关阅读:
    Luogu P1396 营救
    Luogu P1339 热浪Heat Wave
    哈夫曼树学习笔记
    题解 CF1372C
    题解 CF 1372 B
    题解 CF 1372A
    题解 UVA1193 Radar Installation
    题解 洛谷 P2287 [USACO07NOV]Sunscreen G
    洛谷 P1080 国王游戏 题解
    牛客练习赛 66C公因子 题解
  • 原文地址:https://www.cnblogs.com/lsongyang/p/10855402.html
Copyright © 2011-2022 走看看