作者 杨乐
1 个管道 的构建 通过 耗费 6 秒

提交

@@ -214,7 +214,7 @@ @@ -214,7 +214,7 @@
214 margin-bottom: 4%;place-items: center;box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.2);"> 214 margin-bottom: 4%;place-items: center;box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.2);">
215 <img src='img/portfolio/WX.png' style="margin-right: 8%;"> 215 <img src='img/portfolio/WX.png' style="margin-right: 8%;">
216 <div id='login-a-ewm'> 216 <div id='login-a-ewm'>
217 - <a style="font-size: 1.1em;font-family: Helvetica;" >微信快速登录/注册</a> 217 + <a style="font-size: 1.1em;font-family: Helvetica;">微信快速登录/注册</a>
218 </div> 218 </div>
219 219
220 </div> 220 </div>
@@ -269,9 +269,10 @@ @@ -269,9 +269,10 @@
269 <!-- jQuery --> 269 <!-- jQuery -->
270 <script type="text/javascript" src="js/jquery-2.1.1.js"></script> 270 <script type="text/javascript" src="js/jquery-2.1.1.js"></script>
271 <script type="text/javascript" src="js/bootstrap.min.js"></script> 271 <script type="text/javascript" src="js/bootstrap.min.js"></script>
272 - 272 + <script src="https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/layer.js"></script>
273 <!-- Custom Theme JavaScript --> 273 <!-- Custom Theme JavaScript -->
274 <script src="js/agency.js"></script> 274 <script src="js/agency.js"></script>
  275 + <!-- 微信转换二维码 -->
