img路径拼接

This commit is contained in:
huichao
2020-07-29 13:19:12 +08:00
parent 03c2751132
commit 24e7bdef96
3 changed files with 49 additions and 16 deletions

View File

@@ -40,4 +40,12 @@ export function getBaseAgentInfo(data) {
method: 'post',
data
})
}
//转code
export function getCode(data) {
return request({
url: getUrl(`/agent/Performance/getGroupCodeByName`, 1),
method: 'post',
data
})
}

View File

@@ -163,7 +163,7 @@ export default {
parmas.date = this.dateTime
parmas.mask = '1'
parmas.agentCode=this.list[i].code
parmas.Name = this.list[i].name
parmas.Name = this.list[i].name.split("部")[1]
parmas.buName=this.unitName
localStorage.parmas2 = JSON.stringify(parmas)
this.$jump({

View File

@@ -38,9 +38,13 @@
v-for="(item, index) in headerList"
:key="index"
>
<div @click="(InfoDetails(index))">
<!-- <img v-if="item.agentHeadUrl!==null" class="h40 w40" :src="item.agentHeadUrl" alt /> -->
<img class="h40 w40" src="@/assets/images/u188.png" alt />
<div @click="(InfoDetails(index))" class="w40 h60">
<div style="width:40px; height:42px;border-radius: 20px; margin-top: 2px;margin-left: 2px;" v-if="item.agentHeadUrl!==null">
<img style="width:40px; height:40px;border-radius: 20px" :src="item.agentHeadUrl | urlFormat" alt />
</div>
<div class="h40 w40" v-else>
<img class="h40 w40" src="@/assets/images/u188.png" alt />
</div>
<div class="absolute fs12 white captain" v-if="String(item.agentName)==String(Name).split('组')[0] ||String(item.agentName)==String(unitName).split('组')[0]">团队长</div>
<div :class="[item.isShowImg?'active':'']"></div>
<div class="fs13">{{item.agentName}}</div>
@@ -94,9 +98,10 @@
</div>
</template>
<script>
import { getBaseAgentInfo, getPerformanceHeader, getPerformanceDetail, getHeader } from '@/api/ebiz/performance/performance'
import { getBaseAgentInfo, getPerformanceHeader, getPerformanceDetail, getHeader,getCode } from '@/api/ebiz/performance/performance'
import utils from '@/assets/js/utils/date-utils'
import { Popup, DatetimePicker } from 'vant'
import config from '@/config'
export default {
name: 'performance',
components: {
@@ -136,7 +141,7 @@ export default {
},
created() {
// console.log('=======' + this.$route.params.parmas)
console.log("+++++++++++"+JSON.parse(window.localStorage.getItem('parmas')))
console.log(JSON.parse(window.localStorage.getItem('parmas2')))
if (window.localStorage.getItem('parmas') !== null) {
this.mask = JSON.parse(window.localStorage.getItem('parmas')).mask
;(this.titleTime = JSON.parse(window.localStorage.getItem('parmas')).date.slice(0, 7)),
@@ -159,23 +164,24 @@ export default {
;(this.titleTime = JSON.parse(window.localStorage.getItem('parmas1')).date.slice(0, 7)),
(this.dateTime = JSON.parse(window.localStorage.getItem('parmas1')).date),
(this.unitName = JSON.parse(window.localStorage.getItem('parmas1')).unitName),
(this.Name = JSON.parse(window.localStorage.getItem('parmas1')).Name),
(this.code = JSON.parse(window.localStorage.getItem('parmas1')).code),
this.buName=JSON.parse(window.localStorage.getItem('parmas1')).buName
// window.localStorage.removeItem('parmas1');
}
// this.performanceData()
if (this.code == '') {
if (JSON.parse(window.localStorage.getItem('obj')).agentGrade.slice(0, 2) == 'A2') {
this.getPerformanceHeader1()
}else{
this.getCode1()
}
if(this.mask=="1"){
this.getPerformanceDetailC()
// this.getPerformanceDetailC()
}
this.formatDate1()
this.getBaseAgentInfo1()
if (this.code !== '') {
this.getHeader1()
// this.getHeader1()
}
},
mounted() {
@@ -218,7 +224,7 @@ export default {
getBaseAgentInfo1() {
let date = {}
getBaseAgentInfo(date).then((res) => {
console.log(res)
// console.log(res)
if (res.result == 0) {
;(this.agentGrade = res.agentGrade),
(this.unitName = res.unitName),
@@ -251,11 +257,11 @@ export default {
getPerformanceHeader1() {
let date = {}
getPerformanceHeader(date).then((res) => {
console.log('==' + res)
// console.log( res)
if (res.result == 0) {
for (let i = 0; i < res.content.length; i++) {
res.content[i].isShowImg = true
res.content[i].imgUrl=encodeURIComponent(config.imgDomain + '/returnDirectStream?imgPath=' +res.content[i].imgUrl)
// res.content[i].agentHeadUrl=encodeURIComponent(config.imgDomain + '/returnDirectStream?imgPath=' +res.content[i].imgUrl)
}
this.headerList = res.content
console.log(this.headerList)
@@ -263,7 +269,7 @@ export default {
})
},
getHeader1() {
console.log(1111)
console.log(this.code)
let code = {
agentgroup: this.code,
}
@@ -295,6 +301,20 @@ export default {
}
})
},
getCode1(){
console.log("=========="+this.Name)
let code={
groupCode:this.Name
}
getCode(code).then(res=>{
console.log(res)
if (res.result == 0) {
this.code=res.content.groupCode
}
console.log(this.code)
this.getHeader1()
})
},
//点击头像
InfoDetails(item) {
console.log(item)
@@ -318,6 +338,11 @@ export default {
}
})
},
},
filters: {
urlFormat(url) {
return (config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${url}`).replace(/\+/g, '%2B')
}
},
destroyed: function () {
console.log("我已经离开了!");
@@ -352,8 +377,8 @@ export default {
overflow-x: scroll;
}
.active {
width: 40px;
height: 40px;
width: 40px !important;
height: 40px !important;
z-index: 100;
background: #ccc;
opacity: 0.5;