m2pool_web_frontend/mining-pool/src/views/helpCenter/index.js

170 lines
4.8 KiB
JavaScript

import { documentsList } from '../../api/documentManagement'
export default{
name: 'HelpCenter',
data() {
return {
/** 搜索查询字符串 */
searchQuery: '',
/** 选中的语言 */
selectedLanguage: 'zh',
/** 分类按钮数据 */
categories: [
{ id: 1, name: 'home.APIfile', route: 'apiFile' },//API文档
{ id: 2, name: 'home.miningTutorial', route: 'AccessMiningPool/nexaAccess' },//挖矿教程
{ id: 3, name: 'home.serviceTerms', route: 'ServiceTerms' },//服务条款
{ id: 4, name: 'home.rate', route: 'rate' },//费率
{ id: 5, name: 'home.announcements', route: 'announcements' },//公告中心
{ id: 6, name: 'home.commonProblem', route: 'commonProblem' },//常见问题
],
/** 推荐内容数据 */
recommendedItems: [
{ id: 1, description: 'home.allocationExplanation' ,route:"allocationExplanation"},//矿池分配及转账规则
// { id: 2, description: '余额不足如何任何偿还,该如何规划运营?' },
// { id: 3, description: '矿池选择它已经拥有综合的优势时间,怎么办?' }
],
/** 活动数据 */
activities: [
// {
// id: 1,
// type: '最新公告',
// title: 'LKY将停减税',
// author: '文章ID1星期 主发布',
// comments: '0'
// },
// {
// id: 2,
// type: '最新公告',
// title: 'PFP将停减税',
// author: '文章ID1星期 11发布',
// comments: '0'
// },
// {
// id: 3,
// type: '最新公告',
// title: 'ETC+ZIL停研发综合日获得',
// author: '文章ID1星期 15发布',
// comments: '0'
// },
// {
// id: 4,
// type: '最新公告',
// title: '预计2023年06月19日SCC收益分配说明',
// author: '文章ID1星期 18发布',
// comments: '0'
// },
// {
// id: 5,
// type: '其他',
// title: '关于临时(信为网站、备案管理、矿池编码)',
// author: '文章ID1星期 19发布',
// comments: '0'
// }
],
activeParams:{
type:"3",//公告中心
lang:this.$i18n.locale,
pageNum:1,
pageSize:10
},
TypeList:[
{
value:"1",
label:"挖矿教程"
},
{
value:"2",
label:"常见问题"
},
{
value:"3",
label:"公告中心"
},
{
value:"0",
label:"其他"
},
]
}
},
mounted(){
try {
this.TypeList = JSON.parse(localStorage.getItem('TypeList'))
} catch (error) {
console.log(error);
}
this.fetchActivityList(this.activeParams)
},
methods: {
async fetchActivityList(params){
const res = await documentsList(params)
console.log(res,"res");
if (res.code === 200) {
this.activities = res.rows
}
},
/**
* 处理搜索功能
*/
handleSearch() {
if (this.searchQuery.trim()) {
let url = `/${this.$i18n.locale}/searchResult`
this.$router.push({
path:url,
query:{
keyword:this.searchQuery
}
})
}
},
/**
* 处理分类按钮点击
* @param {Object} category - 分类对象
*/
handleCategoryClick(category) {
console.log(category,"i肯定看到");
const lang = this.$i18n.locale;
this.$router.push(`/${lang}/${category.route}`);
},
/**
* 处理查看更多按钮点击 跳转公告中心页面
*/
handleViewMore() {
this.$router.push(`/${this.$i18n.locale}/announcements`);
},
handelType(type){
try {
let label = this.TypeList.find(item => item.value == type).label
return this.$t(label)
} catch (error) {
return ''
}
},
handelTime(time){
try {
return `${time.split("T")[0]} ${time.split("T")[1]}`
} catch (error) {
return ''
}
},
handleActivityClick(activity){
let url = `/${this.$i18n.locale}/announcementDetails`
// 跳转到公告详情页
this.$router.push({
path:url,
query:{
id:activity.id
}
});
}
}
}