Files
im/pages/common/article.vue
T
cansnow cf1ad1c24b 14
2025-12-17 08:47:58 +08:00

62 lines
1.8 KiB
Vue

<template>
<view class="n-ps-all-base">
<uv-parse v-if="content" :content="content"></uv-parse>
<view class="n-flex-row" v-if="showButton" :style="{marginTop:'100rpx'}">
<uv-button class="n-flex-1 n-ms-base" v-for="(item, idx) in buttonList" :key="idx" @click="switchButton(idx, item)" :text="item.title" :icon="'/static/image/' + item.value + '.png'" :plain="current==idx" :color="current==idx ? item.color:'#f8f8f8'" :customStyle="{height:'80rpx'}" :customTextStyle="{color:current==idx ? item.color:'#333333',marginLeft:'20rpx'}" shape="circle" color="#f8f8f8" throttleTime="1000"></uv-button>
</view>
<uv-empty :show="empty" icon="/static/image/empty.png" text="暂无数据~" width="200" marginTop="100"></uv-empty>
</view>
</template>
<script>
import {getArticle} from '@/api/login.js'
export default {
data() {
return {
empty: false,
content: '',
current: null,
questionId: 0,
showButton: false,
buttonList: [
{title:'未解决', value:'unresolved', color:'#fc3463'},
{title:'已解决', value:'resolved', color:'#5ac725'}
]
}
},
onLoad(evt) {
if(evt.type=='config') this.setConfig(evt)
if(evt.type=='question') this.setQuestion(evt)
uni.setNavigationBarTitle({title:evt.title})
},
methods: {
// 设置配置内容
setConfig(evt) {
let config = getApp().globalData.config
if(evt.name && config[evt.name]){
this.content = config[evt.name]
}else{
this.empty = true
}
},
// 设置问题内容
setQuestion(evt) {
this.content = evt.content
this.questionId = evt.id
this.showButton = true
},
// 切换按钮
switchButton(idx, item) {
this.current = idx
getArticle({id:this.questionId,type:item.value})
}
}
}
</script>
<style>
</style>