275 <script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script> 276 <script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
276 <!-- Plugin JavaScript --> 277 <!-- Plugin JavaScript -->
277 <script src="js/jquery.easing.min.js"></script> 278 <script src="js/jquery.easing.min.js"></script>
@@ -13,31 +13,38 @@ $(document).ready(function() { @@ -13,31 +13,38 @@ $(document).ready(function() {
13 newCodes = newCode.split("&"); 13 newCodes = newCode.split("&");
14 var ncode = newCodes[0] 14 var ncode = newCodes[0]
15 // console.log(ncode); 15 // console.log(ncode);
16 - var url1 = '/login/loginCheck'  
17 var header1 = { 16 var header1 = {
18 "Content-Type": "application/x-www-form-urlencoded" 17 "Content-Type": "application/x-www-form-urlencoded"
19 } 18 }
  19 +
20 var params = { code: ncode } 20 var params = { code: ncode }
21 - //传回code值  
22 - ajax(url1, "POST", header1, params, function(res) { 21 + //传回code值 微信登录
  22 + ajax('/login/loginCheck', "POST", header1, params, function(res) {
23 console.log(res); 23 console.log(res);
24 - // alert("登录成功!")  
25 - localStorage.setItem("token", res.data.token);  
26 - localStorage.setItem("userId", res.data.id);  
27 - if (res.data.status === 1) {  
28 - window.location.href = 'save.html'  
29 - } else if (res.data.Status1 === 2) {  
30 - window.location.href = 'participated.html'  
31 - } else {  
32 - window.location.href = 'index.html'  
33 - }  
34 - //绑定账号的用户授权  
35 - var url3 = '/login/loginCheck1'  
36 var header2 = { 24 var header2 = {
37 "Content-Type": "application/x-www-form-urlencoded", 25 "Content-Type": "application/x-www-form-urlencoded",
38 "token": res.data.token 26 "token": res.data.token
39 } 27 }
40 - ajax(url3, "PUT", header2, params, function(res) { 28 +
  29 + // alert("登录成功!")
  30 + localStorage.setItem("token", res.data.token);
  31 + localStorage.setItem("userId", res.data.id);
  32 + //查看个人信息
  33 + ajax("/login/userInfo", "GET", header2, function(res) {}, function(res) {
  34 + console.log(res);
  35 +
  36 + })
  37 +
  38 + // if (res.data.status === 1) {
  39 + // window.location.href = 'save.html'
  40 + // } else if (res.data.Status1 === 2) {
  41 + // window.location.href = 'participated.html'
  42 + // } else {
  43 + // window.location.href = 'index.html'
  44 + // }
  45 +
  46 + //绑定账号的用户授权
  47 + ajax('/login/loginCheck1', "PUT", header2, params, function(res) {
41 console.log(res); 48 console.log(res);
42 }, function(res) { 49 }, function(res) {
43 console.log(res); 50 console.log(res);
@@ -75,14 +82,13 @@ $(document).ready(function() { @@ -75,14 +82,13 @@ $(document).ready(function() {
75 code = ""; //清除验证码。如果不清除,过时间后,输入收到的验证码依然有效 82 code = ""; //清除验证码。如果不清除,过时间后,输入收到的验证码依然有效
76 } 83 }
77 }, 1000); 84 }, 1000);
78 - var url2 = '/login/codeLogin'  
79 var header1 = { 85 var header1 = {
80 "Content-Type": "application/x-www-form-urlencoded" 86 "Content-Type": "application/x-www-form-urlencoded"
81 } 87 }
82 var params1 = { phoneNumber: phone } 88 var params1 = { phoneNumber: phone }
83 89
84 //获取验证码接口 90 //获取验证码接口
85 - ajax(url2, "GET", header1, params1, function(res) { 91 + ajax('/login/codeLogin', "GET", header1, params1, function(res) {
86 console.log(res); 92 console.log(res);
87 }, function(res) {}) 93 }, function(res) {})
88 }); 94 });
@@ -102,7 +108,6 @@ $(document).ready(function() { @@ -102,7 +108,6 @@ $(document).ready(function() {
102 } else if (inputCode.length === 0) { 108 } else if (inputCode.length === 0) {
103 alert("验证码不能为空!") 109 alert("验证码不能为空!")
104 } else { 110 } else {
105 - var url = "/login/loginRegistered"; // 接口  
106 var header = { 111 var header = {
107 "Content-Type": "application/json" 112 "Content-Type": "application/json"
108 } 113 }
@@ -110,7 +115,9 @@ $(document).ready(function() { @@ -110,7 +115,9 @@ $(document).ready(function() {
110 code: inputCode, 115 code: inputCode,
111 phoneNumber: inputNumber 116 phoneNumber: inputNumber
112 }) 117 })
113 - ajax(url, "POST", header, params2, function(res) { 118 +
  119 + //手机号登录
  120 + ajax("/login/loginRegistered", "POST", header, params2, function(res) {
114 console.log(res); 121 console.log(res);
115 localStorage.setItem("token", res.data.token); 122 localStorage.setItem("token", res.data.token);
116 localStorage.setItem("userId", res.data.user); 123 localStorage.setItem("userId", res.data.user);
@@ -126,7 +133,6 @@ $(document).ready(function() { @@ -126,7 +133,6 @@ $(document).ready(function() {
126 window.location.href = 'save.html' 133 window.location.href = 'save.html'
127 } else if (res.data.Status1 === 2) { 134 } else if (res.data.Status1 === 2) {
128 window.location.href = 'participated.html' 135 window.location.href = 'participated.html'
129 - // window.location.href = 'browseMore.html'  
130 } else { 136 } else {
131 window.location.href = 'index.html' 137 window.location.href = 'index.html'
132 } 138 }
@@ -143,33 +149,15 @@ $(document).ready(function() { @@ -143,33 +149,15 @@ $(document).ready(function() {
143 149
144 //获取用户VIP信息判断是否是VIP 150 //获取用户VIP信息判断是否是VIP
145 function setPersonal() { 151 function setPersonal() {
146 - // $.ajax({  
147 - // type: 'GET',  
148 - // url: 'http://192.168.1.241:9004/login/userInfo',  
149 - // headers: {  
150 - // "Content-Type": "application/json",  
151 - // "token": localStorage.getItem('token'),  
152 - // },  
153 - // success: function(res) {  
154 - // console.log(res);  
155 - // if (res.data.status1 == 1) {  
156 - // window.location.href = 'personalCenter.html'  
157 - // } else {  
158 - // window.location.href = 'personalCenter2.html'  
159 - // }  
160 - // }  
161 - // })  
162 alert('请先登录!') 152 alert('请先登录!')
163 } 153 }
164 -//跳转二维码登录 154 +//请求授权地址,跳转二维码登录页
165 function setEWM() { 155 function setEWM() {
166 - var url = '/login/loginInit'  
167 var header = { 156 var header = {
168 "Content-Type": "application/x-www-form-urlencoded" 157 "Content-Type": "application/x-www-form-urlencoded"
169 } 158 }
170 - ajax(url, "GET", header, function(res) {}, function(res) { 159 + ajax("/login/loginInit", "GET", header, function(res) {}, function(res) {
171 console.log(res); 160 console.log(res);
172 - console.log(res.data);  
173 window.location.href = res.data 161 window.location.href = res.data
174 }) 162 })
175 // $('#phone-login').hide() 163 // $('#phone-login').hide()
@@ -87,6 +87,12 @@ @@ -87,6 +87,12 @@
87 height: 40px; 87 height: 40px;
88 } 88 }
89 89
  90 + .per-huiyuan-img {
  91 + margin-right: 10px;
  92 + width: 40px;
  93 + height: 40px;
  94 + }
  95 +
90 .per-weixin-bind { 96 .per-weixin-bind {
91 display: flex; 97 display: flex;
92 justify-content: space-between; 98 justify-content: space-between;
@@ -735,6 +741,10 @@ @@ -735,6 +741,10 @@
735 </div> 741 </div>
736 <button style="color: #70D09D;background-color: #323232;border: 1px solid #70D09D;border-radius: 10em;padding: 0.5% 5%;">续费</button> 742 <button style="color: #70D09D;background-color: #323232;border: 1px solid #70D09D;border-radius: 10em;padding: 0.5% 5%;">续费</button>
737 </div> 743 </div>
  744 + <!-- 支付宝页面 -->
  745 + <div class="zhifubao_form" style="display: none;">
  746 +
  747 + </div>
738 </div> 748 </div>
739 </div> 749 </div>
740 <div class='personalCenter-right-all'> 750 <div class='personalCenter-right-all'>
@@ -31,12 +31,12 @@ $(document).ready(function() { @@ -31,12 +31,12 @@ $(document).ready(function() {
31 // $("#WXunbind").html(title) 31 // $("#WXunbind").html(title)
32 // } 32 // }
33 if (res.data.wname == null) { 33 if (res.data.wname == null) {
34 - $("#WXunbind").html("绑定") 34 + $("#WXunbind").html("未绑")
35 } else { 35 } else {
36 $("#WXunbind").html("解绑") 36 $("#WXunbind").html("解绑")
37 } 37 }
38 if (res.data.phoneNumber == null) { 38 if (res.data.phoneNumber == null) {
39 - $("#Punbind").html("绑定") 39 + $("#Punbind").html("未绑")
40 } else { 40 } else {
41 $("#Punbind").html("解绑") 41 $("#Punbind").html("解绑")
42 } 42 }
@@ -78,7 +78,6 @@ $(document).ready(function() { @@ -78,7 +78,6 @@ $(document).ready(function() {
78 var inputEmailAddress = $("#emailAddress").val(); 78 var inputEmailAddress = $("#emailAddress").val();
79 console.log(inputEmailAddress); 79 console.log(inputEmailAddress);
80 80
81 - var url1 = "/login/updateSysUser";  
82 var header1 = { 81 var header1 = {
83 "Content-Type": "application/json", 82 "Content-Type": "application/json",
84 } 83 }
@@ -93,7 +92,7 @@ $(document).ready(function() { @@ -93,7 +92,7 @@ $(document).ready(function() {
93 userName: inputUserName 92 userName: inputUserName
94 }) 93 })
95 // 调用公共ajax 94 // 调用公共ajax
96 - ajax(url1, "PUT", header1, params, function(res) { 95 + ajax("/login/updateSysUser", "PUT", header1, params, function(res) {
97 console.log(res); 96 console.log(res);
98 alert('保存成功!') 97 alert('保存成功!')
99 location.reload(); 98 location.reload();
@@ -108,7 +107,6 @@ $(document).ready(function() { @@ -108,7 +107,6 @@ $(document).ready(function() {
108 // 调用公共ajax 107 // 调用公共ajax
109 ajax(url2, "DELETE", header, function(res) { 108 ajax(url2, "DELETE", header, function(res) {
110 console.log(res); 109 console.log(res);
111 -  
112 }, function(res) { 110 }, function(res) {
113 console.log(res); 111 console.log(res);
114 alert("解绑成功!") 112 alert("解绑成功!")
@@ -121,7 +119,6 @@ $(document).ready(function() { @@ -121,7 +119,6 @@ $(document).ready(function() {
121 // 调用公共ajax 119 // 调用公共ajax
122 ajax(url3, "DELETE", header, function(res) { 120 ajax(url3, "DELETE", header, function(res) {
123 console.log(res); 121 console.log(res);
124 -  
125 }, function(res) { 122 }, function(res) {
126 console.log(res); 123 console.log(res);
127 alert("解绑成功!") 124 alert("解绑成功!")
@@ -231,22 +228,51 @@ function payment() { @@ -231,22 +228,51 @@ function payment() {
231 console.log(res); 228 console.log(res);
232 console.log(res); 229 console.log(res);
233 console.log(res.data); 230 console.log(res.data);
234 -  
235 - $(".hide_box").fadeToggle();  
236 - $(".shang_box").fadeToggle();  
237 - 231 + console.log(paymentType);
238 var params1 = { 232 var params1 = {
239 id: res.data, 233 id: res.data,
240 type: screenType 234 type: screenType
241 } 235 }
242 - 236 + //支付类型paymentType : 1微信 2支付宝
  237 + if (paymentType == 1) {
  238 + $(".hide_box").fadeToggle();
  239 + $(".shang_box").fadeToggle();
243 //微信支付 240 //微信支付
244 - ajax("/pay/createNative", "GET", header1, params1, function(res) {  
245 - console.log(res);  
246 - let title = `<img src="${res.data.codeUrl}" alt="扫码支付" title="扫一扫" >` 241 + ajax("/pay/createNative", "GET", header1, params1, function(res1) {
  242 + console.log(res1);
  243 + let title = `<img src="${res1.data.codeUrl}" alt="扫码支付" title="扫一扫" >`
247 $(".shang_payimg").html(title) 244 $(".shang_payimg").html(title)
  245 + //订单号
  246 + console.log(res1.data.outTradeNo);
  247 + //计时器
  248 + var timeInterval = setInterval(function() {
  249 + ajax("/orderLog/test", "GET", header1, { id: res1.data.outTradeNo }, function(res2) {
  250 + console.log(res2.data);
  251 + if (res2.data == '2') {
  252 + clearInterval(timeInterval)
  253 + alert("支付成功!")
  254 + window.location.href = 'personalCenter2.html'
  255 + }
  256 + }, function(res) {})
  257 + }, 2000)
248 }, function(res) {}) 258 }, function(res) {})
  259 + } else if (paymentType == 2) {
  260 + // $(".hide_box").fadeToggle();
  261 + // $(".shang_box").fadeToggle();
  262 + //支付宝支付
  263 + ajax("/zfbPay/alipay", "GET", header1, params1, function(res) {
  264 + console.log(res);
  265 + $(".zhifubao_form").html(res)
249 }, function(res) {}) 266 }, function(res) {})
  267 + } else {
  268 + alert("请选择支付类型!")
  269 + }
  270 +
  271 +
  272 +
  273 + }, function(res) {
  274 + console.log(res);
  275 + })
250 } 276 }
251 //获取用户VIP信息判断是否是VIP 277 //获取用户VIP信息判断是否是VIP
252 function ifVIP() { 278 function ifVIP() {
@@ -12,12 +12,12 @@ $(document).ready(function() { @@ -12,12 +12,12 @@ $(document).ready(function() {
12 }, function(res) { 12 }, function(res) {
13 console.log(res); 13 console.log(res);
14 if (res.data.wname == null) { 14 if (res.data.wname == null) {
15 - $("#WXunbind").html("绑定") 15 + $("#WXunbind").html("未绑")
16 } else { 16 } else {
17 $("#WXunbind").html("解绑") 17 $("#WXunbind").html("解绑")
18 } 18 }
19 if (res.data.phoneNumber == null) { 19 if (res.data.phoneNumber == null) {
20 - $("#Punbind").html("绑定") 20 + $("#Punbind").html("未绑")
21 } else { 21 } else {
22 $("#Punbind").html("解绑") 22 $("#Punbind").html("解绑")
23 } 23 }
1 $(document).ready(function() { 1 $(document).ready(function() {
  2 + var header = {
  3 + "Content-Type": "application/x-www-form-urlencoded",
  4 + "token": localStorage.getItem('token'),
  5 + }
  6 + ajax("/login/userInfo", "GET", header, params, function(res) {
  7 + console.log(res);
  8 + alert('保存成功!')
  9 + window.location.href = 'index.html'
  10 + }, function(res) {
  11 + console.log(res);
  12 + })
2 13
3 }); 14 });
4 15
5 //获取用户VIP信息判断是否是VIP 16 //获取用户VIP信息判断是否是VIP
6 function setPersonal() { 17 function setPersonal() {
7 - // $.ajax({  
8 - // type: 'GET',  
9 - // url: 'http://192.168.1.241:9004/login/userInfo',  
10 - // headers: {  
11 - // "Content-Type": "application/json",  
12 - // "token": localStorage.getItem('token'),  
13 - // },  
14 - // success: function(res) {  
15 - // console.log(res);  
16 - // if (res.data.status1 == 1) {  
17 - // window.location.href = 'personalCenter.html'  
18 - // } else {  
19 - // window.location.href = 'personalCenter2.html'  
20 - // }  
21 - // }  
22 - // })  
23 alert('请完善个人信息!') 18 alert('请完善个人信息!')
24 } 19 }
25 $(".btnSave").click(function() { 20 $(".btnSave").click(function() {
@@ -58,7 +53,7 @@ $(".btnSave").click(function() { @@ -58,7 +53,7 @@ $(".btnSave").click(function() {
58 } else if (/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(inputEmailAddress) == false) { 53 } else if (/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(inputEmailAddress) == false) {
59 alert("邮箱格式不正确,请重新填写!") 54 alert("邮箱格式不正确,请重新填写!")
60 } else { 55 } else {
61 - var url = "/login/updateSysUser"; // 接口 56 + var url = "/login/updateSysUser";
62 var header = { 57 var header = {
63 "Content-Type": "application/json" 58 "Content-Type": "application/json"
64 } 59 }
@@ -80,31 +75,5 @@ $(".btnSave").click(function() { @@ -80,31 +75,5 @@ $(".btnSave").click(function() {
80 }, function(res) { 75 }, function(res) {
81 console.log(res); 76 console.log(res);
82 }) 77 })
83 -  
84 -  
85 -  
86 - // $.ajax({  
87 - // type: "PUT",  
88 - // url: "http://192.168.1.241:9004/login/updateSysUser",  
89 - // // dataType: "jsonp",  
90 - // headers: {  
91 - // "Content-Type": "application/json"  
92 - // },  
93 - // data: JSON.stringify({  
94 - // emailAddress: inputEmailAddress,  
95 - // id: localStorage.getItem("userId"),  
96 - // img: null,  
97 - // phone: inputPhone,  
98 - // specialty: inputSpecialty,  
99 - // school: inputSchool,  
100 - // surname: inputSurname,  
101 - // userName: inputUserName  
102 - // }),  
103 - // success: function(msg) {  
104 - // alert('保存成功!')  
105 - // window.location.href = 'index.html'  
106 - // },  
107 - // error: function(res) {}  
108 - // });  
109 } 78 }
110 }) 79 })