解决已知编码问题
This commit is contained in:
parent
6fd1c6d909
commit
f9b84f213b
@ -23,7 +23,15 @@ let Base64 = require("js-base64").Base64;
|
|||||||
// "gif",
|
// "gif",
|
||||||
// ];
|
// ];
|
||||||
|
|
||||||
|
export const encodePath = (path) => {
|
||||||
|
return path.replace(/(.*)/, (p1, p2) => {
|
||||||
|
return p2.replace().replace(/\//g, "%2F").replace(/#/g, "%23")
|
||||||
|
})
|
||||||
|
//return path.replace().replace("/", "%2F").replace("#", "%23")
|
||||||
|
}
|
||||||
|
|
||||||
export const checkoutPath = (path, file) => {
|
export const checkoutPath = (path, file) => {
|
||||||
|
path = encodePath(path)
|
||||||
if (file.mimeType === "application/vnd.google-apps.folder") {
|
if (file.mimeType === "application/vnd.google-apps.folder") {
|
||||||
if (path.substr(-1) !== "/") {
|
if (path.substr(-1) !== "/") {
|
||||||
path += "/";
|
path += "/";
|
||||||
@ -75,13 +83,12 @@ export const getQueryString = (path, param) => {
|
|||||||
|
|
||||||
export const getURLParameters = (url) =>
|
export const getURLParameters = (url) =>
|
||||||
url
|
url
|
||||||
.match(/([^?=&]+)(=([^&]*))/g)
|
.match(/([^?=&]+)(=([^&]*))/g)
|
||||||
.reduce(
|
.reduce(
|
||||||
(a, v) => (
|
(a, v) => (
|
||||||
(a[v.slice(0, v.indexOf("="))] = v.slice(v.indexOf("=") + 1)), a
|
(a[v.slice(0, v.indexOf("="))] = v.slice(v.indexOf("=") + 1)), a
|
||||||
),
|
), {}
|
||||||
{}
|
);
|
||||||
);
|
|
||||||
|
|
||||||
// console.log(getURLParameters("/Movies/xx.mp4?a=view&y=123"));
|
// console.log(getURLParameters("/Movies/xx.mp4?a=view&y=123"));
|
||||||
|
|
||||||
@ -176,7 +183,7 @@ export function formatFileSize(bytes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** 日期格式化
|
/** 日期格式化
|
||||||
* @param {Number String Date}
|
* @param {Number String Date}
|
||||||
* @param {String} 'YYYY-MM-DD HH:mm:ss EEE' 年(Y)、月(M)、日(D)、12小时(h)、24小时(H)、分(m)、秒(s)、毫秒(S)、周(E)、季度(q)
|
* @param {String} 'YYYY-MM-DD HH:mm:ss EEE' 年(Y)、月(M)、日(D)、12小时(h)、24小时(H)、分(m)、秒(s)、毫秒(S)、周(E)、季度(q)
|
||||||
* @return {String}
|
* @return {String}
|
||||||
@ -185,41 +192,41 @@ export function formatFileSize(bytes) {
|
|||||||
export function formatDate(date, fmt) {
|
export function formatDate(date, fmt) {
|
||||||
fmt = fmt || 'YYYY-MM-DD HH:mm:ss';
|
fmt = fmt || 'YYYY-MM-DD HH:mm:ss';
|
||||||
if (typeof date === 'string') {
|
if (typeof date === 'string') {
|
||||||
// date = new Date(date.replace(/-/g, '/'))
|
// date = new Date(date.replace(/-/g, '/'))
|
||||||
date = new Date(date)
|
date = new Date(date)
|
||||||
}
|
}
|
||||||
if (typeof date === 'number') {
|
if (typeof date === 'number') {
|
||||||
date = new Date(date)
|
date = new Date(date)
|
||||||
}
|
}
|
||||||
var o = {
|
var o = {
|
||||||
'M+': date.getMonth() + 1,
|
'M+': date.getMonth() + 1,
|
||||||
'D+': date.getDate(),
|
'D+': date.getDate(),
|
||||||
'h+': date.getHours() % 12 === 0 ? 12 : date.getHours() % 12,
|
'h+': date.getHours() % 12 === 0 ? 12 : date.getHours() % 12,
|
||||||
'H+': date.getHours(),
|
'H+': date.getHours(),
|
||||||
'm+': date.getMinutes(),
|
'm+': date.getMinutes(),
|
||||||
's+': date.getSeconds(),
|
's+': date.getSeconds(),
|
||||||
'q+': Math.floor((date.getMonth() + 3) / 3),
|
'q+': Math.floor((date.getMonth() + 3) / 3),
|
||||||
'S': date.getMilliseconds()
|
'S': date.getMilliseconds()
|
||||||
}
|
}
|
||||||
var week = {
|
var week = {
|
||||||
'0': '\u65e5',
|
'0': '\u65e5',
|
||||||
'1': '\u4e00',
|
'1': '\u4e00',
|
||||||
'2': '\u4e8c',
|
'2': '\u4e8c',
|
||||||
'3': '\u4e09',
|
'3': '\u4e09',
|
||||||
'4': '\u56db',
|
'4': '\u56db',
|
||||||
'5': '\u4e94',
|
'5': '\u4e94',
|
||||||
'6': '\u516d'
|
'6': '\u516d'
|
||||||
}
|
}
|
||||||
if (/(Y+)/.test(fmt)) {
|
if (/(Y+)/.test(fmt)) {
|
||||||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
|
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
|
||||||
}
|
}
|
||||||
if (/(E+)/.test(fmt)) {
|
if (/(E+)/.test(fmt)) {
|
||||||
fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? '\u661f\u671f' : '\u5468') : '') + week[date.getDay() + ''])
|
fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? '\u661f\u671f' : '\u5468') : '') + week[date.getDay() + ''])
|
||||||
}
|
}
|
||||||
for (var k in o) {
|
for (var k in o) {
|
||||||
if (new RegExp('(' + k + ')').test(fmt)) {
|
if (new RegExp('(' + k + ')').test(fmt)) {
|
||||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
|
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fmt;
|
return fmt;
|
||||||
}
|
}
|
@ -83,8 +83,8 @@ export default {
|
|||||||
if (n == "") {
|
if (n == "") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
n = decodeURI(n);
|
n = decodeURIComponent(n);
|
||||||
p += n + "/";
|
p += arr[i] + "/";
|
||||||
// if (p.match("/[0-9]+:/")[0] === p) {
|
// if (p.match("/[0-9]+:/")[0] === p) {
|
||||||
// n = this.$t('index');
|
// n = this.$t('index');
|
||||||
// }
|
// }
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(file, index) in data" v-bind:key="index">
|
<tr v-for="(file, index) in data" v-bind:key="index">
|
||||||
<td
|
<td
|
||||||
@click="
|
@click.self="
|
||||||
go(
|
go(
|
||||||
file,
|
file,
|
||||||
file.mimeType !== 'application/vnd.google-apps.folder'
|
file.mimeType !== 'application/vnd.google-apps.folder'
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<use :xlink:href="icons(file.mimeType)" />
|
<use :xlink:href="icons(file.mimeType)" />
|
||||||
</svg>
|
</svg>
|
||||||
{{ file.name }}
|
{{ file.name }}
|
||||||
<span class="has-text-grey g2-file-desc">{{ file.description }}</span>
|
<span class="has-text-grey g2-file-desc" v-html="file.description"></span>
|
||||||
</td>
|
</td>
|
||||||
<td class="is-hidden-mobile is-hidden-touch">
|
<td class="is-hidden-mobile is-hidden-touch">
|
||||||
{{ file.modifiedTime }}
|
{{ file.modifiedTime }}
|
||||||
|
Loading…
Reference in New Issue
Block a user