export const communal = {
|
data() {
|
return {
|
clientWidth: 0,
|
showImageIcon: 0, // 图标显示
|
exhibitionAllImages: 0, // 展示所有图片
|
showImageNumber: 0, // 展示图片数量
|
showImageIconFull: 0,
|
exhibitionAllImagesFull: 0,
|
showImageNumberFull: 0,
|
}
|
},
|
computed: {
|
url() {
|
const { path } = this.$route
|
if (path.includes('building')) {
|
// 楼栋
|
if (location.hostname === 'scp.jycash.cn') {
|
return process.env.VUE_APP_PRODUCT_XXXFINTECH_API_HOST + 'server/addBuildImage'
|
}else if (location.host === '10.10.16.114') {
|
return process.env.VUE_APP_HTTPS_API_HOST + 'server/addBuildImage'
|
} else {
|
return process.env.VUE_APP_API_HOST + 'server/addBuildImage'
|
}
|
} else {
|
// 项目/企业/合作方
|
if (location.hostname === 'scp.jycash.cn') {
|
return process.env.VUE_APP_PRODUCT_XXXFINTECH_API_HOST + 'server/addProjectImage'
|
} else if (location.host === '10.10.16.114') {
|
return process.env.VUE_APP_HTTPS_API_HOST + 'server/addProjectImage'
|
} else {
|
return process.env.VUE_APP_API_HOST + 'server/addProjectImage'
|
}
|
}
|
// if (location.hostname === 'scp.jycash.cn') {
|
// if (path.includes('building')) {
|
// return process.env.VUE_APP_PRODUCT_XXXFINTECH_API_HOST + 'server/addBuildImage'
|
// } else {
|
// return process.env.VUE_APP_API_HOST + 'server/addProjectImage'
|
// }
|
// } else {
|
// if (path.includes('building')) {
|
// return process.env.VUE_APP_PRODUCT_XXXFINTECH_API_HOST + 'server/addProjectImage'
|
// } else {
|
// return process.env.VUE_APP_API_HOST + 'server/addProjectImage'
|
// }
|
// }
|
},
|
// showImageNumber() {
|
// const { clientWidth, $route } = this
|
// const { path } = $route
|
// if (clientWidth > 1310) {
|
// this.exhibitionAllImages = 4
|
// if (path.includes('details')) {
|
// this.showImageIcon = 4
|
// return 3
|
// } else {
|
// this.showImageIcon = 3
|
// return 2
|
// }
|
// // this.showImageIcon = 3
|
// // this.exhibitionAllImages = 4
|
// // return 2
|
// } else {
|
// this.exhibitionAllImages = 3
|
// if (path.includes('details')) {
|
// this.showImageIcon = 3
|
// return 2
|
// } else {
|
// this.showImageIcon = 2
|
// return 1
|
// }
|
// // this.showImageIcon = 2
|
// // this.exhibitionAllImages = 3
|
// // return 1
|
// }
|
// },
|
// showImageIcon() {
|
// const { clientWidth } = this
|
// if (clientWidth > 1325) {
|
// return 3
|
// } else {
|
// return 2
|
// }
|
// },
|
// exhibitionAllImages() {
|
// const { clientWidth } = this
|
// if (clientWidth > 1320) { // 1310
|
// return 4
|
// } else {
|
// return 2
|
// }
|
// }
|
},
|
mounted() {
|
window.addEventListener('resize', this.updateClientWidth)
|
this.updateClientWidth()
|
},
|
methods: {
|
// 金额格式化
|
formatMoney(value) {
|
if (value) {
|
value =
|
parseFloat((value + '').replace(/[^\d\.-]/g, '')).toFixed(2) + ''
|
if (value == 'NaN') return
|
let l = value
|
.split('.')[0]
|
.split('')
|
.reverse()
|
let r = value.split('.')[1]
|
let t = ''
|
for (let i = 0; i < l.length; i++) {
|
t += l[i] + ((i + 1) % 3 === 0 && i + 1 !== l.length ? ',' : '')
|
}
|
return (
|
t
|
.split('')
|
.reverse()
|
.join('') +
|
'.' +
|
r
|
)
|
}
|
},
|
// 浏览器大小
|
updateClientWidth() {
|
const clientWidth = document.documentElement.clientWidth || 0
|
this.clientWidth = clientWidth
|
// console.log(this.clientWidth)
|
this.controllerImage()
|
},
|
controllerImage() {
|
const { clientWidth, $route } = this
|
const { path } = $route
|
if (clientWidth > 1310) {
|
this.exhibitionAllImages = 4
|
this.exhibitionAllImagesFull = 11
|
if (path.includes('details')) {
|
this.showImageIcon = 4
|
this.showImageNumber = 3
|
this.showImageIconFull = 11
|
this.showImageNumberFull = 10
|
} else {
|
this.showImageIcon = 3
|
this.showImageNumber = 2
|
this.showImageIconFull = 10
|
this.showImageNumberFull = 9
|
}
|
// this.showImageIcon = 3
|
// this.exhibitionAllImages = 4
|
// return 2
|
} else {
|
this.exhibitionAllImages = 3
|
this.exhibitionAllImagesFull = 7
|
if (path.includes('details')) {
|
this.showImageIcon = 3
|
this.showImageNumber = 2
|
this.showImageIconFull = 7
|
this.showImageNumberFull = 6
|
} else {
|
this.showImageIcon = 2
|
this.showImageNumber = 1
|
this.showImageIconFull = 6
|
this.showImageNumberFull = 5
|
}
|
// this.showImageIcon = 2
|
// this.exhibitionAllImages = 3
|
// return 1
|
}
|
}
|
}
|
}
|
|
export const money = {
|
methods:{
|
// 金额格式化
|
formatMoney(value) {
|
if (value) {
|
value =
|
parseFloat((value + '').replace(/[^\d\.-]/g, '')).toFixed(2) + ''
|
if (value == 'NaN') return
|
let l = value
|
.split('.')[0]
|
.split('')
|
.reverse()
|
let r = value.split('.')[1]
|
let t = ''
|
for (let i = 0; i < l.length; i++) {
|
t += l[i] + ((i + 1) % 3 === 0 && i + 1 !== l.length ? ',' : '')
|
}
|
return (
|
t
|
.split('')
|
.reverse()
|
.join('') +
|
'.' +
|
r
|
)
|
}
|
},
|
}
|
}
|