Authored by wenjiekong

学生验证修改

... ... @@ -19,9 +19,10 @@ const studentsModel = require(`${mRoot}/students`); // students 页 model
*/
exports.index = (req, res, next) => {
req.user.uid = 13311991;
let channel = req.query.channel || req.cookies._Channel || 'boys';
req.user.uid = 13311991;
studentsModel.getStudentsData(channel, req).then(result => {
let responseData = studentsModel.getTestData(channel);
... ... @@ -73,7 +74,7 @@ exports.eduLevel = (req, res, next) => {
};
/**
* 学生验证
* 身份验证
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
... ...
... ... @@ -85,16 +85,15 @@ exports.verifyIdentity = (uid, certNo, name, pageUrl) => {
* 学籍验证
* @return
*/
exports.verifyStudent = (uid, collegeName, educationDegree, enrollmentYear, token) => {
exports.verifyStudent = (uid, collegeName, educationDegree, enrollmentYear) => {
let finalParams = {
method: 'method=app.student.verifyStudent',
method: 'app.student.verifyStudent',
uid: uid,
client_type: 'web',
college_name: collegeName,
education_degree: educationDegree,
enrollment_year: enrollmentYear,
token: token
enrollment_year: enrollmentYear
};
return api.get('', finalParams);
};
... ...
... ... @@ -109,7 +109,15 @@ exports.stuProducts = (data) => {
return products;
};
exports.stuVerify = (data) => {
data.isStudent = data.isStudent === 1 ? true : false;
exports.stuVerify = (result) => {
let data = {};
if (result.code === 200) {
data = result.data;
data.isStudent = data.isStudent === 1 ? true : false;
} else {
data.msg = result.message;
}
return data;
}
};
... ...
... ... @@ -46,11 +46,6 @@ exports.getStudentsData = (channel, req) => {
if (req.user.uid && req.query.collegeName && req.query.educationDegree &&
req.query.enrollmentYear && req.query.sign) {
// console.info(req.user.uid);
// console.info(req.query.collegeName);
// console.info(req.query.educationDegree);
// console.info(req.query.enrollmentYear);
// console.info(req.query.params);
apiMethod.push(
studentsApi.verifyStudent(req.user.uid, req.query.collegeName,
req.query.educationDegree, req.query.enrollmentYear)
... ... @@ -89,8 +84,9 @@ exports.getStudentsData = (channel, req) => {
Object.assign(responseData.realData, {proItem: stuHandler.stuProducts(result[3].data.product_list)});
}
if (result[4] && result[4].code === 200) {
Object.assign(responseData.realData, {verifyRusult: stuHandler.stuVerify(result[4].data)});
if (result[4]) {
console.info(result[4]);
Object.assign(responseData.realData, {verifyRusult: stuHandler.stuVerify(result[4])});
}
return responseData;
... ... @@ -246,8 +242,8 @@ exports.getTestData = () => {
stuNum: [1, 2, 3, 4, 5, 6, 7]
},
verifyRusult: {
isStudent: true,
prompt: '100有货币已到账'
status: true,
rank: 20
}
};
return respData;
... ... @@ -294,7 +290,7 @@ exports.getEduLevel = () => {
exports.verifyIdentity = (uid, params) => {
let pageUrl = 'http://localhost:6002/product/students?' +
queryString.stringify({collegeName: params.collegeName,
educationDegree: params.educationDegree, enrollmentYear: params.enrollmentYear}) + '&';
educationDegree: params.educationDegree, enrollmentYear: params.enrollmentYear});
return studentsApi.verifyIdentity(uid, params.certNo, params.name, pageUrl).then(result => {
return result;
... ...
... ... @@ -100,5 +100,12 @@
<li><a>\{{this}}</a></li>
\{{/yearData}}
</script>
<script type="text/html" id="identity-back">
<div class="identity-back-wrap">
<div class="identity-back-icon fail-icon"></div>
<p class="identity-back-title">{{msg}}</p>
<p class="identity-back-subtitle">您可以<span class="backForm">重新验证></span></p>
</div>
</script>
</div>
{{/realData}}
... ...
... ... @@ -73,8 +73,8 @@
<p class="identity-back-subtitle"><span>{{prompt}}</span></p>
{{else}}
<div class="identity-back-icon fail-icon"></div>
<p class="identity-back-title">太遗憾了,您的学校信息未通过审核!</p>
<p class="identity-back-subtitle">您可以<span id="backForm">重新验证></span></p>
<p class="identity-back-title">{{#if msg}} {{msg}} {{else}} 太遗憾了,您的学校信息未通过审核!{{/if}}</p>
<p class="identity-back-subtitle">您可以<span class="backForm">重新验证></span></p>
{{/if}}
</div>
{{/verifyRusult}}
... ...
... ... @@ -21,7 +21,8 @@ var $sortItem = $('.sort-item'),
var $rightDia = $('#rights-dia'),
$couponDia = $('#coupon-dia');
var provFn;
var provFn,
identityFn;
var alertConfig,
makeAlert;
... ... @@ -52,6 +53,7 @@ var redirect = {
// handlebars模板
provFn = handlebars.compile($('#stu-select').html() || '');
identityFn = handlebars.compile($('#identity-back').html() || '');
require('../plugins/slider');
... ... @@ -108,6 +110,9 @@ function submitIdentity(json) {
}).then(function(data) {
if (data.code === 200) {
window.location.href = data.data;
} else {
$('identity-back-wrap').remove();
$('#identity-wrap').append(identityFn({msg: data.message}));
}
});
}
... ... @@ -415,12 +420,11 @@ $('#identity-Btn').on('click', function() {
return;
}
$prompt.html('');
console.info(identData);
submitIdentity(identData);
});
// 重新验证
$('#backForm').on('click', function() {
$('.backForm').on('click', function() {
$identityForm.removeClass('hide').siblings().addClass('hide');
});
... ...