Authored by QC-L

更新为 UFO APPID,修复登录弹出展示 review by 黄敬囿

@@ -3,7 +3,8 @@ export default { @@ -3,7 +3,8 @@ export default {
3 domains: { 3 domains: {
4 // production 4 // production
5 api: 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway', 5 api: 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway',
6 - yohoApi: 'http://api-test3.dev.yohocorp.com' 6 + yohoApi: 'http://api-test3.dev.yohocorp.com',
  7 + yohoLogin: 'http://java-yoho-wechat.test3.ingress.dev.yohocorp.com'
7 }, 8 },
8 apiParams: { 9 apiParams: {
9 client_type: 'miniapp', 10 client_type: 'miniapp',
@@ -16,15 +17,16 @@ export default { @@ -16,15 +17,16 @@ export default {
16 }, 17 },
17 unionType: '', // 渠道号 18 unionType: '', // 渠道号
18 // MINI_APP_DOMAIN: 'miniapp.yohobuy.com', 19 // MINI_APP_DOMAIN: 'miniapp.yohobuy.com',
19 - appid: 'wx193403dfd8cf74a1', 20 + appid: 'wxc677c88385762287',
20 business_line: 'miniapp', // 业务线 21 business_line: 'miniapp', // 业务线
21 - mini_app_type: '62', 22 + mini_app_type: '63',
22 }, 23 },
23 production: { 24 production: {
24 domains: { 25 domains: {
25 // production 26 // production
26 api: 'https://2.yohobuy.com', 27 api: 'https://2.yohobuy.com',
27 - yohoApi: 'https://api.yoho.cn' 28 + yohoApi: 'https://api.yoho.cn',
  29 + yohoLogin: 'https://api.yoho.cn'
28 }, 30 },
29 apiParams: { 31 apiParams: {
30 client_type: 'miniapp', 32 client_type: 'miniapp',
@@ -37,8 +39,8 @@ export default { @@ -37,8 +39,8 @@ export default {
37 }, 39 },
38 unionType: '', // 渠道号 40 unionType: '', // 渠道号
39 // MINI_APP_DOMAIN: 'miniapp.yohobuy.com', 41 // MINI_APP_DOMAIN: 'miniapp.yohobuy.com',
40 - appid: 'wx193403dfd8cf74a1', 42 + appid: 'wxc677c88385762287',
41 business_line: 'yohobuy', // 业务线 43 business_line: 'yohobuy', // 业务线
42 - mini_app_type: '62', 44 + mini_app_type: '63',
43 } 45 }
44 }[process.env.NODE_ENV]; 46 }[process.env.NODE_ENV];
@@ -77,7 +77,7 @@ export const decodeUnionId = (srd_session, result) => { @@ -77,7 +77,7 @@ export const decodeUnionId = (srd_session, result) => {
77 union_id = globalData.union_id; 77 union_id = globalData.union_id;
78 } 78 }
79 if (!union_id) { 79 if (!union_id) {
80 - throw new Error('union_id is null'); 80 + throw new Error('授权失败,请使用手机号登录');
81 } 81 }
82 // 网络上传头像,union_id,昵称 82 // 网络上传头像,union_id,昵称
83 login.sendWeChatUserDataWithUnionId(data.union_id, nickName, avatarUrl).catch(error => { 83 login.sendWeChatUserDataWithUnionId(data.union_id, nickName, avatarUrl).catch(error => {
1 const { GET, POST } = require('../request/request'); 1 const { GET, POST } = require('../request/request');
2 import config from '../../config.js' 2 import config from '../../config.js'
3 3
  4 +const WECHAT_SMALLPROGRAM_ONLOGIN = 'wechat.smallProgram.onLogin';
  5 +const WECHAT_SMALLPROGRAM_DECODEUSERINFO = 'wechat.smallProgram.decodeUserInfo';
  6 +
4 export default class BaseService { 7 export default class BaseService {
5 constructor(url) { 8 constructor(url) {
6 this.url = config.domains.api; 9 this.url = config.domains.api;
@@ -18,10 +21,19 @@ export default class BaseService { @@ -18,10 +21,19 @@ export default class BaseService {
18 this.url = config.domains.api; 21 this.url = config.domains.api;
19 return this; 22 return this;
20 } 23 }
  24 +
  25 + loginApi() {
  26 + this.url = config.domains.yohoLogin
  27 + return this;
  28 + }
21 29
22 async GET(params, options) { 30 async GET(params, options) {
  31 + let url = this.url;
  32 + if (params.method === WECHAT_SMALLPROGRAM_ONLOGIN || params.method === WECHAT_SMALLPROGRAM_DECODEUSERINFO) {
  33 + url = config.domains.yohoLogin;
  34 + }
23 return await GET({ 35 return await GET({
24 - url: this.url, 36 + url: url,
25 path: options && options.path ? options.path: '', 37 path: options && options.path ? options.path: '',
26 params: params, 38 params: params,
27 complete: options && options.complete ? options.complete: null 39 complete: options && options.complete ? options.complete: null