以渔有方跳转

master
huan.xu 5 years ago
parent 1e3dc5547a
commit ca3432c4f0
  1. 2
      src/api/app.js
  2. 17
      src/api/yyyf.js
  3. 28
      src/pages/index.vue

@ -10,6 +10,8 @@ export const userApi = 'https://www.zhixinchains.com/user'; //用户
export const FILE_URL = 'https://file.zhixinchains.com/'; //图片地址
export const yyyfApi = 'http://localhost:81101'; //用户
// export const c2cApi = 'https://c2c.flamex.io'; //法币
// export const btcApi = 'https://btc.flamex.io'; //BTC钱包
// export const eosApi = 'https://eos.flamex.io'; //EOS钱包

@ -0,0 +1,17 @@
import request from '@/utils/request';
import axios from 'axios';
import Cookie from '@/common/cookie';
import {getCurrentLanguage, languageCode2BELocalCode} from '@/common/i18n';
import {userApi, ethApi} from './app';
const Host = yyyfApi + '/';
//登录
export function signIn(data) {
return request({
method: 'post',
url: Host + 'loginFromYyyf/login',
params: data,
timeout: -1,
});
}

@ -295,7 +295,8 @@ import {getUsd, getRange, getCurrencyUrl} from '@/api/currency';
import {getGongGao, getLunbo} from '@/api/priceSysconf.js';
import {getCurrentLanguage} from '@/common/i18n';
import {FILE_URL} from '@/api/app';
import Cookie from '@/common/cookie';
import {signIn} from '@/api/yyyf';
//
import {getExchangeRateCookie} from '@/utils/auth';
@ -326,13 +327,13 @@ export default {
},
created() {
let params = this.parseUrl();
//
if (
!$.isEmptyObject(params) &&
params.userId != undefined &&
params.reqType != undefined
) {
alert(2);
location.href = '/';
this.loginFromYyyf(params);
}
//
@ -399,6 +400,27 @@ export default {
}
return params;
},
loginFromYyyf(data) {
signIn(data).then(res => {
// console.log(res);
if (res.data.code === 200) {
debugger;
this.loading = false;
//tokencookie
// Cookie.set('token', res.data.data.token);
localStorage.setItem('yyyfToken', res.data.data.token);
//cookie
// Cookie.set('userData', res.data.data);
localStorage.setItem('userData', JSON.stringify(res.data.data));
location.href = '/';
} else {
this.loading = false;
this.$message.warning(res.data.msg);
}
});
},
setSize1: function() {
var width =
window.innerWidth ||

Loading…
Cancel
Save