Files
2026-07-24 18:18:27 +08:00

264 lines
7.2 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view>
<view class="heardbg u-p-l-30 u-p-r-30 u-p-t-20">
<navbar :backopen="false"></navbar>
<view class="u-flex" @click.stop="login">
<u-avatar :src="userInfo.avatar" size="44"></u-avatar>
<view class="u-m-l-20 u-flex-1 u-flex u-row-between">
<view>
<view v-if="!isLogin" class="u-flex">
<view class="u-font-28 u-m-r-10">立即登录</view>
<u-icon name="arrow-right"></u-icon>
</view>
<view v-else class="u-font-28 u-word-break u-line-1">{{userInfo.nickname}}</view>
<view v-if="isLogin" class="u-m-t-10 u-font-22 u-color-666 u-word-break u-line-1">
ID:{{userInfo.id}}</view>
</view>
<view v-if="isLogin" @click.stop="exit"
class="u-border-f u-b-fff-2 u-color-aaa u-w-100 u-h-50 u-radius-40 u-lh-50 u-text-center u-font-24">
退出</view>
</view>
</view>
<view class="u-b-f u-radius-20 u-p-t-16 u-p-b-16 u-p-r-20 u-p-l-20 u-m-t-30">
<view class="u-m-t-30 u-flex u-col-top u-row-around">
<view class="u-text-center" @click="$u.route('/pagesA/my/VIPRecord')">
<image src="/static/image/icon23.png" class="u-w-42 u-h-42"></image>
<view class="u-m-t-6 u-font-22">VIP记录</view>
</view>
<!-- 抖音的IM 客服 data-im-id:客服的抖音号-->
<button class="u-reset-button" open-type="contact">
<view class="u-text-center">
<image src="/static/image/icon26.png" class="u-w-42 u-h-42"></image>
<view class="u-m-t-6 u-font-22">联系客服</view>
</view>
</button>
</view>
</view>
</view>
<view class="u-p-l-30 u-p-r-30 u-m-t-20">
<view class="u-b-f u-radius-20 u-p-b-20">
<u-tabs :list="tabList" lineColor="#C81F22" :current="current" @click="onclick"
:IconShow="false"></u-tabs>
<scroll-view scroll-y style="height: 51vh;" v-if="list.length>0" @scrolltolower="getbottom()">
<view class="u-p-l-20 u-p-r-20 u-p-b-30">
<view v-if="current == 0" class="u-flex u-m-t-30" v-for="(item,index) in list" :key="index">
<u-image :src="item.img" @click="govideo(item.vid,item.mid)" width="100rpx" height="140rpx"
radius="5"></u-image>
<view class="u-flex-1 u-m-l-20 u-flex u-row-between">
<view @click="govideo(item.vid,item.mid)">
<view class="u-font-28 u-word-break u-line-1">{{item.vname}}</view>
<view class="u-font-24 u-m-t-30 u-color-999">{{item.mid}}集</view>
</view>
</view>
</view>
<view v-else class="u-flex u-flex-wrap u-col-top">
<view class="u-w-200 u-m-t-30 u-m-r-16" v-for="(item,index) in list" :key="index"
@click="govideo(item.vid,item.mid)">
<image :src="item.img" class="u-w-200 u-h-280 u-radius-10" mode="aspectFill">
</image>
<view class="u-word-break u-line-1 u-m-t-10 u-font-26">{{item.vname}}</view>
<view class="u-m-t-10 u-color-999 u-font-22">{{item.mid}}集</view>
<view
class="u-bnt-tabbar-FF5205-FF0591 u-radius-40 u-w-140 u-text-center u-p-t-10 u-p-b-10 u-font-22 u-m-t-10">
点击观看</view>
</view>
</view>
</view>
</scroll-view>
<view v-if="list.length>0" class="u-flex u-row-center">
<view class="u-w-60 u-h-2 u-b-EC"></view>
<view class="u-color-666 u-font-20">海量短剧 · 免费观看</view>
<view class="u-w-60 u-h-2 u-b-EC"></view>
</view>
<empty v-if="list.length<1"></empty>
</view>
</view>
</view>
</template>
<script>
import navbar from '@/components/navbar.vue'
import empty from '@/components/empty/empty.vue'
import login from "@/utils/login";
export default {
components: {
navbar,
empty
},
data() {
return {
isLogin: uni.getStorageSync('kyToken') ? true : false, //是否登录
current: 0,
paramster: {
code: '', //授权code
invite: '', //推广码
ad_code: '', //巨量广告id
source: '', //来源:1=自由授权,2=巨量来源
},
userInfo: {}, //用户信息
page: 1,
status: 'loadmore', //加载更多
list: [],
apiUrl: getApp().globalData.oss_url, //域名
dy_im: getApp().globalData.dy_im,
tabList: [{
name: "看过"
}, {
name: "收藏"
}]
}
},
mounted() {
this.getuserInfo()
},
onShow() {
this.clear()
},
methods: {
// 获取用户信息
getuserInfo() {
let that = this;
that.$httpRequest({
url: "/api/user/index",
method: "GET",
data: {}
}).then(res => {
if (res.code == 1) {
this.userInfo = res.data
uni.setStorageSync('userInfo', res.data)
}
}).catch(err => {
console.log(err)
})
},
// 登录
login() {
login.wxLogin().then(res => {
this.getuserInfo()
})
},
onclick(e) {
this.current = e.index
this.clear()
},
clear() {
this.list = []
this.page = 1
if (this.current == 0) {
this.videoLookList()
} else {
this.videoCollectList()
}
},
// 观看记录
videoLookList() {
this.$httpRequest({
url: "/api/video/videolog",
methods: "GET",
data: {
limit: 15,
page: this.page
}
}).then(res => {
if (res.rows.length < 15) {
this.status = 'nomore';
} else {
this.page = this.page + 1;
this.status = 'loadmore';
}
this.list = this.list.concat(res.rows);
uni.stopPullDownRefresh();
})
},
// 收藏记录
videoCollectList() {
this.$httpRequest({
url: "/api/video/recordlist",
methods: "GET",
data: {
limit: 15,
page: this.page
}
}).then(res => {
if (res.rows.length < 15) {
this.status = 'nomore';
} else {
this.page = this.page + 1;
this.status = 'loadmore';
}
this.list = this.list.concat(res.rows);
uni.stopPullDownRefresh();
})
},
//追剧的修改稿
videoCollectAdd(item, index) {
this.$api.videoCollectAdd({
vl_id: item.vl_id, //剧目id
vid: item.vid, //剧集id
status: item.is_collect ? 2 : 1,
}).then(res => {
if (res.code == 1) {
if (!this.list[index].is_collect) {
this.$getMsg('添加成功')
} else {
this.$getMsg('取消追剧')
}
this.list[index].is_collect = !this.list[index].is_collect
}
})
},
//添加小程序
addApplet() {
this.$getMsg('已添加成功', 1500, false, 'success')
},
// 进入短剧播放页面
govideo(vid, min) {
uni.navigateTo({
url: '/pagesA/player/detailPlayer?vid=' + vlid + '&mid=' + min || 0
})
},
getbottom() {
//避免多次触发
if (this.status == 'loading' || this.status == 'nomore') {
return;
}
if (this.current == 0) {
this.videoLookList()
} else {
this.videoCollectList()
}
},
// 退出
exit() {
uni.showModal({
content: '确认退出登录',
cancelText: '返回',
confirmColor: '#C81F22',
success: (s) => {
if (s.confirm) {
uni.removeStorageSync('djtoken')
this.$getMsg('退出成功')
this.isLogin = false
}
}
})
}
}
}
</script>
<style scoped lang="scss">
.heardbg {
background: linear-gradient(173deg, #FEECEB, #FEECEB, #FFF6DD, #f7f7f7, #f7f7f7) no-repeat;
background-color: #f7f7f7;
}
.bg99 {
background: #999;
color: #fff;
}
</style>