This commit is contained in:
王创世 2024-06-18 09:33:08 +08:00
parent 7d90bc570f
commit a2a6ade27d
7 changed files with 298 additions and 23 deletions

View File

@ -1,17 +1,68 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-cn"> <html lang="zh-cn">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8"/>
<link rel="icon" href="/favicon.ico" /> <!-- <link rel="icon" href="/favicon.ico"/>-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title></title> <title></title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="/src/main.jsx"></script> <script type="module" src="/src/main.jsx"></script>
</body> </body>
<script> <script>
window.global = window; window.global = window;
</script>
</script>
<script type="module">
import axios from 'axios';
import store from "@/store";
async function setFaviconFromApi() {
// console.log(111111);
// var faviconUrl =localStorage.getItem('ico');
// localStorage.setItem('ico', '');
// try {
// // 假设 API 端点为 /api/favicon-url 返回 favicon 的 URL
// // const response = await fetch('/api/favicon-url');
// // if (!response.ok) {
// // console.error('Failed to fetch favicon URL');
// // }
// // const faviconUrl = await response.text();
//
// // 动态创建 link 标签并设置属性
// const link = document.createElement('link');
// link.rel = 'icon';
// link.href = '/favicon.ico';
// document.head.appendChild(link);
// } catch (error) {
// console.error('Error setting favicon:', error);
// }
if(typeof (store.state.user.association)=='object'){
var association=store.state.user.association;
}else{
var association=JSON.parse(store.state.user.association);
}
console.log(association);
let formData = new FormData();
formData.append('association_id', association.association_id);
axios.post(store.state.user.apiUrl + '/api/common/icoImage', formData)
.then(response => {
console.log(response);
var ico=response.data.data;
const link = document.createElement('link');
link.rel = 'icon';
link.href = store.state.user.apiUrl+ico;
document.head.appendChild(link);
})
.catch(error => {
console.error('获取失败', error);
});
}
// 页面加载完成后执行
document.addEventListener('DOMContentLoaded', () => {
setFaviconFromApi();
});
</script>
</html> </html>

View File

