Commit 642ee55e by 李长胜

处理测试环境售后详情image不显示问题

1 parent f9082d39
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* 日期格式化 * 日期格式化
* let time = new Date().format('yyyy-MM-dd hh:mm:ss') * let time = new Date().format('yyyy-MM-dd hh:mm:ss')
*/ */
Date.prototype.format = function(fmt) { Date.prototype.format = function (fmt) {
let o = { let o = {
'M+': this.getMonth() + 1, //月份 'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日 'd+': this.getDate(), //日
...@@ -24,27 +24,46 @@ Date.prototype.format = function(fmt) { ...@@ -24,27 +24,46 @@ Date.prototype.format = function(fmt) {
return fmt return fmt
} }
const getParams = (str = window.location.href) => { const getParams = (str = window.location.href) => {
let params = str.split('?') let params = str.split('?')
if (params.length < 2) return {} if (params.length < 2) return {}
let param = params[1].split('&') let param = params[1].split('&')
let obj = {} let obj = {}
for (let i = 0; i < param.length; i++) { for (let i = 0; i < param.length; i++) {
let paramsA = param[i].split('=') let paramsA = param[i].split('=')
let key = paramsA[0] let key = paramsA[0]
let value = paramsA[1] let value = paramsA[1]
obj[key] = value obj[key] = value
}
return obj
} }
/**num:要转换的数值,fixed:精确几位小数 */ return obj
}
/**num:要转换的数值,fixed:精确几位小数 */
const decimal = (num, fixed) => { const decimal = (num, fixed) => {
let pow = Math.pow(10, fixed) let pow = Math.pow(10, fixed)
return Math.round(num * pow) / pow return Math.round(num * pow) / pow
} }
const getHttpsImgUrl = (url) => {
if (!url) {
return ''
}
var flag = url.startsWith("http:")
if (flag) {
var newurl = url.replace("http:", "https:")
//去掉http自动带的端口 :7060,https不能有
var startPos = newurl.lastIndexOf(":")
var endPos = newurl.indexOf("/", startPos)
var preStr = newurl.substring(0, startPos)
var afterStr = newurl.substring(endPos)
var finalStr = preStr + afterStr
return finalStr
}
return url
}
import Vue from 'vue' import Vue from 'vue'
const utils = { const utils = {
getParams, getParams,
decimal decimal,
getHttpsImgUrl
} }
Object.keys(utils).map(key => { Object.keys(utils).map(key => {
Vue.prototype[key] = utils[key] Vue.prototype[key] = utils[key]
......
...@@ -164,6 +164,8 @@ export default { ...@@ -164,6 +164,8 @@ export default {
this.$apis.orderApi.getRefundDetail(params).then(({ code, data }) => { this.$apis.orderApi.getRefundDetail(params).then(({ code, data }) => {
if (code == 0) { if (code == 0) {
console.log(data,'77777777777') console.log(data,'77777777777')
data.list[0].img=this.getHttpsImgUrl(data.list[0].img)
data.list[0].goodImg=this.getHttpsImgUrl( data.list[0].goodImg)
this.detailInfo = data.list[0] this.detailInfo = data.list[0]
} }
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!