Authored by 陈轩

Merge remote-tracking branch 'origin/release/5.1' into release/5.1

@@ -184,6 +184,10 @@ exports.addressModify = (req, res, next) => { @@ -184,6 +184,10 @@ exports.addressModify = (req, res, next) => {
184 * @param next 184 * @param next
185 */ 185 */
186 exports.locationList = (req, res, next) => { 186 exports.locationList = (req, res, next) => {
  187 + res.set({
  188 + 'Cache-Control': 'max-age=600'
  189 + });
  190 +
187 addressModel.locationList({ 191 addressModel.locationList({
188 uid: req.user.uid 192 uid: req.user.uid
189 }).then(result => { 193 }).then(result => {
@@ -155,6 +155,12 @@ const index = (req, res) => { @@ -155,6 +155,12 @@ const index = (req, res) => {
155 155
156 // ajax 请求分期专享商品 156 // ajax 请求分期专享商品
157 const getInstallmentGoods = (req, res) => { 157 const getInstallmentGoods = (req, res) => {
  158 + let allowOrigin = _.get(req, 'headers.origin', null) ?
  159 + req.headers.origin : req.protocol + '://' + req.headers.host;
  160 +
  161 + res.setHeader('Access-Control-Allow-Origin', allowOrigin);
  162 + res.setHeader('Access-Control-Allow-Credentials', 'true');
  163 +
158 let params = req.query || {}; 164 let params = req.query || {};
159 165
160 installmentModel.getSearchIntallment(params).then((result) => { 166 installmentModel.getSearchIntallment(params).then((result) => {
@@ -193,6 +193,7 @@ function bindAddressListEvent(html) { @@ -193,6 +193,7 @@ function bindAddressListEvent(html) {
193 if (window.localStorage && window.localStorage.getItem) { 193 if (window.localStorage && window.localStorage.getItem) {
194 chinaAddressList = window.localStorage.getItem('chinaAddressList'); 194 chinaAddressList = window.localStorage.getItem('chinaAddressList');
195 } 195 }
  196 +
196 if (chinaAddressList) { 197 if (chinaAddressList) {
197 bindAddressListEvent(chinaAddressList); 198 bindAddressListEvent(chinaAddressList);
198 } else { 199 } else {
@@ -201,12 +202,14 @@ if (chinaAddressList) { @@ -201,12 +202,14 @@ if (chinaAddressList) {
201 $.ajax({ 202 $.ajax({
202 method: 'GET', 203 method: 'GET',
203 url: '/home/locationList', 204 url: '/home/locationList',
204 - timeout: 60000 205 + timeout: 60000,
  206 + cache: true
205 }).then(function(html) { 207 }).then(function(html) {
206 bindAddressListEvent(html); 208 bindAddressListEvent(html);
207 - if (window.localStorage && window.localStorage.setItem) {  
208 - window.localStorage.setItem('chinaAddressList', html);  
209 - } 209 +
  210 + // if (window.localStorage && window.localStorage.setItem) {
  211 + // window.localStorage.setItem('chinaAddressList', html);
  212 + // }
210 }).fail(function() { 213 }).fail(function() {
211 tip.show('获取省市区列表失败'); 214 tip.show('获取省市区列表失败');
212 }); 215 });
@@ -54,10 +54,13 @@ ListData.prototype.getListData = function(page) { @@ -54,10 +54,13 @@ ListData.prototype.getListData = function(page) {
54 loading.showLoadingMask(); 54 loading.showLoadingMask();
55 $.ajax({ 55 $.ajax({
56 type: 'GET', 56 type: 'GET',
57 - url: self.opt.url, 57 + url: 'http:' + '//m.yohobuy.com' + self.opt.url,
58 data: { 58 data: {
59 page: this.opt.page 59 page: this.opt.page
60 }, 60 },
  61 + xhrFields: {
  62 + withCredentials: true
  63 + },
61 dataType: 'html', 64 dataType: 'html',
62 success: function(data) { 65 success: function(data) {
63 var $this, $title; 66 var $this, $title;
@@ -51,7 +51,7 @@ require('../../common'); @@ -51,7 +51,7 @@ require('../../common');
51 if (isApp) { 51 if (isApp) {
52 $.ajax({ 52 $.ajax({
53 type: 'GET', 53 type: 'GET',
54 - url: '/product/index/shopAppCookie', 54 + url: location.protocol + '//m.yohobuy.com/product/index/shopAppCookie',
55 xhrFields: { 55 xhrFields: {
56 withCredentials: true 56 withCredentials: true
57 }, 57 },
@@ -63,7 +63,7 @@ require('../../common'); @@ -63,7 +63,7 @@ require('../../common');
63 63
64 $.ajax({ 64 $.ajax({
65 type: 'GET', 65 type: 'GET',
66 - url: '/product/index/shopFav', 66 + url: location.protocol + '//m.yohobuy.com/product/index/shopFav',
67 xhrFields: { 67 xhrFields: {
68 withCredentials: true 68 withCredentials: true
69 }, 69 },