Bez popisu

invitingFriends.html 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="yes" name="apple-mobile-web-app-capable">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
  7. <title>账本邀请</title>
  8. <link rel="stylesheet" type="text/css" href="public/public_css.css"/>
  9. <style type="text/css">
  10. body{
  11. background: #ffffff;
  12. }
  13. .userImg{
  14. width: 0.87rem;
  15. height: 0.87rem;
  16. border-radius: 50%;
  17. margin: auto;
  18. margin-top: 0.41rem;
  19. margin-bottom: 0.22rem;
  20. }
  21. .inviting{
  22. max-width: 2.4rem;
  23. text-align: center;
  24. font-size: 0.16rem;
  25. color: #878787;
  26. line-height: 0.22rem;
  27. margin: auto;
  28. margin-bottom: 0.37rem;
  29. }
  30. .inviting text{
  31. color:#646464;
  32. }
  33. .label{
  34. color: #444444;
  35. font-size: 0.16rem;
  36. display: inline-block;
  37. width: 0.55rem;
  38. }
  39. input{
  40. border: none;
  41. font-size: 0.16rem;
  42. outline: none;
  43. margin-left: 0.16rem;
  44. }
  45. .tel{
  46. width: 3.2rem;
  47. margin: auto;
  48. border-bottom: 0.01rem solid #D8D8D8;
  49. margin-top: 0.16rem;
  50. padding-bottom: 0.05rem;
  51. }
  52. .forget_password{
  53. display: inline-block;
  54. color: #666666;
  55. font-size: 0.14rem;
  56. line-height: 0.2rem;
  57. margin-left: 0.3rem;
  58. margin-top: 0.16rem;
  59. }
  60. .button{
  61. width: 2.18rem;
  62. height: 0.41rem;
  63. border-radius: 0.26rem;
  64. background: #FFE100;
  65. color: #FFFFFF;
  66. box-shadow:0px 0.02rem 0px rgba(251,179,179,0.5);
  67. font-size: 0.2rem;
  68. margin: auto;
  69. margin-top: 0.56rem;
  70. display: block;
  71. }
  72. .other{
  73. color: #999999;
  74. font-size: 0.14rem;
  75. line-height: 0.2rem;
  76. margin-top: 0.45rem;
  77. text-align: center;
  78. }
  79. .register_weixin{
  80. width: 0.6rem;
  81. height: 0.6rem;
  82. margin: auto;
  83. }
  84. .mobilePhone,.pass_word{
  85. display: none;
  86. font-size: 0.14rem;
  87. color: red;
  88. margin-left: 0.9rem;
  89. margin-top: 0.10rem;
  90. margin-bottom: -0.10rem;
  91. }
  92. </style>
  93. </head>
  94. <body>
  95. <img class="userImg" src="image/logo.png" />
  96. <p class="inviting">Hi,我是<text>小小小零首付</text>,邀请你加入《<span>旅行账本</span>》一起记账</p>
  97. <p class="mobilePhone">请输入手机号</p>
  98. <div class="tel"><div class="label">手机号</div><input id="mobile" type="tel" placeholder="请输入手机号" onchange="mobilePhoneEvent()"/></div>
  99. <p class="pass_word">请输入密码</p>
  100. <div class="tel"><div class="label">密码</div><input id="pwd" type="password" placeholder="请输入密码" onchange="passwordEvent()"/></div>
  101. <text class="forget_password" onclick="goForgetPassword()">忘记密码?</text>
  102. <button class="button" onclick="goAddSuccess()">立即加入</button>
  103. <div class="other">——其他方式——</div>
  104. <img onclick="addWeixin()" src="image/weixin.png" class="register_weixin"/>
  105. <div class="mask">
  106. <div class="content">
  107. <h3>提示</h3>
  108. <p>密码错误啊啊啊啊啊</p>
  109. <div onclick="iknow()">我知道了</div>
  110. </div>
  111. </div>
  112. </body>
  113. </html>
  114. <script type="text/javascript" src="public/qs.js"></script>
  115. <script type="text/javascript" src="public/jquery-2.1.0.js"></script>
  116. <script type="text/javascript">
  117. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  118. window.onresize = function(){
  119. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  120. }
  121. var flagButton = false;
  122. var book_id = '';
  123. // var openid = '';
  124. // var unionid = '';
  125. var wechat = '';
  126. var userName = '';
  127. var userImg = '';
  128. var appUrl = '';
  129. var cid = '';
  130. var accountBook = '';
  131. var str=location.href; //取得整个地址栏
  132. localStorage.setItem('addUrl',str)
  133. var num=str.indexOf("?");
  134. str=str.substr(num+1); //str得到?之后的字符串
  135. var brr=str.split("&");
  136. for(var i = 0 ; i<brr.length; i++){
  137. if(brr[i].indexOf('book_id') != -1){
  138. book_id = brr[i].split('=')[1];
  139. }
  140. if(brr[i].indexOf('cid') != -1){
  141. cid = brr[i].split('=')[1];
  142. }
  143. // if(brr[i].indexOf('openid') != -1){
  144. // openid = brr[i].split('=')[1];
  145. // }
  146. // if(brr[i].indexOf('unionid') != -1){
  147. // unionid = brr[i].split('=')[1];
  148. // }
  149. if(brr[i].indexOf('userName') != -1){
  150. userName = brr[i].split('=')[1];
  151. userName = decodeURI(userName);
  152. }
  153. if(brr[i].indexOf('user_url') != -1){
  154. userImg = brr[i].split('=')[1];
  155. userImg = decodeURIComponent(userImg)
  156. }
  157. if(brr[i].indexOf('appUrl') != -1){
  158. appUrl = brr[i].split('=')[1];
  159. appUrl = decodeURIComponent(appUrl)
  160. localStorage.setItem('appUrl',appUrl)
  161. }
  162. if(brr[i].indexOf('accountBook') != -1){
  163. accountBook = brr[i].split('=')[1];
  164. accountBook = decodeURI(accountBook)
  165. localStorage.setItem('accountBook',accountBook)
  166. }
  167. if(brr[i].indexOf('weChat') != -1){
  168. wechat = brr[i].split('=')[1];
  169. wechat = decodeURIComponent(wechat);
  170. }
  171. }
  172. window.onload = function () {
  173. var we_chat_Arr=wechat.split("&");
  174. var redirect_uri = '';
  175. for(var i = 0 ; i<we_chat_Arr.length; i++){
  176. if(we_chat_Arr[i].indexOf('redirect_uri') != -1){
  177. redirect_uri = we_chat_Arr[i].split('=')[1];
  178. redirect_uri = decodeURIComponent(redirect_uri)
  179. we_chat_Arr[i] = "redirect_uri=" + redirect_uri + "?book_id=" + book_id + "&cid=" + cid
  180. }
  181. }
  182. wechat = we_chat_Arr.join("&")
  183. $(".inviting text").html(userName);
  184. if(userImg == ''){
  185. $(".userImg").attr("src","image/logo.png");
  186. }else{
  187. $(".userImg").attr("src",userImg);
  188. }
  189. $(".inviting span").html(accountBook)
  190. }
  191. function goAddSuccess() {
  192. if($("#mobile").val() == ''){
  193. $(".mobilePhone").css("display","block");
  194. $(".mobilePhone").html('请输入手机号');
  195. return;
  196. }
  197. passwordEvent();
  198. mobilePhoneEvent();
  199. if(flagButton){
  200. var data = {
  201. "book_id":book_id,
  202. 'type':1,
  203. 'mobile':$("#mobile").val(),
  204. 'password':$("#pwd").val()
  205. }
  206. addMobile(data);
  207. }
  208. }
  209. function addWeixin(){
  210. window.location.href = wechat;
  211. }
  212. function goForgetPassword() {
  213. window.location.href="forgetPassword.html";
  214. }
  215. function iknow() {
  216. $(".mask").css("visibility","hidden");
  217. }
  218. function mobilePhoneEvent () {
  219. var teleNumber = $("#mobile").val();
  220. var myMobile=/^[0-9]{11}$/;
  221. if (!myMobile.test(teleNumber)) {
  222. //手机号码未填写及填写不正确
  223. $(".mobilePhone").css("display","block");
  224. $(".mobilePhone").html('手机号格式错误');
  225. flagButton = false;
  226. }else{
  227. $(".mobilePhone").css("display","none");
  228. flagButton = true;
  229. }
  230. }
  231. function passwordEvent () {
  232. if($("#pwd").val() == ''){
  233. $(".pass_word").css("display","block");
  234. return;
  235. }else{
  236. $(".pass_word").css("display","none");
  237. }
  238. }
  239. function addMobile(data){
  240. $.ajax({
  241. type:"post",
  242. url:"/api/V1/shareBook",
  243. data: data,
  244. success: function (res) {
  245. console.log(JSON.parse(res))
  246. if(JSON.parse(res).code == 0){
  247. if(Boolean(JSON.parse(res).res)){
  248. window.location.href="addSuccess.html";
  249. localStorage.setItem('avatar',JSON.parse(res).res.avatar)
  250. localStorage.setItem('book_name',JSON.parse(res).res.book_name)
  251. localStorage.setItem('user_name',JSON.parse(res).res.user_name)
  252. }else{
  253. $(".mask").css("visibility","visible");
  254. $(".content p").html(JSON.parse(res).message[0]);
  255. }
  256. }else{
  257. var msg = JSON.parse(res).message[0]
  258. $(".mask").css("visibility","visible");
  259. if(msg.indexOf("password") != -1){
  260. msg = msg.replace('password', '密码');
  261. }
  262. $(".content p").html(msg);
  263. }
  264. }
  265. });
  266. }
  267. </script>