diff --git a/ldcake-ui/components/c-date-picker/c-date-picker.vue b/ldcake-ui/components/c-date-picker/c-date-picker.vue
index 234479e6dadf05460c8b1dc081ae6d2518d58541..a64fa2d2b2f3891db2879616065d37d95142b9bd 100644
--- a/ldcake-ui/components/c-date-picker/c-date-picker.vue
+++ b/ldcake-ui/components/c-date-picker/c-date-picker.vue
@@ -96,7 +96,7 @@
pickerValue: this.fields === 'year' ? [0] : this.fields === 'month' ? [0, 0] : [0, 0, 0],
dateType: "startDate",
startDate: '',
- endDate: "",
+ endDate: '',
};
},
watch: {
diff --git a/ldcake-ui/components/c-fabutton/c-fabutton.vue b/ldcake-ui/components/c-fabutton/c-fabutton.vue
index a98bcb9e53a1e40591e819c88e822859a9056e64..6281834e15e9e63809e24f6e6d8dcff9ae5e2d54 100644
--- a/ldcake-ui/components/c-fabutton/c-fabutton.vue
+++ b/ldcake-ui/components/c-fabutton/c-fabutton.vue
@@ -1,7 +1,7 @@
@@ -24,7 +24,7 @@
type: Boolean,
default: false
},
- // 背景透明度
+ // 背景颜色
background: {
type: String,
default: ''
@@ -66,16 +66,6 @@
this.top = this.windowHeight - this.height - this.edge;
}).exec();
},
- computed: {
- handleStyle() {
- const defaultColor = this.$c.color.primary;
- return [
- `background-color: ${this.background||defaultColor}`,
- `left: ${this.left}px`,
- `top: ${this.top}px`,
- ].join(',')
- }
- },
methods: {
click() {
this.$emit('click');
diff --git a/ldcake-ui/components/c-mp-tips/c-mp-tips.vue b/ldcake-ui/components/c-mp-tips/c-mp-tips.vue
new file mode 100644
index 0000000000000000000000000000000000000000..672be795365fafe87bf0025a10e900174afc31fd
--- /dev/null
+++ b/ldcake-ui/components/c-mp-tips/c-mp-tips.vue
@@ -0,0 +1,136 @@
+
+
+
+
+
+ {{ text }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ldcake-ui/index.js b/ldcake-ui/index.js
index 8550f08e2eec424904de5ccc0559a1404b0f51e3..ffefeca1596ca7a23154f30187bfb8513aabef6b 100644
--- a/ldcake-ui/index.js
+++ b/ldcake-ui/index.js
@@ -1,10 +1,14 @@
// 主题相关颜色,info|success|warning|primary|default|error,此颜色已在uview.scss中定义,但是为js中也能使用,故也定义一份
-import isEmpty from './libs/utils/isEmpty.js'
import color from './libs/config/color.js'
+import common from './libs/utils/common.js'
+import cache from './libs/utils/cache.js'
+import storage from './libs/utils/storage.js'
const $c = {
- isEmpty,
color,
+ common,
+ storage,
+ cache,
}
const install = Vue => {
diff --git a/ldcake-ui/libs/config/index.js b/ldcake-ui/libs/config/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..5150b8e47f919044c13f3927da088a2cee622cc1
--- /dev/null
+++ b/ldcake-ui/libs/config/index.js
@@ -0,0 +1,14 @@
+let version = '1.0.6';
+
+export default {
+ name: 'ldcake',
+ v: version,
+ version: version,
+ type: [
+ 'primary',
+ 'success',
+ 'info',
+ 'error',
+ 'warning'
+ ]
+}
\ No newline at end of file
diff --git a/ldcake-ui/libs/utils/cache.js b/ldcake-ui/libs/utils/cache.js
new file mode 100644
index 0000000000000000000000000000000000000000..c16556bec5a2af83023eda39053f71d9e5558532
--- /dev/null
+++ b/ldcake-ui/libs/utils/cache.js
@@ -0,0 +1,69 @@
+const {
+ setStorage,
+ getStorage,
+ removeStorage,
+ clearStorage
+} = require('./storage.js')
+const config = require('../config/index')
+
+let dtime = '_deadtime'
+
+/**
+ * k: key
+ * v: value
+ * t: time (second)
+ */
+export const setCache = (k, v, t) => {
+ const key = getCacheKey(k)
+ setStorage(key, v)
+ var seconds = parseInt(t)
+ if (seconds > 0) {
+ var timestamp = Date.parse(new Date())
+ timestamp = timestamp / 1000 + seconds
+ setStorage(`${key}${dtime}`.toUpperCase(), `${timestamp}`)
+ } else {
+ removeStorage(`${key}${dtime}`.toUpperCase())
+ }
+}
+
+/**
+ * k: key
+ * def: 可选参数,表示无缓存数据时返回值(支持字符串、json、数组、boolean等)
+ */
+export const getCache = (k, def) => {
+ const key = getCacheKey(k)
+ var deadtime = parseInt(getStorage(`${key}${dtime}`.toUpperCase()))
+ if (deadtime) {
+ if (parseInt(deadtime) < Date.parse(new Date()) / 1000) {
+ if (def) {
+ return def;
+ } else {
+ return
+ }
+ }
+ }
+ var res = getStorage(key);
+ if (res) {
+ return res
+ } else {
+ return def
+ }
+}
+
+/**
+ * 移除cache
+ */
+export const removeCache = (k) => {
+ const key = getCacheKey(k)
+ removeStorage(key)
+ removeStorage(`${key}dtime`.toUpperCase())
+}
+
+// 清除cache
+export const clearCache = () => {
+ clearStorage()
+}
+
+const getCacheKey = (k) => {
+ return `${k}`.toUpperCase()
+}
diff --git a/ldcake-ui/libs/utils/common.js b/ldcake-ui/libs/utils/common.js
new file mode 100644
index 0000000000000000000000000000000000000000..36130e1df9a327fedc3e84836b8d71b28ac09bf6
--- /dev/null
+++ b/ldcake-ui/libs/utils/common.js
@@ -0,0 +1,14 @@
+// rpx转px
+export const rpx2px = (upx) =>{
+ return upx / 750 * uni.getSystemInfoSync().windowWidth
+}
+
+// px转rpx
+export const px2rpx = (px) => {
+ return (px * 750) / uni.getSystemInfoSync().windowWidth
+}
+
+// 判断数据是否为空
+export const isEmpty = (val) => {
+ return !(!!val ? typeof val === 'object' ? Array.isArray(val) ? !!val.length : !!Object.keys(val).length : true : false);
+}
\ No newline at end of file
diff --git a/ldcake-ui/libs/utils/isEmpty.js b/ldcake-ui/libs/utils/isEmpty.js
deleted file mode 100644
index 439496b998283eb0e020d78cfc078e1f3fd0574e..0000000000000000000000000000000000000000
--- a/ldcake-ui/libs/utils/isEmpty.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function isEmpty(val) {
- return !(!!val ? typeof val === 'object' ? Array.isArray(val) ? !!val.length : !!Object.keys(val).length : true : false);
-}
-
-export default isEmpty;
\ No newline at end of file
diff --git a/ldcake-ui/libs/utils/storage.js b/ldcake-ui/libs/utils/storage.js
new file mode 100644
index 0000000000000000000000000000000000000000..929b221599f2f18b115b309823a5077c1212e696
--- /dev/null
+++ b/ldcake-ui/libs/utils/storage.js
@@ -0,0 +1,27 @@
+const config = require('../config/index')
+
+export const getStorageInfo = () => {
+ return uni.getStorageInfoSync()
+}
+
+export const setStorage = (k, v) => {
+ const key = getStorageKey(k)
+ uni.setStorageSync(key, v)
+}
+
+export const getStorage = (k) => {
+ const key = getStorageKey(k)
+ return uni.getStorageSync(key)
+}
+
+export const removeStorage = () => {
+ return uni.removeStorageSync()
+}
+
+export const clearStorage = () => {
+ return uni.clearStorageSync()
+}
+
+const getStorageKey = (k) => {
+ return `${config['name']}_${k}`.toUpperCase()
+}
diff --git a/ldcake-ui/package.json b/ldcake-ui/package.json
index 1c66baf9e0bff3bf9984bfe545d2c87b00bf4561..9e607129608cff030cbb31f97ee414d3cdc706c9 100644
--- a/ldcake-ui/package.json
+++ b/ldcake-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "ldcake-ui",
- "version": "1.0.6",
+ "version": "1.0.7",
"description": "基于uni-app的UI组件库",
"main": "index.js",
"scripts": {
diff --git a/pages.json b/pages.json
index 44b022d3b503d6c22478950dfc8e11506179da18..b6d14ed57111b8d510674bd3ed05f07a2a08c75f 100644
--- a/pages.json
+++ b/pages.json
@@ -22,7 +22,7 @@
"path" : "pages/components/spin/spin",
"style" :
{
- "navigationBarTitleText": "Spin 加载中",
+ "navigationBarTitleText": "Spin(加载中)",
"enablePullDownRefresh": false
}
@@ -36,6 +36,15 @@
}
}
+ ,{
+ "path" : "pages/components/mp-tips/mp-tips",
+ "style" :
+ {
+ "navigationBarTitleText": "右上角引导(mp-tips)",
+ "enablePullDownRefresh": false
+ }
+
+ }
],
"globalStyle": {
"navigationBarTextStyle": "black",
diff --git a/pages/components/date-picker/date-picker.vue b/pages/components/date-picker/date-picker.vue
index 868d17e8c14d2fd507679ba61bb82092f2f3ca72..3df7b2fa60ce5f7f5201bacada44bb496e3a60a4 100644
--- a/pages/components/date-picker/date-picker.vue
+++ b/pages/components/date-picker/date-picker.vue
@@ -3,10 +3,10 @@
演示效果
- date-picker值:{{ result }}
+ date-picker值:{{ result[0]||'' }} {{ result[1]||'' }}
-
+
@@ -20,6 +20,7 @@
},
methods: {
confirm(e){
+ console.log(e)
this.result = e;
this.isShow = false;
}
diff --git a/pages/components/mp-tips/mp-tips.vue b/pages/components/mp-tips/mp-tips.vue
new file mode 100644
index 0000000000000000000000000000000000000000..cbb42cde934596a81c0c76cba145594ac51229e5
--- /dev/null
+++ b/pages/components/mp-tips/mp-tips.vue
@@ -0,0 +1,37 @@
+
+
+
+ 演示效果
+
+
+
+ 恭喜你啦!看到我了~
+
+
+ 很抱歉哦,仅支持微信小程序查看哦~
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/index/index.vue b/pages/index/index.vue
index d8d763bed0cdfe8074b007fbe33e419b45fed2a4..9e1c5ca04824095d51daa4aada37887e36e0fbc5 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -37,6 +37,10 @@
name: '悬浮按钮(fabutton)',
url: '/pages/components/fabutton/fabutton'
},
+ {
+ name: '右上角引导(mp-tips)',
+ url: '/pages/components/mp-tips/mp-tips'
+ },
]
}
}