博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
dcloud会员激活mui
阅读量:5888 次
发布时间:2019-06-19

本文共 4359 字,大约阅读时间需要 14 分钟。

  hot3.png

<!doctype html>

<html>

 

<head>

<meta charset="UTF-8">

<title></title>

<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />

<link href="../../css/mui.min.css" rel="stylesheet" />

<style>

#head {line-height: 40px;}

#head-img1 { position: absolute; bottom: 10px; right: 16px; width: 40px; height: 40px;}

.mui-table-view span.mui-pull-right {color:#969696;}

</style>

</head>

 

<body>

 

<header class="mui-bar mui-bar-nav">

    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>

    <h1 class="mui-title mui-text-left">会员</h1>

</header>

 

<div class="mui-content">

    <div class="mui-scroll-wrapper">

        <div class="mui-scroll" style="padding-top:55px;">

            <!--这里放置真实显示的DOM内容-->

            <ul class="mui-table-view">

<li class="mui-table-view-cell">

<a id="head" class="">头像

<span class="mui-pull-right">

<img class="head-img mui-action-preview" id="head-img1" src="../../images/shuijiao.jpg"/>

</span>

</a>

</li>

<li class="mui-table-view-cell">

<a>姓名<span class="mui-pull-right" id="userName">检爱一生</span></a>

</li>

<li class="mui-table-view-cell">

<a>身份证号<span class="mui-pull-right" id="idCard">888888888888888888</span></a>

</li>

<li class="mui-table-view-cell">

<a>会员状态<span class="mui-pull-right" id="vipStatus">已激活</span></a>

</li>

<li class="mui-table-view-cell">

<a>有效期至<span class="mui-pull-right" id="term">2088.08.08</span></a>

</li>

<li class="mui-table-view-cell">

<div class="mui-input-row">

        <label>激活码</label>

        <input type="number" class="mui-input-clear mui-text-right" id="activateCode" placeholder="请输入激活码">

    </div>

</li>

</ul>

        </div>

    <button id="activate" class="mui-btn mui-btn-block" style="position:absolute;left:0;bottom:0;">激活</button>

    </div>

</div>

</body>

<script src="../../js/mui.min.js"></script>

<script type="text/javascript">

mui.plusReady(function(){

var userName = document.getElementById("userName");

var idCard = document.getElementById("idCard");

var vipStatus = document.getElementById("vipStatus");

var term = document.getElementById("term");

var activate = document.getElementById("activate");

var activateCode = document.getElementById("activateCode");

mui.ajax('http://',{

data:{

access_token:'WyJOdz09IiwiTVRRNE16WTRNakEwT1E9PSIsIk1USTVOakF3TUE9PSJd'

},

dataType:'json',//服务器返回json格式数据

type:'post',//HTTP请求类型

timeout:10000,//超时时间设置为10秒;

//headers:{'Content-Type':'application/json'},

success:function(data){

//console.log(JSON.stringify(data))

if(data.code == 1){

userName.innerHTML = data.data.real_name;

idCard.innerHTML = data.data.id_card;

if(data.data.vip_status == 0){

vipStatus.innerHTML = '未激活';

activate.style.display = 'block';

term.parentNode.parentNode.style.display = 'none';

activateCode.parentNode.parentNode.style.display = 'block';

}else if(data.data.vip_status == 1){

vipStatus.innerHTML = '已激活';

activate.style.display = 'none';

term.parentNode.parentNode.style.display = 'block';

activateCode.parentNode.parentNode.style.display ='none';

var timestamp = data.data.user_time_length;

var d = new Date(timestamp * 1000);

term.innerHTML = (d.getFullYear())+"."+(d.getMonth() + 1)+"."+(d.getDate());

}

}else{

mui.toast(data.msg);

}

},

error:function(xhr,type,errorThrown){

mui.toast('系统异常');

}

});

});

 

mui("body").on('tap','#activate',function(){

var vipStatus = document.getElementById("vipStatus");

var term = document.getElementById("term");

var activate = document.getElementById("activate");

var activateCode = document.getElementById("activateCode");

var val = activateCode.value;

mui.ajax('http://',{

data:{

access_token:'WyJOdz09IiwiTVRRNE5ESXhPRGMyTVE9PSIsIk1USTVOakF3TUE9PSJd',

activation_code:val

},

dataType:'json',//服务器返回json格式数据

type:'post',//HTTP请求类型

timeout:10000,//超时时间设置为10秒;

//headers:{'Content-Type':'application/json'},

success:function(data){

//console.log(JSON.stringify(data))

if(data.code == 1){

vipStatus.innerHTML = '已激活';

activateCode.parentNode.parentNode.style.display = 'none';

activate.style.display = 'none';

term.parentNode.parentNode.style.display = 'block';

var timestamp = data.data.user_time_length;

var d = new Date(timestamp * 1000);

term.innerHTML = (d.getFullYear())+"."+(d.getMonth() + 1)+"."+(d.getDate());

mui.toast('激活成功');

}else if(data.code == -1){

mui.toast(data.msg);

}

},

error:function(xhr,type,errorThrown){

mui.toast('系统异常');

}

});

});

</script>

</html>

转载于:https://my.oschina.net/af666/blog/825147

你可能感兴趣的文章
C语言写单链表的创建、释放、追加(即总是在最后的位置增加节点)
查看>>
poj1635
查看>>
C# LINQ详解(一)
查看>>
视频直播点播nginx-rtmp开发手册中文版
查看>>
ruby学习总结04
查看>>
Binary Tree Paths
查看>>
Ueditor自定义ftp上传
查看>>
线程以及多线程
查看>>
PHP队列的实现
查看>>
单点登录加验证码例子
查看>>
[T-SQL]从变量与数据类型说起
查看>>
稀疏自动编码之反向传播算法(BP)
查看>>
二叉搜索树转换成双向链表
查看>>
WebLogic和Tomcat的区别
查看>>
java类中 获取服务器的IP 端口
查看>>
occActiveX - ActiveX with OpenCASCADE
查看>>
redmine
查看>>
css 序
查看>>
DirectshowLib摄像头拍照的”未找到可用于建立连接的介质筛选器组合“ 解决办法...
查看>>
三种简单排序
查看>>