Authored by zzzzzzz

前端判断登录

... ... @@ -49,7 +49,7 @@
<div class="content">
<div class="vip-goods-sec">
{{#each vipgoods}}
<h5 class="vip-goods-sec-label">潮牌尖</h5>
<h5 class="vip-goods-sec-label">潮牌尖</h5>
<ul class="vip-goods-list clearfix">
{{#each this}}
<li class="vip-good">
... ...
... ... @@ -110,7 +110,7 @@ const _processIndexData = (dataList) => {
let url = `/guang/star/detail?tag=${data.tagName}&openby:yohobuy{"action":"go.h5","params":{"id":"","share":"","shareparam":{},"islogin":"N","type":0,"updateflag":"N","url":"http://m.yohobuy.com/guang/star/detail","param":{"tag":"${data.tagName}"}}}`; // eslint-disable-line
formatData.starAvatar.push({
//noLazy: index < 6,
// noLazy: index < 6,
url: url,
cover: data.cover ? (data.cover + '?imageView2/2/w/180/h/180') : data.cover
});
... ...
... ... @@ -4,6 +4,8 @@
*/
'use strict';
require('plugin/modal');
require('../common.js');
var yoho = require('../yoho-app');
var tip = require('plugin/tip');
window.tip = tip;
... ... @@ -20,6 +22,7 @@ var $punchModal;
var page = {
init: function() {
yoho.checkLogin();
this.domInit();
this.bindEvents();
... ... @@ -40,18 +43,15 @@ var page = {
$punch.on('click', $.proxy(this.punchFuli, this));
$msgModal
.on('shown.yoho.modal', function() {
yoho.checkLogin();
$msg.focus();
})
.on('keydown', '.msg-text', function(event) {
event.preventDefault();
if (event.which !== KEY_CODE.ENTER) {
return;
}
var textArea = event.target;
var content = $.trim(textArea.value);
if (content.length) {
if (content.length && event.which === KEY_CODE.ENTER) {
event.preventDefault();
self.leaveMsg(content);
}
})
... ... @@ -62,14 +62,15 @@ var page = {
// 签到福利
punchFuli: function() {
yoho.checkLogin();
$.post('/activity/vip-day/signin.json').done(function(res) {
if (res.code !== 200) {
tip.show(res.message || '签到失败');
return;
}
if (res.code !== 200) {
tip.show(res.message || '签到失败');
return;
}
$punchModal.yModal('show');
})
$punchModal.yModal('show');
})
.fail(function() {
tip.show('签到失败 >_<');
});
... ... @@ -77,8 +78,8 @@ var page = {
leaveMsg: function(content) {
$.post('/activity/vip-day/msg/save.json', {
content: content
})
content: content
})
.done(function(res) {
if (res.code !== 200) {
tip.show('留言失败~稍后再试');
... ... @@ -110,7 +111,8 @@ var page = {
return;
}
var $frag = $('<ul></ul>'), $fragClone;
var $frag = $('<ul></ul>'),
$fragClone;
$.each(res.data, function(index, msg) {
var li = document.createElement('li');
... ... @@ -133,6 +135,7 @@ var page = {
onePageH = $fragClone[0].offsetTop;
console.log(oneMsgH)
function rolling() {
$msgRoll.animate({
... ... @@ -159,5 +162,4 @@ var page = {
window.$ = $;
$(function() {
page.init();
});
});
\ No newline at end of file
... ...
/* eslint-disable vars-on-top */
'use strict';
require('plugin/modal.alert');
require('../common');
require('../yoho-app').checkLogin();
var tip = require('plugin/tip');
var Game = require('./vip_day/game');
... ... @@ -52,7 +54,7 @@ $(function() {
});
game.success = function(score, coin) {
var content = score === 0 ? '很遗憾您没有中奖,继续加油哦~' : '<p class="primary">恭喜你获得<span class="award">' + score + '</span>个有货币</p>';
var content = score === 0 ? '很遗憾您没有中奖,继续加油哦~' : '<p class="primary">恭喜你获得<span class="award">' + score + '</span>个有货币,请到【我的奖品】中查收</p>';
$.yAlert({
class: 'vipday-game-alert',
... ...
/* eslint-disable vars-on-top */
'use strict';
require('plugin/modal.alert');
require('../common');
require('../yoho-app').checkLogin();
var Game = require('./vip_day/game');
window.$ = $;
... ... @@ -16,7 +18,7 @@ $(function() {
console.log(score);
$.yAlert({
class: 'vipday-game-alert',
content: '<p class="primary">恭喜你获得<span class="award">' + score + '</span>个有货币</p>'
content: '<p class="primary">恭喜你获得<span class="award">' + score + '</span>个有货币,请到【我的奖品】中查收</p>'
});
$gameNotify.text('您的机会已用完,请下月28号再来');
game.destory();
... ...
... ... @@ -257,8 +257,9 @@ starIScroll.iScroll.on('scrollStart', function() {
bannerSwiper && bannerSwiper.stopAutoplay();
});
starIScroll.iScroll.on('scroll', function() {
$window.trigger('scroll');
starIScroll.iScroll.on('scroll', function() {
$window.trigger('scroll');
// var avatarOffsetT;
//
// if (this.directionY !== -1) {
... ... @@ -300,7 +301,7 @@ starIScroll.iScroll.on('scrollStart', function() {
// } else {
// $avatarClone.hide();
// }
});
});
starIScroll.iScroll.on('scrollEnd', function() {
// $loadingTip.slideUp();
... ...
... ... @@ -71,7 +71,20 @@ var yoho = {
appInterface[name] = callback;
}
}, 500);
}
},
/**
* 判断是否登录并跳转app对应登录
*/
checkLogin: function() {
var url = window.location.protocol + '//m.yohobuy.com/signin.html?refer=' + encodeURIComponent(window.location.href) + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http://m.yohobuy.com/activity/vip-day"}}}';
if (!window.getUid()) {
$('body').append('<a href=\'' + url +'\' style="display:none;" id="collocation-link">' +
'<span class="collocation-link"></span></a>');
$('.collocation-link').click();
}
},
};
module.exports = yoho;
... ...