import { documentsList,findDataInfo} from '../../api/documentManagement' export default { data() { return { problems: [ { id: 1, title: "如何开始挖矿?", content: "详细步骤:注册、配置矿机、连接矿池。", }, { id: 2, title: "如何查看收益?", content: "登录后在个人中心查看收益统计。", }, { id: 3, title: "如何联系客服?", content: "可通过在线客服或提交工单联系我们。", }, ], listParams:{ type:"3",//常见问题 lang:this.$i18n.locale, pageNum:1, pageSize:50 }, problemLoading:false, DetailsParams:{ id:"", lang:this.$i18n.locale, }, info:"" }; }, mounted() { this.DetailsParams.id = this.$route.query.id; console.log(this.$route.query.id,"this.DetailsParams.id"); if (this.DetailsParams.id) { this.fetchProblemDetails(this.DetailsParams) } this.fetchProblemsList(this.listParams) }, methods: { async fetchProblemsList(params) { this.setLoading('problemLoading', true); const res = await documentsList(params) if(res && res.code === 200){ this.problems = res.rows; // this.DetailsParams.id = this.problems[0].id; // this.fetchProblemDetails(this.DetailsParams) } this.setLoading('problemLoading', false); }, async fetchProblemDetails(params) { this.setLoading('problemLoading', true); const res = await findDataInfo(params) if(res && res.code === 200){ console.log(res,"res"); this.info = res.data.content || "" } this.setLoading('problemLoading', false); }, /** * 跳转到问题详情页 * @param {number} id 问题ID */ handleClick(id) { this.DetailsParams.id = id; this.fetchProblemDetails(this.DetailsParams) }, }, };