123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <view class="question-detail-page">
- <van-sticky>
- <view class="" @click="goSearch">
- <van-search :value="search_txt" shape="round" placeholder="提问内容" disabled />
-
- </view>
- <van-tabs id="tabs" :active="status" title-active-color="#3385FF" color="#3385FF" @change="typeChange">
- <van-tab :title="item.label" :name="item.key" v-for="item in tabs" :key="item.key"></van-tab>
- </van-tabs>
- </van-sticky>
-
- <view class="list-cont">
- <question-item
- v-for="item in list"
- :key="item"
- :item="item"
- :status="status"
- :type="type"
- />
- </view>
-
- <van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="finished&&list.length===0"/>
- </view>
- </template>
- <script>
- import questionItem from '../components/questionItem.vue'
- export default {
- data() {
- return {
- type:'',//页面类型
- search_txt: '',
- status: '',
- tabs: [],
- list:[1,2,3,4],
- finished: false
- };
- },
- components: { questionItem },
- onLoad(options) {
- this.initState(options)
- },
- onShow() {
- this.$nextTick(()=>{
- this.selectComponent('#tabs').resize();// 解决初始渲染 vant tab 底部条
- })
- },
- methods: {
- /* 改变类型 */
- typeChange(key) {
-
- },
-
- /* 搜索 */
- goSearch() {
- console.log(1111)
- uni.navigateTo({
- url: `/pages-approve/search/index?type=question`
- })
- },
-
-
- /* init*/
- initState({ type }) {
- const titleMap = {
- 'question': '分配提问',
- 'comment': '评论管理',
- }
- const tabMap = {
- 'question': [
- {
- label: '待分配',
- key: 1
- },
- {
- label: '待回答',
- key: 2
- },
- {
- label: '已回答',
- key: 3
- },
-
- ],
- 'comment': [
- {
- label: '全部',
- key: 1
- },
- {
- label: '已精选',
- key: 2
- },
- {
- label: '未精选',
- key: 3
- },
-
- ]
- }
-
- this.type = type;
-
- this.tabs = tabMap[type] || tabMap['question'];
-
- uni.setNavigationBarTitle({
- title: titleMap[type]
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .list-cont {
- padding: 40rpx 20rpx;
- }
- </style>
|