65e7a1ad86clay fix : 关闭一系列bug

Reviewed-on: http://git.hchyun.com/feashow/sist_web/pulls/9
This commit is contained in:
clay
2022-10-04 12:03:12 +00:00
8 changed files with 184 additions and 111 deletions

View File

@@ -2,6 +2,11 @@ import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
const routes = [
// {

View File

@@ -15,7 +15,6 @@ export function setThis(that) {
export function getParentNode(id) {
try {
let menuList = JSON.parse(sessionStorage.getItem("menu"));
console.log(menuList,"menuList")
for (let menu of menuList) {
for (let child of menu.children) {
if (id == child.encodeId) {

View File

@@ -3,8 +3,8 @@
<el-row>
<el-col>
<div class="context">
<div class="title">{{value.title}}</div>
<div class="text" v-html="value.content"></div>
<div v-if="introductionData" class="title">{{ introductionData.title }}</div>
<div v-if="introductionData" class="text" v-html="introductionData.content"></div>
</div>
</el-col>
</el-row>
@@ -15,30 +15,45 @@
export default {
name: "Introduction",
props: {
value: {
introduction: {
type: Object,
default: {
title:"12",
content:"12"
default() {
return {
}
},
},
},
data(){
return{}
}
data() {
return {
introductionData : this.value
}
},
watch:{
introduction(val){
this.introductionData = val
}
},
created() {
this.value = {
title: "12",
content: "12"
}
},
}
</script>
<style scoped lang="scss">
.Introduction{
.Introduction {
width: 100%;
}
.tab {
margin-left: 1.9rem;
margin-top: 1.5rem;
font-weight: 400;
font-size: 1.4rem !important;
}
.context {
margin: 3rem 4rem;
@@ -54,7 +69,8 @@ export default {
margin-top: 2rem;
font-size: 1.2rem;
font-weight: 400;
color: #3C3C3C;word-break: break-word; /* 文本行的任意字内断开 */
color: #3C3C3C;
word-break: break-word; /* 文本行的任意字内断开 */
word-wrap: break-word; /* IE */
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP printers */
@@ -63,7 +79,7 @@ export default {
white-space: pre; /* CSS2 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
pre{
pre {
width: 100%;
}
}

View File

@@ -3,29 +3,27 @@
<el-row v-for="(dire,index) in value" :key="index">
<!--正文内容-->
<el-col class="context">
<el-col class="context" :span="23">
<el-row class="context_el-row">
<el-col :span="2" :offset="1">
<el-col :span="1" :offset="1">
<img class="context_img" src="@/assets/teaching_staff/eji_icon_ys.png" alt="">
</el-col>
<el-col :span="3" class="context_name">{{ dire.name }}</el-col>
<el-col :span="4" class="context_name">{{ dire.name }}</el-col>
<el-col :span="16">
<hr class="context_hr">
</el-col>
<el-row v-for="(chile,index) in dire.children" :key="index">
<el-col class="name" :offset="1" :span="23">
{{ chile.name }}<span v-if="chile.children.length>1">({{chile.children.length}})</span>
</el-row>
<el-row v-for="(chile,index) in dire.children" :key="index">
<el-col class="name" :offset="1" :span="23">
{{ chile.name }}<span v-if="chile.children.length>1">({{chile.children.length}})</span>
</el-col>
<el-col class="text" :offset="1" :span="23">
<div v-for="(item,index) in chile.children" :key="index">
<a :href="item.link">
{{ item.name }}
</a>
</div>
</el-col>
<el-row>
<el-col class="text" :offset="1" :span="23">
<div v-for="(item,index) in chile.children" :key="index">
<a style="text-decoration: none" :href="item.link">
{{ item.name }}
</a>
</div>
</el-col>
</el-row>
</el-row>
</el-row>
</el-col>
</el-row>
@@ -68,7 +66,7 @@ export default {
margin: 3rem 2rem;
padding-bottom: 3rem;
//width: 84.3rem;
background: #FFFFFF;
//background: #FFFFFF;
.context_el-row {
margin-top: 2rem;
@@ -89,6 +87,7 @@ export default {
line-height: 2.2rem;
margin-top: 1.1rem;
border: #1956BC solid 0.1rem;
background-color: #1956BC;
}
}
@@ -96,16 +95,25 @@ export default {
margin-top: 2rem;
font-size: 1.6rem;
font-weight: 600;
color: #1956BC;
//color: #1956BC;
}
.text {
font-size: 1.4rem;
color: #3C3C3C;
//color: #3C3C3C;
clear: left;
div {
float: left;
margin-top: .4rem;
width: 7.4%;
//width: 7.4%;
margin-left: 1rem;
margin-right: 1rem;
a{
color: #000000;
text-decoration: none
}
a:hover{
color: #1956BC;
}
}
}
}

View File

@@ -21,8 +21,8 @@
</div>
<div>
<!--正文内容-->
<div class="context">
<div v-for="(item,index) in value.data" class="tw">
<div class="context" v-if="listData">
<div v-for="(item,index) in listData.data" class="tw">
<el-row>
<el-col :xs="6" :sm="6" :md="5" :lg="4" :xl="4">
<div class="tw_time">
@@ -48,21 +48,21 @@
</div>
</el-col>
</el-row>
<hr v-if="index != value.data.length-1" style="border: 0.1rem solid #E6E6E6;" class="hr">
<hr v-if="index != listData.data.length-1" style="border: 0.1rem solid #E6E6E6;" class="hr">
</div>
</div>
<el-row>
<el-col class="pagination_p">
<el-pagination class="pagination"
<el-pagination class="pagination" v-if="listData"
:small="small"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="value.pageNum"
:current-page.sync="listData.pageNum"
:page-sizes="[5,10,20, 30, 50, 100]"
:page-size="4"
layout="prev, pager, next,sizes, jumper"
:total="value.total">
:total="listData.total">
</el-pagination>
</el-col>
</el-row>
@@ -76,7 +76,7 @@ import {getNode} from "@/api";
export default {
name: "list",
props: {
value: {
list: {
type: Object,
default() {
return {
@@ -89,11 +89,17 @@ export default {
},
data() {
return {
listData : this.list,
width: document.documentElement.clientWidth,
small: document.documentElement.clientWidth <= 992,
query: '',
}
},
watch:{
list(val){
this.listData = val
}
},
methods: {
getContext(context) {
let type = this.$route.query && this.$route.query.type
@@ -101,50 +107,50 @@ export default {
if (type != null) {
router = "?id=" + context.id + '&type=' + type + "&lang=" + sessionStorage.getItem("lang")
} else {
router = "/" + this.value.navId + "?id=" + context.id + "&lang=" + sessionStorage.getItem("lang")
router = "/" + this.listData.navId + "?id=" + context.id + "&lang=" + sessionStorage.getItem("lang")
}
let routeData = null;
if (this.width <= 992) {
routeData = this.$router.resolve({path: "/mobile/" + this.value.secondId + router});
routeData = this.$router.resolve({path: "/mobile/" + this.listData.secondId + router});
} else {
routeData = this.$router.resolve({path: "/pc/" + this.value.secondId + router});
routeData = this.$router.resolve({path: "/pc/" + this.listData.secondId + router});
}
window.open(routeData.href,"_blank")
},
handleSizeChange(val) {
console.log(`每页 ${val}`);
if (val === -1) {
this.value.pageSize = 1
this.listData.pageSize = 1
} else {
this.value.pageSize = val
this.listData.pageSize = val
}
this.getData()
},
handleCurrentChange(val) {
if (val === -1) {
this.value.pageNum = 1
this.listData.pageNum = 1
} else {
this.value.pageNum = val
this.listData.pageNum = val
}
this.getData()
},
getData() {
let data = {
title: this.query,
id: this.value.navId,
pageNum: this.value.pageNum,
pageSize: this.value.pageSize
id: this.listData.navId,
pageNum: this.listData.pageNum,
pageSize: this.listData.pageSize
}
this.type = this.$route.query && this.$route.query.type
if (this.type != null && this.type !== 0) {
data.id = this.value.secondId
data.id = this.listData.secondId
} else {
console.log(this.value);
console.log(this.listData);
}
console.log(data);
// console.log(data);
getNode(data).then(res => {
this.value.data = res.rows
this.value.total = res.total
this.listData.data = res.rows
this.listData.total = res.total
})
},
getDay(time) {

View File

@@ -22,9 +22,9 @@
</el-col>
<el-col v-if="$i18n.locale === 'cn'" v-show="width" :md="6" :lg="6" :xl="4">
<div class="left_lab" ref="lab">
<div class="lab">
<div class="lab" v-if="navList">
<div v-for="(nav,index) in navList" class="lab_div">
<div v-if="index === showIndex" class="lab_list lab_select" @click="navClick(nav,index)">
<div v-if="index === showIndex&& nav" class="lab_list lab_select" @click="navClick(nav,index)">
<div class="lab_img">
<img src="@/assets/school_profile/eji_icon_xz.png" alt="">
</div>
@@ -32,7 +32,7 @@
{{ nav.title }}
</div>
</div>
<div v-if="index !== showIndex" class="lab_list" @click="navClick(nav,index)">
<div v-if="index !== showIndex&& nav" class="lab_list" @click="navClick(nav,index)">
<div class="lab_img">
<img src="@/assets/school_profile/eji_icon_xz.png" alt="">
</div>
@@ -87,7 +87,7 @@
<!--<router-link to="">-->
<span v-if="$i18n.locale === 'cn'">{{ crumbs.one.title }}</span>
<span v-if="$i18n.locale === 'en'">{{ crumbs.one.englishTitle }}</span>
<!--</router-link>-->
<!--</router-link>-->
</span>
<span> > </span>
<span style="color: #1956BC;">
@@ -99,8 +99,8 @@
</el-row>
<el-row>
<el-col>
<Introduction :value="contextData" v-if="type === 1"/>
<List :value="contextData" v-if="type === 2"/>
<Introduction :introduction="contextData" v-if="type === 1"/>
<List :list="contextData" v-if="type === 2"/>
<FileList :value="contextData" v-if="type === 4"/>
<DireData :value="contextData" v-if="type === 3 && organizationType == '1'"/>
<Organization :value="contextData" v-if="type === 3 && organizationType == '2'"/>
@@ -118,7 +118,7 @@
<el-row>
<el-col>
<div class="tab">
<router-link to="/" >{{ $t('message.home') }}</router-link>
<router-link to="/">{{ $t('message.home') }}</router-link>
<span> > </span>
<span style="color: #1956BC;">
<!--<router-link to="">-->
@@ -138,8 +138,8 @@
</el-row>
<el-row>
<el-col>
<Introduction :value="contextData" v-if="type === 1"/>
<List :value="contextData" v-if="type === 2"/>
<Introduction :introduction="contextData" v-if="type === 1"/>
<List :list="contextData" v-if="type === 2"/>
<FileList :value="contextData" v-if="type === 4"/>
<DireData :value="contextData" v-if="type === 3 && organizationType == '1'"/>
<Organization :value="contextData" v-if="type === 3 && organizationType == '2'"/>
@@ -181,7 +181,7 @@ export default {
width: document.documentElement.clientWidth > 992,
secondId: null,
navId: null,
organizationType:"",
organizationType: "",
navList: [],
showIndex: 0,
showSecond: true,
@@ -220,9 +220,9 @@ export default {
this.getContent(info.second)
}
return
}else {
console.log(this.navId,"this.navId")
if (undefined == this.navId ){
} else {
console.log(this.navId, "this.navId")
if (undefined == this.navId) {
this.showIndex = 0
this.getNodes()
}
@@ -235,7 +235,7 @@ export default {
this.$refs.lab.style.height = this.navList.length * 8 + 10 + 'rem'
} catch (e) {
}
if (this.secondId == id) {
if (this.secondId == id && this.navList) {
for (let i = 0; i < this.navList.length; i++) {
if (this.navId == this.navList[i].encodeId) {
this.showIndex = i
@@ -253,6 +253,7 @@ export default {
this.secondId = this.$route.params && this.$route.params.secondId;
this.navId = this.$route.params && this.$route.params.navId;
this.type = this.$route.query && this.$route.query.type
console.log(this.type,"this.type")
setTimeout(() => {
this.getNav()
}, 200);
@@ -310,34 +311,60 @@ export default {
/**
* 获得节点信息
*/
getNodes() {
async getNodes() {
this.navList = []
getNode({id: this.secondId}).then(res => {
this.navList = res.data
try {
setTimeout(() => {
this.$refs.lab.style.height = this.navList.length * 8 + 10 + 'rem'
}, 100);
} catch (e) {
console.log(e)
// await getNode({id: this.secondId}).then(res => {
// this.navList = res.data
// try {
// setTimeout(() => {
// this.$refs.lab.style.height = this.navList.length * 8 + 10 + 'rem'
// }, 100);
// } catch (e) {
// console.log(e)
// }
// // if (!this.navList){
// // return
// // }
// for (let i = 0; i < this.navList.length; i++) {
// if (this.navId == this.navList[i].encodeId) {
// this.showIndex = i
// }
// }
// let arcId = this.$route.query && this.$route.query.id
// if (arcId != undefined) {
// this.getContext(arcId)
// } else {
// console.log("测试,我被触发了!")
// if (this.navId == undefined) {
// this.getContent(this.navList[0])
// } else {
// this.getContent(this.navList[this.showIndex])
// }
// }
// })
let res = await getNode({id: this.secondId})
// todo 延时异步问题
this.$refs.lab.style.height = res.data.length * 8 + 10 + 'rem'
this.navList = res.data
// if (!this.navList){
// return
// }
for (let i = 0; i < this.navList.length; i++) {
if (this.navId == this.navList[i].encodeId) {
this.showIndex = i
}
for (let i = 0; i < this.navList.length; i++) {
if (this.navId == this.navList[i].encodeId) {
this.showIndex = i
}
}
let arcId = this.$route.query && this.$route.query.id
if (arcId != undefined) {
this.getContext(arcId)
}
let arcId = this.$route.query && this.$route.query.id
if (arcId != undefined) {
this.getContext(arcId)
} else {
console.log("测试,我被触发了!")
if (this.navId == undefined) {
this.getContent(this.navList[0])
} else {
console.log("测试,我被触发了!")
if (this.navId == undefined) {
this.getContent(this.navList[0])
} else {
this.getContent(this.navList[this.showIndex])
}
this.getContent(this.navList[this.showIndex])
}
})
}
},
/**
* 获取三级菜单
@@ -345,6 +372,10 @@ export default {
*/
getContent(menu) {
console.log("getContent内部,menu:", menu)
console.log(menu)
if (menu == undefined){
return
}
this.type = menu.type
this.contextData = null
this.bgImage = menu.link
@@ -355,7 +386,7 @@ export default {
pageNum: 1,
pageSize: 5
}
if (this.type === 4){
if (this.type === 4) {
data.pageSize = 10
}
} else {
@@ -366,9 +397,9 @@ export default {
getNode(data).then(res => {
console.log(res, "res值")
console.log(this.type);
if (null == res.data){
if (null == res.data && null == res.rows) {
this.contextData = null
console.log("将值设为null",this.contextData)
console.log("将值设为null", this.contextData)
this.type = 0
return
}
@@ -384,20 +415,19 @@ export default {
} else if (this.type == 1) {
this.contextData = res.data
} else if (this.type == 3) {
if (res.additional == ""){
if (res.additional == "") {
this.organizationType = "1"
}else {
console.log(this.organizationType,"this.organizationType")
} else {
console.log(this.organizationType, "this.organizationType")
this.organizationType = res.additional
}
this.contextData = handleTree(res.data, "id", "pid", null, null)
console.log(this.contextData,"this.contextData")
console.log(this.contextData, "this.contextData")
}
})
},
/**
* 菜单点击,路由切换
* @param nav
@@ -468,7 +498,8 @@ export default {
.lab_div {
border-bottom: 0.1rem solid #94BCFF !important;
margin-left: 1rem;
//margin-left: 1rem;
width: 100%;
}
.lab_div:last-child {
@@ -479,7 +510,7 @@ export default {
.lab_list {
cursor: pointer;
text-align: center;
width: 19rem;
//width: 19rem;
height: 8rem;
clear: left;
line-height: 8rem;
@@ -490,7 +521,7 @@ export default {
width: 1.4rem;
height: 1.4rem;
display: none;
margin-left: 3rem;
margin-left: 1rem;
img {
width: 100%;
@@ -500,7 +531,7 @@ export default {
.lab_title {
color: #1956BC;
float: left;
margin-left: 5rem;
margin-left: 3rem;
}
}

View File

@@ -95,8 +95,8 @@
<!--<div class="secondary" v-if="index == 5">-->
</div>
</span>
<div class="iconfont"><img src="@/assets/header/denglu.png" alt=""></div>
<div class="switchLang"><img src="@/assets/header/en.png" alt=""></div>
<div class="iconfont" @click="login"><img src="@/assets/header/denglu.png" alt=""></div>
<div class="switchLang" @click="switchLang"><img src="@/assets/header/en.png" alt=""></div>
</div>
</el-col>
</div>
@@ -141,6 +141,10 @@ export default {
console.log(menu);
this.$router.push("/pc/" + menu.encodeId + "?type=" + menu.type + "&lang=" + sessionStorage.getItem("lang"));
},
login(){
let routeData = this.$router.resolve("/admin");
window.open(routeData.href,"_blank")
},
switchLang() {
let lang = "";
if (this.$i18n.locale === "en") {

View File

@@ -32,8 +32,8 @@
</el-row>
<el-row>
<el-col>
<Introduction :value="contextData" v-if="type === 1"/>
<List :value="contextData" v-if="type === 2"/>
<Introduction :introduction="contextData" v-if="type === 1"/>
<List :list="contextData" v-if="type === 2"/>
<FileList :value="contextData" v-if="type === 4"/>
<DireData :value="contextData" v-if="type === 3"/>
<Details :value="detailsData" v-if="type == null"/>
@@ -110,6 +110,7 @@ export default {
this.getContext(arcId)
} else {
this.menuData = getParentNode(this.navId)
console.log(this.menuData,"menuData")
this.getContent(this.menuData.three)
}
}
@@ -125,6 +126,7 @@ export default {
},
methods: {
init(){
console.log(this.navId)
this.menuData = getParentNode(this.navId)
crumbs(this.secondId).then(res => {
this.crumbs = res.data
@@ -148,6 +150,7 @@ export default {
if (arcId != undefined) {
this.getContext(arcId)
} else {
console.log(this.menuData,"menuData")
this.getContent(this.menuData.three)
}
},
@@ -161,7 +164,7 @@ export default {
},
getContent(menu) {
console.log(menu)
//let menu = this.menuData.three
// let menu = this.menuData.three
this.type = menu.type
this.contextData = null
this.bgImage = menu.link
@@ -233,7 +236,8 @@ export default {
.lab_div {
border-bottom: 0.1rem solid #94BCFF !important;
margin-left: 1rem;
//margin-left: 1rem;
width: 100%;
}
.lab_div:last-child {