Merge branch 'main' into zhuhao_dev
# Conflicts: # src/renderer/src/layout/index.vue
This commit is contained in:
commit
36989c5ba3
|
@ -8,8 +8,8 @@ File({ app, shell, BrowserWindow, ipcMain })
|
|||
function createWindow() {
|
||||
// Create the browser window.
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 1050,
|
||||
height: 650,
|
||||
width: 888,
|
||||
height: 520,
|
||||
show: false,
|
||||
frame: false,
|
||||
autoHideMenuBar: true,
|
||||
|
@ -107,4 +107,5 @@ ipcMain.on('close-window', () => {
|
|||
ipcMain.on('set-winsize', (e, {x, y})=>{
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
win.setSize(x,y);
|
||||
win.center()
|
||||
})
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { ref } from 'vue'
|
||||
|
||||
const size = ref('default')
|
||||
// const size = computed(() => store.state.app.elementSize)
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
|
|
@ -7,4 +7,13 @@ export const listEvaluation = (params)=> {
|
|||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const addFileToPrepare = (params) => {
|
||||
return request({
|
||||
url: '/smarttalk/file/addFileToPrepare',
|
||||
method: 'post',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
|
|
@ -37,4 +37,13 @@ export function getUserProfile() {
|
|||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 修改用户,这个不涉及到用户的权限、角色更新
|
||||
export function updateUserInfo(data) {
|
||||
return request({
|
||||
url: '/system/user/updateUserInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
|
@ -231,7 +231,7 @@ const getSubject = async () => {
|
|||
subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject && isHaveUnit(item.id))
|
||||
localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
|
||||
}
|
||||
|
||||
|
||||
// 默认第一个
|
||||
curBookName.value = subjectList.value[0].itemtitle
|
||||
curBookId.value = subjectList.value[0].id
|
||||
|
@ -305,6 +305,7 @@ onMounted(() => {
|
|||
border-bottom: solid #f4f5f7 1px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
border-radius: 10px 10px 0 0;
|
||||
}
|
||||
|
||||
.book-list {
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
<template>
|
||||
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="500"
|
||||
top="25vh"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
style="border-radius: 5px;padding-top: 0;">
|
||||
<div class="dialog-title flex">
|
||||
<span>选择你的年级、学科</span>
|
||||
</div>
|
||||
<div class="dialog-content">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="年级">
|
||||
<el-select v-model="gradeVal" style="width: 120px;" @change="changeGrade">
|
||||
<el-option v-for="item in gradeList" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学科">
|
||||
<el-select v-model="subjectVal" style="width: 130px;">
|
||||
<el-option v-for="item in subjectList" :key="item.id" :label="item.itemtitle" :value="item.itemtitle" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="editUserInfo">
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch, defineProps, defineEmits } from 'vue'
|
||||
import { listEvaluation } from '@/api/subject'
|
||||
import { updateUserInfo } from '@/api/system/user'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const { userId, userName } = userStore.user
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
})
|
||||
|
||||
// 定义要发送的emit事件
|
||||
const emit = defineEmits(['update:modelValue', 'onSuccess'])
|
||||
|
||||
const gradeList = ref([
|
||||
{
|
||||
label: '高中',
|
||||
value: '高中'
|
||||
},
|
||||
{
|
||||
label: '初中',
|
||||
value: '初中'
|
||||
},
|
||||
{
|
||||
label: '小学',
|
||||
value: '小学'
|
||||
},
|
||||
{
|
||||
label: '幼儿园',
|
||||
value: '幼儿园'
|
||||
},
|
||||
]
|
||||
)
|
||||
const subjectVal = ref('')
|
||||
const gradeVal = ref('')
|
||||
// 默认第一项
|
||||
gradeVal.value = gradeList.value[0].value
|
||||
//学科列表数据
|
||||
const subjectList = ref([])
|
||||
const allSubject = ref([])
|
||||
const dialogVisible = ref(false)
|
||||
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
dialogVisible.value = newVal
|
||||
})
|
||||
|
||||
//切换年级
|
||||
const changeGrade = ()=>{
|
||||
// 切换年级 过滤出对应学科数据
|
||||
subjectList.value = allSubject.value.filter( item => item.edustage == gradeVal.value)
|
||||
if(!subjectList.value.length){
|
||||
subjectVal.value = ''
|
||||
return
|
||||
}
|
||||
// 默认选中第一个学科
|
||||
subjectVal.value = subjectList.value[0].itemtitle
|
||||
}
|
||||
// 获取学科数据
|
||||
|
||||
const getSubject = async ()=>{
|
||||
const { rows } = await listEvaluation({ itemkey: "subject", pageSize: 500 })
|
||||
// 所有学科
|
||||
allSubject.value = rows;
|
||||
// 根据默认第一个年级(gradeVal) 拿到学科数据
|
||||
subjectList.value = rows.filter( item => item.edustage == gradeVal.value)
|
||||
if(!subjectList.value.length) return
|
||||
// 默认选中第一个学科
|
||||
subjectVal.value = subjectList.value[0].itemtitle
|
||||
}
|
||||
|
||||
// 修改用户年级 学科
|
||||
const editUserInfo = async () =>{
|
||||
const data = {
|
||||
userId,
|
||||
userName,
|
||||
edustage: subjectVal.value,
|
||||
edusubject: gradeVal.value
|
||||
}
|
||||
await updateUserInfo(data)
|
||||
await userStore.getInfo()
|
||||
emit('onSuccess')
|
||||
}
|
||||
|
||||
|
||||
onMounted(getSubject)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dialog-title {
|
||||
justify-content: space-between;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #000;
|
||||
|
||||
.icon-close {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-content {
|
||||
padding: 30px 20px 10px 30px;
|
||||
}
|
||||
|
||||
.dialog-footer{
|
||||
text-align: center;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
|
@ -17,6 +17,9 @@ import Uploader from './components/Uploader.vue'
|
|||
import uploaderState from '@/store/modules/uploader'
|
||||
import { ref } from 'vue'
|
||||
let uploaderStore = ref(uploaderState())
|
||||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
ipcRenderer ? ipcRenderer .send('set-winsize', { x: 1200, y: 700 }) : ''
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -12,7 +12,7 @@ export const constantRoutes = [
|
|||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
redirect: '/resource',
|
||||
redirect: '/login',
|
||||
children: [
|
||||
{
|
||||
path: '/resource',
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<!--选择学科-->
|
||||
<SelectSubject v-model="isSubject" v-if="isSubject" class="select-subject" @onSuccess="successEditSubject" />
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
|
@ -42,13 +44,15 @@ import Cookies from 'js-cookie'
|
|||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import leftBg2 from '@/assets/images/login/left-bg2.png'
|
||||
import SelectSubject from '@/components/select-subject/index.vue'
|
||||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const formRef = ref()
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const isMaxSize = ref(false)
|
||||
const btnLoading = ref(false)
|
||||
const isSubject = ref(false)
|
||||
//表单
|
||||
const loginForm = reactive({
|
||||
username: '',
|
||||
|
@ -61,6 +65,8 @@ const rules = reactive({
|
|||
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }]
|
||||
})
|
||||
|
||||
ipcRenderer ? ipcRenderer.send('set-winsize', { x: 888, y: 520 }) : ''
|
||||
|
||||
//登录
|
||||
const submitForm = async (formEl) => {
|
||||
if (!formEl) return
|
||||
|
@ -81,8 +87,14 @@ const submitForm = async (formEl) => {
|
|||
try{
|
||||
await userStore.login(loginForm)
|
||||
await userStore.getInfo()
|
||||
ElMessage.success('登录成功')
|
||||
router.push('/resource')
|
||||
if(userStore.user.edustage || userStore.user.edusubject){
|
||||
ElMessage.success('登录成功')
|
||||
router.push('/resource')
|
||||
}
|
||||
else{
|
||||
isSubject.value = true
|
||||
}
|
||||
|
||||
|
||||
}finally{
|
||||
btnLoading.value = false
|
||||
|
@ -91,6 +103,12 @@ const submitForm = async (formEl) => {
|
|||
})
|
||||
}
|
||||
|
||||
const successEditSubject = ()=>{
|
||||
isSubject.value = false
|
||||
ElMessage.success('登录成功')
|
||||
router.push('/resource')
|
||||
}
|
||||
|
||||
const getCookie = () => {
|
||||
const username = Cookies.get('username')
|
||||
const password = Cookies.get('password')
|
||||
|
@ -101,7 +119,6 @@ const getCookie = () => {
|
|||
}
|
||||
|
||||
onMounted(()=>{
|
||||
// ipcRenderer.send('set-winsize',{x:888,y: 520})
|
||||
getCookie()
|
||||
})
|
||||
// 最小化
|
||||
|
@ -206,4 +223,7 @@ const closeWindow = () => {
|
|||
.el-form-item {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.select-subject{
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
<ul>
|
||||
<li class="list-item" v-for="item in sourceStore.result.list" :key="item.id">
|
||||
<div class="item-left flex">
|
||||
<FileImage :fileName="item.fileName" :size="50" />
|
||||
<FileImage :fileName="item.fileShowName" :size="50" />
|
||||
<div class="flex item-left-content">
|
||||
<div class="name flex">{{ item.fileShowName }}</div>
|
||||
<div class="item-tags flex">
|
||||
<el-tag type="info" class="mr-10">{{ item.fileFlag }}</el-tag>
|
||||
<el-tag type="info" class="mr-10">{{ getFileSuffix(item.fileName) }}</el-tag>
|
||||
<el-tag type="info" class="mr-10">{{ getFileSuffix(item.fileShowName) }}</el-tag>
|
||||
<span class="gray-text mr-10">{{ item.uploadTime }}上传</span>
|
||||
<!-- <span class="line mr-10"></span>
|
||||
<span class="gray-text mr-10">下载3次</span> -->
|
||||
|
@ -37,15 +37,11 @@
|
|||
<i class="iconfont icon-xiazai"></i>
|
||||
<span>下载</span>
|
||||
</div>
|
||||
<div class="item-popover-item" @click="moveFile(item)">
|
||||
<i class="iconfont icon-xiazai"></i>
|
||||
<span>移动至</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
</el-popover>
|
||||
|
||||
<el-button size="small" plain round type="primary">
|
||||
<el-button size="small" plain round type="primary" @click="addLesson(item)">
|
||||
<i class="iconfont icon-jiahao"></i>
|
||||
备课</el-button>
|
||||
</div>
|
||||
|
@ -58,28 +54,37 @@
|
|||
:page-sizes="[10, 20, 30, 50]" background layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="sourceStore.result.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { toRaw } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import FileImage from '@/components/file-image/index.vue'
|
||||
import { deleteSmarttalk, updateSmarttalk } from '@/api/file'
|
||||
import { addFileToPrepare } from '@/api/subject'
|
||||
import { getFileSuffix } from '@/utils/ruoyi'
|
||||
import useResoureStore from '../store'
|
||||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const sourceStore = useResoureStore()
|
||||
const handleSizeChange = () => { }
|
||||
const handleCurrentChange = () => { }
|
||||
|
||||
// 分页change
|
||||
const handleSizeChange = (limit) => {
|
||||
sourceStore.query.pageSize = limit
|
||||
sourceStore.handleQuery()
|
||||
}
|
||||
const handleCurrentChange = (page) => {
|
||||
sourceStore.query.pageNum = page
|
||||
sourceStore.handleQuery()
|
||||
}
|
||||
|
||||
// 下载文件
|
||||
const downloadFile = (item) => {
|
||||
ipcRenderer.send('save-as', item.fileFullPath, item.fileShowName)
|
||||
}
|
||||
|
||||
// 编辑行
|
||||
const editRow = (item) => {
|
||||
console.log(item.fileShowName.substring(0, item.fileShowName.lastIndexOf('.')))
|
||||
ElMessageBox.prompt('请输入新的名称', '重命名', {
|
||||
|
@ -114,11 +119,32 @@ const delRow = (item) => {
|
|||
}
|
||||
}
|
||||
|
||||
// 移动
|
||||
const moveFile = (item) => {
|
||||
moveDialogVisible.value = true
|
||||
// 加入备课
|
||||
const addLesson = ({ id }) => {
|
||||
let data = {
|
||||
id,
|
||||
fileRoot: '资源',
|
||||
...(toRaw(sourceStore.nodeData)),
|
||||
}
|
||||
// 过滤空值
|
||||
for (let key in data) {
|
||||
if (!data[key]) {
|
||||
delete data[key]
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
sourceStore.loading = true
|
||||
addFileToPrepare(data).then(() => {
|
||||
ElMessage.success('操作成功')
|
||||
})
|
||||
}
|
||||
finally {
|
||||
sourceStore.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
</el-row>
|
||||
<el-row class="resoure-btns">
|
||||
<el-col :span="24" class="query-row flex">
|
||||
<div class="flex row-left"> <el-select v-model="sourceStore.query.fileSuffix"
|
||||
style="width: 100px">
|
||||
<div class="flex row-left"> <el-select v-model="sourceStore.query.fileSuffix" @change="sourceStore.changeSuffix"
|
||||
style="width: 110px">
|
||||
<el-option v-for="item in sourceStore.resourceFormatList" :key="item.value" :label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select>
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
</div>
|
||||
<!-- 上传弹窗 -->
|
||||
<uploadDialog v-model="isDialogOpen" @submitFile="submitFile" />
|
||||
<!-- <MoveFile v-model="isDialogOpen" @onSubmit="onSubmit" /> -->
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -26,14 +25,11 @@ import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
|||
import ResoureSearch from './container/resoure-search.vue'
|
||||
import ResoureList from './container/resoure-list.vue'
|
||||
import uploadDialog from '@/components/upload-dialog/index.vue'
|
||||
import MoveFile from '@/components/move-file/index.vue'
|
||||
import uploaderState from '@/store/modules/uploader'
|
||||
|
||||
|
||||
const sourceStore = useResoureStore()
|
||||
const isDialogOpen = ref(false)
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
// ipcRenderer.send('set-winsize',{x:1100,y: 700})
|
||||
|
||||
|
||||
const openDialog = () => {
|
||||
isDialogOpen.value = true
|
||||
|
@ -55,24 +51,32 @@ const nodeClick = (data) => {
|
|||
// 查询
|
||||
const getData = (data) => {
|
||||
const { textBook, node } = data
|
||||
let textBookId = textBook.curBookId
|
||||
|
||||
let textbookId = textBook.curBookId
|
||||
console.log(textbookId)
|
||||
let levelFirstId = node.id
|
||||
let levelSecondId = node.parentNode ? node.parentNode.id : ''
|
||||
sourceStore.query = {
|
||||
textBookId,
|
||||
levelFirstId,
|
||||
levelSecondId,
|
||||
...sourceStore.query
|
||||
}
|
||||
sourceStore.query.textbookId = textbookId
|
||||
sourceStore.nodeData = {
|
||||
textbookId,
|
||||
levelFirstId,
|
||||
levelSecondId,
|
||||
}
|
||||
|
||||
sourceStore.handleQuery()
|
||||
}
|
||||
|
||||
// 提交文件
|
||||
const submitFile = (data) => {
|
||||
let fileList = toRaw(data)
|
||||
const { textBookId, levelFirstId, levelSecondId, fileSource, fileRoot } = sourceStore.query
|
||||
const { textbookId, levelFirstId, levelSecondId, fileSource, fileRoot } = sourceStore.query
|
||||
// 给每个文件添加属性
|
||||
let fileData = { textBookId, levelFirstId, levelSecondId, fileSource, fileRoot }
|
||||
let fileData = { textbookId, levelFirstId, levelSecondId, fileSource, fileRoot }
|
||||
fileList.forEach(item => {
|
||||
fileData.fileShowName = item.fileData.fileShowName
|
||||
fileData.fileFlag = item.fileData.fileFlag
|
||||
|
|
|
@ -15,7 +15,7 @@ const resourceTypeList = [
|
|||
const resourceFormatList = [
|
||||
{
|
||||
label: '资源格式',
|
||||
value: ''
|
||||
value: -1
|
||||
},
|
||||
...resourceFormat
|
||||
]
|
||||
|
@ -42,11 +42,17 @@ export default defineStore('resource', {
|
|||
searchKey: '',
|
||||
// 新建资源
|
||||
isCreate: false,
|
||||
|
||||
//节点数据
|
||||
nodeData:{},
|
||||
loading: false,
|
||||
//查询条件
|
||||
query: {
|
||||
textbookId: '',
|
||||
fileSource: '平台',
|
||||
fileSuffix: '',
|
||||
//资源格式 mp3 ppt ...
|
||||
fileSuffix: -1,
|
||||
// 资源类型 课件 素材 教案
|
||||
fileFlag: '',
|
||||
fileRoot: '资源',
|
||||
orderByColumn: 'uploadTime',
|
||||
|
@ -62,7 +68,11 @@ export default defineStore('resource', {
|
|||
handleQuery() {
|
||||
try {
|
||||
this.loading = true
|
||||
getSmarttalkPage(this.query).then((res) => {
|
||||
let data = {...this.query}
|
||||
if(data.fileSuffix == -1){
|
||||
data.fileSuffix = ''
|
||||
}
|
||||
getSmarttalkPage(data).then((res) => {
|
||||
this.result.total = res.total
|
||||
this.result.list = res.rows
|
||||
})
|
||||
|
@ -77,6 +87,10 @@ export default defineStore('resource', {
|
|||
changeType(val) {
|
||||
this.query.fileFlag = val
|
||||
this.handleQuery()
|
||||
},
|
||||
changeSuffix(val){
|
||||
this.query.fileSuffix = val
|
||||
this.handleQuery()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue