fix: 根据项目code个性化定制的bug
This commit is contained in:
parent
4918d99218
commit
8629e1bf61
|
@ -6,6 +6,7 @@ NODE_ENV = development
|
||||||
# VUE_APP_TITLE = '托克逊能源管理平台'
|
# VUE_APP_TITLE = '托克逊能源管理平台'
|
||||||
# VUE_APP_TITLE = '中建材光子科技有限公司'
|
# VUE_APP_TITLE = '中建材光子科技有限公司'
|
||||||
VUE_APP_TITLE = '超低排放系统'
|
VUE_APP_TITLE = '超低排放系统'
|
||||||
|
VUE_APP_PJ = 'pf'
|
||||||
|
|
||||||
# 接口地址
|
# 接口地址
|
||||||
#VUE_APP_API_BASEURL = http://1.203.161.103:2800/api
|
#VUE_APP_API_BASEURL = http://1.203.161.103:2800/api
|
||||||
|
|
|
@ -406,9 +406,10 @@ export default {
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
base: {
|
base: {
|
||||||
|
url: `${config.API_URL}/system/base_config/`,
|
||||||
name: "账户信息",
|
name: "账户信息",
|
||||||
req: async function(project){
|
req: async function(data){
|
||||||
return await http.get(`${config.API_URL}/system/base_config${project}`);
|
return await http.get(this.url, data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getInfo: {
|
getInfo: {
|
||||||
|
|
|
@ -10,8 +10,7 @@ const routes = [
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "工作台",
|
"title": "工作台",
|
||||||
"icon": "el-icon-home-filled",
|
"icon": "el-icon-home-filled",
|
||||||
"type": "menu",
|
"type": "menu"
|
||||||
"perms": ["photon"]
|
|
||||||
},
|
},
|
||||||
"children": [
|
"children": [
|
||||||
//首页
|
//首页
|
||||||
|
|
|
@ -128,19 +128,33 @@ export default {
|
||||||
var res1 = await that.$API.auth.info.get();
|
var res1 = await that.$API.auth.info.get();
|
||||||
that.$TOOL.data.set("USER_INFO", res1);
|
that.$TOOL.data.set("USER_INFO", res1);
|
||||||
that.$TOOL.data.set("PERMISSIONS", Object.keys(res1.perms));
|
that.$TOOL.data.set("PERMISSIONS", Object.keys(res1.perms));
|
||||||
let base_name_short = this.$TOOL.data.get('BASE_INFO').base.base_name_short;
|
let base_dashboard = this.$TOOL.data.get('BASE_INFO').base.base_dashboard;
|
||||||
console.log(this.$TOOL.data.get('BASE_INFO'))
|
if (base_dashboard == null || base_dashboard == undefined) {
|
||||||
if (base_name_short == '托克逊能管') {
|
base_dashboard = '/dashboard'
|
||||||
|
}
|
||||||
|
if (this.$TOOL.data.get('BASE_INFO').base.base_name_short.indexOf('曲阳') != -1) {
|
||||||
|
that.$API.am.area.list.req({ page_size: 999 }).then(res => {
|
||||||
|
if (res.err_msg) {
|
||||||
|
} else {
|
||||||
|
debugger;
|
||||||
|
let areaList = res.results;
|
||||||
|
that.$TOOL.data.set("qyjyAreaList", areaList);
|
||||||
|
if (res1.type === 'employee') {
|
||||||
|
this.$router.replace({
|
||||||
|
path: "/",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$router.replace({
|
||||||
|
path: "/rpm/rpj",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
that.$message.success("Login Success 登录成功");
|
||||||
|
that.islogin = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
this.$router.replace({
|
this.$router.replace({
|
||||||
path: "/dashboard_enm",
|
path: base_dashboard,
|
||||||
});
|
|
||||||
} else if (base_name_short == '光子科技') {
|
|
||||||
this.$router.replace({
|
|
||||||
path: "/dashboard_photon",
|
|
||||||
});
|
|
||||||
} else if (base_name_short == '超低排放') {
|
|
||||||
this.$router.replace({
|
|
||||||
path: "/dashboard_enp",
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// if(this.$TOOL.data.get('BASE_INFO').base.base_name_short=='托克逊能管'){//托克逊
|
// if(this.$TOOL.data.get('BASE_INFO').base.base_name_short=='托克逊能管'){//托克逊
|
||||||
|
@ -175,6 +189,8 @@ export default {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
that.islogin = false;
|
that.islogin = false;
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
} finally {
|
||||||
|
that.islogin = false;
|
||||||
}
|
}
|
||||||
// var res = await this.$API.auth.token.post(data)
|
// var res = await this.$API.auth.token.post(data)
|
||||||
// console.log(res, err)
|
// console.log(res, err)
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
<template>
|
<template>
|
||||||
<el-form ref="loginForm" :model="form" :rules="rules" label-width="0" size="large" @keyup.enter="login">
|
<el-form ref="loginForm" :model="form" :rules="rules" label-width="0" size="large" @keyup.enter="login">
|
||||||
<el-form-item prop="phone" style="margin-bottom: 25px;">
|
<el-form-item prop="phone" style="margin-bottom: 25px;">
|
||||||
<el-input v-model="form.phone" prefix-icon="el-icon-iphone" clearable :placeholder="$t('login.mobilePlaceholder')">
|
<el-input v-model="form.phone" prefix-icon="el-icon-iphone" clearable
|
||||||
|
:placeholder="$t('login.mobilePlaceholder')">
|
||||||
<template #prepend>+86</template>
|
<template #prepend>+86</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="code" style="margin-bottom: 35px;">
|
<el-form-item prop="code" style="margin-bottom: 35px;">
|
||||||
<div class="login-msg-yzm">
|
<div class="login-msg-yzm">
|
||||||
<el-input v-model="form.code" prefix-icon="el-icon-unlock" clearable :placeholder="$t('login.smsPlaceholder')"></el-input>
|
<el-input v-model="form.code" prefix-icon="el-icon-unlock" clearable
|
||||||
<el-button @click="getYzm" :disabled="disabled">{{this.$t('login.smsGet')}}<span v-if="disabled"> ({{time}})</span></el-button>
|
:placeholder="$t('login.smsPlaceholder')"></el-input>
|
||||||
|
<el-button @click="getYzm" :disabled="disabled">{{ this.$t('login.smsGet') }}<span v-if="disabled">
|
||||||
|
({{ time }})</span></el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" style="width: 100%;" :loading="islogin" round @click="login">{{ $t('login.signIn') }}</el-button>
|
<el-button type="primary" style="width: 100%;" :loading="islogin" round @click="login">{{ $t('login.signIn')
|
||||||
|
}}</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <div class="login-reg">
|
<!-- <div class="login-reg">
|
||||||
{{$t('login.noAccount')}} <router-link to="/user_register">{{$t('login.createAccount')}}</router-link>
|
{{$t('login.noAccount')}} <router-link to="/user_register">{{$t('login.createAccount')}}</router-link>
|
||||||
|
@ -21,112 +25,116 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
phone: "",
|
phone: "",
|
||||||
code: "",
|
code: "",
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
phone: [
|
phone: [
|
||||||
{required: true, message: this.$t('login.mobileError')},
|
{ required: true, message: this.$t('login.mobileError') },
|
||||||
{validator: (rule, value, callback) => {
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
let reg = /^1[3456789]\d{9}$/;
|
let reg = /^1[3456789]\d{9}$/;
|
||||||
if (reg.test(value)) {
|
if (reg.test(value)) {
|
||||||
callback();
|
callback();
|
||||||
}else{
|
} else {
|
||||||
callback(new Error('请输入正确的手机号'));
|
callback(new Error('请输入正确的手机号'));
|
||||||
}
|
}
|
||||||
}}
|
|
||||||
|
|
||||||
],
|
|
||||||
code: [
|
|
||||||
{ required: true, message: "请输入验证码" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
disabled: false,
|
|
||||||
time: 0,
|
|
||||||
islogin: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async getYzm(){
|
|
||||||
let that = this;
|
|
||||||
var validate = await this.$refs.loginForm.validateField("phone").catch(()=>{})
|
|
||||||
if(!validate){ return false }
|
|
||||||
this.$API.auth.sms_code.req({phone:that.form.phone}).then(res=>{
|
|
||||||
this.$message.success(this.$t('login.smsSent'))
|
|
||||||
this.disabled = true;
|
|
||||||
this.time = 60
|
|
||||||
var t = setInterval(() => {
|
|
||||||
this.time -= 1
|
|
||||||
if(this.time < 1){
|
|
||||||
clearInterval(t)
|
|
||||||
this.disabled = false
|
|
||||||
this.time = 0
|
|
||||||
}
|
}
|
||||||
},1000)
|
|
||||||
}).catch(err=>{
|
|
||||||
this.disabled = false;
|
|
||||||
this.$message.warning(err)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async login(){
|
|
||||||
let that = this;
|
|
||||||
this.$refs.loginForm.validate(async (valid) => {
|
|
||||||
if (valid) {
|
|
||||||
this.$API.auth.login_sms_code.req(that.form).then(res=>{
|
|
||||||
that.$TOOL.cookie.set("TOKEN", res.access, {
|
|
||||||
expires: that.form.autologin ? 24 * 60 * 60 : 0,
|
|
||||||
});
|
|
||||||
that.$TOOL.data.set("TOKEN", res.access);
|
|
||||||
that.$TOOL.data.set("TOKEN_REFRESH", res.refresh);
|
|
||||||
that.$TOOL.cookie.set("TOKEN_REFRESH", res.refresh);
|
|
||||||
that.$TOOL.data.set("TOKEN_TIME", new Date().getTime());
|
|
||||||
that.$API.auth.info.get().then(res1=>{
|
|
||||||
that.$TOOL.data.set("USER_INFO", res1);
|
|
||||||
that.$TOOL.data.set("PERMISSIONS", Object.keys(res1.perms));
|
|
||||||
if(this.$TOOL.data.get('BASE_INFO').base.base_name_short=='托克逊能管'){//托克逊
|
|
||||||
this.$router.replace({
|
|
||||||
path: "/dashboard_enm",
|
|
||||||
});
|
|
||||||
}else{//曲阳金隅
|
|
||||||
that.$API.am.area.list.req({page_size:999}).then(res => {
|
|
||||||
if (res.err_msg) {
|
|
||||||
} else {
|
|
||||||
debugger;
|
|
||||||
let areaList = res.results;
|
|
||||||
that.$TOOL.data.set("qyjyAreaList", areaList);
|
|
||||||
if(res1.type==='employee'){
|
|
||||||
this.$router.replace({
|
|
||||||
path: "/",
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
this.$router.replace({
|
|
||||||
path: "/rpm/rpj",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
that.$message.success("Login Success 登录成功");
|
|
||||||
that.islogin = false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}).catch(err=>{
|
|
||||||
this.disabled = false;
|
|
||||||
this.$message.warning(err)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
],
|
||||||
|
code: [
|
||||||
|
{ required: true, message: "请输入验证码" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
disabled: false,
|
||||||
|
time: 0,
|
||||||
|
islogin: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getYzm() {
|
||||||
|
let that = this;
|
||||||
|
var validate = await this.$refs.loginForm.validateField("phone").catch(() => { })
|
||||||
|
if (!validate) { return false }
|
||||||
|
this.$API.auth.sms_code.req({ phone: that.form.phone }).then(res => {
|
||||||
|
this.$message.success(this.$t('login.smsSent'))
|
||||||
|
this.disabled = true;
|
||||||
|
this.time = 60
|
||||||
|
var t = setInterval(() => {
|
||||||
|
this.time -= 1
|
||||||
|
if (this.time < 1) {
|
||||||
|
clearInterval(t)
|
||||||
|
this.disabled = false
|
||||||
|
this.time = 0
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
}).catch(err => {
|
||||||
|
this.disabled = false;
|
||||||
|
this.$message.warning(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async login() {
|
||||||
|
let that = this;
|
||||||
|
this.$refs.loginForm.validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.$API.auth.login_sms_code.req(that.form).then(res => {
|
||||||
|
that.$TOOL.cookie.set("TOKEN", res.access, {
|
||||||
|
expires: that.form.autologin ? 24 * 60 * 60 : 0,
|
||||||
|
});
|
||||||
|
that.$TOOL.data.set("TOKEN", res.access);
|
||||||
|
that.$TOOL.data.set("TOKEN_REFRESH", res.refresh);
|
||||||
|
that.$TOOL.cookie.set("TOKEN_REFRESH", res.refresh);
|
||||||
|
that.$TOOL.data.set("TOKEN_TIME", new Date().getTime());
|
||||||
|
that.$API.auth.info.get().then(res1 => {
|
||||||
|
that.$TOOL.data.set("USER_INFO", res1);
|
||||||
|
that.$TOOL.data.set("PERMISSIONS", Object.keys(res1.perms));
|
||||||
|
let base_dashboard = this.$TOOL.data.get('BASE_INFO').base.base_dashboard;
|
||||||
|
if (base_dashboard == null || base_dashboard == undefined) {
|
||||||
|
base_dashboard = '/dashboard'
|
||||||
|
}
|
||||||
|
if (this.$TOOL.data.get('BASE_INFO').base.base_name_short.indexOf('曲阳') != -1) {
|
||||||
|
that.$API.am.area.list.req({ page_size: 999 }).then(res => {
|
||||||
|
if (res.err_msg) {
|
||||||
|
} else {
|
||||||
|
debugger;
|
||||||
|
let areaList = res.results;
|
||||||
|
that.$TOOL.data.set("qyjyAreaList", areaList);
|
||||||
|
if (res1.type === 'employee') {
|
||||||
|
this.$router.replace({
|
||||||
|
path: "/",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$router.replace({
|
||||||
|
path: "/rpm/rpj",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
that.$message.success("Login Success 登录成功");
|
||||||
|
that.islogin = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$router.replace({
|
||||||
|
path: base_dashboard,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
this.disabled = false;
|
||||||
|
this.$message.warning(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -158,13 +158,15 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
getDept() {
|
getDept() {
|
||||||
let that = this;
|
let that = this;
|
||||||
let project = '';
|
let req = {};
|
||||||
if (that.project_code == undefined) {
|
if (that.project_code == undefined || that.project_code == '#') {
|
||||||
project = '/';
|
if (process.env.NODE_ENV == 'development') {
|
||||||
|
req.project_code = process.env.VUE_APP_PJ;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
project = '?project_code=' + that.project_code;
|
req.project_code = that.project_code;
|
||||||
}
|
}
|
||||||
that.$API.system.config.base.req(project).then((res) => {
|
that.$API.system.config.base.req(req).then((res) => {
|
||||||
that.baseConfig = res.base;
|
that.baseConfig = res.base;
|
||||||
that.$store.commit("SET_baseName", res.base.base_name);
|
that.$store.commit("SET_baseName", res.base.base_name);
|
||||||
that.$store.commit("SET_baseLogo", res.base.base_logo);
|
that.$store.commit("SET_baseLogo", res.base.base_logo);
|
||||||
|
|
Loading…
Reference in New Issue