|
1 | 1 | <script>
|
2 |
| -const carbonUrl = '//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=antdvcom' |
| 2 | +const googleAdsUrl = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js' |
3 | 3 | export default {
|
4 | 4 | props: {
|
5 | 5 | isMobile: Boolean
|
6 | 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 |
| - }, |
| 7 | + // watch: { |
| 8 | + // $route (e, t) { |
| 9 | + // const adId = '#adsbygoogle' |
| 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 | 26 | mounted () {
|
27 |
| - this.load() |
| 27 | + // this.load() |
28 | 28 | },
|
29 | 29 | methods: {
|
30 | 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) { |
| 31 | + if (googleAdsUrl) { |
| 32 | + /* eslint-disable */ |
| 33 | + let adsbygoogle = [] |
38 | 34 | const e = document.createElement('script')
|
39 |
| - e.id = '_carbonads_js' |
40 |
| - e.src = carbonUrl |
| 35 | + e.id = '_adsbygoogle_js' |
| 36 | + e.src = googleAdsUrl |
41 | 37 | this.$el.appendChild(e)
|
| 38 | + setTimeout(() => { |
| 39 | + (adsbygoogle = window.adsbygoogle || []).push({}) |
| 40 | + }, 2000) |
42 | 41 | }
|
43 | 42 | }
|
44 | 43 | },
|
45 | 44 | render () {
|
46 |
| - return <div id="carbon-ads" class={this.isMobile ? 'carbon-mobile' : ''} /> |
| 45 | + // return <ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-4801326429087140" data-ad-slot="6929057621" /> |
| 46 | + return <div class="business-pro-ad"><a href="https://store.antdv.com/pro/" target="_blank">(推荐) 企业级商用版 Admin Pro 现已发售,采用 Vue3 + TS 欢迎购买。</a></div>; |
47 | 47 | }
|
48 | 48 | }
|
49 | 49 | </script>
|
50 |
| -<style lang="less"> |
51 |
| -#carbon-ads { |
52 |
| - width: 256px; |
53 |
| - /* float: right; */ |
54 |
| - margin-top: 75px; |
| 50 | + |
| 51 | +<style lang="less" scoped> |
| 52 | +.business-pro-ad { |
55 | 53 | position: fixed;
|
| 54 | + background: rgba(255,255,255,0.25); |
56 | 55 | left: 0;
|
57 | 56 | 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 |
| - } |
| 57 | + padding: 0 12px; |
| 58 | + height: 48px; |
| 59 | + width: 258px; |
| 60 | + z-index: 99; |
113 | 61 | }
|
114 | 62 | </style>
|
0 commit comments