Commit 629aacfb authored by 罗成兵's avatar 罗成兵

分配记录

parent 933ae6ea
NODE_ENV = dev NODE_ENV = dev
VUE_APP_BASE_URL2 = http://123.56.183.13:8083 VUE_APP_BASE_URL1 = http://123.56.183.13:8083
VUE_APP_BASE_URL = http://127.0.0.1:8082 VUE_APP_BASE_URL = http://127.0.0.1:8082
VUE_APP_BASE_PATH = https://beta-yac.yiboshi.com VUE_APP_BASE_PATH = https://beta-yac.yiboshi.com
VUE_APP_KEY_WORD = 'XwKsGlMcdPMEhR1B' VUE_APP_KEY_WORD = 'XwKsGlMcdPMEhR1B'
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"core-js": "^3.6.5", "core-js": "^3.6.5",
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
"http-parser-js": "^0.5.3", "http-parser-js": "^0.5.3",
"js-base64": "^3.6.1",
"moment": "^2.29.1", "moment": "^2.29.1",
"moment-locales-webpack-plugin": "^1.2.0", "moment-locales-webpack-plugin": "^1.2.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
......
...@@ -13,6 +13,7 @@ Vue.use(VueRouter) ...@@ -13,6 +13,7 @@ Vue.use(VueRouter)
const routes = [ const routes = [
{path: '/', redirect: activeUrl}, {path: '/', redirect: activeUrl},
{path: '/Login', component: () => import('@/views/Login.vue')},
{path: '/unitLogin', component: () => import('@/views/Login.vue')}, {path: '/unitLogin', component: () => import('@/views/Login.vue')},
{ {
path: '/Home', path: '/Home',
...@@ -64,14 +65,26 @@ const router = new VueRouter({ ...@@ -64,14 +65,26 @@ const router = new VueRouter({
// 路由守卫 // 路由守卫
router.beforeEach((to, form, next) => { router.beforeEach((to, form, next) => {
NProgress.start(); NProgress.start();
if (to.path === '/Home/folviteIndex') { // if (to.path === '/Home/folviteIndex') {
return next(); // return next();
}; // };
//未匹配到配置路由,默认跳转登录页
if (to.matched.length === 0){
next("/Login");
return ;
}
if (to.path==='/Login'){
next();
return;
}
const token = window.sessionStorage.getItem('token'); const token = window.sessionStorage.getItem('token');
console.log("path",to);
console.log("token",token);
if (token) { if (token) {
next(); next();
} else { } else {
window.top.postMessage({messageType:"LOGOUT"}, '*') next("/Login");
//window.top.postMessage({messageType:"LOGOUT"}, '*')
} }
}); });
router.afterEach((to, form, next) => { router.afterEach((to, form, next) => {
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<a-layout> <a-layout>
<a-layout-content class="layout_container" style="background: #fff"> <a-layout-content class="layout_container" style="background: #fff">
<div style="padding: 24px;"> <div style="padding: 24px;">
<a-tabs type="card" :tabBarGutter="10" v-model="$store.state.activeKeyInfo" @change="onChange"> <a-tabs type="card" :tabBarGutter="10" v-model="$store.state.activeKeyInfo" @change="onChange">
<a-tab-pane v-for="(item, index) in $store.state.tabsInfo" :key="item.frontActionUrl" > <a-tab-pane v-for="(item, index) in $store.state.tabsInfo" :key="item.frontActionUrl">
<span slot="tab"> <span slot="tab">
<span v-if="item.frontActionUrl != '/Home/distributionWarehousing' && item.frontActionUrl != '/Home/folviteApply'" <span v-if="item.frontActionUrl != '/Home/distributionWarehousing' && item.frontActionUrl != '/Home/folviteApply'"
>{{item.name}}</span> >{{item.name}}</span>
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
</span> </span>
<!--<span>{{item.name}}</span>--> <!--<span>{{item.name}}</span>-->
</span> </span>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
<router-view></router-view> <router-view></router-view>
</div> </div>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
data() { data() {
return { return {
// 菜单 // 菜单
menuList:[], menuList: [],
// 选中的菜单 // 选中的菜单
activeItem: [], activeItem: [],
// tabs标签 // tabs标签
...@@ -55,11 +55,10 @@ ...@@ -55,11 +55,10 @@
created() { created() {
//获取妇幼权限和登录基本信息 //获取妇幼权限和登录基本信息
// document.cookie = 'bGNnd3lwdF9hdA=8f26b5cc-1d66-4b31-8b86-26d916209e1e;'//昆明市 // document.cookie = 'bGNnd3lwdF9hdA=8f26b5cc-1d66-4b31-8b86-26d916209e1e;'//昆明市
document.cookie = 'bGNnd3lwdF9hdA=' + sessionStorage.getItem("loginToken") + ';'//云南省
document.cookie = 'bGNnd3lwdF9hdA=a551a5a0-aa58-45fe-be4a-9304aa60b594;'//云南省 let cookieToken = getCookie('bGNnd3lwdF9hdA');
let cookieToken = getCookie('bGNnd3lwdF9hdA')
if (cookieToken) {//根据cookie获取token并调用接口获取菜单并设置初始选中菜单 if (cookieToken) {//根据cookie获取token并调用接口获取菜单并设置初始选中菜单
window.sessionStorage.setItem('token','bearer'+' ' + cookieToken); //window.sessionStorage.setItem('token', 'bearer' + ' ' + cookieToken);
let par = {} let par = {}
this.$api.fyManage.fetchFYLoginUser(par).then(({data}) => { this.$api.fyManage.fetchFYLoginUser(par).then(({data}) => {
// window.sessionStorage.setItem('menuList', JSON.stringify(data.menuList)); // window.sessionStorage.setItem('menuList', JSON.stringify(data.menuList));
...@@ -70,7 +69,7 @@ ...@@ -70,7 +69,7 @@
}) })
} else { } else {
console.log('没有token') console.log('没有token')
window.top.postMessage({messageType:"LOGOUT"}, '*')//给最顶层窗口发送token失效通知 window.top.postMessage({messageType: "LOGOUT"}, '*')//给最顶层窗口发送token失效通知
return return
} }
}, },
...@@ -87,7 +86,7 @@ ...@@ -87,7 +86,7 @@
window.sessionStorage.setItem('activeItem', '/Home/inStock') window.sessionStorage.setItem('activeItem', '/Home/inStock')
} }
if (!window.sessionStorage.getItem('activeKey')) { if (!window.sessionStorage.getItem('activeKey')) {
this.$router.push({path:'/Home/inStock'}) this.$router.push({path: '/Home/inStock'})
this.$store.commit('changeActKey', '/Home/inStock') this.$store.commit('changeActKey', '/Home/inStock')
} }
const tabs = JSON.parse(window.sessionStorage.getItem('tabs')); const tabs = JSON.parse(window.sessionStorage.getItem('tabs'));
...@@ -123,25 +122,29 @@ ...@@ -123,25 +122,29 @@
<style lang="less"> <style lang="less">
.index_body { .index_body {
.ant-tabs-bar { .ant-tabs-bar {
border-bottom: 1px solid rgba(255,77,128,.2)!important; border-bottom: 1px solid rgba(255, 77, 128, .2) !important;
} }
.ant-tabs-nav-scroll { .ant-tabs-nav-scroll {
margin-left: 0px!important; margin-left: 0px !important;
} }
.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container { .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container {
height: 35px!important; height: 35px !important;
} }
.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab { .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab {
height: 35px!important; height: 35px !important;
color: #F8F8FF!important; color: #F8F8FF !important;
line-height: 35px!important; line-height: 35px !important;
background: rgba(255,77,128, .5); background: rgba(255, 77, 128, .5);
border-bottom: 0px solid #FF4D80; border-bottom: 0px solid #FF4D80;
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-top-right-radius: 10px; border-top-right-radius: 10px;
} }
.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active { .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active {
height: 35px!important; height: 35px !important;
color: #fff; color: #fff;
background: #FF4D80; background: #FF4D80;
border-color: #FF4D80; border-color: #FF4D80;
......
...@@ -13,30 +13,33 @@ ...@@ -13,30 +13,33 @@
</a-input> </a-input>
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop="password"> <a-form-model-item prop="password">
<a-input-password placeholder="请输入密码" v-model="formData.password" size="large" @keyup.enter="login"> <a-input-password placeholder="请输入密码" v-model="formData.password" size="large"
@keyup.enter="login">
<a-icon slot="prefix" type="lock"/> <a-icon slot="prefix" type="lock"/>
</a-input-password> </a-input-password>
</a-form-model-item> </a-form-model-item>
<a-form-model-item v-show="!captchaVerificationVis"> <a-form-model-item v-show="!captchaVerificationVis">
<Verify <Verify
@success="success" @success="success"
:mode="'fixed'" :mode="'fixed'"
:captchaType="'blockPuzzle'" :captchaType="'blockPuzzle'"
:imgSize="{ :imgSize="{
width: '340px', width: '340px',
height: '155px', height: '155px',
}" }"
ref="verify" ref="verify"
></Verify> ></Verify>
</a-form-model-item> </a-form-model-item>
<a-form-model-item v-show="captchaVerificationVis"> <a-form-model-item v-show="captchaVerificationVis">
<a-alert <a-alert
message="验证通过" message="验证通过"
type="success" type="success"
show-icon show-icon
/> />
</a-form-model-item> </a-form-model-item>
<a-button @click="login" type="primary" block size="large" :disabled="!captchaVerificationVis" :loading="loading" @keyup.enter="login">登录</a-button> <a-button @click="login" type="primary" block size="large" :disabled="!captchaVerificationVis"
:loading="loading" @keyup.enter="login">登录
</a-button>
<!-- <a href="javascript:;" style="float: right;text-decoration: none;" @click="toNetwork">网点管理登录</a> --> <!-- <a href="javascript:;" style="float: right;text-decoration: none;" @click="toNetwork">网点管理登录</a> -->
</a-form-model> </a-form-model>
</div> </div>
...@@ -45,15 +48,16 @@ ...@@ -45,15 +48,16 @@
</template> </template>
<script> <script>
import Verify from "@/views/components/verifition/Verify"; import Verify from "@/views/components/verifition/Verify";
import {aesEncrypt} from "@/views/components/verifition/utils/ase"
import {getEnumByFlag} from "./utils/common"; import {getEnumByFlag} from "./utils/common";
import {singleLogin, aesEncrypt} from "./utils/loginApi";
export default { export default {
components: {Verify}, components: {Verify},
data() { data() {
return { return {
formData: {username:"",password:""}, formData: {username: "530000yyb", password: "ynby2020"},
formRules: {}, formRules: {},
captchaVerificationVis: false, captchaVerificationVis: true,
captchaVerification: {}, captchaVerification: {},
loading: false, loading: false,
} }
...@@ -63,40 +67,26 @@ ...@@ -63,40 +67,26 @@
methods: { methods: {
login() { login() {
this.loading = true; this.loading = true;
const {username, password} = this.formData let fromData = new FormData();
let params = { fromData.append("username", aesEncrypt(this.formData.username));
userName: username || '', fromData.append("password", aesEncrypt(this.formData.password));
password: password || '' fromData.append(
} "captchaVerification",
this.$api.common.login(params).then(({code, data}) => { this.captchaVerification.captchaVerification
this.loading = false; );
if (code === 'SUCCESS') { singleLogin(fromData).then(res => {
this.$message.success('登录成功!'); if (res.data.code === "SUCCESS") {
this.getAllEnum() console.log("登录成功", res.data.data);
window.sessionStorage.setItem('token', data.token); sessionStorage.setItem('token', 'bearer' + ' ' + res.data.data.token);
window.sessionStorage.setItem('loginType', data.userInfo.userType); this.$router.push('/')
window.sessionStorage.setItem('menuList', JSON.stringify(data.menuList)); this.$message.success(res.data.msg)
window.sessionStorage.setItem('userInfo', JSON.stringify(data.userInfo)); }else {
window.sessionStorage.setItem('networkInfo', JSON.stringify(data.networkInfo)); this.$message.error(res.data.msg)
if (data.userInfo.userType === 1) {
this.$router.push('/Home/index');
window.sessionStorage.setItem('activeItem', '/Home/index');
}
if (data.userInfo.userType === 2) {
this.$router.push('/supply/supplyIndex');
window.sessionStorage.setItem('activeItem', '/supply/supplyIndex');
window.sessionStorage.setItem('openKeys', 78);
}
}
})
},
getAllEnum() {
let par= {}
this.$api.common.fetchAllEnum(par).then(({data, code}) => {
if (code == 'SUCCESS') {
window.sessionStorage.setItem('allEnum', JSON.stringify(data))
} }
}) this.loading = false;
}).catch(res => {
this.loading = false;
});
}, },
toNetwork() { toNetwork() {
this.$router.push('/networkPortLogin') this.$router.push('/networkPortLogin')
......
...@@ -11,7 +11,21 @@ ...@@ -11,7 +11,21 @@
name: "commonCode", name: "commonCode",
methods: { methods: {
searchList() { searchList() {
//确认提示框
this.$confirm({
title: 'Do you Want to delete these items?',
content: "",
onOk() {
console.log('OK');
},
onCancel() {
console.log('Cancel');
},
class: 'test',
});
this.$message.success('This is a success message');
this.$message.error('This is an error message');
this.$message.warning('This is a warning message');
}, },
downloadExcel() { downloadExcel() {
......
import axios from 'axios';
import {Base64} from "js-base64";
import CryptoJS from 'crypto-js'
let SIGN_HOST = "https://beta-yac.yiboshi.com";
let JQ_SECRET = "jq:jqsecret";
let COOKIE = 'bGNnd3lwdF9hdA';
const instance = axios.create({
baseURL: SIGN_HOST,
withCredentials: true,
timeout: 60000
});
// request 拦截器
instance.interceptors.request.use(
config => {
if (config.url == "/authentication/form") {
let LoginToken = Base64.encode(JQ_SECRET);
config.headers.Authorization = `Basic ${LoginToken}`;
} else {
let token = getCookie(COOKIE);
config.headers.Authorization = `bearer ${token}`;
}
return config;
},
error => {
return Promise.reject(error);
})
export const singleLogin = data => {
return instance({
url: "/authentication/form",
method: "post",
data
});
};
export const aesEncrypt = word => {
let KEY_WORD='XwKsGlMcdPMEhR1B';
var key = CryptoJS.enc.Utf8.parse(KEY_WORD);
var srcs = CryptoJS.enc.Utf8.parse(word);
var encrypted = CryptoJS.AES.encrypt(srcs, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
return encrypted.toString();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment