feat:设备使用记录
This commit is contained in:
@@ -2,7 +2,7 @@ const version = '3'
|
||||
|
||||
// 开发环境才提示,生产环境不会提示
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log(`\n %c uview-plus V${version} %c https://ijry.github.io/uview-plus/ \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0;', 'color: #3c9cff;background: #ffffff; padding:5px 0;');
|
||||
console.log(`\n %c uview-plus V${version} %c https://uview-plus.jiangruyi.com/ \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0;', 'color: #3c9cff;background: #ffffff; padding:5px 0;');
|
||||
}
|
||||
|
||||
export default {
|
||||
@@ -37,6 +37,20 @@ export default {
|
||||
'up-tips-color': '#909399',
|
||||
'up-light-color': '#c0c4cc'
|
||||
},
|
||||
// 字体图标地址
|
||||
iconUrl: 'https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf',
|
||||
// 自定义图标
|
||||
customIcon: {
|
||||
family: '',
|
||||
url: ''
|
||||
},
|
||||
customIcons: {}, // 自定义图标与unicode对应关系
|
||||
// 默认单位,可以通过配置为rpx,那么在用于传入组件大小参数为数值时,就默认为rpx
|
||||
unit: 'px'
|
||||
unit: 'px',
|
||||
// 拦截器
|
||||
interceptor: {
|
||||
navbarLeftClick: null
|
||||
},
|
||||
// 只加载一次字体
|
||||
loadFontOnce: false
|
||||
}
|
||||
|
||||
@@ -4,7 +4,14 @@
|
||||
* 无需在每个引入组件的页面中都配置一次
|
||||
*/
|
||||
import config from './config'
|
||||
|
||||
// 各个需要fixed的地方的z-index配置文件
|
||||
import zIndex from './zIndex.js'
|
||||
// 关于颜色的配置,特殊场景使用
|
||||
import color from './color.js'
|
||||
// http
|
||||
import http from '../function/http.js'
|
||||
import { shallowMerge } from '../function/index.js'
|
||||
// 组件props
|
||||
import ActionSheet from '../../components/u-action-sheet/actionSheet'
|
||||
import Album from '../../components/u-album/album'
|
||||
import Alert from '../../components/u-alert/alert'
|
||||
@@ -15,6 +22,7 @@ import Badge from '../../components/u-badge/badge'
|
||||
import Button from '../../components/u-button/button'
|
||||
import Calendar from '../../components/u-calendar/calendar'
|
||||
import CarKeyboard from '../../components/u-car-keyboard/carKeyboard'
|
||||
import Card from '../../components/u-card/card'
|
||||
import Cell from '../../components/u-cell/cell'
|
||||
import CellGroup from '../../components/u-cell-group/cellGroup'
|
||||
import Checkbox from '../../components/u-checkbox/checkbox'
|
||||
@@ -32,7 +40,7 @@ import DatetimePicker from '../../components/u-datetime-picker/datetimePicker'
|
||||
import Divider from '../../components/u-divider/divider'
|
||||
import Empty from '../../components/u-empty/empty'
|
||||
import Form from '../../components/u-form/form'
|
||||
import GormItem from '../../components/u-form-item/formItem'
|
||||
import FormItem from '../../components/u-form-item/formItem'
|
||||
import Gap from '../../components/u-gap/gap'
|
||||
import Grid from '../../components/u-grid/grid'
|
||||
import GridItem from '../../components/u-grid-item/gridItem'
|
||||
@@ -94,11 +102,7 @@ import Tooltip from '../../components/u-tooltip/tooltip'
|
||||
import Transition from '../../components/u-transition/transition'
|
||||
import Upload from '../../components/u-upload/upload'
|
||||
|
||||
const {
|
||||
color
|
||||
} = config
|
||||
|
||||
export default {
|
||||
const props = {
|
||||
...ActionSheet,
|
||||
...Album,
|
||||
...Alert,
|
||||
@@ -109,6 +113,7 @@ export default {
|
||||
...Button,
|
||||
...Calendar,
|
||||
...CarKeyboard,
|
||||
...Card,
|
||||
...Cell,
|
||||
...CellGroup,
|
||||
...Checkbox,
|
||||
@@ -126,7 +131,7 @@ export default {
|
||||
...Divider,
|
||||
...Empty,
|
||||
...Form,
|
||||
...GormItem,
|
||||
...FormItem,
|
||||
...Gap,
|
||||
...Grid,
|
||||
...GridItem,
|
||||
@@ -188,3 +193,24 @@ export default {
|
||||
...Transition,
|
||||
...Upload
|
||||
}
|
||||
|
||||
function setConfig(configs) {
|
||||
shallowMerge(config, configs.config || {})
|
||||
shallowMerge(props, configs.props || {})
|
||||
shallowMerge(color, configs.color || {})
|
||||
shallowMerge(zIndex, configs.zIndex || {})
|
||||
}
|
||||
|
||||
// 初始化自定义配置
|
||||
if (uni && uni.upuiParams) {
|
||||
console.log('setting uview-plus')
|
||||
let temp = uni.upuiParams()
|
||||
if (temp.httpIns) {
|
||||
temp.httpIns(http)
|
||||
}
|
||||
if (temp.options) {
|
||||
setConfig(temp.options)
|
||||
}
|
||||
}
|
||||
|
||||
export default props
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
// vue下,单行和多行显示省略号需要单独处理
|
||||
@if $i == '1' {
|
||||
@if $i == 1 {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
// swiper-item,
|
||||
.u-empty,
|
||||
.u-empty__wrap,
|
||||
.u-transition,
|
||||
.u-tabs,
|
||||
.u-tabs__wrapper,
|
||||
.u-tabs__wrapper__scroll-view-wrapper,
|
||||
@@ -17,6 +18,7 @@
|
||||
.u-tabs__wrapper__nav__line,
|
||||
.up-empty,
|
||||
.up-empty__wrap,
|
||||
.up-transition,
|
||||
.up-tabs,
|
||||
.up-tabs__wrapper,
|
||||
.up-tabs__wrapper__scroll-view-wrapper,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
64
uview-plus/libs/function/calc.js
Normal file
64
uview-plus/libs/function/calc.js
Normal file
@@ -0,0 +1,64 @@
|
||||
// 浮点数加法
|
||||
export function add (arg1, arg2) {
|
||||
var r1, r2, m
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
m = Math.pow(10, Math.max(r1, r2))
|
||||
return (arg1 * m + arg2 * m) / m
|
||||
}
|
||||
// 浮点数减法
|
||||
export function sub (arg1, arg2) {
|
||||
var r1, r2, m, n
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
m = Math.pow(10, Math.max(r1, r2))
|
||||
n = (r1 >= r2) ? r1 : r2
|
||||
return Math.abs(((arg1 * m - arg2 * m) / m).toFixed(n))
|
||||
}
|
||||
//浮点乘法
|
||||
export function mul (a, b) {
|
||||
var c = 0,
|
||||
d = a.toString(),
|
||||
e = b.toString();
|
||||
try {
|
||||
c += d.split(".")[1].length;
|
||||
} catch (f) {}
|
||||
try {
|
||||
c += e.split(".")[1].length;
|
||||
} catch (f) {}
|
||||
return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
|
||||
}
|
||||
//浮点除法
|
||||
export function div (a, b) {
|
||||
var c, d, e = 0,
|
||||
f = 0;
|
||||
try {
|
||||
e = a.toString().split(".")[1].length;
|
||||
} catch (g) {}
|
||||
try {
|
||||
f = b.toString().split(".")[1].length;
|
||||
} catch (g) {}
|
||||
return c = Number(a.toString().replace(".", "")), d = Number(b.toString().replace(".", "")), xyutil.mul(c / d, Math.pow(10, f - e));
|
||||
}
|
||||
export default {
|
||||
add,
|
||||
sub,
|
||||
mul,
|
||||
div
|
||||
}
|
||||
4
uview-plus/libs/function/http.js
Normal file
4
uview-plus/libs/function/http.js
Normal file
@@ -0,0 +1,4 @@
|
||||
// 全局挂载引入http相关请求拦截插件
|
||||
import Request from '../luch-request'
|
||||
const http = new Request()
|
||||
export default http
|
||||
File diff suppressed because it is too large
Load Diff
@@ -237,6 +237,13 @@ export function object(value) {
|
||||
return Object.prototype.toString.call(value) === '[object Object]'
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是Promise对象
|
||||
*/
|
||||
export function objectPromise(value) {
|
||||
return Object.prototype.toString.call(value) === '[object Promise]';
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否短信验证码
|
||||
*/
|
||||
@@ -257,7 +264,7 @@ export function func(value) {
|
||||
* @param {Object} value
|
||||
*/
|
||||
export function promise(value) {
|
||||
return object(value) && func(value.then) && func(value.catch)
|
||||
return objectPromise(value) && func(value.then) && func(value.catch)
|
||||
}
|
||||
|
||||
/** 是否图片格式
|
||||
|
||||
54
uview-plus/libs/i18n/index.js
Normal file
54
uview-plus/libs/i18n/index.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import zhHans from './locales/zh-Hans.json'
|
||||
import zhHant from './locales/zh-Hant.json'
|
||||
import en from './locales/en.json'
|
||||
import es from './locales/es.json'
|
||||
import fr from './locales/fr.json'
|
||||
import de from './locales/de.json'
|
||||
import ko from './locales/ko.json'
|
||||
import ja from './locales/ja.json'
|
||||
import ru from './locales/ru.json'
|
||||
|
||||
let settings = {
|
||||
lang: uni.getLocale(),
|
||||
locales: {
|
||||
en,
|
||||
es,
|
||||
fr,
|
||||
de,
|
||||
ko,
|
||||
ja,
|
||||
ru,
|
||||
'zh-Hant': zhHant,
|
||||
'zh-Hans': zhHans
|
||||
}
|
||||
};
|
||||
|
||||
uni.onLocaleChange((locale) => {
|
||||
settings.lang = locale;
|
||||
})
|
||||
|
||||
/**
|
||||
* 多语言方法
|
||||
*/
|
||||
export function t(value, params = {}) {
|
||||
// console.log(settings.locales[settings.lang])
|
||||
if (value) {
|
||||
let lang = settings.lang
|
||||
if (!settings.locales[settings.lang]) {
|
||||
lang = 'zh-Hans'
|
||||
}
|
||||
let result = settings.locales[lang][value] || value;
|
||||
// 替换{xxx}格式的变量
|
||||
Object.keys(params).forEach(key => {
|
||||
const reg = new RegExp(`{${key}}`, 'g');
|
||||
result = result.replace(reg, params[key]);
|
||||
});
|
||||
return result;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
settings: settings
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user