説明なし

invitingFriends.html 7.6KB

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