Browse Source

add new

master
sunfree 7 months ago
parent
commit
8705e7fd1f
  1. 2
      index.html
  2. 6
      src/components/blogs/header/CarouselImg.vue
  3. 3
      src/stores/index.ts
  4. 2
      src/tools/request.ts
  5. 10
      src/types/custom.d.ts
  6. 15
      src/views/admin/ClassticManageView.vue
  7. 19
      src/views/admin/CommonLinkManageView.vue
  8. 2
      src/views/admin/blogmanage/BlogLabelView.vue
  9. 10
      src/views/admin/diarymanage/DiaryManageView.vue
  10. 3
      src/views/admin/diarymanage/DiaryTypeView.vue
  11. 14
      src/views/blog/AboutMe.vue
  12. 61
      src/views/blog/AmountChartView.vue
  13. 1
      src/views/blog/ContentDetail.vue
  14. 18
      src/views/blog/blogcontent/BlogListView.vue

2
index.html

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
<title>SunFree</title>
</head>
<body>
<div id="app"></div>

6
src/components/blogs/header/CarouselImg.vue

@ -12,9 +12,9 @@ import { toRefs } from 'vue';
const { idShow } = homePageStore()
const { show_carousel } = toRefs(idShow)
const imgdatas: string[] = [
"/src/assets/images/nav01.jpg",
"/src/assets/images/nav02.jpg",
"/src/assets/images/nav03.jpg"
"http://www.wuruilin.cn/personself/nav01.jpg",
"http://www.wuruilin.cn/personself/nav02.jpg",
"http://www.wuruilin.cn/personself/nav03.jpg"
]
</script>

3
src/stores/index.ts

