Skip to content

Commit b0441a3

Browse files
committed
chore: add ads, fix docs site
1 parent b867491 commit b0441a3

File tree

6 files changed

+136
-9
lines changed

6 files changed

+136
-9
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ An out-of-box UI solution for enterprise applications as a Vue boilerplate. base
77

88
<div align="center">
99

10-
[![License](https://img.shields.io/npm/l/package.json.svg?style=flat)](https://github.com/sendya/ant-design-pro-vue/blob/master/LICENSE)
11-
[![Release](https://img.shields.io/github/release/vueComponent/ant-design-vue-pro.svg?style=flat)](https://github.com/sendya/ant-design-pro-vue/releases/latest)
12-
[![Travis branch](https://travis-ci.org/vueComponent/ant-design-vue-pro.svg?branch=master)](https://travis-ci.org/sendya/ant-design-pro-vue)
10+
[![License](https://img.shields.io/npm/l/package.json.svg?style=flat)](https://github.com/vueComponent/ant-design-vue-pro/blob/master/LICENSE)
11+
[![Release](https://img.shields.io/github/release/vueComponent/ant-design-vue-pro.svg?style=flat)](https://github.com/vueComponent/ant-design-vue-pro/releases/latest)
12+
[![Travis branch](https://travis-ci.org/vueComponent/ant-design-vue-pro.svg?branch=master)](https://travis-ci.org/vueComponent/ant-design-vue-pro)
1313

1414
</div>
1515

README.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ An out-of-box UI solution for enterprise applications as a Vue boilerplate. base
99

1010
[![License](https://img.shields.io/npm/l/package.json.svg?style=flat)](https://github.com/vueComponent/ant-design-vue-pro/blob/master/LICENSE)
1111
[![Release](https://img.shields.io/github/release/vueComponent/ant-design-vue-pro.svg?style=flat)](https://github.com/vueComponent/ant-design-vue-pro/releases/latest)
12-
[![Travis branch](https://travis-ci.org/vueComponent/ant-design-vue-pro.svg?branch=master)](https://travis-ci.org/sendya/ant-design-pro-vue)
12+
[![Travis branch](https://travis-ci.org/vueComponent/ant-design-vue-pro.svg?branch=master)](https://travis-ci.org/vueComponent/ant-design-vue-pro)
1313

1414
</div>
1515

src/components/Other/CarbonAds.vue

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<script>
2+
const carbonUrl = '//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=antdvcom'
3+
export default {
4+
props: {
5+
isMobile: Boolean
6+
},
7+
watch: {
8+
$route (e, t) {
9+
const adId = '#carbonads'
10+
// if(isGitee) {
11+
// adId = '#cf';
12+
// }
13+
if (e.path !== t.path && this.$el.querySelector(adId)) {
14+
this.$el.innerHTML = ''
15+
this.load()
16+
}
17+
this.adInterval && clearInterval(this.adInterval)
18+
this.adInterval = setInterval(() => {
19+
if (!this.$el.querySelector(adId)) {
20+
this.$el.innerHTML = ''
21+
this.load()
22+
}
23+
}, 20000)
24+
}
25+
},
26+
mounted () {
27+
this.load()
28+
},
29+
methods: {
30+
load () {
31+
// if(isGitee) {
32+
// axios.get('https://api.codefund.app/properties/162/funder.html?template=horizontal')
33+
// .then(function (response) {
34+
// document.getElementById("codefund-ads").innerHTML = response.data;
35+
// });
36+
// } else
37+
if (carbonUrl) {
38+
const e = document.createElement('script')
39+
e.id = '_carbonads_js'
40+
e.src = carbonUrl
41+
this.$el.appendChild(e)
42+
}
43+
}
44+
},
45+
render () {
46+
return <div id="carbon-ads" class={this.isMobile ? 'carbon-mobile' : ''} />
47+
}
48+
}
49+
</script>
50+
<style lang="less">
51+
#carbon-ads {
52+
width: 256px;
53+
/* float: right; */
54+
margin-top: 75px;
55+
position: fixed;
56+
left: 0;
57+
bottom: 0;
58+
padding: 0;
59+
overflow: hidden;
60+
z-index: 100;
61+
background-color: #fff;
62+
/* border-radius: 3px; */
63+
font-size: 13px;
64+
background: #f5f5f5;
65+
font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
66+
}
67+
#carbonads {
68+
overflow: hidden;
69+
}
70+
#carbon-ads a {
71+
display: inline-block;
72+
color: #7f8c8d;
73+
font-weight: normal;
74+
}
75+
#carbon-ads span {
76+
color: #7f8c8d;
77+
}
78+
#carbon-ads img {
79+
float: left;
80+
padding-right: 10px;
81+
}
82+
#carbon-ads .carbon-img,
83+
#carbon-ads .carbon-text {
84+
display: block;
85+
font-weight: normal;
86+
color: #34495e;
87+
}
88+
#carbon-ads .carbon-text {
89+
padding-top: 6px;
90+
display: -webkit-box;
91+
-webkit-box-orient: vertical;
92+
-webkit-line-clamp: 4;
93+
overflow: hidden;
94+
}
95+
#carbon-ads .carbon-poweredby {
96+
color: #aaa;
97+
font-weight: normal;
98+
line-height: 1.2;
99+
margin-top: 6px;
100+
}
101+
#carbon-ads.carbon-mobile {
102+
width: 100%;
103+
position: relative;
104+
right: 0;
105+
bottom: 0;
106+
padding: 0;
107+
margin-bottom: 15px;
108+
margin-top: 5px;
109+
.carbon-img {
110+
float: left;
111+
margin-right: 10px;
112+
}
113+
}
114+
</style>

src/core/directives/action.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import store from '@/store'
1212
* - 当前用户没有权限时,组件上使用了该指令则会被隐藏
1313
* - 当后台权限跟 pro 提供的模式不同时,只需要针对这里的权限过滤进行修改即可
1414
*
15-
* @see https://github.com/sendya/ant-design-pro-vue/pull/53
15+
* @see https://github.com/vueComponent/ant-design-vue-pro/pull/53
1616
*/
1717
const action = Vue.directive('action', {
1818
inserted: function (el, binding, vnode) {

src/layouts/BasicLayout.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
:i18nRender="i18nRender"
1212
v-bind="settings"
1313
>
14+
<!-- Ads begin
15+
广告代码 真实项目中请移除
16+
production remove this Ads
17+
-->
18+
<ads v-if="isProPreviewSite"/>
19+
<!-- Ads end -->
20+
1421
<setting-drawer :settings="settings" @change="handleSettingChange" />
1522
<template v-slot:rightContentRender>
1623
<right-content :top-menu="settings.layout === 'topmenu'" :is-mobile="isMobile" :theme="settings.theme" />
@@ -31,17 +38,23 @@ import { SIDEBAR_TYPE, TOGGLE_MOBILE_TYPE } from '@/store/mutation-types'
3138
import defaultSettings from '@/config/defaultSettings'
3239
import RightContent from '@/components/GlobalHeader/RightContent'
3340
import GlobalFooter from '@/components/GlobalFooter'
41+
import Ads from '@/components/Other/CarbonAds'
3442
import LogoSvg from '../assets/logo.svg?inline'
3543
3644
export default {
3745
name: 'BasicLayout',
3846
components: {
3947
SettingDrawer,
4048
RightContent,
41-
GlobalFooter
49+
GlobalFooter,
50+
Ads
4251
},
4352
data () {
4453
return {
54+
// preview.pro.antdv.com only use.
55+
isProPreviewSite: process.env.VUE_APP_PREVIEW === 'true',
56+
// end
57+
4558
// base
4659
menus: [],
4760
// 侧栏收起状态

src/router/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const routerObject = {
4242
| keepAlive | 缓存该路由 | boolean | false |
4343
| target | 菜单链接跳转目标(参考 html a 标记) | string | - |
4444
| hidden | 配合`hideChildrenInMenu`使用,用于隐藏菜单时,提供递归到父菜单显示 选中菜单项_(可参考 个人页 配置方式)_ | boolean | false |
45-
| hiddenHeaderContent | *特殊 隐藏 [PageHeader](https://github.com/sendya/ant-design-pro-vue/blob/master/src/components/PageHeader/PageHeader.vue#L6) 组件中的页面带的 面包屑和页面标题栏 | boolean | false |
45+
| hiddenHeaderContent | *特殊 隐藏 [PageHeader](https://github.com/vueComponent/ant-design-vue-pro/blob/master/src/components/PageHeader/PageHeader.vue#L6) 组件中的页面带的 面包屑和页面标题栏 | boolean | false |
4646
| permission | 与项目提供的权限拦截匹配的权限,如果不匹配,则会被禁止访问该路由页面 | array | [] |
4747

4848
> 路由自定义 `Icon` 请引入自定义 `svg` Icon 文件,然后传递给路由的 `meta.icon` 参数即可
@@ -123,12 +123,12 @@ const asyncRouterMap = [
123123
> 1. 请注意 `component: () => import('..') ` 方式引入路由的页面组件为 懒加载模式。具体可以看 [Vue 官方文档](https://router.vuejs.org/zh/guide/advanced/lazy-loading.html)
124124
> 2. 增加新的路由应该增加在 '/' (index) 路由的 `children`
125125
> 3. 子路由的父级路由必须有 `router-view` 才能让子路由渲染出来,请仔细查阅 vue-router 文档
126-
> 4. `permission` 可以进行自定义修改,只需要对这个模块进行自定义修改即可 [src/store/modules/permission.js#L10](https://github.com/sendya/ant-design-pro-vue/blob/master/src/store/modules/permission.js#L10)
126+
> 4. `permission` 可以进行自定义修改,只需要对这个模块进行自定义修改即可 [src/store/modules/permission.js#L10](https://github.com/vueComponent/ant-design-vue-pro/blob/master/src/store/modules/permission.js#L10)
127127
128128

129129
附权限路由结构:
130130

131131
![权限结构](https://static-2.loacg.com/open/static/github/permissions.png)
132132

133133

134-
第二种前端路由由后端动态生成的设计,可以前往官网文档 https://pro.loacg.com/docs/authority-management 参考
134+
第二种前端路由由后端动态生成的设计,可以前往官网文档 https://pro.antdv.com/docs/authority-management 参考

0 commit comments

Comments
 (0)