<!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>