Sin descripción

invitingFriends.html 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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.48rem;
  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. color: #666666;
  54. font-size: 0.14rem;
  55. line-height: 0.2rem;
  56. margin-left: 0.3rem;
  57. margin-top: 0.16rem;
  58. }
  59. .button{
  60. width: 2.18rem;
  61. height: 0.41rem;
  62. border-radius: 0.26rem;
  63. background: #F2F2F2;
  64. font-size: 0.2rem;
  65. color: #666666;
  66. margin: auto;
  67. margin-top: 0.56rem;
  68. display: block;
  69. }
  70. .other{
  71. color: #999999;
  72. font-size: 0.14rem;
  73. line-height: 0.2rem;
  74. margin-top: 0.45rem;
  75. text-align: center;
  76. }
  77. .register_weixin{
  78. width: 0.6rem;
  79. height: 0.6rem;
  80. margin: auto;
  81. }
  82. </style>
  83. </head>
  84. <body>
  85. <img class="userImg" src="https://small-app.oss-cn-beijing.aliyuncs.com/youhuiquan/shenqian.png" />
  86. <p class="inviting">Hi,我是<text>小小小零首付</text>,邀请你加入《旅行账本》一起记账</p>
  87. <div class="tel"><label>手机号</label><input id="mobile" type="tel" placeholder="请输入手机号" /></div>
  88. <div class="tel"><label>密码</label><input id="pwd" type="password" placeholder="请输入密码" /></div>
  89. <div class="forget_password" onclick="goForgetPassword()">忘记密码?</div>
  90. <button class="button" onclick="goAddSuccess()">立即加入</button>
  91. <div class="other">——其他方式——</div>
  92. <img onclick="addWeixin()" src="image/weixin.png" class="register_weixin"/>
  93. <div class="mask">
  94. <div class="content">
  95. <h3>提示</h3>
  96. <p>密码错误啊啊啊啊啊</p>
  97. <div onclick="iknow()">我知道了</div>
  98. </div>
  99. </div>
  100. </body>
  101. </html>
  102. <script type="text/javascript" src="public/jquery-2.1.0.js"></script>
  103. <script type="text/javascript">
  104. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  105. window.onresize = function(){
  106. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  107. }
  108. var book_id = '';
  109. var openid = '';
  110. var unionid = '';
  111. var userName = '';
  112. var userImg = '';
  113. var str=location.href; //取得整个地址栏
  114. var num=str.indexOf("?");
  115. str=str.substr(num+1); //str得到?之后的字符串
  116. var brr=str.split("&");
  117. for(var i = 0 ; i<brr.length; i++){
  118. if(brr[i].indexOf('book_id') != -1){
  119. book_id = brr[i].split('=')[1];
  120. }
  121. if(brr[i].indexOf('openid') != -1){
  122. openid = brr[i].split('=')[1];
  123. }
  124. if(brr[i].indexOf('unionid') != -1){
  125. unionid = brr[i].split('=')[1];
  126. }
  127. if(brr[i].indexOf('userName') != -1){
  128. userName = brr[i].split('=')[1];
  129. userName = decodeURI(userName);
  130. }
  131. if(brr[i].indexOf('userImg') != -1){
  132. userImg = brr[i].split('=')[1];
  133. }
  134. }
  135. window.onload = function () {
  136. $(".inviting text").html(userName);
  137. $(".userImg").attr("src",userImg);
  138. }
  139. function goAddSuccess() {
  140. // loginData();
  141. var data = {
  142. "book_id":book_id,
  143. 'type':1,
  144. 'mobile':$("#mobile").val(),
  145. 'password':$("#pwd").val()
  146. }
  147. addMobile(data);
  148. }
  149. function addWeixin(){
  150. var data = {
  151. "book_id":book_id,
  152. 'type':1,
  153. 'openid':openid,
  154. 'unionid':unionid
  155. }
  156. addMobile(data);
  157. }
  158. function goForgetPassword() {
  159. window.location.href="forgetPassword.html";
  160. }
  161. function iknow() {
  162. $(".mask").css("visibility","hidden");
  163. }
  164. function loginData(){
  165. var mobile = $("#mobile").val();
  166. var pwd = $("#pwd").val();
  167. var token = '';
  168. $.ajax({
  169. type:"post",
  170. url:"/api/V1/h5Login",
  171. data:{
  172. 'mobile':mobile,
  173. 'password':pwd
  174. },
  175. success: function (res) {
  176. if(JSON.parse(res).code == 0){
  177. //登录成功
  178. token = JSON.parse(res).res.token;
  179. addBook(token);
  180. }else{
  181. var msg = JSON.parse(res).message[0]
  182. $(".mask").css("visibility","visible");
  183. if(msg.indexOf("password") != -1){
  184. msg = msg.replace('password', '密码');
  185. }
  186. $(".content p").html(msg);
  187. }
  188. }
  189. });
  190. }
  191. function addBook (token) {
  192. $.ajax({
  193. type:"post",
  194. url:"/api/V1/shareBook",
  195. data:{
  196. "book_id":book_id
  197. },
  198. headers:{
  199. 'token':token
  200. },
  201. success: function (res) {
  202. console.log(JSON.parse(res))
  203. if(JSON.parse(res).code == 0){
  204. window.location.href="addSuccess.html";
  205. }else{
  206. $(".mask").css("visibility","visible");
  207. $(".content p").html('加入失败');
  208. }
  209. }
  210. });
  211. }
  212. function addMobile(data){
  213. $.ajax({
  214. type:"post",
  215. url:"/api/V1/shareBook",
  216. data: data,
  217. success: function (res) {
  218. console.log(JSON.parse(res))
  219. if(JSON.parse(res).code == 0){
  220. window.location.href="addSuccess.html";
  221. }else{
  222. var msg = JSON.parse(res).message[0]
  223. $(".mask").css("visibility","visible");
  224. if(msg.indexOf("password") != -1){
  225. msg = msg.replace('password', '密码');
  226. }
  227. $(".content p").html(msg);
  228. }
  229. }
  230. });
  231. }
  232. function addWeixin(data){
  233. $.ajax({
  234. type:"post",
  235. url:"/api/V1/shareBook",
  236. data: data,
  237. success: function (res) {
  238. if(JSON.parse(res).code == 0){
  239. window.location.href="addSuccess.html";
  240. }else{
  241. var msg = JSON.parse(res).message[0]
  242. $(".mask").css("visibility","visible");
  243. // if(msg.indexOf("password") != -1){
  244. // msg = msg.replace('password', '密码');
  245. // }
  246. $(".content p").html(msg);
  247. }
  248. }
  249. });
  250. }
  251. </script>