Compare commits

..

9 Commits

Author SHA1 Message Date
017f5255ef 修改设备图片 2025-10-16 18:16:23 +08:00
5e74fa2196 gitigonre 2025-10-16 17:44:21 +08:00
e912175871 删除多余视频文件 2025-10-16 17:42:32 +08:00
281d0015aa gitignore 2025-10-16 17:39:38 +08:00
bdca181855 修改配置文件 2025-10-16 17:38:45 +08:00
168748eb18 Merge branch 'main' of https://git.rangutech.com/yiqiuyang/portal 2025-10-16 17:36:31 +08:00
3f5f76946d news 2025-10-16 17:36:27 +08:00
b9719c22cd 修改富文本 2025-10-16 17:35:59 +08:00
a5d1de0e23 修改管理页面 2025-10-16 16:50:46 +08:00
17 changed files with 183 additions and 163 deletions

2
.gitignore vendored
View File

@ -2,6 +2,7 @@
node_modules
/dist
/situation
/protal_dist
# local env files
.env.local
@ -21,3 +22,4 @@ package-lock.json
*.njsproj
*.sln
*.sw?
*.zip

View File

@ -1,9 +1,3 @@
window.GD_KEYS = [
'348d477ba83826e46b32d3ff10fffe82',
'ed2ea36f8564541569c370254845d93d',
'c1da03827f956a215311c0f5229bddc3',
]
window.config = {
baseUrl: 'http://192.168.3.10:9121/',
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 KiB

After

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 KiB

After

Width:  |  Height:  |  Size: 884 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -26,3 +26,21 @@ export function getNewsDetail(params) {
params,
})
}
// 保存新闻
export function updateNews(data) {
return request({
url: '/news/B8fpNxunbxj37x3VRcVz',
method: 'post',
data,
})
}
// 获取新闻列表
export function saveDetail(data) {
return request({
url: '/news/VbxWW8EdJQGyWzJyvSrN',
method: 'post',
data,
})
}

View File

@ -31,6 +31,7 @@ let autoPlayTimer = null
const itemWidth = computed(() => $fontSize(props.sourceWidth))
const itemHeight = computed(() => $fontSize(props.sourceHeight))
const itemGap = computed(() => $fontSize(props.sourceGap))
const itemTotalWidth = computed(() => itemWidth.value + itemGap.value)
const viewPortWidth = computed(() => props.pageSize * itemWidth.value + (props.pageSize - 1) * itemGap.value + 'px')
const trackWidth = computed(() => props.data.length * itemTotalWidth.value - itemGap.value + 'px')

View File

