import { isWeixin } from '@/common/utils/common'; // #ifdef H5 import wx from 'weixin-js-sdk' // #endif // 存放页面公用数据、方法... export default { data() { return { } }, mixins: [], onLoad() { }, mounted() { if (isWeixin()) { // 去除顶部 var uni_page_head = document.querySelector("uni-page-head[uni-page-head-type='default']") if (uni_page_head) { uni_page_head.remove() } // 去除底部 var uni_tabbar_bottom = document.getElementsByClassName("uni-tabbar-bottom") if (uni_tabbar_bottom.length) { uni_tabbar_bottom[0].remove() var uni_page_wrapper = document.getElementsByTagName("uni-page-wrapper") if (uni_page_wrapper.length) { uni_page_wrapper[0].setAttribute('style', 'height: calc(100% - env(safe-area-inset-bottom)) !important') } } } }, methods: { //检查文件类型 $checkFileType(url) { if (!url) return ''; if (url.indexOf('?') >= 0) { url = url.slice(0, url.indexOf('?')); } const fileSuffix = url.substring(url.lastIndexOf(".") + 1); const wordList = ['doc', 'docx', 'dot', 'wps', 'wpt']; const excelList = ['xls', 'xlsx', 'xlt', 'et', 'ett']; const pptList = ['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps']; const pdfList = ['pdf']; const imgList = ['jpg', 'jpeg', 'png']; const videoList = ['mp4']; if (wordList.indexOf(fileSuffix) >= 0) { return 'word'; } else if (excelList.indexOf(fileSuffix) >= 0) { return 'excel'; } else if (pptList.indexOf(fileSuffix) >= 0) { return 'ppt'; } else if (pdfList.indexOf(fileSuffix) >= 0) { return 'pdf'; } else if (imgList.indexOf(fileSuffix) >= 0) { return 'img'; } else if (videoList.indexOf(fileSuffix) >= 0) { return 'video'; } else { return ''; } }, //密码转化成密文 $passwordFn(id, pas) { let k = 123456789 for (let i = 0; i < id.length; i++) { let a = (id[i].charCodeAt() % 13) + 1 k = ((k * a) % 9999999) + 1 } k = (k % 98989898) + 99 for (let i = 0; i < pas.length; i++) { let a = (pas[i].charCodeAt() % 17) + 1 k = ((k % 9876543) + 1) * a } let res = k % 100000000 // console.log(res, k, id, pas); return new Intl.NumberFormat(undefined, { minimumIntegerDigits: 8, useGrouping: false }).format(res) }, test() { console.log('mixins'); } } }