@ -29,6 +29,9 @@
<!-- />--> <!-- />-->
<!-- </div>--> <!-- </div>-->
<!-- </template>--> <!-- </template>-->
<template #top="{ row }">
<t-tag @click="topNews(row)" theme="success" variant="light" style="cursor: pointer">置顶</t-tag>
</template>
<template #money="{ row }"> <template #money="{ row }">
<div v-if="row.activity_type==4"> <div v-if="row.activity_type==4">
<div v-if="row.money>0"> <div v-if="row.money>0">
@ -173,7 +176,7 @@
</t-dialog> </t-dialog>
<t-dialog :header="isEdit?'编辑活动':'新增活动'" :visible="addMode" :onClose="onCloseMy" @confirm="onSubmit" <t-dialog :header="isEdit?'编辑活动':'新增活动'" :visible="addMode" :onClose="onCloseMy" @confirm="onSubmit"
width="45%" top="20px"> width="45%" top="20px">
<t-form> <t-form layout="inline">
<t-form-item label="活动标题" name="activity_name"> <t-form-item label="活动标题" name="activity_name">
<t-input placeholder="请输入活动标题" v-model="addForm.activity_name" :style="{ width: '480px' }"/> <t-input placeholder="请输入活动标题" v-model="addForm.activity_name" :style="{ width: '480px' }"/>
</t-form-item> </t-form-item>
@ -246,16 +249,27 @@
<t-form-item label="活动排序" name="weigh"> <t-form-item label="活动排序" name="weigh">
<t-input placeholder="请输入排序" v-model="addForm.weigh" :style="{ width: '480px' }"/> <t-input placeholder="请输入排序" v-model="addForm.weigh" :style="{ width: '480px' }"/>
</t-form-item> </t-form-item>
<t-form-item label="报名开始时间" name="activity_start_time">
<t-date-picker :clearable="true" placeholder="活动开始时间"
:enableTimePicker="true" :allow-input="false"
v-model="addForm.activity_start_time"></t-date-picker>
</t-form-item>
<t-form-item label="报名结束时间" name="activity_end_time">
<t-date-picker :clearable="true" placeholder="活动结束时间"
:enableTimePicker="true" :allow-input="false"
v-model="addForm.activity_end_time"></t-date-picker>
</t-form-item>
<t-form-item label="活动开始时间" name="activity_start_time"> <t-form-item label="活动开始时间" name="activity_start_time">
<t-date-picker :clearable="true" :style="{ width: '480px' }" placeholder="活动开始时间" <t-date-picker :clearable="true" placeholder="活动开始时间"
:enableTimePicker="true" :allow-input="false" :enableTimePicker="true" :allow-input="false"
v-model="addForm.activity_start_time"></t-date-picker> v-model="addForm.activity_start_time"></t-date-picker>
</t-form-item> </t-form-item>
<t-form-item label="活动结束时间" name="activity_end_time"> <t-form-item label="活动结束时间" name="activity_end_time">
<t-date-picker :clearable="true" :style="{ width: '480px' }" placeholder="活动结束时间" <t-date-picker :clearable="true" placeholder="活动结束时间"
:enableTimePicker="true" :allow-input="false" :enableTimePicker="true" :allow-input="false"
v-model="addForm.activity_end_time"></t-date-picker> v-model="addForm.activity_end_time"></t-date-picker>
</t-form-item> </t-form-item>
</t-form> </t-form>
</t-dialog> </t-dialog>
@ -397,6 +411,7 @@ export default {
{colKey: 'activity_start_time', title: '活动开始时间', align: 'center'}, {colKey: 'activity_start_time', title: '活动开始时间', align: 'center'},
{colKey: 'activity_end_time', title: '活动结束时间', align: 'center'}, {colKey: 'activity_end_time', title: '活动结束时间', align: 'center'},
{colKey: 'activity_location', title: '活动地点', align: 'center'}, {colKey: 'activity_location', title: '活动地点', align: 'center'},
{colKey: 'top', title: '置顶', align: 'center'},
{colKey: 'select', title: '操作', width: 200, align: 'center'}, {colKey: 'select', title: '操作', width: 200, align: 'center'},
], ],
pagination: { pagination: {
@ -480,6 +495,23 @@ export default {
this.getType=d.activity_type; this.getType=d.activity_type;
this.openJuanModeList(); this.openJuanModeList();
}, },
topNews(row){
console.log(row);
this.$request
.post('/common/listtopping', {id: row.id,type:'activity'})
.then((res) => {
if (res.code == 1) {
this.$message.success('置顶成功');
this.getList();
} else {
this.$message.error(res.msg);
}
console.log(res);
})
.catch((e) => {
console.log(e);
});
},
openJuanModeList(){ openJuanModeList(){
this.$request this.$request
.post("/money_log/find", { .post("/money_log/find", {

View File

@ -11,7 +11,17 @@
theme="image" theme="image"
tips="请选择单张图片文件上传" tips="请选择单张图片文件上传"
accept="image/*" accept="image/*"
:format-response="formatResponse" :format-response="(response) => formatResponse(response, 0)"
></t-upload>
</t-form-item>
<t-form-item label="协会ico" name="ico_image">
<t-upload
:action="$store.state.user.apiUrl+'/api/common/upload'"
v-model="addForm.ico_image_show"
theme="image"
tips="请选择ICO图片文件上传用于后台页面标题小图标"
accept=".ico"
:format-response="(response) => formatResponse(response, 1)"
></t-upload> ></t-upload>
</t-form-item> </t-form-item>
<t-form-item label="协会名称" name="association_name"> <t-form-item label="协会名称" name="association_name">
@ -115,6 +125,8 @@ export default {
association_desc:'', association_desc:'',
association_image:'', association_image:'',
association_image_show:[], association_image_show:[],
ico_image:'',
ico_image_show:[],
ruhuixizhu:'' ruhuixizhu:''
}, },
editor: null, editor: null,
@ -172,9 +184,14 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
formatResponse(res) { formatResponse(res,type) {
console.log(res); console.log(res);
this.addForm.association_image = res.data.url; if(type==0){
this.addForm.association_image = res.data.url;
}else{
this.addForm.ico_image = res.data.url;
}
return {url: res.data.fullurl}; return {url: res.data.fullurl};
}, },
getList() { getList() {
@ -185,6 +202,12 @@ export default {
this.info = res.data; this.info = res.data;
this.addForm.id=res.data.id; this.addForm.id=res.data.id;
this.addForm.association_name=res.data.association_name; this.addForm.association_name=res.data.association_name;
this.addForm.ico_image=res.data.ico_image;
if(res.data.ico_image==''){
this.addForm.ico_image_show=[];
}else{
this.addForm.ico_image_show=[{url:store.state.user.apiUrl+res.data.ico_image}];
}
this.addForm.association_phone=res.data.association_phone; this.addForm.association_phone=res.data.association_phone;
this.addForm.association_emal=res.data.association_emal; this.addForm.association_emal=res.data.association_emal;
this.addForm.association_dizhi=res.data.association_dizhi; this.addForm.association_dizhi=res.data.association_dizhi;
@ -237,7 +260,7 @@ export default {
.then((res) => { .then((res) => {
if(res.code==1){ if(res.code==1){
this.$message.success(res.msg); this.$message.success(res.msg);
localStorage.setItem('associationInfo', JSON.stringify(this.addForm) ); //localStorage.setItem('associationInfo', JSON.stringify(this.addForm) );
this.getList(); this.getList();
}else { }else {
this.$message.error(res.msg); this.$message.error(res.msg);

View File

@ -47,7 +47,7 @@
</t-form-item> </t-form-item>
<t-form-item label="权限类型" name="type"> <t-form-item label="权限类型" name="type">
<t-select v-model="modData.group"> <t-select v-model="modData.group">
<t-option value="2" key="2" label="业务员"></t-option> <t-option value="2" key="2" label="办事员"></t-option>
</t-select> </t-select>
</t-form-item> </t-form-item>
</t-form> </t-form>

View File

@ -22,6 +22,9 @@
</t-popconfirm> </t-popconfirm>
</t-space> </t-space>
</template> </template>
<template #top="{ row }">
<t-tag @click="topNews(row)" theme="success" variant="light" style="cursor: pointer">置顶</t-tag>
</template>
</t-table> </t-table>
<div style="margin-top: 30px"> <div style="margin-top: 30px">
<t-pagination <t-pagination
@ -52,6 +55,9 @@
<t-form-item label="来源" name="news_source"> <t-form-item label="来源" name="news_source">
<t-input placeholder="请输入来源" v-model="addForm.news_source"/> <t-input placeholder="请输入来源" v-model="addForm.news_source"/>
</t-form-item> </t-form-item>
<t-form-item label="点击量" name="news_source">
<t-input placeholder="请输入自定义点击量" v-model="addForm.news_hits"/>
</t-form-item>
<t-form-item label="新闻内容" name="news_content"> <t-form-item label="新闻内容" name="news_content">
<div style="border: 1px solid #ccc;z-index: 99"> <div style="border: 1px solid #ccc;z-index: 99">
<!-- 工具栏 --> <!-- 工具栏 -->
@ -84,10 +90,11 @@
<t-form-item <t-form-item
label="展示时间" label="展示时间"
name="days"> name="days">
<t-date-picker :clearable="true" placeholder="展示时间" <t-date-picker :style="{ width: '200px' }" :clearable="true" placeholder="展示时间"
:enableTimePicker="true" :allow-input="false" :enableTimePicker="true" :allow-input="false"
v-model="addForm.showtime"></t-date-picker> v-model="addForm.showtime"></t-date-picker>
</t-form-item> </t-form-item>
</t-form> </t-form>
</t-dialog> </t-dialog>
</t-card> </t-card>
@ -113,6 +120,7 @@ export default {
news_image: '', news_image: '',
news_image_show:[], news_image_show:[],
showtime:'', showtime:'',
news_hits:0,
}, },
addMode: false, addMode: false,
isEdit: false, isEdit: false,
@ -126,6 +134,7 @@ export default {
{colKey: 'news_hits', title: '点击量', align: 'center'}, {colKey: 'news_hits', title: '点击量', align: 'center'},
{colKey: 'news_source', title: '来源', align: 'center'}, {colKey: 'news_source', title: '来源', align: 'center'},
{colKey: 'showtime', title: '创建时间', align: 'center'}, {colKey: 'showtime', title: '创建时间', align: 'center'},
{colKey: 'top', title: '置顶', align: 'center'},
{colKey: 'select', title: '操作', width: 200, align: 'center'}, {colKey: 'select', title: '操作', width: 200, align: 'center'},
], ],
pagination: { pagination: {
@ -208,6 +217,23 @@ export default {
onCreated(editor) { onCreated(editor) {
this.editor = Object.seal(editor); this.editor = Object.seal(editor);
}, },
topNews(row){
console.log(row);
this.$request
.post('/common/listtopping', {id: row.news_id,type:'news'})
.then((res) => {
if (res.code == 1) {
this.$message.success('置顶成功');
this.getList();
} else {
this.$message.error(res.msg);
}
console.log(res);
})
.catch((e) => {
console.log(e);
});
},
del(d) { del(d) {
console.log(d); console.log(d);
this.$request this.$request
@ -238,6 +264,7 @@ export default {
news_image: '', news_image: '',
news_image_show:[], news_image_show:[],
showtime:'', showtime:'',
news_hits:0,
}; };
}, },
edit(d) { edit(d) {
@ -251,7 +278,8 @@ export default {
this.addForm.news_auto = d.news_auto; this.addForm.news_auto = d.news_auto;
this.addForm.news_source = d.news_source; this.addForm.news_source = d.news_source;
this.addForm.news_content = d.news_content; this.addForm.news_content = d.news_content;
this.addForm.showtime = d.showtime; this.addForm.showtime = d.showtime
this.addForm.news_hits = d.news_hits;
this.addMode = true; this.addMode = true;
this.isEdit = true; this.isEdit = true;
}, },
@ -272,7 +300,7 @@ export default {
}, },
getGory(){ getGory(){
this.$request this.$request
.post("/news/gory") .post("/gory/index")
.then((res) => { .then((res) => {
console.log(res); console.log(res);
if (res.code == 1) { if (res.code == 1) {

View File

@ -0,0 +1,135 @@
<template>
<t-card :bordered="false">
<div class="form-step-container">
<t-button @click="add">新增</t-button>
<t-table
rowKey="index"
:data="list"
:columns="columns"
:stripe="false"
:bordered="false"
:hover="true"
size="large"
table-layout="auto"
cellEmptyContent="-"
>
<template #select="{ row }">
<t-space size="24px" v-if="row.id!=0">
<t-button theme="warning" @click="edit(row)">编辑</t-button>
<t-popconfirm content="确认删除吗,类目下的新闻将不再显示!" @confirm="del(row)">
<t-button theme="danger" >删除</t-button>
</t-popconfirm>
</t-space>
</template>
</t-table>
</div>
<t-dialog header="类目管理" :visible="addMode" :onClose="onCloseMy" @confirm="onSubmit">
<t-form>
<t-form-item label="类目名称" name="name">
<t-input placeholder="请输入类目名称" v-model="name"/>
</t-form-item>
<t-form-item label="排序" name="weigt">
<t-input placeholder="请输入排序" v-model="weigh"/>
</t-form-item>
</t-form>
</t-dialog>
</t-card>
</template>
<script lang="ts">
export default {
data() {
return {
name: '',
weigh:0,
addMode: false,
isEdit: false,
editID:0,
list: [],
columns: [
{colKey: 'name', title: '类目名称'},
{colKey: 'createtime', title: '添加时间'},
{colKey: 'select', title: '操作', width: 200},
],
}
},
mounted() {
//this.member_id=this.$route.query.id;
this.getList();
},
methods: {
del(d){
console.log(d);
this.$request
.post('/gory/del',{id:d.id})
.then((res) => {
if(res.code==1){
this.$message.success('删除成功!');
this.getList();
}else {
this.$message.error(res.msg);
}
console.log(res);
})
.catch((e) => {
console.log(e);
});
},
add(){
this.weigh='';
this.name= '';
this.addMode=true;
this.isEdit=false;
},
edit(d){
this.editID=d.id;
this.name=d.name;
this.weigh=d.weigh;
this.addMode=true;
this.isEdit=true;
},
getList() {
this.$request
.post("/gory/index")
.then((res) => {
console.log(res);
this.list = res.data;
})
.catch((e) => {
console.log(e);
});
},
onSubmit() {
if (this.name == '') {
this.$message.error('类目名称不能为空');
return;
}
var url='/gory/add';
if(this.isEdit){
url='/gory/update';
}
this.$request
.post(url,{name:this.name,diy_name:this.name,weigh:this.weigh,id:this.editID})
.then((res) => {
if(res.code==1){
this.$message.success('操作成功!');
this.addMode=false;
this.getList();
}else {
this.$message.error(res.msg);
}
console.log(res);
})
.catch((e) => {
console.log(e);
});
},
onCloseMy() {
this.addMode = false;
}
}
}
</script>
<style scoped lang="less">
</style>

View File

@ -81,6 +81,12 @@ export default [
name: 'newsIndex', name: 'newsIndex',
component: () => import('@/pages/news/news_index.vue'), component: () => import('@/pages/news/news_index.vue'),
meta: { title: '新闻内容管理' }, meta: { title: '新闻内容管理' },
},
{
path: 'news_type',
name: 'newsType',
component: () => import('@/pages/news/news_type.vue'),
meta: { title: '新闻类目管理' },
} }
], ],
},{ },{