排行榜新增本月排行及上月排行筛选

This commit is contained in:
2022-08-31 10:33:36 +08:00
parent 347e9a05e0
commit 68df0a014f
8 changed files with 789 additions and 581 deletions

View File

@@ -9,8 +9,8 @@ import router from '../router'
// 基础配置 // 基础配置
const config = { const config = {
// apiUrl : 'https://api.gongli.vip/api/', // 正式环境 apiUrl : 'https://api.gongli.vip/api/', // 正式环境
apiUrl: 'http://api.gl.shangkelian.cn/api/', // 测试 // apiUrl: 'http://api.gl.shangkelian.cn/api/', // 测试
timeout: 60000 timeout: 60000
} }
@@ -46,7 +46,6 @@ const request = (parameter, hideLoding = true) => {
data: parameter.data || {}, data: parameter.data || {},
method: parameter.method || 'GET', method: parameter.method || 'GET',
success: res => { success: res => {
console.log(res)
if (res.header.Authorization) { if (res.header.Authorization) {
updateToken('token', res.header.Authorization) updateToken('token', res.header.Authorization)
} }

View File

@@ -39,9 +39,25 @@ const totaluser = () => {
}) })
} }
// 月度推荐会员排行榜
const monthVip = () => {
return request({
url: 'user/rank/month_vip'
})
}
// 月度推荐用户排行榜
const monthUser = () => {
return request({
url: 'user/rank/month_user'
})
}
export { export {
week_mul, week_mul,
week, week,
total, total,
totaluser totaluser,
monthVip,
monthUser
} }

View File

