添加设备检查,域名跳转

master
fuxiaochun 2023-08-15 23:06:54 +08:00
parent 9cbd8f2221
commit 86cdda0712
5 changed files with 34 additions and 17 deletions

View File

@ -2,4 +2,8 @@ VITE_PUBLIC_PATH = /
VITE_API_BASE_URL = 'http://test-admin.haituaigc.com' VITE_API_BASE_URL = 'http://test-admin.haituaigc.com'
VITE_API_CHAT_URL = 'http://openai-test.haituaigc.com' VITE_API_CHAT_URL = 'http://openai-test.haituaigc.com'
VITE_PC_HOST = 'http://test.haituaigc.com'
VITE_M_HOST = 'http://test-m.haituaigc.com'

View File

@ -2,4 +2,8 @@ VITE_PUBLIC_PATH = /
VITE_API_BASE_URL = 'http://test-admin.haituaigc.com' VITE_API_BASE_URL = 'http://test-admin.haituaigc.com'
VITE_API_CHAT_URL = 'http://openai-test.haituaigc.com' VITE_API_CHAT_URL = 'http://openai-test.haituaigc.com'
VITE_PC_HOST = 'http://test.haituaigc.com'
VITE_M_HOST = 'http://test-m.haituaigc.com'

View File

@ -15,6 +15,15 @@ import 'vant/es/toast/style';
import 'amfe-flexible' import 'amfe-flexible'
function platCheck() {
const userAgent = navigator.userAgent.toLowerCase();
const mobileKeywords = ['iphone', 'ipod', 'android', 'silk', 'blackberry', 'bb10', 'phone', 'mobile', 'kindle', 'opera mini', 'mobile safari', 'windows phone'];
const isMobileDevice = mobileKeywords.some(keyword => userAgent.includes(keyword));
if (!isMobileDevice) {
window.location.href = import.meta.env.VITE_PC_HOST;
}
}
platCheck();
const app = createApp(App); const app = createApp(App);

View File

@ -58,7 +58,7 @@ onMounted(()=>{
const getList = ()=>{ const getList = ()=>{
placeholder.value = '数据加载中...'; placeholder.value = '数据加载中...';
let params = { let params = {
category_id: props.cid, category_id: props.cid ? props.cid : undefined,
type: props.type, type: props.type,
per_page: pageSize.value, per_page: pageSize.value,
page: pageNum.value page: pageNum.value

View File

@ -73,7 +73,7 @@ const getRecommendList = () => {
let params = { let params = {
recommend: 1, recommend: 1,
type: 'policy', type: 'policy',
per_page: 6, per_page: 4,
page: 1 page: 1
}; };
http('/api/article', params, 'get').then(res => { http('/api/article', params, 'get').then(res => {
@ -162,50 +162,50 @@ const goDetail = (id) => {
.recommend{ .recommend{
padding: 30px 0; padding: 30px 0;
.blockTitle{ .blockTitle{
height: 46px; height: 80px;
line-height: 45px; line-height: 80px;
border-bottom: 1px solid #666; border-bottom: 1px solid #666;
font-size: 18px; font-size: 39px;
font-weight: bold; font-weight: bold;
} }
ul{ ul{
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
li{ li{
width: 50%; width: 100%;
padding-right: 30px; padding-right: 30px;
display: flex; display: flex;
margin-top: 30px; margin-top: 30px;
.img{ .img{
width: 120px; width: 260px;
height: 168px; height: 360px;
overflow: hidden; overflow: hidden;
img{ img{
width: 120px; width: 260px;
height: 168px; height: 360px;
} }
} }
.info{ .info{
flex: 1; flex: 1;
margin-left: 15px; margin-left: 15px;
height: 168px; height: 360px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
h3{ h3{
font-size: 14px; font-size: 32px;
font-weight: bold; font-weight: bold;
padding-bottom: 10px; padding-bottom: 10px;
} }
p{ p{
padding: 10px 0; padding: 10px 0;
font-size: 12px; font-size: 26px;
line-height: 22px; line-height: 30px;
flex: 1; flex: 1;
} }
span{ span{
color: #999; color: #999;
font-size: 12px; font-size: 22px;
} }
} }
} }