Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
Ygopro Arena Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Ygopro Arena Web
Commits
692bcec5
Commit
692bcec5
authored
Dec 31, 2017
by
ganjingcun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ads
parent
5fe5c56e
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
730 additions
and
13 deletions
+730
-13
src/api.js
src/api.js
+33
-1
src/components/Ads.vue
src/components/Ads.vue
+497
-0
src/components/Index.vue
src/components/Index.vue
+77
-0
src/components/PageHeader.vue
src/components/PageHeader.vue
+95
-9
src/components/Vote.vue
src/components/Vote.vue
+21
-2
src/router/index.js
src/router/index.js
+7
-1
No files found.
src/api.js
View file @
692bcec5
...
@@ -12,6 +12,10 @@ export default class Api {
...
@@ -12,6 +12,10 @@ export default class Api {
static
uploadUrl
=
`
${
URL
}
/upload`
static
uploadUrl
=
`
${
URL
}
/upload`
static
implUrl
=
`
${
URL
}
/impltrack`
static
clkUrl
=
`
${
URL
}
/clktrack`
static
getDownloadUrl
(
url
)
{
static
getDownloadUrl
(
url
)
{
url
=
url
.
slice
(
7
)
url
=
url
.
slice
(
7
)
var
downloadUrl
=
`
${
URL
}
/download/
${
url
}
`
var
downloadUrl
=
`
${
URL
}
/download/
${
url
}
`
...
@@ -95,4 +99,32 @@ export default class Api {
...
@@ -95,4 +99,32 @@ export default class Api {
return
Vue
.
http
.
post
(
url
,
opt
,
{
'
emulateJSON
'
:
true
});
return
Vue
.
http
.
post
(
url
,
opt
,
{
'
emulateJSON
'
:
true
});
}
}
static
saveAds
(
opt
)
{
const
url
=
`
${
URL
}
/ads`
return
Vue
.
http
.
post
(
url
,
opt
,
{
'
emulateJSON
'
:
true
});
}
static
getAdsList
(
opt
)
{
return
Vue
.
http
.
get
(
`
${
URL
}
/ads`
,
{
'
params
'
:
opt
});
}
static
adsStatus
(
opt
)
{
const
url
=
`
${
URL
}
/adsStatus`
return
Vue
.
http
.
post
(
url
,
opt
,
{
'
emulateJSON
'
:
true
});
}
static
getAd
(
opt
)
{
return
Vue
.
http
.
get
(
`
${
URL
}
/getAd`
,
{
'
params
'
:
opt
});
}
static
adClick
(
opt
)
{
const
url
=
`
${
URL
}
/adClick`
return
Vue
.
http
.
post
(
url
,
opt
,
{
'
emulateJSON
'
:
true
});
}
static
adImpl
(
opt
)
{
const
url
=
`
${
URL
}
/adImpl`
return
Vue
.
http
.
post
(
url
,
opt
,
{
'
emulateJSON
'
:
true
});
}
}
}
src/components/Ads.vue
0 → 100644
View file @
692bcec5
This diff is collapsed.
Click to expand it.
src/components/Index.vue
View file @
692bcec5
<
template
>
<
template
>
<div
class=
"hello"
>
<div
class=
"hello"
>
<div
id=
"promo"
v-if=
"!user.isLogin"
v-bind:style=
"
{ backgroundImage: 'url(' + image + ')' }">
<div
id=
"promo"
v-if=
"!user.isLogin"
v-bind:style=
"
{ backgroundImage: 'url(' + image + ')' }">
<div
class=
"jumbotron"
>
<div
class=
"jumbotron"
>
<h1>
MyCard
</h1>
<h1>
MyCard
</h1>
...
@@ -9,6 +12,18 @@
...
@@ -9,6 +12,18 @@
</div>
</div>
</div>
</div>
<div
id=
"promo2"
v-if=
"adObj.id"
v-bind:style=
"
{ backgroundImage: 'url(' + adObj.src + ')' }">
<div
class=
"jumbotron"
>
<h3>
{{
adObj
.
name
}}
</h3>
<p>
{{
adObj
.
desctext
}}
</p>
<p><a
class=
"text-uppercase btn btn-info btn-lg"
@
click=
"adClick"
>
去看看!
</a></p>
<!--
<p><a
class=
"text-uppercase btn btn-info btn-lg"
href=
"#/download"
>
Start Now!
</a></p>
-->
</div>
<div
style=
"float:right;position:relative; background-color: #d3dce6; padding: 4px; margin-right: -38px; margin-top: 10px;"
>
广告
</div>
</div>
<div
class=
"projects-clean"
v-bind:class=
"
{ 'fix-top': user.isLogin }">
<div
class=
"projects-clean"
v-bind:class=
"
{ 'fix-top': user.isLogin }">
<div
class=
"container"
id=
"project"
>
<div
class=
"container"
id=
"project"
>
<div
class=
"intro"
>
<div
class=
"intro"
>
...
@@ -49,13 +64,17 @@
...
@@ -49,13 +64,17 @@
<
script
>
<
script
>
import
querystring
from
'
querystring
'
;
import
querystring
from
'
querystring
'
;
import
image
from
'
../assets/img/banner.jpg
'
import
image
from
'
../assets/img/banner.jpg
'
import
image3
from
'
../assets/img/image3.png
'
import
{
mapGetters
}
from
'
vuex
'
import
{
mapGetters
}
from
'
vuex
'
import
API
from
'
../api
'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
isMobile
:
false
,
isMobile
:
false
,
image
:
image
,
image
:
image
,
image3
:
image3
,
adObj
:{}
}
}
},
},
...
@@ -66,6 +85,24 @@
...
@@ -66,6 +85,24 @@
}),
}),
},
},
mounted
:
function
()
{
var
_this
=
this
API
.
getAd
({}).
then
((
res
)
=>
{
if
(
res
.
data
.
data
&&
res
.
data
.
data
!==
"
null
"
)
{
_this
.
adObj
=
res
.
data
.
data
if
(
_this
.
isMobile
)
{
_this
.
adObj
.
src
=
_this
.
adObj
.
imgm_url
}
else
{
_this
.
adObj
.
src
=
_this
.
adObj
.
imgp_url
}
}
},
(
res
)
=>
{
console
.
log
(
res
)
});
},
created
:
function
()
{
created
:
function
()
{
var
clientWidth
=
document
.
body
.
clientWidth
;
var
clientWidth
=
document
.
body
.
clientWidth
;
if
(
clientWidth
<
753
)
{
if
(
clientWidth
<
753
)
{
...
@@ -86,6 +123,22 @@
...
@@ -86,6 +123,22 @@
gogo
:
function
(
url
)
{
gogo
:
function
(
url
)
{
// window.open(url)
// window.open(url)
window
.
location
.
href
=
url
window
.
location
.
href
=
url
},
adClick
:
function
(){
API
.
adClick
({
id
:
this
.
adObj
.
id
}).
then
((
res
)
=>
{
},
(
res
)
=>
{
console
.
log
(
res
)
});
window
.
open
(
this
.
adObj
.
click_ref
,
"
_blank
"
);
},
adImpl
:
function
(){
API
.
adImpl
({
id
:
this
.
adObj
.
id
}).
then
((
res
)
=>
{
},
(
res
)
=>
{
console
.
log
(
res
)
});
}
}
},
},
}
}
...
@@ -120,4 +173,28 @@
...
@@ -120,4 +173,28 @@
background-size
:
cover
;
background-size
:
cover
;
margin-top
:
50px
;
margin-top
:
50px
;
}
}
#promo2
{
text-align
:
center
;
padding
:
40px
;
background-repeat
:
no-repeat
;
background-size
:
cover
;
margin-top
:
50px
;
}
.el-carousel__item
h3
{
color
:
#475669
;
font-size
:
14px
;
opacity
:
0.75
;
line-height
:
200px
;
margin
:
0
;
}
.el-carousel__item
:nth-child
(
2n
)
{
background-color
:
#99a9bf
;
}
.el-carousel__item
:nth-child
(
2n
+
1
)
{
background-color
:
#d3dce6
;
}
</
style
>
</
style
>
\ No newline at end of file
src/components/PageHeader.vue
View file @
692bcec5
...
@@ -87,7 +87,11 @@
...
@@ -87,7 +87,11 @@
</div>
</div>
</el-dialog>
</el-dialog>
<div
id=
"ads"
style=
"display: none"
>
<div
@
click=
"adClick"
>
<img
v-bind:style=
"
{ height: 'auto', width: width }" v-bind:src="adObj.src">
</div>
</div>
...
@@ -110,11 +114,16 @@
...
@@ -110,11 +114,16 @@
const
cityOptions
=
[
'
上海
'
,
'
北京
'
,
'
广州
'
,
'
深圳
'
];
const
cityOptions
=
[
'
上海
'
,
'
北京
'
,
'
广州
'
,
'
深圳
'
];
return
{
return
{
opids
:
[],
opids
:
[],
height
:
"
300
"
,
width
:
"
400
"
,
isMobile
:
false
,
isMobile
:
false
,
cities
:
cityOptions
,
cities
:
cityOptions
,
voteObj
:
{
voteObj
:
{
multiple
:
false
,
multiple
:
false
,
options
:
[]
options
:
[]
},
adObj
:
{
},
},
size
:
'
small
'
,
size
:
'
small
'
,
dialogFormVisible
:
false
,
dialogFormVisible
:
false
,
...
@@ -149,11 +158,7 @@
...
@@ -149,11 +158,7 @@
var
_this
=
this
var
_this
=
this
if
(
location
.
hash
===
"
#/vote
"
||
location
.
hash
===
"
#/report
"
)
{
if
(
location
.
hash
===
"
#/vote
"
||
location
.
hash
===
"
#/report
"
||
location
.
hash
===
"
#/ads
"
)
{
return
;
}
if
(
!
this
.
user
.
isLogin
)
{
return
;
return
;
}
}
...
@@ -167,10 +172,70 @@
...
@@ -167,10 +172,70 @@
// }
// }
// }
// }
var
_this
=
this
API
.
getAd
({}).
then
((
res
)
=>
{
if
(
res
.
data
.
data
&&
res
.
data
.
data
!==
"
null
"
)
{
_this
.
adObj
=
res
.
data
.
data
if
(
_this
.
isMobile
)
{
_this
.
adObj
.
src
=
_this
.
adObj
.
imgm_url
}
else
{
_this
.
adObj
.
src
=
_this
.
adObj
.
imgp_url
}
setTimeout
(
function
()
{
var
area
=
[
"
800px
"
,
"
480px
"
]
if
(
_this
.
isMobile
)
{
area
=
[
"
300px
"
,
"
400px
"
]
}
layer
.
open
({
type
:
1
,
title
:
false
//不显示标题栏
// ,closeBtn: false
,
area
:
area
,
shade
:
0.8
,
offset
:
_this
.
isMobile
?
'
100px
'
:
"
auto
"
,
id
:
'
LAY_layuipro
'
//设定一个id,防止重复弹出
// ,btn: ['火速围观', '残忍拒绝']
,
btnAlign
:
'
c
'
,
moveType
:
1
//拖拽模式,0或者1
,
content
:
$
(
'
#ads
'
)
,
success
:
function
(
layero
)
{
var
btn
=
layero
.
find
(
'
.layui-layer-btn
'
);
btn
.
find
(
'
.layui-layer-btn0
'
).
attr
({
href
:
'
http://www.layui.com/
'
,
target
:
'
_blank
'
});
}
,
success
:
function
()
{
_this
.
adImpl
()
setTimeout
(
function
()
{
layer
.
close
(
layer
.
index
);
},
5000
)
}
,
end
:
function
()
{
$
(
"
#ads
"
).
hide
()
}
});
},
3000
)
}
},
(
res
)
=>
{
console
.
log
(
res
)
});
if
(
!
this
.
user
.
isLogin
)
{
return
;
}
API
.
getVote
({
user
:
this
.
user
.
id
,
username
:
this
.
user
.
username
}).
then
((
res
)
=>
{
API
.
getVote
({
user
:
this
.
user
.
id
,
username
:
this
.
user
.
username
}).
then
((
res
)
=>
{
if
(
res
.
data
.
data
&&
res
.
data
.
data
!==
"
null
"
)
{
if
(
res
.
data
.
data
&&
res
.
data
.
data
!==
"
null
"
)
{
this
.
voteObj
=
res
.
data
.
data
this
.
voteObj
=
res
.
data
.
data
this
.
voteObj
.
options
=
JSON
.
parse
(
this
.
voteObj
.
options
)
this
.
voteObj
.
options
=
JSON
.
parse
(
this
.
voteObj
.
options
)
...
@@ -260,8 +325,29 @@
...
@@ -260,8 +325,29 @@
},
},
methods
:
{
methods
:
{
adClick
:
function
()
{
API
.
adClick
({
id
:
this
.
adObj
.
id
}).
then
((
res
)
=>
{
},
(
res
)
=>
{
console
.
log
(
res
)
});
window
.
open
(
this
.
adObj
.
click_ref
,
"
_blank
"
);
},
adImpl
:
function
()
{
API
.
adImpl
({
id
:
this
.
adObj
.
id
}).
then
((
res
)
=>
{
},
(
res
)
=>
{
console
.
log
(
res
)
});
},
submitVote
:
function
()
{
submitVote
:
function
()
{
var
param
=
{
var
param
=
{
user
:
this
.
user
.
id
,
user
:
this
.
user
.
id
,
username
:
this
.
user
.
username
,
username
:
this
.
user
.
username
,
...
...
src/components/Vote.vue
View file @
692bcec5
...
@@ -164,6 +164,18 @@
...
@@ -164,6 +164,18 @@
export
default
{
export
default
{
created
:
function
()
{
created
:
function
()
{
//权限设置
if
(
!
this
.
user
.
isLogin
||
!
this
.
user
.
admin
)
{
this
.
$notify
({
// title: '警告',
message
:
'
需要管理员权限才能查看该页面,已为您自动跳转到首页 !
'
,
type
:
'
warning
'
})
this
.
loading
=
false
return
this
.
$router
.
replace
(
'
/
'
)
}
var
lang
=
localStorage
.
getItem
(
'
lang
'
)
||
'
cn
'
;
var
lang
=
localStorage
.
getItem
(
'
lang
'
)
||
'
cn
'
;
this
.
init
(
lang
)
this
.
init
(
lang
)
},
},
...
@@ -304,6 +316,13 @@
...
@@ -304,6 +316,13 @@
}
}
},
},
computed
:
{
...
mapGetters
({
lang
:
'
getLang
'
,
user
:
'
getUser
'
})
},
methods
:
{
methods
:
{
switchChange
:
function
(
id
,
status
)
{
switchChange
:
function
(
id
,
status
)
{
// this.loading = true
// this.loading = true
...
...
src/router/index.js
View file @
692bcec5
...
@@ -11,6 +11,7 @@ import History from '@/components/History'
...
@@ -11,6 +11,7 @@ import History from '@/components/History'
import
Deck
from
'
@/components/Deck
'
import
Deck
from
'
@/components/Deck
'
import
Report
from
'
@/components/Report
'
import
Report
from
'
@/components/Report
'
import
Vote
from
'
@/components/Vote
'
import
Vote
from
'
@/components/Vote
'
import
Ads
from
'
@/components/Ads
'
Vue
.
use
(
Router
)
Vue
.
use
(
Router
)
...
@@ -71,5 +72,10 @@ export default new Router({
...
@@ -71,5 +72,10 @@ export default new Router({
name
:
'
Vote
'
,
name
:
'
Vote
'
,
component
:
Vote
component
:
Vote
},
},
{
path
:
'
/ads
'
,
name
:
'
Ads
'
,
component
:
Ads
},
]
]
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment