Commit aca7c7f4 by 张立顺

feat 神策功能开发

1 parent 7442e2e9
:root {
--header-background: #a3b6c6;
--header-color: #fff;
--menu-background: #2a3f54;
--menu-color: #fff;
--menu-active-color: #fff;
--main-background-color: #f0f1f7;
--main-color: #5f5efb;
--base-border: #5f5efb;
}
// 头部样式变量 // 头部样式变量
$header-height: 48px; $header-height: 48px;
$header-background: #a3b6c6; $header-background: var(--header-background);
$header-color: #fff; $header-color: var(--header-color);
$header-padding: 15px; $header-padding: 15px;
$logo-height: 124px; $logo-height: 124px;
// 左侧菜单样式变量 // 左侧菜单样式变量
$menu-background: #2a3f54; $menu-background: var(--menu-background);
$menu-color: #fff; $menu-color: var(--menu-color);
$menu-active-color: #fff; $menu-active-color: var(--menu-active-color);
// 主视图区样式变量 // 主视图区样式变量
$main-background-color: #f0f1f7; $main-background-color: var(--main-background-color);
$main-color: #5f5efb; $main-color: var(--main-color);
$menu-width: 208px; $menu-width: 208px;
$menu-width-collapse: 80px; $menu-width-collapse: 80px;
$base-border: #5f5efb; $base-border: var(--base-border);
$font-family: 'PingFangSC-Regular', 'Microsoft YaHei', '微软雅黑', 'MicrosoftJhengHei', 'STHeiti', 'MingLiu'; $font-family: 'PingFangSC-Regular', 'Microsoft YaHei', '微软雅黑', 'MicrosoftJhengHei', 'STHeiti', 'MingLiu';
$min-width: 1280px; $min-width: 1280px;
$left: 24px; $left: 24px;
......
...@@ -19,22 +19,22 @@ module.exports = { ...@@ -19,22 +19,22 @@ module.exports = {
// 头部样式变量 // 头部样式变量
header_height: '48px', header_height: '48px',
header_background: '#a3b6c6', header_background: 'var(--header-background)',
header_color: '#fff', header_color: 'var(--header-color)',
header_padding: '15px', header_padding: '15px',
logo_height: '70px', logo_height: '70px',
logo_menu_gap: '36px', logo_menu_gap: '36px',
// 左侧菜单样式变量 // 左侧菜单样式变量
menu_background: '#2a3f54', menu_background: 'var(--menu-background)',
menu_color: '#fff', menu_color: 'var(--menu-color)',
menu_active_color: '#fff', menu_active_color: 'var(--menu-active-color)',
// 主视图区样式变量 // 主视图区样式变量
main_background_color: '#f0f1f7', main_background_color: 'var(--main-background-color)',
main_color: '#5f5efb', main_color: 'var(--main-color)',
menu_width: '224px', menu_width: '224px',
menu_width_collapse: '64px', menu_width_collapse: '64px',
base_border: '#5f5efb', base_border: 'var(--base-border)',
font_family: `'PingFangSC-Regular', 'Microsoft YaHei', '微软雅黑', 'MicrosoftJhengHei', 'STHeiti', 'MingLiu'`, font_family: `'PingFangSC-Regular', 'Microsoft YaHei', '微软雅黑', 'MicrosoftJhengHei', 'STHeiti', 'MingLiu'`,
min_width: '1280px', min_width: '1280px',
left: '16px', left: '16px',
......
...@@ -15,7 +15,17 @@ export function customized(cdn, { assets, title }) { ...@@ -15,7 +15,17 @@ export function customized(cdn, { assets, title }) {
link.href = `${cdn}/assets/${assets}/favicon.ico` link.href = `${cdn}/assets/${assets}/favicon.ico`
document.getElementsByTagName('head')[0].appendChild(link) document.getElementsByTagName('head')[0].appendChild(link)
document.title = title document.title = title
if (assets === 'sc') {
setTheme('#08C489')
}
} }
export function setTheme(color) {
if (!color) return
document.documentElement.style.setProperty('--main-color', color)
document.documentElement.style.setProperty('--base-border', color)
}
export function getIcon(iconName) { export function getIcon(iconName) {
const { ICONS, DEFAULT_ICON_NAME } = constants const { ICONS, DEFAULT_ICON_NAME } = constants
return ICONS.includes(iconName) && ICONS.includes(iconName + '-active') ? iconName : DEFAULT_ICON_NAME return ICONS.includes(iconName) && ICONS.includes(iconName + '-active') ? iconName : DEFAULT_ICON_NAME
......
...@@ -21,7 +21,7 @@ export const fetchConfig = (isEnv = sw) => { ...@@ -21,7 +21,7 @@ export const fetchConfig = (isEnv = sw) => {
const _pathname = location.pathname const _pathname = location.pathname
const _login_path = _session?.loginpath const _login_path = _session?.loginpath
const _constRoutes = router.constantRoutes.map(({ path }) => path) const _constRoutes = router.constantRoutes.map(({ path }) => path)
// 如果存在配置缓存,并且当前路径不是用以区分不同产品的路由(oss:运营版,login:基础版,sp:服务商版 jl:冀联版).说明是刷新页面,则直接返回缓存的配置.另外如果当前路由与登录时缓存的路由一致,也直接返回缓存配置. // 如果存在配置缓存,并且当前路径不是用以区分不同产品的路由(oss:运营版,login:基础版,sp:服务商版 jl:冀联版 sc:神策版).说明是刷新页面,则直接返回缓存的配置.另外如果当前路由与登录时缓存的路由一致,也直接返回缓存配置.
if ((_config && !_constRoutes.includes(_pathname)) || _pathname === _login_path || (_pathname === '/' && _login_path === '/login')) { if ((_config && !_constRoutes.includes(_pathname)) || _pathname === _login_path || (_pathname === '/' && _login_path === '/login')) {
return Promise.resolve(_config) return Promise.resolve(_config)
} }
......
...@@ -228,7 +228,7 @@ export default { ...@@ -228,7 +228,7 @@ export default {
&.el-button--default { &.el-button--default {
&:hover, &:hover,
&:focus { &:focus {
border-color: #7777f3; border-color: $main-color;
color: $main-color !important; color: $main-color !important;
} }
} }
......
...@@ -8,6 +8,7 @@ import { Http } from 'glsk-common' ...@@ -8,6 +8,7 @@ import { Http } from 'glsk-common'
import '@/common/reg-prototype.js' import '@/common/reg-prototype.js'
import '@/common/error-handler.js' import '@/common/error-handler.js'
import { fetchConfig, config } from '@/config/index' import { fetchConfig, config } from '@/config/index'
import '@/assets/style/theme.css'
import '@/assets/style/index.scss' import '@/assets/style/index.scss'
import '@/assets/images/sprite/sprite.css' import '@/assets/images/sprite/sprite.css'
import './components' import './components'
......
...@@ -11,7 +11,8 @@ const Path = Object.freeze({ ...@@ -11,7 +11,8 @@ const Path = Object.freeze({
E404: '/404', E404: '/404',
OSS: '/oss', OSS: '/oss',
SP: '/sp', //Service Provider SP: '/sp', //Service Provider
JL: '/jl' JL: '/jl',
SC: '/sc'
}) })
// 路由 // 路由
let constantRoutes = Object.freeze([ let constantRoutes = Object.freeze([
...@@ -46,6 +47,12 @@ let constantRoutes = Object.freeze([ ...@@ -46,6 +47,12 @@ let constantRoutes = Object.freeze([
meta: { title: '冀联登录' } meta: { title: '冀联登录' }
}, },
{ {
path: Path.SC,
name: 'sc',
component: Login,
meta: { title: '神策登录' }
},
{
path: '/', path: '/',
redirect: Path.LOGIN // 默认加载的路由 redirect: Path.LOGIN // 默认加载的路由
} }
......
...@@ -38,6 +38,8 @@ const auth = { ...@@ -38,6 +38,8 @@ const auth = {
let { code, message, data, menus, sessionData } = await api.app.permission({ productCode, sessionId }) let { code, message, data, menus, sessionData } = await api.app.permission({ productCode, sessionId })
if (code == response.code_success_value) { if (code == response.code_success_value) {
menus = data[0]?.products[0]?.merchantProTreeResponses menus = data[0]?.products[0]?.merchantProTreeResponses
// 特殊账号菜单过滤
menus = handleSpecialMenuFilter(menus, merchant)
if (menus?.length) { if (menus?.length) {
data[0].active = true data[0].active = true
sessionData = { ...merchantItems, loginList: data, token: sessionId } sessionData = { ...merchantItems, loginList: data, token: sessionId }
...@@ -54,4 +56,112 @@ const auth = { ...@@ -54,4 +56,112 @@ const auth = {
} }
} }
} }
/**
* 处理特殊账号的菜单过滤
* Handle menu filtering for special accounts
* @param {Array} menus Original menu list
* @param {Object} merchant Merchant/User info
* @returns {Array} Filtered menu list
*/
function handleSpecialMenuFilter(menus, merchant) {
// 从全局配置中获取特殊账号过滤规则
// Get special account filtering rules from global configuration
const globalConfig = This('$config')
/**
* scMenuFilter: {
accountName: 'zhkchy',
merchantName: '中海康城花园',
pathname: '/',
keepLabel: '客户'
}
}
*/
const config = globalConfig?.scMenuFilter
// 如果没有配置或配置为空,则不进行过滤
if (!config) {
return menus
}
const { accountName, merchantName } = merchant || {}
// 检查是否满足特殊账号条件
const isSpecialAccount = accountName === config.accountName && merchantName === config.merchantName && location.pathname === config.pathname
if (isSpecialAccount && Array.isArray(menus)) {
// 1. 过滤逻辑:只留下 label == "客户" 的菜单
const filteredMenus = menus.filter(item => item.label === config.keepLabel)
// 2. 新增菜单 (TODO: 请根据实际菜单数据结构配置以下内容)
const findByLabel = (list, label) => {
for (let i = 0; i < list.length; i++) {
const item = list[i]
if (item?.label === label) return item
if (Array.isArray(item?.children) && item.children.length) {
const found = findByLabel(item.children, label)
if (found) return found
}
}
return null
}
const target = findByLabel(filteredMenus, '客户运营')
if (target) {
target.children = Array.isArray(target.children) ? target.children : []
const exists = target.children.some(child => child?.label === '神策-行为分析')
if (!exists) {
const scMenu = {
id: 2981,
label: '神策-行为分析',
value: null,
logo: null,
disabled: null,
parentId: 275,
superParentId: null,
menuUrl: '^',
functionUrl: null,
rootIds: '275-298',
children: [
{
id: 298101,
label: '用户行为路径',
value: null,
logo: null,
disabled: null,
parentId: 2735,
superParentId: null,
menuUrl: '/behaviorManage/pathList',
functionUrl: null,
rootIds: '2735-2938',
children: []
},
{
id: 298102,
label: 'LTV分析',
value: null,
logo: null,
disabled: null,
parentId: 2735,
superParentId: null,
menuUrl: '/behaviorManage/LTVList',
functionUrl: null,
rootIds: '2735-2938',
children: []
},
{
id: 298103,
label: '属性分析',
value: null,
logo: null,
disabled: null,
parentId: 2735,
superParentId: null,
menuUrl: '/behaviorManage/attributeList',
functionUrl: null,
rootIds: '2735-2938',
children: []
}
]
}
target.children.push(scMenu)
}
}
return filteredMenus
}
return menus
}
export default auth export default auth
<template> <template>
<div class="scrm-base-home"> <div class="scrm-base-home" :style="homeStyle">
<div class="login-header animate__animated animate__fadeInDown"> <div class="login-header animate__animated animate__fadeInDown">
<el-image :src="`${$config.cdn}/assets/${$config.customized.assets}/logo_login.png`"></el-image> <el-image :src="`${$config.cdn}/assets/${$config.customized.assets}/logo_login.png`"></el-image>
<h2>专注汽车行业数字化+智能营销解决方案——帮您的流量变销量</h2> <h2>专注汽车行业数字化+智能营销解决方案——帮您的流量变销量</h2>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<div class="left"> <div class="left">
<!-- <el-carousel height="500px" :autoplay="true" arrow="never"> --> <!-- <el-carousel height="500px" :autoplay="true" arrow="never"> -->
<!-- <el-carousel-item v-for="item in 3" :key="item"> --> <!-- <el-carousel-item v-for="item in 3" :key="item"> -->
<el-image :src="`${$config.cdn}/assets/images/banner1.png`"></el-image> <el-image :src="bannerSrc"></el-image>
<!-- </el-carousel-item> --> <!-- </el-carousel-item> -->
<!-- </el-carousel> --> <!-- </el-carousel> -->
</div> </div>
...@@ -104,6 +104,24 @@ export default { ...@@ -104,6 +104,24 @@ export default {
this.getCode() this.getCode()
this.clearAmimate() this.clearAmimate()
}, },
computed: {
isSc() {
return this.$config?.customized?.assets === 'sc'
},
bannerSrc() {
const cdn = this.$config?.cdn || ''
return this.isSc ? `${cdn}/assets/sc/banner2.png` : `${cdn}/assets/images/banner1.png`
},
homeStyle() {
const cdn = this.$config?.cdn || ''
const bg = this.isSc ? `${cdn}/assets/sc/bg1.png` : 'https://img02.glsx.com.cn/weapp/resource/saas/scrm/assets/images/bg.png'
return { backgroundImage: `url('${bg}')` }
},
disabled() {
return !this.loginForm.userName || !this.loginForm.password || !this.loginForm.codeToken || !this.loginForm.code || this.isLogin || !this.isPrivacyChecked
},
...mapGetters(['app'])
},
components: { components: {
[LoginSMSCodeCheck.name]: LoginSMSCodeCheck [LoginSMSCodeCheck.name]: LoginSMSCodeCheck
}, },
...@@ -143,12 +161,12 @@ export default { ...@@ -143,12 +161,12 @@ export default {
} }
} }
}, },
computed: { // computed: {
disabled() { // disabled() {
return !this.loginForm.userName || !this.loginForm.password || !this.loginForm.codeToken || !this.loginForm.code || this.isLogin || !this.isPrivacyChecked // return !this.loginForm.userName || !this.loginForm.password || !this.loginForm.codeToken || !this.loginForm.code || this.isLogin || !this.isPrivacyChecked
}, // },
...mapGetters(['app']) // ...mapGetters(['app'])
}, // },
/** /**
* 进入页面前 如果qiankun已运行 清空session数据1 * 进入页面前 如果qiankun已运行 清空session数据1
* 并刷新本页面 qiankun重新初始化(因为qiankun暂时不支持卸载加载过的应用,无法再次初始化子应用的信息) * 并刷新本页面 qiankun重新初始化(因为qiankun暂时不支持卸载加载过的应用,无法再次初始化子应用的信息)
...@@ -354,9 +372,10 @@ $border-radius: 20px; ...@@ -354,9 +372,10 @@ $border-radius: 20px;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
align-items: center; align-items: center;
background-color: $main-color; // background-color: $main-color;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/scrm/assets/images/bg.png') no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
background-position: center;
flex-direction: column; flex-direction: column;
.login-header { .login-header {
......
...@@ -292,7 +292,7 @@ export default { ...@@ -292,7 +292,7 @@ export default {
&:hover, &:hover,
&:focus { &:focus {
border-color: #7777f3; border-color: #7777f3;
color: $main-color !important; color: $main-color;
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!