作者 徐浩

合并代码

... ... @@ -37,10 +37,10 @@
})
}else{
var identity=uni.getStorageSync('identity')
uni.reLaunch({
url:'/new_tec/homePage/homePage'
})
return
// uni.reLaunch({
// url:'/new_tec/homePage/homePage'
// })
// return
if(identity==2){
uni.reLaunch({
url:'/pages/tch_index/tch_index'
... ...
... ... @@ -6,37 +6,50 @@
<view @tap="tabsClick(BIGSHOTS.AUDIOLESSONS)" :class="{'bigShots-1-1-i': true, 'bigShots-1-1-is': type === BIGSHOTS.AUDIOLESSONS}">音频课程</view>
</view>
<view class="bigShots-1-2">
<view class="bigShots-1-2-i">
视频专辑 <u-icon size="12" name="arrow-down-fill" color="#646464"></u-icon>
</view>
<view class="bigShots-1-2-i">
评论量 <u-icon size="12" name="arrow-down-fill" color="#646464"></u-icon>
<picker @change="bindpickerChange" :value="index" :range="subjectList" range-key="title">
<view class="bigShots-1-2-i">
<text class="bigShots-1-2-i-t">{{ selectType.name || '请选择分类' }} </text>
<u-icon size="10" name="arrow-down-fill" color="#646464"></u-icon>
</view>
</picker>
<view class="bigShots-1-2-i" @click="setSorting(SORTINGTYPE.COMMENT)">
<text class="bigShots-1-2-i-t" v-if="currentSorting !== SORTINGTYPE.COMMENT">评论量</text>
<text class="bigShots-1-2-i-t" v-else style="color: #2d81ff;">评论量</text>
<u-icon size="10" v-if="sortLog[SORTINGTYPE.COMMENT] !== SORTORDER.DESC" name="arrow-down-fill" :color="currentSorting !== SORTINGTYPE.COMMENT ? '#646464' : '#2d81ff'"></u-icon>
<u-icon size="10" v-else name="arrow-up-fill" :color="currentSorting !== SORTINGTYPE.COMMENT ? '#646464' : '#2d81ff'"></u-icon>
</view>
<view class="bigShots-1-2-i">
点赞量 <u-icon size="12" name="arrow-down-fill" color="#646464"></u-icon>
<view class="bigShots-1-2-i" @click="setSorting(SORTINGTYPE.LIKECOUNT)">
<text class="bigShots-1-2-i-t" v-if="currentSorting !== SORTINGTYPE.LIKECOUNT">点赞量</text>
<text class="bigShots-1-2-i-t" v-else style="color: #2d81ff;">点赞量</text>
<u-icon size="10" v-if="sortLog[SORTINGTYPE.LIKECOUNT] !== SORTORDER.DESC" name="arrow-down-fill" :color="currentSorting !== SORTINGTYPE.LIKECOUNT ? '#646464' : '#2d81ff'"></u-icon>
<u-icon size="10" v-else name="arrow-up-fill" :color="currentSorting !== SORTINGTYPE.LIKECOUNT ? '#646464' : '#2d81ff'"></u-icon>
</view>
</view>
</view>
<view class="bigShots-2">
<view class="bigShots-2-i" @click="toBigShotsDetails">
<view class="bigShots-2-i" v-for="item in list" :key="item.id" @click="toBigShotsDetails(item)">
<view class="bigShots-2-i-l">
<image class="bigShots-2-i-l-i" src="@/static/images/ewm.png"></image>
<image class="bigShots-2-i-l-i" :src="item.cover"></image>
</view>
<view class="bigShots-2-i-r">
<view class="bigShots-2-i-r-1">5000题申论100题国考省考公务员考试</view>
<view class="bigShots-2-i-r-1">{{ item.name }}</view>
<view class="bigShots-2-i-r-2">
<view class="bigShots-2-i-r-2-i">
<image class="bigShots-2-i-r-2-i-l" src="@/static/imagesV2/icon44.png" mode="widthFix"></image>
<text class="bigShots-2-i-r-2-i-t">0</text>
<text class="bigShots-2-i-r-2-i-t">{{ item.comment_count }}</text>
</view>
<view class="bigShots-2-i-r-2-i">
<image class="bigShots-2-i-r-2-i-l" src="@/static/imagesV2/icon45.png" mode="widthFix"></image>
<text class="bigShots-2-i-r-2-i-t">0</text>
<text class="bigShots-2-i-r-2-i-t">{{ item.up_count }}</text>
</view>
</view>
</view>
</view>
<u-loadmore :status="status" v-if="!notData"/>
<u-empty
v-if="notData"
mode="data"
text="暂无数据"
icon="/static/imagesV2/icon24.png"
... ... @@ -48,20 +61,145 @@
<script>
import { BIGSHOTS } from '@/emit/index.js'
/**
* 排序方式
*/
const SORTORDER = {
/**
* 升序
* @value asc
*/
'ASC': 'asc',
/**
* 降序
* @value desc
*/
'DESC': 'desc'
}
/**
* 排序类型
*/
const SORTINGTYPE = {
/**
* 评论量
* @value 1
*/
'COMMENT': 'comment_count',
/**
* 点赞量
* @value 2
*/
'LIKECOUNT': 'up_count'
}
export default {
data() {
return {
SORTINGTYPE,
BIGSHOTS,
type: BIGSHOTS.VIDEOLESSONS
SORTORDER,
page: 1,
sortLog: {
comment_count: SORTORDER.ASC,
up_count: SORTORDER.ASC
},
currentSorting: '',
list: [],
// 加载前值为loadmore,加载中为loading,没有数据为nomore
status: 'loadmore',
type: BIGSHOTS.VIDEOLESSONS,
subjectList: [],
selectType: {}
}
},
computed: {
notData() {
return this.status === 'nomore' && !this.list.length
}
},
onReachBottom() {
this.getData()
},
onShow() {
this.onRetry()
this.getClass()
},
methods: {
bindpickerChange(e) {
this.selectType = this.subjectList[e.detail.value]
this.onRetry()
},
setSorting(type) {
let result = this.sortLog[type]
if(result === SORTORDER.ASC) {
result = SORTORDER.DESC
} else {
result = SORTORDER.ASC
}
this.sortLog[type] = result
this.currentSorting = type
this.onRetry()
},
onRetry(){
this.page=1
this.list = []
this.status = 'loadmore'
this.getData()
},
getClass() {
this.$service.P_get('/course/cate', {}).then(res => {
console.log(res)
this.subjectList = res.data.map(item => {
return {
title: item.name,
id: item.id,
...item
}
})
})
},
getData() {
if(this.status === 'loading' || this.status === 'nomore') return;
this.status = 'loading';
uni.showLoading({
title: '加载中',
mask: true
})
this.$service.P_get('/course', {
page: this.page,
order_field: this.currentSorting,
order_sort: this.currentSorting ? this.sortLog[this.currentSorting] : '',
cate_id: this.selectType.id || ''
}).then(res => {
uni.hideLoading();
if (res.code == 1) {
this.page++;
this.list = [
...this.list,
...res.data.data
];
this.status = res.data.data.length < res.data.per_page ? 'nomore' : 'loadmore'
} else {
this.status = 'loadmore';
if (res.msg) {
uni.showToast({
icon: 'none',
title: res.msg
})
} else {
uni.showToast({
icon: 'none',
title: '获取数据失败'
})
}
}
})
},
tabsClick(type) {
this.type = type
},
toBigShotsDetails() {
toBigShotsDetails(item) {
uni.navigateTo({
url: '/pagesStu/bigShotsDetails/bigShotsDetails'
url: '/pagesStu/bigShotsDetails/bigShotsDetails?id=' + item.id
})
// uni.navigateTo({
// url: '/pagesStu/audioFrequency/audioFrequency'
... ... @@ -114,10 +252,14 @@
height: 85rpx;
align-items: center;
padding: 0 25rpx;
background-color: #f8f8f8;
.bigShots-1-2-i{
padding-right: 25rpx;
display: flex;
align-items: center;
.bigShots-1-2-i-t{
margin-right: 10rpx;
}
}
}
}
... ...