Authored by zhangxiaoru

shop uid

'use strict';
const shopModel = require('../models/shopCollect'),
headerModel = require('../../../doraemon/models/header');
headerModel = require('../../../doraemon/models/header'),
_ = require('lodash');
const crypto = global.yoho.crypto;
const shopIndex = (req, res) => {
let isApp = req.query.app_version || req.query.appVersion || false;
// let uid = req.user.uid;
let uid = req.user.uid;
let parameter = {};
if (!isApp) {
... ... @@ -15,6 +16,12 @@ const shopIndex = (req, res) => {
navTitle: '店铺收藏'
})
};
} else {
uid = crypto.encryption('', req.query.uid + ''),
parameter = {
appVersion: true,
uid: uid
};
}
shopModel.banner().then((result) => {
... ... @@ -39,7 +46,7 @@ const shopNav = (req, res, next) => {
const shopList = (req, res, next) => {
let uid = req.user.uid;
let uid = req.query.uid || req.user.uid || '';
let tabName = req.query.tabName;
shopModel.shopList(uid, tabName).then((result) => {
... ...
... ... @@ -11,4 +11,6 @@
</div>
{{/ shopCollect}}
<input type="hidden" name="app_version" value="{{appVersion}}">
<input type="hidden" name="uid" value="{{uid}}">
</div>
\ No newline at end of file
... ...
... ... @@ -10,7 +10,10 @@ var searching,
shopId,
stoping,
navSwiper,
navType;
bannerSwiper,
navType,
appVersion = $('input[name="app_version"]').val(),
uid = $('input[name="uid"]').val();
var shopNav = require('shopCollect/shop-nav.hbs'),
shopList = require('shopCollect/shop-list.hbs');
... ... @@ -31,7 +34,8 @@ function shopListData(tabName, stoping) {
method: 'get',
url: '/activity/shopList',
data: {
tabName: tabName
tabName: tabName,
uid: window.queryString.uid
},
success: function(data) {
... ... @@ -68,6 +72,8 @@ function shopListData(tabName, stoping) {
id: shopId,
opt: opt,
type: 'shop',
uid: uid,
appVersion: appVersion
},
xhrFields: {
withCredentials: true
... ... @@ -75,25 +81,25 @@ function shopListData(tabName, stoping) {
success: function(list) {
var url;
if (list.code === 200) {
if ($this.hasClass('already-collect')) {
$this.removeClass('already-collect');
tip.show('店铺取消收藏成功');
} else {
$this.addClass('already-collect');
tip.show('店铺收藏成功');
}
if (list.code === 200) {
if ($this.hasClass('already-collect')) {
$this.removeClass('already-collect');
tip.show('店铺取消收藏成功');
} else {
$this.addClass('already-collect');
tip.show('店铺收藏成功');
}
}
if (list.code === 400) {
if (list.code === 400) {
url = list.data;
if ($('#jump-login').length <= 0) {
$('body').append('<a href=\'' + url + '\'><span id="jump-login"><span></a>');
}
$('#jump-login').click();
url = list.data;
if ($('#jump-login').length <= 0) {
$('body').append('<a href=\'' + url + '\'><span id="jump-login"><span></a>');
}
searching = false;
$('#jump-login').click();
}
searching = false;
},
error: function() {
tip.show('网络断开连接了~');
... ...
... ... @@ -100,7 +100,7 @@ function inputAction() {
var i;
if (data.length > 0) {
console.log(data.length);
for (i = 0; i < data.length; i++) {
ajaxHtml += '<li><span class="keyword">' + data[i].keyword + '</span><span class="count">' +
data[i].count + ' items<i class="iconfont">&#xe614;</i></span></li>';
... ...