Нет описания

invitingFriends.html 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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. .forget{
  61. display: flex;
  62. justify-content: space-between;
  63. width: 3.2rem;
  64. margin: auto;
  65. }
  66. .forget span{
  67. display: inline-block;
  68. color: #666666;
  69. font-size: 0.14rem;
  70. line-height: 0.2rem;
  71. margin-left: 0.3rem;
  72. margin-top: 0.16rem;
  73. }
  74. .forget span b{
  75. font-weight: normal;
  76. color: #FFE100;
  77. }
  78. .button{
  79. width: 2.18rem;
  80. height: 0.41rem;
  81. border-radius: 0.26rem;
  82. background: #FFE100;
  83. color: #FFFFFF;
  84. box-shadow:0px 0.02rem 0px rgba(251,179,179,0.5);
  85. font-size: 0.2rem;
  86. margin: auto;
  87. margin-top: 0.56rem;
  88. display: block;
  89. }
  90. .other{
  91. color: #999999;
  92. font-size: 0.14rem;
  93. line-height: 0.2rem;
  94. margin-top: 0.45rem;
  95. text-align: center;
  96. }
  97. .register_weixin{
  98. width: 0.6rem;
  99. height: 0.6rem;
  100. margin: auto;
  101. }
  102. .mobilePhone,.pass_word{
  103. display: none;
  104. font-size: 0.14rem;
  105. color: red;
  106. margin-left: 0.9rem;
  107. margin-top: 0.10rem;
  108. margin-bottom: -0.10rem;
  109. }
  110. </style>
  111. </head>
  112. <body>
  113. <img class="userImg" src="image/logo.png" />
  114. <p class="inviting">Hi,我是<text>小小小零首付</text>,邀请你加入《<span>旅行账本</span>》一起记账</p>
  115. <p class="mobilePhone">请输入手机号</p>
  116. <div class="tel"><div class="label">手机号</div><input id="mobile" type="tel" placeholder="请输入手机号" onchange="mobilePhoneEvent()"/></div>
  117. <p class="pass_word">请输入密码</p>
  118. <div class="tel"><div class="label">密码</div><input id="pwd" type="password" placeholder="请输入密码" onchange="passwordEvent()"/></div>
  119. <div class="forget"><text class="forget_password" onclick="goForgetPassword()">忘记密码?</text><span>没有账号?<b onclick="addWeixin()">立即注册</b></span></div>
  120. <button class="button" onclick="goAddSuccess()">立即加入</button>
  121. <div class="other">——其他方式——</div>
  122. <img onclick="addWeixin()" src="image/weixin.png" class="register_weixin"/>
  123. <div class="mask">
  124. <div class="content">
  125. <h3>提示</h3>
  126. <p>密码错误啊啊啊啊啊</p>
  127. <div onclick="iknow()">我知道了</div>
  128. </div>
  129. </div>
  130. </body>
  131. </html>
  132. <script type="text/javascript" src="public/qs.js"></script>
  133. <script type="text/javascript" src="public/jquery-2.1.0.js"></script>
  134. <script type="text/javascript">
  135. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  136. window.onresize = function(){
  137. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  138. }
  139. var flagButton = false;
  140. var book_id = '';
  141. // var openid = '';
  142. // var unionid = '';
  143. var wechat = '';
  144. var userName = '';
  145. var userImg = '';
  146. var appUrl = '';
  147. var cid = '';
  148. var accountBook = '';
  149. var str=location.href; //取得整个地址栏
  150. localStorage.setItem('addUrl',str)
  151. var num=str.indexOf("?");
  152. str=str.substr(num+1); //str得到?之后的字符串
  153. var brr=str.split("&");
  154. for(var i = 0 ; i<brr.length; i++){
  155. if(brr[i].indexOf('book_id') != -1){
  156. book_id = brr[i].split('=')[1];
  157. }
  158. if(brr[i].indexOf('cid') != -1){
  159. cid = brr[i].split('=')[1];
  160. }
  161. // if(brr[i].indexOf('openid') != -1){
  162. // openid = brr[i].split('=')[1];
  163. // }
  164. // if(brr[i].indexOf('unionid') != -1){
  165. // unionid = brr[i].split('=')[1];
  166. // }
  167. if(brr[i].indexOf('userName') != -1){
  168. userName = brr[i].split('=')[1];
  169. userName = decodeURI(userName);
  170. }
  171. if(brr[i].indexOf('user_url') != -1){
  172. userImg = brr[i].split('=')[1];
  173. userImg = decodeURIComponent(userImg)
  174. }
  175. if(brr[i].indexOf('appUrl') != -1){
  176. appUrl = brr[i].split('=')[1];
  177. appUrl = decodeURIComponent(appUrl)
  178. localStorage.setItem('appUrl',appUrl)
  179. }
  180. if(brr[i].indexOf('accountBook') != -1){
  181. accountBook = brr[i].split('=')[1];
  182. accountBook = decodeURI(accountBook)
  183. localStorage.setItem('accountBook',accountBook)
  184. }
  185. if(brr[i].indexOf('weChat') != -1){
  186. wechat = brr[i].split('=')[1];
  187. wechat = decodeURIComponent(wechat);
  188. }
  189. }
  190. window.onload = function () {
  191. var we_chat_Arr=wechat.split("&");
  192. var redirect_uri = '';
  193. for(var i = 0 ; i<we_chat_Arr.length; i++){
  194. if(we_chat_Arr[i].indexOf('redirect_uri') != -1){
  195. redirect_uri = we_chat_Arr[i].split('=')[1];
  196. redirect_uri = decodeURIComponent(redirect_uri)
  197. var redirect = redirect_uri + "?book_id=" + book_id + "&cid=" + cid;
  198. redirect = encodeURIComponent(redirect);
  199. we_chat_Arr[i] = "redirect_uri=" + redirect;
  200. }
  201. }
  202. wechat = we_chat_Arr.join("&")
  203. $(".inviting text").html(userName);
  204. if(userImg == ''){
  205. $(".userImg").attr("src","image/logo.png");
  206. }else{
  207. $(".userImg").attr("src",userImg);
  208. }
  209. $(".inviting span").html(accountBook)
  210. }
  211. function goAddSuccess() {
  212. if($("#mobile").val() == ''){
  213. $(".mobilePhone").css("display","block");
  214. $(".mobilePhone").html('请输入手机号');
  215. return
  216. }
  217. if($("#pwd").val() == ''){
  218. $(".pass_word").css("display","block");
  219. return
  220. }else{
  221. $(".pass_word").css("display","none");
  222. }
  223. mobilePhoneEvent();
  224. if(flagButton){
  225. var data = {
  226. "book_id":book_id,
  227. 'type':1,
  228. 'mobile':$("#mobile").val(),
  229. 'password':$("#pwd").val()
  230. }
  231. addMobile(data);
  232. }
  233. }
  234. function addWeixin(){
  235. window.location.href = wechat;
  236. }
  237. function goForgetPassword() {
  238. window.location.href="forgetPassword.html";
  239. }
  240. function iknow() {
  241. $(".mask").css("visibility","hidden");
  242. }
  243. function mobilePhoneEvent () {
  244. var teleNumber = $("#mobile").val();
  245. var myMobile=/^[0-9]{11}$/;
  246. if (!myMobile.test(teleNumber)) {
  247. //手机号码未填写及填写不正确
  248. $(".mobilePhone").css("display","block");
  249. $(".mobilePhone").html('手机号格式错误');
  250. flagButton = false;
  251. }else{
  252. $(".mobilePhone").css("display","none");
  253. flagButton = true;
  254. }
  255. }
  256. function passwordEvent () {
  257. if($("#pwd").val() == ''){
  258. $(".pass_word").css("display","block");
  259. return false;
  260. }else{
  261. $(".pass_word").css("display","none");
  262. }
  263. }
  264. function addMobile(data){
  265. $.ajax({
  266. type:"post",
  267. url:"/api/V1/shareBook",
  268. data: data,
  269. success: function (res) {
  270. console.log(JSON.parse(res))
  271. if(JSON.parse(res).code == 0){
  272. if(Boolean(JSON.parse(res).res)){
  273. window.location.href="addSuccess.html";
  274. localStorage.setItem('avatar',JSON.parse(res).res.avatar)
  275. localStorage.setItem('book_name',JSON.parse(res).res.book_name)
  276. localStorage.setItem('user_name',JSON.parse(res).res.user_name)
  277. }else{
  278. $(".mask").css("visibility","visible");
  279. $(".content p").html(JSON.parse(res).message[0]);
  280. }
  281. }else{
  282. var msg = JSON.parse(res).message[0]
  283. $(".mask").css("visibility","visible");
  284. if(msg.indexOf("password") != -1){
  285. msg = msg.replace('password', '密码');
  286. }
  287. $(".content p").html(msg);
  288. }
  289. }
  290. });
  291. }
  292. </script>