123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- <template>
- <view class="index">
- <button type="primary" @tap="toranking">排行榜</button>
- <button type="primary" @tap="toupload">图片上传</button>
- <button type="primary" @tap="tohonour">荣耀殿堂</button>
- <button type="primary" @tap="toexchange">礼品兑换</button>
- <button type="primary" @tap="tostatistics">数据统计</button>
- <button type="primary" @tap="tosetting">设置</button>
- <button type="primary" @tap="toChallenge">学分挑战</button>
- <button type="primary" v-if="userStatus" @tap="toScore">学分账单</button>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
-
- }
- },
- computed: {
- userServerInfo () { //用户服务器信息
- return this.$store.state.userServerInfo
- },
- userStatus () { //根据赛季阶段和用户类型,显示不同可操作项
- if (this.$verified()) { //如果用户已经登录,进行下一步判断
- if (this.userServerInfo.status) { //如果赛季已经开赛
- if (this.userServerInfo.status === 1) { //如果赛季正处于报名阶段
- if (this.userServerInfo.signuped) { //如果用户已报名
- return '已报名'
- } else { //如果用户未报名,那么可能是 1 用户真没报名 2 批发商 3 客服
- if (this.userServerInfo.type === 1) {
- return '报名参赛'
- } else if (this.userServerInfo.type === 2) {
- return '报名参赛'
- } else if (this.userServerInfo.type === 3) {
- return ''
- }
- }
- } else if (this.userServerInfo.status === 2 || this.userServerInfo.status === 3 || this.userServerInfo.status === 5) { //如果赛季正处于比赛或兑奖阶段
- if (this.userServerInfo.signuped) { //如果用户已报名
- return '学分账单'
- } else { //如果用户未报名,那么可能是 1 用户真没报名 2 批发商 3 客服
- if (this.userServerInfo.type === 1) {
- // return '报名截止'
- return ''
- } else if (this.userServerInfo.type === 2) {
- return '学分账单'
- } else if (this.userServerInfo.type === 3) {
- return ''
- }
- }
- } else if (this.userServerInfo.status === 4) { // 如果赛季正处于报名结束的空档期
- if (this.userServerInfo.signuped) { //如果用户已报名
- return '已报名'
- } else { //如果用户未报名,那么可能是 1 用户真没报名 2 批发商 3 客服
- if (this.userServerInfo.type === 1) {
- // return '报名截止'
- return ''
- } else if (this.userServerInfo.type === 2) {
- return '学分账单'
- } else if (this.userServerInfo.type === 3) {
- return ''
- }
- }
- }
- } else { //如果赛季暂未开赛
- // return '暂未开赛'
- return ''
- }
- } else { //如果用户未登录
- return '绑定账号'
- }
- }
- },
- onShow() {
- this.routing = false
- },
- methods: {
- toScore() {
- uni.navigateTo({ url: '../score/score' })
- },
- toChallenge() { // 点击学分挑战
- if (this.$verified()) { //用户是否已登录
- if (this.userServerInfo.signuped) { // 用户是否已经报名
- if (this.userServerInfo.type === 2) { // 只有批发商能够参加学分竞赛
- if (this.routing) { return }
- this.routing = true
- uni.navigateTo({ url: '../challengeList/challengeList' })
- } else { //批发商和客服不可参赛,所以提示无参赛记录
- uni.showToast({ title: '只有批发商可以参与挑战', icon:"none" })
- }
- } else {
- uni.showToast({ title: '您还没有报名参赛', icon:"none" })
- }
- } else { //未登录弹出登录框
- uni.showToast({ title: '您还未登录', icon:"none" })
- }
- },
- toranking () { //点击排行榜
- if (this.$verified()) { //用户是否已登录
- if (this.userServerInfo.type === 1) { //判断用户类型,普通用户需要报名后才可以查看排行榜
- if (this.userServerInfo.signuped) { //如果用户已报名,就跳转
- if (this.routing) { return }
- this.routing = true
- uni.navigateTo({ url: '../ranking/ranking' })
-
- } else { ////如果用户已报名,就提示用户没有报名
- uni.showToast({
- title: '您还没有报名参赛',
- icon:"none"
- })
- }
- } else { //批发商和客服可以直接查看排行榜页
- if (this.routing) { return }
- this.routing = true
- uni.navigateTo({ url: '../ranking/ranking' })
- }
- } else { //未登录弹出登录框
- uni.showToast({
- title: '您还未登录'
- });
- }
- },
- tohonour () { //点击荣誉殿堂
- if (this.$verified()) { //用户是否已登录
- if (this.userServerInfo.type === 1) { //普通用户直接跳转到荣誉殿堂页面
- if (this.routing) { return }
- this.routing = true
- uni.navigateTo({ url: '../honour/honour' })
- } else { //批发商和客服不可参赛,所以提示无参赛记录
- uni.showToast({
- title: '无参赛记录',
- icon:"none"
- });
- }
- } else { //未登录弹出登录框
- uni.showToast({
- title: '您还未登录'
- });
- }
- },
- toupload () { //点击上传图片
- if (this.$verified()) { //用户是否已登录
- if (this.userServerInfo.signuped) {
- if (this.userServerInfo.status === 1 || this.userServerInfo.status === 4) {
- uni.showToast({
- title: '比赛还没有开始',
- icon:"none"
- });
- } else if (this.userServerInfo.status === 2) {
- if (this.routing) { return }
- this.routing = true
- uni.navigateTo({ url: '../upload/upload' })
- } else if (this.userServerInfo.status === 3 || this.userServerInfo.status === 5) {
- uni.showToast({
- title: '比赛已经结束了',
- icon:"none"
- });
- }
- } else {
- uni.showToast({
- title: '您还没有报名参赛',
- icon:"none"
- });
- }
- } else { //未登录弹出登录框
- uni.showToast({
- title: '您还未登录'
- });
- }
- },
- toexchange () { //点击兑换奖品
- if (this.$verified()) { //用户是否已登录
- if (this.userServerInfo.status === 3) {
- if (this.routing) { return }
- this.routing = true
- uni.navigateTo({ url: '../exchange/exchange' })
- } else {
- uni.showToast({
- title: '礼品兑换还未开始',
- icon:"none"
- });
- }
- } else { //未登录弹出登录框
- uni.showToast({
- title: '您还未登录'
- });
- }
- },
- tosetting () { //点击设置
- if (this.routing) { return }
- this.routing = true
- uni.navigateTo({ url: '../setting/setting' })
- },
- tostatistics () { //点击数据统计
- if (this.$verified()) { //用户是否已登录
- if (this.routing) { return }
- this.routing = true
- uni.navigateTo({ url: '../statistics/statistics' })
- } else { //未登录弹出登录框
- uni.showToast({
- title: '您还未登录'
- });
- }
- },
- }
- }
- </script>
- <style>
- .index{
- width: 100%;
- height: 100%;
- position: relative;
- box-sizing: border-box;
- padding: 161rpx 50rpx 0;
- display: flex;
- flex-direction: column;
- }
- button {
- width: 100%;
- margin-top: 20px;
- }
- </style>
|