Showing
7 changed files
with
40 additions
and
25 deletions
@@ -19,9 +19,10 @@ const studentsModel = require(`${mRoot}/students`); // students 页 model | @@ -19,9 +19,10 @@ const studentsModel = require(`${mRoot}/students`); // students 页 model | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | exports.index = (req, res, next) => { | 21 | exports.index = (req, res, next) => { |
22 | + req.user.uid = 13311991; | ||
23 | + | ||
22 | let channel = req.query.channel || req.cookies._Channel || 'boys'; | 24 | let channel = req.query.channel || req.cookies._Channel || 'boys'; |
23 | 25 | ||
24 | - req.user.uid = 13311991; | ||
25 | studentsModel.getStudentsData(channel, req).then(result => { | 26 | studentsModel.getStudentsData(channel, req).then(result => { |
26 | 27 | ||
27 | let responseData = studentsModel.getTestData(channel); | 28 | let responseData = studentsModel.getTestData(channel); |
@@ -73,7 +74,7 @@ exports.eduLevel = (req, res, next) => { | @@ -73,7 +74,7 @@ exports.eduLevel = (req, res, next) => { | ||
73 | }; | 74 | }; |
74 | 75 | ||
75 | /** | 76 | /** |
76 | - * 学生验证 | 77 | + * 身份验证 |
77 | * @param {[type]} req [description] | 78 | * @param {[type]} req [description] |
78 | * @param {[type]} res [description] | 79 | * @param {[type]} res [description] |
79 | * @return {[type]} [description] | 80 | * @return {[type]} [description] |
@@ -85,16 +85,15 @@ exports.verifyIdentity = (uid, certNo, name, pageUrl) => { | @@ -85,16 +85,15 @@ exports.verifyIdentity = (uid, certNo, name, pageUrl) => { | ||
85 | * 学籍验证 | 85 | * 学籍验证 |
86 | * @return | 86 | * @return |
87 | */ | 87 | */ |
88 | -exports.verifyStudent = (uid, collegeName, educationDegree, enrollmentYear, token) => { | 88 | +exports.verifyStudent = (uid, collegeName, educationDegree, enrollmentYear) => { |
89 | let finalParams = { | 89 | let finalParams = { |
90 | - method: 'method=app.student.verifyStudent', | 90 | + method: 'app.student.verifyStudent', |
91 | uid: uid, | 91 | uid: uid, |
92 | client_type: 'web', | 92 | client_type: 'web', |
93 | college_name: collegeName, | 93 | college_name: collegeName, |
94 | education_degree: educationDegree, | 94 | education_degree: educationDegree, |
95 | - enrollment_year: enrollmentYear, | ||
96 | - token: token | 95 | + enrollment_year: enrollmentYear |
97 | }; | 96 | }; |
98 | - | 97 | + |
99 | return api.get('', finalParams); | 98 | return api.get('', finalParams); |
100 | }; | 99 | }; |
@@ -109,7 +109,15 @@ exports.stuProducts = (data) => { | @@ -109,7 +109,15 @@ exports.stuProducts = (data) => { | ||
109 | return products; | 109 | return products; |
110 | }; | 110 | }; |
111 | 111 | ||
112 | -exports.stuVerify = (data) => { | ||
113 | - data.isStudent = data.isStudent === 1 ? true : false; | 112 | +exports.stuVerify = (result) => { |
113 | + let data = {}; | ||
114 | + | ||
115 | + if (result.code === 200) { | ||
116 | + data = result.data; | ||
117 | + data.isStudent = data.isStudent === 1 ? true : false; | ||
118 | + } else { | ||
119 | + data.msg = result.message; | ||
120 | + } | ||
121 | + | ||
114 | return data; | 122 | return data; |
115 | -} | 123 | +}; |
@@ -46,11 +46,6 @@ exports.getStudentsData = (channel, req) => { | @@ -46,11 +46,6 @@ exports.getStudentsData = (channel, req) => { | ||
46 | 46 | ||
47 | if (req.user.uid && req.query.collegeName && req.query.educationDegree && | 47 | if (req.user.uid && req.query.collegeName && req.query.educationDegree && |
48 | req.query.enrollmentYear && req.query.sign) { | 48 | req.query.enrollmentYear && req.query.sign) { |
49 | - // console.info(req.user.uid); | ||
50 | - // console.info(req.query.collegeName); | ||
51 | - // console.info(req.query.educationDegree); | ||
52 | - // console.info(req.query.enrollmentYear); | ||
53 | - // console.info(req.query.params); | ||
54 | apiMethod.push( | 49 | apiMethod.push( |
55 | studentsApi.verifyStudent(req.user.uid, req.query.collegeName, | 50 | studentsApi.verifyStudent(req.user.uid, req.query.collegeName, |
56 | req.query.educationDegree, req.query.enrollmentYear) | 51 | req.query.educationDegree, req.query.enrollmentYear) |
@@ -89,8 +84,9 @@ exports.getStudentsData = (channel, req) => { | @@ -89,8 +84,9 @@ exports.getStudentsData = (channel, req) => { | ||
89 | Object.assign(responseData.realData, {proItem: stuHandler.stuProducts(result[3].data.product_list)}); | 84 | Object.assign(responseData.realData, {proItem: stuHandler.stuProducts(result[3].data.product_list)}); |
90 | } | 85 | } |
91 | 86 | ||
92 | - if (result[4] && result[4].code === 200) { | ||
93 | - Object.assign(responseData.realData, {verifyRusult: stuHandler.stuVerify(result[4].data)}); | 87 | + if (result[4]) { |
88 | + console.info(result[4]); | ||
89 | + Object.assign(responseData.realData, {verifyRusult: stuHandler.stuVerify(result[4])}); | ||
94 | } | 90 | } |
95 | 91 | ||
96 | return responseData; | 92 | return responseData; |
@@ -246,8 +242,8 @@ exports.getTestData = () => { | @@ -246,8 +242,8 @@ exports.getTestData = () => { | ||
246 | stuNum: [1, 2, 3, 4, 5, 6, 7] | 242 | stuNum: [1, 2, 3, 4, 5, 6, 7] |
247 | }, | 243 | }, |
248 | verifyRusult: { | 244 | verifyRusult: { |
249 | - isStudent: true, | ||
250 | - prompt: '100有货币已到账' | 245 | + status: true, |
246 | + rank: 20 | ||
251 | } | 247 | } |
252 | }; | 248 | }; |
253 | return respData; | 249 | return respData; |
@@ -294,7 +290,7 @@ exports.getEduLevel = () => { | @@ -294,7 +290,7 @@ exports.getEduLevel = () => { | ||
294 | exports.verifyIdentity = (uid, params) => { | 290 | exports.verifyIdentity = (uid, params) => { |
295 | let pageUrl = 'http://localhost:6002/product/students?' + | 291 | let pageUrl = 'http://localhost:6002/product/students?' + |
296 | queryString.stringify({collegeName: params.collegeName, | 292 | queryString.stringify({collegeName: params.collegeName, |
297 | - educationDegree: params.educationDegree, enrollmentYear: params.enrollmentYear}) + '&'; | 293 | + educationDegree: params.educationDegree, enrollmentYear: params.enrollmentYear}); |
298 | 294 | ||
299 | return studentsApi.verifyIdentity(uid, params.certNo, params.name, pageUrl).then(result => { | 295 | return studentsApi.verifyIdentity(uid, params.certNo, params.name, pageUrl).then(result => { |
300 | return result; | 296 | return result; |
@@ -100,5 +100,12 @@ | @@ -100,5 +100,12 @@ | ||
100 | <li><a>\{{this}}</a></li> | 100 | <li><a>\{{this}}</a></li> |
101 | \{{/yearData}} | 101 | \{{/yearData}} |
102 | </script> | 102 | </script> |
103 | + <script type="text/html" id="identity-back"> | ||
104 | + <div class="identity-back-wrap"> | ||
105 | + <div class="identity-back-icon fail-icon"></div> | ||
106 | + <p class="identity-back-title">{{msg}}</p> | ||
107 | + <p class="identity-back-subtitle">您可以<span class="backForm">重新验证></span></p> | ||
108 | + </div> | ||
109 | + </script> | ||
103 | </div> | 110 | </div> |
104 | {{/realData}} | 111 | {{/realData}} |
@@ -73,8 +73,8 @@ | @@ -73,8 +73,8 @@ | ||
73 | <p class="identity-back-subtitle"><span>{{prompt}}</span></p> | 73 | <p class="identity-back-subtitle"><span>{{prompt}}</span></p> |
74 | {{else}} | 74 | {{else}} |
75 | <div class="identity-back-icon fail-icon"></div> | 75 | <div class="identity-back-icon fail-icon"></div> |
76 | - <p class="identity-back-title">太遗憾了,您的学校信息未通过审核!</p> | ||
77 | - <p class="identity-back-subtitle">您可以<span id="backForm">重新验证></span></p> | 76 | + <p class="identity-back-title">{{#if msg}} {{msg}} {{else}} 太遗憾了,您的学校信息未通过审核!{{/if}}</p> |
77 | + <p class="identity-back-subtitle">您可以<span class="backForm">重新验证></span></p> | ||
78 | {{/if}} | 78 | {{/if}} |
79 | </div> | 79 | </div> |
80 | {{/verifyRusult}} | 80 | {{/verifyRusult}} |
@@ -21,7 +21,8 @@ var $sortItem = $('.sort-item'), | @@ -21,7 +21,8 @@ var $sortItem = $('.sort-item'), | ||
21 | var $rightDia = $('#rights-dia'), | 21 | var $rightDia = $('#rights-dia'), |
22 | $couponDia = $('#coupon-dia'); | 22 | $couponDia = $('#coupon-dia'); |
23 | 23 | ||
24 | -var provFn; | 24 | +var provFn, |
25 | + identityFn; | ||
25 | 26 | ||
26 | var alertConfig, | 27 | var alertConfig, |
27 | makeAlert; | 28 | makeAlert; |
@@ -52,6 +53,7 @@ var redirect = { | @@ -52,6 +53,7 @@ var redirect = { | ||
52 | 53 | ||
53 | // handlebars模板 | 54 | // handlebars模板 |
54 | provFn = handlebars.compile($('#stu-select').html() || ''); | 55 | provFn = handlebars.compile($('#stu-select').html() || ''); |
56 | +identityFn = handlebars.compile($('#identity-back').html() || ''); | ||
55 | 57 | ||
56 | require('../plugins/slider'); | 58 | require('../plugins/slider'); |
57 | 59 | ||
@@ -108,6 +110,9 @@ function submitIdentity(json) { | @@ -108,6 +110,9 @@ function submitIdentity(json) { | ||
108 | }).then(function(data) { | 110 | }).then(function(data) { |
109 | if (data.code === 200) { | 111 | if (data.code === 200) { |
110 | window.location.href = data.data; | 112 | window.location.href = data.data; |
113 | + } else { | ||
114 | + $('identity-back-wrap').remove(); | ||
115 | + $('#identity-wrap').append(identityFn({msg: data.message})); | ||
111 | } | 116 | } |
112 | }); | 117 | }); |
113 | } | 118 | } |
@@ -415,12 +420,11 @@ $('#identity-Btn').on('click', function() { | @@ -415,12 +420,11 @@ $('#identity-Btn').on('click', function() { | ||
415 | return; | 420 | return; |
416 | } | 421 | } |
417 | $prompt.html(''); | 422 | $prompt.html(''); |
418 | - console.info(identData); | ||
419 | submitIdentity(identData); | 423 | submitIdentity(identData); |
420 | }); | 424 | }); |
421 | 425 | ||
422 | // 重新验证 | 426 | // 重新验证 |
423 | -$('#backForm').on('click', function() { | 427 | +$('.backForm').on('click', function() { |
424 | $identityForm.removeClass('hide').siblings().addClass('hide'); | 428 | $identityForm.removeClass('hide').siblings().addClass('hide'); |
425 | }); | 429 | }); |
426 | 430 |
-
Please register or login to post a comment