socialforge/app/views/wechats/login.html.erb

86 lines
2.3 KiB
Plaintext
Raw Normal View History

2016-05-27 22:14:41 +08:00
<% if @wechat_user %>
2016-01-19 15:06:40 +08:00
2016-05-27 22:14:41 +08:00
<div class="page">
<div class="weui_msg">
<div class="weui_icon_area"><i class="weui_icon_success weui_icon_msg"></i></div>
<div class="weui_text_area">
<h2 class="weui_msg_title">操作成功</h2>
<p class="weui_msg_desc">您已经绑定过微信了,用户名: (<%= @wechat_user.user.login %>)</p>
</div>
<div class="weui_opr_area">
<p class="weui_btn_area">
2016-05-27 22:54:57 +08:00
<a onclick="WeixinJSBridge.call('closeWindow');" class="weui_btn weui_btn_primary">确定</a>
2016-05-27 22:14:41 +08:00
</p>
</div>
</div>
</div>
<% else %>
2016-01-19 14:28:13 +08:00
<div class="loginIn">
<div>
2016-01-20 22:14:47 +08:00
<p class="weui_cells_title wechat-error">
2016-01-19 14:28:13 +08:00
<%= @wechat_bind_errors %>
</p>
</div>
2016-01-20 21:49:22 +08:00
2016-01-19 14:28:13 +08:00
<%= form_tag(bind_wechat_path,:id=>'main_login_form',:method=>'post') do %>
2016-01-20 21:49:22 +08:00
<div class="weui_cells weui_cells_form">
<div class="weui_cell">
<div class="weui_cell_hd"><label class="weui_label">用户名</label></div>
<div class="weui_cell_bd weui_cell_primary">
<input class="weui_input" autocapitalize="off" type="text" name="username" placeholder="请输入邮箱/登录名"/> </div>
2016-01-20 21:49:22 +08:00
</div>
2016-01-19 14:28:13 +08:00
2016-01-20 21:49:22 +08:00
<div class="weui_cell">
<div class="weui_cell_hd"><label class="weui_label">密码</label></div>
2016-01-20 21:49:22 +08:00
<div class="weui_cell_bd weui_cell_primary">
2016-05-26 12:59:15 +08:00
<input class="weui_input" type="password" name="password" placeholder="请输入密码"/>
2016-01-19 14:28:13 +08:00
</div>
2016-01-20 21:49:22 +08:00
</div>
2016-01-19 14:28:13 +08:00
2016-01-20 21:49:22 +08:00
<div class="weui_btn_area">
2016-03-01 15:21:20 +08:00
<a class="weui_btn weui_btn_primary" id="submitForm">确定</a>
2016-01-20 21:49:22 +08:00
</div>
2016-01-19 14:28:13 +08:00
</div>
<% end %>
2016-01-19 15:06:40 +08:00
</div>
2016-03-01 15:37:48 +08:00
<script type="text/javascript">
$(function(){
console.log("started.");
$("#submitForm").click(function(){
var data = {};
$("#main_login_form").serializeArray().map(function(x){data[x.name] = x.value;});
console.log(data);
$.ajax({
type: "POST",
2016-03-01 15:42:37 +08:00
url: $("#main_login_form").attr("action"),
2016-03-01 15:37:48 +08:00
data:data,
2016-03-01 16:56:37 +08:00
dataType: 'json',
success: function(data){
console.log(data);
if(data.status == 0){
byConfirm(data.msg, function(){
window.closeWindow();
});
} else {
byAlert(data.msg, "绑定失败");
}
}
2016-03-01 15:37:48 +08:00
});
})
});
2016-05-27 22:14:41 +08:00
</script>
<% end %>