mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 03:16:42 +08:00
统一定义一个部门名称截断的处理
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<div v-else class="uavatar">
|
||||
<div v-if="sex === 1 "><img src="../../../public/images/Avatarman.png" alt=""></div>
|
||||
<div v-else><img src="../../../public/images/Avatarwoman.png" alt=""></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding-left: 15px;">
|
||||
@@ -60,9 +60,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
userAvatarText
|
||||
} from "@/utils/tools.js";
|
||||
import {userAvatarText,cutFullName} from "@/utils/tools.js";
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'UcHeader',
|
||||
@@ -86,16 +84,9 @@ import {
|
||||
if(this.$route.path == '/study/index'){
|
||||
this.setCurIdentity(1);
|
||||
}
|
||||
this.orgInfo=this.userInfo.departFullName;
|
||||
//console.log(this.orgInfo,'转化前的名称')
|
||||
//this.orgInfo='京东方科技集团/显示事业/技术开发部';
|
||||
if(this.orgInfo){
|
||||
let idx=this.orgInfo.indexOf('/');
|
||||
if(idx>-1){
|
||||
this.orgInfo=this.orgInfo.substring(idx+1);
|
||||
}
|
||||
}
|
||||
//console.log(this.orgInfo,'转化后的名称')
|
||||
//let testName='京东方科技集团股份有限公司/北京中祥英科技有限公司/技术中心';
|
||||
//this.orgInfo=cutFullName(testName,1);
|
||||
this.orgInfo=cutFullName(this.userInfo.departFullName,1);
|
||||
},
|
||||
methods:{
|
||||
setCurIdentity(iden){
|
||||
|
||||
@@ -5,6 +5,25 @@ export const deepCopy = (obj) => {
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
};
|
||||
|
||||
/**截取名称部分,以/划分 */
|
||||
export const cutFullName = (fullName,num) => {
|
||||
let newName=fullName;
|
||||
if(newName){
|
||||
let names=newName.split('/');
|
||||
if(names.length>1){
|
||||
newName=names[1];
|
||||
if(num==2){
|
||||
if(names.length>2){
|
||||
newName+="/"+names[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return newName;
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取url协议
|
||||
* @param {Object} type
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
<interactBar :type="3" :readonly="true" :data="ca" :shares="false" :views="false"></interactBar>
|
||||
</div>
|
||||
<div style="height:40px;margin-top:10px">
|
||||
<authorInfo :avatar="ca.authorInfo.avatar" :name="ca.authorInfo.name" :sex="ca.authorInfo.sex"></authorInfo></div>
|
||||
<authorInfo :avatar="ca.authorInfo.avatar" :info="ca.authorInfo.orgInfo" :name="ca.authorInfo.name" :sex="ca.authorInfo.sex"></authorInfo></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -331,7 +331,7 @@ import ad from '@/components/Portal/adFloat.vue';
|
||||
import interactRowBar from '@/components/Portal/interactRowBar.vue';
|
||||
import courseImage from '@/components/Course/courseImage.vue';
|
||||
import articleImage from '@/components/Article/articleImage.vue';
|
||||
import { toScore} from '@/utils/tools.js';
|
||||
import { toScore,cutFullName} from '@/utils/tools.js';
|
||||
export default {
|
||||
name: 'index',
|
||||
components: { portalHeader,ad, portalFooter, articleImage, portalFloatTools, authorInfo, interactRowBar, interactBar, courseImage },
|
||||
@@ -493,7 +493,9 @@ export default {
|
||||
list.forEach((item, index) => {
|
||||
res.result.some(author => {
|
||||
if (author.aid == item.authorId) {
|
||||
author.orgInfo=cutFullName(author.orgInfo,1);
|
||||
item.authorInfo = author;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<span>工号:{{ authorInfo.code }}</span>
|
||||
<span>部门:{{ authorInfo.orgInfo }}</span>
|
||||
<!-- <span>案例编号:{{ caseDetail.id }}</span> -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="label">
|
||||
@@ -144,6 +144,7 @@ import apiMessage from '@/api/system/message.js';
|
||||
import apiDict from "@/api/modules/dict.js"
|
||||
import {encrypt} from '@/utils/jsencrypt.js';
|
||||
import cookies from 'vue-cookies'
|
||||
import {cutFullName} from "@/utils/tools.js";
|
||||
export default {
|
||||
name: 'atticle',
|
||||
components: { portalHeader, portalFooter, interactBar, author, comments,pdfPreview },
|
||||
@@ -254,12 +255,9 @@ export default {
|
||||
getCaseUserDetail() {
|
||||
apiUser.getByIds([this.caseDetail.authorId]).then(res => {
|
||||
if (res.status == 200 && res.result.length>0) {
|
||||
this.authorInfo = res.result[0];
|
||||
console.log(this.authorInfo)
|
||||
let idx=this.authorInfo.orgInfo.indexOf('/');
|
||||
if(idx>-1){
|
||||
this.authorInfo.orgInfo=this.authorInfo.orgInfo.substring(idx+1);
|
||||
}
|
||||
this.authorInfo = res.result[0];
|
||||
this.authorInfo.orgInfo=cutFullName(this.authorInfo.orgInfo,1);
|
||||
|
||||
this.toUsers = [
|
||||
{name: res.result[0].name, aid:res.result[0].aid ,sex:res.result[0].sex}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user