123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471 |
- <template>
- <gracePage :customHeader="false">
- <view class="container" slot="gBody">
- <ourLoading isFullScreen :active="pageLoading" :text="pageLoadingText" />
- <swiper class="banner-swiper" autoplay :interval="5000" :duration="1000" @change="change" :circular="swiper.circular" @click="closeOpen()">
- <swiper-item class="banner-swiper-item" v-for="(v, k) in fetch.info.pic_bg" :key="k">
- <image :src="v" mode="widthFix"></image>
- </swiper-item>
- </swiper>
- <view class="content">
- <!-- section-1 begin -->
- <view class="section-1" @click="closeOpen()">
- <view class="item">
- <image :src="fetch.info.pic_cover" mode="widthFix"></image>
- <view class="wenyue-font">{{fetch.info.name}}</view>
- <view class="text-color-assist">{{fetch.info.desc}}</view>
- </view>
- <view class="item" v-if="fetch.info.uid > 0 && fetch.share_user.uid <= 0">
- <image :src="fetch.info.user.avatar" mode="widthFix" style="border-radius: 100%;"></image>
- <view class="wenyue-font">{{fetch.info.user.username}}</view>
- <view class="text-color-assist">{{fetch.info.user.author}}</view>
- </view>
-
- <view class="item" v-if="fetch.share_user.uid > 0">
- <image :src="fetch.info.share_user.avatar" mode="widthFix" style="border-radius: 100%;"></image>
- <view class="wenyue-font">{{fetch.info.share_user.username}}</view>
- <view class="text-color-assist">{{fetch.info.user.author}}</view>
- </view>
- </view>
- <!-- section-2 end -->
- <!-- section-2 begin -->
- <view class="section-2">
- <view class="item" :style="item_style" v-for="(v, k) in fetch.button" :key="k" @click="button(v)">
- <view class="title">
- <image :src="v.icon" v-if="v.icon" style="width:33px;height:33px;"></image>
- <view>{{v.name}}</view>
- </view>
- <view class="tips" v-if="v.info">{{v.info}}</view>
- </view>
- </view>
- <!-- section-2 end -->
- <view class="section-3">
- <view class="my-integral">
- <view class="tips">
- <mp-html :content="fetch.info.content" ref="article"></mp-html>
- </view>
- </view>
-
- </view>
-
-
-
- </view>
-
- <view v-if="buyState">
- <buy :curid="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" :code="fetch.code" :name="fetch.info.name" @hideBuy="hideBuy" @share="share" @view="view"></buy>
- </view>
-
- <view v-if="passState">
- <pass :curid="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" :code="fetch.code" :name="fetch.info.name" @hidePass="hidePass" @share="share" @view="view"></pass>
- </view>
-
- <view v-if="rankingState">
- <ranking :curid="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" @hideRanking="hideRanking"></ranking>
- </view>
-
- <view v-if="infoState">
- <info :curid="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" @hideInfo="hideInfo"></info>
- </view>
-
- <dever-share ref="share" :curid="id" :code="fetch.code" :data="fetch.share" v-if="fetch.share && fetch.code"></dever-share>
-
- <view class="mask buy-layer" v-if="inviteState && fetch.share_user && fetch.share_user.code">
- <view class="buytip-layer layer " catchtap="handleStop">
- <view class="buy-tit buy-user"><image :src="fetch.share_user.avatar" mode="widthFix"></image></view>
- <view class="buy-tit" style="margin-top: 10rpx;">{{fetch.share_user.username}}赠送{{fetch.info.ticket_name}}</view>
- <view v-if="fetch.share_user.ticket && fetch.share_user.ticket.desc">
- <text class="p">“{{fetch.share_user.ticket.desc}}”</text>
- <text class="p">—“他”是这么说的</text>
- </view>
-
- <view v-else>
- <text class="p">“{{fetch.share.content}}”</text>
- <text class="p">—{{fetch.share.title}}</text>
- </view>
-
- <view v-if="fetch.share_ticket">
- <text class="p">“{{fetch.share_ticket}}”</text>
- <text class="p">—你已拥有{{fetch.info.ticket_name}},你这么回复“他”吧</text>
- </view>
-
- <view class="btn-wrapper" v-if="!fetch.share_ticket">
- <view class="button cancel" @click="hideInvite">不要
- </view>
- <view class="button primary" :style="fetch.button.bgcolor" @click="saveTicket(fetch.share_user.code)">收下
- <button formType="submit"></button>
- </view>
- </view>
-
- <view class="btn-wrapper" v-if="fetch.share_ticket">
- <view class="button primary" style="margin: 0 auto;" @click="hideInvite" :style="fetch.button.bgcolor">关闭</view>
- </view>
-
- </view>
- </view>
- </view>
- </gracePage>
- </template>
- <script>
- import mpHtml from "@/lib/mp-html/mp-html.vue";
- import buy from "@/pages/dream/buy.vue";
- import pass from "@/pages/dream/pass.vue";
- import ranking from "@/pages/dream/ranking.vue";
- import info from "@/pages/dream/info.vue";
- import deverShare from '@/lib/dever/components/share.vue';
- export default {
- data() {
- return {
- id : 0,
- swiper : {
- index : 0,
- circular : true,
- },
- fetch: {
- is_read : false,
- is_ticket : false,
- info : {},
- button : {},
- code : '',
- share : {},
- share_user : {
- uid : -1,
- }
- },
- buyState : false,
- passState : false,
- rankingState : false,
- infoState : false,
- inviteState : true,
- item_style : 'margin: 0 auto;',
- }
- },
- onLoad(option) {
- this.id = option.id;
- this.code = option.code;
- },
- onShow() {
- if (this.id || this.code) {
- this.getData();
- }
- },
- // 重新加载
- onPullDownRefresh: function() {
- this.getData();
- },
- methods: {
- change : function(e) {
- this.swiper.index = e.detail.current;
- },
- getData : function() {
- var self = this;
- var url = this.Dever.host + '/pages/dream/index';
- this.Dever.get(this, 'app/collection/?l=api.getInfo', {id:this.id,code:this.code,url:url}, function(t) {
- if (t.button.length > 2) {
- self.item_style = 'margin-left:5rpx;';
- } else {
- self.item_style = 'margin:0 auto';
- }
- uni.setNavigationBarTitle({
- title:t.info.name
- });
- });
- },
- button : function(v) {
- if (v.type == 1) {
- this.goView();
- }
- else if (v.type == 2) {
- this.showBuy();
- }
- else if (v.type == 3) {
- this.goRanking();
- }
- else if (v.type == 10) {
- this.Dever.location(v.link, 'webview', v.name);
- }
- },
- goView : function() {
- //是否登录
- var token = this.Dever.getToken();
- if (!token) {
- var self = this;
- this.Dever.alert('您还未登录,请先登录', 'none', function() {
- if (self.id) {
- self.Dever.login = 'user/login?id=' + self.id;
- } else if (self.code) {
- self.Dever.login = 'user/login?code=' + self.code;
- }
-
- self.Dever.checkLogin();
- });
-
- return;
- }
- //是否已经有权限阅读
- if (!this.fetch.is_read) {
- this.showBuy();
- } else {
- this.view();
- }
- },
- view : function() {
- this.Dever.location('dream/view?code='+this.fetch.code + '&name=' + this.fetch.info.name);
- },
- closeOpen : function() {
- this.hideRanking();
- this.hideBuy();
- this.hideInfo();
- this.hideInvite();
- },
- showInvite : function() {
- this.inviteState = true;
- },
- hideInvite : function() {
- this.inviteState = false;
- },
- saveTicket : function(code) {
- var self = this;
- this.Dever.post('app/user/?l=api.saveTicket', {code:code}, function(t) {
- self.Dever.alert('已收下');
- self.hideInvite();
- });
- },
- showBuy : function() {
- if (this.fetch.info.buy == 1 && this.fetch.is_ticket) {
- this.buyState = true;
- } else if (this.fetch.info.password) {
- this.passState = true;
- } else {
- this.Dever.alert('库存没有了');
- }
- },
- hidePass : function() {
- this.passState = false;
- },
- hideBuy : function() {
- this.buyState = false;
- },
- hideRanking : function() {
- this.rankingState = false;
- },
- goRanking : function() {
- this.rankingState = true;
- },
- goInfo : function() {
- this.infoState = true;
- },
- hideInfo : function() {
- this.infoState = false;
- },
- share : function() {
- this.$refs.share.open();
- }
- },
- components:{
- buy,pass,ranking,info,deverShare,mpHtml
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- max-height: 100%;
- }
- .banner-swiper {
- width: 100%;
- height: 600rpx;
-
- .banner-swiper-item {
- image {
- width: 100%;
- }
- }
- }
- .content {
- width: 100%;
- padding: 0 30rpx;
- position: relative;
- }
- .section-1 {
- position: relative;
- background-color: $bg-color-white;
- margin-top: -60rpx;
- border-radius: $border-radius-lg;
- padding: 60rpx 0;
- display: flex;
- margin-bottom: 30rpx;
- box-shadow: $box-shadow;
-
- .item {
- flex: 1;
- flex-shrink: 0;
- display: flex;
- flex-direction: column;
- align-items: center;
- position: relative;
-
- &:nth-child(1):after {
- content: '';
- position: absolute;
- right: 0;
- top: 0;
- bottom: 0;
- width: 2rpx;
- background-color: $border-color;
- }
-
- image {
- width: 100rpx;
- margin-bottom: 20rpx;
- }
-
- .wenyue-font {
- font-size: 30rpx;
- margin-bottom: 10rpx;
- }
- }
- }
- .section-2 {
- display: flex;
- justify-content: space-between;
- margin-bottom: 30rpx;
-
- .item {
- width: 335rpx;
- background-color: #EAEBEC;
- padding: $spacing-row-lg 0;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- border-radius: $border-radius-lg;
-
- .title {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: $font-size-lg;
-
- image {
- width: 60rpx;
- height: 60rpx;
- margin-right: 10rpx;
- }
- }
-
- .tips {
- color: $text-color-assist;
- font-size: $font-size-base;
- }
- }
- }
- .section-3 {
- margin-bottom: 30rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-size: $font-size-base;
- color: $text-color-assist;
- padding: 0 10rpx;
-
- .my-integral {
- flex: 1;
- display: flex;
- flex-direction: column;
-
- .integrals {
- display: flex;
- align-items: center;
- font-size: $font-size-lg;
- color: $text-color-base;
- margin-bottom: 10rpx;
-
- .neutra-font {
- margin-left: 10rpx;
- font-size: 42rpx;
- }
- }
- }
-
- .my-code {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 0 30rpx;
- position: relative;
-
- image {
- width: 60rpx;
- height: 60rpx;
- margin-bottom: $spacing-col-sm;
- }
-
- &:before {
- content: " ";
- position: absolute;
- left: 0;
- top: 0;
- bottom: 0;
- border-left: 1rpx solid rgba($color: $border-color, $alpha: 0.6);
- }
- }
- }
- .mask {
- position: fixed;
- left: 0;
- top: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.5);
- z-index:100;
- }
- .mask .layer {
- width: 570rpx;
- box-sizing: border-box;
- padding: 70rpx 60rpx;
- background: #fff;
- border-radius: 10rpx;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%,-50%);
- }
- .mask .layer .tit {
- text-align: center;
- font-size: 40rpx;
- margin: 16rpx 0 60rpx;
- }
- .mask .layer input {
- border-radius: 10rpx;
- border: 1rpx solid #999;
- height: 88rpx;
- line-height: 88rpx;
- padding: 0 28rpx;
- box-sizing: border-box;
- font-size: 24rpx;
- }
- .mask .layer .errtip {
- color: #d1171a;
- text-align: center;
- font-size: 24rpx;
- margin: 21rpx 0;
- height: 34rpx;
- }
- .mask .layer .btn-wrapper {
- padding-top: 30rpx;
- }
- </style>
|