12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import { getToken } from '@/api/token'
- import bus from '@/assets/js/event.js'
- export default {
- data () {
- return {
- token: null,
- }
- },
- props: {
-
- },
- mounted () {
-
- },
- methods: {
- submitHandler: function (func, checkToken) {
- if (this.token == null || checkToken == false) {
- getToken().then((res) => {
- this.token = res.data;
- func(this.token);
- }).catch((error) => {
- if (error && error.status == 404) {
- return;
- }
- console.log(error)
- msg('网络错误');
- this.resetToken();
- });
- }
- },
- resetToken: function () {
- this.token = null;
- },
- backListView: function(isDestoryListView, listViewName, params, func) {
-
- },
- reset: function(backUp) {
-
- },
- toClick: function (ref, func) {
-
- },
- download: function (data, fileName) {
- if (!data || !data.data) {
- msg("文件下载失败(文件或已被删除)");
- return
- }
- let url = window.URL.createObjectURL(new Blob([data.data]))
- let link = document.createElement('a')
- link.style.display = 'none'
- link.href = url
- link.setAttribute('download', fileName || decodeURIComponent(data.fileName))
- document.body.appendChild(link)
- link.click()
- },
- }
- }
|