Compare commits

...

2 Commits

Author SHA1 Message Date
fuxiaochun 4d4deaffd7 Merge branch 'master' of https://gitea.hmily.club/haitu/aigc-h5 2023-08-21 21:39:19 +08:00
fuxiaochun bcfeca7136 debug 2023-08-21 21:39:07 +08:00
7 changed files with 99 additions and 58 deletions

View File

@ -39,6 +39,10 @@ body {
background-color: #b6b7b9; background-color: #b6b7b9;
} }
.httpLoading{
font-size: 22px;
}
/* #app { /* #app {
max-width: 1280px; max-width: 1280px;
margin: 0 auto; margin: 0 auto;

View File

@ -23,12 +23,14 @@
<div class="blockTitle">推荐文章</div> <div class="blockTitle">推荐文章</div>
<ul> <ul>
<li :key="item.id" v-for="item in recommend" @click="goDetail(item.id)"> <li :key="item.id" v-for="item in recommend" @click="goDetail(item.id)">
<div class="img"><img :src="item.cover" :alt="item.title"></div> <div class="img">
<div class="info"> <img :src="item.cover" :alt="item.title">
<h3>{{ item.title }}</h3> </div>
<p>{{ item.description }}1</p> <div class="rTitle">
<h2>{{ item.title }}</h2>
<span>{{ DateFormat(new Date(item.published_at * 1000), 'yyyy.MM.dd') }}</span> <span>{{ DateFormat(new Date(item.published_at * 1000), 'yyyy.MM.dd') }}</span>
</div> </div>
<div class="desc">{{ item.description }}</div>
</li> </li>
</ul> </ul>
</div> </div>
@ -217,52 +219,63 @@ const goDetail = (id) => {
} }
ul { ul {
display: flex; padding-top: 30px;
flex-wrap: wrap;
li{ li{
width: 100%; width: 100%;
padding-right: 30px; height: 408px;
display: flex; background: #D6D6DD;
margin-top: 30px; border-radius: 3px;
border: 5px solid #D6D6DD;
margin-bottom: 20px;
color: #333;
cursor: pointer;
.img{ .img{
width: 260px; width: 100%;
height: 360px; height: 264px;
background-color: #666;
overflow: hidden; overflow: hidden;
img{ img{
width: 260px; object-fit: cover;
height: 360px; display: block;
background-color: #666;
&[src='']{
display: none;
} }
} }
}
.info { .rTitle{
flex: 1; height: 80px;
margin-left: 15px; width: 100%;
height: 360px; padding: 20px 10px;
display: flex; display: flex;
flex-direction: column;
justify-content: space-between; justify-content: space-between;
align-items: center;
h3 { h2{
font-size: 32px; height: 40px;
font-weight: bold; font-weight: bold;
padding-bottom: 10px; font-size: 28px;
} line-height: 40px;
margin-right: 10px;
p {
padding: 10px 0;
font-size: 26px;
line-height: 30px;
flex: 1; flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left;
} }
span{ span{
color: #999; height: 40px;
line-height: 40px;
display: inline-block;
font-size: 22px; font-size: 22px;
} }
} }
.desc{
padding: 10px;
font-size: 22px;
font-weight: bold;
line-height: 30px;
}
} }
} }
} }

View File

@ -22,6 +22,7 @@ export default function () {
const showLoading = ()=>{ const showLoading = ()=>{
if (requestCount === 0) { if (requestCount === 0) {
let renderDom = document.createElement('div'); let renderDom = document.createElement('div');
renderDom.className ='httpLoading';
renderDom.style.cssText = 'width:100%; height: 100%; position: absolute;left:0;top:0;z-index:9999;background-color: rgba(0,0,0,0.5);display: flex;justify-content: center; align-items: center;' renderDom.style.cssText = 'width:100%; height: 100%; position: absolute;left:0;top:0;z-index:9999;background-color: rgba(0,0,0,0.5);display: flex;justify-content: center; align-items: center;'
renderDom.setAttribute('id', 'requestLoading'); renderDom.setAttribute('id', 'requestLoading');
renderDom.innerHTML = 'loading...'; renderDom.innerHTML = 'loading...';
@ -76,7 +77,7 @@ export default function () {
if (response.data.status != 0) { if (response.data.status != 0) {
if (response.data.status == 401 ) { if (response.data.status == 401 ) {
// token失效 // token失效
showToast('账号过期或异地登录, 请重新登录'); // showToast('账号过期或异地登录, 请重新登录');
localCache.remove('auth'); localCache.remove('auth');
localCache.remove('userInfo'); localCache.remove('userInfo');
userInfo.updateUserInfo({}); userInfo.updateUserInfo({});
@ -97,7 +98,7 @@ export default function () {
switch (error.response.data.status) { switch (error.response.data.status) {
case 401: case 401:
// token失效 // token失效
showToast('账号过期或异地登录, 请重新登录'); // showToast('账号过期或异地登录, 请重新登录');
localCache.remove('auth'); localCache.remove('auth');
localCache.remove('userInfo'); localCache.remove('userInfo');
userInfo.updateUserInfo({}); userInfo.updateUserInfo({});

View File

@ -3,7 +3,7 @@
<div class="logo"> <div class="logo">
<img :src="website.info.web_logo" :alt="website.info.web_title"> <img :src="website.info.web_logo" :alt="website.info.web_title">
</div> </div>
<div class="title">{{$route.meta.title}}</div> <div class="title">{{pageTitle}}</div>
<div class="nav"> <div class="nav">
<div class="navBtn" @click.stop="toggleMenu"><van-icon name="wap-nav" size="0.6rem" /></div> <div class="navBtn" @click.stop="toggleMenu"><van-icon name="wap-nav" size="0.6rem" /></div>
<div class="menuBox" @click.stop="" v-if="showMenu"> <div class="menuBox" @click.stop="" v-if="showMenu">
@ -46,7 +46,7 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from 'vue'; import { ref, onMounted, computed } from 'vue';
import { useUserInfo } from '@/stores/userInfo'; import { useUserInfo } from '@/stores/userInfo';
import { localCache } from '@/io/cache'; import { localCache } from '@/io/cache';
import http from '@/io/http'; import http from '@/io/http';
@ -65,6 +65,10 @@ const timer = ref(0);
const showMenu = ref(false); const showMenu = ref(false);
const pageTitle = computed(()=>{
return website.pageTitle || route.meta.title;
});
onMounted(()=>{ onMounted(()=>{
document.body.addEventListener('click', ()=>{ document.body.addEventListener('click', ()=>{
showMenu.value = false; showMenu.value = false;
@ -157,7 +161,7 @@ const jump = (url)=>{
position: relative; position: relative;
z-index: 9; z-index: 9;
.logo{ .logo{
width: 230px; width: 200px;
height: 80px; height: 80px;
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
@ -169,19 +173,21 @@ const jump = (url)=>{
} }
} }
.title{ .title{
width: 230px; width: 290px;
height: 70px; height: 70px;
line-height: 70px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
font-size: 28px; font-size: 28px;
font-weight: bold; font-weight: bold;
display: flex; text-align: center;
justify-content: center; // display: flex;
align-items: center; // justify-content: center;
// align-items: center;
} }
.nav{ .nav{
width: 230px; width: 200px;
height: 70px; height: 70px;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;

View File

@ -87,7 +87,7 @@ const router = createRouter({
path: "/business/macroeconomics/trend/:id", path: "/business/macroeconomics/trend/:id",
name: "Trend", name: "Trend",
meta: { meta: {
title: "洞趋势", title: "洞趋势",
group: 'business' group: 'business'
}, },
component: () => import("@/views/business/macroeconomics/trend.vue"), component: () => import("@/views/business/macroeconomics/trend.vue"),

View File

@ -2,10 +2,14 @@ import { ref, computed } from "vue";
import { defineStore } from "pinia"; import { defineStore } from "pinia";
export const useWebsite = defineStore("website", () => { export const useWebsite = defineStore("website", () => {
const pageTitle = ref('');
const info = ref({}); const info = ref({});
function updateInfo(data) { function updateInfo(data) {
info.value = data; info.value = data;
} }
function setPageTitle(title){
pageTitle.value = title;
}
return { info, updateInfo }; return { info, pageTitle, updateInfo, setPageTitle };
}); });

View File

@ -2,10 +2,10 @@
<div class="pageContainer"> <div class="pageContainer">
<div class="mainBox"> <div class="mainBox">
<div class="breadNav"> <div class="breadNav">
<router-link to="/home">首页</router-link><span>&gt;</span> <router-link to="/">首页</router-link><span>&gt;</span>
<router-link to="/insights">AI商情</router-link><span>&gt;</span> <router-link to="/business">AI商情</router-link><span>&gt;</span>
<router-link to="/insights/legal/index">法律法规</router-link><span>&gt;</span> <router-link to="/business/legal">法律法规</router-link><span>&gt;</span>
<router-link to="/insights/legal/country">国别地区指南</router-link><span>&gt;</span> <router-link to="/business/legal/country">国别地区指南</router-link><span>&gt;</span>
<span>详情</span> <span>详情</span>
</div> </div>
<template v-if="detail"> <template v-if="detail">
@ -16,7 +16,7 @@
<p>{{detail.description }}</p> <p>{{detail.description }}</p>
</div> </div>
</div> </div>
<div class="detailContent"> <div class="detailContent" v-if="detail.content">
<dl class="menu"> <dl class="menu">
<dt>目录</dt> <dt>目录</dt>
<dd> <dd>
@ -36,6 +36,9 @@
</template> </template>
</div> </div>
</div> </div>
<div class="detailContent" v-else>
<div class="empty">暂无内容</div>
</div>
</template> </template>
<div class="loadingBox" v-else>...</div> <div class="loadingBox" v-else>...</div>
</div> </div>
@ -67,10 +70,11 @@ onMounted(() => {
const getDetail = () => { const getDetail = () => {
http(`/api/country/${id.value}`, {}, 'get').then(res => { http(`/api/country/${id.value}`, {}, 'get').then(res => {
detail.value = res.data; detail.value = res.data;
curMenu.value = res.data.content[0].title; let _content = Array.isArray(res.data.content) ? (res.data.content[0] || {}) : {};
curMenuData.value = res.data.content[0].list; curMenu.value = _content.title;
curSection.value = curMenuData.value[0].title; curMenuData.value = _content.list || [];
curSectionData.value = curMenuData.value[0].list; curSection.value = curMenuData.value[0]?.title;
curSectionData.value = curMenuData.value[0]?.list;
}).catch(err => { }).catch(err => {
showToast(err.message); showToast(err.message);
}); });
@ -155,6 +159,15 @@ const chooseSection = (item)=>{
.detailContent { .detailContent {
padding: 20px 0; padding: 20px 0;
.empty{
width: 100%;
height: 50vh;
display: flex;
justify-content: center;
align-items: center;
font-size: 30px;
color: #CCC;
}
.menu, .menu,
.section{ .section{