123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <view class="i-h-v100 i-w-v100">
-
- <view class="i-pst-f i-z-index01">
- <image class="i-h-v100 i-w-v100" mode="scaleToFill" src="/static/image/homeBg.png"></image>
- </view>
-
- <pageButton :buttonData="buttonData" :isShow="showModel != 'default'" :nowTitle="nowTitle"
- :pageStatus="pageStatus" @backEvent="backEvent" @tolastEvent="tolastEvent"></pageButton>
-
- <homeList :list="list" :isShow="showModel === 'default'" :pageStatus="pageStatus" :title="title" @customEvent="homeListEvent"
- @clearCacheEvent="clearCache">
- </homeList>
-
- <homeDetails :itemInfo="detail_info" :isShow="showModel === 'model_detail'" :pageStatus="pageStatus">
- </homeDetails>
-
- <listModel :list="detail_list" :isShow="showModel === 'model_list'" :pageStatus="pageStatus"
- :styleType="style_type" @toDetailEvent="toDetailEvent"></listModel>
-
- <schoolRank :list="rank_list" :schoolList="schoolList" :isShow="showModel === 'model_rank'" :pageStatus="pageStatus"
- @toDetailEvent="toDetailEvent"></schoolRank>
- </view>
- </template>
- <script>
- import data from '@/custom/data.js'
- export default {
- data() {
- return {
-
- title: ['金东方电子宣传册', '副标题'],
- buttonData: {
- lastpage: ['default'],
- lastpageIndex: 0
- },
- lastpageTitle: 'default',
- nowTitle: '',
- showModel: 'default',
- pageStatus: 1,
- homeAnimation: {},
- list: [],
- rank_list:[],
- schoolList:[],
- detail_list: [],
- detail_info: {
- img: '',
- },
- style_type: 1,
- timeStr:''
- }
- },
- onLoad() {
-
- uni.iCommon.getFontFamily()
-
- this.get_data()
- },
- onShow() {
-
- this.checkDataUpdate()
- },
- watch: {
- showModel(newVal) {
-
- if (newVal == 'default') {
- this.buttonData.lastpage.splice(0, this.buttonData.lastpage.length)
- this.buttonData.lastpage.push('default')
- this.checkDataUpdate()
- } else if (this.buttonData.lastpage.length === this.buttonData.lastpageIndex) {
-
- this.buttonData.lastpage.push(newVal)
- }
- },
- list(newVal){
- if(uni.getStorageSync('school')){
- this.schoolList = uni.getStorageSync('school')
- }else{
- newVal[5].list.forEach((item, index) => {
- this.schoolList.push(item.list)
- });
- uni.getStorageSync('school',this.schoolList)
- }
- }
- },
- methods: {
-
- checkDataUpdate(){
- data.check_data_update(this)
- },
-
- Animation_Controls(model_type) {
- this.pageStatus = 3
- setTimeout(() => {
-
-
-
- this.pageStatus = 1
- this.showModel = model_type
- setTimeout(() => {
-
- }, 400)
- }, 300)
- },
-
- get_data() {
- data.get_home_list(this)
- },
-
- clearCache(e) {
- uni.removeStorageSync('list')
- console.log('已清除缓存')
-
- this.list = []
- this.detail_info = {}
- this.title = []
-
- this.get_data()
- },
-
- homeListEvent(e) {
- this.buttonData.lastpageIndex = 1
- if (e.model_type != undefined) {
-
- this.nowTitle = e.title
- this.lastpageTitle = e.title
-
- this.detail_list = e.list
- this.style_type = e.style_type
- this.rank_list = e.list
- if (e.model_type === 'model_detail') {
- this.detail_info.img = e.list[0].inner_img
- }
- this.Animation_Controls(e.model_type)
-
- }
- },
-
- backEvent() {
- this.Animation_Controls('default')
- },
-
- tolastEvent() {
-
- if (this.buttonData.lastpage.length === 2) {
-
- this.buttonData.lastpage = ['default']
- this.Animation_Controls(this.buttonData.lastpage[0])
- } else {
-
-
- this.buttonData.lastpageIndex -= 1
- this.buttonData.lastpage.pop()
- this.nowTitle = this.lastpageTitle
- this.Animation_Controls(this.buttonData.lastpage[1])
- }
- },
-
- toDetailEvent(item) {
-
-
- this.buttonData.lastpageIndex += 1
- setTimeout(()=>{
- this.nowTitle = item.title
- },400)
- this.Animation_Controls('model_detail')
- this.detail_info.img = item.inner_img
- console.log(item.inner_img)
- }
- },
- }
- </script>
- <style>
-
- html {
- font-size: 9px;
- }
- </style>
|