fix: 根据项目code个性化定制的bug

This commit is contained in:
caoqianming 2024-02-26 18:46:18 +08:00
parent 4918d99218
commit 8629e1bf61
6 changed files with 152 additions and 125 deletions

View File

@ -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

View File

@ -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: {

View File

@ -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": [
//首页 //首页

View File

@ -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({ this.$router.replace({
path: "/dashboard_enm", path: "/",
}); });
} else if (base_name_short == '光子科技') { } else {
this.$router.replace({ this.$router.replace({
path: "/dashboard_photon", path: "/rpm/rpj",
}); });
} else if (base_name_short == '超低排放') { }
that.$message.success("Login Success 登录成功");
that.islogin = false;
}
})
} else {
this.$router.replace({ this.$router.replace({
path: "/dashboard_enp", path: base_dashboard,
}); });
} }
// 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)

View File

@ -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>
@ -31,14 +35,16 @@
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: [ code: [
@ -90,11 +96,11 @@
that.$API.auth.info.get().then(res1 => { that.$API.auth.info.get().then(res1 => {
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));
if(this.$TOOL.data.get('BASE_INFO').base.base_name_short=='托克逊能管'){// let base_dashboard = this.$TOOL.data.get('BASE_INFO').base.base_dashboard;
this.$router.replace({ if (base_dashboard == null || base_dashboard == undefined) {
path: "/dashboard_enm", base_dashboard = '/dashboard'
}); }
}else{// if (this.$TOOL.data.get('BASE_INFO').base.base_name_short.indexOf('曲阳') != -1) {
that.$API.am.area.list.req({ page_size: 999 }).then(res => { that.$API.am.area.list.req({ page_size: 999 }).then(res => {
if (res.err_msg) { if (res.err_msg) {
} else { } else {
@ -114,6 +120,10 @@
that.islogin = false; that.islogin = false;
} }
}) })
} else {
this.$router.replace({
path: base_dashboard,
});
} }
}) })
}).catch(err => { }).catch(err => {
@ -127,6 +137,4 @@
} }
</script> </script>
<style> <style></style>
</style>

View File

@ -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') {
} else { req.project_code = process.env.VUE_APP_PJ;
project = '?project_code=' + that.project_code;
} }
that.$API.system.config.base.req(project).then((res) => { } else {
req.project_code = that.project_code;
}
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);