Skip to content

Commit

Permalink
Merge pull request #482 from terlinhe/v1.0.2
Browse files Browse the repository at this point in the history
V1.0.2
  • Loading branch information
ielgnaw authored Aug 31, 2022
2 parents 905ccfb + c345ca2 commit 9d95994
Show file tree
Hide file tree
Showing 293 changed files with 12,552 additions and 2,497 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ module.exports = {
BK_API_URL_TMPL: false,
BKPAAS_ENVIRONMENT: false,
BK_ITSM_URL: false,
BK_APP_APIGW_PREFIX: false
BK_APP_APIGW_PREFIX: false,
BKPAAS_ENGINE_REGION: false,
BK_IAM_HOST: false,
IAM_ENABLE: false
},
// add your custom rules hered
rules: {
Expand Down
11 changes: 9 additions & 2 deletions lib/client/build/webpack.dev.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const postcssPlugins = require('./postcss-plugins')
const clientConf = require('./conf')
const httpConf = require('../../server/conf/http')
const iamConf = require('../../server/conf/iam')
const { pathToNodeModules } = require('./util')
const baseConf = require('./webpack.base.conf')
const manifest = require('../static/lib-manifest.json')
Expand Down Expand Up @@ -150,7 +151,10 @@ const webpackConfig = merge(baseConf, {
staticUrl: clientConf.dev.staticUrl,
BKPAAS_ENVIRONMENT: clientConf.dev.BKPAAS_ENVIRONMENT,
BK_ITSM_URL: httpConf.itsmUrl,
BK_APP_APIGW_PREFIX: (httpConf.apiGateWayUrlTmpl && (httpConf.apiGateWayUrlTmpl.replace('{api_name}', 'bk-lesscode') + '/' + clientConf.build.LESSCODE_ENVIRONMENT)) || ''
BK_APP_APIGW_PREFIX: (httpConf.apiGateWayUrlTmpl && (httpConf.apiGateWayUrlTmpl.replace('{api_name}', 'bk-lesscode') + '/' + clientConf.build.LESSCODE_ENVIRONMENT)) || '',
BKPAAS_ENGINE_REGION: httpConf.authName === 'bk_token' ? 'default' : 'ieod',
BK_IAM_HOST: iamConf.IAM_SAAS_HOST,
IAM_ENABLE: false
}),

new HtmlWebpackPlugin({
Expand All @@ -160,7 +164,10 @@ const webpackConfig = merge(baseConf, {
staticUrl: clientConf.dev.staticUrl,
BKPAAS_ENVIRONMENT: clientConf.dev.BKPAAS_ENVIRONMENT,
BK_ITSM_URL: httpConf.itsmUrl,
BK_APP_APIGW_PREFIX: (httpConf.apiGateWayUrlTmpl && (httpConf.apiGateWayUrlTmpl.replace('{api_name}', 'bk-lesscode') + '/' + clientConf.build.LESSCODE_ENVIRONMENT)) || ''
BK_APP_APIGW_PREFIX: (httpConf.apiGateWayUrlTmpl && (httpConf.apiGateWayUrlTmpl.replace('{api_name}', 'bk-lesscode') + '/' + clientConf.build.LESSCODE_ENVIRONMENT)) || '',
BKPAAS_ENGINE_REGION: httpConf.authName === 'bk_token' ? 'default' : 'ieod',
BK_IAM_HOST: iamConf.IAM_SAAS_HOST,
IAM_ENABLE: false
}),

new FriendlyErrorsPlugin()
Expand Down
10 changes: 8 additions & 2 deletions lib/client/build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const postcssPlugins = require('./postcss-plugins')
const ReplaceStaticUrlPlugin = require('./replace-static-url-plugin')
const clientConf = require('./conf')
const httpConf = require('../../server/conf/http')
const iamConf = require('../../server/conf/iam')
const { pathToNodeModules } = require('./util')
const baseConf = require('./webpack.base.conf')
const manifest = require('../static/lib-manifest.json')
Expand Down Expand Up @@ -244,7 +245,10 @@ module.exports = merge(baseConf, {
staticUrl: clientConf.build.staticUrl,
BKPAAS_ENVIRONMENT: clientConf.build.BKPAAS_ENVIRONMENT,
BK_ITSM_URL: httpConf.itsmUrl,
BK_APP_APIGW_PREFIX: (httpConf.apiGateWayUrlTmpl && (httpConf.apiGateWayUrlTmpl.replace('{api_name}', 'bk-lesscode') + '/' + clientConf.build.LESSCODE_ENVIRONMENT)) || ''
BK_APP_APIGW_PREFIX: (httpConf.apiGateWayUrlTmpl && (httpConf.apiGateWayUrlTmpl.replace('{api_name}', 'bk-lesscode') + '/' + clientConf.build.LESSCODE_ENVIRONMENT)) || '',
BKPAAS_ENGINE_REGION: httpConf.authName === 'bk_token' ? 'default' : 'ieod',
BK_IAM_HOST: iamConf.IAM_SAAS_HOST,
IAM_ENABLE: true
}),

new HtmlWebpackPlugin({
Expand All @@ -265,7 +269,9 @@ module.exports = merge(baseConf, {
staticUrl: clientConf.build.staticUrl,
BKPAAS_ENVIRONMENT: clientConf.build.BKPAAS_ENVIRONMENT,
BK_ITSM_URL: httpConf.itsmUrl,
BK_APP_APIGW_PREFIX: (httpConf.apiGateWayUrlTmpl && (httpConf.apiGateWayUrlTmpl.replace('{api_name}', 'bk-lesscode') + '/' + clientConf.build.LESSCODE_ENVIRONMENT)) || ''
BK_APP_APIGW_PREFIX: (httpConf.apiGateWayUrlTmpl && (httpConf.apiGateWayUrlTmpl.replace('{api_name}', 'bk-lesscode') + '/' + clientConf.build.LESSCODE_ENVIRONMENT)) || '',
BK_IAM_HOST: iamConf.IAM_SAAS_HOST,
IAM_ENABLE: true
}),

new MiniCssExtractPlugin({
Expand Down
3 changes: 3 additions & 0 deletions lib/client/index-dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
var STATIC_URL = '<%= htmlWebpackPlugin.options.staticUrl %>'
var BKPAAS_ENVIRONMENT = '<%= htmlWebpackPlugin.options.BKPAAS_ENVIRONMENT %>'
var BK_API_URL_TMPL = '{{ BK_API_URL_TMPL }}'
var BKPAAS_ENGINE_REGION = '<%= htmlWebpackPlugin.options.BKPAAS_ENGINE_REGION %>'
var BK_IAM_HOST = '<%= htmlWebpackPlugin.options.BK_IAM_HOST %>'
var IAM_ENABLE = <%= htmlWebpackPlugin.options.IAM_ENABLE %>
</script>

<%= require('html-loader!./require-monaco.html') %>
Expand Down
3 changes: 3 additions & 0 deletions lib/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
var STATIC_URL = '<%= htmlWebpackPlugin.options.staticUrl %>'
var BKPAAS_ENVIRONMENT = '<%= htmlWebpackPlugin.options.BKPAAS_ENVIRONMENT %>'
var BK_API_URL_TMPL = '{{ BK_API_URL_TMPL }}'
var BKPAAS_ENGINE_REGION = '<%= htmlWebpackPlugin.options.BKPAAS_ENGINE_REGION %>'
var BK_IAM_HOST = '<%= htmlWebpackPlugin.options.BK_IAM_HOST %>'
var IAM_ENABLE = <%= htmlWebpackPlugin.options.IAM_ENABLE %>
</script>
<%= require('html-loader!./require-monaco.html') %>
</body>
Expand Down
5 changes: 4 additions & 1 deletion lib/client/preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,16 @@
var BKPAAS_ENVIRONMENT = '<%= htmlWebpackPlugin.options.BKPAAS_ENVIRONMENT %>'
var BK_ITSM_URL = '<%= htmlWebpackPlugin.options.BK_ITSM_URL %>'
var BK_APP_APIGW_PREFIX = '<%= htmlWebpackPlugin.options.BK_APP_APIGW_PREFIX %>'
var BKPAAS_ENGINE_REGION = '<%= htmlWebpackPlugin.options.BKPAAS_ENGINE_REGION %>'
var BK_IAM_HOST = '<%= htmlWebpackPlugin.options.BK_IAM_HOST %>'
var IAM_ENABLE = <%= htmlWebpackPlugin.options.IAM_ENABLE %>

const recalculate = () => {
const html = window.document.documentElement
const clientWidth = html.clientWidth || 375
html.style.fontSize = `${clientWidth / 20}px`
}

window.addEventListener('resize', recalculate, false)
window.document.addEventListener('DOMContentLoaded', recalculate, false)
</script>
Expand Down
113 changes: 107 additions & 6 deletions lib/client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,43 @@

<template>
<section v-if="emptyPage" class="preview-page">
<router-view :name="topView" />
<not-exist v-if="isNotExist" :message="notExistMsg" />
<template v-else>
<apply-page v-if="isNotPermission" :auth-result="authResult" />
<router-view v-if="!isNotPermission" :name="topView" />
</template>
</section>
<section v-else-if="authed">
<div id="app" :class="systemCls">
<home-header v-if="homeHeaderNav"></home-header>
<app-header v-else></app-header>
<router-view :name="topView" v-show="!mainContentLoading" />
<not-exist v-if="isNotExist" :message="notExistMsg" />
<template v-else>
<apply-page v-if="isNotPermission" :auth-result="authResult" />
<router-view v-if="!isNotPermission" :name="topView" v-show="!mainContentLoading" />
</template>
</div>
<bk-fixed-navbar v-if="!isCanvas"
<bk-fixed-navbar
:ext-cls="hasFooterBar ? 'nav-footer-bar' : 'no-footer-bar'"
:style="showFixedNavBar ? 'transform: translateY(-50%); opacity: 1' : 'transform: translateY(100%); opacity: 0'"
:position="position"
:nav-items="navItems"></bk-fixed-navbar>
<div class="nav-icon" @click="toggerNavbar" :class="hasFooterBar ? 'nav-icon-footer' : 'nav-icon-bottom'">
<i class="bk-drag-icon bk-drag-arrow-down toggle-arrow" :class="showFixedNavBar ? 'nav-icon-down' : 'nav-icon-up'" />
</div>
</section>
</template>
<script>
import { mapGetters } from 'vuex'
import { bus } from './common/bus'
import ApplyPage from './components/apply-permission/apply-page.vue'
export default {
name: 'app',
components: {
ApplyPage
},
data () {
return {
systemCls: 'mac',
Expand All @@ -57,7 +73,15 @@
],
routerNameData: ['/home', '/help'],
homeHeaderNav: true,
appTabData: [{ name: '产品介绍', url: '/', routerName: 'home' }, { name: '帮助文档', url: '/help', routerName: 'intro' }]
appTabData: [{ name: '产品介绍', url: '/', routerName: 'home' }, { name: '帮助文档', url: '/help', routerName: 'intro' }],
isNotPermission: false,
authResult: {
requiredPermissions: []
},
isNotExist: false,
notExistMsg: '',
hasFooterBar: false,
showFixedNavBar: true
}
},
Expand All @@ -82,15 +106,29 @@
'$route': {
handler (value) {
if (value.matched[0]) {
this.$nextTick(() => {
this.hasFooterBar = !!document.getElementsByClassName('footer').length
})
this.homeHeaderNav = this.routerNameData.includes(value.matched[0].path) || this.routerNameData.includes(value.fullPath + value.name)
}
this.isNotPermission = false
this.isNotExist = false
},
immediate: true
}
},
async created () {
await this.$store.dispatch('isPlatformAdmin')
bus.$on('permission-page', this.permissionHold)
this.$once('hook:beforeDestroy', () => {
bus.$off('permission-page', this.permissionHold)
})
bus.$on('not-exist', this.notExistHold)
this.$once('hook:beforeDestroy', () => {
bus.$off('not-exist', this.notExistHold)
})
await this.$store.dispatch('checkIamNoResourcesPerm')
},
mounted () {
Expand All @@ -101,6 +139,21 @@
bus.$on('redirect-login', data => {
window.location.replace(data.loginUrl)
})
},
methods: {
permissionHold (authResult) {
this.isNotPermission = true
this.authResult = authResult
},
notExistHold (msg) {
this.isNotExist = true
this.notExistMsg = msg
},
toggerNavbar () {
this.showFixedNavBar = !this.showFixedNavBar
}
}
}
</script>
Expand Down Expand Up @@ -134,6 +187,54 @@
z-index: 9999;
}
.nav-footer-bar.middle {
transition:transform .5s, opacity .5s;
top: auto;
bottom: 1%;
}
.no-footer-bar.middle {
transition:transform .5s, opacity .5s;
top: auto;
bottom: -3%;
}
.nav-icon{
z-index: 2009;
position: fixed;
right: 10px;
width: 52px;
height: 20px;
background: #3A84FF;
box-shadow: 0 -2px 8px 0 rgba(0,0,0,0.12);
border-radius: 15px 15px 0 0;
bottom: 50px;
text-align: center;
color: #fff;
font-size: 24px;
cursor: pointer;
i {
position: absolute;
top: -1px;
left: 14px;
transition:transform 0.5s;
}
.nav-icon-down{
transform: rotate(0deg);
}
.nav-icon-up{
transform: rotate(180deg);
}
}
.nav-icon-footer{
bottom: 50px;
}
.nav-icon-bottom{
bottom: 0px;
}
.win {
/* font-family: Microsoft Yahei, PingFang SC, Helvetica, Aria; */
font-family: -apple-system, BlinkMacSystemFont, PingFang SC, Microsoft YaHei, Helvetica Neue, Arial;
Expand Down
10 changes: 10 additions & 0 deletions lib/client/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ axios.interceptors.response.use(
// 接口请求成功
case 0:
return data
// 需要去权限中心申请权限
case 403:
if (data.data.permissionType === 'page') {
bus.$emit('permission-page', data.data)
return data.data
}
return data
case 404:
bus.$emit('not-exist', data.message)
return data
// 后端业务处理报错
default:
const { code, message = '系统错误' } = response.data
Expand Down
50 changes: 50 additions & 0 deletions lib/client/src/bk-icon/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ <h2 class="page-title">
</div>
<section class="tab-content single-color active" data-type="singleColor">
<ul class="icon-list">
<li class="icon-item" title="assembly-line">
<span class="icon bk-drag-icon bk-drag-assembly-line"></span>
<p class="icon-text">assembly-line</p>
</li>
<li class="icon-item" title="home">
<span class="icon bk-drag-icon bk-drag-home"></span>
<p class="icon-text">home</p>
Expand Down Expand Up @@ -1349,6 +1353,22 @@ <h2 class="page-title">
<span class="icon bk-drag-icon bk-drag-zidingyibiaoge"></span>
<p class="icon-text">zidingyibiaoge</p>
</li>
<li class="icon-item" title="sort">
<span class="icon bk-drag-icon bk-drag-sort"></span>
<p class="icon-text">sort</p>
</li>
<li class="icon-item" title="liebiao">
<span class="icon bk-drag-icon bk-drag-liebiao"></span>
<p class="icon-text">liebiao</p>
</li>
<li class="icon-item" title="kapian">
<span class="icon bk-drag-icon bk-drag-kapian"></span>
<p class="icon-text">kapian</p>
</li>
<li class="icon-item" title="refill">
<span class="icon bk-drag-icon bk-drag-refill"></span>
<p class="icon-text">refill</p>
</li>
</ul>
<h3 class="describe-title">为什么使用</h3>
<ul class="use-describe">
Expand All @@ -1366,6 +1386,12 @@ <h3 class="describe-title">如何使用</h3>
</section>
<section class="tab-content multiple-color" data-type="multipleColor">
<ul class="icon-list">
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#bk-drag-assembly-line"></use>
</svg>
<p class="icon-text">assembly-line</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#bk-drag-home"></use>
Expand Down Expand Up @@ -3214,6 +3240,30 @@ <h3 class="describe-title">如何使用</h3>
</svg>
<p class="icon-text">zidingyibiaoge</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#bk-drag-sort"></use>
</svg>
<p class="icon-text">sort</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#bk-drag-liebiao"></use>
</svg>
<p class="icon-text">liebiao</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#bk-drag-kapian"></use>
</svg>
<p class="icon-text">kapian</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#bk-drag-refill"></use>
</svg>
<p class="icon-text">refill</p>
</li>
</ul>
<h3 class="describe-title">为什么使用</h3>
<ul class="use-describe">
Expand Down
Binary file modified lib/client/src/bk-icon/fonts/iconcool.eot
Binary file not shown.
Loading

0 comments on commit 9d95994

Please sign in to comment.