diff --git a/babel.config.js b/babel.config.js
index ba17966..44182c3 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -1,5 +1,12 @@
module.exports = {
presets: [
'@vue/app'
+ ],
+ plugins: [
+ ['import', {
+ libraryName: 'vant',
+ libraryDirectory: 'es',
+ style: true
+ }, 'vant']
]
}
diff --git a/package.json b/package.json
index a05a3c0..b188619 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
"path-to-regexp": "2.4.0",
"sortablejs": "^1.10.2",
"spark-md5": "^3.0.0",
+ "vant": "^2.5.0",
"vonic": "^1.1.3",
"vue": "2.6.10",
"vue-router": "3.0.6",
@@ -50,6 +51,7 @@
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1",
"babel-jest": "23.6.0",
+ "babel-plugin-import": "^1.13.0",
"chalk": "2.4.2",
"connect": "3.6.6",
"eslint": "^5.15.3",
diff --git a/src/main.js b/src/main.js
index 6965ac3..9d4a1a0 100644
--- a/src/main.js
+++ b/src/main.js
@@ -12,8 +12,9 @@ import EVueContextmenu from 'e-vue-contextmenu'
import App from './App'
import store from './store'
import router from './router'
-import WeVue from 'we-vue'
-import 'we-vue/lib/style.css'
+// import WeVue from 'we-vue'
+// import 'we-vue/lib/style.css'
+import { Button, Cell, CellGroup, Image, List, PullRefresh, SwipeCell, Col, Row, Divider } from 'vant';
import '@/icons' // icon
import '@/permission' // permission control
@@ -35,7 +36,19 @@ import '@/permission' // permission control
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui,按如下方式声明
Vue.use(ElementUI)
-Vue.use(WeVue)
+// Vue.use(WeVue)
+
+// 有赞的移动UI
+Vue.use(Button);
+Vue.use(Cell);
+Vue.use(CellGroup);
+Vue.use(Image);
+Vue.use(List);
+Vue.use(PullRefresh);
+Vue.use(SwipeCell);
+Vue.use(Col);
+Vue.use(Row);
+Vue.use(Divider);
Vue.use(uploader)
Vue.use(EVueContextmenu)
diff --git a/src/utils/number.js b/src/utils/number.js
index fecafd5..48709ba 100644
--- a/src/utils/number.js
+++ b/src/utils/number.js
@@ -51,6 +51,11 @@ export function strlen(str){
return len;
}
+/***
+ * 截取字符串前10位
+ * @param str
+ * @returns {string}
+ */
export function substring10(str){
var len = 0;
var res = '';
@@ -69,3 +74,38 @@ export function substring10(str){
}
return res;
}
+
+/**
+ * @param {number} agoTime
+ * @returns {string}
+ */
+export function formatTime(agoTime) {
+ const diff = agoTime / 1000
+ if (diff < 30) {
+ return '刚刚'
+ } else if (diff < 3600) {
+ // less 1 hour
+ return parseInt(diff / 60) + '分钟前'
+ } else if (diff < 3600 * 24) {
+ return parseInt(diff / 3600) + '小时前'
+ } else if (diff < 3600 * 24 * 30) {
+ return parseInt(diff / (3600 * 24)) + '天前'
+ } else if (diff <= 3600 * 24 * 30 * 12) {
+ return parseInt(diff / (3600 * 24 * 30)) + '个月前'
+ } else {
+ return parseInt(diff / (3600 * 24 * 30 * 12)) + '年月前'
+ }
+}
+
+export function formatSize(size) {
+ console.log(size)
+ if (size < 1024) {
+ return size + 'B'
+ } else if (size < 1024 * 1024) {
+ return (size/1024).toFixed(2) + 'k'
+ } else if (size < 1024 * 1024 * 1024) {
+ return (size/(1024 * 1024)).toFixed(2) + 'M'
+ } else {
+ return (size/(1024 * 1024 * 1024)).toFixed(2) + 'G'
+ }
+}
diff --git a/src/views/demo/index_m.vue b/src/views/demo/index_m.vue
index 1db64ad..62aee1c 100644
--- a/src/views/demo/index_m.vue
+++ b/src/views/demo/index_m.vue
@@ -1,9 +1,137 @@
-
- 1
- 2
- 3
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+ {{formatTime(item.agoTime)}}
+
+
+ {{formatSize(item.size)}}
+
+
+
+
+
+
+
+
+
+
+
+
+