Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vue-ssr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lixy
vue-ssr
Commits
80972b4d
Commit
80972b4d
authored
Aug 30, 2019
by
lixy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
axios
parent
efc40e88
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
100 additions
and
251 deletions
+100
-251
bannerActivity.vue
components/bannerActivity.vue
+3
-1
footer.vue
components/footer.vue
+0
-2
menu.vue
components/menu.vue
+0
-4
nuxt.config.js
nuxt.config.js
+6
-2
package.json
package.json
+5
-0
aboutXx.vue
pages/aboutXx.vue
+2
-2
activity.vue
pages/activity.vue
+3
-12
_id.vue
pages/activityList/_id.vue
+5
-37
campsite.vue
pages/campsite.vue
+10
-52
_id.vue
pages/campsiteDetails/_id.vue
+6
-23
demo.vue
pages/demo.vue
+18
-9
_id.vue
pages/demoList/_id.vue
+2
-11
index.vue
pages/index.vue
+5
-6
news.vue
pages/news.vue
+3
-5
_id.vue
pages/newsList/_id.vue
+3
-40
tour.vue
pages/tour.vue
+10
-24
_id.vue
pages/tourDetails/_id.vue
+4
-10
vehicle.vue
pages/vehicle.vue
+4
-5
_id.vue
pages/vehicleList/_id.vue
+4
-6
axios.js
plugins/axios.js
+4
-0
filters.js
plugins/filters.js
+3
-0
No files found.
components/bannerActivity.vue
View file @
80972b4d
...
...
@@ -3,7 +3,9 @@
<div
class=
"box"
>
<ul>
<li
v-for=
"(item, index) in list"
:key=
"item.id"
:class=
"index === current ? 'active' : ''"
@
click=
"bannerClick(index, item)"
>
<img
:src=
"item.banner"
style=
"width:100%;height: auto"
:alt=
"item.title"
/>
<nuxt-link
:to=
"'/activityList/'+item.id"
>
<img
:src=
"item.banner"
style=
"width:100%;height: auto"
:alt=
"item.title"
/>
</nuxt-link>
</li>
</ul>
<div
class=
"status"
>
...
...
components/footer.vue
View file @
80972b4d
...
...
@@ -33,7 +33,6 @@
</
template
>
<
script
>
import
axios
from
'axios'
export
default
{
transition
:
'bounce'
,
name
:
'footerModal'
,
...
...
@@ -49,7 +48,6 @@
<
style
scoped
>
.footer-container
{
width
:
100%
;
/*height: 423px;*/
height
:
300px
;
position
:
relative
;
background
:
url("../assets/images/footer.jpg")
no-repeat
;
...
...
components/menu.vue
View file @
80972b4d
...
...
@@ -29,7 +29,6 @@
</
template
>
<
script
>
import
axios
from
'axios'
export
default
{
transition
:
'bounce'
,
name
:
'menuModal'
,
...
...
@@ -83,9 +82,6 @@
width
:
1200px
;
margin
:
0
auto
;
}
/* li{
text-decoration: none;
} */
.users
{
list-style-type
:
none
;
display
:
flex
;
...
...
nuxt.config.js
View file @
80972b4d
...
...
@@ -27,7 +27,6 @@ module.exports = {
{
src
:
'~plugins/filters.js'
,
srr
:
false
}
],
build
:
{
extend
(
config
,
{
isDev
,
isClient
})
{
if
(
isDev
&&
isClient
)
{
config
.
module
.
rules
.
push
({
...
...
@@ -51,10 +50,15 @@ module.exports = {
}
},
env
:
{
host
:
"https://
dev.dfangche
.com"
host
:
"https://
xxtest.upyuns
.com"
},
generate
:
{
routes
:
[
]
}
// ,
// server: {
// port: 3000, // default: 3000
// host: '10.1.37.172', // default: localhost
// }
}
package.json
View file @
80972b4d
...
...
@@ -4,7 +4,12 @@
"description"
:
"Nuxt.js project"
,
"author"
:
"yutao <haiyan.xu.vip@gmail.com>"
,
"private"
:
true
,
"nuxt"
:
{
"host"
:
"10.1.37.172"
,
"port"
:
"3000"
},
"scripts"
:
{
"test"
:
"nuxt --hostname 10.1.37.172 --port 3333"
,
"dev"
:
"nuxt"
,
"build"
:
"nuxt build"
,
"start"
:
"nuxt start"
,
...
...
pages/aboutXx.vue
View file @
80972b4d
...
...
@@ -22,7 +22,7 @@
</
template
>
<
script
>
import
axios
from
"axios"
;
import
axios
from
'../plugins/axios'
import
menuModal
from
"../components/menu"
;
import
footerModal
from
"../components/footer"
;
import
vehicleBanner
from
"../components/vehicleBanner"
...
...
@@ -79,7 +79,7 @@
*/
async
getBanner
(){
//关于欣新banner
let
tempBannerData
=
await
axios
.
get
(
'
https://dev.dfangche.com
/api/app/banner/app/unauth/findBannerlist?type=6&platform=1'
);
let
tempBannerData
=
await
axios
.
get
(
'/api/app/banner/app/unauth/findBannerlist?type=6&platform=1'
);
let
banner
=
tempBannerData
.
data
.
data
;
this
.
bannerList
=
banner
;
},
...
...
pages/activity.vue
View file @
80972b4d
...
...
@@ -42,7 +42,7 @@
</
template
>
<
script
>
import
axios
from
"axios"
;
import
axios
from
'../plugins/axios'
import
menuModal
from
"../components/menu"
;
import
footerModal
from
"../components/footer"
;
import
vehicleBanner
from
"../components/vehicleBanner"
...
...
@@ -55,7 +55,6 @@
},
data
()
{
return
{
typeId
:
"营地类型"
,
dataType
:
[],
totalCount
:
""
,
dataDetail
:
[],
...
...
@@ -101,7 +100,7 @@
*/
async
getBanner
(){
//首活动banner
let
tempBannerData
=
await
axios
.
get
(
'
https://dev.dfangche.com
/api/app/banner/app/unauth/findBannerlist?type=4&platform=1'
);
let
tempBannerData
=
await
axios
.
get
(
'/api/app/banner/app/unauth/findBannerlist?type=4&platform=1'
);
let
banner
=
tempBannerData
.
data
.
data
;
this
.
bannerList
=
banner
;
},
...
...
@@ -116,17 +115,10 @@
async
getAll
()
{
let
{
data
:
{
data
}
}
=
await
axios
.
get
(
`https://dev.dfangche.com//api/uccn/summitActivity/app/unauth/list?page=
${
this
.
listQuery
.
pageNo
}
&limit=10000`
);
}
=
await
axios
.
get
(
`/api/uccn/summitActivity/app/unauth/list?page=
${
this
.
listQuery
.
pageNo
}
&limit=10000`
);
// console.log(data);
this
.
totalCount
=
data
.
totalCount
;
data
.
data
.
map
(
function
(
item
)
{
// item.startTime = timestamp2Date(item.startTime);
// item.endTime = timestamp2Date(item.endTime);
})
this
.
dataDetail
=
data
.
data
;
// this.dataDetail = this.dataDetail.push(data.data);
},
mounted
()
{
window
.
addEventListener
(
'scroll'
,
this
.
scrollHandle
);
// 绑定页面的滚动事件
...
...
@@ -167,7 +159,6 @@
*
zoom
:
1
;
/*ie6清除浮动的方式 *号只有IE6-IE7执行,其他浏览器不执行*/
}
.banner
{
/* background-color: #fff; */
text-align
:
center
;
}
...
...
pages/activityList/_id.vue
View file @
80972b4d
...
...
@@ -14,8 +14,8 @@
<h1>
{{
detail
.
title
}}
</h1>
<div
class=
"r-cc"
>
<p>
活动人数
<span
style=
"margin-left: 20px;"
>
{{
detail
.
limitNum
}}
</span></p>
<p>
活动时间
<span
style=
"margin-left: 20px;"
>
{{
detail
.
startTime
}}
~
{{
detail
.
endTime
}}
</span></p>
<p
style
=
"ellipsis2"
>
活动地点
<span
style=
"margin-left: 20px;"
>
{{
detail
.
province
}}{{
detail
.
city
}}{{
detail
.
town
}}{{
detail
.
address
}}
</span></p>
<p>
活动时间
<span
style=
"margin-left: 20px;"
>
{{
detail
.
startTime
|
formatDate
(
'yyyy-MM-dd hh:mm:ss'
)
}}
~
{{
detail
.
endTime
|
formatDate
(
'yyyy-MM-dd hh:mm:ss'
)
}}
</span></p>
<p
class
=
"ellipsis2"
>
活动地点
<span
style=
"margin-left: 20px;"
>
{{
detail
.
province
}}{{
detail
.
city
}}{{
detail
.
town
}}{{
detail
.
address
}}
</span></p>
</div>
<div
class=
"buttonDetails"
>
报名参加
</div>
</div>
...
...
@@ -41,12 +41,11 @@
</
template
>
<
script
>
import
axios
from
'axios'
import
axios
from
'
../../plugins/
axios'
import
menuModal
from
"../../components/menu"
import
footerModal
from
"../../components/footer"
import
Swiper
from
'swiper'
;
import
'swiper/dist/css/swiper.min.css'
;
// import { getDetail } from '../../../../demo nuxt/nuxt-bnhcp/ajax/getData';
export
default
{
transition
:
'bounce'
,
components
:
{
...
...
@@ -64,41 +63,13 @@
return
!
isNaN
(
+
params
.
id
)
},
async
asyncData
({
env
,
params
,
error
})
{
function
formatDate
(
date
,
fmt
)
{
if
(
/
(
y+
)
/
.
test
(
fmt
))
{
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
date
.
getFullYear
()
+
''
).
substr
(
4
-
RegExp
.
$1
.
length
))
}
let
o
=
{
'M+'
:
date
.
getMonth
()
+
1
,
'd+'
:
date
.
getDate
(),
'h+'
:
date
.
getHours
(),
'm+'
:
date
.
getMinutes
(),
's+'
:
date
.
getSeconds
()
}
for
(
let
k
in
o
)
{
if
(
new
RegExp
(
`(
${
k
}
)`
).
test
(
fmt
))
{
let
str
=
o
[
k
]
+
''
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
===
1
?
str
:
padLeftZero
(
str
))
}
}
return
fmt
}
function
padLeftZero
(
str
)
{
return
(
'00'
+
str
).
substr
(
str
.
length
)
}
function
timestamp2Date
(
timestamp
)
{
let
date
=
new
Date
(
timestamp
);
//时间戳为10位需*1000,时间戳为13位的话不需乘1000
return
formatDate
(
date
,
'yyyy-MM-dd hh:mm:ss'
);
}
const
{
data
}
=
await
axios
.
get
(
env
.
host
+
'/api/uccn/summitActivity/app/unauth/'
+
params
.
id
);
const
{
data
}
=
await
axios
.
get
(
'/api/uccn/summitActivity/app/unauth/'
+
params
.
id
);
let
detail
=
data
.
data
;
detail
.
startTime
=
timestamp2Date
(
detail
.
startTime
);
detail
.
endTime
=
timestamp2Date
(
detail
.
endTime
);
detail
.
content
=
detail
.
content
.
replace
(
/<img/g
,
"<img style='width:100%'"
);
if
(
!
detail
)
{
return
error
({
message
:
'detail not found'
,
statusCode
:
404
})
}
let
tempBannerData
=
await
axios
.
get
(
env
.
host
+
'/api/uccn/random/list/app/unauth/get?type=4'
);
let
tempBannerData
=
await
axios
.
get
(
'/api/uccn/random/list/app/unauth/get?type=4'
);
let
hot
=
tempBannerData
.
data
.
data
;
return
{
detail
:
detail
,
hotList
:
hot
}
},
...
...
@@ -139,9 +110,6 @@
swiper
:
galleryThumbs
}
});
},
head
:
{
title
:
'营地详情'
}
}
</
script
>
...
...
pages/campsite.vue
View file @
80972b4d
...
...
@@ -49,7 +49,7 @@
</
template
>
<
script
>
import
axios
from
"axios"
;
import
axios
from
'../plugins/axios'
;
import
menuModal
from
"../components/menu"
;
import
footerModal
from
"../components/footer"
;
import
banner
from
"../components/banner"
...
...
@@ -62,8 +62,8 @@ export default {
},
data
()
{
return
{
showBanner
:
!
0
,
looptime
:
4000
,
// 循环时间
showBanner
:
!
0
,
looptime
:
4000
,
// 循环时间
typeId
:
"营地类型"
,
dataType
:
[],
totalCount
:
""
,
...
...
@@ -90,7 +90,7 @@ export default {
window
.
addEventListener
(
"scroll"
,
this
.
scrollHandle
);
// 绑定页面的滚动事件
},
methods
:
{
chooseSelect
(
e
)
{
console
.
log
(
e
.
target
.
value
);
this
.
listQuery
.
type
=
e
.
target
.
value
;
...
...
@@ -98,23 +98,19 @@ export default {
},
goDetails
()
{
console
.
log
(
2222222
);
},
async
getType
()
{
const
{
data
:
{
data
}
}
=
await
axios
.
get
(
"https://dev.dfangche.com/api/campsite/campsiteTag/app/unauth/tags"
);
}
=
await
axios
.
get
(
"/api/campsite/campsiteTag/app/unauth/tags"
);
// console.log(data);
this
.
dataType
=
data
;
},
async
getAll
()
{
let
{
data
:
{
data
}
}
=
await
axios
.
get
(
`https://dev.dfangche.com/api/uccn/app/unauth/campsite/shops?type=
${
this
.
listQuery
.
type
}
&pageNo=
${
this
.
listQuery
.
pageNo
}
&pageSize=
${
this
.
listQuery
.
pageSize
}
`
);
}
=
await
axios
.
get
(
`/api/uccn/app/unauth/campsite/shops?type=
${
this
.
listQuery
.
type
}
&pageNo=
${
this
.
listQuery
.
pageNo
}
&pageSize=
${
this
.
listQuery
.
pageSize
}
`
);
// console.log(data);
if
(
!
data
.
data
.
length
==
0
){
this
.
totalCount
=
data
.
totalCount
;
...
...
@@ -125,8 +121,6 @@ export default {
this
.
dataDetail
=
data
.
data
;
this
.
dataNull
=
true
}
// this.dataDetail = this.dataDetail.push(data.data);
},
// 点击下一页回调
prev
()
{
...
...
@@ -155,36 +149,17 @@ export default {
// console.log("距顶部"+scrollTop+"可视区高度"+windowHeight+"滚动条总高度"+scrollHeight);
// this.listQuery.pageNo++;
// this.getAll();
}
}
},
head
:
{
title
:
"房车营地"
},
async
asyncData
()
{
const
{
data
}
=
await
axios
.
get
(
'
https://dev.dfangche.com
/api/app/banner/app/unauth/findBannerlist?type=2&platform=1'
);
const
{
data
}
=
await
axios
.
get
(
'/api/app/banner/app/unauth/findBannerlist?type=2&platform=1'
);
let
cc
=
data
.
data
;
return
{
bannerList
:
cc
}
},
// async asyncData({store,listQuery}) {
// let [dataType,dataDetail] = await Promise.all([
// axios.get("https://dev.dfangche.com/api/campsite/campsiteTag/app/unauth/tags"),
// axios.get("https://dev.dfangche.com/api/uccn/app/unauth/campsite/shops")
// ])
// console.log(dataDetail.data.data.data);
// console.log(dataType.data.data,);
// return {
// dataType:dataType.data.data,
// dataDetail:dataDetail.data.data.data,
// data3:dataDetail.data.data
// };
// },
};
</
script
>
<
style
scoped
>
.clearfix
:after
{
/*伪元素是行内元素 正常浏览器清除浮动方法*/
...
...
@@ -201,23 +176,6 @@ export default {
.wrap
{
padding
:
0
0
;
}
/* .banner {
text-align: center;
}
.banner h2 {
font-size: 20px;
font-weight: 700;
padding-top: 40px;
}
.banner h3 {
font-size: 16px;
padding-top: 20px;
font-weight: 400;
padding-bottom: 40px;
} */
.campsiteDetail
{
padding
:
0
;
margin
:
0
;
...
...
@@ -248,4 +206,4 @@ export default {
color
:
white
;
/* 字体颜色 */
margin-left
:
10px
;
}
</
style
>
\ No newline at end of file
</
style
>
pages/campsiteDetails/_id.vue
View file @
80972b4d
...
...
@@ -94,12 +94,11 @@
</
template
>
<
script
>
import
axios
from
"axios"
;
import
axios
from
'../../plugins/axios'
import
menuModal
from
"../../components/menu"
;
import
footerModal
from
"../../components/footer"
;
import
Swiper
from
"swiper"
;
import
"swiper/dist/css/swiper.min.css"
;
// import { getDetail } from '../../../../demo nuxt/nuxt-bnhcp/ajax/getData';
export
default
{
transition
:
"bounce"
,
components
:
{
...
...
@@ -125,12 +124,9 @@ export default {
return
!
isNaN
(
+
params
.
id
);
},
async
asyncData
({
env
,
params
,
error
})
{
const
{
data
}
=
await
axios
.
get
(
env
.
host
+
"/api/uccn/app/unauth/campsite/shop?id="
+
params
.
id
);
const
{
data
}
=
await
axios
.
get
(
"/api/uccn/app/unauth/campsite/shop?id="
+
params
.
id
);
let
user
=
data
.
data
;
let
campsiteShop
=
user
.
campsiteShopCarouselDetailVos
;
// console.log(user);
if
(
!
user
)
{
return
error
({
message
:
"User not found"
,
statusCode
:
404
});
...
...
@@ -141,7 +137,6 @@ export default {
changeImgIndex
(
index
,
length
)
{
this
.
$refs
.
mySwiper
.
swiper
.
slideTo
(
index
+
1
,
1000
,
true
);
this
.
lengthPic
=
length
;
// console.log(this.lengthPic);
},
visiblePic
()
{
this
.
visible
=
!
this
.
visible
;
...
...
@@ -149,25 +144,14 @@ export default {
async
getNode
()
{
const
{
data
:
{
data
}
}
=
await
axios
.
get
(
"https://dev.dfangche.com/api/app/cofig/app/unauth/types?types=13"
);
// console.log(data[0].value);
}
=
await
axios
.
get
(
"/api/app/cofig/app/unauth/types?types=13"
);
this
.
value
=
data
[
0
].
value
;
},
async
getHot
()
{
const
{
data
:
{
data
}
}
=
await
axios
.
get
(
"https://dev.dfangche.com/api/uccn/random/list/app/unauth/get?type=4&number&location=2"
);
console
.
log
(
data
);
const
{
data
:
{
data
}
}
=
await
axios
.
get
(
"/api/uccn/random/list/app/unauth/get?type=4&number&location=2"
);
this
.
hotList
=
data
},
toHot
(
id
){
// console.log(id);
// params.id = id
}
toHot
(
id
){
}
},
mounted
()
{
let
t
=
this
;
...
...
@@ -218,7 +202,7 @@ export default {
*
zoom
:
1
;
/*ie6清除浮动的方式 *号只有IE6-IE7执行,其他浏览器不执行*/
}
.wrap
{
padding
:
0
10%
;
}
.gallery-top
img
{
...
...
@@ -261,4 +245,3 @@ export default {
</
style
>
\ No newline at end of file
pages/demo.vue
View file @
80972b4d
...
...
@@ -21,19 +21,28 @@
</
template
>
<
script
>
import
axios
from
'
axios'
import
axios
from
'
../plugins/axios'
;
export
default
{
data
(){
return
{
pageNo
:
1
,
pageSize
:
10
,
nomore
:
false
,
loading
:
false
,
evns
:
""
}
},
async
asyncData
({
env
})
{
const
{
data
}
=
await
axios
.
get
(
env
.
host
+
'/api/uccn/app/unauth/campsite/shops?type=53&pageNo=1&pageSize=1
0'
);
const
{
data
}
=
await
axios
.
get
(
'/api/uccn/app/unauth/campsite/shops?type=53&pageNo=1&pageSize=1000
0'
);
let
cc
=
data
.
data
.
data
;
console
.
log
(
data
);
// return { users: env.users }
return
{
users
:
cc
}
return
{
users
:
cc
,
evn
:
env
.
host
}
},
mounted
(){
let
t
=
this
;
t
.
pageNo
=
2
;
},
// asyncData ({ env }) {
// return { users: env.users }
// }
methods
:{
}
}
</
script
>
...
...
pages/demoList/_id.vue
View file @
80972b4d
...
...
@@ -6,29 +6,20 @@
</
template
>
<
script
>
import
axios
from
'axios'
import
axios
from
'
../../plugins/
axios'
export
default
{
validate
({
params
})
{
console
.
log
(
params
.
id
);
return
!
isNaN
(
+
params
.
id
)
},
async
asyncData
({
env
,
params
,
error
})
{
const
{
data
}
=
await
axios
.
get
(
env
.
host
+
'/api/uccn/app/unauth/campsite/shop?id='
+
params
.
id
);
const
{
data
}
=
await
axios
.
get
(
'/api/uccn/app/unauth/campsite/shop?id='
+
params
.
id
);
let
user
=
data
.
data
;
if
(
!
user
)
{
return
error
({
message
:
'User not found'
,
statusCode
:
404
})
}
return
user
},
// asyncData ({ params, env, error }) {
////
// const user = env.users.find(user => String(user.id) === params.id)
// if (!user) {
// return error({ message: 'User not found', statusCode: 404 })
// }
// return user
// },
head
()
{
return
{
title
:
this
.
name
...
...
pages/index.vue
View file @
80972b4d
...
...
@@ -25,7 +25,7 @@
<div
class=
"line-title"
></div>
</div>
</div>
<img
src=
"../assets/images/tv.png"
/>
<img
src=
"../assets/images/tv.png"
style=
"width: 1200px;"
/>
<!--autoplay="autoplay"-->
<video
class=
"video-play"
width=
"320"
height=
"240"
controls
muted
>
<source
src=
"https://xxtest.upyuns.com/image/test.mp4"
type=
"video/mp4"
>
...
...
@@ -146,7 +146,6 @@
<div
class=
"min-win"
>
<ul
class=
"v-type-ul"
>
<li
class=
"v-type"
:class=
"tabIndex== 0?'v-type-active':''"
@
click=
"changeVehicle(0)"
>
上汽大通
</li>
<!--
<li
class=
"v-type"
:class=
"tabIndex== 0?'v-type-active':''"
@
click=
"changeVehicle(0)"
>
上汽大通
</li>
-->
<li
class=
"v-type"
:class=
"tabIndex== 1?'v-type-active':''"
@
click=
"changeVehicle(1)"
>
格林卡诺C2
</li>
<li
class=
"v-type"
:class=
"tabIndex== 2?'v-type-active':''"
@
click=
"changeVehicle(2)"
>
齐星依维柯
</li>
<li
class=
"v-type"
:class=
"tabIndex== 3?'v-type-active':''"
@
click=
"changeVehicle(3)"
>
奔驰斯宾特
</li>
...
...
@@ -268,7 +267,7 @@
</
template
>
<
script
>
import
axios
from
'axios'
import
axios
from
'
../plugins/
axios'
import
banner
from
"../components/banner"
import
bannerActivity
from
"../components/bannerActivity"
import
menuModal
from
"../components/menu"
...
...
@@ -370,17 +369,17 @@ export default {
}
// 首页活动
const
{
data
}
=
await
axios
.
get
(
env
.
host
+
'/api/uccn/summitActivity/app/unauth/home'
);
const
{
data
}
=
await
axios
.
get
(
'/api/uccn/summitActivity/app/unauth/home'
);
let
cc
=
data
.
data
;
cc
.
map
(
function
(
item
){
item
.
startTime
=
timestamp2DateNoTime
(
item
.
startTime
);
item
.
endTime
=
timestamp2DateNoTime
(
item
.
endTime
);
});
//首页banner
let
tempBannerData
=
await
axios
.
get
(
env
.
host
+
'/api/app/banner/app/unauth/findBannerlist?type=0&platform=1'
);
let
tempBannerData
=
await
axios
.
get
(
'/api/app/banner/app/unauth/findBannerlist?type=0&platform=1'
);
let
banner
=
tempBannerData
.
data
.
data
;
//首页新闻
let
newsData
=
await
axios
.
get
(
'
https://xxtest.upyuns.com
/api/uccn/article/app/unauth/homePage/1'
);
let
newsData
=
await
axios
.
get
(
'/api/uccn/article/app/unauth/homePage/1'
);
let
news
=
newsData
.
data
.
data
;
return
{
activityList
:
cc
,
bannerList
:
banner
,
newsList
:
news
}
},
...
...
pages/news.vue
View file @
80972b4d
...
...
@@ -42,7 +42,7 @@
</
template
>
<
script
>
import
axios
from
"axios"
;
import
axios
from
'../plugins/axios'
;
import
menuModal
from
"../components/menu"
;
import
footerModal
from
"../components/footer"
;
import
vehicleBanner
from
"../components/vehicleBanner"
...
...
@@ -101,7 +101,7 @@
*/
async
getBanner
(){
//首活动banner
let
tempBannerData
=
await
axios
.
get
(
'
https://dev.dfangche.com
/api/app/banner/app/unauth/findBannerlist?type=5&platform=1'
);
let
tempBannerData
=
await
axios
.
get
(
'/api/app/banner/app/unauth/findBannerlist?type=5&platform=1'
);
let
banner
=
tempBannerData
.
data
.
data
;
this
.
bannerList
=
banner
;
},
...
...
@@ -116,9 +116,7 @@
async
getAll
()
{
let
{
data
:
{
data
}
}
=
await
axios
.
get
(
`https://dev.dfangche.com/api/uccn/article/app/unauth/list?type=1&page=1&limit=10000`
);
}
=
await
axios
.
get
(
`/api/uccn/article/app/unauth/list?type=1&page=1&limit=10000`
);
// console.log(data);
this
.
totalCount
=
data
.
total
;
this
.
dataDetail
=
data
.
list
;
...
...
pages/newsList/_id.vue
View file @
80972b4d
...
...
@@ -39,7 +39,7 @@
</
template
>
<
script
>
import
axios
from
'axios'
import
axios
from
'
../../plugins/
axios'
import
menuModal
from
"../../components/menu"
import
footerModal
from
"../../components/footer"
import
Swiper
from
'swiper'
;
...
...
@@ -62,40 +62,12 @@
return
!
isNaN
(
+
params
.
id
)
},
async
asyncData
({
env
,
params
,
error
})
{
function
formatDate
(
date
,
fmt
)
{
if
(
/
(
y+
)
/
.
test
(
fmt
))
{
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
date
.
getFullYear
()
+
''
).
substr
(
4
-
RegExp
.
$1
.
length
))
}
let
o
=
{
'M+'
:
date
.
getMonth
()
+
1
,
'd+'
:
date
.
getDate
(),
'h+'
:
date
.
getHours
(),
'm+'
:
date
.
getMinutes
(),
's+'
:
date
.
getSeconds
()
}
for
(
let
k
in
o
)
{
if
(
new
RegExp
(
`(
${
k
}
)`
).
test
(
fmt
))
{
let
str
=
o
[
k
]
+
''
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
===
1
?
str
:
padLeftZero
(
str
))
}
}
return
fmt
}
function
padLeftZero
(
str
)
{
return
(
'00'
+
str
).
substr
(
str
.
length
)
}
function
timestamp2Date
(
timestamp
)
{
let
date
=
new
Date
(
timestamp
);
//时间戳为10位需*1000,时间戳为13位的话不需乘1000
return
formatDate
(
date
,
'yyyy-MM-dd hh:mm:ss'
);
}
const
{
data
}
=
await
axios
.
get
(
env
.
host
+
'//api/uccn/article/app/unauth/one?id='
+
params
.
id
+
"&urlType=1"
);
const
{
data
}
=
await
axios
.
get
(
'/api/uccn/article/app/unauth/one?id='
+
params
.
id
+
"&urlType=1"
);
let
detail
=
data
.
data
;
detail
.
startTime
=
timestamp2Date
(
detail
.
startTime
);
detail
.
endTime
=
timestamp2Date
(
detail
.
endTime
);
if
(
!
detail
)
{
return
error
({
message
:
'detail not found'
,
statusCode
:
404
})
}
let
tempBannerData
=
await
axios
.
get
(
env
.
host
+
'/api/uccn/article/app/unauth/three/1'
);
let
tempBannerData
=
await
axios
.
get
(
'/api/uccn/article/app/unauth/three/1'
);
let
hot
=
tempBannerData
.
data
.
data
;
return
{
detail
:
detail
,
hotList
:
hot
}
},
...
...
@@ -191,20 +163,11 @@
.content-detail
.c-title
{
padding
:
5px
;
}
/*.content-new{*/
/*background: #fff;*/
/*padding: 10px 20px;*/
/*box-shadow: 5px 5px 5px #ccc;*/
/*margin-bottom: 10px;*/
/*}*/
.content-new
a
{
display
:
flex
;
color
:
#333
;
}
.swiper-wrapper-thu
{
/*max-width: 293px;*/
margin
:
0
!important
;
}
.swiper-wrapper-thu
img
{
...
...
pages/tour.vue
View file @
80972b4d
...
...
@@ -38,7 +38,7 @@
<div
style=
"float:left;width:70%;padding-left:30px"
>
<h2
style=
"font-size: 18px"
>
{{
item
.
name
}}
</h2>
<h6
style=
"font-size: 16px;font-weight:400;margin:35px 8px"
>
{{
item
.
describe
}}
</h6>
<nuxt-link
:to=
"item.link"
>
<button
class=
"buttonDetails"
>
旅游详情
</button>
</nuxt-link>
...
...
@@ -52,7 +52,7 @@
</
template
>
<
script
>
import
axios
from
'axios'
import
axios
from
'
../plugins/
axios'
import
menuModal
from
"../components/menu"
import
footerModal
from
"../components/footer"
import
banner
from
"../components/banner"
...
...
@@ -98,25 +98,17 @@
async
getType
()
{
const
{
data
:
{
data
}
}
=
await
axios
.
get
(
"https://dev.dfangche.com/api/uccn/app/unauth/tour/tagList"
);
// console.log(data);
}
=
await
axios
.
get
(
"/api/uccn/app/unauth/tour/tagList"
);
this
.
dataType
=
data
;
},
async
getAll
()
{
let
{
data
:
{
data
}
}
=
await
axios
.
get
(
`https://dev.dfangche.com/api/uccn/app/unauth/tour/getGoodList?tagId=
${
this
.
listQuery
.
tagId
}
&page=
${
this
.
listQuery
.
page
}
&limit=
${
this
.
listQuery
.
limit
}
`
);
}
=
await
axios
.
get
(
`/api/uccn/app/unauth/tour/getGoodList?tagId=
${
this
.
listQuery
.
tagId
}
&page=
${
this
.
listQuery
.
page
}
&limit=
${
this
.
listQuery
.
limit
}
`
);
console
.
log
(
data
);
data
.
data
.
map
(
function
(
item
){
// item.modelParam = JSON.parse( item.modelParam);
item
.
link
=
encodeURI
(
'/tourDetails/'
+
item
.
id
+
'?name='
+
item
.
name
);
item
.
link
=
encodeURI
(
item
.
link
);
// item.pictureList = item.picture.split(",");
// item.coverPic = item.coverPic?item.coverPic: item.pictureList.length>0?item.pictureList[0]:'';
});
if
(
!
data
.
data
.
length
==
0
){
this
.
totalCount
=
data
.
totalCount
;
...
...
@@ -127,20 +119,14 @@
this
.
dataDetail
=
data
.
data
;
this
.
dataNull
=
true
}
// this.dataDetail = this.dataDetail.push(data.data);
},
// 点击下一页回调
prev
()
{
},
// 点击下一页回调
next
()
{
},
prev
()
{},
// 点击下一页回调
next
()
{},
// 鼠标移入状态点回调
changeBanner
()
{
},
bannerClick
()
{
},
changeBanner
()
{},
bannerClick
()
{},
},
head
:
{
title
:
'房车旅游'
...
...
@@ -195,4 +181,4 @@
margin-left
:
10px
;
margin-top
:
15px
;
}
</
style
>
\ No newline at end of file
</
style
>
pages/tourDetails/_id.vue
View file @
80972b4d
...
...
@@ -98,7 +98,7 @@
</
template
>
<
script
>
import
axios
from
"axios"
;
import
axios
from
'../../plugins/axios'
import
menuModal
from
"../../components/menu"
;
import
footerModal
from
"../../components/footer"
;
import
Swiper
from
"swiper"
;
...
...
@@ -129,8 +129,7 @@ export default {
},
async
asyncData
({
env
,
params
,
error
})
{
console
.
log
(
params
.
id
);
const
{
data
}
=
await
axios
.
get
(
env
.
host
+
"/api/uccn/app/unauth/tour/detail/"
+
params
.
id
const
{
data
}
=
await
axios
.
get
(
"/api/uccn/app/unauth/tour/detail/"
+
params
.
id
);
let
user
=
data
.
data
;
let
campsiteShop
=
user
.
bannerDTOS
;
...
...
@@ -153,18 +152,14 @@ export default {
async
getNode
()
{
const
{
data
:
{
data
}
}
=
await
axios
.
get
(
"https://dev.dfangche.com/api/app/cofig/app/unauth/types?types=14"
);
}
=
await
axios
.
get
(
"/api/app/cofig/app/unauth/types?types=14"
);
// console.log(data[0].value);
this
.
value
=
data
[
0
].
value
;
},
async
getHot
()
{
const
{
data
:
{
data
}
}
=
await
axios
.
get
(
"https://dev.dfangche.com/api/uccn/random/list/app/unauth/get?type=3&number&location=2"
);
}
=
await
axios
.
get
(
"/api/uccn/random/list/app/unauth/get?type=3&number&location=2"
);
console
.
log
(
data
);
this
.
hotList
=
data
},
...
...
@@ -283,4 +278,3 @@ export default {
\ No newline at end of file
pages/vehicle.vue
View file @
80972b4d
...
...
@@ -42,7 +42,8 @@
</
template
>
<
script
>
import
axios
from
"axios"
;
import
axios
from
'../plugins/axios'
import
menuModal
from
"../components/menu"
;
import
footerModal
from
"../components/footer"
;
import
vehicleBanner
from
"../components/vehicleBanner"
...
...
@@ -99,7 +100,7 @@
*/
async
getBanner
(){
//车型banner
let
tempBannerData
=
await
axios
.
get
(
'
https://dev.dfangche.com
/api/app/banner/app/unauth/findBannerlist?type=1&platform=1'
);
let
tempBannerData
=
await
axios
.
get
(
'/api/app/banner/app/unauth/findBannerlist?type=1&platform=1'
);
let
banner
=
tempBannerData
.
data
.
data
;
this
.
bannerList
=
banner
;
},
...
...
@@ -111,9 +112,7 @@
async
getAll
()
{
let
{
data
:
{
data
}
}
=
await
axios
.
get
(
`https://dev.dfangche.com/api/uccn/vehicleModel/app/unauth/findVehicleModelPage?page=1&limit=100`
);
}
=
await
axios
.
get
(
`/api/uccn/vehicleModel/app/unauth/findVehicleModelPage?page=1&limit=100`
);
// console.log(data);
this
.
totalCount
=
data
.
totalCount
;
data
.
data
.
map
(
function
(
item
){
...
...
pages/vehicleList/_id.vue
View file @
80972b4d
...
...
@@ -95,7 +95,7 @@
</
template
>
<
script
>
import
axios
from
'axios'
import
axios
from
'
../../plugins/
axios'
import
menuModal
from
"../../components/menu"
import
footerModal
from
"../../components/footer"
import
Swiper
from
'swiper'
;
...
...
@@ -117,7 +117,7 @@
return
!
isNaN
(
+
params
.
id
)
},
async
asyncData
({
env
,
params
,
route
,
error
})
{
const
{
data
}
=
await
axios
.
get
(
env
.
host
+
'/api/uccn/vehicleModel/app/unauth/detail/'
+
route
.
query
.
name
);
const
{
data
}
=
await
axios
.
get
(
'/api/uccn/vehicleModel/app/unauth/detail/'
+
route
.
query
.
name
);
let
user
=
data
.
data
;
data
.
data
.
modelsDetails
=
data
.
data
.
modelsDetails
.
replace
(
/<img/g
,
"<img style='width:100%'"
);
data
.
data
.
modelParam
=
JSON
.
parse
(
data
.
data
.
modelParam
);
...
...
@@ -128,7 +128,7 @@
if
(
!
user
)
{
return
error
({
message
:
'User not found'
,
statusCode
:
404
})
}
let
tempBannerData
=
await
axios
.
get
(
env
.
host
+
'/api/uccn/random/list/app/unauth/get?type=1'
);
let
tempBannerData
=
await
axios
.
get
(
'/api/uccn/random/list/app/unauth/get?type=1'
);
let
hot
=
tempBannerData
.
data
.
data
;
hot
.
map
(
function
(
item
){
item
.
link
=
encodeURI
(
'/vehicleList/'
+
item
.
id
+
'?name='
+
item
.
name
);
...
...
@@ -136,7 +136,7 @@
item
.
pictureList
=
item
.
picture
.
split
(
","
);
item
.
coverPic
=
item
.
coverPic
?
item
.
coverPic
:
item
.
pictureList
.
length
>
0
?
item
.
pictureList
[
0
]:
''
;
});
let
noticeData
=
await
axios
.
get
(
env
.
host
+
'/api/app/cofig/app/unauth/types?types=6'
);
let
noticeData
=
await
axios
.
get
(
'/api/app/cofig/app/unauth/types?types=6'
);
let
notice
=
noticeData
.
data
.
data
;
return
{
detail
:
user
,
hotList
:
hot
,
notice
:
notice
}
},
...
...
@@ -188,13 +188,11 @@
width
:
30%
;
border-left
:
1px
solid
#ccc
;
border-right
:
1px
solid
#ccc
;
/*border-bottom: 1px solid #999;*/
padding
:
5px
3px
;
}
.right-item
{
width
:
70%
;
border-right
:
1px
solid
#ccc
;
/*border-bottom: 1px solid #999;*/
padding
:
5px
3px
;
}
.modal-item
{
...
...
plugins/axios.js
0 → 100644
View file @
80972b4d
import
axios
from
'axios'
export
default
axios
.
create
({
baseURL
:
"https://xxtest.upyuns.com"
})
plugins/filters.js
View file @
80972b4d
...
...
@@ -20,6 +20,9 @@ export function formatDate (date, fmt) {
}
return
fmt
}
export
function
getBaseUrl
(){
return
baseUrl
=
"https://xxtest.upyuns.com"
;
}
function
padLeftZero
(
str
)
{
return
(
'00'
+
str
).
substr
(
str
.
length
)
}
...
...
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