增加一个显示名称机构名称的访求 cutOrgNamePath

This commit is contained in:
daihh
2022-10-20 09:36:37 +08:00
parent 362c254668
commit d8e3189103
3 changed files with 42 additions and 16 deletions

View File

@@ -6,7 +6,7 @@
<template>
<div>
<el-row class="article-add">
<el-form ref="form" :rules="rules" :model="addForm" label-position="right" label-width="80px">
<el-form ref="askForm" :rules="askFormRules" :model="askForm" label-position="right" label-width="80px">
<el-dialog :close-on-click-modal='false' title="提问题" label-width="80px" :visible.sync="askQuestionDialog">
<!-- <el-form ref="askForm" :model="askForm" :rules="askFormRules" label-position="right" > -->
<el-form-item label="标题:" prop="title">
@@ -30,7 +30,7 @@
<el-form-item label="内容:" prop="content">
<el-input type="textarea" v-model="askForm.content" placeholder="请输入问题内容" :rows="8"></el-input>
</el-form-item>
<!-- </el-form> -->
<el-form-item >
<div class="btnbox">
@@ -41,9 +41,9 @@
<el-button type="primary" @click="addQaData" :disabled="!askForm.checked">发布问题</el-button>
<el-button @click="askQuestionDialog = false"> </el-button>
</div>
</div>
</el-form-item>
<el-dialog class="checked-show" :visible.sync="askFormCheckedShow" top="14vh" width="800px" :show-close="false" :modal="false">
<agreement></agreement>
@@ -56,7 +56,7 @@
</el-form>
</el-row>
</div>
</template>
<script>
@@ -185,7 +185,7 @@
.el-form-item__content{
display: flex;
justify-content: flex-start;
dl {
margin: 0;
padding: 10px;

View File

@@ -18,8 +18,31 @@ export const cutFullName = (fullName,num) => {
}
}
}
}
return newName;
};
/**截取机构名称路径namePath最后两段不包含第一个 */
export const cutOrgNamePath = (namePath) => {
let newName=namePath;
if(newName){
let names=newName.split('/');
let len=names.length;
//使用最后两们
if(len>3){
newName=names[len-2]+'/'+names[len-1];
}else if(len==2){
//去掉第一位,只是取第二位
newName=names[1];
}
// if(names.length>1){
// newName=names[1];
// if(num==2){
// if(names.length>2){
// newName+="/"+names[2];
// }
// }
// }
}
return newName;
};

View File

@@ -24,7 +24,7 @@
<span class="grade">{{userData.level}}</span>
</p>
<p class="personal-info">{{userInfo.departName}}</p>
<p class="personal-info">{{cutOrgNamePath(userInfo.departFullName)}}</p>
<a href="uc/study/task">
<div class="personal-box">
<span>代办</span>
@@ -195,13 +195,11 @@
<div class="case-inter">
<div class="case-inter-box">
<div class="case-inter-left">
<authorInfo :avatar="ca.authorInfo.avatar" :info="ca.authorInfo.orgInfo" :name="ca.authorInfo.name"
:sex="ca.authorInfo.sex" :aid="userInfo.aid"></authorInfo>
<authorInfo :avatar="ca.authorInfo.avatar" :info="ca.authorInfo.orgInfo" :name="ca.authorInfo.name" :sex="ca.authorInfo.sex" :aid="userInfo.aid"></authorInfo>
</div>
<div class="interact-bar-index"
style="font-size: 12px;color: #6E7B84;display: flex;line-height: 30px;">
<interactBar :type="3" :readonly="true" :comments="false" :praises="false" :favorites="false"
:data="ca" :shares="false" :views="true"></interactBar>人观看
<interactBar :type="3" :readonly="true" :comments="false" :praises="false" :favorites="false" :data="ca" :shares="false" :views="true"></interactBar>人观看
</div>
</div>
@@ -417,7 +415,8 @@
import {
toScore,
cutFullName,
formatUserNumber
formatUserNumber,
cutOrgNamePath
} from '@/utils/tools.js';
import {
swiper,
@@ -456,6 +455,7 @@
totalStudyHour:0
},
formatNum:formatUserNumber,
cutOrgNamePath:cutOrgNamePath,
//userInfo: {},
ankingList: [],
answersList: [],
@@ -516,7 +516,7 @@
},
mounted() {
//this.userInfo = this.$store.getters.userInfo;
// console.log(this.this.userInfo)
//console.log(this.userInfo,'userInfo');
this.getCourseData(1);
this.getCaseData();
this.getArticleData();
@@ -527,6 +527,7 @@
this.getAnkingData();
this.getLevel();
this.getQaAnswers();
},
computed: {
...mapGetters(['userInfo','studyTaskCount']),
@@ -586,7 +587,7 @@
}
})
this.scorelist = res.result;
console.log(this.scorelist,'this.scorelist');
//console.log(this.scorelist,'this.scorelist');
}
});
},
@@ -665,6 +666,8 @@
this.pageIndex = 0;
}
this.isNext = true;
// }
} else {
console.log('加载课程信息失败:' + res.error);
@@ -1241,7 +1244,7 @@
.swiper-container{
// background-color: rgba($color: #000000, $alpha: 0.2);
}
}
}