@@ -3,47 +3,57 @@
<view class="rank_top"> <view class="rank_top">
<view class="rank_top_left"> <view class="rank_top_left">
<image class="rank_title" src="../../static/rank/rank_txt.png" mode="widthFix" /> <image class="rank_title" src="../../static/rank/rank_txt.png" mode="widthFix" />
<view class="rank_sub_title" @click="toHelp"> 共力家族 周会员邀请 <image src="/static/rank/help.png" mode="widthFix" /> </view> <view class="rank_sub_title" @click="toHelp"> 共力家族 周会员邀请
<image src="/static/rank/help.png" mode="widthFix" />
</view>
</view> </view>
<image class="rank_top_right" src="../../static/rank/rank.png" mode="widthFix" /> <image class="rank_top_right" src="../../static/rank/rank.png" mode="widthFix" />
</view> </view>
<!-- @click="click" --> <!-- @click="click" -->
<u-sticky bgColor="#34CE98"> <u-sticky bgColor="#34CE98">
<u-tabs <u-tabs :list="tabs" lineColor="white" :activeStyle="{color: 'white', fontWeight: 'bold', fontSize: '15px'}"
:list="tabs" :inactiveStyle="{color: 'rgba(255,255,255,.6)', fontSize: '15px'}" :itemStyle="{'height': '50px'}"
lineColor="white" @click="onTabs" />
:activeStyle="{color: 'white', fontWeight: 'bold', fontSize: '15px'}"
:inactiveStyle="{color: 'rgba(255,255,255,.6)', fontSize: '15px'}"
:itemStyle="{'height': '50px'}"
@click="onTabs"
/>
</u-sticky> </u-sticky>
<view class="rank_update_time" v-if="type != '3' && type != '4' && end_timestamp"> <view class="rank_update_time" v-if="type != '3' && type != '4' && end_timestamp">
<view class="title"> 加成{{type === '1'?'结束':'生效'}}倒计时:</view> <view class="title"> 加成{{type === '1'?'结束':'生效'}}倒计时:</view>
<u-count-down <u-count-down ref="countDown" format="DD:HH:mm:ss" :time="end_timestamp" :autoStart="false"
ref="countDown" @change="downTime">
format="DD:HH:mm:ss"
:time="end_timestamp"
:autoStart="false"
@change="downTime"
>
<view class="time"> <view class="time">
<view class="time__item"> <view class="time__item">
<text class="time__item_no">{{ timeData.days > 9 ? timeData.days: '0' + timeData.days }} </text> <text class="time__item_no">{{ timeData.days > 9 ? timeData.days: '0' + timeData.days }}
</text>
</view> </view>
<view class="time__item"> <view class="time__item">
<text class="time__item_no">{{ timeData.hours > 9 ? timeData.hours : '0' + timeData.hours}}</text> <text
class="time__item_no">{{ timeData.hours > 9 ? timeData.hours : '0' + timeData.hours}}</text>
</view> </view>
<view class="time__item"> <view class="time__item">
<text class="time__item_no">{{ timeData.minutes > 9 ? timeData.minutes : '0' + timeData.minutes}}</text> <text
class="time__item_no">{{ timeData.minutes > 9 ? timeData.minutes : '0' + timeData.minutes}}</text>
</view> </view>
<view class="time__item"> <view class="time__item">
<text class="time__item_no">{{ timeData.seconds > 9 ? timeData.seconds : '0' + timeData.seconds}}</text> <text
class="time__item_no">{{ timeData.seconds > 9 ? timeData.seconds : '0' + timeData.seconds}}</text>
</view> </view>
</view> </view>
</u-count-down> </u-count-down>
</view> </view>
<block v-if="type =='3' || type == '4'">
<view class="rank_update_time">
<view :class="['title', 'sub-title',current?'actived':'']" @click="getCurrent('1')">
<image v-if="current" src="/static/rank/mo.png" mode="widthFix" />
<image v-else src="/static/rank/mo-null.png" mode="widthFix" /> 本月排行
</view>
<view :class="['title', 'sub-title',!current?'actived':'']" @click="getCurrent('2')">
<image v-if="!current" src="/static/rank/mo.png" mode="widthFix" />
<image v-else src="/static/rank/mo-null.png" mode="widthFix" />上月排行
</view>
</view>
</block>
<view class="list"> <view class="list">
<block v-if="lists.length>0"> <block v-if="lists.length>0">
<view class="list_item" v-for="(item,index) in lists" :keys='index'> <view class="list_item" v-for="(item,index) in lists" :keys='index'>
@@ -67,9 +77,7 @@
</block> </block>
<block v-else> <block v-else>
<view class="vertical pages-empty"> <view class="vertical pages-empty">
<u-empty <u-empty icon="http://cdn.uviewui.com/uview/empty/list.png" textColor="#999"
icon="http://cdn.uviewui.com/uview/empty/list.png"
textColor="#999"
:text="type === '1'?'上周无加成数据':'当前暂无邀请数据'"> :text="type === '1'?'上周无加成数据':'当前暂无邀请数据'">
</u-empty> </u-empty>
</view> </view>
@@ -82,38 +90,53 @@
week, week,
week_mul, week_mul,
total, total,
totaluser totaluser,
monthVip,
monthUser
} from '@/apis/interfaces/rank.js' } from '@/apis/interfaces/rank.js'
export default { export default {
data() { data() {
return { return {
end_timestamp: 0, end_timestamp: 0,
lists : [], lists: [],
timeData : { timeData: {
days : 0, days: 0,
hours : 0, hours: 0,
minutes : 0, minutes: 0,
seconds : 0 seconds: 0
},
type: '1', // 1加成榜 2邀请榜 3会员邀请 4用户邀请
page_id: '',
tabs: [{
name: '上周加成榜',
type: '1'
},
{
name: '本周邀请榜',
type: '2'
},
{
name: '会员邀请榜',
type: '3'
},
{
name: '用户邀请榜',
type: '4'
}, },
type : '1', // 1加成榜 2邀请榜 3会员邀请 4用户邀请
page_id : '',
tabs : [
{name: '上周加成榜', type: '1'},
{name: '本周邀请榜', type: '2'},
{name: '会员邀请榜', type: '3'},
{name: '用户邀请榜', type: '4'},
], ],
current: true,
listsInfo:{},// current last
} }
}, },
onShow() { onShow() {
this.getList(); this.getList();
}, },
methods: { methods: {
onTabs(e){ onTabs(e) {
if(this.type == e.type){ if (this.type == e.type) {
return return
} }
if(this.$refs.countDown){ if (this.$refs.countDown) {
this.$refs.countDown.pause() this.$refs.countDown.pause()
} }
uni.showLoading({ uni.showLoading({
@@ -138,19 +161,25 @@
} else if (this.type === '2') { } else if (this.type === '2') {
urlRequest = week urlRequest = week
} else if (this.type === '4') { } else if (this.type === '4') {
urlRequest = totaluser urlRequest = monthUser
} else { } else {
urlRequest = total urlRequest = monthVip
} }
urlRequest().then(res => { urlRequest().then(res => {
if (this.type === '1' || this.type === '2') {
this.lists = res.rand; this.lists = res.rand;
this.page_id = res.page_id;
this.end_timestamp = res.end_timestamp * 1000; this.end_timestamp = res.end_timestamp * 1000;
this.$nextTick(() => { this.$nextTick(() => {
if(this.$refs.countDown){ if (this.$refs.countDown) {
this.$refs.countDown.start() this.$refs.countDown.start()
} }
}) })
} else if (this.type === '3' || this.type === '4') {
this.current = true;
this.listsInfo = res.rank;
this.lists = res.rank.current;
}
this.page_id = res.page_id;
uni.hideLoading() uni.hideLoading()
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
@@ -159,11 +188,23 @@
mask: true mask: true
}) })
}) })
},
getCurrent(id){
if(id === '1'){
this.current = true;
}else{
this.current = false;
}
if(this.current){
this.lists = this.listsInfo.current
}else{
this.lists = this.listsInfo.last
}
} }
}, },
onHide() { onHide() {
try { try {
if(this.$refs.countDown){ if (this.$refs.countDown) {
this.$refs.countDown.pause() this.$refs.countDown.pause()
} }
} catch (err) { } catch (err) {
@@ -186,6 +227,7 @@
background-color: #34CE98; background-color: #34CE98;
padding: 50rpx 30rpx 40rpx 30rpx; padding: 50rpx 30rpx 40rpx 30rpx;
border-bottom: solid 1rpx rgba($color: #fff, $alpha: 0.6); border-bottom: solid 1rpx rgba($color: #fff, $alpha: 0.6);
.rank_top_left { .rank_top_left {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -230,19 +272,41 @@
padding: 50rpx 30rpx; padding: 50rpx 30rpx;
width: 100%; width: 100%;
border-bottom: 20rpx solid $window-color; border-bottom: 20rpx solid $window-color;
.sub-title {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
image {
width: 36rpx !important;
margin-right: 20rpx;
}
}
.title { .title {
font-size: 28rpx; font-size: 28rpx;
font-weight: normal; font-weight: normal;
color: #34CE98; color: #999;
padding-right: 10rpx; padding-right: 10rpx;
} }
.time{
.actived {
color: #34CE98;
}
.time {
display: flex; display: flex;
.time__item{
.time__item {
font-size: 28rpx; font-size: 28rpx;
color: #34CE98; color: #34CE98;
} }
.time__item_no{
.time__item_no {
background: #34CE98; background: #34CE98;
border-radius: 5rpx; border-radius: 5rpx;
color: white; color: white;
@@ -256,6 +320,7 @@
.list { .list {
padding: 30rpx; padding: 30rpx;
.list_item { .list_item {
display: flex; display: flex;
flex-direction: row; flex-direction: row;

BIN
static/.DS_Store vendored Normal file

Binary file not shown.

BIN
static/rank/mo-null.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
static/rank/mo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long