123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- <template>
- <gracePage :customHeader="false">
- <view class="container" slot="gBody">
- <drawerPage :show="drawer.show ? 'left' : ''">
- <view class="container_main" slot="links">
- <block v-if="login">
- <swiper class="swiper" @change="change" :circular="swiper.circular" :current="index">
- <swiper-item v-for="(v, k) in fetch.items" v-if="v.data" :key="k" >
- <scroll-view scroll-y="true" scroll-x="true" class="scroll-height" @scrolltolower="bottomCall">
- <dream ref="dream" @showDrawer="showDrawer" :index="k" :item="v" :control="control" :bottom="bottom" class="item"></dream>
- </scroll-view>
- </swiper-item>
- </swiper>
- </block>
- <block v-if="!login">
- <dream ref="dream" @showDrawer="showDrawer" :index="index" :item="fetch.items[index]" :control="control" :bottom="bottom" class="item"></dream>
- </block>
- </view>
- </drawerPage>
-
-
- <drawerWindow v-for="(v, k) in drawer.item" :key="k" :show="v.show" :zIndex="v.index" padding="v.padding" :top="v.top" direction="v.direction" :width="v.width" v-on:closeDrawer="closeDrawer(k)">
- <view slot="links">
- <block v-if="k == 'cate'">
- <cate ref="cate" @goIndex="goIndex" :index="index" :content_id="content_id" :info_id="fetch.info_id" :page_id="fetch.page_id" :parent_page_id="fetch.parent_page_id" :width="v.width" :param="v.param" @getCate="getCate"></cate>
- </block>
-
- <block v-if="k == 'community'">
- <community ref="community" @goIndex="goIndex" :index="index" :content_id="content_id" :info_id="fetch.info_id" :page_id="fetch.page_id" :parent_page_id="fetch.parent_page_id" :width="v.width" :param="v.param"></community>
- </block>
-
- <block v-if="k == 'times'">
- <times ref="times" @goIndex="goIndex" :index="index" :content_id="content_id" :info_id="fetch.info_id" :page_id="fetch.page_id" :parent_page_id="fetch.parent_page_id" :width="v.width" :param="v.param" :times="times" @getTimes="getTimes"></times>
- </block>
- </view>
- </drawerWindow>
-
- <y-Fab v-if="!drawer.show && fetch.user.avatar && login" :bottom="20" :right="20" :btnList="drawer.button" @click="clickDrawerButton" :text="`P`+(swiper.index+1)" :icon_o="fetch.user.avatar"></y-Fab>
- <y-Fab v-if="!login" :bottom="20" :right="20" @click="goHome" :text="`P`+(swiper.index+1)"></y-Fab>
- </view>
- </gracePage>
- </template>
- <script>
- import cate from "@/pages/dream/func/cate.vue";
- import community from "@/pages/dream/func/community.vue";
- import times from "@/pages/dream/func/times.vue";
- import dream from "@/pages/dream/view/dream.vue";
- import drawerPage from "@/lib/dever/components/drawerPage.vue";
- import drawerWindow from "@/lib/dever/components/drawerWindow.vue";
- var graceRichText = require("@/lib/graceUI/jsTools/richText.js");
- export default{
- data() {
- return {
- id : 1,
- page_id : 1,
- index : 0,
- content_id : 0,
- times : 0,
- login : false,
- swiper : {
- index : 0,
- circular : false,
- },
- fetch: {
- items : [],
- user : {},
- info_id : 0,
- page_id : 0,
- parent_page_id : 0,
- },
- control : {},
- bottom : {},
- drawer : {
- // 是否显示
- show : '',
- button : [],
- item : {
- cate : {
- show : false,
- index : 5,
- top: 0,
- padding: '0rpx',
- width : '86%',
- direction : 'left',
- param : {},
- button : {
- bgColor: '#55ff7f',
- text: '选集',
- fontSize: 28,
- color: '#fff'
- }
- },
-
- community : {
- show : false,
- index : 5,
- top: 0,
- padding: '0rpx',
- width : '86%',
- direction : 'left',
- param : {
- type : 3,
- type_id : this.content_id,
- },
- button : {
- bgColor: '#16C2C2',
- text: '御所',
- fontSize: 28,
- color: '#fff'
- },
- }
- }
- }
- }
- },
- onLoad(option) {
- this.login = true;
- this.id = option.id;
- this.page_id = option.page_id;
- this.index = option.index;
- this.times = option.times;
- this.Dever.data('page_id', this.page_id);
- this.Dever.data('times', this.times);
- this.getData();
- },
- // 重新加载
- onPullDownRefresh: function() {
- if (this.drawer.show && this.drawer.item[this.drawer.show].show == true) {
- this.$refs[this.drawer.show][0].getData();
- } else {
- this.getData();
- }
- },
- methods:{
- // 触底刷新
- bottomCall: function() {
- if (this.bottom && this.bottom[this.swiper.index]) {
- this.bottom[this.swiper.index].getData(2);
- }
- },
- record : function() {
- this.Dever.post('app/collection/?l=api.record', {noloading:1, id:this.id, page_id:this.page_id, times:this.times, index: this.swiper.index});
- },
- change : function(e) {
- this.swiper.index = e.detail.current;
- //用户记录
- this.record();
- if (this.control) {
- var i = 0;
- for (i in this.control) {
- if (this.control[i].load) {
- console.info(i);
- if (this.swiper.index == i) {
- console.info('start');
- this.control[i].start();
- } else {
- this.control[i].stop();
- }
- }
- }
- }
- },
- view : function() {
- this.Dever.location('dream/view?id=1');
- },
- initDrawer : function() {
- var i = '';
- this.drawer.button = [];
- for (i in this.drawer.item) {
- this.drawer.item[i].button.key = i;
- this.drawer.item[i].param.type = 3;
- this.drawer.item[i].param.type_id = this.content_id;
- this.drawer.button.push(this.drawer.item[i].button);
- }
- },
- getData : function() {
- var self = this;
- self.drawer.item = {};
- //this.record();
- this.Dever.get(this, 'app/collection/?l=api.getContent', {id:this.id, page_id:this.page_id}, function(t) {
- if (t && t['func']) {
- self.drawer.item = t['func'];
- self.initDrawer();
- if (t['func']['cate']) {
- self.getCate(t);
- }
- if (t['func']['times']) {
- self.getTimes(t);
- }
- }
- });
- },
- getCate : function(info) {
- var self = this;
- this.Dever.get(this, 'app/collection/?l=api.category', {id:info.info_id, parent_page_id:info.parent_page_id, page_id:info.page_id, times:this.times,noloading:1}, function(t) {
- self.drawer.item['cate'].param = t;
- });
- },
- getTimes : function(info) {
- var self = this;
- this.Dever.get(this, 'app/collection/?l=api.times', {id:info.info_id, parent_page_id:info.parent_page_id, page_id:info.page_id, times:this.times,noloading:1}, function(t) {
- if (t && t.times && t.times.length > 0) {
- self.drawer.item['times'].param = t;
- } else {
- delete self.drawer.item['times'];
- self.initDrawer();
- }
- });
- },
- goIndex : function(index) {
- this.index = index;
- if (this.drawer.show) {
- this.closeDrawer(this.drawer.show);
- }
- },
- showDrawer : function(key) {
- this.getContentId();
- this.drawer.item[key].show = !this.drawer.item[key].show;
- if (this.drawer.show) {
- this.drawer.show = '';
- } else {
- this.drawer.show = key;
- }
- },
- closeDrawer : function(key) {
- this.drawer.item[key].show = false;
- this.drawer.show = '';
- },
- getContentId : function() {
- this.content_id = this.fetch.items[this.swiper.index].id;
- },
- clickDrawerButton : function(e) {
- this.showDrawer(this.drawer.button[e.index].key);
- }
- },
- components:{
- dream,cate,community,times,drawerPage,drawerWindow
- }
- }
- </script>
- <style>
- .container {
- position: absolute;
- height: 100%;
- width: 100%;
- left: 0;
- top: 0;
- -webkit-overflow-scrolling: touch;
- }
- .container_main {
- width: 750rpx;
- height: 100%;
- }
- .swiper {
- width: 750rpx;
- height: 100%;
- }
- swiper-item>view{
- height: 100%;
- }
- swiper-item image{
- width: 750rpx;
- height: 100%;
- }
- .scroll-height {
- height:100%;
- }
- </style>
|