部分vue代码:
(IP真实为服务器IP,这里隐掉了)
.then(function(res){
console.info(res.data)
self.docPath = res.data
let str = self.docPath
str = str.substring(str.indexOf("bank"),str.length)
self.docPath = "http://1.1.1.1:8889/"+str
self.docPath = unescape(JSON.stringify(self.docPath))
console.info(self.docPath)
// str = decodeURI(str)
// console.info(str)
window.open(self.docPath)
})
后台返回给部分文件路径,自己截取需要的部分然后拼接IP,端口号,项目名找到这个文件
后台返回的数据:
然后我得到了bank后面(包括bank)的字符串
在和服务器IP端口号拼起来,打印如下:
我把上面这个完整的链接放在 window.open里面,浏览器的反应是这样的
可以看到前面加上了我本地的IP端口号和项目名,这是其中一个问题
我把前面的本地信息去掉,依然请求不到,变成了404