123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <template>
- <view class="content">
- <view class="top">
- <!-- 自定义导航栏 -->
- <i-navbar></i-navbar>
- <!-- 公告 -->
- <i-notice :notice="notice"></i-notice>
- </view>
- <!-- banner -->
- <i-banner :banners="banners"></i-banner>
- <!-- news -->
- <i-news-list :newsList="newsList"></i-news-list>
- <!-- i-nav-list -->
- <i-nav-list :navsList="navsList"></i-nav-list>
- <!-- i-block-list -->
- <i-block-list :blocksList="blocksList"></i-block-list>
- <!-- null-bottom -->
- <i-null-bottom></i-null-bottom>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- notice:{
- title:"今日值班",
- message:"",
- },
- banners:[],
- newsList:[],
- navsList:[],
- blocksList:[]
-
- }
- },
- onLoad() {
-
- // 获取公告
- this.getNotice()
- // 获取轮播图
- this.getBanner()
- // 获取新闻列表
- this.getNews()
- // 获取首页导航
- this.getNavs()
- // 获取首页分类链接
- this.getBlocksList()
- },
- methods:{
- // 请求获取公告
- async getNotice(){
- const res = await this.$myRequest({
- url: '/notice/list',
- })
- // console.log(res)
- const data = res.data.data
- this.notice.title = data.title
-
- if(!data.content){
- this.notice.message = data.message + '。'
- return
- }
-
-
- this.notice.message = data.content.split(';')
- },
- // 请求轮播图
- async getBanner(){
- const res = await this.$myRequest({
- url: '/scrollImg/list',
- })
- // console.log(res.data.data.data)
- const data = res.data.data.data
- this.banners = data
- // console.log(this.banners)
-
- },
- // 请求新闻动态
- async getNews(){
- const res = await this.$myRequest({
- url: '/article/list',
- })
- // console.log(res.data.data.data)
- const data = res.data.data.data
-
- this.newsList = data
- },
- // 请求首页导航设置
- async getNavs(){
- const res = await this.$myRequest({
- url: '/homeNav/list',
- })
- // console.log(res.data.data.data)
- const data = res.data.data.data
-
- this.navsList = data
- },
- // 请求首页分类链接
- async getBlocksList(){
- const res = await this.$myRequest({
- url: '/home/links',
- header:{
- Authorization : uni.getStorageSync('token_type') +' '+uni.getStorageSync('Authorization')
- }
- })
- console.log(res.data.data)
- const data = res.data.data
-
- this.blocksList = data
- },
-
-
-
-
- }
- }
- </script>
- <style lang="scss">
- .top {
- width: 100%;
- height: 457rpx;
- background-image: url(../../../static/top.png);
- background-size: cover;
- background-repeat: no-repeat;
- }
- </style>
|