添加设备检查,域名跳转

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_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_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'
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);

View File

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

View File

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