Commit 7bc28744c18a03e1ac869649ac05d049740b4d75

Authored by 王强
1 parent 9ad3c0a3

购好物,工会相关页面,兼容银联支付测试,修改接口请求头数据~

src/main.js
... ... @@ -558,6 +558,11 @@ Vue.prototype.http = function(path, data, callback, ext) {
558 558 params.shop.headers.Uid = data.uid;
559 559 }
560 560  
  561 + // 判断如果ext.headers存在,合并headers
  562 + if (typeof ext.headers === 'object') {
  563 + Object.assign(params[api].headers, ext.headers);
  564 + }
  565 +
561 566 // 判断请求类型
562 567 switch (method) {
563 568 case "POST":
... ...
src/pages/labourUnion/labourUnion.vue
... ... @@ -282,14 +282,41 @@
282 282  
283 283 // 加载中提示
284 284 Indicator.open("加载中...");
285   -
  285 +
  286 + // 设置扩展参数
  287 + let ext = {
  288 + method: "POST"
  289 + };
  290 +
  291 + // 判断如果在App内,设置请求头参数
  292 + if (this.isCNLive.value) {
  293 +
  294 + // 初始化headers
  295 + let headers = {};
  296 +
  297 + // 判断是否有version参数
  298 + if (this.$route.query.version) {
  299 + this.$set(headers, 'Version', this.$route.query.version);
  300 + }
  301 +
  302 + // 判断是否有device参数
  303 + if (this.$route.query.device) {
  304 + this.$set(headers, 'Phone-Model', this.$route.query.device);
  305 + }
  306 +
  307 + // 判断headers的值是否正确
  308 + if (headers.Version && headers['Phone-Model']) {
  309 +
  310 + // 设置ext中的headers参数
  311 + this.$set(ext, 'headers', headers);
  312 + }
  313 + }
  314 +
286 315 // 获取证书请求接口
287 316 this.http("/Api/" + (this.getApiVersion().index) + "/ghIndex", {
288 317 id: this.$route.query.ghId,
289 318 uid: (this.$route.query.uid || 0)
290   - }, this.ghIndexCallback, {
291   - method: "POST"
292   - });
  319 + }, this.ghIndexCallback, ext);
293 320 }
294 321 },
295 322  
... ...
src/pages/labourUnion2/labourUnion2.vue
... ... @@ -316,12 +316,39 @@
316 316 // 加载中提示
317 317 Indicator.open("加载中...");
318 318  
  319 + // 设置扩展参数
  320 + let ext = {
  321 + method: "POST"
  322 + };
  323 +
  324 + // 判断如果在App内,设置请求头参数
  325 + if (this.isCNLive.value) {
  326 +
  327 + // 初始化headers
  328 + let headers = {};
  329 +
  330 + // 判断是否有version参数
  331 + if (this.$route.query.version) {
  332 + this.$set(headers, 'Version', this.$route.query.version);
  333 + }
  334 +
  335 + // 判断是否有device参数
  336 + if (this.$route.query.device) {
  337 + this.$set(headers, 'Phone-Model', this.$route.query.device);
  338 + }
  339 +
  340 + // 判断headers的值是否正确
  341 + if (headers.Version && headers['Phone-Model']) {
  342 +
  343 + // 设置ext中的headers参数
  344 + this.$set(ext, 'headers', headers);
  345 + }
  346 + }
  347 +
319 348 // 获取证书请求接口
320 349 this.http("/Api/" + (this.getApiVersion().index) + "/ghOtherIndex", {
321 350 uid: (this.$route.query.uid || 0)
322   - }, this.ghOtherIndexCallback, {
323   - method: "POST"
324   - });
  351 + }, this.ghOtherIndexCallback, ext);
325 352 },
326 353  
327 354 /**
... ... @@ -852,10 +879,10 @@
852 879 document.addEventListener('visibilitychange', () => {
853 880  
854 881 // 页面显示出来了
855   - if (document.hidden === false && this.$route.name == 'labourUnion') {
  882 + if (document.hidden === false && this.$route.name == 'labourUnion2') {
856 883  
857 884 // 获取页面头部数据
858   - this.ghIndex();
  885 + this.ghOtherIndex();
859 886 }
860 887 });
861 888 }
... ...