var PreviewPanel = {
template: '
',
props: [],
data: function() {
return {
content: "",
modelName:"",
createTime: "",
imgs: []
}
},
// beforeRouteEnter: function (to, from, next) {
// next(function(vm) {
// var query = vm.$route.query
// if(query && query.modelCode) {
// vm.modelCode = query.modelCode
// vm.listDetail()
// }
// })
// },
created: function() {
var vm = this
EventBus.$on('preview-template', function(data) {
var regN = /\n/g;
vm.content = data.content.replace(regN,"
").replace(/ /g, " ");
vm.modelName = data.modelName
vm.imgs = data.imgs
})
},
methods: {
listDetail: function() {
var vm = this
guidanceAPI.listDetail({
modelCode: vm.modelCode
}).then(function(res) {
var data = res.data
if(data) {
var regN = /\n/g;
vm.content = data.content.replace(regN,"
").replace(/ /g, " ");
vm.modelName = data.modelName
vm.createTime = data.createTime
vm.imgs = _.map(data.imagesUrls, function(s) {
return httpRequest.getImgUrl(s)
})
}
})
},
getDetail: function (){
var regN = /\n/g;
var regRN = /\r\n/g;
var content = detail.content.replace(/ /g, " ");
content = content.replace(regN,"
");
var p = ""+content+"
",
images = "";
for(i=0; i -1)){
src = getImgUrl(detail.images[i]);
}
images += "";
}
$(".content").append(p+images);
},
goBack: function() {
this.$router.back()
}
}
}