123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- // 存放页面公用数据、方法...
- export default {
- data() {
- return {
- }
- },
- mixins: [],
- onLoad() {
- },
- 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');
- }
- }
- }
|