Files
dvcp_v2_wxcp_app/library/project/fd/AppAnswer/AppAnswer.vue

117 lines
2.3 KiB
Vue
Raw Normal View History

2023-01-09 17:04:27 +08:00
<template>
<div class="AppAnswer">
2023-01-10 13:42:45 +08:00
<div class="tab-wrapper">
<div class="tab">
<span :class="[component === 'List' ? 'active' : '']" @click="change('List')">问题</span>
<span :class="[component === 'Ranking' ? 'active' : '']" @click="change('Ranking')">排行</span>
</div>
</div>
<div class="AppAnswer-body">
2023-01-11 09:58:04 +08:00
<component :is="component" :ref="component"></component>
2023-01-10 13:42:45 +08:00
</div>
2023-01-09 17:54:09 +08:00
</div>
2023-01-09 17:04:27 +08:00
</template>
<script>
import { mapState } from 'vuex'
2023-01-10 13:42:45 +08:00
import List from './component/List'
import Ranking from './component/Ranking'
2023-01-09 17:04:27 +08:00
export default {
name: 'AppAnswer',
appName: '学习问答',
data() {
return {
detail: {},
list: [],
wxLogin: 0,
current: 1,
2023-01-10 13:42:45 +08:00
total: 0,
component: 'List'
2023-01-09 17:04:27 +08:00
}
},
2023-01-10 13:42:45 +08:00
components: {
List,
Ranking
},
2023-01-09 17:04:27 +08:00
computed: {
...mapState(['user']),
},
2023-01-11 09:58:04 +08:00
onLoad () {
uni.$on('update', () => {
this.$refs.List.update()
})
},
2023-01-09 17:04:27 +08:00
methods: {
2023-01-10 13:42:45 +08:00
getList () {
2023-01-09 17:04:27 +08:00
},
2023-01-10 13:42:45 +08:00
handleDetail (id) {
2023-01-09 17:04:27 +08:00
if (!this.user.token) this.wxLogin++
else uni.navigateTo({url: './voteDetail?id=' + id})
2023-01-10 13:42:45 +08:00
},
change (type) {
this.component = type
2023-01-09 17:04:27 +08:00
}
},
2023-01-10 13:42:45 +08:00
2023-01-09 17:04:27 +08:00
onReachBottom () {
2023-01-11 09:58:04 +08:00
this.$refs[this.component].getMore()
2023-01-09 17:04:27 +08:00
}
}
</script>
<style lang="scss" scoped>
.AppAnswer {
min-height: 100vh;
2023-01-10 13:42:45 +08:00
background: #F3F5F9;
.tab-wrapper {
position: sticky;
top: 0;
z-index: 11;
background: #3975C6;
}
.tab {
display: flex;
align-items: center;
justify-content: space-between;
height: 112px;
border-radius: 50px 50px 0 0;
padding: 0 256px;
background: #F3F5F9;
span {
position: relative;
line-height: 1;
color: #999999;
font-size: 40px;
&.active {
color: #000000;
&::after {
position: absolute;
bottom: -2px;
z-index: 0;
opacity: 0.8;
left: 50%;
width: 80px;
height: 12px;
background-image: linear-gradient(90deg, #46C0FF 0%, #0C85FF 100%);
transform: translateX(-50%);
content: '';
}
}
}
}
2023-01-09 17:04:27 +08:00
}
</style>