123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta content="yes" name="apple-mobile-web-app-capable">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
- <title>账本邀请</title>
- <link rel="stylesheet" type="text/css" href="public/public_css.css"/>
- <style type="text/css">
- body{
- background: #ffffff;
- }
- .userImg{
- width: 0.87rem;
- height: 0.87rem;
- border-radius: 50%;
- margin: auto;
- margin-top: 0.41rem;
- margin-bottom: 0.22rem;
- }
- .inviting{
- max-width: 2.4rem;
- text-align: center;
- font-size: 0.16rem;
- color: #878787;
- line-height: 0.22rem;
- margin: auto;
- margin-bottom: 0.37rem;
- }
- .inviting text{
- color:#646464;
- }
- label{
- color: #444444;
- font-size: 0.16rem;
- display: inline-block;
- width: 0.48rem;
- }
- input{
- border: none;
- font-size: 0.16rem;
- outline: none;
- margin-left: 0.16rem;
- }
- .tel{
- width: 3.2rem;
- margin: auto;
- border-bottom: 0.01rem solid #D8D8D8;
- margin-top: 0.16rem;
- padding-bottom: 0.05rem;
- }
- .forget_password{
- color: #666666;
- font-size: 0.14rem;
- line-height: 0.2rem;
- margin-left: 0.3rem;
- margin-top: 0.16rem;
- }
- .button{
- width: 2.18rem;
- height: 0.41rem;
- border-radius: 0.26rem;
- background: #F2F2F2;
- font-size: 0.2rem;
- color: #666666;
- margin: auto;
- margin-top: 0.56rem;
- display: block;
- }
- .other{
- color: #999999;
- font-size: 0.14rem;
- line-height: 0.2rem;
- margin-top: 0.45rem;
- text-align: center;
- }
- .register_weixin{
- width: 0.6rem;
- height: 0.6rem;
- margin: auto;
- }
- </style>
- </head>
- <body>
- <img class="userImg" src="https://small-app.oss-cn-beijing.aliyuncs.com/youhuiquan/shenqian.png" />
- <p class="inviting">Hi,我是<text>小小小零首付</text>,邀请你加入《旅行账本》一起记账</p>
- <div class="tel"><label>手机号</label><input id="mobile" type="tel" placeholder="请输入手机号" /></div>
- <div class="tel"><label>密码</label><input id="pwd" type="password" placeholder="请输入密码" /></div>
- <div class="forget_password" onclick="goForgetPassword()">忘记密码?</div>
- <button class="button" onclick="goAddSuccess()">立即加入</button>
- <div class="other">——其他方式——</div>
- <img onclick="addWeixin()" src="image/weixin.png" class="register_weixin"/>
-
- <div class="mask">
- <div class="content">
- <h3>提示</h3>
- <p>密码错误啊啊啊啊啊</p>
- <div onclick="iknow()">我知道了</div>
- </div>
- </div>
-
- </body>
- </html>
- <script type="text/javascript" src="public/jquery-2.1.0.js"></script>
- <script type="text/javascript">
- document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
- window.onresize = function(){
- document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
- }
- var book_id = '';
- var openid = '';
- var unionid = '';
- var userName = '';
- var userImg = '';
- var str=location.href; //取得整个地址栏
- var num=str.indexOf("?");
- str=str.substr(num+1); //str得到?之后的字符串
- var brr=str.split("&");
- for(var i = 0 ; i<brr.length; i++){
- if(brr[i].indexOf('book_id') != -1){
- book_id = brr[i].split('=')[1];
- }
- if(brr[i].indexOf('openid') != -1){
- openid = brr[i].split('=')[1];
- }
- if(brr[i].indexOf('unionid') != -1){
- unionid = brr[i].split('=')[1];
- }
- if(brr[i].indexOf('userName') != -1){
- userName = brr[i].split('=')[1];
- userName = decodeURI(userName);
- }
- if(brr[i].indexOf('userImg') != -1){
- userImg = brr[i].split('=')[1];
- }
- }
- window.onload = function () {
- $(".inviting text").html(userName);
- $(".userImg").attr("src",userImg);
- }
- function goAddSuccess() {
- // loginData();
- var data = {
- "book_id":book_id,
- 'type':1,
- 'mobile':$("#mobile").val(),
- 'password':$("#pwd").val()
- }
- addMobile(data);
- }
- function addWeixin(){
- var data = {
- "book_id":book_id,
- 'type':1,
- 'openid':openid,
- 'unionid':unionid
- }
- addMobile(data);
- }
- function goForgetPassword() {
- window.location.href="forgetPassword.html";
- }
- function iknow() {
- $(".mask").css("visibility","hidden");
- }
- function loginData(){
- var mobile = $("#mobile").val();
- var pwd = $("#pwd").val();
- var token = '';
- $.ajax({
- type:"post",
- url:"/api/V1/h5Login",
- data:{
- 'mobile':mobile,
- 'password':pwd
- },
- success: function (res) {
- if(JSON.parse(res).code == 0){
- //登录成功
- token = JSON.parse(res).res.token;
- addBook(token);
- }else{
- var msg = JSON.parse(res).message[0]
- $(".mask").css("visibility","visible");
- if(msg.indexOf("password") != -1){
- msg = msg.replace('password', '密码');
- }
- $(".content p").html(msg);
-
- }
- }
- });
- }
-
-
- function addBook (token) {
- $.ajax({
- type:"post",
- url:"/api/V1/shareBook",
- data:{
- "book_id":book_id
- },
- headers:{
- 'token':token
- },
- success: function (res) {
- console.log(JSON.parse(res))
- if(JSON.parse(res).code == 0){
- window.location.href="addSuccess.html";
- }else{
- $(".mask").css("visibility","visible");
- $(".content p").html('加入失败');
- }
- }
- });
- }
-
- function addMobile(data){
- $.ajax({
- type:"post",
- url:"/api/V1/shareBook",
- data: data,
- success: function (res) {
- console.log(JSON.parse(res))
- if(JSON.parse(res).code == 0){
- window.location.href="addSuccess.html";
- }else{
- var msg = JSON.parse(res).message[0]
- $(".mask").css("visibility","visible");
- if(msg.indexOf("password") != -1){
- msg = msg.replace('password', '密码');
- }
- $(".content p").html(msg);
- }
- }
- });
- }
- function addWeixin(data){
- $.ajax({
- type:"post",
- url:"/api/V1/shareBook",
- data: data,
- success: function (res) {
- if(JSON.parse(res).code == 0){
- window.location.href="addSuccess.html";
- }else{
- var msg = JSON.parse(res).message[0]
- $(".mask").css("visibility","visible");
- // if(msg.indexOf("password") != -1){
- // msg = msg.replace('password', '密码');
- // }
- $(".content p").html(msg);
- }
- }
- });
- }
- </script>
|