Commit f2913405 authored by jyx's avatar jyx

代码优化

parent 8543445a
<template>
<view style="background: white;">
<scroll-view scroll-y="true"
:style="'height: '+(windowHeight -120)+'px;margin-top:'+(titleBarHeight +statusBarHeight)+'px;'">
<view class="flex space" style="display:flex; flex-wrap:wrap;">
<block v-for="(value,key) in dataList" :key="key">
<view class="mt-10"
style="width:31%; position: relative; border-radius:20rpx;margin-bottom: 10rpx;margin-left: 14rpx;"
@click.stop="click(value)" @longpress.stop="longClick(key)">
<image class="integral-mall-goods" mode="aspectFill" :src="value.coverImage"></image>
<view class="text" style="font-size: 26rpx;color: black;height: 36rpx;margin-left: 5rpx;">
{{value.title}}
</view>
<view class="text" style="font-size: 22rpx;color: gray;height: 30rpx;margin-left: 5rpx;">
{{value.vedioDesc}}
</view>
<view v-if="isEditStyle" @click.stop="cbClick(key)" style="position: absolute;background: #000000; opacity: 0.6;width: 92%;height: 96%;top: 0;border-radius:20rpx;
<view style="background: white;height: 100%;">
<z-paging class="flex-1">
<scroll-view scroll-y="true" v-if="dataList.length>0" :style="'height: '+(windowHeight -120)+'px;'">
<view class="flex space" style="display:flex; flex-wrap:wrap;">
<block v-for="(value,key) in dataList" :key="key">
<view class="mt-10"
style="width:31%; position: relative; border-radius:20rpx;margin-bottom: 10rpx;margin-left: 14rpx;"
@click.stop="click(value)" @longpress.stop="longClick(key)">
<image class="integral-mall-goods" mode="aspectFill" :src="value.coverImage"></image>
<view class="text" style="font-size: 26rpx;color: black;height: 36rpx;margin-left: 5rpx;">
{{value.title}}
</view>
<view class="text" style="font-size: 22rpx;color: gray;height: 30rpx;margin-left: 5rpx;">
{{value.vedioDesc}}
</view>
<view v-if="isEditStyle" @click.stop="cbClick(key)" style="position: absolute;background: #000000; opacity: 0.6;width: 92%;height: 96%;top: 0;border-radius:20rpx;
padding-left: 20rpx;padding-top: 20rpx;">
<image v-if="value.isChecked" src="@/static/ic_selected.png"
style="width: 50rpx;height: 50rpx;" />
<image v-if="!value.isChecked" src="@/static/ic_unselected.png"
style="width: 50rpx;height: 50rpx;" />
<image v-if="value.isChecked" src="@/static/ic_selected.png"
style="width: 50rpx;height: 50rpx;" />
<image v-if="!value.isChecked" src="@/static/ic_unselected.png"
style="width: 50rpx;height: 50rpx;" />
</view>
</view>
</view>
</block>
</block>
</view>
</scroll-view>
<view v-if="dataList.length<=0"
style="position: absolute;left: 50%;width: 240rpx;margin-left: -120rpx;top: 600rpx;text-align: center;">
<text style="color: gray;">暂无在追剧</text>
<view @click="goRecommend" class="button" style="margin-top: 20rpx;color: white;">去剧场</view>
</view>
</scroll-view>
<view v-if="dataList.length<=0"
style="position: absolute;left: 50%;width: 240rpx;margin-left: -120rpx;top: 600rpx;text-align: center;">
<text style="color: gray;">暂无在追剧</text>
<view @click="goRecommend" class="button" style="margin-top: 20rpx;color: white;">去剧场</view>
</view>
<view v-if="dataList.length>=0" @click="clickEdit" class="editBar">
<image style="width: 50rpx;height: 50rpx;"
:src="!isEditStyle?'../../static/video/edit.png':'../../static/video/close.png'"></image>
</view>
</z-paging>
</view>
</template>
<script>
......@@ -58,7 +65,7 @@
watch: {
isEditStyle: {
handler(newValue, oldValue) {
this.$emit("showEditBarR", newValue)
this.$emit("showEditBarH", newValue)
}
},
},
......@@ -68,6 +75,12 @@
this.windowHeight = uni.getSystemInfoSync().windowHeight
this.loadData()
},
hide() {
},
clickEdit() {
this.isEditStyle = !this.isEditStyle
},
loadData() {
// 收藏记录
this.post({
......@@ -78,9 +91,9 @@
}) => {
this.dataList = data.list;
if (this.dataList.length > 0) {
this.$emit("showEditR", true)
this.$emit("showEdit", true)
} else {
this.$emit("showEditR", false)
this.$emit("showEdit", false)
}
}
});
......@@ -95,7 +108,7 @@
this.$emit("goRecommend")
},
click(detail) {
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail)) +
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail)) +
'&tt_album_id=' + detail.douyinAlbumId + '&tt_episode_id=' + detail.douyinEpisodeId);
},
longClick(key) {
......@@ -171,4 +184,18 @@
margin-left: 10rpx;
// position: absolute;
}
.editBar {
position: absolute;
bottom: 80rpx;
right: 60rpx;
width: 80rpx;
height: 80rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 80rpx;
background-color: aqua;
box-shadow: 0 0 2px 0px rgba(0, 0, 0, 0.1);
}
</style>
\ No newline at end of file
......@@ -13,6 +13,17 @@
</view>
<z-paging class="flex-1" ref="paging" v-model="dataList" @query="queryList">
<view class="search-wrap">
<!-- <image style="width: 80rpx; height: 80rpx" src="@/static/index/ic_quit_white.png"></image> -->
<view class="search-bar" @click="goSearchPage">
<image style="width: 40rpx; height: 40rpx" src="@/static/search.png"></image>
<text style="margin-left: 30rpx">{{
bannerList.length > 0 ? bannerList[0].title : ''
}}</text>
</view>
</view>
<view class="content">
<swiper class="banner" :style="'margin-top:'+statusBarHeight+'px;'" :indicator-dots="true"
:autoplay="true" :interval="2000" :duration="500">
......@@ -370,6 +381,9 @@
}) => {}
});
},
goSearchPage() {
navigateTo(`/pagesA/search/search`)
},
showFirstDialog() {
let that = this;
let loadEpisode_id = uni.getStorageSync('tt_episode_id') || '';
......@@ -415,10 +429,29 @@
position: relative;
}
.search-wrap {
height: 80rpx;
margin: 10rpx 15rpx;
display: flex;
flex-direction: row;
}
.search-bar {
width: 100%;
margin-left: 20rpx;
margin-right: 20rpx;
border-radius: 10rpx;
background-color: lightgray;
display: flex;
flex-direction: row;
align-items: center;
padding: 0 20rpx;
}
.show-mask {
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
background: rgba(0, 0, 0, 0.6);
position: absolute;
z-index: 999;
color: white;
......
......@@ -171,7 +171,8 @@
},
handleDotRecord() {
// 看点记录
navigateTo(`/pagesD/dotRecord/dotRecord`)
// navigateTo(`/pagesD/dotRecord/dotRecord`)
navigateTo(`/pagesA/task/task`)
},
handleUseDotRecord() {
// 看点消费记录
......
......@@ -85,6 +85,13 @@
this.windowHeight = uni.getSystemInfoSync().windowHeight
},
methods: {
hide() {
try {
this.$refs.recommendVideo.stop();
} catch {
}
},
reShare() {
var href = ''
// #ifdef H5
......
......@@ -25,21 +25,6 @@
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "#000000"
}
}, {
"path": "pages/index/index",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "#000000"
}
},
{
"path": "pages/my/my",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "#000000"
}
}, {
"path": "pages/brower/brower",
"style": {
......@@ -47,27 +32,6 @@
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "pages/recommend/recommend",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "#ffffff"
}
}, {
"path": "pages/recommend/follow",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "#000000"
}
}, {
"path": "pages/recommend/recommendVideo",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "#ffffff"
}
}
],
// 分包配置
......@@ -80,12 +44,26 @@
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "search/search",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "task/task",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}]
}, {
"root": "pagesC",
"pages": [{
"path": "ttvideo/ttVideoDetail",
"style": {
"style": {
"backgroundColor": "#000000",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#000000",
......@@ -139,14 +117,6 @@
"pages/home": {
"network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
"packages": ["pagesA", "pagesC", "pagesD"] //进入页面后预下载分包
},
"pages/recommend/recommend": {
"network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
"packages": ["pagesC"] //进入页面后预下载分包
},
"pages/my/my": {
"network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
"packages": ["pagesD"] //进入页面后预下载分包
}
},
"globalStyle": {
......
......@@ -2,9 +2,10 @@
<view class="body">
<view style="height: 92%;">
<indexPage v-show="currentPage==0" ref="index" />
<recommendPage v-on:showEditBarH="showEditBarH" v-on:changeBottomBarColor="changeBottomBarColor"
v-show="currentPage==1" ref="recommend" />
<userPage v-show="currentPage==2" ref="user" />
<recommendPage v-show="currentPage==1" ref="recommend" />
<followPage v-on:showEditBarH="showEditBarH" v-on:goRecommend="goRecommend" v-show="currentPage==2"
ref="follow" />
<userPage v-show="currentPage==3" ref="user" />
</view>
<view v-if="!isShowBlackBar" class="tabs-bar">
<view :class="currentPage==0?'tab active': 'tab'" :style="'padding-bottom:' + bottomSafePadding + 'px;'"
......@@ -29,7 +30,16 @@
<view :class="currentPage == 2?'tab active': 'tab'" :style="'padding-bottom:' + bottomSafePadding + 'px;'"
@click="tabChange(2)">
<view style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==2" class="tabs-image" src="/static/tab/my_selected.png" mode="heightFix">
<image v-if="currentPage==2" class="tabs-image" src="/static/tab/promote_selected.png"
mode="heightFix"></image>
<image v-else class="tabs-image" src="/static/tab/promote_unselected.png" mode="heightFix"></image>
</view>
看过
</view>
<view :class="currentPage == 3?'tab active': 'tab'" :style="'padding-bottom:' + bottomSafePadding + 'px;'"
@click="tabChange(3)">
<view style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==3" class="tabs-image" src="/static/tab/my_selected.png" mode="heightFix">
</image>
<image v-else class="tabs-image" src="/static/tab/my_unselected.png" mode="heightFix"></image>
</view>
......@@ -86,14 +96,9 @@
} from '@/utils/fun.js';
import common from '@/mixins/common';
const app = getApp();
// 首页
// import indexPage from "@/pages/index/index.vue";
// import recommendPage from "@/pages/recommend/recommend.vue";
// import userPage from "@/pages/my/my.vue";
import indexPage from "@/components/home/index.vue";
import recommendPage from "@/components/home/recommend.vue";
import recommendPage from "@/components/home/recommendVideo.vue";
import followPage from "@/components/home/follow.vue";
import userPage from "@/components/home/my.vue";
export default {
......@@ -102,6 +107,7 @@
components: {
indexPage,
recommendPage,
followPage,
userPage
},
data() {
......@@ -117,13 +123,13 @@
let index = options.index ?? ''
if (index != '' && index != undefined) {
this.currentPage = index
}
// #ifdef MP-TOUTIAO
tt.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ffffff'
})
}
// #ifdef MP-TOUTIAO
tt.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ffffff'
})
// #endif
if (wx.setVisualEffectOnCapture) {
......@@ -133,15 +139,15 @@
},
})
}
}
},
onShow() {
try {
// 在子组件重写show()代替onShow()
if (this.currentPage == 0) {
this.$refs.index.show();
this.$refs.index.show();
} else if (this.currentPage == 1) {
// this.$refs.recommend.show();
} else if (this.currentPage == 2) {
......@@ -164,38 +170,29 @@
},
loadComponentData() {
if (this.currentPage == 0) {
this.changeBottomBarColor(false)
this.$refs.index.show();
this.$refs.recommend.hide();
this.$refs.follow.hide();
this.$refs.user.hide();
} else if (this.currentPage == 1) {
this.$refs.recommend.show();
this.$refs.follow.hide();
this.$refs.index.hide();
this.$refs.user.hide();
} else if (this.currentPage == 2) {
this.changeBottomBarColor(false)
this.$refs.follow.show();
this.$refs.index.hide();
this.$refs.recommend.hide();
this.$refs.user.hide();
} else if (this.currentPage == 2) {
this.$refs.user.show();
this.$refs.index.hide();
this.$refs.recommend.hide();
this.$refs.follow.hide();
}
},
changeBottomBarColor(b) {
this.isShowBlackBar = b
// #ifdef MP-TOUTIAO
if(b){
tt.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#000000'
})
}else{
tt.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ffffff'
})
}
// #endif
goRecommend() {
this.currentPage = 1
},
showEditBarH(b) {
this.showEditBar = b
......@@ -203,14 +200,14 @@
},
fullChoice() {
this.isFullChoice = !this.isFullChoice
this.$refs.recommend.fullChoice();
this.$refs.follow.fullChoice();
},
noChoice() {
this.isFullChoice = !this.isFullChoice
this.$refs.recommend.noChoice();
this.$refs.follow.noChoice();
},
deleteCollect() {
this.$refs.recommend.deleteCollect();
this.$refs.follow.deleteCollect();
}
}
}
......@@ -218,7 +215,7 @@
<style lang="scss">
.body {
height: 100%;
height: 100%;
background-color: white;
}
......
This diff is collapsed.
<template>
<view class="body">
<!-- <scroll-view :scroll-y="true"> -->
<z-paging style="height: 100%;">
<view
:style="'display: flex;flex-direction: row;align-items: center;margin: 20rpx;padding-left: 10rpx;margin-top:'+statusBarHeight+'px;'">
<image class="avatar" src="@/static/logo-about.png"></image>
<view>
<view style="font-size: 32rpx;color: black;margin-left: 20rpx;">用户ID:{{userBean.idcode}}</view>
</view>
<!-- <button text="微信用户一键登录" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">123123</button> -->
</view>
<view v-if="userBean.showVipInner && os === 'android' "
style="display: flex;flex-direction: row;background: #f5ca86;margin: 20rpx;padding: 40rpx;border-radius:20rpx;align-items: center;justify-content:space-between;">
<view style="display: flex;flex-direction: column;justify-content: center;">
<view style="font-size: 36rpx;color: #5b1500;font-weight: 777;">
{{userBean.expireTime<=0 ? '开通VIP会员' : 'VIP会员'}}
</view>
<view v-if="userBean.expireTime<=0" style="font-size: 30rpx;color: #5b1500;margin-top: 12rpx;">
解锁全部短剧
</view>
<view v-else style="font-size: 30rpx;color: #5b1500;margin-top: 12rpx;">
到期时间:{{userBean.expireTime*1000 | formatDate('yyyy-MM-dd')}}
</view>
<view v-if="userBean.expireTime<=0" @click="handleCoinPay"
style="width: 210rpx;height: 60rpx;background-color: #5b1500;border-radius:30rpx;color: white;font-size: 26rpx;justify-content: center;align-items: center;display: flex;padding-bottom: 4rpx;margin-top: 30rpx;">
立即开通
</view>
<view v-else style="width: 210rpx;height: 60rpx;padding-bottom: 4rpx;margin-top: 30rpx;">
</view>
</view>
<image style="border-radius:10rpx; width: 130rpx;height: 100rpx;margin-right: 20rpx;"
src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/bg_my_vip.png" mode="scaleToFill"></image>
</view>
<view v-if="os === 'android' "
style="display: flex;height: 200rpx;margin: 20rpx;background: #f5ca86;border-radius: 20rpx;">
<view style="flex-grow: 2; margin-left: 20rpx;">
<view
style="width: 100%;height: 100%;display: flex;flex-direction: column;justify-content: center;">
<view style="display: flex;align-items: center;">
<image
style="width: 50rpx;height: 50rpx;display: flex;align-items: right;margin-right: 10rpx;"
src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_my_coin.png"></image>
<view style="font-size: 36rpx;font-weight: 777;">看点充值</view>
</view>
<view style="font-size: 28rpx;color: #5b1500;margin-top: 20rpx;">海量看点狂洒中,好剧等你来解锁</view>
</view>
</view>
<view style="width: 220rpx;">
<view
style="width: 100%;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
<view style="font-size: 30rpx;color: #5b1500;margin-bottom: 20rpx;">{{userBean.point}}</view>
<view @click="handleCoinPay"
style="width: 160rpx;height: 60rpx;background-color: #5b1500;border-radius:30rpx;color: white;font-size: 26rpx;justify-content: center;align-items: center;display: flex;padding-bottom: 4rpx;">
去充值
</view>
</view>
</view>
</view>
<view class="infobg" style="margin: 20rpx;">
<view v-if="userBean.showVipInner && os === 'android' " class="item arrow" @click="handlePayRecord">
我的订单
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view>
<view v-if="os === 'android' " class="item arrow" @click="handleDotRecord">
看点记录
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view>
<view v-if="os === 'android' " class="item arrow" @click="handleUseDotRecord">
消费记录
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view>
<view class="item arrow" @click="handleWatchRecord">
观看记录
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view>
<view class="item arrow" @click="handlePhone">
联系客服
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view>
</view>
<view style="display: flex;justify-content: center;margin-top: 20rpx;font-size: 26rpx;color: gray;">
{{ versionName }}
</view>
</z-paging>
<!-- </scroll-view> -->
<coin-popup :show="showAnimate" @close="showAnimate = false" @paySuccess="paySuccess">
</coin-popup>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
getToLocal
} from "@/utils/utils.js"
import {
navigateTo,
message,
alert,
loading
} from '@/utils/fun.js';
import {
openUrl
} from '@/utils/app+.js';
const app = getApp();
export default {
name: 'index',
mixins: [common],
data() {
return {
statusBarHeight: app.globalData.statusBarHeight,
userBean: {},
showAnimate: false,
windowHeight: 0,
os: 'android',
versionName: app.globalData.versionName,
corpid: '', // 企业ID
curl: '', // 客服链接
};
},
methods: {
show() {
this.os = wx.getSystemInfoSync().platform;
this.windowHeight = uni.getSystemInfoSync().windowHeight
// loadData() {
this.post({
url: '/user/baseMsg',
showLoading: false,
success: ({
data
}) => {
this.userBean = data;
}
});
},
hide() {
},
handleDotRecord() {
// 看点记录
navigateTo(`/pagesD/dotRecord/dotRecord`)
},
handleUseDotRecord() {
// 看点消费记录
navigateTo(`/pagesD/useDotRecord/useDotRecord`)
},
handleWatchRecord() {
navigateTo(`/pagesD/watchRecord/watchRecord`)
},
handleCoinPay() {
this.showAnimate = true;
},
handlePayRecord() {
navigateTo(`/pagesD/payRecord/payRecord`)
},
handleVipPay() {
navigateTo(`/pagesA/vipPay/vipPay`)
},
handlePhone() {
// if (this.corpid != '' && this.curl != '') {
// wx.openCustomerServiceChat({
// extInfo: {
// url: this.curl
// },
// corpId: this.corpid,
// success(res) {},
// fail(e) {
// console.log(e)
// }
// })
// } else {
// let that = this
// // 联系我们
// this.post({
// url: '/vedio/customerServiceNumbers',
// showLoading: false,
// success: ({
// data
// }) => {
// let datas = data.customerServiceNumbers.split(',')
// that.corpid = datas[0]
// that.curl = datas[1]
// wx.openCustomerServiceChat({
// extInfo: {
// url: that.curl
// },
// corpId: that.corpid,
// success(res) {},
// fail(e) {
// console.log(e)
// }
// })
// }
// });
// }
wx.makePhoneCall({
phoneNumber: '4000969950',
success: function(res) {
console.log('拨打电话成功!');
},
fail: function(res) {
console.log('拨打电话失败!');
}
})
},
paySuccess(largeType) {
// largeType=vip 开通vip
// largeType=point 购买看点
if(wx.getSystemInfoSync().platform=='ios'){
message.notify('支付成功');
}
this.post({
url: '/user/baseMsg',
showLoading: false,
success: ({
data
}) => {
this.userBean = data;
}
});
},
getPhoneNumber(e) {
console.log(e.detail.code) // 动态令牌
console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
console.log(e.detail.errno) // 错误码(失败时返回)
}
}
};
</script>
<style lang="scss">
@import '@/scss/uni.scss';
.body {
background-color: whitesmoke;
}
.avatar {
background-color: #d8d8d8;
width: 100rpx;
height: 100rpx;
border-radius: 50%;
overflow: hidden;
//box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)
}
</style>
\ No newline at end of file
<template>
<view style="background: white;">
<scroll-view scroll-y="true"
:style="'height: '+(windowHeight -120)+'px;margin-top:'+(titleBarHeight +statusBarHeight)+'px;'">
<view class="flex space" style="display:flex; flex-wrap:wrap;">
<block v-for="(value,key) in dataList" :key="key">
<view class="mt-10"
style="width:31%; position: relative; border-radius:20rpx;margin-bottom: 10rpx;margin-left: 14rpx;"
@click.stop="click(value)" @longpress.stop="longClick(key)">
<image class="integral-mall-goods" mode="aspectFill" :src="value.coverImage"></image>
<view class="text" style="font-size: 26rpx;color: black;height: 36rpx;margin-left: 5rpx;">
{{value.title}}
</view>
<view class="text" style="font-size: 22rpx;color: gray;height: 30rpx;margin-left: 5rpx;">
{{value.vedioDesc}}
</view>
<view v-if="isEditStyle" @click.stop="cbClick(key)" style="position: absolute;background: #000000; opacity: 0.6;width: 92%;height: 96%;top: 0;border-radius:20rpx;
padding-left: 20rpx;padding-top: 20rpx;">
<image v-if="value.isChecked" src="@/static/ic_selected.png"
style="width: 50rpx;height: 50rpx;" />
<image v-if="!value.isChecked" src="@/static/ic_unselected.png"
style="width: 50rpx;height: 50rpx;" />
</view>
</view>
</block>
</view>
</scroll-view>
<view v-if="dataList.length<=0"
style="position: absolute;left: 50%;width: 240rpx;margin-left: -120rpx;top: 600rpx;text-align: center;">
<text style="color: gray;">暂无在追剧</text>
<view @click="goRecommend" class="button" style="margin-top: 20rpx;color: white;">去剧场</view>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
navigateTo,
} from '@/utils/fun.js';
const app = getApp();
export default {
name: "follow",
mixins: [common],
data() {
return {
titleBarHeight: app.globalData.titleBarHeight,
statusBarHeight: app.globalData.statusBarHeight,
windowHeight: 0,
dataList: [],
isEditStyle: false
}
},
watch: {
isEditStyle: {
handler(newValue, oldValue) {
this.$emit("showEditBarR", newValue)
}
},
},
onLoad(e) {},
methods: {
show() {
this.windowHeight = uni.getSystemInfoSync().windowHeight
this.loadData()
},
loadData() {
// 收藏记录
this.post({
url: '/vedio/collectList',
showLoading: false,
success: ({
data
}) => {
this.dataList = data.list;
if (this.dataList.length > 0) {
this.$emit("showEditR", true)
} else {
this.$emit("showEditR", false)
}
}
});
},
changeEditStyle(b) {
this.isEditStyle = b
if (!this.isEditStyle) {
this.noChoice()
}
},
goRecommend() {
this.$emit("goRecommend")
},
click(detail) {
navigateTo(`/pagesC/video/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(detail)))
},
longClick(key) {
this.isEditStyle = true
this.dataList[key].isChecked = true
},
onChange(key) {
this.dataList[key].isChecked = !this.dataList[key].isChecked
},
cbClick(key) {
let newData = this.dataList[key]
newData.isChecked = !newData.isChecked
this.$set(this.dataList, key, newData)
},
fullChoice() {
for (let i = 0; i < this.dataList.length; i++) {
this.dataList[i].isChecked = true
}
this.$forceUpdate()
},
noChoice() {
for (let i = 0; i < this.dataList.length; i++) {
this.dataList[i].isChecked = false
}
this.$forceUpdate()
},
deleteCollect() {
let list = []
for (let i = 0; i < this.dataList.length; i++) {
if (this.dataList[i].isChecked) {
list.push(this.dataList[i].vedioId)
}
}
// 取消收藏
this.post({
url: '/vedio/cancelCollect',
data: {
list
},
showLoading: false,
success: ({
data
}) => {
this.isEditStyle = false
uni.showToast({
title: "删除成功"
})
this.loadData()
}
});
},
}
}
</script>
<style lang="scss" scoped>
.integral-mall-goods {
width: 100%;
height: 320rpx;
background: #F2F2F2;
border-radius: 16upx;
}
.text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.cb {
margin-top: 10rpx;
margin-left: 10rpx;
// position: absolute;
}
</style>
\ No newline at end of file
<template>
<view class="body">
<view class="tabContainer" :style="
'height:' +
titleBarHeight +
'px;line-height:' +
titleBarHeight +
'px;padding-top:' +
statusBarHeight +
'px;background-color:transparent'
">
<view v-if="(current==0 && showEdit)"
:style="'position: absolute;left: 20rpx;top:'+ (statusBarHeight + 10) + 'px'"
@click.stop="showEditBar = !showEditBar">
<image style="width: 50rpx;height: 50rpx;" mode="widthFix"
:src="showEditBar?'/static/video/close.png':'/static/video/edit.png'" />
</view>
<view v-show="showEditBar" style="width: 300rpx;background: white;z-index: 999;">
<view
style="font-size: 36rpx;text-align: center;align-items: center;height:100rpx;line-height: 100rpx;">
追剧
</view>
</view>
<view v-if="(!showEditBar && showTap)">
<u-tabs :list="tabs" :current="current" @change="handleChange" lineWidth="30" :scrollable="false"
:lineColor="current==0?'#f56c6c':'#ffffff'" :activeStyle="{
color: current==0?'#000000':'#ffffff',
fontWeight: 'bold',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#606266',
transform: 'scale(1)'
}" />
</view>
</view>
<swiper class="swiper" @change="swiperChange" :current="current" :disable-touch="showEditBar">
<swiper-item class="swiper-item">
<followPage v-on:showEditBarR="showEditBarR" v-on:goRecommend="goRecommend" v-on:showEditR="showEditR"
ref="follow" />
</swiper-item>
<swiper-item class="swiper-item">
<recommendVideoPage ref="recommendVideo" />
</swiper-item>
</swiper>
</view>
</template>
<script>
import common from '@/mixins/common';
import followPage from "@/pages/recommend/follow.vue"
import recommendVideoPage from "@/pages/recommend/recommendVideo.vue";
import {
navigateTo,
} from '@/utils/fun.js';
const app = getApp();
export default {
name: "recommend",
mixins: [common],
components: {
followPage,
recommendVideoPage
},
data() {
return {
current: 1,
tabIndex: 1,
tabs: [{
name: '追剧'
}, {
name: '推荐'
}],
showEditBar: false,
showEdit: false,
showTap: false,
titleBarHeight: app.globalData.titleBarHeight,
titleButtonWidth: app.globalData.titleButtonWidth,
statusBarHeight: app.globalData.statusBarHeight,
}
},
onLoad(e) {},
watch: {
showEditBar: {
handler(newValue, oldValue) {
this.$refs.follow.changeEditStyle(newValue);
}
},
},
methods: {
hide() {
this.$refs.recommendVideo.stop();
},
show() {
this.$nextTick(() => {
// 延迟渲染,否则位置错乱
this.showTap = true
})
if (this.current == 0) {
this.$refs.follow.show();
this.$refs.recommendVideo.stop();
this.$emit("changeBottomBarColor", false);
} else if (this.current == 1) {
this.$refs.recommendVideo.show();
this.$emit("changeBottomBarColor", true);
}
},
handleChange(event) {
this.current = event.index;
this.show()
},
swiperChange(event) {
this.current = event.detail.current
this.show()
},
showEditBarR(b) {
this.showEditBar = b
this.$emit("showEditBarH", b);
},
showEditR(b) {
this.showEdit = b
},
fullChoice() {
this.$refs.follow.fullChoice()
},
noChoice() {
this.$refs.follow.noChoice()
},
deleteCollect() {
this.$refs.follow.deleteCollect()
},
goRecommend() {
this.current = 1
},
}
}
</script>
<style lang="scss" scoped>
.body {
background: white;
width: 100%;
height: 100%;
}
.tabContainer {
width: 100%;
position: absolute;
z-index: 100;
display: flex;
align-items: center;
overflow: hidden;
justify-content: center;
}
.swiper {
height: 100%;
}
.recommendTitle {}
</style>
\ No newline at end of file
This diff is collapsed.
<template>
<view class="container">
<view class="search-head">
<view class="search-bar">
<image style="width: 40rpx; height: 40rpx" src="@/static/search.png"></image>
<input class="inputkeyword" type="text" placeholder="请输入搜索剧集" onchange="showChangePrompt"
:value="keyword" />
<image v-if="keyword!=''" @click="clearWord" style="width: 36rpx; height: 36rpx"
src="@/static/search.png"></image>
</view>
<text class="searchbutton" @click="getsearch">搜索</text>
</view>
<z-paging class="item-list">
<view>
<view class="search-item-wrap" v-if="searchList.length>0 && !showEmpty">
<view class="search-item-top">
<text class="item-title">历史搜索</text>
<image @click="clearHistory" style="width: 40rpx; height: 40rpx"
src"@/static/video/ic_delete.png"></image>
</view>
<view class="search-item-bottom">
<block v-for="(item, index) in searchList" :key="index">
<text class="search-item" @click="clickHistory(item)">{{ item }}</text>
</block>
</view>
</view>
</view>
<view>
<view class="emptyView" if="showEmpty">
<text style="font-size: 30rpx;"> 暂无搜索结果 </text>
</view>
</view>
<view v-if="topList.length>0 && dataList.length==0" class="flex">
<text class="item-title">{{showEmpty ? '猜你喜欢' : '今日热门' }}</text>
<view class="item-list-column">
<block v-for="(item, index) in topList" :key="index">
<view class="product-item-column" @click="handleListItem(item)">
<image class="item-list-img3" :src="item.coverImage"></image>
<view class="item-list-bottom">
<view>
<image class="item-list-bottom-img" src="../../assets/images/ic_index_play.png">
</image>
<text
style="margin-left: 4rpx; color: white; font-size: 24rpx">{{ item.showNum }}</text>
</view>
<text style="margin-left: 4rpx; color: white; font-size: 24rpx">
{{ item.vedioTotal }}
</text>
</view>
<text style="font-size: 24rpx; color: black">{{ item.title }}</text>
</view>
</block>
</view>
</view>
<view class="item-content">
<view class="item-list-column">
<block v-for="(item, index) in dataList" :key="index">
<view class="pack-item" @click="handleListItem(item)">
<image class="images" :src="item.coverImage" />
<view class="pack-item-cloumn">
<text class="text">
{{ item.title }}
</text>
<text class="text3"> {{
item.vedioDesc == ''
? '已看' +
item.seeIndex +
'集/共' +
item.vedioTotal +
'集'
: item.vedioDesc
}}
</text>
<text class="text4">
{{ item.orderTagsStr }}
</text>
</view>
</view>
</block>
</view>
</view>
</z-paging>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
navigateTo,
message,
alert,
loading
} from '@/utils/fun.js';
export default {
name: 'search',
mixins: [common],
data() {
return {
dataList: [],
topList: [],
searchList: [],
keyword: '',
showEmpty: false,
searchKey: 'SEARCH_HISTORY_WORDS'
}
},
mounted() {
this.getHistorySearchWords()
this.getOrders()
},
methods: {
toSearch() {
let that = this
this.post({
url: '/vedioV1/orders',
data: {
words: that.keyword
},
showLoading: false,
success: ({
data
}) => {
that.dataList = data.list
if (that.dataList.length == 0) {
that.showEmpty = true
}
},
fail: () => {
that.dataList = []
}
});
},
getOrders() {
let that = this
this.post({
url: '/vedioV1/orders',
showLoading: false,
success: ({
data
}) => {
that.topList = data.list
},
fail: () => {
that.topList = []
}
});
},
showChangePrompt(e) {
this.keyword = e.value
},
clickHistory(word) {
this.keyword = word
this.getsearch()
},
getsearch() {
if (this.keyword == '') {
message({
fail: '请输入搜索内容'
})
return
}
this.toSearch()
this.saveSearchWord(this.keyword)
},
clearWord() {
this.keyword = ''
this.dataList = []
this.showEmpty = false
},
handleListItem(item) {
navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)) +
'&tt_album_id=' + item.douyinAlbumId + '&tt_episode_id=' + item.douyinEpisodeId);
},
saveSearchWord(word) {
// 校验是否保存过,保存过不保存
for (var i = 0; i < this.searchList.length; i++) {
if (this.searchList[i] == word) return
}
// 保存搜索数据
let that = this
that.searchList.push(word)
uni.setStorage({
key: that.searchKey,
data: that.setArrToClipStr(that.searchList),
success: function(data) {
that.getHistorySearchWords()
},
fail: function() {}
})
},
getHistorySearchWords() {
let that = this
uni.getStorage({
key: that.searchKey,
success: function(data) {
if (data == '' || data == undefined) {
that.searchList = []
} else {
that.searchList = []
that.searchList = that.getArrfromClipStr(data)
}
},
fail: function() {
that.searchList = []
}
})
},
clearHistory() {
let that = this
uni.removeStorage({
key: that.searchKey,
success: function(data) {
that.searchList = []
},
fail: function(data, code) {
that.searchList = []
}
})
},
setArrToClipStr(strArr) {
let clipStr = ''
for (var i = 0; i < strArr.length; i++) {
clipStr += (strArr[i] + ',')
}
return clipStr
},
getArrfromClipStr(clipStr) {
let result = clipStr.split(',')
let resultArr = []
for (var i = 0; i < result.length; i++) {
if (result[i] == '') continue
resultArr.push(result[i])
}
return resultArr
}
}
}
</script>
<style lang="less">
.container {
background-color: #ffffff;
display: flex;
height: 100%;
flex-direction: column;
}
.item-list {
display: flex;
flex-direction: column;
background-color: aqua;
height: 92%;
flex: 1;
}
.pack-item {
margin-top: 10rpx;
width: 100%;
height: 260rpx;
position: relative;
margin-bottom: 10rpx;
margin-left: 14rpx;
margin-right: 14rpx;
display: flex;
flex-direction: row;
.images {
width: 180rpx;
height: 260rpx;
border-radius: 16rpx;
}
.pack-item-cloumn {
margin-left: 20rpx;
flex-direction: column;
.text {
margin-top: 20rpx;
font-size: 34rpx;
color: black;
font-weight: bold;
}
.text2 {
margin-top: 16rpx;
font-size: 24rpx;
color: #000000;
}
.text3 {
margin-top: 16rpx;
font-size: 24rpx;
color: #000000;
}
.text4 {
margin-top: 16rpx;
font-size: 22rpx;
color: gray;
}
}
}
.search-head {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 8%;
}
.search-bar {
border-radius: 60rpx;
margin: 10rpx 15rpx;
padding: 15rpx 30rpx;
width: 80%;
background-color: #f2f2f2;
display: flex;
flex-direction: row;
align-items: center;
}
.inputkeyword {
margin-left: 30rpx;
}
.searchbutton {
text-align: center;
color: #000000;
font-size: 30rpx;
width: 20%;
margin-right: 10rpx;
}
.emptyView {
width: 100%;
height: 200rpx;
display: flex;
justify-content: center;
align-items: center;
}
.item-list-column {
width: 100%;
margin: 10rpx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.item-list-bottom {
background-color: #808080;
width: 100%;
display: flex;
justify-content: space-between;
margin-top: 280rpx;
height: 40rpx;
border-radius: 10rpx;
align-content: center;
opacity: 0.7;
}
.item-list-bottom-img {
object-fit: fill;
height: 30rpx;
width: 30rpx;
margin-left: 4rpx;
margin-top: 4rpx;
}
.product-item-column {
width: 31%;
margin-left: 8rpx;
height: 390rpx;
display: flex;
flex-direction: column;
margin-bottom: 10rpx;
}
.item-list-img3 {
position: absolute;
width: 100%;
object-fit: cover;
height: 320rpx;
border-radius: 10rpx;
}
.item-title {
margin-left: 20rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
color: #000000;
font-size: 36rpx;
font-weight: 400;
}
.search-item-wrap {
display: flex;
flex-direction: column;
}
.search-item-top {
width: 100%;
padding-right: 20rpx;
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
justify-content: space-between;
}
.search-item-bottom {
display: flex;
flex-wrap: wrap;
}
.search-item {
border: 4rpx;
height: 60rpx;
margin: 8rpx 15rpx;
border-radius: 60rpx;
border: 0rpx solid #f8f8ff;
background-color: #f8f8ff;
padding: 10rpx 20rpx;
}
</style>
\ No newline at end of file
This diff is collapsed.
TGYoypuXSpCliIAj
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment