| | |
| | | } |
| | | |
| | | const getInformationList = () => { |
| | | const cachedNews = localStorage.getItem('cachedNews'); |
| | | if (cachedNews) { |
| | | list.value = JSON.parse(cachedNews); |
| | | infoLoading.value = false; |
| | | return; |
| | | } |
| | | _getInformationList().then(data => { |
| | | list.value = data |
| | | infoLoading.value = false |
| | | updateNewsData(data); |
| | | infoLoading.value = false; |
| | | }) |
| | | } |
| | | |
| | | const updateNewsData = (newData) => { |
| | | const cachedNews = localStorage.getItem('cachedNews'); |
| | | if (cachedNews) { |
| | | try { |
| | | const oldData = JSON.parse(cachedNews); |
| | | // 比较新旧数据是否不同 |
| | | if (JSON.stringify(oldData) !== JSON.stringify(newData)) { |
| | | list.value = newData; |
| | | localStorage.setItem('cachedNews', JSON.stringify(newData)); |
| | | } |
| | | } catch (e) { |
| | | // 处理JSON解析错误 |
| | | localStorage.removeItem('cachedNews'); |
| | | list.value = newData; |
| | | localStorage.setItem('cachedNews', JSON.stringify(newData)); |
| | | } |
| | | } else { |
| | | list.value = newData; |
| | | localStorage.setItem('cachedNews', JSON.stringify(newData)); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | // 初始加载新闻数据 |
| | | getInformationList(); |
| | | |
| | | // 添加跳转方法 |
| | | const openOriginUrl = (url) => { |
| | | window.open(url, '_blank') |
| | | } |
| | | // 设置静默更新定时器,每5分钟检查一次 |
| | | const newsUpdateInterval = setInterval(() => { |
| | | _getInformationList().then(newData => { |
| | | updateNewsData(newData); |
| | | }).catch(error => { |
| | | console.error('Silent update failed:', error); |
| | | }); |
| | | }, 5 * 60 * 1000); // 5分钟间隔 |
| | | |
| | | const copyInviteLink = () => { |
| | | const inviteLink = 'https://www.thinkmarketga.com/#/pages/register?c=' + usercode.value // 邀请链接 |
| | | navigator.clipboard.writeText(inviteLink) |
| | | .then(() => { |
| | | // 可以添加提示,比如使用Toast组件 |
| | | showToast({ |
| | | message: '邀请链接已复制', |
| | | position: 'bottom', |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | onUnmounted(() => { |
| | | clearInterval(newsUpdateInterval); |
| | | }); |
| | | }); |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | @import '@/assets/css/deepseek_css_20250625_30ff932.css'; |