项目管理更新

This commit is contained in:
Yuanjianghong 2021-11-12 14:16:05 +08:00
parent 20f2408aec
commit e64c479139
6 changed files with 128 additions and 70 deletions

View File

@ -2,32 +2,42 @@ import request from '@/utils/request'
const coursewareApi = { const coursewareApi = {
add: '/courseManagement/xmCourseCourseware/addOrUpdate', add: '/courseManagement/xmCourseCourseware/addOrUpdate',
// get: '/courseManagement/course/details', // get: '/courseManagement/course/details',
// update: 'sys/menu/update', // update: 'sys/menu/update',
del: 'courseManagement/xmCourseCourseware/delete', del: 'courseManagement/xmCourseCourseware/delete',
// updateStatus: 'sys/menu/updateStatus', // updateStatus: 'sys/menu/updateStatus',
// list: '/courseManagement/course/listPage', // list: '/courseManagement/course/listPage',
// coursewareList:'/courseManagement/course/courseware/details', // coursewareList:'/courseManagement/course/courseware/details',
// questionList:'/courseManagement/course/questionList' // questionList:'/courseManagement/course/questionList'
classList: '/courseManagement/coursewareClassify/listPage'
} }
//删除课件 //删除课件
export function deleteCourseware (params) { export function deleteCourseware(params) {
return request({ return request({
url: coursewareApi.del, url: coursewareApi.del,
method: 'delete', method: 'delete',
params: params params: params
}) })
} }
// 课件新增 // 课件新增
export function coursewareAdd (params) { export function coursewareAdd(params) {
return request({ return request({
url: coursewareApi.add, url: coursewareApi.add,
method: 'post', method: 'post',
data: params data: params
}) })
} }
// 课件分类列表
export function coursewareClassList(params) {
return request({
url: coursewareApi.classList,
method: 'get',
params: params
})
}

View File

