Browse Source

chore: add ads, fix docs site

liangliangyin 4 years ago
parent
commit
b0441a3a29

+ 3 - 3
README.md

@@ -7,9 +7,9 @@ An out-of-box UI solution for enterprise applications as a Vue boilerplate. base
 
 <div align="center">
 
-[![License](https://img.shields.io/npm/l/package.json.svg?style=flat)](https://github.com/sendya/ant-design-pro-vue/blob/master/LICENSE)
-[![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)
-[![Travis branch](https://travis-ci.org/vueComponent/ant-design-vue-pro.svg?branch=master)](https://travis-ci.org/sendya/ant-design-pro-vue)
+[![License](https://img.shields.io/npm/l/package.json.svg?style=flat)](https://github.com/vueComponent/ant-design-vue-pro/blob/master/LICENSE)
+[![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)
+[![Travis branch](https://travis-ci.org/vueComponent/ant-design-vue-pro.svg?branch=master)](https://travis-ci.org/vueComponent/ant-design-vue-pro)
 
 </div>
 

+ 1 - 1
README.zh-CN.md

@@ -9,7 +9,7 @@ An out-of-box UI solution for enterprise applications as a Vue boilerplate. base
 
 [![License](https://img.shields.io/npm/l/package.json.svg?style=flat)](https://github.com/vueComponent/ant-design-vue-pro/blob/master/LICENSE)
 [![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)
-[![Travis branch](https://travis-ci.org/vueComponent/ant-design-vue-pro.svg?branch=master)](https://travis-ci.org/sendya/ant-design-pro-vue)
+[![Travis branch](https://travis-ci.org/vueComponent/ant-design-vue-pro.svg?branch=master)](https://travis-ci.org/vueComponent/ant-design-vue-pro)
 
 </div>
 

+ 114 - 0
src/components/Other/CarbonAds.vue

@@ -0,0 +1,114 @@
+<script>
+const carbonUrl = '//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=antdvcom'
+export default {
+  props: {
+    isMobile: Boolean
+  },
+  watch: {
+    $route (e, t) {
+      const adId = '#carbonads'
+      // if(isGitee) {
+      //   adId = '#cf';
+      // }
+      if (e.path !== t.path && this.$el.querySelector(adId)) {
+        this.$el.innerHTML = ''
+        this.load()
+      }
+      this.adInterval && clearInterval(this.adInterval)
+      this.adInterval = setInterval(() => {
+        if (!this.$el.querySelector(adId)) {
+          this.$el.innerHTML = ''
+          this.load()
+        }
+      }, 20000)
+    }
+  },
+  mounted () {
+    this.load()
+  },
+  methods: {
+    load () {
+      // if(isGitee) {
+      //   axios.get('https://api.codefund.app/properties/162/funder.html?template=horizontal')
+      //   .then(function (response) {
+      //     document.getElementById("codefund-ads").innerHTML = response.data;
+      //   });
+      // } else
+      if (carbonUrl) {
+        const e = document.createElement('script')
+        e.id = '_carbonads_js'
+        e.src = carbonUrl
+        this.$el.appendChild(e)
+      }
+    }
+  },
+  render () {
+    return <div id="carbon-ads" class={this.isMobile ? 'carbon-mobile' : ''} />
+  }
+}
+</script>
+<style lang="less">
+#carbon-ads {
+  width: 256px;
+  /* float: right; */
+  margin-top: 75px;
+  position: fixed;
+  left: 0;
+  bottom: 0;
+  padding: 0;
+  overflow: hidden;
+  z-index: 100;
+  background-color: #fff;
+  /* border-radius: 3px; */
+  font-size: 13px;
+  background: #f5f5f5;
+  font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
+}
+#carbonads {
+  overflow: hidden;
+}
+#carbon-ads a {
+  display: inline-block;
+  color: #7f8c8d;
+  font-weight: normal;
+}
+#carbon-ads span {
+  color: #7f8c8d;
+}
+#carbon-ads img {
+  float: left;
+  padding-right: 10px;
+}
+#carbon-ads .carbon-img,
+#carbon-ads .carbon-text {
+  display: block;
+  font-weight: normal;
+  color: #34495e;
+}
+#carbon-ads .carbon-text {
+  padding-top: 6px;
+  display: -webkit-box;
+  -webkit-box-orient: vertical;
+  -webkit-line-clamp: 4;
+  overflow: hidden;
+}
+#carbon-ads .carbon-poweredby {
+  color: #aaa;
+  font-weight: normal;
+  line-height: 1.2;
+  margin-top: 6px;
+}
+#carbon-ads.carbon-mobile {
+  width: 100%;
+  position: relative;
+  right: 0;
+  bottom: 0;
+  padding: 0;
+  margin-bottom: 15px;
+  margin-top: 5px;
+  .carbon-img {
+    float: left;
+    margin-right: 10px;
+  }
+}
+</style>

+ 1 - 1
src/core/directives/action.js

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

+ 14 - 1
src/layouts/BasicLayout.vue

@@ -11,6 +11,13 @@
     :i18nRender="i18nRender"
     v-bind="settings"
   >
+    <!-- Ads begin
+      广告代码 真实项目中请移除
+      production remove this Ads
+    -->
+    <ads v-if="isProPreviewSite"/>
+    <!-- Ads end -->
+
     <setting-drawer :settings="settings" @change="handleSettingChange" />
     <template v-slot:rightContentRender>
       <right-content :top-menu="settings.layout === 'topmenu'" :is-mobile="isMobile" :theme="settings.theme" />
@@ -31,6 +38,7 @@ import { SIDEBAR_TYPE, TOGGLE_MOBILE_TYPE } from '@/store/mutation-types'
 import defaultSettings from '@/config/defaultSettings'
 import RightContent from '@/components/GlobalHeader/RightContent'
 import GlobalFooter from '@/components/GlobalFooter'
+import Ads from '@/components/Other/CarbonAds'
 import LogoSvg from '../assets/logo.svg?inline'
 
 export default {
@@ -38,10 +46,15 @@ export default {
   components: {
     SettingDrawer,
     RightContent,
-    GlobalFooter
+    GlobalFooter,
+    Ads
   },
   data () {
     return {
+      // preview.pro.antdv.com only use.
+      isProPreviewSite: process.env.VUE_APP_PREVIEW === 'true',
+      // end
+
       // base
       menus: [],
       // 侧栏收起状态

+ 3 - 3
src/router/README.md

@@ -42,7 +42,7 @@ const routerObject = {
 | keepAlive           | 缓存该路由                                                   | boolean | false  |
 | target              | 菜单链接跳转目标(参考 html a 标记)                          | string | -  |
 | hidden              | 配合`hideChildrenInMenu`使用,用于隐藏菜单时,提供递归到父菜单显示 选中菜单项_(可参考 个人页 配置方式)_ | boolean | false  |
-| hiddenHeaderContent | *特殊 隐藏 [PageHeader](https://github.com/sendya/ant-design-pro-vue/blob/master/src/components/PageHeader/PageHeader.vue#L6) 组件中的页面带的 面包屑和页面标题栏 | boolean | false  |
+| hiddenHeaderContent | *特殊 隐藏 [PageHeader](https://github.com/vueComponent/ant-design-vue-pro/blob/master/src/components/PageHeader/PageHeader.vue#L6) 组件中的页面带的 面包屑和页面标题栏 | boolean | false  |
 | permission          | 与项目提供的权限拦截匹配的权限,如果不匹配,则会被禁止访问该路由页面 | array   | []     |
 
 > 路由自定义 `Icon` 请引入自定义 `svg` Icon 文件,然后传递给路由的 `meta.icon` 参数即可
@@ -123,7 +123,7 @@ const asyncRouterMap = [
 > 1. 请注意 `component: () => import('..') ` 方式引入路由的页面组件为 懒加载模式。具体可以看 [Vue 官方文档](https://router.vuejs.org/zh/guide/advanced/lazy-loading.html)
 > 2. 增加新的路由应该增加在 '/' (index) 路由的 `children` 内
 > 3. 子路由的父级路由必须有 `router-view` 才能让子路由渲染出来,请仔细查阅 vue-router 文档
-> 4. `permission` 可以进行自定义修改,只需要对这个模块进行自定义修改即可 [src/store/modules/permission.js#L10](https://github.com/sendya/ant-design-pro-vue/blob/master/src/store/modules/permission.js#L10)
+> 4. `permission` 可以进行自定义修改,只需要对这个模块进行自定义修改即可 [src/store/modules/permission.js#L10](https://github.com/vueComponent/ant-design-vue-pro/blob/master/src/store/modules/permission.js#L10)
 
 
 附权限路由结构:
@@ -131,4 +131,4 @@ const asyncRouterMap = [
 ![权限结构](https://static-2.loacg.com/open/static/github/permissions.png)
 
 
-第二种前端路由由后端动态生成的设计,可以前往官网文档 https://pro.loacg.com/docs/authority-management 参考
+第二种前端路由由后端动态生成的设计,可以前往官网文档 https://pro.antdv.com/docs/authority-management 参考