master
panliang 2023-12-10 13:31:48 +08:00
parent 58c2fdb7a3
commit f43d0df1a7
13 changed files with 196 additions and 84 deletions

View File

@ -1,3 +1,3 @@
ENV = 'production'
VUE_APP_BASE_API = 'http://local.party-rank.host'
VUE_APP_BASE_API = 'http://party-rank.abcdefg.fun'

View File

@ -42,6 +42,7 @@
border: 1px solid #e5e5e5;
border-left: none;
border-right: none;
padding: 15rpx 0;
}
.table-td {
display: flex;

View File

@ -54,6 +54,13 @@
"navigationBarTitleText" : "排行榜"
}
},
{
"path" : "pages/score/cate-rank",
"style" :
{
"navigationBarTitleText" : "排行榜"
}
},
{
"path" : "pages/user/profile",
"style" :

View File

@ -1,28 +1,16 @@
<template>
<view class="page">
<swiper class="swiper" autoplay circular>
<swiper-item v-for="item in banners" :key="item.id">
<swiper-item v-for="item in banners" :key="item.id" @click="target(item.link_config)">
<image :src="item.picture" style="height: 300rpx;width: 100%;" />
</swiper-item>
</swiper>
<view class="app-content">
<view class="item" @click="commonArticle('common')">
<view v-for="item in navList" :key="item.id" class="item" @click="target(item.link_config)">
<view class="icon">
<image src="../../static/images/form-active.png" />
<image :src="item.picture" />
</view>
<view class="title">共性指标</view>
</view>
<view class="item" @click="authArticle">
<view class="icon">
<image src="../../static/images/form-active.png" />
</view>
<view class="title">进阶指标</view>
</view>
<view class="item" @click="feedback">
<view class="icon">
<image src="../../static/images/form-active.png" />
</view>
<view class="title">书记信箱</view>
<view class="title">{{ item.title }}</view>
</view>
</view>
<view class="rank">
@ -48,20 +36,17 @@
<script>
import Rank from '../../components/rank.vue'
import { isLogin } from '../../utils/index'
import { isLogin, navigateTarget } from '../../utils/index'
export default {
components: { Rank },
data() {
return {
header: ['排名', '党员', '得'],
header1: ['排名', '支部', '得分'],
header: ['排名', '党员', '得'],
header1: ['排名', '支部', '平均得星'],
userList: [],
cateList: [],
banners: [
{id: 1, 'image': 'https://via.placeholder.com/800x300.png?text=1'},
{id: 2, 'image': 'https://via.placeholder.com/800x300.png?text=2'},
{id: 3, 'image': 'https://via.placeholder.com/800x300.png?text=3'},
]
banners: [],
navList: [],
}
},
onLoad() {
@ -75,25 +60,27 @@
if (res.status == 0) {
this.banners = res.data
}
res = await this.$ajax.get('/api/rank', { params: { type: 'user', limit: 20 } })
res = await this.$ajax.get('/api/rank/user', { params: { limit: 20 } })
if (res.status == 0) {
this.userList = res.data
this.userList = res.data.list
}
res = await this.$ajax.get('/api/rank', { params: { type: 'cate', limit: 5 } })
res = await this.$ajax.get('/api/rank/cate', { params: { limit: 5 } })
if (res.status == 0) {
this.cateList = res.data
this.cateList = res.data.list
}
res = await this.$ajax.get('/api/banner', { params: { key: 'banner_3' }})
if (res.status == 0) {
this.navList = res.data
}
uni.hideLoading()
},
userRank(type) {
uni.navigateTo({
url: `/pages/score/user-rank?type=${type}`
url: `/pages/score/${type}-rank`
})
},
commonArticle() {
uni.navigateTo({
url: `/pages/article/detail?type=common`
})
target(option) {
return navigateTarget(option)
},
authArticle() {
//
@ -113,11 +100,6 @@
}
})
}
},
feedback() {
uni.navigateTo({
url: '/pages/feedback/add'
})
}
}
}
@ -166,13 +148,15 @@
.rank .header {
text-align: center;
font-weight: bold;
position: relative;
padding: 15rpx 0;
}
.rank .title {
font-size: 36rpx;
}
.rank .tool {
float: right;
margin-right: 30rpx;
right: 30rpx;
position: absolute;
}
.rank .body {
padding-top: 15rpx;

View File

@ -19,7 +19,7 @@ export default {
})
} else {
uni.reLaunch({
url: '/pages/auth/login'
url: '/pages/index/index'
})
}
},