@ -1,10 +1,10 @@
export function timeFix () { export function timeFix() {
const time = new Date() const time = new Date()
const hour = time.getHours() const hour = time.getHours()
return hour < 9 ? '早上好' : hour <= 11 ? '上午好' : hour <= 13 ? '中午好' : hour < 20 ? '下午好' : '晚上好' return hour < 9 ? '早上好' : hour <= 11 ? '上午好' : hour <= 13 ? '中午好' : hour < 20 ? '下午好' : '晚上好'
} }
export function welcome () { export function welcome() {
const arr = ['休息一会儿吧', '准备吃什么呢?', '要不要打一把 DOTA', '我猜你可能累了'] const arr = ['休息一会儿吧', '准备吃什么呢?', '要不要打一把 DOTA', '我猜你可能累了']
const index = Math.floor(Math.random() * arr.length) const index = Math.floor(Math.random() * arr.length)
return arr[index] return arr[index]
@ -13,18 +13,18 @@ export function welcome () {
/** /**
* 触发 window.resize * 触发 window.resize
*/ */
export function triggerWindowResizeEvent () { export function triggerWindowResizeEvent() {
const event = document.createEvent('HTMLEvents') const event = document.createEvent('HTMLEvents')
event.initEvent('resize', true, true) event.initEvent('resize', true, true)
event.eventType = 'message' event.eventType = 'message'
window.dispatchEvent(event) window.dispatchEvent(event)
} }
export function handleScrollHeader (callback) { export function handleScrollHeader(callback) {
let timer = 0 let timer = 0
let beforeScrollTop = window.pageYOffset let beforeScrollTop = window.pageYOffset
callback = callback || function () {} callback = callback || function () { }
window.addEventListener( window.addEventListener(
'scroll', 'scroll',
event => { event => {
@ -45,7 +45,7 @@ export function handleScrollHeader (callback) {
) )
} }
export function isIE () { export function isIE() {
const bw = window.navigator.userAgent const bw = window.navigator.userAgent
const compare = (s) => bw.indexOf(s) >= 0 const compare = (s) => bw.indexOf(s) >= 0
const ie11 = (() => 'ActiveXObject' in window)() const ie11 = (() => 'ActiveXObject' in window)()
@ -57,7 +57,7 @@ export function isIE () {
* @param id parent element id or class * @param id parent element id or class
* @param timeout * @param timeout
*/ */
export function removeLoadingAnimate (id = '', timeout = 1500) { export function removeLoadingAnimate(id = '', timeout = 1500) {
if (id === '') { if (id === '') {
return return
} }
@ -66,7 +66,7 @@ export function removeLoadingAnimate (id = '', timeout = 1500) {
}, timeout) }, timeout)
} }
export function listToTree (list, tree, parentId) { export function listToTree(list, tree, parentId) {
list.forEach(item => { list.forEach(item => {
if (item.pid === parentId) { if (item.pid === parentId) {
const child = { const child = {
@ -85,3 +85,19 @@ export function listToTree (list, tree, parentId) {
}) })
return tree return tree
} }
//列表转🌲
// export function list2Tree(list, parentId) {
// let obj = []
// list.forEach(item => {
// item.children = []
// obj[item.id] = item
// })
// return list.filter(item => {
// if (item.parentId !== parentId) {
// obj[item.parentId].children.push(item)
// return false
// }
// return true
// })
// }

View File

@ -10,11 +10,13 @@
<a-step title="完成" /> <a-step title="完成" />
</a-steps> </a-steps>
<div class="content"> <div class="content">
<step1 v-if="currentTab === 0" @nextStep="nextStep" /> <keep-alive>
<step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep" /> <step1 v-if="currentTab === 0" @nextStep="nextStep" />
<step3 v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep" /> <step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep" />
<step4 v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep" /> <step3 v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep" />
<step5 v-if="currentTab === 4" @prevStep="prevStep" @finish="finish" /> <step4 v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep" />
<step5 v-if="currentTab === 4" @prevStep="prevStep" @finish="finish" />
</keep-alive>
</div> </div>
</a-card> </a-card>
</template> </template>
@ -32,7 +34,7 @@ export default {
}, },
data() { data() {
return { return {
title:'', title: '',
currentTab: 0, currentTab: 0,
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
@ -67,6 +69,7 @@ export default {
// handler // handler
// //
nextStep() { nextStep() {
console.log('1111', this)
if (this.currentTab < 5) { if (this.currentTab < 5) {
this.currentTab += 1 this.currentTab += 1
} }

View File

@ -11,53 +11,56 @@
> >
<a-row type="flex" justify="center" align="top"> <a-row type="flex" justify="center" align="top">
<a-col :span="6"> <a-col :span="6">
<a-menu v-model="current" mode="horizontal"> <a-menu v-model="current" mode="horizontal" @click="handleMenuClick">
<a-menu-item key="sys"> <a-icon type="mail" />系统课程</a-menu-item> <a-menu-item key="sys"> <a-icon type="sys" />系统课程</a-menu-item>
<a-menu-item key="self"> <a-icon type="appstore" />自制课程</a-menu-item> <a-menu-item key="self"> <a-icon type="self" />自制课程</a-menu-item>
</a-menu> </a-menu>
<a-input-search style="margin-bottom: 8px" placeholder="Search" @change="onChange" />
<a-tree <a-tree
:replace-fields="replaceFields"
:expanded-keys="expandedKeys" :expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent" :auto-expand-parent="autoExpandParent"
:tree-data="gData" :tree-data="treeData"
@expand="onExpand" @expand="onExpand"
@select="onSelect"
> >
<template slot="title" slot-scope="{ title }">
<span v-if="title.indexOf(searchValue) > -1">
{{ title.substr(0, title.indexOf(searchValue)) }}
<span style="color: #f50">{{ searchValue }}</span>
{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
</span>
<span v-else>{{ title }}</span>
</template>
</a-tree> </a-tree>
</a-col> </a-col>
<a-col :span="18"> <a-col :span="18">
<p class="height-50">col-4</p> <div id="content">
<p>dsfdsfdsfdsfds</p>
</div>
</a-col> </a-col>
</a-row> </a-row>
</a-modal> </a-modal>
</template> </template>
<script> <script>
import { coursewareClassList } from '@/api/course/courseware'
//jsjsjson //jsjsjson
//import from '' //import from ''
export default { export default {
//import使 //import使
components: {}, components: {
coursewareClassList,
},
props: {}, props: {},
data() { data() {
// //
return { return {
replaceFields: {
children: 'children',
title: 'name',
key: 'id'
},
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
current: ['mail'], current: ['sys'],
modalTitle: '', modalTitle: '',
expandedKeys: [], expandedKeys: [],
searchValue: '', searchValue: '',
autoExpandParent: true, autoExpandParent: true,
gData: [], treeData: [],
} }
}, },
// data // data
@ -87,25 +90,36 @@ export default {
this.expandedKeys = expandedKeys this.expandedKeys = expandedKeys
this.autoExpandParent = false this.autoExpandParent = false
}, },
onChange(e) { //
console.log(this.gData) handleMenuClick(e) {
const value = e.target.value console.log('key============', e.key)
const expandedKeys = dataList this.getCourseTreeData(e.key)
.map((item) => { console.log(this.treeData)
if (item.title.indexOf(value) > -1) { },
return getParentKey(item.key, gData) //
} getCourseTreeData(key) {
return null coursewareClassList().then((res) => {
}) //list🌲
.filter((item, i, self) => item && self.indexOf(item) === i) const list2tree1 = (list, parentId) => {
Object.assign(this, { return list.filter((item) => {
expandedKeys, if (item.parentId === parentId) {
searchValue: value, item.children = list2tree1(list, item.id)
autoExpandParent: true, return true
}
return false
})
}
this.treeData = list2tree1(res.data, -1)
}) })
}, },
onSelect(selectedKeys, e){
}
}, },
created() {}, // - 访this created() {
this.handleMenuClick()
}, // - 访this
mounted() {}, // - 访DOM mounted() {}, // - 访DOM
beforeCreate() {}, // - beforeCreate() {}, // -
beforeMount() {}, // - beforeMount() {}, // -
@ -117,4 +131,9 @@ export default {
} }
</script> </script>
<style scoped> <style scoped>
#content {
background-color: aquamarine;
width: 100%;
height: 500px;
}
</style> </style>

View File

@ -140,6 +140,7 @@ export default {
ClassList, ClassList,
}, },
created(ClassList) { created(ClassList) {
console.log('第一个表单创建了');
this.fetchTemplateData() this.fetchTemplateData()
}, },
methods: { methods: {
@ -185,5 +186,8 @@ export default {
this.form.resitNumber = Math.floor(Math.random() * (5 - 1) + 1) this.form.resitNumber = Math.floor(Math.random() * (5 - 1) + 1)
}, },
}, },
destroyed() {
console.log('第一个表单销毁了')
}
} }
</script> </script>

View File

@ -122,6 +122,9 @@ export default {
}, },
} }
}, },
created(){
console.log('第2个表单创建了')
},
computed: { computed: {
treeData() { treeData() {
return handleTreeData(treeData, this.targetKeys) return handleTreeData(treeData, this.targetKeys)
@ -142,7 +145,7 @@ export default {
}, },
toPrep() { toPrep() {
console.log('toPrep', this.form) console.log('toPrep', this.form)
this.$emit('prevStep',this.form) this.$emit('prevStep', this.form)
}, },
onChange(targetKeys) { onChange(targetKeys) {
console.log('Target Keys:', targetKeys) console.log('Target Keys:', targetKeys)
@ -172,5 +175,8 @@ export default {
} }
}, },
}, },
destroyed() {
console.log('第2个表单销毁了')
},
} }
</script> </script>