From ec21d656adf3779dafe5aa3400a170ff54dd3c4e Mon Sep 17 00:00:00 2001 From: Luck-Xiaomi <1569717859@qq.com> Date: Thu, 9 Jun 2022 18:11:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=98=9F=E7=92=87=20?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E8=AE=BE=E5=A4=87=E7=BC=96=E5=8F=B7=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=99=BB=E5=BD=95=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/js/api/autoLogin-xingXuan.js | 5 +++++ src/pages/equipmentCenter/equipmentCenter.js | 12 +++++++----- src/pages/index/index.js | 14 ++++++++------ 3 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 src/assets/js/api/autoLogin-xingXuan.js diff --git a/src/assets/js/api/autoLogin-xingXuan.js b/src/assets/js/api/autoLogin-xingXuan.js new file mode 100644 index 00000000..1d3dbbac --- /dev/null +++ b/src/assets/js/api/autoLogin-xingXuan.js @@ -0,0 +1,5 @@ +import {post} from '../http' +// 星璇自动登录 +export function autoLogin(data) { + return post('/xmgl/base/getProjectUserByNumber', data) +} \ No newline at end of file diff --git a/src/pages/equipmentCenter/equipmentCenter.js b/src/pages/equipmentCenter/equipmentCenter.js index 682a2435..34e6c6c7 100644 --- a/src/pages/equipmentCenter/equipmentCenter.js +++ b/src/pages/equipmentCenter/equipmentCenter.js @@ -11,20 +11,22 @@ import '@/assets/style/button.less' import '@/assets/style/table.less' import '@/assets/style/dialog.less' import '@/assets/style/pagination.less' +import { autoLogin } from '@/assets/js/api/autoLogin-xingXuan' if (COMPANY == 'xingxuan') { // tag: 测试功能 if(window.location.href.indexOf('?project_id=') != -1) { const projectId = window.location.href.split('?project_id=')[1].split('&')[0]; - console.log('projectId: ', projectId); - // login() + login(projectId) } - function login() { + function login(projectNumber) { // TODO: 对接登录接口 - - parseLoginData(res.result); + autoLogin({ projectNumber }).then(res => { + if (res.code != 200) return + parseLoginData(res.result); + }) } function parseLoginData(data) { diff --git a/src/pages/index/index.js b/src/pages/index/index.js index fb260e07..fee8429f 100644 --- a/src/pages/index/index.js +++ b/src/pages/index/index.js @@ -20,7 +20,7 @@ import axios from 'axios' import { Message } from 'element-ui' import Pagination from '@/components/Pagination' import { resetForm } from '@/util' - +import { autoLogin } from '@/assets/js/api/autoLogin-xingXuan' // 全局组件挂载 Vue.component('Pagination', Pagination) @@ -32,14 +32,15 @@ if (COMPANY == 'xingxuan') { // tag: 测试功能 if(window.location.href.indexOf('?project_id=') != -1) { const projectId = window.location.href.split('?project_id=')[1].split('&')[0]; - console.log('projectId: ', projectId); - // login() + login(projectId) } - function login() { + function login(projectNumber) { // TODO: 对接登录接口 - - parseLoginData(res.result); + autoLogin({ projectNumber }).then(res => { + if (res.code != 200) return + parseLoginData(res.result); + }) } function parseLoginData(data) { @@ -135,6 +136,7 @@ if (COMPANY == 'xingxuan') { } } + let url = '' console.log(COMPANY) if(COMPANY == 'longguang'){