init
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div>
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
||||
@@ -0,0 +1,73 @@
|
||||
import http from '../utils/http/http.js'
|
||||
|
||||
const indexdata = (data) => {
|
||||
return http.get("/admin/index/data", data);
|
||||
};
|
||||
const getindex = (data) => {
|
||||
return http.get("/admin/index", data);
|
||||
};
|
||||
const agreement = (type,data) => {
|
||||
return http.get("/admin/basic/agreement/"+type, data);
|
||||
};
|
||||
const updateagreement = (type,data) => {
|
||||
return http.put("/admin/basic/agreement/"+type, data);
|
||||
};
|
||||
const gettime = (data) => {
|
||||
return http.get("/admin/system/time/1", data);
|
||||
};
|
||||
const updatetime = (data) => {
|
||||
return http.put("/admin/system/time/1", data);
|
||||
};
|
||||
const getarticle = (data) => {
|
||||
return http.posts("/admin/article/page", data);
|
||||
};
|
||||
const getavideo = (data) => {
|
||||
return http.posts("/admin/video/page", data);
|
||||
};
|
||||
const gethospital = (data) => {
|
||||
return http.get("/admin/basic/hospital/page", data);
|
||||
};
|
||||
const putarticle = (id,data) => {
|
||||
return http.puts("/admin/article/"+id, data);
|
||||
};
|
||||
const putarticles = (data) => {
|
||||
return http.posts("/admin/article", data);
|
||||
};
|
||||
const putstatus = (id,data) => {
|
||||
return http.puts("/admin/article/status/"+id, data);
|
||||
};
|
||||
const putvideostatus = (id,data) => {
|
||||
return http.puts("/admin/video/status/"+id, data);
|
||||
};
|
||||
const getvote = (data) => {
|
||||
return http.get("/admin/article/vote/page", data);
|
||||
};
|
||||
const getvideovote = (data) => {
|
||||
return http.get("/admin/video/vote/page", data);
|
||||
};
|
||||
const putavideo = (id,data) => {
|
||||
return http.puts("/admin/video/"+id, data);
|
||||
};
|
||||
const putavideos = (data) => {
|
||||
return http.posts("/admin/video", data);
|
||||
};
|
||||
const UEDITOR_SERVERURL = import.meta.env.VITE_APP_UEDITOR_SERVERURL
|
||||
const editorConfig = {
|
||||
// 后端服务地址,后端处理参考
|
||||
// https://open-doc.modstart.com/ueditor-plus/backend.html
|
||||
// serverUrl: '/api/path/to/server',
|
||||
serverUrl: UEDITOR_SERVERURL,
|
||||
// UEDITOR_HOME_URL: '/static/UEditorPlus/',
|
||||
// UEDITOR_CORS_URL: '/static/UEditorPlus/',
|
||||
loadConfigFromServer: true,
|
||||
UEDITOR_HOME_URL: import.meta.env.MODE=="development"?'/static/UEditorPlus/':'/admin/web/v/static/UEditorPlus/',
|
||||
UEDITOR_CORS_URL: import.meta.env.MODE=="development"?'/static/UEditorPlus/':'/admin/web/v/static/UEditorPlus/',
|
||||
initialFrameHeight: 500, // 高度
|
||||
initialFrameWidth: '100%',
|
||||
autoHeightEnabled: false,
|
||||
}
|
||||
|
||||
export default {
|
||||
indexdata, getindex,agreement,updateagreement,gettime,updatetime,getarticle,gethospital,putarticles
|
||||
,putarticle,putstatus,getvote,getavideo,getvideovote,putvideostatus,putavideo,putavideos,editorConfig
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import http from '../utils/http/http.js'
|
||||
|
||||
const login = (data) => {
|
||||
return http.post("/admin/login", data);
|
||||
};
|
||||
const getUserList = (data) => {
|
||||
return http.get("/user/list", data);
|
||||
};
|
||||
const saveUser = (data) => {
|
||||
return http.post("/user/save", data);
|
||||
};
|
||||
const delUser = (data) => {
|
||||
return http.del("/user/delete", data);
|
||||
};
|
||||
const getUserDetail = (data) => {
|
||||
return http.get("/user/detail", data);
|
||||
};
|
||||
const getcaptcha = (data) => {
|
||||
return http.get("/admin/captcha", data);
|
||||
};
|
||||
export default {
|
||||
login, getUserList, saveUser, delUser, getUserDetail,getcaptcha
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 290 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 416 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,10 @@
|
||||
import router from '../../router/index.js'
|
||||
export default {
|
||||
// 路由跳转
|
||||
changeView(url, queryParams) {
|
||||
router.push({
|
||||
path: url,
|
||||
query: queryParams,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// 全局变量
|
||||
export default {
|
||||
name: '肝胆相照',
|
||||
officialAccount: '肝胆相照技术'
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 496 B |
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<div>
|
||||
{{ name }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup >
|
||||
import { onMounted, ref } from 'vue';
|
||||
import userApi from '../api/user'
|
||||
const name = ref("关亚奇");
|
||||
onMounted(() => {
|
||||
userApi.getUserList().then(res=>{
|
||||
console.log('------->');
|
||||
console.log(res);
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<div>
|
||||
<p>{{ msg }}</p>
|
||||
<p>姓名:{{ user.name }}</p>
|
||||
<p>年龄:{{ user.age }}</p>
|
||||
<button @click="changeAge">点击</button>
|
||||
<p>单独姓名:{{ name }}</p>
|
||||
<button @click="changeName">修改姓名</button>
|
||||
<p>单独年龄:{{ age }}</p>
|
||||
<button @click="changeRefAge">修改年龄</button>
|
||||
<p>诗人:{{ poet }}</p>
|
||||
<button @click="changePoet">修改诗人</button>
|
||||
<p>computed:{{ newPoet }}</p>
|
||||
<!-- 父子传值 -->
|
||||
<Son :user="user" />
|
||||
</div>
|
||||
</template>
|
||||
<script >
|
||||
import { reactive, ref, toRef, toRefs } from "@vue/reactivity";
|
||||
import { computed, watch, provide } from "vue";
|
||||
import Son from "./Son.vue";
|
||||
export default {
|
||||
components: {
|
||||
Son,
|
||||
},
|
||||
setup() {
|
||||
let msg = "hello";
|
||||
// reactive是一个函数,它可以将复杂数据类型变成响应式数据。
|
||||
let user = reactive({
|
||||
name: "张无忌",
|
||||
age: 12,
|
||||
});
|
||||
const changeAge = () => {
|
||||
user.age++;
|
||||
};
|
||||
// toRef是函数,将对象中某个属性为单独的响应式数据
|
||||
const name = toRef(user, "name");
|
||||
const changeName = () => {
|
||||
name.value = "赵敏";
|
||||
};
|
||||
// toRefs是函数,将对象中所有属性为单独响应式数据
|
||||
const refUser = toRefs(user);
|
||||
const changeRefAge = () => {
|
||||
refUser.age.value = 18;
|
||||
};
|
||||
// ref函数,常用于简单数据类型定义为响应式数据,再修改值,获取值的时候,需要.value
|
||||
let poet = ref("李白");
|
||||
const changePoet = () => {
|
||||
poet.value = "杜甫";
|
||||
};
|
||||
// computed 计算
|
||||
const newPoet = computed(() => {
|
||||
return poet.value + ",白居易";
|
||||
});
|
||||
// watch 监听
|
||||
watch(user, () => {
|
||||
console.log("user改变了");
|
||||
});
|
||||
watch(
|
||||
() => user.age,
|
||||
() => {
|
||||
console.log("age改变了");
|
||||
}
|
||||
);
|
||||
// provide
|
||||
provide("poet", poet);
|
||||
provide("changePoet", changePoet);
|
||||
return {
|
||||
msg,
|
||||
user,
|
||||
name,
|
||||
changeAge,
|
||||
changeName,
|
||||
changeRefAge,
|
||||
...refUser,
|
||||
poet,
|
||||
changePoet,
|
||||
newPoet,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="block">
|
||||
<div style="font-weight: 600;font-size: 16px;color: rgba(0,0,0,0.9);margin-right: 16px;">{{ title }}</div>
|
||||
<el-date-picker
|
||||
v-model="value1"
|
||||
type="date"
|
||||
placeholder="开始日期"
|
||||
size="lager"
|
||||
/>
|
||||
<div> 至 </div>
|
||||
<el-date-picker
|
||||
v-model="value2"
|
||||
type="date"
|
||||
placeholder="结束日期"
|
||||
size="lager"
|
||||
/>
|
||||
</div>
|
||||
<div id="myChart" :style="{ width: '800px', height: '400px' }"></div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import * as echarts from 'echarts';
|
||||
import request from "../api/request.js";
|
||||
const value1 = ref('')
|
||||
const value2 = ref('')
|
||||
const orgindata = ref([])
|
||||
const datax = ref([])
|
||||
const datay = ref([])
|
||||
var myChart;
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
onMounted(()=>{
|
||||
initEcharts ()
|
||||
initdata()
|
||||
})
|
||||
onUnmounted(() => {
|
||||
// 销毁图表
|
||||
myChart.dispose;
|
||||
});
|
||||
var option;
|
||||
|
||||
function initEcharts () {
|
||||
var chartDom = document.getElementById('myChart');
|
||||
myChart = echarts.init(chartDom);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
function initEchartsdata () {
|
||||
|
||||
option = {
|
||||
xAxis: {
|
||||
data: datax.value
|
||||
},
|
||||
yAxis: {},
|
||||
series: [
|
||||
{
|
||||
data: datay.value,
|
||||
type: 'line',
|
||||
areaStyle: {}
|
||||
},
|
||||
|
||||
]
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
}
|
||||
const form = reactive({
|
||||
type: "2",
|
||||
start_time: value1.value,
|
||||
end_time: value2.value,
|
||||
|
||||
});
|
||||
function initdata()
|
||||
{
|
||||
request.indexdata(form).then(res=>{
|
||||
console.log('indexdata',res)
|
||||
orgindata.value=[]
|
||||
orgindata.value.push(...res.data.data)
|
||||
datax.value=orgindata.value.map(item=>item.date)
|
||||
datay.value=orgindata.value.map(item=>item.count)
|
||||
|
||||
|
||||
initEchartsdata()
|
||||
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.block {
|
||||
display: flex;
|
||||
|
||||
align-items: center;
|
||||
margin-left: 16px;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<div style="padding: 16px 0px;">
|
||||
<el-breadcrumb :separator-icon="ArrowRight">
|
||||
<el-breadcrumb-item style="font-size: 16px;" >{{ title1 }}</el-breadcrumb-item>
|
||||
<el-breadcrumb-item style="font-size: 16px;" >{{ title2 }}</el-breadcrumb-item>
|
||||
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ArrowRight } from '@element-plus/icons-vue'
|
||||
const props = defineProps({
|
||||
title1: {
|
||||
type: String,
|
||||
|
||||
},
|
||||
title2: {
|
||||
type: String,
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<div id="phone">
|
||||
<div class="screen">
|
||||
<!-- <div class="empty">
|
||||
<svg viewBox="0 0 48 48">
|
||||
<path d="M47.3296 9.02336C46.9238 8.85514 46.4566 8.94821 46.1461 9.25869L26.2748 29.13C26.1703 29.2345 26.0916 29.3551 26.0386 29.4836C25.9866 29.6094 25.9576 29.7471 25.9567 29.8914C25.9567 29.892 25.9567 29.8925 25.9567 29.8929C25.9567 29.8932 25.9567 29.8933 25.9567 29.8934C25.9567 29.8938 25.9567 29.8941 25.9567 29.8946C25.9567 29.8949 25.9567 29.8951 25.9567 29.8954C25.9567 29.8958 25.9567 29.8959 25.9567 29.8962C25.9567 29.8967 25.9567 29.8973 25.9567 29.8979C25.9567 37.2506 19.975 43.2324 12.6223 43.2324C6.85987 43.2324 2.17195 38.5443 2.17195 32.7821C2.17195 28.2919 5.82494 24.639 10.315 24.639C13.7874 24.639 16.6122 27.4639 16.6122 30.9362C16.6122 33.5944 14.4497 35.7569 11.7916 35.7569C9.78483 35.7569 8.15229 34.1242 8.15229 32.1175C8.15229 30.6319 9.36098 29.4232 10.8466 29.4232C11.4463 29.4232 11.9326 28.9371 11.9326 28.3373C11.9326 27.7375 11.4463 27.2513 10.8466 27.2513C8.16337 27.2513 5.98034 29.4343 5.98034 32.1175C5.98034 35.3219 8.58722 37.9288 11.7916 37.9288C13.6865 37.9288 15.4077 37.1712 16.6683 35.943C16.6915 35.9233 16.7141 35.9026 16.736 35.8808L36.6075 16.0094C37.9281 14.6887 38.6555 12.9328 38.6555 11.065C38.6555 6.39509 34.8563 2.5957 30.1864 2.5957C27.4311 2.5957 24.8408 3.66864 22.8925 5.61688L3.02118 25.4882C2.99522 25.5142 2.97079 25.5412 2.94798 25.569C1.12539 27.4303 0 29.9774 0 32.7821C0 39.7421 5.66237 45.4043 12.6223 45.4043C16.8781 45.4043 20.7386 43.6813 23.5432 40.8958C23.5763 40.8697 23.6081 40.8415 23.6385 40.811L43.4582 20.9913C46.387 18.0626 48 14.1685 48 10.0267C48 9.58741 47.7353 9.19147 47.3296 9.02336ZM24.4283 7.15266C25.9663 5.61471 28.0111 4.76765 30.1862 4.76765C33.6586 4.76765 36.4835 7.59259 36.4835 11.065C36.4835 12.3526 35.9821 13.5632 35.0715 14.4737L18.7826 30.7627C18.6899 26.1724 14.9271 22.4669 10.315 22.4669C9.88181 22.4669 9.45426 22.4939 9.03497 22.546L24.4283 7.15266ZM41.9225 19.4555L27.6501 33.7279C27.9264 32.6444 28.0883 31.5148 28.1221 30.3545L45.5033 12.9732C44.9566 15.4096 43.7313 17.6467 41.9225 19.4555Z" fill="currentColor"></path>
|
||||
</svg>
|
||||
<span>No more letters</span>
|
||||
</div> -->
|
||||
<h1 v-text="title"></h1>
|
||||
<div class="content" v-html="htmlContent">
|
||||
</div>
|
||||
</div>
|
||||
<div class="time">16:22</div>
|
||||
<svg class="battery" viewBox="0 0 25 12">
|
||||
<rect opacity="0.35" x="0.5" y="0.833374" width="21" height="10.3333" rx="2.16667" fill="none" stroke="currentColor"></rect>
|
||||
<path opacity="0.4" d="M23 4V8C23.8047 7.66122 24.328 6.87313 24.328 6C24.328 5.12687 23.8047 4.33878 23 4" fill="currentColor"></path>
|
||||
<rect x="2" y="2.33337" width="18" height="7.33333" rx="1.33333" fill="currentColor"></rect>
|
||||
</svg>
|
||||
<svg class="wifi" viewBox="0 0 16 12">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.33045 2.60802C10.5463 2.60811 12.6775 3.45955 14.2835 4.98635C14.4044 5.10422 14.5977 5.10274 14.7168 4.98302L15.8728 3.81635C15.9331 3.75563 15.9667 3.67338 15.9662 3.58779C15.9657 3.50221 15.9311 3.42036 15.8701 3.36035C11.655 -0.679198 5.00522 -0.679198 0.79012 3.36035C0.729062 3.42032 0.694418 3.50215 0.693855 3.58773C0.693292 3.67331 0.726856 3.75558 0.78712 3.81635L1.94345 4.98302C2.06248 5.10292 2.25593 5.10441 2.37679 4.98635C3.98294 3.45945 6.11434 2.60801 8.33045 2.60802ZM8.33045 6.40368C9.54794 6.40361 10.722 6.85614 11.6245 7.67335C11.7465 7.78933 11.9388 7.78682 12.0578 7.66768L13.2125 6.50102C13.2733 6.43982 13.307 6.3568 13.3061 6.27054C13.3052 6.18427 13.2698 6.10196 13.2078 6.04202C10.4596 3.48563 6.20365 3.48563 3.45545 6.04202C3.39338 6.10196 3.35796 6.18432 3.35714 6.27061C3.35633 6.3569 3.39019 6.43991 3.45112 6.50102L4.60545 7.66768C4.72444 7.78682 4.91672 7.78933 5.03879 7.67335C5.94066 6.85668 7.11377 6.40419 8.33045 6.40368ZM10.6434 8.9575C10.6452 9.04401 10.6112 9.12741 10.5495 9.18802L8.55212 11.2037C8.49357 11.2629 8.41374 11.2963 8.33045 11.2963C8.24716 11.2963 8.16734 11.2629 8.10879 11.2037L6.11112 9.18802C6.04941 9.12736 6.01546 9.04394 6.01729 8.95743C6.01912 8.87092 6.05657 8.789 6.12079 8.73102C7.39636 7.65213 9.26455 7.65213 10.5401 8.73102C10.6043 8.78905 10.6417 8.87099 10.6434 8.9575Z" fill="currentColor"></path>
|
||||
</svg>
|
||||
<svg class="cellular" viewBox="0 0 18 12">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.6665 0.666626H15.6665C15.1142 0.666626 14.6665 1.11434 14.6665 1.66663V10.3333C14.6665 10.8856 15.1142 11.3333 15.6665 11.3333H16.6665C17.2188 11.3333 17.6665 10.8856 17.6665 10.3333V1.66663C17.6665 1.11434 17.2188 0.666626 16.6665 0.666626ZM10.9998 2.99996H11.9998C12.5521 2.99996 12.9998 3.44767 12.9998 3.99996V10.3333C12.9998 10.8856 12.5521 11.3333 11.9998 11.3333H10.9998C10.4476 11.3333 9.99984 10.8856 9.99984 10.3333V3.99996C9.99984 3.44767 10.4476 2.99996 10.9998 2.99996ZM7.33317 5.33329H6.33317C5.78089 5.33329 5.33317 5.78101 5.33317 6.33329V10.3333C5.33317 10.8856 5.78089 11.3333 6.33317 11.3333H7.33317C7.88546 11.3333 8.33317 10.8856 8.33317 10.3333V6.33329C8.33317 5.78101 7.88546 5.33329 7.33317 5.33329ZM2.6665 7.33329H1.6665C1.11422 7.33329 0.666504 7.78101 0.666504 8.33329V10.3333C0.666504 10.8856 1.11422 11.3333 1.6665 11.3333H2.6665C3.21879 11.3333 3.6665 10.8856 3.6665 10.3333V8.33329C3.6665 7.78101 3.21879 7.33329 2.6665 7.33329Z" fill="currentColor"></path>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
|
||||
},
|
||||
htmlContent: {
|
||||
type: String,
|
||||
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<style scoped>
|
||||
#phone {
|
||||
--c-frame: black;
|
||||
--c-interface: black;
|
||||
--c-headline: black;
|
||||
--c-screen: #e4e2e2;
|
||||
--c-letter: #fff;
|
||||
--c-date: black;
|
||||
--c-subline: #898989;
|
||||
--c-text: #A7A7A7;
|
||||
--empty-mask: 100%;
|
||||
--headline-y: 0;
|
||||
position: relative;
|
||||
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
font-size: 14px;
|
||||
width: 375px;
|
||||
color: var(--c-interface);
|
||||
margin: 0 auto;
|
||||
height: calc(100vh - 15%);
|
||||
border-radius: 9.6%/4.43%;
|
||||
box-shadow: 0 0 0 10px var(--c-frame);
|
||||
}
|
||||
|
||||
#phone:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
height: 30px;
|
||||
width: 200px;
|
||||
border-radius: 0 0 16px 16px;
|
||||
background: var(--c-frame);
|
||||
}
|
||||
#phone .time,
|
||||
#phone .battery,
|
||||
#phone .cellular,
|
||||
#phone .wifi {
|
||||
position: absolute;
|
||||
top: 17px;
|
||||
}
|
||||
#phone .time {
|
||||
left: 21px;
|
||||
top: 15px;
|
||||
font-size: 100%;
|
||||
font-weight: 600;
|
||||
}
|
||||
#phone .battery {
|
||||
right: 15px;
|
||||
width: 25px;
|
||||
height: 12px;
|
||||
}
|
||||
#phone .cellular {
|
||||
right: 64px;
|
||||
width: 18px;
|
||||
height: 12px;
|
||||
}
|
||||
#phone .wifi {
|
||||
right: 44px;
|
||||
width: 16px;
|
||||
height: 12px;
|
||||
}
|
||||
#phone .screen {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
#phone .screen {
|
||||
padding-bottom: 87vh;
|
||||
background: #fff;
|
||||
transform: translateZ(0);
|
||||
border-radius: 36px;
|
||||
overflow: hidden;
|
||||
-webkit-mask-image: -webkit-radial-gradient(white, black);
|
||||
}
|
||||
#phone .screen h1 {
|
||||
font-size: 20px;
|
||||
font-weight: bolder;
|
||||
color: var(--c-headline);
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
top: 45px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transform: translateY(var(--headline-y)) translateZ(0);
|
||||
}
|
||||
#phone .screen .content {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 115px;
|
||||
right: 10px;
|
||||
bottom: 10px;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
#phone .screen .content::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
/deep/img{
|
||||
max-width: 100% !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<div class="uebox">
|
||||
<vue-ueditor-wrap v-model="content" :editor-id="props.id" :config="editorConfig"
|
||||
:editorDependencies="['ueditor.config.js', 'ueditor.all.js', 'lang/zh-cn/zh-cn.js']" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import { VueUeditorWrap } from 'vue-ueditor-wrap'
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
// 内容
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// serverUrl: {
|
||||
// type: String,
|
||||
// default: ''
|
||||
// },
|
||||
|
||||
// 必须得有,如果要在一个页面内写两个或以上的组件,需要用id去区分
|
||||
id: {
|
||||
type: String,
|
||||
default: 'common_editor'
|
||||
}
|
||||
})
|
||||
const emits = defineEmits(['update:modelValue','changeData'])
|
||||
const content = computed({
|
||||
get() {
|
||||
return props.modelValue || ''
|
||||
},
|
||||
|
||||
set(value) {
|
||||
emits('update:modelValue', value);
|
||||
|
||||
emits("changeData",value);
|
||||
return value
|
||||
}
|
||||
})
|
||||
|
||||
const UEDITOR_SERVERURL = import.meta.env.VITE_APP_UEDITOR_SERVERURL
|
||||
const editorConfig =reactive({
|
||||
serverUrl: '/admin/api/v/admin/system/editor',
|
||||
serverHeaders: {
|
||||
'Authorization': 'Bearer '+localStorage.getItem('tokens')
|
||||
},
|
||||
// serverUrl: UEDITOR_SERVERURL,
|
||||
loadConfigFromServer: true,
|
||||
UEDITOR_HOME_URL:import.meta.env.MODE=="development"?'/static/UEditorPlus/':'/admin/web/v/static/UEditorPlus/',
|
||||
UEDITOR_CORS_URL: import.meta.env.MODE=="development"?'/static/UEditorPlus/':'/admin/web/v/static/UEditorPlus/',
|
||||
initialFrameHeight: 400, // 高度
|
||||
initialFrameWidth: '100%',
|
||||
autoHeightEnabled: false,
|
||||
toolbars:[
|
||||
[
|
||||
"fullscreen", // 全屏
|
||||
"source", // 源代码
|
||||
"|",
|
||||
"undo", // 撤销
|
||||
"redo", // 重做
|
||||
"|",
|
||||
"bold", // 加粗
|
||||
"italic", // 斜体
|
||||
"underline", // 下划线
|
||||
"fontborder", // 字符边框
|
||||
"strikethrough",// 删除线
|
||||
"superscript", // 上标
|
||||
"subscript", // 下标
|
||||
"removeformat", // 清除格式
|
||||
"formatmatch", // 格式刷
|
||||
"autotypeset", // 自动排版
|
||||
"blockquote", // 引用
|
||||
"pasteplain", // 纯文本粘贴模式
|
||||
"|",
|
||||
"forecolor", // 字体颜色
|
||||
"backcolor", // 背景色
|
||||
"insertorderedlist", // 有序列表
|
||||
"insertunorderedlist", // 无序列表
|
||||
"selectall", // 全选
|
||||
"cleardoc", // 清空文档
|
||||
"|",
|
||||
"rowspacingtop",// 段前距
|
||||
"rowspacingbottom", // 段后距
|
||||
"lineheight", // 行间距
|
||||
"|",
|
||||
"customstyle", // 自定义标题
|
||||
"paragraph", // 段落格式
|
||||
"fontfamily", // 字体
|
||||
"fontsize", // 字号
|
||||
"|",
|
||||
"directionalityltr", // 从左向右输入
|
||||
"directionalityrtl", // 从右向左输入
|
||||
"indent", // 首行缩进
|
||||
"|",
|
||||
"justifyleft", // 居左对齐
|
||||
"justifycenter", // 居中对齐
|
||||
"justifyright",
|
||||
"justifyjustify", // 两端对齐
|
||||
"|",
|
||||
"touppercase", // 字母大写
|
||||
"tolowercase", // 字母小写
|
||||
"|",
|
||||
"link", // 超链接
|
||||
"unlink", // 取消链接
|
||||
"anchor", // 锚点
|
||||
"|",
|
||||
"imagenone", // 图片默认
|
||||
"imageleft", // 图片左浮动
|
||||
"imageright", // 图片右浮动
|
||||
"imagecenter", // 图片居中
|
||||
"|",
|
||||
"simpleupload", // 单图上传
|
||||
"insertimage", // 多图上传
|
||||
"emotion", // 表情
|
||||
"scrawl", // 涂鸦
|
||||
// "insertvideo", // 视频
|
||||
// "attachment", // 附件
|
||||
"insertframe", // 插入Iframe
|
||||
"insertcode", // 插入代码
|
||||
"pagebreak", // 分页
|
||||
"template", // 模板
|
||||
"background", // 背景
|
||||
"formula", // 公式
|
||||
"|",
|
||||
"horizontal", // 分隔线
|
||||
"date", // 日期
|
||||
"time", // 时间
|
||||
"spechars", // 特殊字符
|
||||
"wordimage", // Word图片转存
|
||||
"|",
|
||||
"inserttable", // 插入表格
|
||||
"deletetable", // 删除表格
|
||||
"insertparagraphbeforetable", // 表格前插入行
|
||||
"insertrow", // 前插入行
|
||||
"deleterow", // 删除行
|
||||
"insertcol", // 前插入列
|
||||
"deletecol", // 删除列
|
||||
"mergecells", // 合并多个单元格
|
||||
"mergeright", // 右合并单元格
|
||||
"mergedown", // 下合并单元格
|
||||
"splittocells", // 完全拆分单元格
|
||||
"splittorows", // 拆分成行
|
||||
"splittocols", // 拆分成列
|
||||
"contentimport", // 内容导入(支持Word、Markdown)
|
||||
"|",
|
||||
"print", // 打印
|
||||
"preview", // 预览
|
||||
"searchreplace", // 查询替换
|
||||
"help", // 帮助
|
||||
]
|
||||
]
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.uebox {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import { createApp } from 'vue'
|
||||
import './style.css'
|
||||
import App from './App.vue'
|
||||
import router from './router/index.js'
|
||||
import locale from 'element-plus/lib/locale/lang/zh-cn'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import * as Icons from '@element-plus/icons-vue'
|
||||
import commonJs from './assets/js/common'
|
||||
import VueUeditorWrap from 'vue-ueditor-wrap';
|
||||
|
||||
|
||||
|
||||
const app = createApp(App)
|
||||
for (let i in Icons) {
|
||||
app.component(i, Icons[i])
|
||||
}
|
||||
app.use(router).use(ElementPlus, { locale })
|
||||
app.use(VueUeditorWrap)
|
||||
app.config.globalProperties.$commonJs = commonJs
|
||||
app.mount('#app')
|
||||
@@ -0,0 +1,101 @@
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/login'
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
meta: {
|
||||
title: '登录'
|
||||
},
|
||||
component: () => import('../view/Login.vue')
|
||||
},
|
||||
{
|
||||
path: '/home',
|
||||
name: '主页',
|
||||
meta: {
|
||||
title: '主页'
|
||||
},
|
||||
component: () => import('../view/Home.vue'),
|
||||
redirect: '/index',
|
||||
children: [
|
||||
{
|
||||
path: '/index',
|
||||
meta: {
|
||||
title: '大赛介绍'
|
||||
},
|
||||
component: () => import('../view/Welcome.vue')
|
||||
},
|
||||
{
|
||||
path: '/rules',
|
||||
meta: {
|
||||
title: '投票规则'
|
||||
},
|
||||
component: () => import('../view/Rules.vue')
|
||||
},
|
||||
{
|
||||
path: '/votetime',
|
||||
meta: {
|
||||
title: '投票时间'
|
||||
},
|
||||
component: () => import('../view/voteTime.vue')
|
||||
},
|
||||
{
|
||||
path: '/articlelist',
|
||||
meta: {
|
||||
title: '图文科普'
|
||||
},
|
||||
component: () => import('../view/articleList.vue')
|
||||
},
|
||||
{
|
||||
path: '/videolist',
|
||||
meta: {
|
||||
title: '视频科普'
|
||||
},
|
||||
component: () => import('../view/videoList.vue')
|
||||
},
|
||||
{
|
||||
path: '/user/list',
|
||||
meta: {
|
||||
title: '用户管理'
|
||||
},
|
||||
component: () => import('../view/user/Index.vue'),
|
||||
},
|
||||
{
|
||||
path: '/user/detail',
|
||||
meta: {
|
||||
title: '用户详情'
|
||||
},
|
||||
component: () => import('../view/user/Detail.vue'),
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes
|
||||
})
|
||||
// 挂载路由导航守卫:to表示将要访问的路径,from表示从哪里来,next是下一个要做的操作
|
||||
router.beforeEach((to, from, next) => {
|
||||
// 修改页面 title
|
||||
if (to.meta.title) {
|
||||
document.title = '肝胆英雄榜投票后台 - ' + to.meta.title
|
||||
}
|
||||
// 放行登录页面
|
||||
if (to.path === '/login') {
|
||||
return next()
|
||||
}
|
||||
// 获取token
|
||||
// const token= sessionStorage.getItem('tokens')
|
||||
// if (!token) {
|
||||
// return next('/login')
|
||||
// } else {
|
||||
// next()
|
||||
// }
|
||||
return next()
|
||||
})
|
||||
|
||||
// 导出路由
|
||||
export default router
|
||||
@@ -0,0 +1,17 @@
|
||||
html,
|
||||
body {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* 表格统一样式 */
|
||||
.el-table .el-table__header-wrapper thead th,
|
||||
.el-table .el-table__fixed-header-wrapper thead th {
|
||||
padding: 0;
|
||||
background-color: #F9F9F9;
|
||||
height: 50px;
|
||||
line-height: 40px;
|
||||
color: #283543;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import axios from "axios";
|
||||
import router from "../../router/index";
|
||||
import { ElMessage } from 'element-plus'
|
||||
// 1. 创建axios实例
|
||||
const instance = axios.create({
|
||||
// 接口
|
||||
baseURL: import.meta.env.VITE_BASE_URL+"",
|
||||
// 超时时间
|
||||
timeout: 50000,
|
||||
headers:{
|
||||
'Content-Type':'application/x-www-form-urlencoded',
|
||||
}
|
||||
});
|
||||
// 2.请求拦截
|
||||
instance.interceptors.request.use(
|
||||
config => {
|
||||
let token = sessionStorage.getItem('tokens')
|
||||
if (token) {
|
||||
config.headers['Authorization'] = token
|
||||
}
|
||||
return config;
|
||||
},
|
||||
error => {
|
||||
// 请求发生错误,抛出异常
|
||||
Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
// 3.响应拦截
|
||||
instance.interceptors.response.use(
|
||||
res => {
|
||||
return res;
|
||||
},
|
||||
error => {
|
||||
if (error && error.response) {
|
||||
const status = error.response.status
|
||||
router.push("/login");
|
||||
switch (status) {
|
||||
case 400:
|
||||
ElMessage.error("请求错误");
|
||||
break;
|
||||
case 401:
|
||||
ElMessage.error("未授权,请重新登录");
|
||||
break;
|
||||
case 403:
|
||||
ElMessage.error("拒绝访问");
|
||||
break;
|
||||
case 404:
|
||||
ElMessage.error("请求错误,未找到相应的资源");
|
||||
break;
|
||||
case 408:
|
||||
ElMessage.error("请求超时");
|
||||
break;
|
||||
case 500:
|
||||
ElMessage.error("服务器内部错误");
|
||||
break;
|
||||
case 501:
|
||||
ElMessage.error("网络未实现");
|
||||
break;
|
||||
case 502:
|
||||
ElMessage.error("网络错误");
|
||||
break;
|
||||
case 503:
|
||||
ElMessage.error("服务不可用");
|
||||
break;
|
||||
case 504:
|
||||
ElMessage.error("网络超时");
|
||||
break;
|
||||
case 505:
|
||||
ElMessage.error("HTTP版本不支持该请求");
|
||||
break;
|
||||
default:
|
||||
ElMessage.error("请求失败");
|
||||
}
|
||||
} else {
|
||||
if (JSON.stringify(error).includes("timeout")) {
|
||||
ElMessage.error("服务器响应超时,请刷新页面");
|
||||
}
|
||||
ElMessage.error("连接服务器失败");
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
// 4.导出 axios 实例
|
||||
export default instance;
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
import axios from "axios";
|
||||
import { ElMessage } from 'element-plus'
|
||||
import router from "../../router/index";
|
||||
// 1. 创建axios实例
|
||||
const instances = axios.create({
|
||||
// 接口
|
||||
baseURL: import.meta.env.VITE_BASE_URL+"",
|
||||
// 超时时间
|
||||
timeout: 50000,
|
||||
headers:{
|
||||
'Content-Type':'application/json',
|
||||
}
|
||||
});
|
||||
// 2.请求拦截
|
||||
instances.interceptors.request.use(
|
||||
config => {
|
||||
let token = sessionStorage.getItem('tokens')
|
||||
if (token) {
|
||||
config.headers['Authorization'] = token
|
||||
}
|
||||
return config;
|
||||
},
|
||||
error => {
|
||||
// 请求发生错误,抛出异常
|
||||
Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
// 3.响应拦截
|
||||
instances.interceptors.response.use(
|
||||
res => {
|
||||
return res;
|
||||
},
|
||||
error => {
|
||||
if (error && error.response) {
|
||||
const status = error.response.status
|
||||
router.push("/login");
|
||||
switch (status) {
|
||||
case 400:
|
||||
ElMessage.error("请求错误");
|
||||
break;
|
||||
case 401:
|
||||
ElMessage.error("未授权,请重新登录");
|
||||
break;
|
||||
case 403:
|
||||
ElMessage.error("拒绝访问");
|
||||
break;
|
||||
case 404:
|
||||
ElMessage.error("请求错误,未找到相应的资源");
|
||||
break;
|
||||
case 408:
|
||||
ElMessage.error("请求超时");
|
||||
break;
|
||||
case 500:
|
||||
ElMessage.error("服务器内部错误");
|
||||
break;
|
||||
case 501:
|
||||
ElMessage.error("网络未实现");
|
||||
break;
|
||||
case 502:
|
||||
ElMessage.error("网络错误");
|
||||
break;
|
||||
case 503:
|
||||
ElMessage.error("服务不可用");
|
||||
break;
|
||||
case 504:
|
||||
ElMessage.error("网络超时");
|
||||
break;
|
||||
case 505:
|
||||
ElMessage.error("HTTP版本不支持该请求");
|
||||
break;
|
||||
default:
|
||||
ElMessage.error("请求失败");
|
||||
}
|
||||
} else {
|
||||
if (JSON.stringify(error).includes("timeout")) {
|
||||
ElMessage.error("服务器响应超时,请刷新页面");
|
||||
}
|
||||
ElMessage.error("连接服务器失败");
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
// 4.导出 axios 实例
|
||||
export default instances;
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import instance from "./axios"
|
||||
import instances from "./axiosnew"
|
||||
const post = (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
instance.post(url, data).then(res => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
const posts = (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
instances.post(url, data).then(res => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
const get = (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
instance.get(url, { params: data }).then(res => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
const put = (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
instance.put(url, data).then(res => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
const puts = (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
instances.put(url, data).then(res => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const del = (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
instance.delete(url, { params: data }).then(res => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
post, get, put, del,posts,puts
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-container class="home-container">
|
||||
<!-- header -->
|
||||
<el-header>
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
<p class="system-name">肝胆英雄榜投票后台</p>
|
||||
</el-col>
|
||||
<el-col :offset="12" :span="8" style="min-width: 150px">
|
||||
<el-dropdown style="float: right; margin: 20px 10px">
|
||||
<span class="el-dropdown-link" style="color: #fff; cursor: pointer">
|
||||
{{ username }} <el-icon class="el-icon--right">
|
||||
<arrow-down />
|
||||
</el-icon>
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click.native="logout">退出系统</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-avatar shape="square" src="https://doc.igandan.com/app/html/img/2016/20160714132557.png"
|
||||
style="margin: 10px; float: right"></el-avatar>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-header>
|
||||
<el-container style="overflow: auto">
|
||||
<!-- 菜单 -->
|
||||
<el-aside>
|
||||
<div class="toggle-button" @click="isCollapse = !isCollapse">
|
||||
<el-icon :size="20">
|
||||
<Expand v-if="isCollapse" />
|
||||
<Fold v-if="!isCollapse" />
|
||||
</el-icon>
|
||||
</div>
|
||||
<el-menu router :default-active="$route.path" class="el-menu-vertical-demo" :collapse="isCollapse">
|
||||
<el-sub-menu index="1">
|
||||
<template #title>
|
||||
<span>英雄榜</span>
|
||||
</template>
|
||||
<el-menu-item-group>
|
||||
<el-menu-item index="/index" @click="saveActiveNav('/index')">大赛介绍</el-menu-item>
|
||||
<el-menu-item index="/rules" @click="saveActiveNav('/rules')">投票规则</el-menu-item>
|
||||
<el-menu-item index="/votetime" @click="saveActiveNav('/votetime')">投票时间</el-menu-item>
|
||||
</el-menu-item-group>
|
||||
</el-sub-menu>
|
||||
<el-sub-menu index="2">
|
||||
<template #title>
|
||||
|
||||
<span>参赛作品</span>
|
||||
</template>
|
||||
<el-menu-item-group>
|
||||
<!-- <el-menu-item index="/articlelist" @click="saveActiveNav('/articlelist')">图文科普</el-menu-item> -->
|
||||
<el-menu-item index="/videolist" @click="saveActiveNav('/videolist')">视频科普</el-menu-item>
|
||||
|
||||
</el-menu-item-group>
|
||||
</el-sub-menu>
|
||||
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
<el-container>
|
||||
<el-main>
|
||||
<!-- 面包屑 -->
|
||||
<!-- <Breadcrumb /> -->
|
||||
<!-- 主要内容 -->
|
||||
<router-view></router-view>
|
||||
</el-main>
|
||||
<el-footer>Copyright © 2024 肝胆相照技术</el-footer>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onBeforeMount, ref } from 'vue';
|
||||
|
||||
import { useRouter } from 'vue-router'
|
||||
const router = useRouter();
|
||||
// 挂载 DOM 之前
|
||||
onBeforeMount(() => {
|
||||
activePath.value = sessionStorage.getItem("activePaths")
|
||||
? sessionStorage.getItem("activePaths")
|
||||
: "/index"
|
||||
})
|
||||
let isCollapse = ref(false);
|
||||
let activePath = ref("");
|
||||
// 保存链接的激活状态
|
||||
const saveActiveNav = (path) => {
|
||||
sessionStorage.setItem("activePaths", path);
|
||||
activePath.value = path;
|
||||
}
|
||||
const logout = () => {
|
||||
// 清除缓存
|
||||
sessionStorage.clear();
|
||||
router.push("/login");
|
||||
}
|
||||
const username = ref('')
|
||||
onMounted(() => {
|
||||
username.value = localStorage.getItem("usernames")
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.home-container {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
background: #f2f3f5;
|
||||
}
|
||||
|
||||
.el-header {
|
||||
background: #2661ef;
|
||||
padding: 0 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.system-name {
|
||||
color: #fff;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.el-aside {
|
||||
background: white;
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
.el-menu-vertical-demo:not(.el-menu--collapse) {
|
||||
width: 200px;
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.el-footer {
|
||||
color: #cccccc;
|
||||
text-align: center;
|
||||
line-height: 60px;
|
||||
}
|
||||
|
||||
.el-footer:hover {
|
||||
color: #2661ef;
|
||||
}
|
||||
|
||||
.toggle-button {
|
||||
background-color: #d9e0e7;
|
||||
font-size: 18px;
|
||||
line-height: 24px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
letter-spacing: 0.2em;
|
||||
cursor: pointer;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.el-menu-vertical-demo:not(.el-menu--collapse) {
|
||||
width: 200px;
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.el-menu-item.is-active {
|
||||
color: #fff !important;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
background-color: #2661ef !important;
|
||||
border-radius: 2px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
box-sizing: border-box;
|
||||
margin: 2px 5px 0px 2px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div style="width:700px">
|
||||
<p style="float: left;">
|
||||
<el-icon color="#409EFF" :size="50">
|
||||
<ElementPlus />
|
||||
</el-icon>
|
||||
</p>
|
||||
<p style="float: left;font-size: 25px; font-weight: bold">
|
||||
欢迎来到肝胆英雄榜投票后台管理系统
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</el-header>
|
||||
<el-main>
|
||||
<el-card class="login_card">
|
||||
<el-form :model="form" :rules="rules" ref="ruleFormRef" label-width="80px">
|
||||
<el-form-item label="账号:" prop="access">
|
||||
<el-input v-model="form.access" placeholder="请输入账号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码:" prop="password">
|
||||
<el-input type="password" placeholder="请输入密码" v-model="form.password" />
|
||||
</el-form-item>
|
||||
|
||||
<div class="codes">
|
||||
<el-form-item prop="code" >
|
||||
<el-input placeholder="请输入验证码" v-model="form.captcha" />
|
||||
</el-form-item>
|
||||
<el-image style="width: 120px; height: 40px;margin-left: 10px;" :src="b64s" fit="fill" @click="changecode" />
|
||||
</div>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit()">登录</el-button>
|
||||
<el-button type="primary" @click="resetForm()">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-main>
|
||||
<!-- <el-footer>
|
||||
<p>关于我们 | 联系我们 | 人才招聘 | 广告服务 | 友情链接 | 知否社区 | 知否公益</p>
|
||||
<p>Copyright © 2001-2022 <el-tag>公众号:知否技术</el-tag></p>
|
||||
</el-footer> -->
|
||||
</el-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import userApi from "../api/user";
|
||||
import { reactive, ref, getCurrentInstance, onMounted } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import router from "../router/index";
|
||||
const { proxy } = getCurrentInstance();
|
||||
const form = reactive({
|
||||
// access: "admin",
|
||||
// password: "123456",
|
||||
access: "",
|
||||
password: "",
|
||||
captcha: "",
|
||||
captchaId: "",
|
||||
});
|
||||
const ruleFormRef = ref();
|
||||
const rules = reactive({
|
||||
access: [{ required: true, message: "账号不能为空", trigger: "blur" }],
|
||||
password: [{ required: true, message: "密码不能为空", trigger: "blur" }],
|
||||
captcha: [{ required: true, message: "验证码不能为空", trigger: "blur" }],
|
||||
});
|
||||
const b64s =ref('')
|
||||
|
||||
const onSubmit = () => {
|
||||
if (!ruleFormRef) return;
|
||||
ruleFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const res = await userApi.login(form);
|
||||
if (res.data) {
|
||||
|
||||
if (res.data.code==200) {
|
||||
// proxy.$commonJs.changeView('/home');
|
||||
sessionStorage.setItem("tokens", 'Bearer '+res.data.data.token);
|
||||
localStorage.setItem("usernames",form.access);
|
||||
router.push("/index");
|
||||
} else {
|
||||
ElMessage.error(res.data.message);
|
||||
}
|
||||
} else {
|
||||
ElMessage.error("服务器内部错误");
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
const resetForm = () => {
|
||||
if (!ruleFormRef) return;
|
||||
ruleFormRef.value.resetFields();
|
||||
};
|
||||
onMounted(()=>{
|
||||
changecode()
|
||||
})
|
||||
const changecode = () => {
|
||||
userApi.getcaptcha().then(res=>{
|
||||
b64s.value = res.data.data.b64s
|
||||
form.captchaId = res.data.data.id
|
||||
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-container {
|
||||
height: 100vh;
|
||||
background-image: url("../assets/img/bg.jpg");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.el-header {
|
||||
height: 10%;
|
||||
}
|
||||
|
||||
.el-main {
|
||||
height: 80%;
|
||||
/* background-image: url("../assets/img/bg.jpg");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 120%;
|
||||
background-position-y: bottom; */
|
||||
}
|
||||
|
||||
.login_card {
|
||||
margin: 100px 200px;
|
||||
width: 20%;
|
||||
min-width: 300px;
|
||||
height: 270px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.el-footer {
|
||||
height: 10%;
|
||||
text-align: center;
|
||||
}
|
||||
.codes{
|
||||
display: flex;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<el-card>
|
||||
<HeaderView title1="英雄榜" title2="投票规则"/>
|
||||
|
||||
<!-- <div >
|
||||
<vue-ueditor-wrap v-model="content" editor-id="editor" :config="request.editorConfig"
|
||||
:editorDependencies="['ueditor.config.js', 'ueditor.all.js','lang/zh-cn/zh-cn.js']" />
|
||||
</div> -->
|
||||
<div class="myeditor" style="margin-top: 20px;" >
|
||||
<ueditor :modelValue="content" @changeData="changeData"></ueditor>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div style="display: flex;justify-content: center;margin-top:32px;width: 1500px;" >
|
||||
<el-button type="primary" text size="large" @click="drawer = true" >预览</el-button>
|
||||
<el-button size="large" @click="open('温馨提示','确定要取消输入吗')" >取消</el-button>
|
||||
<el-button type="primary" size="large" @click="open('温馨提示','确定要保存输入吗')" >保存</el-button>
|
||||
</div>
|
||||
|
||||
<el-drawer v-model="drawer" title="" >
|
||||
<phoneVew :htmlContent="content"></phoneVew>
|
||||
</el-drawer>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import request from "../api/request.js";
|
||||
import { ElMessageBox ,ElMessage} from 'element-plus'
|
||||
|
||||
const drawer = ref(false)
|
||||
const content = ref('');
|
||||
const orgincontent = ref('');
|
||||
const changeData=(data)=>{
|
||||
content.value = data;
|
||||
|
||||
}
|
||||
onMounted(() => {
|
||||
getindexs()
|
||||
|
||||
|
||||
})
|
||||
const param = reactive({
|
||||
page_size: "10",
|
||||
page: "1",
|
||||
|
||||
});
|
||||
const updateparam = reactive({
|
||||
agreement_title: "",
|
||||
agreement_content:"",
|
||||
|
||||
});
|
||||
const getindexs = () => {
|
||||
request.agreement(2).then(res => {
|
||||
|
||||
content.value= res.data.data.agreement_content
|
||||
orgincontent.value= res.data.data.agreement_content
|
||||
|
||||
})
|
||||
}
|
||||
let rescode,message;
|
||||
const open = (titles,spans) => {
|
||||
ElMessageBox({
|
||||
title: titles,
|
||||
message: h('p', null, [
|
||||
h('span', null, spans),
|
||||
|
||||
]),
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
instance.confirmButtonLoading = true
|
||||
instance.confirmButtonText = '提交中...'
|
||||
if('确定要取消输入吗'==spans){
|
||||
|
||||
content.value=orgincontent.value
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
}
|
||||
else{
|
||||
updateparam.agreement_content=content.value
|
||||
request.updateagreement(2,updateparam).then(res => {
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
rescode = res.data.code
|
||||
message = res.data.message
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
done()
|
||||
}
|
||||
},
|
||||
}).then((action) => {
|
||||
if('确定要取消输入吗'==spans)
|
||||
{
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '已取消输入',
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(rescode!=200)
|
||||
{
|
||||
ElMessage.error(message);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '提交成功',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.main {
|
||||
|
||||
background: white;
|
||||
height: 100%vh;
|
||||
/* background-image: url("../assets/img/index.gif");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
background-position-y: bottom; */
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<el-card>
|
||||
<HeaderView title1="英雄榜" title2="大赛介绍" />
|
||||
<div class="myeditor" style="margin-top: 20px;" >
|
||||
<ueditor :modelValue="content" @changeData="changeData"></ueditor>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- <div>
|
||||
<vue-ueditor-wrap v-model="content" editor-id="editor" :config="request.editorConfig"
|
||||
:editorDependencies="['ueditor.config.js', 'ueditor.all.js', 'lang/zh-cn/zh-cn.js']" />
|
||||
</div> -->
|
||||
<div style="display: flex;justify-content: center;margin-top:32px;width: 1500px;">
|
||||
<el-button type="primary" text size="large" @click="drawer = true">预览</el-button>
|
||||
<el-button size="large" @click="open('温馨提示', '确定要取消输入吗')">取消</el-button>
|
||||
<el-button type="primary" size="large" @click="open('温馨提示', '确定要保存输入吗')">保存</el-button>
|
||||
</div>
|
||||
|
||||
<el-drawer v-model="drawer" title="">
|
||||
<phoneVew :htmlContent="content"></phoneVew>
|
||||
</el-drawer>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import request from "../api/request.js";
|
||||
import { ElMessageBox, ElMessage } from 'element-plus'
|
||||
|
||||
|
||||
const drawer = ref(false)
|
||||
const content = ref('');
|
||||
const orgincontent = ref('');
|
||||
const changeData=(data)=>{
|
||||
content.value = data;
|
||||
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getindexs()
|
||||
})
|
||||
const param = reactive({
|
||||
page_size: "10",
|
||||
page: "1",
|
||||
|
||||
});
|
||||
const updateparam = reactive({
|
||||
agreement_title: "",
|
||||
agreement_content: "",
|
||||
|
||||
});
|
||||
|
||||
const getindexs = () => {
|
||||
request.agreement(1).then(res => {
|
||||
|
||||
content.value = res.data.data.agreement_content
|
||||
orgincontent.value = res.data.data.agreement_content
|
||||
|
||||
})
|
||||
}
|
||||
let rescode,message;
|
||||
const open = (titles, spans) => {
|
||||
ElMessageBox({
|
||||
title: titles,
|
||||
message: h('p', null, [
|
||||
h('span', null, spans),
|
||||
|
||||
]),
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
instance.confirmButtonLoading = true
|
||||
instance.confirmButtonText = '提交中...'
|
||||
if ('确定要取消输入吗' == spans) {
|
||||
|
||||
content.value = orgincontent.value
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
}
|
||||
else {
|
||||
updateparam.agreement_content = content.value
|
||||
request.updateagreement(1, updateparam).then(res => {
|
||||
done()
|
||||
rescode = res.data.code
|
||||
instance.confirmButtonLoading = false
|
||||
|
||||
message = res.data.message
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
done()
|
||||
}
|
||||
},
|
||||
}).then((action) => {
|
||||
if ('确定要取消输入吗' == spans) {
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '已取消输入',
|
||||
})
|
||||
}
|
||||
else {
|
||||
if(rescode!=200)
|
||||
{
|
||||
ElMessage.error(message);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '提交成功',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.main {
|
||||
|
||||
background: white;
|
||||
height: 100%vh;
|
||||
/* background-image: url("../assets/img/index.gif");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
background-position-y: bottom; */
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,664 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<el-card>
|
||||
<HeaderView title1="参赛作品" title2="图文科普" />
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-input style="width:300px" @clear="searchs" clearable v-model="searchForm.keyword" placeholder="请输入标题、作者或者医院"
|
||||
class="input-with-select">
|
||||
<template #append>
|
||||
<el-button icon="Search" @click="searchs" />
|
||||
</template>
|
||||
</el-input>
|
||||
|
||||
|
||||
<div style="margin-left: 32px;margin-right: 8px;"> 排序</div>
|
||||
<el-select v-model="value" placeholder="默认排序" size="large" style="width: 240px" @change="change(value)">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-button type="primary" style="margin-left: 32px;" size="large" @click="addnewOne()">添加</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :data="tableData" style="margin-top: 20px;">
|
||||
<el-table-column label="标题" width="280">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.article_title }}</span>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="作者1-医院" width="180">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.article_author.length > 0">
|
||||
<div>{{ scope.row.article_author[0].author_name }}</div>
|
||||
<div>{{ scope.row.article_author[0].hospital_name }}</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="作者2-医院" width="180">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.article_author.length > 1">
|
||||
<div>{{ scope.row.article_author[1].author_name }}</div>
|
||||
<div>{{ scope.row.article_author[1].hospital_name }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="作者3-医院" width="180">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.article_author.length > 2">
|
||||
<div>{{ scope.row.article_author[2].author_name }}</div>
|
||||
<div>{{ scope.row.article_author[2].hospital_name }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="创建时间" width="180">
|
||||
<template #default="scope">
|
||||
|
||||
|
||||
<span>{{ scope.row.created_at }}</span>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="投票数" width="180">
|
||||
<template #default="scope">
|
||||
|
||||
|
||||
<span>{{ scope.row.vote_num }}</span>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="400">
|
||||
<template #default="scope">
|
||||
<el-button size="large" @click="handleEdit(scope.$index, scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button size="large" @click="handleStatus(scope.$index, scope.row,'确定要隐藏该条数据吗')" v-if="scope.row.article_status == 1">
|
||||
隐藏
|
||||
</el-button>
|
||||
<el-button size="large" @click="handleStatus(scope.$index, scope.row,'确定要取消隐藏该条数据吗')" v-else>
|
||||
取消隐藏
|
||||
</el-button>
|
||||
<!-- <el-button size="large" @click="handleEdit(scope.$index, scope.row)">
|
||||
删除
|
||||
</el-button> -->
|
||||
<el-button size="large" @click="handleRecord(scope.$index, scope.row)">
|
||||
投票记录
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<el-pagination style="margin-top:20px" v-model:current-page="currentPage4" v-model:page-size="pageSize4"
|
||||
:page-sizes="[10, 20, 30, 40]" :size="size" :disabled="disabled" :background="background"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange" />
|
||||
</el-card>
|
||||
|
||||
<el-drawer v-model="drawer" direction="rtl" size='100%' :z-index="99" >
|
||||
<template #header>
|
||||
<h4>{{ edittitle }}</h4>
|
||||
</template>
|
||||
<template #default>
|
||||
<div>
|
||||
<div style="display: flex;align-items: center;">
|
||||
<span style="color: red;">*</span>
|
||||
<span style="margin-right: 16px;margin-left: 5px;">标题:</span>
|
||||
<el-input v-model="updateForm.article_title" style="width: 1400px" maxlength="100" placeholder="请输入标题"
|
||||
show-word-limit type="text" size="large" />
|
||||
</div>
|
||||
<div v-for="(item, index) of author_name " :key=index>
|
||||
<div style="margin-top: 10px;display: flex;;align-items: center;">
|
||||
<span style="color: red;">*</span>
|
||||
<span style="margin-right: 16px;margin-left: 5px;">作者:</span>
|
||||
<el-input v-model="item.author_name" style="width: 500px" maxlength="10" placeholder="请输入名字"
|
||||
show-word-limit type="text" size="large" />
|
||||
<el-select v-model="hospital_id[index].hospital_name" filterable remote placeholder="请输入单位"
|
||||
:remote-method="(val)=>{remoteMethod(val,index)}" :loading="loading" style="width: 440px;margin-left: 32px;"
|
||||
size="large"
|
||||
@change="(val)=>{chaneindex(val,index)}"
|
||||
>
|
||||
|
||||
<el-option v-for="item in optionss[index]" :key="item.hospital_id" :label="item.hospital_name"
|
||||
:value="item.hospital_id" />
|
||||
</el-select>
|
||||
<el-button type="primary" :icon="Plus" size="large" style="margin-left: 16px;" v-if="author_name.length < 3"
|
||||
@click="changeauther('add', index)" />
|
||||
<el-button type="primary" :icon="Minus" size="large" style="margin-left: 16px;"
|
||||
v-if="author_name.length > 1" @click="changeauther('remove', index)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div>
|
||||
<editor style="margin-top: 20px;text-align: left;" v-model="content" ></editor>
|
||||
</div> -->
|
||||
|
||||
<div class="myeditor" style="margin-top: 20px;" >
|
||||
<ueditor :modelValue="content" v-if="drawer" @changeData="changeData"></ueditor>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<template #footer>
|
||||
<div style="display: flex;justify-content: center;margin-top: 32px ;margin-bottom: 32px;padding:32px; ">
|
||||
<el-button type="primary" text size="large" @click="drawers = true">预览</el-button>
|
||||
<el-button size="large" @click="open('温馨提示', '确定要取消输入吗')">取消</el-button>
|
||||
<el-button type="primary" size="large" @click="open('温馨提示', '确定要保存吗')">保存</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-drawer>
|
||||
<el-drawer v-model="drawers" title="">
|
||||
<phoneVew :htmlContent="content" ></phoneVew>
|
||||
</el-drawer>
|
||||
<el-drawer v-model="drawers1" title="" size='50%' >
|
||||
<div style="width: 500px;">
|
||||
<el-table :data="tableData1" >
|
||||
<el-table-column label="open_id" width="300">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.open_id }}</span>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="投票时间" width="200">
|
||||
<template #default="scope">
|
||||
|
||||
<span>{{ scope.row.voted_at }}</span>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<el-pagination style="margin-top:20px" v-model:current-page="currentPage41" v-model:page-size="pageSize41"
|
||||
:page-sizes="[10, 20, 30, 40]" :size="size1" :disabled="disabled" :background="background"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total1" @size-change="handleSizeChange1"
|
||||
@current-change="handleCurrentChange1" />
|
||||
|
||||
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import request from "../api/request.js";
|
||||
import { ElMessageBox, ElMessage } from 'element-plus'
|
||||
import { Plus, Minus } from '@element-plus/icons-vue'
|
||||
import { nextTick } from "vue";
|
||||
|
||||
|
||||
|
||||
const loading = ref(false)
|
||||
const currentPage4 = ref(1)
|
||||
const pageSize4 = ref(10)
|
||||
const isedit = ref(false)
|
||||
const background = ref(false)
|
||||
const disabled = ref(false)
|
||||
const error = ref(false)
|
||||
const currentPage41 = ref(1)
|
||||
const pageSize41 = ref(10)
|
||||
|
||||
const showEditor=ref(false)
|
||||
|
||||
let total = ref(0);
|
||||
const size = ref('default')
|
||||
let total1 = ref(0);
|
||||
const size1 = ref('default')
|
||||
const edittitle = ref('图文科普')
|
||||
// 搜索条件
|
||||
const searchForm = reactive({
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
keyword: '',
|
||||
order: {
|
||||
|
||||
}
|
||||
})
|
||||
const searchhos = reactive({
|
||||
hospital_name: '',
|
||||
|
||||
})
|
||||
const updateFormid = ref()
|
||||
const updateForm = ref({
|
||||
article_title: '',
|
||||
article_author: [],
|
||||
article_content: '',
|
||||
article_status: ''
|
||||
|
||||
})
|
||||
const updateStatus = ref({
|
||||
article_status: '',
|
||||
|
||||
|
||||
})
|
||||
const voteform = ref({
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
article_id: '',
|
||||
|
||||
})
|
||||
const drawers = ref(false)
|
||||
const drawers1 = ref(false)
|
||||
const content = ref('');
|
||||
const orgincontent = ref('');
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getindexs()
|
||||
|
||||
|
||||
})
|
||||
const getindexs = () => {
|
||||
request.getarticle(searchForm).then(res => {
|
||||
tableData.value = []
|
||||
|
||||
tableData.value.push(...res.data.data.data)
|
||||
|
||||
total.value = res.data.data.total
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
const changeData=(data)=>{
|
||||
content.value = data;
|
||||
|
||||
}
|
||||
const changeauther = (type, index) => {
|
||||
|
||||
if (type == 'add') {
|
||||
author_name.value.push({
|
||||
author_name: '',
|
||||
|
||||
})
|
||||
|
||||
hospital_id.value.push({
|
||||
|
||||
hospital_id: '',
|
||||
hospital_name: '',
|
||||
})
|
||||
} else {
|
||||
author_name.value.splice(index, 1);
|
||||
|
||||
hospital_id.value.splice(index, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const change = (index) => {
|
||||
console.log(index)
|
||||
if (index == '') {
|
||||
searchForm.order = {}
|
||||
} else {
|
||||
searchForm.order = {
|
||||
vote_num: index
|
||||
}
|
||||
}
|
||||
searchs()
|
||||
|
||||
}
|
||||
|
||||
const value = ref('')
|
||||
|
||||
const options = [
|
||||
{
|
||||
value: '',
|
||||
label: '创建时间',
|
||||
},
|
||||
{
|
||||
value: 'desc',
|
||||
label: '投票从高到低',
|
||||
},
|
||||
{
|
||||
value: 'asc',
|
||||
label: '投票从低到高',
|
||||
},
|
||||
|
||||
]
|
||||
const addnewOne = () => {
|
||||
isedit.value = false
|
||||
drawer.value = true;
|
||||
|
||||
showEditor.value = false;
|
||||
|
||||
nextTick(() => {
|
||||
showEditor.value = true
|
||||
})
|
||||
|
||||
updateForm.value.article_title = ''
|
||||
updateForm.value.article_status = 1
|
||||
content.value = ''
|
||||
updateForm.value.article_content = ''
|
||||
updateForm.value.article_author = []
|
||||
author_name.value = []
|
||||
|
||||
hospital_id.value = []
|
||||
|
||||
author_name.value.push({
|
||||
author_name: '',
|
||||
|
||||
})
|
||||
|
||||
hospital_id.value.push({
|
||||
|
||||
hospital_id: '',
|
||||
hospital_name: '',
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const handleSizeChange1 = (valr) => {
|
||||
|
||||
voteform.value.page_size = valr
|
||||
vot()
|
||||
}
|
||||
const handleCurrentChange1 = (val) => {
|
||||
|
||||
voteform.value.page = val
|
||||
vot()
|
||||
}
|
||||
|
||||
|
||||
const handleRecord = (index, row) => {
|
||||
drawers1.value = true
|
||||
voteform.value.article_id = row.article_id
|
||||
|
||||
vot()
|
||||
|
||||
}
|
||||
const vot = () => {
|
||||
request.getvote(voteform.value).then(res => {
|
||||
tableData1.value = []
|
||||
|
||||
tableData1.value.push(...res.data.data.data)
|
||||
total1.value = res.data.data.total
|
||||
|
||||
})
|
||||
}
|
||||
let rescode,message;
|
||||
const handleStatus = (index, row,spans) => {
|
||||
ElMessageBox({
|
||||
title: "温馨提示",
|
||||
message: h('p', null, [
|
||||
h('span', null, spans),
|
||||
|
||||
]),
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
instance.confirmButtonLoading = true
|
||||
instance.confirmButtonText = '提交中...'
|
||||
updateStatus.value.article_status = row.article_status==1?2:1
|
||||
|
||||
request.putstatus(row.article_id,updateStatus.value).then(res => {
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
searchs()
|
||||
rescode = res.data.code
|
||||
message = res.data.message
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
done()
|
||||
}
|
||||
},
|
||||
}).then((action) => {
|
||||
|
||||
if(rescode!=200)
|
||||
{
|
||||
ElMessage.error(message);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '提交成功',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
const handleEdit = (index, row) => {
|
||||
isedit.value = true
|
||||
console.log(row)
|
||||
drawer.value = true;
|
||||
|
||||
|
||||
updateFormid.value = row.article_id
|
||||
updateForm.value.article_title = row.article_title
|
||||
updateForm.value.article_status = row.article_status
|
||||
content.value = row.article_content
|
||||
updateForm.value.article_content = row.article_content
|
||||
updateForm.value.article_author = []
|
||||
updateForm.value.article_author.push(...row.article_author)
|
||||
author_name.value = []
|
||||
|
||||
hospital_id.value = []
|
||||
for (let i = 0; i < row.article_author.length; i++) {
|
||||
author_name.value.push({
|
||||
author_name: row.article_author[i].author_name,
|
||||
|
||||
})
|
||||
|
||||
hospital_id.value.push({
|
||||
|
||||
hospital_id: row.article_author[i].hospital_id,
|
||||
hospital_name: row.article_author[i].hospital_name,
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
const handleDelete = (index, row) => {
|
||||
console.log(index, row)
|
||||
}
|
||||
|
||||
const tableData = ref([
|
||||
// {
|
||||
// article_title:'566',
|
||||
// article_author:[],
|
||||
// created_at: '2016-05-03 13:32',
|
||||
// name: 'Tom',
|
||||
// vote_num: 123,
|
||||
// address: 'No. 189, Grove St, Los Angeles',
|
||||
// },
|
||||
|
||||
])
|
||||
const tableData1 = ref([
|
||||
|
||||
|
||||
])
|
||||
|
||||
const author_name = ref([
|
||||
|
||||
]);
|
||||
|
||||
const hospital_id = ref([
|
||||
|
||||
]);
|
||||
const handleSizeChange = (valr) => {
|
||||
|
||||
searchForm.page_size = valr
|
||||
getindexs()
|
||||
}
|
||||
const handleCurrentChange = (val) => {
|
||||
|
||||
searchForm.page = val
|
||||
getindexs()
|
||||
}
|
||||
const optionss = ref([
|
||||
[], [], []
|
||||
])
|
||||
const remoteMethod = (query,index) => {
|
||||
console.log("query"+''+query+index)
|
||||
if(query)
|
||||
{
|
||||
|
||||
searchhos.hospital_name=query
|
||||
request.gethospital(searchhos).then(res => {
|
||||
|
||||
|
||||
optionss.value[index] = []
|
||||
|
||||
optionss.value[index].push(...res.data.data)
|
||||
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function chaneindex(val,index)
|
||||
{
|
||||
console.log("changeoptionss"+index)
|
||||
|
||||
hospital_id.value[index].hospital_id = val
|
||||
|
||||
}
|
||||
|
||||
|
||||
const drawer = ref(false)
|
||||
// watch(drawer, (newValue, oldValue) => {
|
||||
// if(drawer.value == false) {
|
||||
// window.location.reload();
|
||||
// }
|
||||
// })
|
||||
const open = (titles, spans) => {
|
||||
ElMessageBox({
|
||||
title: titles,
|
||||
message: h('p', null, [
|
||||
h('span', null, spans),
|
||||
|
||||
]),
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
instance.confirmButtonLoading = true
|
||||
instance.confirmButtonText = '提交中...'
|
||||
if ('确定要取消输入吗' == spans) {
|
||||
error.value = true
|
||||
drawer.value = false;
|
||||
|
||||
showEditor.value = false;
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
}
|
||||
else {
|
||||
|
||||
updateForm.value.article_author = []
|
||||
for (let i = 0; i < author_name.value.length; i++) {
|
||||
if (hospital_id.value[i].hospital_id != '' && author_name.value[i].author_name != '') {
|
||||
updateForm.value.article_author.push({
|
||||
author_name: author_name.value[i].author_name,
|
||||
hospital_id: hospital_id.value[i].hospital_id
|
||||
|
||||
})
|
||||
}
|
||||
else {
|
||||
error.value = true
|
||||
|
||||
break
|
||||
|
||||
}
|
||||
}
|
||||
updateForm.value.article_content = content.value
|
||||
if (updateForm.value.article_title == '' || updateForm.value.article_content == '') {
|
||||
error.value = true
|
||||
}
|
||||
|
||||
if (error.value) {
|
||||
open4();
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if (isedit.value) {
|
||||
|
||||
request.putarticle(updateFormid.value, updateForm.value).then(res => {
|
||||
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
searchs()
|
||||
drawer.value = false;
|
||||
|
||||
showEditor.value = false;
|
||||
})
|
||||
}
|
||||
else {
|
||||
request.putarticles(updateForm.value).then(res => {
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
searchs()
|
||||
|
||||
drawer.value = false;
|
||||
|
||||
showEditor.value = false;
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
done()
|
||||
}
|
||||
},
|
||||
}).then((action) => {
|
||||
|
||||
if (!error.value) {
|
||||
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '提交成功',
|
||||
})
|
||||
|
||||
}
|
||||
else {
|
||||
error.value = false
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
const open4 = () => {
|
||||
ElMessage({
|
||||
|
||||
message: '请填写必选项',
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
const searchs = () => {
|
||||
pageSize4.value = 10
|
||||
currentPage4.value = 1
|
||||
searchForm.page_size = 10
|
||||
searchForm.page = 1
|
||||
getindexs()
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
.main {
|
||||
|
||||
background: white;
|
||||
height: 100%vh;
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card class="box-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>用户详情</span>
|
||||
<el-button size="mini" style="float:right" @click="router.go(-1)">返回</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<el-form>
|
||||
<el-form-item label="姓名:">
|
||||
{{ userDetail.name }}
|
||||
</el-form-item>
|
||||
<el-form-item label="年龄:">
|
||||
{{ userDetail.age }}
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onBeforeMount, reactive, ref } from 'vue';
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import userApi from "../../api/user";
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const userDetail = reactive({
|
||||
id: ''
|
||||
})
|
||||
onBeforeMount(async () => {
|
||||
if (route.query.id) {
|
||||
const res = await userApi.getUserDetail({ id: route.query.id })
|
||||
Object.assign(userDetail, res.data.data);
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-input style="width:440px" @clear="searchUser" clearable v-model="searchForm.name" placeholder="请输入用户姓名" class="input-with-select">
|
||||
<template #append>
|
||||
<el-button icon="Search" @click="searchUser" />
|
||||
</template>
|
||||
</el-input>
|
||||
<el-table :data="tableData" border style="width: 100%;margin-top:20px">
|
||||
<el-table-column prop="name" label="姓名" width="180" />
|
||||
<el-table-column prop="age" label="年龄" width="180" />
|
||||
<el-table-column label="操作" width="330">
|
||||
<template #default="scope">
|
||||
<el-button type="danger" size="small" @click="deleteUser(scope.row.id)">删除</el-button>
|
||||
<el-button size="small"
|
||||
@click="() => router.push({ path: '/user/detail', query: { id: scope.row.id } })">详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<el-pagination style="margin-top:20px" :current-page="searchForm.current" :page-size="searchForm.size"
|
||||
:page-sizes="[10, 20, 30, 40]" layout="->,total, sizes, prev, pager, next, jumper" :total="total"
|
||||
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import userApi from "../../api/user";
|
||||
import { onMounted, reactive, ref } from "vue";
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { useRouter } from 'vue-router'
|
||||
const router = useRouter();
|
||||
// Dom 挂载之后
|
||||
onMounted(() => {
|
||||
getUserList();
|
||||
})
|
||||
// 用户数据
|
||||
let tableData = ref([]);
|
||||
let total = ref(0);
|
||||
// 搜索条件
|
||||
const searchForm = reactive({
|
||||
current: 1,
|
||||
size: 10,
|
||||
name: ''
|
||||
})
|
||||
// 获取用户列表
|
||||
const getUserList = async () => {
|
||||
const res = await userApi.getUserList(searchForm);
|
||||
console.log(res);
|
||||
tableData.value = res.data.data.records;
|
||||
total.value = res.data.data.total;
|
||||
}
|
||||
const handleSizeChange = (size) => {
|
||||
searchForm.size = size;
|
||||
getUserList();
|
||||
}
|
||||
const handleCurrentChange = (current) => {
|
||||
searchForm.current = current;
|
||||
getUserList();
|
||||
}
|
||||
const searchUser = () => {
|
||||
searchForm.current = 1;
|
||||
getUserList();
|
||||
}
|
||||
// 删除用户
|
||||
const deleteUser = (id) => {
|
||||
ElMessageBox.confirm(
|
||||
'确定要删除该用户信息吗?',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(async () => {
|
||||
const res = await userApi.delUser({ id: id });
|
||||
if (res.data.success) {
|
||||
ElMessage.success("删除成功")
|
||||
getUserList();
|
||||
} else {
|
||||
ElMessage.error("删除失败")
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '取消删除',
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,656 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<el-card>
|
||||
<HeaderView title1="参赛作品" title2="视频科普" />
|
||||
<div style="display: flex;align-items: center;">
|
||||
<el-input style="width:300px" @clear="searchs" clearable v-model="searchForm.keyword" placeholder="请输入标题、作者或者医院"
|
||||
class="input-with-select">
|
||||
<template #append>
|
||||
<el-button icon="Search" @click="searchs" />
|
||||
</template>
|
||||
</el-input>
|
||||
|
||||
|
||||
<div style="margin-left: 32px;margin-right: 8px;"> 排序</div>
|
||||
<el-select v-model="value" placeholder="默认排序" size="large" style="width: 240px" @change="change(value)">
|
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-button type="primary" style="margin-left: 32px;" size="large" @click="addnewOne()">添加</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :data="tableData" style="margin-top: 20px;">
|
||||
<el-table-column label="标题" width="280">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.video_title }}</span>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="作者1-医院" width="180">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.video_author.length > 0">
|
||||
<div>{{ scope.row.video_author[0].author_name }}</div>
|
||||
<div>{{ scope.row.video_author[0].hospital_name }}</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="作者2-医院" width="180">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.video_author.length > 1">
|
||||
<div>{{ scope.row.video_author[1].author_name }}</div>
|
||||
<div>{{ scope.row.video_author[1].hospital_name }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="作者3-医院" width="180">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.video_author.length > 2">
|
||||
<div>{{ scope.row.video_author[2].author_name }}</div>
|
||||
<div>{{ scope.row.video_author[2].hospital_name }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="创建时间" width="180">
|
||||
<template #default="scope">
|
||||
|
||||
|
||||
<span>{{ scope.row.created_at }}</span>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="投票数" width="180">
|
||||
<template #default="scope">
|
||||
|
||||
|
||||
<span>{{ scope.row.vote_num }}</span>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="400">
|
||||
<template #default="scope">
|
||||
<el-button size="large" @click="handleEdit(scope.$index, scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button size="large" @click="handleStatus(scope.$index, scope.row,'确定要隐藏该条数据吗')" v-if="scope.row.video_status == 1">
|
||||
隐藏
|
||||
</el-button>
|
||||
<el-button size="large" @click="handleStatus(scope.$index, scope.row,'确定要取消隐藏该条数据吗')" v-else>
|
||||
取消隐藏
|
||||
</el-button>
|
||||
<!-- <el-button size="large" @click="handleEdit(scope.$index, scope.row)">
|
||||
删除
|
||||
</el-button> -->
|
||||
<el-button size="large" @click="handleRecord(scope.$index, scope.row)">
|
||||
投票记录
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<el-pagination style="margin-top:20px" v-model:current-page="currentPage4" v-model:page-size="pageSize4"
|
||||
:page-sizes="[10, 20, 30, 40]" :size="size" :disabled="disabled" :background="background"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange" />
|
||||
</el-card>
|
||||
|
||||
<el-drawer v-model="drawer" direction="rtl" size='100%' :z-index="99" >
|
||||
<template #header>
|
||||
<h4>{{ edittitle }}</h4>
|
||||
</template>
|
||||
<template #default>
|
||||
<div>
|
||||
<div style="display: flex;align-items: center;">
|
||||
<span style="color: red;">*</span>
|
||||
<span style="margin-right: 16px;margin-left: 5px;">标题:</span>
|
||||
<el-input v-model="updateForm.video_title" style="width: 1400px" maxlength="100" placeholder="请输入标题"
|
||||
show-word-limit type="text" size="large" />
|
||||
</div>
|
||||
<div v-for="(item, index) of author_name " :key=index>
|
||||
<div style="margin-top: 10px;display: flex;;align-items: center;">
|
||||
<span style="color: red;">*</span>
|
||||
<span style="margin-right: 16px;margin-left: 5px;">作者:</span>
|
||||
<el-input v-model="item.author_name" style="width: 500px" maxlength="10" placeholder="请输入名字"
|
||||
show-word-limit type="text" size="large" />
|
||||
<el-select v-model="hospital_id[index].hospital_name" filterable remote placeholder="请输入单位"
|
||||
:remote-method="(val)=>{remoteMethod(val,index)}" :loading="loading" style="width: 440px;margin-left: 32px;"
|
||||
size="large"
|
||||
@change="(val)=>{chaneindex(val,index)}"
|
||||
>
|
||||
|
||||
<el-option v-for="item in optionss[index]" :key="item.hospital_id" :label="item.hospital_name"
|
||||
:value="item.hospital_id" />
|
||||
</el-select>
|
||||
<el-button type="primary" :icon="Plus" size="large" style="margin-left: 16px;" v-if="author_name.length < 3"
|
||||
@click="changeauther('add', index)" />
|
||||
<el-button type="primary" :icon="Minus" size="large" style="margin-left: 16px;"
|
||||
v-if="author_name.length > 1" @click="changeauther('remove', index)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;align-items: center;">
|
||||
<span style="color: red;">*</span>
|
||||
<span style="margin-right: 16px;margin-left: 5px;">VID:</span>
|
||||
<el-input v-model="updateForm.video_no" style="width: 500px;margin-top: 10px;" placeholder="请输入视频VID"
|
||||
type="text" size="large" />
|
||||
</div>
|
||||
|
||||
<div class="myediotr" style="margin-top: 20px;" >
|
||||
<ueditor :modelValue="content" v-if="drawer" @changeData="changeData" ></ueditor>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<template #footer>
|
||||
<div style="display: flex;justify-content: center;margin-top: 32px ;margin-bottom: 32px;padding:32px; ">
|
||||
<el-button type="primary" text size="large" @click="drawers = true">预览</el-button>
|
||||
<el-button size="large" @click="open('温馨提示', '确定要取消输入吗')">取消</el-button>
|
||||
<el-button type="primary" size="large" @click="open('温馨提示', '确定要保存吗')">保存</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-drawer>
|
||||
<el-drawer v-model="drawers" title="">
|
||||
<phoneVew :htmlContent="content"></phoneVew>
|
||||
</el-drawer>
|
||||
<el-drawer v-model="drawers1" title="" size='50%' >
|
||||
<div style="width: 500px;">
|
||||
<el-table :data="tableData1" >
|
||||
<el-table-column label="open_id" width="300">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.open_id }}</span>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="投票时间" width="200">
|
||||
<template #default="scope">
|
||||
|
||||
<span>{{ scope.row.voted_at }}</span>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<el-pagination style="margin-top:20px" v-model:current-page="currentPage41" v-model:page-size="pageSize41"
|
||||
:page-sizes="[10, 20, 30, 40]" :size="size1" :disabled="disabled" :background="background"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total1" @size-change="handleSizeChange1"
|
||||
@current-change="handleCurrentChange1" />
|
||||
|
||||
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import request from "../api/request.js";
|
||||
import { ElMessageBox, ElMessage } from 'element-plus'
|
||||
import { Plus, Minus } from '@element-plus/icons-vue'
|
||||
import { nextTick } from "vue";
|
||||
|
||||
const loading = ref(false)
|
||||
const currentPage4 = ref(1)
|
||||
const pageSize4 = ref(10)
|
||||
const isedit = ref(false)
|
||||
const background = ref(false)
|
||||
const disabled = ref(false)
|
||||
const error = ref(false)
|
||||
const currentPage41 = ref(1)
|
||||
const pageSize41 = ref(10)
|
||||
|
||||
let total = ref(0);
|
||||
const size = ref('default')
|
||||
let total1 = ref(0);
|
||||
const size1 = ref('default')
|
||||
const edittitle = ref('视频科普')
|
||||
|
||||
|
||||
|
||||
// 搜索条件
|
||||
const searchForm = reactive({
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
keyword: '',
|
||||
order: {
|
||||
|
||||
}
|
||||
})
|
||||
const updateFormid = ref()
|
||||
const updateForm = ref({
|
||||
video_title: '',
|
||||
video_author: [],
|
||||
video_content: '',
|
||||
video_status: '',
|
||||
video_no:''
|
||||
|
||||
})
|
||||
|
||||
const showEditor=ref(false);
|
||||
const updateStatus = ref({
|
||||
video_status: '',
|
||||
|
||||
|
||||
})
|
||||
const voteform = ref({
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
video_id: '',
|
||||
|
||||
})
|
||||
const drawers = ref(false)
|
||||
const drawers1 = ref(false)
|
||||
const content = ref('');
|
||||
|
||||
const orgincontent = ref('');
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getindexs()
|
||||
|
||||
|
||||
})
|
||||
const changeData=(data)=>{
|
||||
content.value = data;
|
||||
|
||||
}
|
||||
const getindexs = () => {
|
||||
request.getavideo(searchForm).then(res => {
|
||||
tableData.value = []
|
||||
|
||||
tableData.value.push(...res.data.data.data)
|
||||
|
||||
total.value = res.data.data.total
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
const changeauther = (type, index) => {
|
||||
if (type == 'add') {
|
||||
author_name.value.push({
|
||||
author_name: '',
|
||||
|
||||
})
|
||||
|
||||
hospital_id.value.push({
|
||||
|
||||
hospital_id: '',
|
||||
hospital_name: '',
|
||||
})
|
||||
} else {
|
||||
author_name.value.splice(index, 1);
|
||||
|
||||
hospital_id.value.splice(index, 1);
|
||||
}
|
||||
|
||||
}
|
||||
function chaneindex(val,index)
|
||||
{
|
||||
console.log("changeoptionss"+index)
|
||||
|
||||
hospital_id.value[index].hospital_id = val
|
||||
|
||||
}
|
||||
|
||||
|
||||
const change = (index) => {
|
||||
console.log(index)
|
||||
if (index == '') {
|
||||
searchForm.order = {}
|
||||
} else {
|
||||
searchForm.order = {
|
||||
vote_num: index
|
||||
}
|
||||
}
|
||||
searchs()
|
||||
|
||||
}
|
||||
|
||||
const value = ref('')
|
||||
|
||||
const options = [
|
||||
{
|
||||
value: '',
|
||||
label: '创建时间',
|
||||
},
|
||||
{
|
||||
value: 'desc',
|
||||
label: '投票从高到低',
|
||||
},
|
||||
{
|
||||
value: 'asc',
|
||||
label: '投票从低到高',
|
||||
},
|
||||
|
||||
]
|
||||
const addnewOne = () => {
|
||||
isedit.value = false
|
||||
drawer.value = true;
|
||||
|
||||
showEditor.value = false;
|
||||
|
||||
|
||||
nextTick(() => {
|
||||
showEditor.value = true;
|
||||
})
|
||||
|
||||
updateForm.value.video_title = ''
|
||||
updateForm.value.video_status = 1
|
||||
content.value = ''
|
||||
updateForm.value.video_no = ''
|
||||
updateForm.value.video_content = ''
|
||||
updateForm.value.video_author = []
|
||||
author_name.value = []
|
||||
|
||||
hospital_id.value = []
|
||||
|
||||
author_name.value.push({
|
||||
author_name: '',
|
||||
|
||||
})
|
||||
|
||||
hospital_id.value.push({
|
||||
|
||||
hospital_id: '',
|
||||
hospital_name: '',
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const handleSizeChange1 = (valr) => {
|
||||
|
||||
voteform.value.page_size = valr
|
||||
vot()
|
||||
}
|
||||
const handleCurrentChange1 = (val) => {
|
||||
|
||||
voteform.value.page = val
|
||||
vot()
|
||||
}
|
||||
|
||||
|
||||
const handleRecord = (index, row) => {
|
||||
drawers1.value = true
|
||||
voteform.value.video_id = row.video_id
|
||||
|
||||
vot()
|
||||
|
||||
}
|
||||
const vot = () => {
|
||||
request.getvideovote(voteform.value).then(res => {
|
||||
tableData1.value = []
|
||||
|
||||
tableData1.value.push(...res.data.data.data)
|
||||
total1.value = res.data.data.total
|
||||
|
||||
})
|
||||
}
|
||||
let rescode,message;
|
||||
const handleStatus = (index, row,spans) => {
|
||||
ElMessageBox({
|
||||
title: "温馨提示",
|
||||
message: h('p', null, [
|
||||
h('span', null, spans),
|
||||
|
||||
]),
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
instance.confirmButtonLoading = true
|
||||
instance.confirmButtonText = '提交中...'
|
||||
updateStatus.value.video_status = row.video_status==1?2:1
|
||||
|
||||
request.putvideostatus(row.video_id,updateStatus.value).then(res => {
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
searchs()
|
||||
rescode = res.data.code
|
||||
message = res.data.message
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
done()
|
||||
}
|
||||
},
|
||||
}).then((action) => {
|
||||
|
||||
if(rescode!=200)
|
||||
{
|
||||
ElMessage.error(message);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '提交成功',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
const handleEdit = (index, row) => {
|
||||
isedit.value = true
|
||||
console.log(row)
|
||||
drawer.value = true;
|
||||
|
||||
//showEditor.value = false;
|
||||
|
||||
updateFormid.value = row.video_id
|
||||
updateForm.value.video_title = row.video_title
|
||||
updateForm.value.video_status = row.video_status
|
||||
content.value = row.video_content
|
||||
updateForm.value.video_no = row.video_no
|
||||
updateForm.value.video_content = row.video_content
|
||||
updateForm.value.video_author = []
|
||||
updateForm.value.video_author.push(...row.video_author)
|
||||
author_name.value = []
|
||||
|
||||
hospital_id.value = []
|
||||
for (let i = 0; i < row.video_author.length; i++) {
|
||||
author_name.value.push({
|
||||
author_name: row.video_author[i].author_name,
|
||||
|
||||
})
|
||||
|
||||
hospital_id.value.push({
|
||||
|
||||
hospital_id: row.video_author[i].hospital_id,
|
||||
hospital_name: row.video_author[i].hospital_name,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
const handleDelete = (index, row) => {
|
||||
console.log(index, row)
|
||||
}
|
||||
|
||||
const tableData = ref([
|
||||
|
||||
|
||||
])
|
||||
const tableData1 = ref([
|
||||
|
||||
|
||||
])
|
||||
|
||||
const author_name = ref([
|
||||
|
||||
]);
|
||||
|
||||
const hospital_id = ref([
|
||||
|
||||
]);
|
||||
const handleSizeChange = (valr) => {
|
||||
|
||||
searchForm.page_size = valr
|
||||
getindexs()
|
||||
}
|
||||
const handleCurrentChange = (val) => {
|
||||
|
||||
searchForm.page = val
|
||||
getindexs()
|
||||
}
|
||||
const optionss = ref([
|
||||
[], [], []
|
||||
])
|
||||
const searchhos = reactive({
|
||||
hospital_name: '',
|
||||
|
||||
})
|
||||
const remoteMethod =(query,index) => {
|
||||
|
||||
|
||||
if(query)
|
||||
{
|
||||
|
||||
searchhos.hospital_name=query
|
||||
request.gethospital(searchhos).then(res => {
|
||||
|
||||
|
||||
optionss.value[index] = []
|
||||
|
||||
optionss.value[index].push(...res.data.data)
|
||||
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const drawer = ref(false)
|
||||
// watch(drawer, (newValue, oldValue) => {
|
||||
// if(drawer.value == false) {
|
||||
// window.location.reload();
|
||||
// }
|
||||
// })
|
||||
const open = (titles, spans) => {
|
||||
ElMessageBox({
|
||||
title: titles,
|
||||
message: h('p', null, [
|
||||
h('span', null, spans),
|
||||
|
||||
]),
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
instance.confirmButtonLoading = true
|
||||
instance.confirmButtonText = '提交中...'
|
||||
if ('确定要取消输入吗' == spans) {
|
||||
error.value = true
|
||||
drawer.value = false;
|
||||
|
||||
showEditor.value = false;
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
}
|
||||
else {
|
||||
|
||||
updateForm.value.video_author = []
|
||||
for (let i = 0; i < author_name.value.length; i++) {
|
||||
if (hospital_id.value[i].hospital_id != '' && author_name.value[i].author_name != '') {
|
||||
updateForm.value.video_author.push({
|
||||
author_name: author_name.value[i].author_name,
|
||||
hospital_id: hospital_id.value[i].hospital_id
|
||||
|
||||
})
|
||||
}
|
||||
else {
|
||||
error.value = true
|
||||
|
||||
break
|
||||
|
||||
}
|
||||
}
|
||||
updateForm.value.video_content = content.value
|
||||
if (updateForm.value.video_title == '' || updateForm.value.video_no == '') {
|
||||
error.value = true
|
||||
}
|
||||
|
||||
if (error.value) {
|
||||
open4();
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if (isedit.value) {
|
||||
request.putavideo(updateFormid.value, updateForm.value).then(res => {
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
searchs()
|
||||
drawer.value = false;
|
||||
|
||||
showEditor.value = false;
|
||||
})
|
||||
}
|
||||
else {
|
||||
request.putavideos(updateForm.value).then(res => {
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
searchs()
|
||||
drawer.value = false;
|
||||
|
||||
showEditor.value = false;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
done()
|
||||
}
|
||||
},
|
||||
}).then((action) => {
|
||||
|
||||
if (!error.value) {
|
||||
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '提交成功',
|
||||
})
|
||||
}
|
||||
else {
|
||||
error.value = false
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
const open4 = () => {
|
||||
ElMessage({
|
||||
|
||||
message: '请填写必选项',
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
const searchs = () => {
|
||||
pageSize4.value = 10
|
||||
currentPage4.value = 1
|
||||
searchForm.page_size = 10
|
||||
searchForm.page = 1
|
||||
getindexs()
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
.main {
|
||||
|
||||
background: white;
|
||||
height: 100%vh;
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<el-card>
|
||||
<HeaderView title1="英雄榜" title2="投票时间"/>
|
||||
<div>
|
||||
<div >
|
||||
<span style="margin-right: 32px;">投票时间</span>
|
||||
<el-date-picker
|
||||
v-model="value2"
|
||||
type="daterange"
|
||||
unlink-panels
|
||||
range-separator="-"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
size="large"
|
||||
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: center;margin-top: 32px ;margin-bottom: 32px;padding:32px; " >
|
||||
|
||||
<el-button size="large" @click="puttime('温馨提示','确定要取消输入吗')">取消</el-button>
|
||||
<el-button type="primary" size="large" @click="puttime('温馨提示','确定要保存吗')">保存</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import request from "../api/request.js";
|
||||
import dayjs from "dayjs"
|
||||
import { ElMessageBox ,ElMessage} from 'element-plus'
|
||||
const value1 = ref([])
|
||||
const value2 = ref([])
|
||||
|
||||
const times = reactive({
|
||||
start_time: "",
|
||||
end_time: "",
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getindexs()
|
||||
|
||||
|
||||
})
|
||||
const getindexs = () => {
|
||||
request.gettime().then(res => {
|
||||
|
||||
|
||||
value2.value.push(new Date(res.data.data.start_time))
|
||||
value2.value.push(new Date(res.data.data.end_time))
|
||||
value1.value.push(new Date(res.data.data.start_time))
|
||||
value1.value.push(new Date(res.data.data.end_time))
|
||||
})
|
||||
}
|
||||
let rescode,message;
|
||||
const puttime = (titles,spans) => {
|
||||
ElMessageBox({
|
||||
title: titles,
|
||||
message: h('p', null, [
|
||||
h('span', null, spans),
|
||||
|
||||
]),
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
instance.confirmButtonLoading = true
|
||||
instance.confirmButtonText = '提交中...'
|
||||
if('确定要取消输入吗'==spans){
|
||||
|
||||
value2.value=[]
|
||||
value2.value.push(value1.value[0])
|
||||
value2.value.push(value1.value[1])
|
||||
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
}
|
||||
else{
|
||||
times.start_time= dayjs(value2.value[0]).format('YYYY-MM-DD HH:mm:ss')
|
||||
times.end_time=dayjs(value2.value[1]).format('YYYY-MM-DD HH:mm:ss')
|
||||
console.log(times)
|
||||
request.updatetime(times).then(res => {
|
||||
done()
|
||||
instance.confirmButtonLoading = false
|
||||
rescode = res.data.code
|
||||
message = res.data.message
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
done()
|
||||
}
|
||||
},
|
||||
}).then((action) => {
|
||||
if('确定要取消输入吗'==spans)
|
||||
{
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '已取消输入',
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
if(rescode!=200)
|
||||
{
|
||||
ElMessage.error(message);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '提交成功',
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.main {
|
||||
text-align: center;
|
||||
background: white;
|
||||
height: 100%vh;
|
||||
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user