123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <template>
- <view class="container">
- <check-login />
- <template v-if="isLogin">
- <!--search-->
- <view class="search-box main-center cross-center">
- <u-input
- v-model="keywords"
- placeholder="请输入剧名"
- color="#fff"
- border="none"
- prefix-icon="search"
- :prefix-icon-style="{
- color: $colors.primaryColor,
- fontSize: '50rpx',
- fontWeight: 500,
- lineHeight: '50rpx'
- }"
- :custom-style="{
- backgroundColor: '#1B203C',
- padding: '14rpx 30rpx',
- width: '700rpx',
- borderRadius: '36rpx',
- color: '#fff'
- }"
- @confirm="handleSearch"
- />
- </view>
- <!--swpier-->
- <swiper-box />
- <!--栏目分类-->
- <nav-bar />
- <!--分类-->
- <episode-box
- v-for="(item,index) in homeColumn"
- :key="index"
- :title="item.name"
- :type="item.type"
- />
- <!--tab bar-->
- <tab-bar />
- <!--最近播放-->
- <recent />
- </template>
- </view>
- </template>
- <script>
- import SwiperBox from '../../components/SwiperBox/index'
- import EpisodeBox from './components/EpisodeBox'
- import TabBar from '../../components/TabBar/index'
- import NavBar from '../../components/NavBar/index'
- import Recent from './components/Recent'
- import CheckLogin from '../../components/CheckLogin/index'
- import { mapState } from 'vuex'
- export default {
- components: { CheckLogin, Recent, NavBar, TabBar, EpisodeBox, SwiperBox },
- data() {
- return {
- keywords: '',
- homeColumnType: {
- 1: 'recommend',
- 2: 'todayRecommend',
- 3: 'news',
- 4: 'rank'
- },
- homeColumn: [],
- parent_id: 0
- }
- },
- computed: {
- isLogin() {
- return this.$api.user.isLogin()
- },
- ...mapState({
- userInfo: seate => seate.user.info
- })
- },
- onLoad(options) {
- console.log('-->index data', options)
- this.isLogin && this.getHomeColumn()
- this.parent_id = typeof options.user_id !== 'undefined' ? options.user_id : 0
- if (this.parent_id && !this.userInfo.parent_id) {
- this.bindParent()
- }
- },
- methods: {
- handleSearch() {
- if (!this.keywords) {
- this.$u.toast('请输入剧集名称')
- return
- }
- this.$u.route({
- url: '/pages/index/search',
- params: {
- keywords: this.keywords
- }
- })
- },
- getHomeColumn() {
- this.$api.setting.homeColumn().then(res => {
- this.homeColumn = res.data
- this.homeColumn.forEach(obj => {
- obj.type = this.homeColumnType[obj.type]
- })
- })
- },
- bindParent() {
- this.$api.user.bind(this.parent_id).then(res => {
- console.log('-->bind success')
- this.$store.dispatch('user/info', res.data)
- })
- }
- },
- onShareAppMessage() {
- return this.$util.shareMessage(this.userInfo)
- }
- }
- </script>
- <style lang="scss" scoped>
- .container{
- padding: 30rpx 20rpx 160px;
- .search-box{
- /*margin-top: 30rpx;*/
- }
- .category-box{
- .category-item{
- flex: 1;
- font-size: 32rpx;
- .icon{
- image{
- width: 100rpx;
- height: 100rpx;
- }
- }
- text{
- color: #fff;
- }
- }
- }
- }
- </style>
|