ContractPoster.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <div>
  3. <el-dialog title="二维码预览" :visible.sync="dialogVisible" width="50%" top="5vh">
  4. <div class="dia_out">
  5. <el-image class="image_class" :src="url" ></el-image>
  6. </div>
  7. <span slot="footer" class="dialog-footer">
  8. <el-button @click="downLoadImage">下载</el-button>
  9. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  10. </span>
  11. </el-dialog>
  12. </div>
  13. </template>
  14. <script>
  15. import { oSessionStorage } from "../utils/utils";
  16. import { basePath } from "../utils/http";
  17. export default {
  18. data() {
  19. return {
  20. dialogVisible: false,
  21. channelId: "",
  22. //url: "http://10.113.248.3:8086/file/show?filePath=./images/cloud.bef3ccbc.jpg",
  23. url: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
  24. //
  25. };
  26. },
  27. mounted() {},
  28. methods: {
  29. downLoadImage() {
  30. window.open(`${basePath}/file/download/${this.channelId}`)
  31. // this.$http.getDown(`/file/download/${this.channelId}`, {}, (res) => {
  32. // const url = window.URL.createObjectURL(new Blob([res.data])); // 创建一个URL对象
  33. // const link = document.createElement("a"); // 创建一个a标签
  34. // link.href = url; // 设置a标签的href属性为URL对象
  35. // link.setAttribute("download", "file.pdf"); // 设置a标签的download属性为要保存的文件名
  36. // document.body.appendChild(link); // 将a标签添加到DOM中
  37. // link.click(); // 模拟点击a标签进行下载
  38. // document.body.removeChild(link); // 下载完成后,移除a标签
  39. // });
  40. },
  41. open(val) {
  42. this.dialogVisible = true;
  43. this.channelId=val.channelId;
  44. this.url = basePath + "/file/show?filePath=" + val.poster;
  45. // this.queryById();
  46. },
  47. //调用查询接口
  48. // queryById() {
  49. // this.$http.get(`/sign/findById/${this.id}`, {}, (res) => {
  50. // // this.$toast.success({message:'成功'});
  51. // if (res && res.code == 200) {
  52. // //将值赋值给list
  53. // this.channelList = res.data;
  54. // } else {
  55. // this.$message.error(res.msg);
  56. // }
  57. // });
  58. // },
  59. },
  60. };
  61. </script>
  62. <style scope>
  63. .image_class {
  64. width: 270px;
  65. height: 480px;
  66. }
  67. .dia_out {
  68. /* text-align: center; */
  69. }
  70. </style>