View File

@ -0,0 +1,114 @@
<template>
<view class="page">
<view class="title">
<view class="name1">
<picker mode="selector" :range="dates" @change="changeDate">{{ date }}<u-icon name="arrow-down-fill" /></picker>
</view>
</view>
<view v-if="user.show" class="me">
我的支部平均得星: <text class="waring">{{ user.score }}</text>, 我的排名: <text class="waring">{{ user.rank }}</text>
</view>
<view class="rank">
<rank :header="header" :list="list" />
</view>
</view>
</template>
<script>
import Rank from '../../components/rank.vue'
import { isLogin } from '../../utils/index'
export default {
components: { Rank },
data() {
return {
header: ['排名', '支部', '平均得星'],
list: [],
date: '当前',
index: 0,
dates: ['当前'],
user: {
show: false,
score: '-',
rank: '-'
}
}
},
onLoad(e) {
this.user.show = isLogin()
this.init()
this.load()
},
methods: {
init() {
this.$ajax.get('/api/rank/cate/dates').then(res => {
if (res.status == 0) {
this.dates = ['当前'].concat(res.data)
}
})
},
load() {
let params = {}
let url = '/api/rank/cate'
if (this.index > 0) {
params.sn = this.dates[this.index]
url = '/api/rank/cate/list'
}
this.$ajax.get(url, { params, custom: {loading: true} }).then(res => {
if (res.status == 0) {
this.list = res.data.list
const current = res.data.current
if (this.user.show && current.cate) {
this.user.score = current.score
this.user.rank = current.rank
}
}
})
},
changeDate(e) {
this.index = e.detail.value
this.date = this.dates[this.index]
this.load()
}
}
}
</script>
<style>
.title {
background-color: white;
display: flex;
padding: 20rpx;
justify-content: space-around;
}
.rank {
background-color: white;
margin-top: 20rpx;
padding: 20rpx;
border-radius: 10rpx;
box-sizing: border-box;
}
.name1 {
display: flex;
width: 100%;
justify-content: center;
}
.name1 ::v-deep .u-icon {
margin-left: 10rpx;
display: inline-block;
}
.me {
background-color: white;
text-align: center;
margin: 15rpx 0;
padding: 10rpx 0;
}
.me .waring {
font-size: 40rpx;
color: #f0ad4e;
}
::v-deep uni-picker {
width: 100%;
text-align: center;
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<view class="page">
<swiper class="swiper" autoplay circular>
<swiper-item v-for="item in banners" :key="item.id">
<swiper-item v-for="item in banners" :key="item.id" @click="target(item.link_config)">
<image :src="item.picture" style="height: 300rpx;width: 100%;" />
</swiper-item>
</swiper>
@ -27,14 +27,14 @@
</block>
</view>
</view>
<view class="article rich-text">
<view v-if="content" class="article rich-text">
<rich-text :nodes="content" />
</view>
</view>
</template>
<script>
import { isLogin } from '../../utils/index'
import { isLogin, navigateTarget } from '../../utils/index'
export default {
data() {
return {
@ -81,6 +81,9 @@
uni.navigateTo({
url: `/pages/score/form?type=${id}`
})
},
target(option) {
return navigateTarget(option)
}
}
}
@ -97,11 +100,10 @@
border-radius: 20rpx;
background-color: white;
display: flex;
justify-content: center;
justify-content: space-around;
}
.app .item {
text-align: center;
margin: 0 10rpx;
}
.app .icon ::v-deep uni-image {
border-radius: 20rpx;

View File

@ -13,7 +13,7 @@
<u-cell title="审核时间" :value="info.check_at"></u-cell>
<u-cell title="审核人" :value="info.check_user ? info.check_user.name : ''"></u-cell>
<u-cell v-if="info.check_status == 2" title="未通过原因" :value="info.check_remarks"></u-cell>
<u-cell v-if="info.check_status == 1" title="得" :value="info.score"></u-cell>
<u-cell v-if="info.check_status == 1" title="得" :value="info.score"></u-cell>
</u-cell-group>
</view>
</template>

View File

@ -22,7 +22,7 @@
<view class="labels">
<view class="label">提交时间: {{ item.created_at }}</view>
<view v-if="item.check_status > 0" class="label">: {{ item.check_at }}</view>
<view v-if="item.check_status == 1" class="label">得: <text class="text-success">+{{ item.score }}</text></view>
<view v-if="item.check_status == 1" class="label">得: <text class="text-success">+{{ item.score }}</text></view>
<view v-if="item.check_status == 2" class="label">: <u-text type="error" :text="item.check_remarks" /></view>
</view>
<view class="options">

View File

@ -6,7 +6,7 @@
</view>
</view>
<view v-if="user.show" class="me">
我的得: <text class="waring">{{ user.score }}</text>, 我的排名: <text class="waring">{{ user.rank }}</text>
我的得: <text class="waring">{{ user.score }}</text>, 我的排名: <text class="waring">{{ user.rank }}</text>
</view>
<view class="rank">
<rank :header="header" :list="list" />
@ -21,8 +21,7 @@
components: { Rank },
data() {
return {
type: 'user',
header: ['排名', '党员', '得分'],
header: ['排名', '支部', '得星'],
list: [],
date: '当前',
index: 0,
@ -35,50 +34,33 @@
}
},
onLoad(e) {
if (e.type) {
this.type = e.type
this.header = ['排名', this.type == 'user' ? '党员' : '支部', '得分'];
}
this.user.show = isLogin()
this.init()
this.load()
},
methods: {
init() {
this.$ajax.get('/api/rank/dates', { params: { type: this.type } }).then(res => {
this.$ajax.get('/api/rank/user/dates').then(res => {
if (res.status == 0) {
this.dates = ['当前'].concat(res.data)
}
})
},
load() {
let url = '/api/rank'
let params = { type: this.type }
let params = {}
let url = '/api/rank/user'
if (this.index > 0) {
url = '/api/rank/list'
params.sn = this.dates[this.index]
url = '/api/rank/user/list'
}
this.$ajax.get(url, { params, custom: {loading: true} }).then(res => {
if (res.status == 0) {
this.list = res.data
}
})
this.loadUser()
},
loadUser() {
if (!this.user.show) {
return;
}
let url = '/api/rank/current'
let params = { type: this.type }
if (this.index > 0) {
url = '/api/rank/current-list'
params.sn = this.dates[this.index]
}
this.$ajax.get(url, { params }).then(res => {
if (res.status == 0) {
this.user.rank = res.data.rank
this.user.score = res.data.score
this.list = res.data.list
const current = res.data.current
if (this.user.show) {
this.user.score = current.score
this.user.rank = current.rank
}
}
})
},

View File

@ -21,17 +21,17 @@
</view>
</view>
<view class="list">
<view class="item">
<view class="item" @click="rank">
<view class="number">{{ user.current_score }}</view>
<view class="text">当前得星</view>
</view>
<view class="border"></view>
<view class="item">
<view class="item" @click="rank">
<view class="number">{{ user.rank }}</view>
<view class="text">总排名</view>
</view>
<view class="border"></view>
<view class="item">
<view class="item" @click="rank">
<view class="number">{{ user.score }}</view>
<view class="text">累计得星</view>
</view>
@ -84,9 +84,11 @@
this.user.score = res.data.score
radarValue = res.data.scores
}
res = await this.$ajax.get('/api/rank/current', { params: { type: 'user' } })
res = await this.$ajax.get('/api/rank/user')
if (res.status == 0) {
this.user.rank = res.data.rank
if (res.data.current) {
this.user.rank = res.data.current.rank
}
}
res = await this.$ajax.get('/api/keyword', { params: { key: 'score_cate_' } })
let radarIndicator = [
@ -156,6 +158,11 @@
uni.navigateTo({
url: '/pages/score/list'
})
},
rank() {
uni.navigateTo({
url: '/pages/score/user-rank?type=user'
})
}
}
}

View File

@ -46,6 +46,9 @@ export default {
this.$ajax.get('/api/user/profile', {custom: {loading: true}}).then(res => {
if (res.status == 0) {
this.user = res.data
if (!this.user.avatar) {
this.user.avatar = '../../static/images/default-avatar.png'
}
}
})
},

View File

@ -9,3 +9,15 @@ export function setToken(value) {
export function getToken() {
return uni.getStorageSync('party_rank_auth_token')
}
export function navigateTarget(option) {
console.log(option)
if (!option || !option.target_url) {
return;
}
if (option.target_type == 'app') {
uni.navigateTo({
url: option.target_url
})
}
}