@ -20,6 +20,7 @@ export const homePageStore = defineStore("homePage", () => {
get(`/statistics/searchtitle?title=${query}`).then(res => {
homepagelist.value = res.data.data.map((items:any)=>({
...items,
imglink: items.imglink || 'http://www.wuruilin.cn/personself/暂无图片.jpg',
create_at:dayjs(items.create_at).format('YYYY-MM-DD HH:mm:ss'),
update_at: dayjs(items.update_at).format('YYYY-MM-DD HH:mm:ss'),
}));
@ -107,7 +108,7 @@ export const classticStore = defineStore("classtic", () => {
const delControl = reactive({
open: false,
ids: ""
ids: "",
})
const editControl = reactive({

2
src/tools/request.ts

@ -3,7 +3,7 @@ import { type AxiosRequestConfig } from 'axios';
import router from '@/router';
const instance = axios.create({
// 添加url
baseURL: 'http://localhost:8000/',
baseURL: 'http://www.wuruilin.cn:8000/',
timeout: 5000,
});

10
src/types/custom.d.ts

@ -2,4 +2,14 @@
// declare module 'echarts';
// declare module 'ant-design-vue/es/menu'
// declare module 'animejs/lib/anime.es.js'
declare module '@kangc/v-md-editor/lib/plugins/tip/index'
declare module '@kangc/v-md-editor/lib/plugins/line-number/index'
declare module '@kangc/v-md-editor/lib/plugins/align'
declare module '@kangc/v-md-editor/lib/plugins/copy-code/index'
declare module '@kangc/v-md-editor/lib/plugins/todo-list/index'
declare module 'codemirror'
declare module '@kangc/v-md-editor/lib/theme/github.js'
declare module '@kangc/v-md-editor/lib/codemirror-editor'
declare module '@kangc/v-md-editor/lib/plugins/emoji/index'
declare module '@kangc/v-md-editor/lib/preview'
declare module 'APlayer'

15
src/views/admin/ClassticManageView.vue

@ -10,7 +10,7 @@
</a-space>
</div>
<div class="modal">
<a-modal v-model:open="addControl.open" :title="addControl.title" cancelText="取消" okText="确定" @ok="add">
<a-modal v-model:open="addControl.open" :title="addControl.title" cancelText="取消" okText="确定" @ok="add" @cancel="unControl(addControl.title)">
<a-form ref="formRef" :model="addList" name="basic" :label-col="{ span: 4, offset: 2 }"
:wrapper-col="{ span: 16 }">
<a-form-item label="语录标题" name="header" :rules="[{ required: true, message: '请输入语录标题!' }]">
@ -24,10 +24,10 @@
</a-form-item>
</a-form>
</a-modal>
<a-modal v-model:open="delControl.open" title="提示" ok-text="确认" cancel-text="取消" @ok="del">
<a-modal v-model:open="delControl.open" title="提示" ok-text="确认" cancel-text="取消" @ok="del" @cancel="unControl('删除')">
<p>确认删除吗</p>
</a-modal>
<a-modal v-model:open="editControl.open" :title="editControl.title" cancelText="取消" okText="确定" @ok="edit">
<a-modal v-model:open="editControl.open" :title="editControl.title" cancelText="取消" okText="确定" @ok="edit" @cancel="unControl(editControl.title)">
<a-form ref="formRef" :model="editList" name="basic" :label-col="{ span: 4, offset: 2 }"
:wrapper-col="{ span: 16 }">
<a-form-item label="语录标题" name="header" :rules="[{ required: true, message: '请修改语录标题!' }]">
@ -60,7 +60,8 @@
<script setup lang='ts'>
import { onMounted, reactive, ref } from 'vue';
import { classticStore } from "@/stores/index"
import type { classticInterface } from "@/api/admin/index"
import type { classticInterface } from "@/api/admin"
import { message } from 'ant-design-vue';
import { get, post, remove, put } from '@/tools/request';
const { delControl, addControl, editControl } = classticStore()
const classticlist = ref<classticInterface[]>([])
@ -79,6 +80,9 @@ const editList = ref({
text: "",
descr: ""
})
const unControl = (text: string) => {
message.warn(`取消${text}`)
}
const classticList = async () => {
try {
await get("/classtics/list").then(response => {
@ -134,6 +138,7 @@ const add = async () => {
addList.value
)
addControl.open = false
message.success("新增成功")
classticList()
formRef.value.resetFields();
} catch (error) {
@ -152,6 +157,7 @@ const del = async (id: any) => {
await remove(
`/classtics/delete/${id}`
)
message.success("删除成功")
classticList()
} else {
console.log("id do not exist!")
@ -183,6 +189,7 @@ const edit = async (id: any) => {
)
editControl.open = false
formRef.value.resetFields()
message.success("编辑成功")
classticList()
} else {
console.log("id do not exist!")

19
src/views/admin/CommonLinkManageView.vue

@ -7,7 +7,7 @@
<a-space style="margin-left: 16px;">
<a-button @click="search">查询</a-button>
<a-button type="primary" ghost @click="addModal">新增</a-button>
<a-modal v-model:open="addControl.open" :title="addControl.title" cancelText="取消" okText="确定" @ok="add">
<a-modal v-model:open="addControl.open" :title="addControl.title" cancelText="取消" okText="确定" @ok="add" @cancel="unControl(addControl.title)">
<a-form ref="formRef" :model="addList" name="basic" :label-col="{ span: 4, offset: 2 }"
:wrapper-col="{ span: 16 }">
<a-form-item label="链接名称" name="linktext" :rules="[{ required: true, message: '请输入链接名称!' }]">
@ -16,7 +16,7 @@
<a-form-item label="链接地址" name="linkurl" :rules="[{ required: true, message: '请输入链接地址!' }]">
<a-input v-model:value="addList.linkurl" />
</a-form-item>
<a-form-item label="备注" name="descr" :rules="[{ required: true, message: '请输入备注!' }]">
<a-form-item label="备注" name="descr" :rules="[{ required: false, message: '请输入备注!' }]">
<a-input v-model:value="addList.descr" />
</a-form-item>
</a-form>
@ -31,13 +31,13 @@
<div>
<a-button size="small" danger @click="delModal(record.id)">删除</a-button>
<a-modal v-model:open="delControl.open" title="提示" ok-text="确认" cancel-text="取消"
@ok="del">
@ok="del" @cancel="unControl('删除')">
<p>确认删除吗</p>
</a-modal>
</div>
<a-button size="small" type="primary" ghost @click="editModal(record.id)">编辑</a-button>
<a-modal v-model:open="editControl.open" :title="editControl.title" cancelText="取消"
okText="确定" @ok="edit">
okText="确定" @ok="edit" @cancel="unControl(editControl.title)">
<a-form ref="formRef" :model="editList" name="basic" :label-col="{ span: 4, offset: 2 }"
:wrapper-col="{ span: 16 }">
<a-form-item label="链接名称" name="linktext"
@ -49,7 +49,7 @@
<a-input v-model:value="editList.linkurl" />
</a-form-item>
<a-form-item label="备注" name="descr"
:rules="[{ required: true, message: '请修改备注!' }]">
:rules="[{ required: false, message: '请修改备注!' }]">
<a-input v-model:value="editList.descr" />
</a-form-item>
</a-form>
@ -65,10 +65,14 @@
<script setup lang='ts'>
import { onMounted, reactive, ref } from 'vue';
import { comLinkStore } from "@/stores/index"
import type { comLinkInterface } from "@/api/admin/classtic"
import { message } from 'ant-design-vue';
import type { comLinkInterface } from "@/api/admin"
import { get, post, remove, put } from '@/tools/request';
const { delControl, addControl, editControl } = comLinkStore()
const comlinklist = ref<comLinkInterface[]>([])
const unControl = (text: string) => {
message.warn(`取消${text}`)
}
const searchlist = reactive({
linktext: ""
})
@ -137,6 +141,7 @@ const add = async () => {
"/comlinks/add",
addList.value
)
message.success("新增成功")
comLinkList()
addControl.open = false
formRef.value.resetFields();
@ -156,6 +161,7 @@ const del = async (id: any) => {
await remove(
`/comlinks/delete/${id}`
)
message.success("删除成功")
comLinkList()
} else {
console.log("id do not exist!")
@ -187,6 +193,7 @@ const edit = async (id: any) => {
)
editControl.open = false
formRef.value.resetFields()
message.success("编辑成功")
comLinkList()
} else {
console.log("id do not exist!")

2
src/views/admin/blogmanage/BlogLabelView.vue

@ -59,7 +59,7 @@
import { onMounted, reactive, ref } from 'vue';
import { labelStore } from "@/stores/index"
import { message } from 'ant-design-vue';
import type { labelInterface } from "@/api/admin/index"
import type { labelInterface } from "@/api/admin"
import { get, post, remove, put } from '@/tools/request';
const { delControl, addControl, editControl } = labelStore()
const labellist = ref<labelInterface[]>([])

10
src/views/admin/diarymanage/DiaryManageView.vue

@ -77,7 +77,7 @@ import type { Rule } from 'ant-design-vue/es/form';
import { useRouter } from "vue-router"
import { message } from 'ant-design-vue';
import type { diaryInterface } from "@/api/admin"
import { get, post, put,remove } from "@/tools/request"
import { get, post, put, remove } from "@/tools/request"
import { diaryStore } from '@/stores';
import type { labelInterface, typeInterface } from "@/api/admin"
dayjs.locale('zh-cn');
@ -224,11 +224,14 @@ const onSubmit = () => {
if (formControl.value.ids) {
await put(`/diarys/update/${formControl.value.ids}`, formdata)
formControl.value.open = false,
diaryList()
message.success("编辑成功")
diaryList()
} else {
await post('/diarys/add', formdata);
formControl.value.open = false,
diaryList()
message.success("添加成功")
diaryList()
}
})
};
@ -284,6 +287,7 @@ const del = async (id: any) => {
await remove(
`/diarys/delete/${id}`
)
message.success("删除成功")
diaryList()
} else {
console.log("id do not exist!")

3
src/views/admin/diarymanage/DiaryTypeView.vue

@ -126,6 +126,7 @@ const add = async () => {
"/diarytypes/add",
addList.value
)
message.success("新增成功")
typeList()
addControl.open = false
formRef.value.resetFields();
@ -145,6 +146,7 @@ const del = async (id: any) => {
await remove(
`/diarytypes/delete/${id}`
)
message.success("删除成功")
typeList()
} else {
console.log("id do not exist!")
@ -176,6 +178,7 @@ const edit = async (id: any) => {
)
editControl.open = false
formRef.value.resetFields()
message.success("编辑成功")
typeList()
} else {
console.log("id do not exist!")

14
src/views/blog/AboutMe.vue

@ -33,20 +33,6 @@ const aboutMe = ref(`# 关于我
- **编程** 我喜欢在空闲时间编写各种小工具和应用程序
- **音乐** 我喜欢听音乐尤其是古典音乐和流行音乐
- **旅行** 我喜欢探索新的地方体验不同的文化
## 联系我
<p style="text-align:center;">
<a href="mailto:your-email@example.com" style="margin-right:15px;">
<img src="https://img.icons8.com/color/48/000000/email.png" alt="Email">
</a>
<a href="https://github.com/your-github" target="_blank" style="margin-right:15px;">
<img src="https://img.icons8.com/ios-glyphs/48/000000/github.png" alt="GitHub">
</a>
<a href="https://www.linkedin.com/in/your-linkedin" target="_blank">
<img src="https://img.icons8.com/color/48/000000/linkedin.png" alt="LinkedIn">
</a>
</p>
`);
</script>

61
src/views/blog/AmountChartView.vue

@ -343,19 +343,33 @@ const pieChartOptions = reactive<Record<Period, any>>({
]
}
})
const updateLineChart = () => {
if (linechart.value) {
createEcharts(linechart, lineChartOptions[selectedLinePeriod.value]);
if (selectedLinePeriod.value) {
fetchLineAndUpdateChart(lineChartOptions[selectedLinePeriod.value], selectedLinePeriod.value);
}
}
};
const updateLinesChart = () => {
if (lineschart.value) {
createEcharts(lineschart, linesChartOptions[selectedLinesPeriod.value]);
console.log(`output->`,selectedLinesPeriod.value)
if(selectedLinesPeriod.value==="thisyear"){
fetchLinesAndUpdateChart(0, linesChartOptions.thisyear)
}else{
fetchLinesAndUpdateChart(1, linesChartOptions.thisyear)
}
}
};
const updatePieChart = () => {
if (piechart.value) {
createEcharts(piechart, pieChartOptions[selectedPiePeriod.value]);
if(selectedPiePeriod.value){
fetchPieAndUpdateChart(pieChartOptions[selectedPiePeriod.value], selectedPiePeriod.value);
}
}
};
@ -371,18 +385,23 @@ const updateLinesChartData = (disbursetype: any, disbursedate: any, disbursedata
const updatePieChartData = (pieData: any, chartOptions: any) => {
chartOptions.series[0].data = pieData;
}
const updateBarChartData = (barData:any) => {
barChartOptions.dataset.source=barData;
const updateBarChartData = (barData: any) => {
barChartOptions.dataset.source = barData;
}
const fetchLineAndUpdateChart = async (days: number, chartOptions: any) => {
const response = await get("/disburses/list/specificdate", { days });
const fetchLineAndUpdateChart = async (chartOptions: any, datetype:any="nighweek" ) => {
const response = await get(`/disburses/line/${datetype}`);
const data = response.data.data;
const createDates = data.map((item: any) => item.create_date);
const totalDisbursePrices = data.map((item: any) => item.total_disburseprice);
updateLineChartData(createDates, totalDisbursePrices, chartOptions);
createEcharts(linechart, chartOptions);
}
const fetchPieAndUpdateChart = async (chartOptions: any, datetype:any="nighweek") => {
const response = await get(`/disburses/pie/${datetype}`);
const data = response.data.data;
updatePieChartData(data, chartOptions);
createEcharts(piechart, chartOptions);
}
const fetchLinesAndUpdateChart = async (days: number, chartOptions: any) => {
const now = new Date();
let currentYear = now.getFullYear();
@ -409,41 +428,25 @@ const fetchLinesAndUpdateChart = async (days: number, chartOptions: any) => {
createEcharts(lineschart, chartOptions);
}
const fetchPieAndUpdateChart = async (days: number, chartOptions: any) => {
const response = await get("/disburses/list/classifieddata", { days });
const data = response.data.data;
updatePieChartData(data, chartOptions);
createEcharts(piechart, chartOptions);
}
const fetchBarAndUpdateChart = async () => {
const response = await get("/disburses/list/calendar");
const data = response.data.data;
updateBarChartData(data);
createEcharts(barchart, barChartOptions);
}
const getLineWeekList = () => fetchLineAndUpdateChart(7, lineChartOptions.nighweek);
const getLineMonthList = () => fetchLineAndUpdateChart(30, lineChartOptions.nighmonth);
const getLineYearList = () => fetchLineAndUpdateChart(365, lineChartOptions.nighyear);
const getPieWeekList = () => fetchPieAndUpdateChart(7, pieChartOptions.nighweek);
const getPieMonthList = () => fetchPieAndUpdateChart(30, pieChartOptions.nighmonth);
const getPieYearList = () => fetchPieAndUpdateChart(365, pieChartOptions.nighyear);
const getLineWeekList = () => fetchLineAndUpdateChart(lineChartOptions.nighweek, 'nighweek');
const getPieWeekList = () => fetchPieAndUpdateChart(pieChartOptions.nighweek, 'nighweek');
const getLinesThisYearList = () => fetchLinesAndUpdateChart(0, linesChartOptions.thisyear)
const getLinesLastYearList = () => fetchLinesAndUpdateChart(1, linesChartOptions.lastyear)
onMounted(() => {
getLineWeekList()
getLineMonthList()
getLineYearList()
getPieWeekList()
getPieMonthList()
getPieYearList()
getLineWeekList()
getLinesThisYearList()
getLinesLastYearList()
fetchBarAndUpdateChart()
createEcharts(lineschart, linesChartOptions.thisyear)
createEcharts(linechart, lineChartOptions.nighweek);
createEcharts(piechart, pieChartOptions.nighweek);
createEcharts(barchart, barChartOptions);
});
})
</script>

1
src/views/blog/ContentDetail.vue

@ -29,6 +29,7 @@ const previewProps = {
// Fetch content
const fetchContent = async () => {
store.setContent('');
try {
const response = await get(`${props.apiUrl}/${route.params.id}`);
if (response.data.data) {

18
src/views/blog/blogcontent/BlogListView.vue

@ -85,20 +85,6 @@ const onShowSizeChange = (page: number) => {
current.value = page;
blogList(page, pageSizeRef.value)
};
// const blogList = async (page: number, pageSize: number) => {
// try {
// const response = await get('/blogs/list', {
// page,
// page_size: pageSize,
// })
// bloglist.value = response.data.data.blogs;
// total.value = response.data.data.total; //
// pageSizeRef.value = pageSize; // response.data.data.page_size
// dataLoaded.value = true
// } catch (error) {
// console.error('Failed to fetch data', error);
// }
// };
const blogList = async (page: number, pageSize: number) => {
try {
const response = await get('/blogs/list', {
@ -117,7 +103,7 @@ const blogList = async (page: number, pageSize: number) => {
update_at: dayjs(items.update_at).format('YYYY-MM-DD HH:mm:ss'),
readnum: items.readnum,
readminite: Math.round(items.blogcontent.length/ 200),
imglink: items.imglink || 'http://www.wuruilin.cn/personself/暂无图片信息空状态.jpg',
imglink: items.imglink || 'http://www.wuruilin.cn/personself/暂无图片.jpg',
}))
total.value = response.data.data.total; //
@ -133,7 +119,7 @@ const blogCount=async (id:any)=>{
const readMore = (id: any) => {
router.push(`/blog/${id}`)
blogCount(id)
bloglist.value = ([])
}
onMounted(() => {

Loading…
Cancel
Save