Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
ssr-pc
Overview
Overview
Details
Activity
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
tangjiale
ssr-pc
Commits
1567dbb6
Commit
1567dbb6
authored
Sep 28, 2022
by
tangjiale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新代码
parent
f318c0f7
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
77 additions
and
68 deletions
+77
-68
README.md
README.md
+2
-0
nuxt.config.js
nuxt.config.js
+3
-7
center-video.vue
pages/components/center-video.vue
+6
-1
screen.vue
pages/screen.vue
+10
-9
axios.js
plugins/axios.js
+22
-16
screenService.js
services/screenService.js
+22
-8
_type.js
ssr/csScreen/_type.js
+12
-5
_id.js
ssr/tired/_id.js
+0
-22
No files found.
README.md
View file @
1567dbb6
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
*
@LastEditTime: 2022-04-09 16:22:40
*
@LastEditTime: 2022-04-09 16:22:40
-->
-->
# 服务端访问域名:http://182.254.228.249:7001/screen
# 为什么选择nuxt框架? (nuxt.js官网:https://zh.nuxtjs.org/ 当前选用版本为2.9.2)
# 为什么选择nuxt框架? (nuxt.js官网:https://zh.nuxtjs.org/ 当前选用版本为2.9.2)
-
1.由于历史原因,需要封装新的框架/封装业务组件,基于 "轻量简洁" "统一复用" 提高代码的可读性维护性,提高开发者编码效率,减轻开发者编码时间压力。
-
1.由于历史原因,需要封装新的框架/封装业务组件,基于 "轻量简洁" "统一复用" 提高代码的可读性维护性,提高开发者编码效率,减轻开发者编码时间压力。
-
2.基于以往的工作经历 并且 通过 '体质健康/中考等项目(后台)' '跳绳商品详情(h5 => 混合app/公众号/:可联调微信/支付宝)' 'ssr-pc (pc/m 站)'实践,Nuxt.js基本满足各端业务需求。
-
2.基于以往的工作经历 并且 通过 '体质健康/中考等项目(后台)' '跳绳商品详情(h5 => 混合app/公众号/:可联调微信/支付宝)' 'ssr-pc (pc/m 站)'实践,Nuxt.js基本满足各端业务需求。
...
...
nuxt.config.js
View file @
1567dbb6
...
@@ -44,12 +44,8 @@ module.exports = {
...
@@ -44,12 +44,8 @@ module.exports = {
return
[
return
[
...
routes
,
...
routes
,
{
{
path
:
'/tired/:id(
\\
d+)/'
,
path
:
'/csScreen/:type(
\\
d+)/'
,
component
:
'~/ssr/tired/_id.js'
component
:
'~/ssr/csScreen/_type.js'
},
{
path
:
'/'
,
component
:
'~/ssr/test.js'
},
},
];
];
}
}
...
@@ -96,7 +92,7 @@ module.exports = {
...
@@ -96,7 +92,7 @@ module.exports = {
],
],
plugins
:
[
plugins
:
[
'@/plugins/axios.js'
,
'@/plugins/axios.js'
,
'~/plugins/index'
,
'~/plugins/index'
],
],
build
:
{
build
:
{
...
...
pages/components/center-video.vue
View file @
1567dbb6
...
@@ -64,7 +64,12 @@
...
@@ -64,7 +64,12 @@
},
},
created
(){
created
(){
this
.
banners
=
this
.
type
==
2
?
this
.
list
:
[
'https://cdn.xiaobentiyu.cn/yueluscreen/1.jpg'
,
'https://cdn.xiaobentiyu.cn/yueluscreen/2.jpg'
,
'https://cdn.xiaobentiyu.cn/yueluscreen/3.jpg'
]
this
.
banners
=
this
.
type
==
2
?
this
.
list
:
this
.
type
==
4
?
[
'https://cdn.xiaobentiyu.cn/images/20220426190929.png'
]
:
this
.
type
==
5
?
[
'https://cdn.xiaobentiyu.cn/images/20220428142516.png'
]
:
this
.
type
==
6
?
[
'https://cdn.xiaobentiyu.cn/images/20220701105915.jpg'
]
//开福区
:
this
.
type
==
7
?
[
'https://cdn.xiaobentiyu.cn/screen/ly-1.jpg'
,
'https://cdn.xiaobentiyu.cn/screen/ly-2.jpg'
]
//浏阳市
:
[
'https://cdn.xiaobentiyu.cn/yueluscreen/1.jpg'
,
'https://cdn.xiaobentiyu.cn/yueluscreen/2.jpg'
,
'https://cdn.xiaobentiyu.cn/yueluscreen/3.jpg'
]
},
},
mounted
(){
mounted
(){
...
...
pages/screen.vue
View file @
1567dbb6
<
template
>
<
template
>
<div
class=
"index-page"
>
<div
class=
"index-page"
>
<div
class=
"index-page-head"
>
{{
type
==
2
?
'天心区智慧体育监测平台'
:
'岳麓区智慧体育服务平台'
}}
</div>
<div
class=
"index-page-head"
>
{{
`${pageTitle[type]
}
智慧体育监测平台`
}}
<
/div
>
<
div
class
=
"flex-s"
>
<
div
class
=
"flex-s"
>
<
div
class
=
"left"
>
<
div
class
=
"left"
>
<
comBox
height
=
"284px"
title
=
"智能设备使用监测(本学期)"
>
<
comBox
height
=
"284px"
title
=
"智能设备使用监测(本学期)"
>
...
@@ -58,23 +58,24 @@
...
@@ -58,23 +58,24 @@
}
,
}
,
data
(){
data
(){
return
{
return
{
type
:
2
,
type
:
''
,
pageTitle
:[
''
,
''
,
'天心区'
,
'岳麓区'
,
'芙蓉区'
,
'雨花区'
,
'开福区'
,
'浏阳市'
],
dataObj
:{
}
,
dataObj
:{
}
,
localBanner
:[]
localBanner
:[]
}
}
}
,
}
,
async
asyncData
({
app
,
query
,
params
,
redirect
,
returnData
}
)
{
async
asyncData
({
app
,
query
,
params
,
redirect
,
returnData
}
)
{
let
{
type
=
2
}
=
params
let
dataObj
=
await
screen
.
handleScreenData
(
app
)
let
dataObj
=
await
screen
.
handleScreenData
(
app
,
type
)
console
.
log
(
'数据由服务端渲染'
)
return
returnData
({
return
returnData
({
dataObj
dataObj
,
type
:
type
}
)
}
)
}
,
}
,
async
mounted
(){
async
mounted
(){
this
.
localBanner
=
this
.
dataObj
.
banner
||
[]
this
.
localBanner
=
this
.
dataObj
.
banner
||
[]
...
@@ -94,7 +95,7 @@
...
@@ -94,7 +95,7 @@
methods
:{
methods
:{
async
updateNewData
(){
async
updateNewData
(){
this
.
dataObj
=
{
}
this
.
dataObj
=
{
}
this
.
dataObj
=
await
screen
.
handleScreenData
(
app
)
this
.
dataObj
=
await
screen
.
handleScreenData
(
app
,
this
.
type
)
}
}
}
}
}
}
...
...
plugins/axios.js
View file @
1567dbb6
/*
* @Author: tangjiale
* @eMail: 932055106@qq.com
* @Date: 2022-06-24 16:07:59
* @LastEditors: tangjiale
* @LastEditTime: 2022-07-08 09:32:20
*/
import
Vue
from
'vue'
import
Vue
from
'vue'
import
qs
from
'qs'
;
import
qs
from
'qs'
;
//http://t.zoukankan.com/goloving-p-11374165.html
//获取当前环境变量
let
config
=
require
(
`@/config/
${
process
.
env
.
ENV_CONFIG
||
'pro'
}
.config.json`
);
let
config
=
require
(
`@/config/
${
process
.
env
.
ENV_CONFIG
||
'pro'
}
.config.json`
);
export
default
({
app
:{
$axios
,
redirect
,
router
,
store
}},
inject
)
=>
{
export
default
({
app
:{
$axios
,
redirect
,
router
,
store
}},
inject
)
=>
{
//配置域名
$axios
.
defaults
.
baseURL
=
config
.
pigsy
//设置请求头功能属性
//设置请求头功能属性
$axios
.
setHeader
(
'Content-Type'
,
'application/json'
)
//请求类型 默认json
$axios
.
setHeader
(
'Content-Type'
,
'application/json'
)
//请求类型 默认json
...
@@ -18,13 +23,11 @@ export default ({app:{ $axios, redirect, router, store}},inject) => {
...
@@ -18,13 +23,11 @@ export default ({app:{ $axios, redirect, router, store}},inject) => {
$axios
.
defaults
.
timeout
=
10000
$axios
.
defaults
.
timeout
=
10000
// 请求拦截
// 请求拦截
$axios
.
onRequest
(
config
=>
{
$axios
.
onRequest
(
option
=>
{
// if (store.getters && store.getters.token) {
// if (store.getters && store.getters.token) {
// config.headers.authorization = 'Bearer ' + store.getters.token
// config.headers.authorization = 'Bearer ' + store.getters.token
// }
// }
return
config
return
option
})
})
// 响应拦截
// 响应拦截
...
@@ -43,15 +46,18 @@ export default ({app:{ $axios, redirect, router, store}},inject) => {
...
@@ -43,15 +46,18 @@ export default ({app:{ $axios, redirect, router, store}},inject) => {
inject
(
'axiosApi'
,
(
url
,
params
,
option
=
{})
=>
{
inject
(
'axiosApi'
,
(
url
,
params
,
option
=
{})
=>
{
/**
/**
*
获取动态
配置域名 base
*
动态获取
配置域名 base
*/
*/
let
base
=
config
[
option
.
domainKey
||
'monk'
]
$axios
.
defaults
.
baseURL
=
config
[
option
.
domainKey
||
'pigsy'
]
console
.
log
(
$axios
.
defaults
.
baseURL
)
/**
/**
* 自定义
配置请求头
option
* 自定义
请求头配置
option
*/
*/
let
headers
=
{
let
headers
=
{
'tangjiale'
:
'asdasdasdadasdasdada'
//
'tangjiale':'asdasdasdadasdasdada'
}
}
//请求类型,默认get
//请求类型,默认get
let
method
=
option
.
method
||
'get'
let
method
=
option
.
method
||
'get'
...
@@ -60,17 +66,17 @@ export default ({app:{ $axios, redirect, router, store}},inject) => {
...
@@ -60,17 +66,17 @@ export default ({app:{ $axios, redirect, router, store}},inject) => {
Object
.
assign
(
headers
,
{
Object
.
assign
(
headers
,
{
'Content-Type'
:
'application/x-www-form-urlencoded'
'Content-Type'
:
'application/x-www-form-urlencoded'
});
});
params
=
qs
.
stringify
(
params
);
params
=
qs
.
stringify
(
params
);
}
else
{
}
else
{
Object
.
assign
(
headers
,
{
Object
.
assign
(
headers
,
{
'Content-Type'
:
'application/json'
'Content-Type'
:
'application/json'
});
});
}
}
//最终请求头部参数
let
finalHeaders
=
Object
.
assign
(
headers
,
headers
);
let
finalHeaders
=
Object
.
assign
(
headers
,
headers
);
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
//TODO $get只返回data get会返回包含code和data的数据对象
//TODO $get只返回data get会返回包含code和data的数据对象
,所以要把 get 请求转为 $get
$axios
[
method
==
'get'
?
'get'
:
(
'$'
+
method
)
](
$axios
[
method
==
'get'
?
'get'
:
(
'$'
+
method
)
](
url
,
method
===
'get'
?
{
params
:
params
}
:
params
,
{
headers
:
finalHeaders
}).
then
(
res
=>
{
url
,
method
===
'get'
?
{
params
:
params
}
:
params
,
{
headers
:
finalHeaders
}).
then
(
res
=>
{
if
(
res
.
code
&&
res
.
code
==
200
)
{
if
(
res
.
code
&&
res
.
code
==
200
)
{
...
@@ -80,13 +86,13 @@ export default ({app:{ $axios, redirect, router, store}},inject) => {
...
@@ -80,13 +86,13 @@ export default ({app:{ $axios, redirect, router, store}},inject) => {
}
}
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
error
(
JSON
.
stringify
({
console
.
error
(
JSON
.
stringify
({
host
:
base
,
host
:
$axios
.
defaults
.
baseURL
,
url
:
url
,
url
:
url
,
data
:
params
,
data
:
params
,
headers
:
finalHeaders
,
headers
:
finalHeaders
,
reqError
:
JSON
.
stringify
(
err
)
reqError
:
JSON
.
stringify
(
err
)
}));
}));
throw
new
Error
(
JSON
.
stringify
(
err
));
//
throw new Error(JSON.stringify(err));
});
});
})
})
...
...
services/screenService.js
View file @
1567dbb6
...
@@ -2,8 +2,22 @@
...
@@ -2,8 +2,22 @@
import
Vue
from
'vue'
import
Vue
from
'vue'
let
axiosApi
=
null
let
axiosApi
=
null
let
regionCode
=
''
//根据外部传入的ctx对象,赋值给本地serve文件
//根据外部传入的ctx对象,赋值给本地serve文件
const
handleScreenData
=
async
(
app
)
=>
{
const
handleScreenData
=
async
(
app
,
type
=
2
)
=>
{
let
areaCode
=
{
2
:
'430103000000'
,
//天心区
3
:
'430104000000'
,
//岳麓区
4
:
'430102000000'
,
//芙蓉区
5
:
'430111000000'
,
//雨花区
6
:
'430105000000'
,
//开福区
7
:
'430181000000'
,
//浏阳市
// 8:'430106000000', //高新区
}
regionCode
=
areaCode
[
type
]
||
'430104000000'
axiosApi
=
app
.
$axiosApi
axiosApi
=
app
.
$axiosApi
let
banner
=
await
queryVideoBanner
()
let
banner
=
await
queryVideoBanner
()
...
@@ -39,12 +53,12 @@ const handleScreenData = async (app) => {
...
@@ -39,12 +53,12 @@ const handleScreenData = async (app) => {
//中间banner图
//中间banner图
const
queryVideoBanner
=
async
()
=>
{
const
queryVideoBanner
=
async
()
=>
{
return
await
axiosApi
(
'/sport/new/screen/getMidUrl'
,{
regionCode
:
430103000000
},{})
return
await
axiosApi
(
'/sport/new/screen/getMidUrl'
,{
regionCode
:
regionCode
},{})
}
}
//年级分布
//年级分布
const
queryYearList
=
async
()
=>
{
const
queryYearList
=
async
()
=>
{
return
await
axiosApi
(
'/sport/new/screen/getGradeJoinList'
,{
regionCode
:
430103000000
},{}).
then
(
res
=>
{
return
await
axiosApi
(
'/sport/new/screen/getGradeJoinList'
,{
regionCode
:
regionCode
},{}).
then
(
res
=>
{
//配置颜色
//配置颜色
const
color
=
[
'#3597FF'
,
'#4EC9E1'
,
'#1BD861'
,
'#1BD861'
,
'#F19466'
,
'#3597FF'
,
'#4EC9E1'
,
'#1BD861'
,
'#F19466'
,
'#3597FF'
]
const
color
=
[
'#3597FF'
,
'#4EC9E1'
,
'#1BD861'
,
'#1BD861'
,
'#F19466'
,
'#3597FF'
,
'#4EC9E1'
,
'#1BD861'
,
'#F19466'
,
'#3597FF'
]
let
option
=
[]
let
option
=
[]
...
@@ -65,21 +79,21 @@ const queryYearList = async ()=>{
...
@@ -65,21 +79,21 @@ const queryYearList = async ()=>{
//学校TOP10排行
//学校TOP10排行
const
getSchoolSpeedTopList
=
async
()
=>
{
const
getSchoolSpeedTopList
=
async
()
=>
{
return
await
axiosApi
(
'/sport/new/screen/getSchoolSpeedTopList'
,{
regionCode
:
430103000000
},{})
return
await
axiosApi
(
'/sport/new/screen/getSchoolSpeedTopList'
,{
regionCode
:
regionCode
},{})
}
}
//学生TOP20排行
//学生TOP20排行
const
getStudentSpeedTopList
=
async
()
=>
{
const
getStudentSpeedTopList
=
async
()
=>
{
return
await
axiosApi
(
'/sport/new/screen/getStudentSpeedTopList'
,{
regionCode
:
430103000000
},{})
return
await
axiosApi
(
'/sport/new/screen/getStudentSpeedTopList'
,{
regionCode
:
regionCode
},{})
}
}
//学生运动参与总览
//学生运动参与总览
const
getSportSchoolSum
=
async
()
=>
{
const
getSportSchoolSum
=
async
()
=>
{
return
await
axiosApi
(
'/sport/new/screen/getSportSchoolSum'
,{
regionCode
:
430103000000
},{})
return
await
axiosApi
(
'/sport/new/screen/getSportSchoolSum'
,{
regionCode
:
regionCode
},{})
}
}
//云赛PK 设备数据
//云赛PK 设备数据
const
queryStatistics
=
async
()
=>
{
const
queryStatistics
=
async
()
=>
{
return
await
axiosApi
(
'/sport/new/screen/statistics'
,{
regionCode
:
430103000000
},{}).
then
(
res
=>
{
return
await
axiosApi
(
'/sport/new/screen/statistics'
,{
regionCode
:
regionCode
},{}).
then
(
res
=>
{
let
_list
=
[...(
res
.
detailList
||
[]),...(
res
.
roomList
||
[])]
let
_list
=
[...(
res
.
detailList
||
[]),...(
res
.
roomList
||
[])]
res
.
_list
=
_list
res
.
_list
=
_list
return
res
return
res
...
@@ -89,7 +103,7 @@ const queryStatistics = async ()=>{
...
@@ -89,7 +103,7 @@ const queryStatistics = async ()=>{
//学校平均参与率
//学校平均参与率
const
querySchoolJoin
=
async
(
dateType
,
studyStep
)
=>
{
const
querySchoolJoin
=
async
(
dateType
,
studyStep
)
=>
{
return
await
axiosApi
(
"/sport/new/screen/getSchoolAvgJoinRate"
,
{
return
await
axiosApi
(
"/sport/new/screen/getSchoolAvgJoinRate"
,
{
regionCode
:
430103000000
,
dateType
,
studyStep
regionCode
:
regionCode
,
dateType
,
studyStep
})
})
}
}
...
...
ssr/
screen
.js
→
ssr/
csScreen/_type
.js
View file @
1567dbb6
import
container
from
'../pages/screen'
;
/*
* @Author: tangjiale
* @eMail: 932055106@qq.com
* @Date: 2022-09-28 15:35:02
* @LastEditors: tangjiale
* @LastEditTime: 2022-09-28 15:47:42
*/
import
container
from
'~/pages/screen'
container
.
head
=
function
()
{
container
.
head
=
function
()
{
const
titleList
=
[
''
,
''
,
'天心区'
,
'岳麓区'
,
'芙蓉区'
,
'雨花区'
,
'开福区'
,
'浏阳市'
]
return
{
return
{
title
:
`
岳麓区数据大屏
`
,
title
:
`
${
titleList
[
this
.
type
]}
智慧体育监测平台
`
,
meta
:
[
meta
:
[
{
{
hid
:
'description'
,
hid
:
'description'
,
name
:
'description'
,
name
:
'description'
,
content
:
'测试测试多url指向同一页面'
content
:
`
${
titleList
[
this
.
type
]}
智慧体育监测平台`
,
},
},
{
{
name
:
'keywords'
,
name
:
'keywords'
,
content
:
'测试测试多url指向同一页面'
content
:
`
${
titleList
[
this
.
type
]}
智慧体育监测平台`
,
}
}
],
],
link
:
[],
link
:
[],
...
...
ssr/tired/_id.js
deleted
100644 → 0
View file @
f318c0f7
import
container
from
'../../pages/test'
;
container
.
head
=
function
()
{
return
{
title
:
`
${
this
.
ip
[
0
]}
- 小本体育`
,
meta
:
[
{
hid
:
'description'
,
name
:
'description'
,
content
:
'测试测试多url指向同一页面'
},
{
name
:
'keywords'
,
content
:
'测试测试多url指向同一页面'
}
],
link
:
[],
};
};
export
default
container
;
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