@ -11,16 +11,12 @@ function setRem() {
// 当前页面宽度相对于设计稿宽度的缩放比例
const scale = document.documentElement.clientWidth / designWidth
// 设置页面根节点字体大小最高放大比例为maxScale
document.documentElement.style.fontSize =
baseSize * Math.min(scale, maxScale) + 'px'
document.documentElement.style.fontSize = baseSize * Math.min(scale, maxScale) + 'px'
}
// 根据设计稿尺寸计算实际尺寸
export function fontSize(res) {
const clientWidth =
window.innerWidth ||
document.documentElement.clientWidth ||
document.body.clientWidth
const clientWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
if (!clientWidth) return res
const scale = clientWidth / designWidth
return res * Math.min(scale, maxScale)

View File

@ -29,37 +29,19 @@ const imgList = [
id: 2,
width: 210,
height: 300,
list: [
'main/5.png',
'main/6.png',
'main/7.png',
'main/8.png',
'main/9.png',
],
list: ['main/5.png', 'main/6.png', 'main/7.png', 'main/8.png', 'main/9.png'],
},
{
id: 3,
width: 210,
height: 300,
list: [
'main/10.png',
'main/11.png',
'main/12.png',
'main/13.png',
'main/14.png',
],
list: ['main/10.png', 'main/11.png', 'main/12.png', 'main/13.png', 'main/14.png'],
},
{
id: 4,
width: 210,
height: 300,
list: [
'main/15.png',
'main/16.png',
'main/17.png',
'main/18.png',
'main/19.png',
],
list: ['main/15.png', 'main/16.png', 'main/17.png', 'main/18.png', 'main/19.png'],
},
{
id: 5,
@ -135,9 +117,13 @@ onMounted(() => {})
.my-card {
width: 100%;
height: 100%;
img {
width: 40%;
height: auto;
}
.label {
text-align: left;
width: 532px;
width: 40%;
padding-right: 25px;
font-family: 'PingFang SC';
font-weight: 400;

View File

@ -1,6 +1,12 @@
<script setup>
import {ref, onMounted} from 'vue'
window.GD_KEYS = [
'348d477ba83826e46b32d3ff10fffe82',
'ed2ea36f8564541569c370254845d93d',
'c1da03827f956a215311c0f5229bddc3',
]
const map = ref(null)
const center = [118.762616, 32.068811]

View File

@ -3,8 +3,9 @@ import axios from 'axios';
import { ref, reactive, onMounted } from 'vue';
import { QuillEditor } from '@vueup/vue-quill'
import '@vueup/vue-quill/dist/vue-quill.snow.css'
import {getNews,getNewsDetail,updateNews,saveDetail} from '@/api/index'
const API_BASE = window.config?.baseUrl
const baseURL = window.config?.baseUrl
// 新闻列表
const newsList = ref([]);
@ -45,14 +46,20 @@ const editorOption= {
modules:{
toolbar: {
container: [
['bold', 'italic', 'underline', 'strike'],
[{ header: 1 }, { header: 2 }],
[{ list: 'ordered' }, { list: 'bullet' }],
[{ indent: '-1' }, { indent: '+1' }],
[{ color: [] }, { background: [] }],
[{ align: [] }],
['link', 'image'],
['clean'],
['bold', 'italic', 'underline', 'strike'], //加粗,斜体,下划线,删除线
['blockquote', 'code-block'], //引用,代码块
[{'header': 1}, {'header': 2}], // 标题键值对的形式1、2表示字体大小
[{'list': 'ordered'}, {'list': 'bullet'}], //列表
[{'script': 'sub'}, {'script': 'super'}], // 上下标
[{'indent': '-1'}, {'indent': '+1'}], // 缩进
[{'direction': 'rtl'}], // 文本方向
[{'size': ['small', false, 'large', 'huge']}], // 字体大小
[{'header': [1, 2, 3, 4, 5, 6, false]}], //几级标题
[{'color': []}, {'background': []}], // 字体颜色,字体背景颜色
[{'font': []}], //字体
[{'align': []}], //对齐方式
['clean'], //清除字体样式
['image', 'video'] //上传图片、上传视频
],
handlers: {
image: imageHandler,
@ -127,16 +134,15 @@ function imageHandler() {
// ----------------- 获取新闻 -----------------
const fetchNews = async () => {
try {
const res = await axios.get(`${API_BASE}/news/`, {
params: {
let query = {
status: statusFilter.value || undefined,
page: page.value,
page_size: pageSize.value,
status: statusFilter.value || undefined,
},
});
if (res.data.code === 0) {
newsList.value = res.data.data;
totalPages.value = res.data.pagination.total_pages;
}
let {code, data, pagination} = await getNews(query)
if (code === 0) {
newsList.value = data;
totalPages.value = pagination.total_pages;
}
} catch (err) {
console.error("获取新闻失败", err);
@ -146,10 +152,11 @@ const fetchNews = async () => {
// ----------------- 添加/编辑 -----------------
const saveNews = async () => {
try {
editingNews.content = quillInstance.value.root.innerHTML
if (isEditing.value) {
await axios.post(`${API_BASE}/news/B8fpNxunbxj37x3VRcVz`, editingNews);
await updateNews(editingNews);
} else {
await axios.post(`${API_BASE}/news/VbxWW8EdJQGyWzJyvSrN`, editingNews);
await saveDetail(editingNews);
}
showForm.value = false;
fetchNews();
@ -161,16 +168,15 @@ const saveNews = async () => {
const editNews = async (news) => {
loading.value = true;
try {
const res = await axios.get(`${API_BASE}/news/details`, {
params: { slug: news.slug }
});
console.log(res.data)
if (res.data.code === 0) {
console.log(res.data.data)
Object.assign(editingNews, res.data.data);
let query = {
slug: news.slug,
}
let {code, data} = await getNewsDetail(query)
if (code === 0) {
Object.assign(editingNews, data);
isEditing.value = true;
showForm.value = true;
quillInstance.value.clipboard.dangerouslyPasteHTML(editingNews.content)
}
} finally {
loading.value = false;
@ -185,6 +191,7 @@ const addNews = () => {
content: "",
status: "draft",
slug: "",
datetime: null,
});
isEditing.value = false;
showForm.value = true;
@ -222,7 +229,7 @@ function uploadImage(file) {
const formData = new FormData();
formData.append('file', file);
fetch(`${API_BASE}/update/img`, {
fetch(`${baseURL}update/img`, {
method: 'POST',
body: formData,
})
@ -230,7 +237,7 @@ function uploadImage(file) {
.then((data) => {
if (data.code === 0) {
console.log(data)
resolve(`${API_BASE}/download/img/${data.data}`);
resolve(`${baseURL}download/img/${data.data}`);
} else {
reject(data.msg);
}
@ -243,6 +250,7 @@ function uploadImage(file) {
onMounted(() => {
fetchNews();
addNews();
});
</script>
@ -303,7 +311,7 @@ onMounted(() => {
</div>
<label>内容简介: <textarea class="snapshot" v-model="editingNews.snapshot"></textarea></label><br />
<label>内容:</label>
<quill-editor v-model:content="editingNews.content" content-type="delta"
<quill-editor content-type="html"
theme="snow" style="height: 300px" :options="editorOption" @ready="onEditorReady"/>
<label>状态:
<select v-model="editingNews.status">

View File

@ -8,21 +8,29 @@ import {ElMessage} from 'element-plus'
const route = useRoute()
const detail = route.query
const showLoad = ref(true)
const newsTitle = ref('')
const newsTime = ref('')
const newsSubTitle = ref('')
const newsCoverImg = ref('')
const newsContent = ref('')
const newsContent = ref(null)
const router = useRouter()
onMounted(() => {
getDetail()
})
const getDetail = () => {
showLoad.value = true
let query = {
slug: detail.slug,
}
getNewsDetail(query)
.then((res) => {
if (res.code === 0) {
let {content, cover_image, snapshot, title} = res.data
let {content, cover_image, snapshot, datetime, title} = res.data
newsTitle.value = title
newsTime.value = datetime
newsSubTitle.value = snapshot
newsCoverImg.value = cover_image
newsContent.value = content
@ -37,11 +45,6 @@ const getDetail = () => {
})
}
const router = useRouter()
onMounted(() => {
getDetail()
})
const toBack = () => {
router.back()
}
@ -53,56 +56,44 @@ const toBack = () => {
<h3 class="label">
{{ newsTitle }}
</h3>
<h3 class="time" v-if="newsSubTitle">
{{ newsSubTitle }}
<h3 class="time" v-if="newsTime">
{{ newsTime }}
</h3>
<div class="img" v-if="newsCoverImg">
<img :src="newsCoverImg" alt="" />
</div>
<div class="artical" v-if="newsContent">
{{ newsContent }}
<div class="artical">
<div v-html="newsContent"></div>
</div>
</div>
<div v-else>暂无内容</div>
<div v-else class="no-content">暂无内容</div>
<div class="back" @click="toBack">返回</div>
</div>
</template>
<style lang="scss" scoped>
.label {
.page {
.label {
text-align: center;
margin: 64px 0 20px 0;
font-family: 'PingFang SC';
font-weight: 500;
font-size: 28px;
color: $black;
}
.time {
}
.time {
text-align: center;
font-family: 'PingFang SC';
font-weight: 500;
font-size: 18px;
margin-bottom: 40px;
}
.img {
width: 1200px;
height: auto;
margin-bottom: 40px;
img {
width: 100%;
height: 100%;
font-size: 20px;
margin-bottom: 20px;
}
}
.artical {
.artical {
width: 1200px;
font-family: 'PingFang SC';
font-weight: 400;
font-size: 18px;
color: $black;
text-indent: 2em;
white-space: pre-wrap; /* 保留换行符,同时允许自动折行 */
word-break: break-word; /* 长单词截断 */
margin-bottom: 300px;
}
.back {
}
.no-content {
margin-top: 40px;
font-size: 32px;
}
.back {
margin-top: 40px;
padding: 10px 40px;
background: #0389ff;
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25);
@ -111,5 +102,6 @@ const toBack = () => {
font-size: 20px;
color: $white;
cursor: pointer;
}
}
</style>

View File

@ -1,16 +1,23 @@
<script setup>
defineOptions({name: 'New'})
import {ref, onMounted, nextTick, onActivated, onDeactivated} from 'vue'
import {ref, onMounted, nextTick, onActivated, onDeactivated, computed} from 'vue'
import Banner from '@/components/Banner/index.vue'
import Swiper from '@/components/Swiper/index.vue'
import {useRouter} from 'vue-router'
import {onBeforeRouteLeave} from 'vue-router'
import {getNews} from '@/api/index'
import {fontSize} from '@/utils'
const currentPage = ref(1)
const showLoad = ref(true)
const containerWidth = ref(1700)
const containerHeight = ref(1400)
const containerWidth = ref(fontSize(1700))
const containerHeight = computed(() => {
if (newList.value.length > 0) {
return 350 * newList.value.length
} else {
return 200
}
})
onMounted(() => {
getNewList()
@ -34,14 +41,20 @@ async function getNewList() {
page: page.value.pageNum,
page_size: page.value.pageSize,
}
let {code, data, pagination} = await getNews(query)
if (code === 0) {
newList.value = data
page.value.totalPages = pagination.total_pages
getNews(query)
.then((res) => {
if (res.code === 0) {
newList.value = res.data
page.value.totalPages = res.pagination.total_pages
showLoad.value = false
} else {
showLoad.value = false
}
})
.catch(() => {
showLoad.value = false
})
}
const toDetail = (item) => {
@ -68,12 +81,8 @@ onDeactivated(() => {
onBeforeRouteLeave((to) => {
if (to.name === 'Detail') return
// 去别的顶级菜单 → 销毁
const parent = to.matched[0]
if (parent?.name !== 'News') {
// 通过修改路由 meta 让 keep-alive 排除当前组件
// 需要把 keep-alive 写成 :include="cachedNames" 并在 pinia 里维护数组
}
})
</script>
@ -93,6 +102,7 @@ onBeforeRouteLeave((to) => {
>
<template #default="{item, index, isActive}">
<div class="my-card">
<template v-if="newList.length > 0">
<div
class="news flex j-s"
:class="{active: isActive}"
@ -111,6 +121,8 @@ onBeforeRouteLeave((to) => {
<div class="text">{{ item.snapshot }}</div>
</div>
</div>
</template>
<div v-else class="no-content">暂无内容</div>
</div>
</template>
</Swiper>
@ -177,5 +189,10 @@ onBeforeRouteLeave((to) => {
color: #999999;
}
}
.no-content {
margin-top: 40px;
font-size: 24px;
}
}
</style>

View File

@ -46,7 +46,7 @@ const toBack = () => {
<!-- 软件 -->
<template v-else>
<div class="content software flex j-s">
<div class="content software flex">
<video autoplay muted loop @loadeddata="onVideoLoaded" v-show="!videoLoaded">
<source :src="`./static/video/${query.video}`" type="video/mp4" />
</video>
@ -68,6 +68,8 @@ const toBack = () => {
<style lang="scss" scoped>
:deep(.hardware) {
font-size: 20px;
line-height: 1.8;
margin-bottom: 40px;
}
@ -107,6 +109,7 @@ const toBack = () => {
.software {
width: 1700px;
align-items: flex-start;
video {
width: 65%;
height: auto;
@ -152,7 +155,6 @@ const toBack = () => {
.descripition {
width: 1000px;
font-size: 22px;
}
.back {

View File

@ -5,7 +5,7 @@ onMounted(() => {})
// 资质证书
const certificateWidth = ref(1300)
const certificateHeight = ref(500)
const certificateHeight = ref(700)
const currentPage = ref(1)
@ -20,7 +20,7 @@ const imgList = [
{
id: 2,
list: [
{id: 2.1, width: 290, height: 188, label: '大型活动保障', img: 'product/2.png'},
{id: 2.1, width: 290, height: 188, label: '要地防控', img: 'product/2.png'},
{id: 2.2, width: 210, height: 280, label: '区域低空监管组网', img: 'product/6.png'},
],
},
@ -28,7 +28,7 @@ const imgList = [
id: 3,
list: [
{id: 3.1, width: 290, height: 188, label: '关键基础设施守护', img: 'product/3.png'},
{id: 3.2, width: 210, height: 280, label: '要地防控', img: 'product/7.png'},
{id: 3.2, width: 210, height: 280, label: '大型活动保障', img: 'product/7.png'},
],
},
{
@ -54,8 +54,8 @@ const imgList = [
:showHover="false"
>
<template #default="{item, index, isActive}">
<div class="certificate flex j-s a-c" :class="{active: isActive}">
<div v-for="(list, listIdx) in imgList" :index="list.id" class="flex j-c a-c wrap">
<div class="certificate flex j-s" :class="{active: isActive}">
<div v-for="list in imgList" :index="list.id" class="flex j-c wrap">
<div v-for="(img, imgIndex) in list.list" :key="imgIndex">
<div class="label">{{ img.label }}</div>
<img
@ -77,9 +77,7 @@ const imgList = [
<style lang="scss" scoped>
#certificate {
// margin-top: 60px;
.certificate {
margin-top: 40px;
width: 100%;
height: 100%;
.label {