新闻分页

This commit is contained in:
quantulr
2024-03-05 17:25:48 +08:00
parent 570c3f2112
commit 3afb373403
18 changed files with 2035 additions and 1886 deletions

View File

@ -5,3 +5,8 @@ export const listNews = (params) => request({
method: "GET", method: "GET",
params params
}); });
export const getNewsInfo = (id) => request({
url: `/app/news/${id}`,
method: "GET",
})

View File

@ -10,16 +10,25 @@
<li class="menu-item1"> <li class="menu-item1">
<div <div
class="menu-item-tit" class="menu-item-tit"
:class="pagePath == '/' ? 'active' : ''" :class="pagePath === '/' ? 'active' : ''"
@click="handlePath('/')" @click="handlePath('/')"
> >
{{ t("headerMenu.home") }} {{ t("headerMenu.home") }}
</div> </div>
</li> </li>
<li class="menu-item1">
<div
class="menu-item-tit"
:class="pagePath === '/news' ? 'active' : ''"
@click="handlePath('/news')"
>
{{ t("headerMenu.news") }}
</div>
</li>
<li class="menu-item1 solution"> <li class="menu-item1 solution">
<div <div
class="menu-item-tit" class="menu-item-tit"
:class="pagePath.indexOf('/solution/') != -1 ? 'active' : ''" :class="pagePath.indexOf('/solution/') !== -1 ? 'active' : ''"
> >
{{ t("headerMenu.resolution") }} {{ t("headerMenu.resolution") }}
</div> </div>
@ -28,7 +37,7 @@
v-for="item in categoryList" v-for="item in categoryList"
class="pointer" class="pointer"
:class=" :class="
pagePath == `/solution/${item.id}` ? 'x_blue _active' : '' pagePath === `/solution/${item.id}` ? 'x_blue _active' : ''
" "
@click=" @click="
handlePath( handlePath(
@ -79,7 +88,7 @@
<li class="menu-item1"> <li class="menu-item1">
<div <div
class="menu-item-tit" class="menu-item-tit"
:class="pagePath == '/innovate' ? 'active' : ''" :class="pagePath === '/innovate' ? 'active' : ''"
@click="handlePath('/innovate')" @click="handlePath('/innovate')"
> >
{{ t("headerMenu.innovation") }} {{ t("headerMenu.innovation") }}
@ -88,7 +97,7 @@
<li class="menu-item1"> <li class="menu-item1">
<div <div
class="menu-item-tit" class="menu-item-tit"
:class="pagePath == '/activity' ? 'active' : ''" :class="pagePath === '/activity' ? 'active' : ''"
@click="handlePath('/activity')" @click="handlePath('/activity')"
> >
{{ t("headerMenu.activity") }} {{ t("headerMenu.activity") }}
@ -97,7 +106,7 @@
<li class="menu-item1"> <li class="menu-item1">
<div <div
class="menu-item-tit" class="menu-item-tit"
:class="pagePath == '/about' ? 'active' : ''" :class="pagePath === '/about' ? 'active' : ''"
@click="handlePath('/about')" @click="handlePath('/about')"
> >
{{ t("headerMenu.aboutUs") }} {{ t("headerMenu.aboutUs") }}
@ -107,7 +116,7 @@
<div <div
v-if="!userStore.token" v-if="!userStore.token"
class="menu-item-tit" class="menu-item-tit"
:class="pagePath == '/login' ? 'active' : ''" :class="pagePath === '/login' ? 'active' : ''"
@click="handlePath('/login')" @click="handlePath('/login')"
> >
{{ t("headerMenu.loginRegister") }} {{ t("headerMenu.loginRegister") }}
@ -137,7 +146,7 @@
<div <div
v-if="userStore.token" v-if="userStore.token"
class="menu-item-tit" class="menu-item-tit"
:class="pagePath == '/login' ? 'active' : ''" :class="pagePath === '/login' ? 'active' : ''"
@click="handlePage" @click="handlePage"
> >
{{ t("headerMenu.personalCenter") }} {{ t("headerMenu.personalCenter") }}
@ -145,7 +154,7 @@
<div <div
v-if="userStore.token" v-if="userStore.token"
class="menu-item-tit" class="menu-item-tit"
:class="pagePath == '/login' ? 'active' : ''" :class="pagePath === '/login' ? 'active' : ''"
@click="logout" @click="logout"
> >
{{ t("headerMenu.logout") }} {{ t("headerMenu.logout") }}
@ -352,7 +361,7 @@ dt {
display: inline-block; display: inline-block;
padding: 25px 0; padding: 25px 0;
font-size: 16px; font-size: 16px;
font-family: Source Han Sans CN; font-family: Source Han Sans CN, sans-serif;
font-weight: 400; font-weight: 400;
color: #000; color: #000;
cursor: pointer; cursor: pointer;
@ -398,6 +407,7 @@ dt {
.webHead { .webHead {
.site-title { .site-title {
padding-top: 8px;
height: 80px; height: 80px;
display: flex; display: flex;
justify-content: start; justify-content: start;
@ -407,10 +417,10 @@ dt {
font-weight: bold; font-weight: bold;
.site-logo { .site-logo {
width: 30px; width: 90px;
height: 30px; height: 82px;
object-fit: cover; object-fit: contain;
margin-right: 4px; margin-right: 8px;
} }
} }

View File

@ -39,6 +39,7 @@ const messages = {
switchSystem: "切换系统", switchSystem: "切换系统",
layoutSettings: "布局设置", layoutSettings: "布局设置",
changeAvatar: "更换头像", changeAvatar: "更换头像",
news: "新闻政策"
}, },
footer: { footer: {
copyRight: "中科云 版权所有", copyRight: "中科云 版权所有",
@ -163,6 +164,7 @@ const messages = {
switchSystem: "Переключить систему", switchSystem: "Переключить систему",
layoutSettings: "Настройки макета", layoutSettings: "Настройки макета",
changeAvatar: "Сменить аватар", changeAvatar: "Сменить аватар",
news: "Пресс-политика"
}, },
footer: { footer: {
copyRight: "Чжункейун Авторское право", copyRight: "Чжункейун Авторское право",

View File

@ -23,7 +23,7 @@ const table = {
cooperationMemo: "Совместный протокол", cooperationMemo: "Совместный протокол",
customerConfirmSolution: "Подтверждение технического решения клиентом", customerConfirmSolution: "Подтверждение технического решения клиентом",
signServiceContract: "Подписание сервисного контракта (сумма контракта)", signServiceContract: "Подписание сервисного контракта (сумма контракта)",
endTopic: "Закрыть тему", endTopic: "Закрыть тему (Полученная сумма)",
notEndTopic: "Тема не закрыта", notEndTopic: "Тема не закрыта",
uploadFile: "Загрузить файл", uploadFile: "Загрузить файл",
uploadTime: "Время загрузки", uploadTime: "Время загрузки",

View File

@ -23,7 +23,7 @@ const table = {
cooperationMemo: "合作备忘录", cooperationMemo: "合作备忘录",
customerConfirmSolution: "客户确认技术解决方案", customerConfirmSolution: "客户确认技术解决方案",
signServiceContract: "签署服务合同(合同额)", signServiceContract: "签署服务合同(合同额)",
endTopic: "结题", endTopic: "结题(到款金额)",
notEndTopic: "未结题", notEndTopic: "未结题",
uploadFile: "上传文件", uploadFile: "上传文件",
uploadTime: "上传时间", uploadTime: "上传时间",

View File

@ -53,7 +53,7 @@
<script setup> <script setup>
import variables from "@/assets/styles/variables.module.scss"; import variables from "@/assets/styles/variables.module.scss";
import logo from "@/assets/logo/logo.png"; import logo from "@/assets/logo/logo.png";
import logoSmall from "@/assets/logo/logo_small.png"; import logoSmall from "@/assets/logo/咸海logo.png";
import useSettingsStore from "@/store/modules/settings"; import useSettingsStore from "@/store/modules/settings";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";

View File

@ -16,6 +16,7 @@ const whiteList = [
"/auth-redirect", "/auth-redirect",
"/bind", "/bind",
"/register", "/register",
"/news",
"/", "/",
"/solution/small", "/solution/small",
"/solution/large", "/solution/large",
@ -27,6 +28,7 @@ const whiteList = [
]; ];
const whiteListReg = [ const whiteListReg = [
/\/solution\/detail\/[0-9]+/, /\/solution\/detail\/[0-9]+/,
/\/news\/detail\/[0-9]+/,
/\/solution\/[0-9]+/, /\/solution\/[0-9]+/,
/\/innovate\/detail\/[0-9]+/, /\/innovate\/detail\/[0-9]+/,
/\/searchList\/[\S]+/, /\/searchList\/[\S]+/,

View File

@ -198,6 +198,16 @@ export const constantRoutes = [
name: "about", name: "about",
component: () => import("../views/website/about/about.vue"), component: () => import("../views/website/about/about.vue"),
}, },
{
path: "news",
name: 'news-list',
component: () => import("../views/website/home/index.vue"),
},
{
path: "news/detail/:id",
name: 'news',
component: () => import("@/views/website/news/detail.vue")
}
], ],
}, },

View File

@ -3,9 +3,10 @@ import Cookies from "js-cookie";
const useAppStore = defineStore("app", { const useAppStore = defineStore("app", {
state: () => ({ state: () => ({
sidebar: { sidebar: {
opened: Cookies.get("sidebarStatus") // opened: Cookies.get("sidebarStatus")
? !!+Cookies.get("sidebarStatus") // ? !!+Cookies.get("sidebarStatus")
: true, // : true,
opened: true,
withoutAnimation: false, withoutAnimation: false,
hide: false, hide: false,
}, },

View File

@ -161,7 +161,7 @@ if (route.query.id) {
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
v-if="index === 2 || index === 3" v-if="index === 2 || index === 3"
:label="t('admin.form.amount')" :label="`${t('admin.form.amount')}${t('admin.table.tenThousandYuan')}`"
> >
<el-input-number <el-input-number
v-model="updateStatusList[index].remark" v-model="updateStatusList[index].remark"

View File

@ -87,7 +87,7 @@
<el-row v-if="isAdd"> <el-row v-if="isAdd">
<el-col :span="24"> <el-col :span="24">
<el-form-item :label="t('admin.form.idCard')"> <el-form-item :label="t('admin.form.idCard')" prop="idImage">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item prop="idImage.0"> <el-form-item prop="idImage.0">
@ -206,7 +206,7 @@ const rules = reactive({
trigger: "blur", trigger: "blur",
}, },
], ],
mobile: [ phone: [
{ {
required: true, required: true,
message: computed(() => message: computed(() =>
@ -220,12 +220,20 @@ const rules = reactive({
// trigger: "blur", // trigger: "blur",
// }, // },
], ],
email: [
{
required: true,
message: computed(() =>
t("admin.form.placeholder", {type: t("admin.form.email")})
),
trigger: "blur",
},],
idCard: [ idCard: [
// { {
// required: true, required: true,
// message: computed(() => t("admin.form.placeholder")), message: computed(() => t("admin.form.placeholder")),
// trigger: "blur", trigger: "blur",
// }, },
], ],
wordAddress: [ wordAddress: [
{ {
@ -241,34 +249,41 @@ const rules = reactive({
trigger: "blur", trigger: "blur",
}, },
], ],
idImage: [
{
required: true,
trigger: "change",
message: computed(() => t("admin.validation.pleaseUpload")),
}
],
"idImage.0": [ "idImage.0": [
// {
// required: true,
// message: computed(() => t("admin.validation.pleaseUpload")),
// trigger: ["blur", "change"],
// },
],
"idImage.1": [
// {
// required: true,
// message: computed(() => t("admin.validation.pleaseUpload")),
// trigger: ["blur", "change"],
// },
],
"idImage.2": [
// {
// required: true,
// message: computed(() => t("admin.validation.pleaseUpload")),
// trigger: ["blur", "change"],
// },
],
certificatePics: [
{ {
required: true, required: true,
message: computed(() => t("admin.validation.pleaseUpload")), message: computed(() => t("admin.validation.pleaseUpload")),
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
], ],
"idImage.1": [
{
required: true,
message: computed(() => t("admin.validation.pleaseUpload")),
trigger: ["blur", "change"],
},
],
"idImage.2": [
{
required: true,
message: computed(() => t("admin.validation.pleaseUpload")),
trigger: ["blur", "change"],
},
],
certificatePics: [
// {
// required: true,
// message: computed(() => t("admin.validation.pleaseUpload")),
// trigger: ["blur", "change"],
// },
],
}); });
const validateForm = async () => { const validateForm = async () => {

View File

@ -9,13 +9,13 @@
{{ t("admin.form.basicInfo") }} {{ t("admin.form.basicInfo") }}
</div> </div>
<el-row> <!--FIXME: <el-row>-->
<el-col :span="24"> <!-- <el-col :span="24">-->
<el-form-item :label="t('admin.form.expertAvatar')"> <!-- <el-form-item :label="t('admin.form.expertAvatar')">-->
<ImageUpload v-model="modelValue.image" :limit="1" /> <!-- <ImageUpload v-model="modelValue.image" :limit="1" />-->
</el-form-item> <!-- </el-form-item>-->
</el-col> <!-- </el-col>-->
</el-row> <!-- </el-row>-->
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
@ -242,7 +242,7 @@ import FieldOptions from "@/views/components/FieldOptions";
import InputBoxAdd from "@/views/components/InputBoxAdd"; import InputBoxAdd from "@/views/components/InputBoxAdd";
import {countryOptions, educationOptions} from "@/utils/parameter"; import {countryOptions, educationOptions} from "@/utils/parameter";
import {useI18n} from "vue-i18n"; import {useI18n} from "vue-i18n";
import { computed, toRefs } from "vue"; import {computed, onActivated, reactive, ref, toRefs} from "vue";
const {t, locale} = useI18n(); const {t, locale} = useI18n();
@ -403,7 +403,8 @@ const cityFormRef = ref();
const fieldFormRef = ref(); const fieldFormRef = ref();
const keywordsFormRef = ref(); const keywordsFormRef = ref();
const researchsFormRef = ref(); const researchsFormRef = ref();
const setLaboratory = () => {}; const setLaboratory = () => {
};
const validateForm = async () => { const validateForm = async () => {
let formValid; let formValid;
try { try {

View File

@ -10,15 +10,16 @@
<el-form-item <el-form-item
:label="`${title}:`" :label="`${title}:`"
:prop="fieldKey" :prop="fieldKey"
:rules="[
>
<!-- :rules="[
{ {
required: true, required: true,
type: 'array', type: 'array',
message: t('admin.validation.pleaseInputAndAdd'), message: t('admin.validation.pleaseInputAndAdd'),
trigger: 'change', trigger: 'change',
}, },
]" ]"-->
>
<el-row type="flex" class="input-add-bar" justify="space-between"> <el-row type="flex" class="input-add-bar" justify="space-between">
<el-col :span="20"> <el-col :span="20">
<el-input v-model="dataVal" :placeholder="placeholder"></el-input> <el-input v-model="dataVal" :placeholder="placeholder"></el-input>

View File

@ -3,6 +3,8 @@ import { reactive, ref, toRefs } from "vue";
import {listNews} from "@/api/website/home/news"; import {listNews} from "@/api/website/home/news";
import Pagination from "@/components/Pagination/index.vue"; import Pagination from "@/components/Pagination/index.vue";
import {useI18n} from "vue-i18n"; import {useI18n} from "vue-i18n";
import dayjs from "dayjs";
const {t, locale} = useI18n(); const {t, locale} = useI18n();
const file_base_url = `${import.meta.env.VITE_APP_BASE_API}/file`; const file_base_url = `${import.meta.env.VITE_APP_BASE_API}/file`;
const total = ref(0); const total = ref(0);
@ -12,7 +14,7 @@ const data = reactive({
latestNews: {}, latestNews: {},
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 8, pageSize: 10,
classification: "0", classification: "0",
}, },
}); });
@ -58,14 +60,21 @@ getList();
</el-tabs> </el-tabs>
<ul class="news-list"> <ul class="news-list">
<li class="news-item" v-for="news in newsList" :key="news.id"> <li class="news-item" v-for="news in newsList" :key="news.id">
<a :href="`/news/detail/${news.id}`" target="_blank">
<span class="title">{{ <span class="title">{{
locale === "zh" ? news.title : locale === "ru" ? news.titleRu : null locale === "zh" ? news.title : locale === "ru" ? news.titleRu : null
}}</span> }}</span>
<span class="time"> <span class="time">
{{ news.create_time }} {{ dayjs(news.createTime).format("YYYY-MM-DD") }}
</span> </span>
</a>
</li> </li>
</ul> </ul>
<pagination v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"/>
</div> </div>
<!-- <div class="news-list"> <!-- <div class="news-list">
@ -90,20 +99,26 @@ getList();
.news-container { .news-container {
padding: 20px; padding: 20px;
display: flex; display: flex;
.left { .left {
flex: 4; width: calc(50vw - 20px);
height: 100%; height: calc(100vh - 200px);
// display: flex; display: flex;
// flex-direction: column; flex-direction: column;
// justify-content: center;
.cover-image { .cover-image {
height: calc(100vh - 200px - 24px - 12px);
//flex: 1;
width: 100%; width: 100%;
aspect-ratio: 4/3; //aspect-ratio: 4/3;
object-fit: cover; object-fit: cover;
} }
.title { .title {
height: 24px;
text-align: center; text-align: center;
font-size: 20px; font-size: 20px;
width: 100%;
font-weight: bold; font-weight: bold;
margin-top: 12px; margin-top: 12px;
margin-bottom: 0; margin-bottom: 0;
@ -112,23 +127,34 @@ getList();
white-space: nowrap; white-space: nowrap;
} }
} }
.right { .right {
flex: 4; width: calc(50vw - 20px);
margin-left: 12px; margin-left: 12px;
height: 100%; height: 100%;
padding: 12px; padding: 12px;
.news-list { .news-list {
.news-item { .news-item {
list-style: disc; & > a {
height: 40px; height: 40px;
display: flex; display: flex;
align-items: center; align-items: center;
cursor: pointer; justify-content: space-between;
.title { .title {
flex: 1;
width: 100px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.time {
color: gray;
font-size: 14px;
}
}
} }
} }
} }

View File

@ -52,12 +52,14 @@
</template> </template>
<script setup> <script setup>
import { computed, onMounted, reactive, ref, shallowRef } from "vue"; import {computed, onActivated, onMounted, reactive, ref, shallowRef} from "vue";
import index0 from "./comp/index0.vue"; import index0 from "./comp/index0.vue";
import index1 from "./comp/index1.vue"; import index1 from "./comp/index1.vue";
import index8 from "./comp/index8.vue"; import index8 from "./comp/index8.vue";
import index9 from "@/views/website/home/comp/index9.vue"; import index9 from "@/views/website/home/comp/index9.vue";
import {useRoute} from "vue-router";
const route = useRoute()
const loading = ref(true); const loading = ref(true);
setTimeout(() => { setTimeout(() => {
loading.value = false; loading.value = false;
@ -193,14 +195,14 @@ const handleIndicatorClick = (idx) => {
console.log(idx); console.log(idx);
let boxIndex; let boxIndex;
let _mapIndex; let _mapIndex;
if (idx === 1) { if (idx <= 2) {
boxIndex = 1; boxIndex = idx;
_mapIndex = null; _mapIndex = null;
} else if (idx <= 5) { } else if (idx <= 6) {
boxIndex = 2;
_mapIndex = idx - 2;
} else {
boxIndex = 3; boxIndex = 3;
_mapIndex = idx - 3;
} else {
boxIndex = 4;
_mapIndex = null; _mapIndex = null;
} }
@ -219,6 +221,13 @@ const handleIndicatorClick = (idx) => {
mapIndex.value = _mapIndex; mapIndex.value = _mapIndex;
} }
}; };
onMounted(() => {
// console.log(route.name)
if (route.name === "news-list") {
handleIndicatorClick(2)
}
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -276,7 +276,7 @@ getCookie();
.content { .content {
// padding: 0 250px; // padding: 0 250px;
// padding: 0 30px; // padding: 0 30px;
width: 1400px; width: 100%;
margin: 0 auto; margin: 0 auto;
flex: 1; flex: 1;
background: #b1ccff; background: #b1ccff;
@ -285,8 +285,10 @@ getCookie();
justify-content: space-between; justify-content: space-between;
.loginImg { .loginImg {
width: 705px; width: calc(100vw - 516px);
height: 458px; //width: 705px;
//height: 458px;
aspect-ratio: 705/458;
} }
} }

View File

@ -0,0 +1,65 @@
<script setup>
import {getNewsInfo} from "@/api/website/home/news";
import {useRoute} from "vue-router";
import {reactive, toRefs} from "vue";
import {useI18n} from "vue-i18n";
import WebFooter from "@/components/webFooter/index.vue";
const {t, locale} = useI18n();
const file_base_url = `${import.meta.env.VITE_APP_BASE_API}/file`;
const data = reactive({
news: {}
})
const {news} = toRefs(data)
const route = useRoute()
const getNews = () => {
const id = route.params.id
getNewsInfo(id).then((resp) => {
news.value = resp.data
})
}
getNews()
</script>
<template>
<div class="container">
<div class="news-body">
<img class="cover-image" :src="`${file_base_url}${news.cover}`"/>
<h1 class="title">{{locale === "zh" ? news.title : locale === "ru" ? news.titleRu : null }}</h1>
<p class="content">{{ locale === "zh" ? news.content : locale === "ru" ? news.contentRu : null}}</p>
</div>
<web-footer></web-footer>
</div>
</template>
<style scoped lang="scss">
.container {
background-color: #f2f6ff;
.news-body {
background-color: #ffffff;
width: 1000px;
margin: 0 auto;
.cover-image {
width: 100%;
aspect-ratio: 6/2;
object-fit: cover;
}
h1.title {
text-align: center;
font-weight: bold;
font-size: 28px;
}
p.content {
font-size: 16px;
line-height: 24px;
margin: 0;
padding: 24px;
}
}
}
</style>

View File

@ -32,8 +32,8 @@ export default defineConfig(({mode, command}) => {
// https://cn.vitejs.dev/config/#server-proxy // https://cn.vitejs.dev/config/#server-proxy
"/dev-api": { "/dev-api": {
// target: "http://101.34.131.16:1618", // target: "http://101.34.131.16:1618",
target: "http://129.211.170.150/api", // target: "http://129.211.170.150/api",
// target: "http://192.168.0.200:1619", target: "http://192.168.0.200:1619",
// target: 'http://172.18.3.127:1618', // target: 'http://172.18.3.127:1618',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, ""), rewrite: (p) => p.replace(/^\/dev-api/, ""),