Bez popisu

invitingFriends.html 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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. var redirect = redirect_uri + "?book_id=" + book_id + "&cid=" + cid;
  180. redirect = encodeURIComponent(redirect);
  181. we_chat_Arr[i] = "redirect_uri=" + redirect;
  182. }
  183. }
  184. wechat = we_chat_Arr.join("&")
  185. $(".inviting text").html(userName);
  186. if(userImg == ''){
  187. $(".userImg").attr("src","image/logo.png");
  188. }else{
  189. $(".userImg").attr("src",userImg);
  190. }
  191. $(".inviting span").html(accountBook)
  192. }
  193. function goAddSuccess() {
  194. if($("#mobile").val() == ''){
  195. $(".mobilePhone").css("display","block");
  196. $(".mobilePhone").html('请输入手机号');
  197. return
  198. }
  199. if($("#pwd").val() == ''){
  200. $(".pass_word").css("display","block");
  201. return
  202. }else{
  203. $(".pass_word").css("display","none");
  204. }
  205. mobilePhoneEvent();
  206. if(flagButton){
  207. var data = {
  208. "book_id":book_id,
  209. 'type':1,
  210. 'mobile':$("#mobile").val(),
  211. 'password':$("#pwd").val()
  212. }
  213. addMobile(data);
  214. }
  215. }
  216. function addWeixin(){
  217. window.location.href = wechat;
  218. }
  219. function goForgetPassword() {
  220. window.location.href="forgetPassword.html";
  221. }
  222. function iknow() {
  223. $(".mask").css("visibility","hidden");
  224. }
  225. function mobilePhoneEvent () {
  226. var teleNumber = $("#mobile").val();
  227. var myMobile=/^[0-9]{11}$/;
  228. if (!myMobile.test(teleNumber)) {
  229. //手机号码未填写及填写不正确
  230. $(".mobilePhone").css("display","block");
  231. $(".mobilePhone").html('手机号格式错误');
  232. flagButton = false;
  233. }else{
  234. $(".mobilePhone").css("display","none");
  235. flagButton = true;
  236. }
  237. }
  238. function passwordEvent () {
  239. if($("#pwd").val() == ''){
  240. $(".pass_word").css("display","block");
  241. return false;
  242. }else{
  243. $(".pass_word").css("display","none");
  244. }
  245. }
  246. function addMobile(data){
  247. $.ajax({
  248. type:"post",
  249. url:"/api/V1/shareBook",
  250. data: data,
  251. success: function (res) {
  252. console.log(JSON.parse(res))
  253. if(JSON.parse(res).code == 0){
  254. if(Boolean(JSON.parse(res).res)){
  255. window.location.href="addSuccess.html";
  256. localStorage.setItem('avatar',JSON.parse(res).res.avatar)
  257. localStorage.setItem('book_name',JSON.parse(res).res.book_name)
  258. localStorage.setItem('user_name',JSON.parse(res).res.user_name)
  259. }else{
  260. $(".mask").css("visibility","visible");
  261. $(".content p").html(JSON.parse(res).message[0]);
  262. }
  263. }else{
  264. var msg = JSON.parse(res).message[0]
  265. $(".mask").css("visibility","visible");
  266. if(msg.indexOf("password") != -1){
  267. msg = msg.replace('password', '密码');
  268. }
  269. $(".content p").html(msg);
  270. }
  271. }
  272. });
  273. }
  274. </script>