diff --git a/src/api/app.js b/src/api/app.js index 8184e33..edf7e6c 100644 --- a/src/api/app.js +++ b/src/api/app.js @@ -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钱包 diff --git a/src/api/yyyf.js b/src/api/yyyf.js new file mode 100644 index 0000000..d3e0492 --- /dev/null +++ b/src/api/yyyf.js @@ -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, + }); +} diff --git a/src/pages/index.vue b/src/pages/index.vue index f8e257a..2f9714a 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -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; + //保存登录的token到cookie + // 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 ||