You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cesuan/pages/index/index.vue

642 lines
14 KiB

1 year ago
<template>
<view class="page">
<view class="box_1">
<view class="group_1">
<view class="box_2">
<view @click="jump_about()" class="section_2">
<view @click.stop="jump_about()" class="nav-bar_1">
<view class="searchbtn"></view>
<input class="searchinput" type="text">
</view>
</view>
<view class="sitename">德易简介</view>
<swiper class="swiper"
indicator-dots
indicator-active-color="#FFFFFF"
circular
autoplay
>
<swiper-item
v-for="item in rotation"
:key="item.id"
>
<img :src = "item.image" class="image_6"/>
</swiper-item>
</swiper>
<view class="todayinfo">
<img src="../../static/index/daily.png" class="image_7"/>
<view>
<view @click="dailyinfo(1)" class="today_l"></view>
<view class="today_m">
<view>{{today}}</view>
</view>
<view @click="dailyinfo(0)" class="today_r"></view>
</view>
</view>
<view class="tag_1">
<img src="../../static/index/laba.png" alt="">
<swiper circular autoplay="true" interval="4000" duration="2000" style="width: 100%; height: 100%;" class="margin-right30 swiperBox">
<swiper-item v-for="(item,index) in noticeList" :key="index" class="row-me row-center swiperItem">
<view @click="article_detail(item.article_id)">{{item.title}}...&nbsp;&nbsp;&gt;</view>
</swiper-item>
</swiper>
</view>
<img src="../../static/index/daywordtop.png" class="image_8"/>
<view class="section_3">
<text lines="1" class="paragraph_1">繁体{{day_word.fan_ti}}<br/><br/>五行{{day_word.wuxing}}</text>
<view class="text-wrapper_1">
<text lines="1" class="text_2">{{day_word.name}}</text>
</view>
<text lines="1" class="paragraph_2">{{day_word.content}}</text>
</view>
<text lines="1" decode="true" class="text_3">///&nbsp;最新文章&nbsp;///</text>
<view v-for="courseinfo in articlelist" class="section_4" @click="article_detail(courseinfo.article_id)">
<img :src="courseinfo.image" class="image_9"/>
<view class="text-wrapper_2">
<text lines="1" class="text_4">{{courseinfo.title}}</text>
<text lines="1" class="text_5">{{courseinfo.introduction}}</text>
<text lines="1" class="text_6">{{courseinfo.created_at}}</text>
</view>
</view>
<img src="../../static/index/ar-d.png" @click="showarticle()" class="label_2"/>
</view>
<tabBar class="tab-bar_1" currenttype="1">
</tabBar >
</view>
</view>
</view>
</template>
<script>
import { setCartTabBadge } from '@/core/app'
import * as Api from '@/api/page'
import Page from '@/components/page'
import tabBar from '@/components/tabbar'
import * as ArticleApi from '@/api/article'
const App = getApp()
export default {
components: {
Page,
tabBar
},
data() {
var myDate = new Date();
return {
today:myDate.getFullYear()+"."+(myDate.getMonth()+1)+"."+myDate.getDate(),
// 页面参数
options: {},
// 页面属性
page: {},
// 页面元素
items: [],
rotation: [
{
id: 1,
url: '../../static/index/swiper.png'
},
{
id: 2,
url: '../../static/index/swiper.png'
},
],
noticeList:[ //公告栏播报
],
day_word:{
'name':'表',
'fan_ti':'表',
'wuxing':'水',
'content':'出外吉祥,温和诚实,中年劳,晚年吉庆,刑偶或欠子。',
},
articlelist:[]
}
},
onPageScroll(res) {
uni.$emit('onPageScroll', res.scrollTop);//传递参数
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 当前页面参数
this.options = options
// 加载页面数据
//this.getPageData();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 更新购物车角标
this.getPageData();
},
methods: {
jump_about()
{
this.$navTo('pages/about/about');
},
article_detail(article_id)
{
this.$navTo('pages/articledetail/articledetail',{article_id:article_id});
},
jump_spread()
{
this.$navTo('pages/spread/spread');
},
dailyinfo(type)
{
console.log(111);
this.$navTo('pages/dailyinfo/dailyinfo',{type:type});
},
/**
* 加载页面数据
* @param {Object} callback
*/
getPageData(callback) {
const app = this
const pageId = app.options.pageId || 0
Api.detail(pageId)
.then(result => {
// 设置页面数据
const { data: { pageData } } = result
app.page = pageData.page
app.items = pageData.items
// 设置顶部导航栏栏
app.setPageBar();
})
.finally(() => callback && callback())
Api.bannerList()
.then(result => {
app.rotation = result.data;
})
.finally(() => callback && callback())
//首页文章
ArticleApi.list({type:7})
.then(result => {
app.articlelist = result.data;
})
.finally(() => callback && callback())
//公告
ArticleApi.list({type:2})
.then(result => {
app.noticeList = result.data;
})
.finally(() => callback && callback())
//公告
Api.homeWord()
.then(result => {
app.day_word = result.data;
})
.finally(() => callback && callback())
},
/**
* 设置顶部导航栏
*/
setPageBar() {
const {
page
} = this
// 设置页面标题
uni.setNavigationBarTitle({
title: page.params.title
});
// 设置navbar标题、颜色
uni.setNavigationBarColor({
frontColor: page.style.titleTextColor === 'white' ? '#ffffff' : '#000000',
backgroundColor: page.style.titleBackgroundColor
})
},
},
/**
* 下拉刷新
*/
onPullDownRefresh() {
// 获取首页数据
this.getPageData(() => {
uni.stopPullDownRefresh()
})
},
/**
* 分享当前页面
*/
onShareAppMessage() {
const app = this
const { page } = app
return {
title: page.params.share_title,
path: "/pages/index/index?" + app.$getShareUrlParams()
}
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* http://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const app = this
const { page } = app
return {
title: page.params.share_title,
path: "/pages/index/index?" + app.$getShareUrlParams()
}
}
}
</script>
<style lang="scss" scoped>
.todayinfo
{
margin:30rpx auto;
height: 270rpx;
position: relative;
width: 100vw;
}
.todayinfo>view
{
height: 270rpx;
color:white;
display: flex;
justify-content: space-between;
width: 100vw;
position: absolute;
top:0;
left:0;
}
.today_l,.today_r,
{
width: 280rpx;
}
.todayinfo img
{
position: absolute;
top:0;
left:0;
}
.today_m
{
padding-top:100rpx;
font-weight: bold;
}
.page {
background-color: rgba(255,255,255,1.000000);
position: relative;
width: 750rpx;
overflow: hidden;
display: flex;
flex-direction: column;
}
.box_1 {
background-color: #fff;
display: flex;
flex-direction: column;
width: 750rpx;
}
.group_1 {
width: 750rpx;
background: url(../../static/index/bg.png) 100%;
background-size: 100% 100%;
flex-direction: row;
display: flex;
padding-bottom: 50px;
}
.box_2 {
width: 750rpx;
display: flex;
flex-direction: column;
padding-bottom: 50px;
}
.section_1 {
width: 651rpx;
height: 22rpx;
flex-direction: row;
display: flex;
margin: 39rpx 0 0 70rpx;
}
.text_1 {
width: 56rpx;
height: 19rpx;
overflow-wrap: break-word;
color: rgba(255,255,255,1);
font-size: 28rpx;
font-family: SFProText-Semibold;
font-weight: 600;
text-align: center;
white-space: nowrap;
line-height: 28rpx;
margin-top: 1rpx;
}
.image_1 {
width: 32rpx;
height: 20rpx;
margin: 1rpx 0 0 475rpx;
}
.image_2 {
width: 29rpx;
height: 20rpx;
margin-left: 9rpx;
}
.group_2 {
height: 22rpx;
margin-left: 9rpx;
display: flex;
flex-direction: column;
width: 41rpx;
}
.group_3 {
background-color: rgba(255,255,255,1.000000);
border-radius: 2rpx;
width: 34rpx;
height: 14rpx;
display: flex;
flex-direction: column;
margin: 4rpx 0 0 4rpx;
}
.section_2 {
width: 750rpx;
height: 280rpx;
margin-top: 19rpx;
flex-direction: row;
display: flex;
background-image: url('../../static/logo.png');
background-repeat: no-repeat;
background-position: center 80rpx;
background-size: 200rpx;
}
.nav-bar_1 {
width: 200rpx;
height: 38rpx;
margin: 18rpx 0 0 21rpx;
flex-direction: row;
display: none;
background-image: url(../../static/seachinput.png);
background-repeat: no-repeat;
background-size: contain;
.searchbtn
{
width: 50rpx;
height: 38rpx;
}
.searchinput
{
height: 38rpx;
width: 150rpx;
font-size: 24rpx;
color:#fff;
}
}
.sitename
{
font-size: 30rpx;
text-align: center;
color:#fff;
margin:20rpx 0 0 0;
}
.swiper
{
margin-top: 10rpx;
}
.applet-top-bar_1 {
width: 141rpx;
height: 40rpx;
margin: 18rpx 20rpx 0 368rpx;
}
.image_4 {
width: 197rpx;
height: 197rpx;
margin: 7rpx 277rpx 0 -474rpx;
}
.image_5 {
width: 79rpx;
height: 19rpx;
margin: 7rpx 0 0 335rpx;
}
/deep/.uni-swiper-dot
{
width: 8rpx;
height:8rpx;
border-radius: unset;
background-color: #aaa;
}
.image_6 {
width: 540rpx;
height: 268rpx;
margin: 17rpx 0 0 105rpx;
}
.image_7 {
width: 750rpx;
height: 241rpx;
margin-top: 32rpx;
}
.tag_1 {
width: 613rpx;
height: 39rpx;
background-color: #e6f0e1;
border-radius: 8rpx;
display: flex;
flex-direction: row;
margin: 25rpx auto 0 auto;
color: rgba(230,0,18,1);
img{
width: 30rpx;
height: 30rpx;
margin:2rpx 16rpx 2rpx 16rpx;
align-self: center;
}
}
.image_8 {
width: 259rpx;
height: 58rpx;
margin: 40rpx 0 0 245rpx;
}
.section_3 {
width: 677rpx;
height: 190rpx;
background: url(../../static/dailyinfo/4.png) 100% no-repeat;
background-size: 100% 100%;
flex-direction: row;
display: flex;
margin: 39rpx 0 0 36rpx;
align-items: center;
}
.paragraph_1 {
width: 130rpx;
height: 80rpx;
overflow-wrap: break-word;
color: rgba(255,255,255,1);
font-size: 24rpx;
font-family: SimHei;
font-weight: normal;
text-align: left;
line-height: 24rpx;
margin: 0 0 0 111rpx;
}
.text-wrapper_1 {
background: url(../../static/index/1.png) 100% no-repeat;
background-size: 100% 100%;
display: flex;
flex-direction: column;
width: 143rpx;
margin: 0 0 0 27rpx;
}
.text_2 {
width: 85rpx;
overflow-wrap: break-word;
color: rgba(230,0,18,1);
font-size: 94rpx;
font-family: FZHLJW--GB1-0;
font-weight: normal;
text-align: left;
white-space: nowrap;
line-height: 94rpx;
margin: 0 0 0 28rpx;
}
.paragraph_2 {
width: 154rpx;
overflow-wrap: break-word;
color: rgba(255,255,255,1);
font-size: 24rpx;
font-family: SimHei;
font-weight: normal;
text-align: left;
line-height: 24rpx;
margin: 0 78rpx 0 34rpx;
}
.text_3 {
width: 270rpx;
height: 24rpx;
overflow-wrap: break-word;
color: rgba(255,255,255,1);
font-size: 25rpx;
font-family: SimHei;
font-weight: normal;
text-align: left;
white-space: nowrap;
line-height: 25rpx;
margin: 32rpx 0 0 38rpx;
}
.section_4 {
width: 675rpx;
height: 110rpx;
flex-direction: row;
display: flex;
justify-content: space-between;
margin: 28rpx 0 0 38rpx;
}
.image_9 {
width: 233rpx;
height: 109rpx;
margin-top: 1rpx;
}
.text-wrapper_2 {
width: 401rpx;
height: 110rpx;
display: flex;
flex-direction: column;
}
.text_4 {
width: 311rpx;
height: 24rpx;
overflow-wrap: break-word;
color: rgba(255,255,255,1);
font-size: 24rpx;
font-family: SimHei;
font-weight: normal;
text-align: left;
line-height: 24rpx;
/*
前提文本父级要有宽度 */
white-space: nowrap;
/* 设置文本不换行 */
overflow: hidden;
text-overflow: ellipsis;
}
.text_5 {
width: 400rpx;
height: 20rpx;
overflow-wrap: break-word;
color: rgba(155,155,156,1);
font-size: 20rpx;
font-family: SimHei;
font-weight: normal;
text-align: left;
line-height: 20rpx;
margin: 22rpx 0 0 1rpx;
/*
前提文本父级要有宽度 */
white-space: nowrap;
/* 设置文本不换行 */
overflow: hidden;
text-overflow: ellipsis;
}
.text_6 {
width: 85rpx;
height: 19rpx;
overflow-wrap: break-word;
color: rgba(155,155,156,1);
font-size: 20rpx;
font-family: SimHei;
font-weight: normal;
text-align: left;
white-space: nowrap;
line-height: 20rpx;
margin: 25rpx 0 0 3rpx;
}
.label_2 {
width: 37rpx;
height: 24rpx;
margin: 11rpx 0 9rpx 356rpx;
}
</style>