
@ -0,0 +1,21 @@ |
|||
.DS_Store |
|||
node_modules/ |
|||
dist/ |
|||
npm-debug.log* |
|||
yarn-debug.log* |
|||
yarn-error.log* |
|||
package-lock.json |
|||
tests/**/coverage/ |
|||
|
|||
# Editor directories and files |
|||
.idea |
|||
.vscode |
|||
*.suo |
|||
*.ntvs* |
|||
*.njsproj |
|||
*.sln |
|||
|
|||
|
|||
.vscode/ |
|||
.hbuilderx/ |
|||
unpackage/ |
@ -0,0 +1,29 @@ |
|||
<script> |
|||
export default { |
|||
onLaunch: function() {}, |
|||
onShow: function() {}, |
|||
onHide: function() {}, |
|||
globalData: {} //全局变量 |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
/*每个页面公共css */ |
|||
@import '@/uni_modules/uni-scss/index.scss'; |
|||
|
|||
/* #ifndef APP-NVUE */ |
|||
@import '@/static/customicons.css'; |
|||
// 设置整个项目的背景色 |
|||
page { |
|||
background-color: #f5f5f5; |
|||
} |
|||
/* #endif */ |
|||
|
|||
@import '@/uni_modules/uview-ui/index.scss'; |
|||
@import '@/common/app.scss'; |
|||
.example-info { |
|||
font-size: 14px; |
|||
color: #333; |
|||
padding: 10px; |
|||
} |
|||
</style> |
@ -0,0 +1,130 @@ |
|||
/** |
|||
* 这里是uni-app内置的常用样式变量 |
|||
* |
|||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 |
|||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App |
|||
* |
|||
*/ |
|||
|
|||
/** |
|||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 |
|||
* |
|||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 |
|||
*/ |
|||
|
|||
/* 颜色变量 */ |
|||
|
|||
/* 行为相关颜色 */ |
|||
$uni-color-primary: #007aff; |
|||
$uni-color-success: #4cd964; |
|||
$uni-color-warning: #f0ad4e; |
|||
$uni-color-error: #dd524d; |
|||
|
|||
/* 文字基本颜色 */ |
|||
$uni-text-color: #333; //基本色 |
|||
$uni-text-color-inverse: #fff; //反色 |
|||
$uni-text-color-grey: #999; //辅助灰色,如加载更多的提示信息 |
|||
$uni-text-color-placeholder: #808080; |
|||
$uni-text-color-disable: #c0c0c0; |
|||
|
|||
/* 背景颜色 */ |
|||
$uni-bg-color: #ffffff; |
|||
$uni-bg-color-grey: #f8f8f8; |
|||
$uni-bg-color-hover: #f1f1f1; //点击状态颜色 |
|||
$uni-bg-color-mask: rgba(0, 0, 0, 0.4); //遮罩颜色 |
|||
|
|||
/* 边框颜色 */ |
|||
$uni-border-color: #c8c7cc; |
|||
|
|||
/* 尺寸变量 */ |
|||
|
|||
/* 文字尺寸 */ |
|||
$uni-font-size-sm: 12px; |
|||
$uni-font-size-base: 14px; |
|||
$uni-font-size-lg: 16; |
|||
|
|||
/* 图片尺寸 */ |
|||
$uni-img-size-sm: 20px; |
|||
$uni-img-size-base: 26px; |
|||
$uni-img-size-lg: 40px; |
|||
|
|||
/* Border Radius */ |
|||
$uni-border-radius-sm: 2px; |
|||
$uni-border-radius-base: 3px; |
|||
$uni-border-radius-lg: 6px; |
|||
$uni-border-radius-circle: 50%; |
|||
|
|||
/* 水平间距 */ |
|||
$uni-spacing-row-sm: 5px; |
|||
$uni-spacing-row-base: 10px; |
|||
$uni-spacing-row-lg: 15px; |
|||
|
|||
/* 垂直间距 */ |
|||
$uni-spacing-col-sm: 4px; |
|||
$uni-spacing-col-base: 8px; |
|||
$uni-spacing-col-lg: 12px; |
|||
|
|||
/* 透明度 */ |
|||
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 |
|||
|
|||
/* 文章场景相关 */ |
|||
$uni-color-title: #2c405a; // 文章标题颜色 |
|||
$uni-font-size-title: 20px; |
|||
$uni-color-subtitle: #555555; // 二级标题颜色 |
|||
$uni-font-size-subtitle: 26px; |
|||
$uni-color-paragraph: #3f536e; // 文章段落颜色 |
|||
$uni-font-size-paragraph: 15px; |
|||
|
|||
/** |
|||
* 下面为当前APP自己定义的公共样式 |
|||
*/ |
|||
.app-container { |
|||
padding: 20px; |
|||
font-size: 14px; |
|||
line-height: 24px; |
|||
} |
|||
|
|||
.u-block { |
|||
padding: 14px; |
|||
&__section { |
|||
margin-bottom: 10px; |
|||
} |
|||
&__title { |
|||
margin-top: 10px; |
|||
font-size: 15px; |
|||
color: $u-content-color; |
|||
margin-bottom: 10px; |
|||
} |
|||
&__flex { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
} |
|||
} |
|||
|
|||
// 使用了cell组件的icon图片样式 |
|||
.u-cell-icon { |
|||
width: 36rpx; |
|||
height: 36rpx; |
|||
margin-right: 8rpx; |
|||
} |
|||
|
|||
.u-page { |
|||
padding: 15px 15px 40px 15px; |
|||
} |
|||
|
|||
.u-demo-block { |
|||
flex: 1; |
|||
margin-bottom: 23px; |
|||
|
|||
&__content { |
|||
@include flex(column); |
|||
} |
|||
|
|||
&__title { |
|||
font-size: 14px; |
|||
color: rgb(143, 156, 162); |
|||
margin-bottom: 8px; |
|||
@include flex; |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
/** |
|||
* config 配置项说明 |
|||
* baseUrl = "", // 接口的根地址
|
|||
* tokenName = "Authorization", // 请求头中token的名字,与服务器端对应
|
|||
* loginTimeoutCode : "5000", // 登录超时或失效的情况下,服务器端返回的错误码
|
|||
* loginTimeoutPage = "/pages/login/index", // 登录超时或失效的情况下,跳转到的登录页面
|
|||
*/ |
|||
module.exports = { |
|||
baseUrl: 'http://jianguan.yyundong.com/api', |
|||
tokenName: "Authorization", // 请求头中token的名字,与服务器端对应
|
|||
loginTimeoutCode: "5001", // 登录超时或失效的情况下,服务器端返回的错误码
|
|||
loginTimeoutPage: "/pages/login/index", // 登录超时或失效的情况下,跳转到的登录页面
|
|||
} |
@ -0,0 +1,7 @@ |
|||
export default { |
|||
data() { |
|||
return { |
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,2 @@ |
|||
uni.$u.props.gap.bgColor = '#f3f4f6' |
|||
uni.$u.props.gap.height = '10' |
@ -0,0 +1,13 @@ |
|||
const { |
|||
http |
|||
} = uni.$u |
|||
|
|||
export default { |
|||
login: (params, config = {}) => http.post('/login', params, { |
|||
custom: { |
|||
catchError: true, |
|||
showFailMessage: true |
|||
} |
|||
}), |
|||
sayhello: (params = {}) => http.get("/sayb", params) |
|||
} |
@ -0,0 +1,9 @@ |
|||
import request from '@/utils/requester.js' |
|||
|
|||
export default { |
|||
login: (params = {}) => request.post("/portal/v1/sysuser/login", params), |
|||
sayhello: (params = {}) => request.get("/sayb", params), |
|||
getSalesReport: (params = {}) => request.get("/system/reportCenter/getSalesReport", params), |
|||
getGoodsOnWay: (params = {}) => request.get("/system/reportCenter/getGoodsOnWay", params), |
|||
getThresholdAnalysis: (params = {}) => request.get("/system/risk/getThresholdAnalysis", params) |
|||
} |
@ -0,0 +1,113 @@ |
|||
<template> |
|||
<view class="nav-wrap"> |
|||
<view class="nav-title"> |
|||
<u--image :showLoading="true" src="https://cdn.uviewui.com/uview/common/logo.png" width="70px" |
|||
height="70px" /> |
|||
<view class="nav-info"> |
|||
<view class="nav-info__title" @tap="jumpToWx"> |
|||
<text class="nav-info__title__text">uView {{version}}</text> |
|||
<!-- #ifdef MP-WEIXIN --> |
|||
<!-- uni-app不支持text内部的text组件的tap事件,所以放到外部响应tap --> |
|||
<text class="nav-info__title__jump">查看1.x演示</text> |
|||
<!-- #endif --> |
|||
</view> |
|||
<text class="nav-slogan">多平台快速开发的UI框架</text> |
|||
</view> |
|||
</view> |
|||
<text class="nav-desc">{{desc}}</text> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
props: { |
|||
desc: String, |
|||
title: String, |
|||
}, |
|||
data() { |
|||
return { |
|||
version: uni.$u.config.v |
|||
} |
|||
}, |
|||
methods: { |
|||
jumpToWx() { |
|||
// #ifdef MP-WEIXIN |
|||
uni.navigateToMiniProgram({ |
|||
appId: 'wx3be833c4a263e0c2' |
|||
}) |
|||
// #endif |
|||
} |
|||
}, |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.nav-wrap { |
|||
padding: 15px; |
|||
position: relative; |
|||
} |
|||
|
|||
.lang { |
|||
position: absolute; |
|||
top: 15px; |
|||
right: 15px; |
|||
} |
|||
|
|||
.nav-title { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: row; |
|||
align-items: center; |
|||
justify-content: flex-start; |
|||
} |
|||
|
|||
.nav-info { |
|||
margin-left: 15px; |
|||
|
|||
&__title { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: row; |
|||
align-items: center; |
|||
|
|||
&__text { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
color: $u-main-color; |
|||
font-size: 25px; |
|||
font-weight: bold; |
|||
text-align: left; |
|||
} |
|||
|
|||
&__jump { |
|||
font-size: 12px; |
|||
color: $u-primary; |
|||
font-weight: normal; |
|||
margin-left: 20px; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.logo { |
|||
width: 70px; |
|||
height: 70px; |
|||
/* #ifndef APP-NVUE */ |
|||
height: auto; |
|||
/* #endif */ |
|||
} |
|||
|
|||
.nav-slogan { |
|||
color: $u-tips-color; |
|||
font-size: 14px; |
|||
} |
|||
|
|||
.nav-desc { |
|||
margin-top: 10px; |
|||
font-size: 14px; |
|||
color: $u-content-color; |
|||
line-height: 20px; |
|||
} |
|||
</style> |
@ -0,0 +1,141 @@ |
|||
<template> |
|||
<view class="uni-section"> |
|||
<view class="uni-section-header" nvue> |
|||
<view v-if="type" class="uni-section__head"> |
|||
<view :class="type" class="uni-section__head-tag"/> |
|||
</view> |
|||
<view class="uni-section__content"> |
|||
<text :class="{'distraction':!subTitle}" :style="{color:color}" class="uni-section__content-title">{{ title }}</text> |
|||
<text v-if="subTitle" class="uni-section__content-sub">{{ subTitle }}</text> |
|||
</view> |
|||
</view> |
|||
<view :style="{padding: padding ? '10px' : ''}"> |
|||
<slot/> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
|
|||
/** |
|||
* Section 标题栏 |
|||
* @description 标题栏 |
|||
* @property {String} type = [line|circle] 标题装饰类型 |
|||
* @value line 竖线 |
|||
* @value circle 圆形 |
|||
* @property {String} title 主标题 |
|||
* @property {String} subTitle 副标题 |
|||
*/ |
|||
|
|||
export default { |
|||
name: 'UniSection', |
|||
emits:['click'], |
|||
props: { |
|||
type: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
title: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
color:{ |
|||
type: String, |
|||
default: '#333' |
|||
}, |
|||
subTitle: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
padding: { |
|||
type: Boolean, |
|||
default: false |
|||
} |
|||
}, |
|||
data() { |
|||
return {} |
|||
}, |
|||
watch: { |
|||
title(newVal) { |
|||
if (uni.report && newVal !== '') { |
|||
uni.report('title', newVal) |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
onClick() { |
|||
this.$emit('click') |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss" > |
|||
$uni-primary: #2979ff !default; |
|||
|
|||
.uni-section { |
|||
background-color: #fff; |
|||
// overflow: hidden; |
|||
margin-top: 10px; |
|||
padding-bottom: 1px; |
|||
} |
|||
.uni-section-header { |
|||
position: relative; |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: row; |
|||
align-items: center; |
|||
padding: 12px 10px; |
|||
// height: 50px; |
|||
font-weight: normal; |
|||
} |
|||
.uni-section__head { |
|||
flex-direction: row; |
|||
justify-content: center; |
|||
align-items: center; |
|||
margin-right: 10px; |
|||
} |
|||
|
|||
.line { |
|||
height: 12px; |
|||
background-color: $uni-primary; |
|||
border-radius: 10px; |
|||
width: 4px; |
|||
} |
|||
|
|||
.circle { |
|||
width: 8px; |
|||
height: 8px; |
|||
border-top-right-radius: 50px; |
|||
border-top-left-radius: 50px; |
|||
border-bottom-left-radius: 50px; |
|||
border-bottom-right-radius: 50px; |
|||
background-color: $uni-primary; |
|||
} |
|||
|
|||
.uni-section__content { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: column; |
|||
flex: 1; |
|||
color: #333; |
|||
} |
|||
|
|||
.uni-section__content-title { |
|||
font-size: 14px; |
|||
color: $uni-primary; |
|||
} |
|||
|
|||
.distraction { |
|||
flex-direction: row; |
|||
align-items: center; |
|||
} |
|||
|
|||
.uni-section__content-sub { |
|||
font-size: 12px; |
|||
color: #999; |
|||
line-height: 16px; |
|||
margin-top: 2px; |
|||
} |
|||
</style> |
@ -0,0 +1,14 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8" /> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|||
<title></title> |
|||
<!--preload-links--> |
|||
<!--app-context--> |
|||
</head> |
|||
<body> |
|||
<div id="app"><!--app-html--></div> |
|||
<script type="module" src="/main.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,31 @@ |
|||
import Vue from 'vue' |
|||
import App from './App' |
|||
// vuex
|
|||
import store from './store' |
|||
// 引入全局uView
|
|||
import uView from '@/uni_modules/uview-ui' |
|||
Vue.use(uView) |
|||
|
|||
import mixin from './common/mixin' |
|||
// #ifdef MP
|
|||
// 引入uView对小程序分享的mixin封装
|
|||
const mpShare = require('@/uni_modules/uview-ui/libs/mixin/mpShare.js') |
|||
Vue.mixin(mpShare) |
|||
// #endif
|
|||
Vue.mixin(mixin) |
|||
|
|||
import api from '@/common/request.api.js' |
|||
Vue.prototype.$api = api |
|||
|
|||
Vue.config.productionTip = false |
|||
App.mpType = 'app' |
|||
|
|||
const app = new Vue({ |
|||
store, |
|||
...App |
|||
}) |
|||
|
|||
// 引入请求封装
|
|||
require('./utils/request/index')(app) |
|||
|
|||
app.$mount() |
@ -0,0 +1,150 @@ |
|||
{ |
|||
"name" : "贷后监管", |
|||
"appid" : "__UNI__EDBF66C", |
|||
"description" : "汇融云眼贷后监管平台监管工具", |
|||
"versionName" : "1.0.0", |
|||
"versionCode" : 1, |
|||
"transformPx" : false, |
|||
"app-plus" : { |
|||
"optimization" : { |
|||
"subPackages" : true |
|||
}, |
|||
"safearea" : { |
|||
"bottom" : { |
|||
"offset" : "none" |
|||
} |
|||
}, |
|||
"splashscreen" : { |
|||
"alwaysShowBeforeRender" : true, |
|||
"waiting" : true, |
|||
"autoclose" : true, |
|||
"delay" : 0 |
|||
}, |
|||
"usingComponents" : true, |
|||
"nvueCompiler" : "uni-app", |
|||
"compilerVersion" : 3, |
|||
"modules" : { |
|||
"Webview-x5" : {} |
|||
}, |
|||
"distribute" : { |
|||
"android" : { |
|||
"permissions" : [ |
|||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", |
|||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", |
|||
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>", |
|||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", |
|||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", |
|||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", |
|||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", |
|||
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>", |
|||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", |
|||
"<uses-permission android:name=\"android.permission.CAMERA\"/>", |
|||
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>", |
|||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", |
|||
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>", |
|||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", |
|||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", |
|||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", |
|||
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>", |
|||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", |
|||
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", |
|||
"<uses-feature android:name=\"android.hardware.camera\"/>", |
|||
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", |
|||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" |
|||
], |
|||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ] |
|||
}, |
|||
"ios" : { |
|||
"idfa" : false, |
|||
"dSYMs" : false |
|||
}, |
|||
"sdkConfigs" : { |
|||
"ad" : {} |
|||
}, |
|||
"icons" : { |
|||
"android" : { |
|||
"hdpi" : "unpackage/res/icons/72x72.png", |
|||
"xhdpi" : "unpackage/res/icons/96x96.png", |
|||
"xxhdpi" : "unpackage/res/icons/144x144.png", |
|||
"xxxhdpi" : "unpackage/res/icons/192x192.png" |
|||
}, |
|||
"ios" : { |
|||
"appstore" : "unpackage/res/icons/1024x1024.png", |
|||
"ipad" : { |
|||
"app" : "unpackage/res/icons/76x76.png", |
|||
"app@2x" : "unpackage/res/icons/152x152.png", |
|||
"notification" : "unpackage/res/icons/20x20.png", |
|||
"notification@2x" : "unpackage/res/icons/40x40.png", |
|||
"proapp@2x" : "unpackage/res/icons/167x167.png", |
|||
"settings" : "unpackage/res/icons/29x29.png", |
|||
"settings@2x" : "unpackage/res/icons/58x58.png", |
|||
"spotlight" : "unpackage/res/icons/40x40.png", |
|||
"spotlight@2x" : "unpackage/res/icons/80x80.png" |
|||
}, |
|||
"iphone" : { |
|||
"app@2x" : "unpackage/res/icons/120x120.png", |
|||
"app@3x" : "unpackage/res/icons/180x180.png", |
|||
"notification@2x" : "unpackage/res/icons/40x40.png", |
|||
"notification@3x" : "unpackage/res/icons/60x60.png", |
|||
"settings@2x" : "unpackage/res/icons/58x58.png", |
|||
"settings@3x" : "unpackage/res/icons/87x87.png", |
|||
"spotlight@2x" : "unpackage/res/icons/80x80.png", |
|||
"spotlight@3x" : "unpackage/res/icons/120x120.png" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"quickapp" : {}, |
|||
"mp-weixin" : { |
|||
"appid" : "", |
|||
"setting" : { |
|||
"urlCheck" : false, |
|||
"es6" : false, |
|||
"minified" : false, |
|||
"postcss" : false |
|||
}, |
|||
"optimization" : { |
|||
"subPackages" : true |
|||
}, |
|||
"usingComponents" : true |
|||
}, |
|||
"mp-alipay" : { |
|||
"usingComponents" : true, |
|||
"component2" : true |
|||
}, |
|||
"mp-qq" : { |
|||
"optimization" : { |
|||
"subPackages" : true |
|||
}, |
|||
"appid" : "15646153" |
|||
}, |
|||
"mp-baidu" : { |
|||
"usingComponents" : true, |
|||
"appid" : "" |
|||
}, |
|||
"mp-toutiao" : { |
|||
"usingComponents" : true, |
|||
"appid" : "" |
|||
}, |
|||
"h5" : { |
|||
"template" : "template.h5.html", |
|||
"router" : { |
|||
"mode" : "history", |
|||
"base" : "" |
|||
}, |
|||
"optimization" : { |
|||
"treeShaking" : { |
|||
"enable" : false |
|||
} |
|||
}, |
|||
"title" : "贷后监管", |
|||
"sdkConfigs" : { |
|||
"maps" : {} |
|||
}, |
|||
"domain" : "", |
|||
"devServer" : { |
|||
"https" : false |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,81 @@ |
|||
{ |
|||
// "condition": { //模式配置,仅开发期间生效 |
|||
// "current": 0, //当前激活的模式(list 的索引项) |
|||
// "list": [{ |
|||
// "name": "test", //模式名称 |
|||
// "path": "pages/componentsA/test/test", //启动页面,必选 |
|||
// "query": "" //启动参数,在页面的onLoad函数里面得到 |
|||
// }] |
|||
// }, |
|||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages |
|||
{ |
|||
"path": "pages/login/login", |
|||
"style": { |
|||
"navigationBarTitleText": "登录", |
|||
"enablePullDownRefresh": false |
|||
} |
|||
}, { |
|||
"path": "pages/home/FindFragment", |
|||
"style": { |
|||
"navigationBarTitleText": "监管业务" |
|||
} |
|||
}, |
|||
{ |
|||
"path": "pages/home/AddFragment", |
|||
"style": { |
|||
"navigationBarTitleText": "操作记录" |
|||
} |
|||
}, { |
|||
"path": "pages/home/UserFragment", |
|||
"style": { |
|||
"navigationBarTitleText": "个人中心" |
|||
} |
|||
}, { |
|||
"path": "pages/index/index", |
|||
"style": { |
|||
"navigationBarTitleText": "汇融云眼贷后监管平台" |
|||
} |
|||
} |
|||
], |
|||
"globalStyle": { |
|||
"pageOrientation": "portrait", |
|||
"navigationBarTitleText": "汇融云眼贷后监管平台", |
|||
"navigationBarTextStyle": "white", |
|||
"navigationBarBackgroundColor": "#007AFF", |
|||
"backgroundColor": "#F8F8F8", |
|||
"backgroundColorTop": "#F4F5F6", |
|||
"backgroundColorBottom": "#F4F5F6", |
|||
"mp-360": { |
|||
"navigationStyle": "custom" |
|||
}, |
|||
"h5": { |
|||
"maxWidth": 1190, |
|||
"navigationBarTextStyle": "black", |
|||
"navigationBarBackgroundColor": "#F1F1F1" |
|||
} |
|||
|
|||
}, |
|||
"tabBar": { |
|||
"color": "#959595", |
|||
"selectedColor": "#41adf8", |
|||
"backgroundColor": "#FFFFFF", |
|||
"borderStyle": "black", |
|||
"list": [{ |
|||
"pagePath": "pages/home/FindFragment", |
|||
"iconPath": "static/bottom-icon/find_normal.png", |
|||
"selectedIconPath": "static/bottom-icon/find_press.png", |
|||
"text": "监管业务" |
|||
}, { |
|||
"pagePath": "pages/home/AddFragment", |
|||
"iconPath": "static/bottom-icon/add_normal.png", |
|||
"selectedIconPath": "static/bottom-icon/add_press.png", |
|||
"text": "操作记录" |
|||
}, { |
|||
"pagePath": "pages/home/UserFragment", |
|||
"iconPath": "static/bottom-icon/mine_normal.png", |
|||
"selectedIconPath": "static/bottom-icon/mine_press.png", |
|||
"text": "我的" |
|||
}] |
|||
|
|||
} |
|||
} |
@ -0,0 +1,301 @@ |
|||
<template> |
|||
<view class="content"> |
|||
|
|||
<view> |
|||
<view class="top_select"> |
|||
<text class="top_select_text">选择日期</text> |
|||
<uni-datetime-picker type="date" :clear-icon="false" v-model="queryParams.date" @change="dateChange" /> |
|||
</view> |
|||
|
|||
<view class="top_select" style="display: flex;"> |
|||
<text class="top_select_text">选择类型</text> |
|||
<uni-data-select style="flex-grow: 1;" v-model="queryParams.type" :localdata="range" @change="typeChange"></uni-data-select> |
|||
</view> |
|||
|
|||
<view class="top_select_btn"> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doQuery()">查询</button> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doReset()">重置 </button> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 20px;margin-left: 20px;"> |
|||
<text>当日数据</text> |
|||
<text style="margin-left: 10px;">{{newDate}}</text> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 15px;margin-left: 10px;margin-right: 10px;"> |
|||
<qiun-data-charts type="column" :opts="opts" :chartData="chartData" /> |
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 25px;margin-left: 15px;margin-right: 15px;"> |
|||
|
|||
<uni-table ref="table" :border="true" stripe type="" emptyText="暂无更多数据"> |
|||
<uni-tr> |
|||
<uni-th align="center">现金流量-经营活动产生的现金流量(元)</uni-th> |
|||
<uni-th align="center">总额</uni-th> |
|||
</uni-tr> |
|||
<uni-tr v-for="(item, index) in tableData" :key="index"> |
|||
<uni-td align="center">{{ item.name }}</uni-td> |
|||
<uni-td align="center">{{ item.price }}</uni-td> |
|||
</uni-tr> |
|||
</uni-table> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 25px;margin-left: 15px;margin-right: 15px;"> |
|||
|
|||
<uni-table ref="table" :border="true" stripe type="" emptyText="暂无更多数据"> |
|||
<uni-tr> |
|||
<uni-th width="200" align="center">销售渠道类别</uni-th> |
|||
<uni-th align="center">总额</uni-th> |
|||
<uni-th align="center">应收帐款</uni-th> |
|||
<uni-th align="center">扣除应收</uni-th> |
|||
</uni-tr> |
|||
<uni-tr v-for="(item, index) in tableData2" :key="index"> |
|||
<uni-td align="center">{{ item.name }}</uni-td> |
|||
<uni-td align="center">{{ item.totalAmount }}</uni-td> |
|||
<uni-td align="center">{{ item.accountsReceivable }}</uni-td> |
|||
<uni-td align="center">{{ item.deductionAccountsReceivable }}</uni-td> |
|||
</uni-tr> |
|||
</uni-table> |
|||
|
|||
|
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
newDate: this.getDate(), |
|||
// 类型1.全部,2.常规商品3.烟草 |
|||
range: [{ |
|||
"value": 1, |
|||
"text": "全部", |
|||
}, |
|||
{ |
|||
"value": 2, |
|||
"text": "常规商品", |
|||
}, { |
|||
"value": 3, |
|||
"text": "烟草", |
|||
} |
|||
], |
|||
tableData: [{ |
|||
name: "销售商品收到的现金(元)", |
|||
price: "2000000", |
|||
}, |
|||
{ |
|||
name: "收到其他与经营活动有关的现金(元)", |
|||
price: "28700", |
|||
}, |
|||
{ |
|||
name: "本项合计", |
|||
price: "123456", |
|||
}, |
|||
], |
|||
tableData2: [{ |
|||
name: "销售商品收到的现金(元)", |
|||
totalAmount: "2000000", |
|||
accountsReceivable: "31914", |
|||
deductionAccountsReceivable: "35793" |
|||
}, |
|||
{ |
|||
name: "连锁内加盟", |
|||
totalAmount: "2000000", |
|||
accountsReceivable: "31914", |
|||
deductionAccountsReceivable: "35793" |
|||
}, |
|||
{ |
|||
name: "配送中心", |
|||
totalAmount: "2000000", |
|||
accountsReceivable: "31914", |
|||
deductionAccountsReceivable: "35793", |
|||
}, { |
|||
name: "连锁外加盟", |
|||
totalAmount: "2000000", |
|||
accountsReceivable: "31914", |
|||
deductionAccountsReceivable: "35793", |
|||
} |
|||
], |
|||
chartData: {}, |
|||
opts: { |
|||
xAxis: { |
|||
disableGrid: true |
|||
}, |
|||
yAxis: { |
|||
data: [{ |
|||
min: 0 |
|||
}] |
|||
}, |
|||
extra: { |
|||
column: { |
|||
type: "group" |
|||
} |
|||
} |
|||
}, |
|||
queryParams: { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
} |
|||
}; |
|||
}, |
|||
onReady() { |
|||
this.getServerData(); |
|||
}, |
|||
methods: { |
|||
getDate() { |
|||
var tempDate = new Date() // 获取今天的日期 |
|||
tempDate.setDate(tempDate.getDate() - 1) // 今天的前N天的日期,N自定义 |
|||
var endDate = tempDate.getFullYear() + '-' + (tempDate.getMonth() + 1) + '-' + tempDate.getDate() |
|||
console.log(endDate) |
|||
return endDate |
|||
}, |
|||
dateChange(e) { |
|||
console.log('----dateChange事件:', e); |
|||
|
|||
}, |
|||
typeChange(e) { |
|||
console.log('e:', e); |
|||
this.queryParams.type = e |
|||
}, |
|||
doQuery() { |
|||
this.newDate = this.queryParams.date |
|||
this.getServerData(); |
|||
}, |
|||
doReset() { |
|||
this.queryParams = { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
} |
|||
this.newDate = this.getDate() |
|||
this.getServerData(); |
|||
}, |
|||
getServerData() { |
|||
// var _this = this |
|||
// this.$api.getSalesReport(_this.queryParams).then((resp) => { |
|||
// // if (resp.success) { |
|||
// console.log('1111', resp.data) |
|||
// // const data = resp.data |
|||
// // _this.dataList = data.financialData |
|||
// // _this.listSalesChannelData = data.listSalesChannelData |
|||
// // _this.drawLine(data.financialAnalysisChartData) |
|||
// // this.tableLoading = false |
|||
// // } else { |
|||
// // // 根据resp.code进行异常情况处理 |
|||
// // _this.dataList = [] |
|||
// // _this.listSalesChannelData = [] |
|||
// } |
|||
// }).catch(e => { |
|||
// console.log('eeeee', e) |
|||
// _this.tableLoading = false |
|||
// }) |
|||
let source = [ |
|||
['product', '分销商进货额', '实际发货额'], |
|||
['1-1', "30816", '28700'], |
|||
['1-2', '20960', '15471'], |
|||
['1-3', 31465, 41573], |
|||
['1-4', 32796, 26290], |
|||
['1-5', 31914, 28749], |
|||
['1-6', 35793, 58339], |
|||
['1-7', 33370, 16888] |
|||
] |
|||
|
|||
let _title = [] |
|||
let _categories = [] |
|||
let _data1 = [] |
|||
let _data2 = [] |
|||
for (var i = 0; i < source.length; i++) { |
|||
// 取标题 |
|||
if (i == 0) { |
|||
let title = source[0] |
|||
for (var j = 1; j < title.length; j++) { |
|||
_title.push(title[j]) |
|||
} |
|||
} else { |
|||
// 取日期 |
|||
let data = source[i] |
|||
_categories.push(data[0]) |
|||
// 取数值 |
|||
_data1.push(data[1]) |
|||
_data2.push(data[2]) |
|||
} |
|||
} |
|||
|
|||
// 拼接 |
|||
let res = { |
|||
categories: _categories, |
|||
series: [{ |
|||
name: _title[0], |
|||
data: _data1 |
|||
}, |
|||
{ |
|||
name: _title[1], |
|||
data: _data2 |
|||
} |
|||
] |
|||
}; |
|||
this.chartData = JSON.parse(JSON.stringify(res)); |
|||
|
|||
// setTimeout(() => { |
|||
// //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接 |
|||
// let res = { |
|||
// categories: ["2016", "2017", "2018", "2019", "2020", "2021"], |
|||
// series: [{ |
|||
// name: "分销商进货额", |
|||
// data: [35, 36, 31, 33, 13, 34] |
|||
// }, |
|||
// { |
|||
// name: "实际发货额", |
|||
// data: [18, 27, 21, 24, 6, 28] |
|||
// } |
|||
// ] |
|||
// }; |
|||
// this.chartData = JSON.parse(JSON.stringify(res)); |
|||
// }, 100); |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.content { |
|||
background: #fff; |
|||
padding-top: 10px; |
|||
} |
|||
|
|||
.top_select { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 10px; |
|||
align-items: center; |
|||
} |
|||
|
|||
.top_select_text { |
|||
margin-right: 10px; |
|||
} |
|||
|
|||
.top_select_btn { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 15px; |
|||
align-items: center; |
|||
} |
|||
</style> |
@ -0,0 +1,288 @@ |
|||
<template> |
|||
<view class="content"> |
|||
|
|||
<view> |
|||
<view class="top_select"> |
|||
<text class="top_select_text">选择日期</text> |
|||
<uni-datetime-picker type="date" :clear-icon="false" v-model="queryParams.date" @change="dateChange" /> |
|||
</view> |
|||
|
|||
<view class="top_select" style="display: flex;"> |
|||
<text class="top_select_text">选择类型</text> |
|||
<uni-data-select style="flex-grow: 1;" v-model="queryParams.type" :localdata="range" |
|||
@change="typeChange"></uni-data-select> |
|||
</view> |
|||
|
|||
<view class="top_select_btn"> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doQuery()">查询</button> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doReset()">重置 </button> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 20px;margin-left: 20px;"> |
|||
<text>当日数据</text> |
|||
<text style="margin-left: 10px;">{{newDate}}</text> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 15px;margin-left: 10px;margin-right: 10px; width: 100%; |
|||
height: 300px;"> |
|||
<qiun-data-charts type="pie" :opts="opts" :chartData="chartData" /> |
|||
</view> |
|||
|
|||
<view style="margin-top: 25px;margin-left: 15px;margin-right: 15px;"> |
|||
|
|||
<uni-table ref="table" :border="true" stripe type="" emptyText="暂无更多数据"> |
|||
<uni-tr> |
|||
<uni-th width="60" align="center">序号</uni-th> |
|||
<uni-th align="center">供应商名称</uni-th> |
|||
<uni-th width="120" align="center">全部到货日期</uni-th> |
|||
<uni-th width="120" align="center">是否延期</uni-th> |
|||
</uni-tr> |
|||
<uni-tr v-for="(item, index) in tableData" :key="index"> |
|||
<uni-td align="center">{{item.num}}</uni-td> |
|||
<uni-td align="center">{{ item.supplierName }}</uni-td> |
|||
<uni-td align="center">{{ item.allArrivedDate }}</uni-td> |
|||
<uni-td align="center">{{ item.isDelay }}</uni-td> |
|||
</uni-tr> |
|||
</uni-table> |
|||
|
|||
|
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
newDate: this.getDate(), |
|||
// 类型1.全部,2.常规商品3.烟草 |
|||
range: [{ |
|||
"value": 1, |
|||
"text": "全部", |
|||
}, |
|||
{ |
|||
"value": 2, |
|||
"text": "常规商品", |
|||
}, { |
|||
"value": 3, |
|||
"text": "烟草", |
|||
} |
|||
], |
|||
tableData: [{ |
|||
"isDelay": "是", |
|||
"supplierName": "中粮可口可乐饮料(河北)有限公司", |
|||
"num": 1, |
|||
"supplierSid": "28", |
|||
"allArrivedDate": "1993-10-16" |
|||
}, |
|||
{ |
|||
"isDelay": "否", |
|||
"supplierName": "中顺洁柔纸业股份有限公司", |
|||
"num": 2, |
|||
"supplierSid": "18", |
|||
"allArrivedDate": "1993-08-12" |
|||
}, |
|||
{ |
|||
"isDelay": "是", |
|||
"supplierName": "今麦郎食品股份有限公司石家庄分公司", |
|||
"num": 3, |
|||
"supplierSid": "08", |
|||
"allArrivedDate": "2003-12-16" |
|||
}, |
|||
{ |
|||
"isDelay": "是", |
|||
"supplierName": "农夫山泉股份有限公司", |
|||
"num": 4, |
|||
"supplierSid": "48", |
|||
"allArrivedDate": "2013-10-16" |
|||
}, |
|||
{ |
|||
"isDelay": "否", |
|||
"supplierName": "北京百事可乐饮料有限公司", |
|||
"num": 5, |
|||
"supplierSid": "12", |
|||
"allArrivedDate": "2008-03-11" |
|||
}, |
|||
{ |
|||
"isDelay": "是", |
|||
"supplierName": "今麦郎食品股份有限公司石家庄分公司", |
|||
"num": 6, |
|||
"supplierSid": "03", |
|||
"allArrivedDate": "1996-11-20" |
|||
}, |
|||
{ |
|||
"isDelay": "是", |
|||
"supplierName": "农夫山泉股份有限公司", |
|||
"num": 7, |
|||
"supplierSid": "68", |
|||
"allArrivedDate": "2022-10-23" |
|||
}, |
|||
{ |
|||
"isDelay": "否", |
|||
"supplierName": "北京百事可乐饮料有限公司", |
|||
"num": 8, |
|||
"supplierSid": "88", |
|||
"allArrivedDate": "2014-06-02" |
|||
} |
|||
], |
|||
chartData: {}, |
|||
//您可以通过修改 config-ucharts.js 文件中下标为 ['pie'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。 |
|||
opts: { |
|||
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", |
|||
"#ea7ccc" |
|||
], |
|||
padding: [5, 5, 5, 5], |
|||
enableScroll: false, |
|||
extra: { |
|||
pie: { |
|||
activeOpacity: 0.5, |
|||
activeRadius: 10, |
|||
offsetAngle: 0, |
|||
labelWidth: 15, |
|||
border: true, |
|||
borderWidth: 3, |
|||
borderColor: "#FFFFFF", |
|||
linearType: "custom" |
|||
} |
|||
} |
|||
}, |
|||
queryParams: { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
} |
|||
}; |
|||
}, |
|||
onReady() { |
|||
this.getServerData(); |
|||
}, |
|||
methods: { |
|||
getDate() { |
|||
var tempDate = new Date() // 获取今天的日期 |
|||
tempDate.setDate(tempDate.getDate() - 1) // 今天的前N天的日期,N自定义 |
|||
var endDate = tempDate.getFullYear() + '-' + (tempDate.getMonth() + 1) + '-' + tempDate.getDate() |
|||
console.log(endDate) |
|||
return endDate |
|||
}, |
|||
dateChange(e) { |
|||
console.log('----dateChange事件:', e); |
|||
|
|||
}, |
|||
typeChange(e) { |
|||
console.log('e:', e); |
|||
this.queryParams.type = e |
|||
}, |
|||
doQuery() { |
|||
this.newDate = this.queryParams.date |
|||
this.getServerData(); |
|||
}, |
|||
doReset() { |
|||
this.queryParams = { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
} |
|||
this.newDate = this.getDate() |
|||
this.getServerData(); |
|||
}, |
|||
getServerData() { |
|||
// var _this = this |
|||
// this.$api.getGoodsOnWay(_this.queryParams).then((resp) => { |
|||
// // if (resp.success) { |
|||
// console.log('1111', resp.data) |
|||
// // const data = resp.data |
|||
// // _this.dataList = data.financialData |
|||
// // _this.listSalesChannelData = data.listSalesChannelData |
|||
// // _this.drawLine(data.financialAnalysisChartData) |
|||
// // this.tableLoading = false |
|||
// // } else { |
|||
// // // 根据resp.code进行异常情况处理 |
|||
// // _this.dataList = [] |
|||
// // _this.listSalesChannelData = [] |
|||
// } |
|||
// }).catch(e => { |
|||
// console.log('eeeee', e) |
|||
// _this.tableLoading = false |
|||
// }) |
|||
let source = [{ |
|||
"value": 2313123, |
|||
"name": "订单总额" |
|||
}, |
|||
{ |
|||
"value": 4359354, |
|||
"name": "实际到货价值" |
|||
}, |
|||
{ |
|||
"value": 2313123, |
|||
"name": "在途货价值" |
|||
}, |
|||
{ |
|||
"value": 56516849, |
|||
"name": "超出价值" |
|||
} |
|||
] |
|||
|
|||
// let res = { |
|||
// series: [{ |
|||
// data: source, |
|||
// }] |
|||
// }; |
|||
|
|||
// this.chartData = JSON.parse(JSON.stringify(res)); |
|||
|
|||
setTimeout(() => { |
|||
//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接 |
|||
let res = { |
|||
series: [{ |
|||
data: source |
|||
}] |
|||
}; |
|||
this.chartData = JSON.parse(JSON.stringify(res)); |
|||
}, 500); |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.charts-box { |
|||
width: 100%; |
|||
height: 300px; |
|||
} |
|||
|
|||
.content { |
|||
background: #fff; |
|||
padding-top: 10px; |
|||
} |
|||
|
|||
.top_select { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 10px; |
|||
align-items: center; |
|||
} |
|||
|
|||
.top_select_text { |
|||
margin-right: 10px; |
|||
} |
|||
|
|||
.top_select_btn { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 15px; |
|||
align-items: center; |
|||
} |
|||
</style> |
@ -0,0 +1,254 @@ |
|||
<template> |
|||
<view class="content"> |
|||
|
|||
<view> |
|||
<view class="top_select"> |
|||
<text class="top_select_text">选择日期</text> |
|||
<uni-datetime-picker type="date" :clear-icon="false" v-model="queryParams.date" @change="dateChange" /> |
|||
</view> |
|||
|
|||
<view class="top_select" style="display: flex;"> |
|||
<text class="top_select_text">选择类型</text> |
|||
<uni-data-select style="flex-grow: 1;" v-model="queryParams.type" :localdata="range" |
|||
@change="typeChange"></uni-data-select> |
|||
</view> |
|||
|
|||
<view class="top_select_btn"> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doQuery()">查询</button> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doReset()">重置 </button> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
newDate: this.getDate(), |
|||
// 类型1.全部,2.常规商品3.烟草 |
|||
range: [{ |
|||
"value": 1, |
|||
"text": "全部", |
|||
}, |
|||
{ |
|||
"value": 2, |
|||
"text": "常规商品", |
|||
}, { |
|||
"value": 3, |
|||
"text": "烟草", |
|||
} |
|||
], |
|||
tableData: [{ |
|||
"isDelay": "是", |
|||
"supplierName": "中粮可口可乐饮料(河北)有限公司", |
|||
"num": 1, |
|||
"supplierSid": "28", |
|||
"allArrivedDate": "1993-10-16" |
|||
}, |
|||
{ |
|||
"isDelay": "否", |
|||
"supplierName": "中顺洁柔纸业股份有限公司", |
|||
"num": 2, |
|||
"supplierSid": "18", |
|||
"allArrivedDate": "1993-08-12" |
|||
}, |
|||
{ |
|||
"isDelay": "是", |
|||
"supplierName": "今麦郎食品股份有限公司石家庄分公司", |
|||
"num": 3, |
|||
"supplierSid": "08", |
|||
"allArrivedDate": "2003-12-16" |
|||
}, |
|||
{ |
|||
"isDelay": "是", |
|||
"supplierName": "农夫山泉股份有限公司", |
|||
"num": 4, |
|||
"supplierSid": "48", |
|||
"allArrivedDate": "2013-10-16" |
|||
}, |
|||
{ |
|||
"isDelay": "否", |
|||
"supplierName": "北京百事可乐饮料有限公司", |
|||
"num": 5, |
|||
"supplierSid": "12", |
|||
"allArrivedDate": "2008-03-11" |
|||
}, |
|||
{ |
|||
"isDelay": "是", |
|||
"supplierName": "今麦郎食品股份有限公司石家庄分公司", |
|||
"num": 6, |
|||
"supplierSid": "03", |
|||
"allArrivedDate": "1996-11-20" |
|||
}, |
|||
{ |
|||
"isDelay": "是", |
|||
"supplierName": "农夫山泉股份有限公司", |
|||
"num": 7, |
|||
"supplierSid": "68", |
|||
"allArrivedDate": "2022-10-23" |
|||
}, |
|||
{ |
|||
"isDelay": "否", |
|||
"supplierName": "北京百事可乐饮料有限公司", |
|||
"num": 8, |
|||
"supplierSid": "88", |
|||
"allArrivedDate": "2014-06-02" |
|||
} |
|||
], |
|||
chartData: {}, |
|||
//您可以通过修改 config-ucharts.js 文件中下标为 ['pie'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。 |
|||
opts: { |
|||
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", |
|||
"#ea7ccc" |
|||
], |
|||
padding: [5, 5, 5, 5], |
|||
enableScroll: false, |
|||
extra: { |
|||
pie: { |
|||
activeOpacity: 0.5, |
|||
activeRadius: 10, |
|||
offsetAngle: 0, |
|||
labelWidth: 15, |
|||
border: true, |
|||
borderWidth: 3, |
|||
borderColor: "#FFFFFF", |
|||
linearType: "custom" |
|||
} |
|||
} |
|||
}, |
|||
queryParams: { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
} |
|||
}; |
|||
}, |
|||
onReady() { |
|||
this.getServerData(); |
|||
}, |
|||
methods: { |
|||
getDate() { |
|||
var tempDate = new Date() // 获取今天的日期 |
|||
tempDate.setDate(tempDate.getDate() - 1) // 今天的前N天的日期,N自定义 |
|||
var endDate = tempDate.getFullYear() + '-' + (tempDate.getMonth() + 1) + '-' + tempDate.getDate() |
|||
console.log(endDate) |
|||
return endDate |
|||
}, |
|||
dateChange(e) { |
|||
console.log('----dateChange事件:', e); |
|||
|
|||
}, |
|||
typeChange(e) { |
|||
console.log('e:', e); |
|||
this.queryParams.type = e |
|||
}, |
|||
doQuery() { |
|||
this.newDate = this.queryParams.date |
|||
this.getServerData(); |
|||
}, |
|||
doReset() { |
|||
this.queryParams = { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
} |
|||
this.newDate = this.getDate() |
|||
this.getServerData(); |
|||
}, |
|||
getServerData() { |
|||
// var _this = this |
|||
// this.$api.getGoodsOnWay(_this.queryParams).then((resp) => { |
|||
// // if (resp.success) { |
|||
// console.log('1111', resp.data) |
|||
// // const data = resp.data |
|||
// // _this.dataList = data.financialData |
|||
// // _this.listSalesChannelData = data.listSalesChannelData |
|||
// // _this.drawLine(data.financialAnalysisChartData) |
|||
// // this.tableLoading = false |
|||
// // } else { |
|||
// // // 根据resp.code进行异常情况处理 |
|||
// // _this.dataList = [] |
|||
// // _this.listSalesChannelData = [] |
|||
// } |
|||
// }).catch(e => { |
|||
// console.log('eeeee', e) |
|||
// _this.tableLoading = false |
|||
// }) |
|||
let source = [{ |
|||
"value": 2313123, |
|||
"name": "订单总额" |
|||
}, |
|||
{ |
|||
"value": 4359354, |
|||
"name": "实际到货价值" |
|||
}, |
|||
{ |
|||
"value": 2313123, |
|||
"name": "在途货价值" |
|||
}, |
|||
{ |
|||
"value": 56516849, |
|||
"name": "超出价值" |
|||
} |
|||
] |
|||
|
|||
// let res = { |
|||
// series: [{ |
|||
// data: source, |
|||
// }] |
|||
// }; |
|||
|
|||
// this.chartData = JSON.parse(JSON.stringify(res)); |
|||
|
|||
setTimeout(() => { |
|||
//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接 |
|||
let res = { |
|||
series: [{ |
|||
data: source |
|||
}] |
|||
}; |
|||
this.chartData = JSON.parse(JSON.stringify(res)); |
|||
}, 500); |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.charts-box { |
|||
width: 100%; |
|||
height: 300px; |
|||
} |
|||
|
|||
.content { |
|||
background: #fff; |
|||
padding-top: 10px; |
|||
} |
|||
|
|||
.top_select { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 10px; |
|||
align-items: center; |
|||
} |
|||
|
|||
.top_select_text { |
|||
margin-right: 10px; |
|||
} |
|||
|
|||
.top_select_btn { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 15px; |
|||
align-items: center; |
|||
} |
|||
</style> |
@ -0,0 +1,220 @@ |
|||
<template> |
|||
<view class="content"> |
|||
|
|||
<view> |
|||
<view class="top_select"> |
|||
<text class="top_select_text">选择日期</text> |
|||
<uni-datetime-picker type="date" :clear-icon="false" v-model="queryParams.date" @change="dateChange" /> |
|||
</view> |
|||
|
|||
<view class="top_select" style="display: flex;"> |
|||
<text class="top_select_text">选择类型</text> |
|||
<uni-data-select style="flex-grow: 1;" v-model="queryParams.type" :localdata="range" |
|||
@change="typeChange"></uni-data-select> |
|||
</view> |
|||
|
|||
<view class="top_select_btn"> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doQuery()">查询</button> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doReset()">重置 </button> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 20px;margin-left: 20px;"> |
|||
<text>当日数据</text> |
|||
<text style="margin-left: 10px;">{{newDate}}</text> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 15px;margin-left: 10px;margin-right: 10px;"> |
|||
<qiun-data-charts type="mix" :opts="opts" :chartData="chartData" /> |
|||
</view> |
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
newDate: this.getDate(), |
|||
// 类型1.全部,2.常规商品3.烟草 |
|||
range: [{ |
|||
"value": 1, |
|||
"text": "全部", |
|||
}, |
|||
{ |
|||
"value": 2, |
|||
"text": "常规商品", |
|||
}, { |
|||
"value": 3, |
|||
"text": "烟草", |
|||
} |
|||
], |
|||
chartData: {}, |
|||
opts: { |
|||
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", |
|||
"#ea7ccc" |
|||
], |
|||
padding: [15, 15, 0, 15], |
|||
enableScroll: false, |
|||
legend: {}, |
|||
xAxis: { |
|||
disableGrid: true, |
|||
title: "" |
|||
}, |
|||
yAxis: { |
|||
disabled: false, |
|||
disableGrid: false, |
|||
splitNumber: 5, |
|||
gridType: "dash", |
|||
dashLength: 4, |
|||
gridColor: "#CCCCCC", |
|||
padding: 10, |
|||
showTitle: true, |
|||
data: [{ |
|||
position: "left", |
|||
title: "折线" |
|||
}, |
|||
{ |
|||
position: "right", |
|||
min: 0, |
|||
max: 200, |
|||
title: "柱状图", |
|||
textAlign: "left" |
|||
} |
|||
] |
|||
}, |
|||
extra: { |
|||
mix: { |
|||
column: { |
|||
width: 20 |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
queryParams: { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
} |
|||
}; |
|||
}, |
|||
onReady() { |
|||
this.getServerData(); |
|||
}, |
|||
methods: { |
|||
getDate() { |
|||
var tempDate = new Date() // 获取今天的日期 |
|||
tempDate.setDate(tempDate.getDate() - 1) // 今天的前N天的日期,N自定义 |
|||
var endDate = tempDate.getFullYear() + '-' + (tempDate.getMonth() + 1) + '-' + tempDate.getDate() |
|||
console.log(endDate) |
|||
return endDate |
|||
}, |
|||
dateChange(e) { |
|||
console.log('----dateChange事件:', e); |
|||
|
|||
}, |
|||
typeChange(e) { |
|||
console.log('e:', e); |
|||
this.queryParams.type = e |
|||
}, |
|||
doQuery() { |
|||
this.newDate = this.queryParams.date |
|||
this.getServerData(); |
|||
}, |
|||
doReset() { |
|||
this.queryParams = { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
} |
|||
this.newDate = this.getDate() |
|||
this.getServerData(); |
|||
}, |
|||
getServerData() { |
|||
// var _this = this |
|||
// this.$api.getThresholdAnalysis(_this.queryParams).then((resp) => { |
|||
// // if (resp.success) { |
|||
// console.log('1111', resp.data) |
|||
// // const data = resp.data |
|||
// // _this.dataList = data.financialData |
|||
// // _this.listSalesChannelData = data.listSalesChannelData |
|||
// // _this.drawLine(data.financialAnalysisChartData) |
|||
// // this.tableLoading = false |
|||
// // } else { |
|||
// // // 根据resp.code进行异常情况处理 |
|||
// // _this.dataList = [] |
|||
// // _this.listSalesChannelData = [] |
|||
// } |
|||
// }).catch(e => { |
|||
// console.log('eeeee', e) |
|||
// _this.tableLoading = false |
|||
// }) |
|||
|
|||
setTimeout(() => { |
|||
//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接 |
|||
let res = { |
|||
categories: ["2018", "2019", "2020", "2021", "2022", "2023"], |
|||
series: [{ |
|||
name: "柱1", |
|||
index: 1, |
|||
type: "column", |
|||
data: [40, { |
|||
"value": 30, |
|||
"color": "#f04864" |
|||
}, 55, 110, 24, 58] |
|||
}, |
|||
{ |
|||
name: "柱2", |
|||
index: 1, |
|||
type: "column", |
|||
data: [50, 20, 75, 60, 34, 38] |
|||
}, |
|||
{ |
|||
name: "折线", |
|||
type: "line", |
|||
color: "#2fc25b", |
|||
data: [120, 140, 105, 170, 95, 160] |
|||
} |
|||
] |
|||
}; |
|||
this.chartData = JSON.parse(JSON.stringify(res)); |
|||
}, 500); |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.content { |
|||
background: #fff; |
|||
padding-top: 10px; |
|||
} |
|||
|
|||
.top_select { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 10px; |
|||
align-items: center; |
|||
} |
|||
|
|||
.top_select_text { |
|||
margin-right: 10px; |
|||
} |
|||
|
|||
.top_select_btn { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 15px; |
|||
align-items: center; |
|||
} |
|||
</style> |
@ -0,0 +1,81 @@ |
|||
<template> |
|||
<view class="app-container"> |
|||
<uni-row class="demo-uni-row" :width="nvueWidth"> |
|||
<uni-col :span="16"> |
|||
<view>汇融云眼贷后监管平台</view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view>设置</view> |
|||
</uni-col> |
|||
</uni-row> |
|||
<uni-grid :column="2" style="margin-top: 20px;"> |
|||
<uni-grid-item> |
|||
<button type="default">入库登记</button> |
|||
</uni-grid-item> |
|||
<uni-grid-item> |
|||
<button type="default">出库登记</button> |
|||
</uni-grid-item> |
|||
<uni-grid-item> |
|||
<button type="default">油罐读数</button> |
|||
</uni-grid-item> |
|||
<uni-grid-item> |
|||
<button type="default">操作记录</button> |
|||
</uni-grid-item> |
|||
</uni-grid> |
|||
<uni-col :span="24" style="margin-top: 20px;"> |
|||
<view>个人</view> |
|||
</uni-col> |
|||
</uni-row> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
href: '', |
|||
gv: {}, |
|||
resinfo: '' |
|||
} |
|||
}, |
|||
onLoad() { |
|||
this.initData() |
|||
}, |
|||
methods: { |
|||
initData() { |
|||
this.gv = getApp().globalData |
|||
console.log('hasLogin', this.$store.getters.hasLogin) |
|||
console.log('token', this.$store.getters.token) |
|||
console.log('uinfo', this.$store.getters.userinfo) |
|||
console.log('uinfo-id', this.$store.getters.userinfo.userid) |
|||
console.log('uinfo-name', this.$store.getters.userinfo.name) |
|||
getApp().globalData.uinfo = this.$store.getters.userinfo |
|||
}, |
|||
sayhello() { |
|||
this.$api.sayhello({ |
|||
name: 'mynameislll' |
|||
}).then(res => { |
|||
this.resinfo = res |
|||
}) |
|||
}, |
|||
logout() { |
|||
this.$store.dispatch('logout').then(() => { |
|||
console.log('NNNN:退出 ') |
|||
}) |
|||
}, |
|||
gologin() { |
|||
uni.reLaunch({ |
|||
url: '/pages/login/index' |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.container { |
|||
padding: 20px; |
|||
font-size: 14px; |
|||
line-height: 24px; |
|||
} |
|||
</style> |
@ -0,0 +1,90 @@ |
|||
<template> |
|||
<view class="u-page"> |
|||
<uni-section title="汇融云眼贷后监管平台" type="line"> |
|||
<uni-card :is-shadow="false" :isFull="true" :border="true"> |
|||
<text> |
|||
汇融云眼贷后监管平台,醇油坊项目监管工具。 |
|||
</text> |
|||
</uni-card> |
|||
<uni-card title="登录" :thumbnail="avatar" sub-title="监管人员登录后进行监管记录等操作" extra="" |
|||
note="Tips"> |
|||
<uni-forms ref="form" :modelValue="formData" :rules="rules"> |
|||
<uni-forms-item label="账号:" name="userName"> |
|||
<uni-easyinput prefixIcon="person" type="text" v-model="formData.userName" |
|||
placeholder="请输入账号" /> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="密码:" name="password"> |
|||
<uni-easyinput prefixIcon="locked" type="password" v-model="formData.password" |
|||
placeholder="请输入密码" /> |
|||
</uni-forms-item> |
|||
</uni-forms> |
|||
<button @click="dologin">登录</button> |
|||
</uni-card> |
|||
</uni-section> |
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
avatar: '/static/logo.png', |
|||
vavatar: '/static/uview/common/logo.png', |
|||
// 表单数据 |
|||
formData: { |
|||
userName: 'admin', |
|||
password: '111111' |
|||
}, |
|||
rules: { |
|||
// 对name字段进行必填验证 |
|||
name: { |
|||
rules: [{ |
|||
required: true, |
|||
errorMessage: '账号不可以为空' |
|||
}] |
|||
}, |
|||
// 对passwd字段进行必填验证 |
|||
passwd: { |
|||
rules: [{ |
|||
required: true, |
|||
errorMessage: '密码不可以为空' |
|||
}] |
|||
} |
|||
}, |
|||
} |
|||
}, |
|||
methods: { |
|||
dologin() { |
|||
let _this = this |
|||
this.$refs.form |
|||
.validate() |
|||
.then(r => { |
|||
_this.$store |
|||
.dispatch('login', _this.formData) |
|||
.then(uinfo => { |
|||
console.log('MMMM:', uinfo) |
|||
getApp().globalData.username = uinfo.name |
|||
getApp().globalData.token = uinfo.token |
|||
console.log('gd--:', getApp().globalData) |
|||
uni.redirectTo({ |
|||
url: '/pages/index/index', |
|||
}) |
|||
// uni.switchTab({ |
|||
// url: '/pages/home/FindFragment' |
|||
// }); |
|||
|
|||
}) |
|||
.catch(er => { |
|||
console.log('EEEE:', er) |
|||
}) |
|||
}) |
|||
.catch(err => { |
|||
console.log('eeee:', err) |
|||
}) |
|||
} |
|||
}, |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
@ -0,0 +1,224 @@ |
|||
'use strict' |
|||
|
|||
// 等待初始化完毕
|
|||
document.addEventListener('UniAppJSBridgeReady', () => { |
|||
document.body.onclick = function () { |
|||
return uni.postMessage({ |
|||
data: { |
|||
action: 'onClick' |
|||
} |
|||
}) |
|||
} |
|||
|
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onJSBridgeReady' |
|||
} |
|||
}) |
|||
}) |
|||
let options |
|||
let medias = [] |
|||
/** |
|||
* @description 获取标签的所有属性 |
|||
* @param {Element} ele |
|||
*/ |
|||
|
|||
function getAttrs(ele) { |
|||
const attrs = Object.create(null) |
|||
|
|||
for (let i = ele.attributes.length; i--;) { |
|||
attrs[ele.attributes[i].name] = ele.attributes[i].value |
|||
} |
|||
|
|||
return attrs |
|||
} |
|||
/** |
|||
* @description 图片加载出错 |
|||
*/ |
|||
|
|||
function onImgError() { |
|||
if (options[1]) { |
|||
this.src = options[1] |
|||
this.onerror = null |
|||
} // 取消监听点击
|
|||
|
|||
this.onclick = null |
|||
this.ontouchstart = null |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onError', |
|||
source: 'img', |
|||
attrs: getAttrs(this) |
|||
} |
|||
}) |
|||
} |
|||
/** |
|||
* @description 创建 dom 结构 |
|||
* @param {object[]} nodes 节点数组 |
|||
* @param {Element} parent 父节点 |
|||
* @param {string} namespace 命名空间 |
|||
*/ |
|||
|
|||
function createDom(nodes, parent, namespace) { |
|||
const _loop = function _loop(i) { |
|||
const node = nodes[i] |
|||
let ele = void 0 |
|||
|
|||
if (!node.type || node.type == 'node') { |
|||
let { name } = node // svg 需要设置 namespace
|
|||
|
|||
if (name == 'svg') namespace = 'http://www.w3.org/2000/svg' |
|||
if (name == 'html' || name == 'body') name = 'div' // 创建标签
|
|||
|
|||
if (!namespace) ele = document.createElement(name); else ele = document.createElementNS(namespace, name) // 设置属性
|
|||
|
|||
for (const item in node.attrs) { |
|||
ele.setAttribute(item, node.attrs[item]) |
|||
} // 递归创建子节点
|
|||
|
|||
if (node.children) createDom(node.children, ele, namespace) // 处理图片
|
|||
|
|||
if (name == 'img') { |
|||
if (!ele.src && ele.getAttribute('data-src')) ele.src = ele.getAttribute('data-src') |
|||
|
|||
if (!node.attrs.ignore) { |
|||
// 监听图片点击事件
|
|||
ele.onclick = function (e) { |
|||
e.stopPropagation() |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onImgTap', |
|||
attrs: getAttrs(this) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
|
|||
if (options[2]) { |
|||
image = new Image() |
|||
image.src = ele.src |
|||
ele.src = options[2] |
|||
|
|||
image.onload = function () { |
|||
ele.src = this.src |
|||
} |
|||
|
|||
image.onerror = function () { |
|||
ele.onerror() |
|||
} |
|||
} |
|||
|
|||
ele.onerror = onImgError |
|||
} // 处理链接
|
|||
else if (name == 'a') { |
|||
ele.addEventListener('click', function (e) { |
|||
e.stopPropagation() |
|||
e.preventDefault() // 阻止默认跳转
|
|||
|
|||
const href = this.getAttribute('href') |
|||
let offset |
|||
if (href && href[0] == '#') offset = (document.getElementById(href.substr(1)) || {}).offsetTop |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onLinkTap', |
|||
attrs: getAttrs(this), |
|||
offset |
|||
} |
|||
}) |
|||
}, true) |
|||
} // 处理音视频
|
|||
else if (name == 'video' || name == 'audio') { |
|||
medias.push(ele) |
|||
|
|||
if (!node.attrs.autoplay) { |
|||
if (!node.attrs.controls) ele.setAttribute('controls', 'true') // 空白图占位
|
|||
|
|||
if (!node.attrs.poster) ele.setAttribute('poster', "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'/>") |
|||
} |
|||
|
|||
if (options[3]) { |
|||
ele.onplay = function () { |
|||
for (let _i = 0; _i < medias.length; _i++) { |
|||
if (medias[_i] != this) medias[_i].pause() |
|||
} |
|||
} |
|||
} |
|||
|
|||
ele.onerror = function () { |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onError', |
|||
source: name, |
|||
attrs: getAttrs(this) |
|||
} |
|||
}) |
|||
} |
|||
} // 处理表格
|
|||
else if (name == 'table' && options[4] && !ele.style.cssText.includes('inline')) { |
|||
const div = document.createElement('div') |
|||
div.style.overflow = 'auto' |
|||
div.appendChild(ele) |
|||
ele = div |
|||
} else if (name == 'svg') namespace = void 0 |
|||
} else ele = document.createTextNode(node.text.replace(/&/g, '&')) |
|||
|
|||
parent.appendChild(ele) |
|||
} |
|||
|
|||
for (let i = 0; i < nodes.length; i++) { |
|||
var image |
|||
|
|||
_loop(i) |
|||
} |
|||
} // 设置 html 内容
|
|||
|
|||
window.setContent = function (nodes, opts, append) { |
|||
const ele = document.getElementById('content') // 背景颜色
|
|||
|
|||
if (opts[0]) document.body.bgColor = opts[0] // 长按复制
|
|||
|
|||
if (!opts[5]) ele.style.userSelect = 'none' |
|||
|
|||
if (!append) { |
|||
ele.innerHTML = '' // 不追加则先清空
|
|||
|
|||
medias = [] |
|||
} |
|||
|
|||
options = opts |
|||
const fragment = document.createDocumentFragment() |
|||
createDom(nodes, fragment) |
|||
ele.appendChild(fragment) // 触发事件
|
|||
|
|||
let height = ele.scrollHeight |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onLoad', |
|||
height |
|||
} |
|||
}) |
|||
clearInterval(window.timer) |
|||
let ready = false |
|||
window.timer = setInterval(() => { |
|||
if (ele.scrollHeight != height) { |
|||
height = ele.scrollHeight |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onHeightChange', |
|||
height |
|||
} |
|||
}) |
|||
} else if (!ready) { |
|||
ready = true |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onReady' |
|||
} |
|||
}) |
|||
} |
|||
}, 350) |
|||
} // 回收计时器
|
|||
|
|||
window.onunload = function () { |
|||
clearInterval(window.timer) |
|||
} |
@ -0,0 +1,19 @@ |
|||
!(function (e, n) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = n() : typeof define === 'function' && define.amd ? define(n) : (e = e || self).uni = n() }(this, (() => { |
|||
'use strict' |
|||
|
|||
try { const e = {}; Object.defineProperty(e, 'passive', { get() { !0 } }), window.addEventListener('test-passive', null, e) } catch (e) {} const n = Object.prototype.hasOwnProperty; function t(e, t) { return n.call(e, t) } const i = []; const a = function (e, n) { const t = { options: { timestamp: +new Date() }, name: e, arg: n }; if (window.__dcloud_weex_postMessage || window.__dcloud_weex_) { if (e === 'postMessage') { const a = { data: [n] }; return window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessage(a) : window.__dcloud_weex_.postMessage(JSON.stringify(a)) } const o = { type: 'WEB_INVOKE_APPSERVICE', args: { data: t, webviewIds: i } }; window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(o) : window.__dcloud_weex_.postMessageToService(JSON.stringify(o)) } if (!window.plus) return window.parent.postMessage({ type: 'WEB_INVOKE_APPSERVICE', data: t, pageId: '' }, '*'); if (i.length === 0) { const r = plus.webview.currentWebview(); if (!r) throw new Error('plus.webview.currentWebview() is undefined'); const d = r.parent(); let s = ''; s = d ? d.id : r.id, i.push(s) } if (plus.webview.getWebviewById('__uniapp__service'))plus.webview.postMessageToUniNView({ type: 'WEB_INVOKE_APPSERVICE', args: { data: t, webviewIds: i } }, '__uniapp__service'); else { const w = JSON.stringify(t); plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat('WEB_INVOKE_APPSERVICE', '",').concat(w, ',').concat(JSON.stringify(i), ');')) } }; const o = { |
|||
navigateTo() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; const n = e.url; a('navigateTo', { url: encodeURI(n) }) }, navigateBack() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; const n = e.delta; a('navigateBack', { delta: parseInt(n) || 1 }) }, switchTab() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; const n = e.url; a('switchTab', { url: encodeURI(n) }) }, reLaunch() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; const n = e.url; a('reLaunch', { url: encodeURI(n) }) }, redirectTo() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; const n = e.url; a('redirectTo', { url: encodeURI(n) }) }, getEnv(e) { window.plus ? e({ plus: !0 }) : e({ h5: !0 }) }, postMessage() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; a('postMessage', e.data || {}) } |
|||
}; const r = /uni-app/i.test(navigator.userAgent); const d = /Html5Plus/i.test(navigator.userAgent); const s = /complete|loaded|interactive/; const w = window.my && navigator.userAgent.indexOf('AlipayClient') > -1; const u = window.swan && window.swan.webView && /swan/i.test(navigator.userAgent); const c = window.qq && window.qq.miniProgram && /QQ/i.test(navigator.userAgent) && /miniProgram/i.test(navigator.userAgent); const g = window.tt && window.tt.miniProgram && /toutiaomicroapp/i.test(navigator.userAgent); const v = window.wx && window.wx.miniProgram && /micromessenger/i.test(navigator.userAgent) && /miniProgram/i.test(navigator.userAgent); const p = window.qa && /quickapp/i.test(navigator.userAgent); for (var l, _ = function () { window.UniAppJSBridge = !0, document.dispatchEvent(new CustomEvent('UniAppJSBridgeReady', { bubbles: !0, cancelable: !0 })) }, f = [function (e) { if (r || d) return window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? document.addEventListener('DOMContentLoaded', e) : window.plus && s.test(document.readyState) ? setTimeout(e, 0) : document.addEventListener('plusready', e), o }, function (e) { if (v) return window.WeixinJSBridge && window.WeixinJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener('WeixinJSBridgeReady', e), window.wx.miniProgram }, function (e) { if (c) return window.QQJSBridge && window.QQJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener('QQJSBridgeReady', e), window.qq.miniProgram }, function (e) { |
|||
if (w) { |
|||
document.addEventListener('DOMContentLoaded', e); const n = window.my; return { |
|||
navigateTo: n.navigateTo, navigateBack: n.navigateBack, switchTab: n.switchTab, reLaunch: n.reLaunch, redirectTo: n.redirectTo, postMessage: n.postMessage, getEnv: n.getEnv |
|||
} |
|||
} |
|||
}, function (e) { if (u) return document.addEventListener('DOMContentLoaded', e), window.swan.webView }, function (e) { if (g) return document.addEventListener('DOMContentLoaded', e), window.tt.miniProgram }, function (e) { |
|||
if (p) { |
|||
window.QaJSBridge && window.QaJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener('QaJSBridgeReady', e); const n = window.qa; return { |
|||
navigateTo: n.navigateTo, navigateBack: n.navigateBack, switchTab: n.switchTab, reLaunch: n.reLaunch, redirectTo: n.redirectTo, postMessage: n.postMessage, getEnv: n.getEnv |
|||
} |
|||
} |
|||
}, function (e) { return document.addEventListener('DOMContentLoaded', e), o }], m = 0; m < f.length && !(l = f[m](_)); m++);l || (l = {}); const E = typeof uni !== 'undefined' ? uni : {}; if (!E.navigateTo) for (const b in l)t(l, b) && (E[b] = l[b]); return E.webView = l, E |
|||
}))) |
@ -0,0 +1 @@ |
|||
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><style>body,html{width:100%;height:100%;overflow:hidden}body{margin:0}video{width:300px;height:225px}img{max-width:100%;-webkit-touch-callout:none}@keyframes show{0%{opacity:0}100%{opacity:1}}</style></head><body><div id="content"></div><script type="text/javascript" src="./js/uni.webview.min.js"></script><script type="text/javascript" src="./js/handler.js"></script></body> |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 862 B |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 401 B |
After Width: | Height: | Size: 470 B |
After Width: | Height: | Size: 511 B |
After Width: | Height: | Size: 476 B |
After Width: | Height: | Size: 472 B |
After Width: | Height: | Size: 545 B |
After Width: | Height: | Size: 365 B |
After Width: | Height: | Size: 587 B |
After Width: | Height: | Size: 565 B |
@ -0,0 +1,363 @@ |
|||
(function (window, document, exportName, undefined) { |
|||
"use strict"; |
|||
|
|||
var isMultiTouch = false; |
|||
var multiTouchStartPos; |
|||
var eventTarget; |
|||
var touchElements = {}; |
|||
|
|||
// polyfills
|
|||
if (!document.createTouch) { |
|||
document.createTouch = function (view, target, identifier, pageX, pageY, screenX, screenY, clientX, clientY) { |
|||
// auto set
|
|||
if (clientX == undefined || clientY == undefined) { |
|||
clientX = pageX - window.pageXOffset; |
|||
clientY = pageY - window.pageYOffset; |
|||
} |
|||
|
|||
return new Touch(target, identifier, { |
|||
pageX: pageX, |
|||
pageY: pageY, |
|||
screenX: screenX, |
|||
screenY: screenY, |
|||
clientX: clientX, |
|||
clientY: clientY |
|||
}); |
|||
}; |
|||
} |
|||
|
|||
if (!document.createTouchList) { |
|||
document.createTouchList = function () { |
|||
var touchList = new TouchList(); |
|||
for (var i = 0; i < arguments.length; i++) { |
|||
touchList[i] = arguments[i]; |
|||
} |
|||
touchList.length = arguments.length; |
|||
return touchList; |
|||
}; |
|||
} |
|||
|
|||
/** |
|||
* create an touch point |
|||
* @constructor |
|||
* @param target |
|||
* @param identifier |
|||
* @param pos |
|||
* @param deltaX |
|||
* @param deltaY |
|||
* @returns {Object} touchPoint |
|||
*/ |
|||
function Touch(target, identifier, pos, deltaX, deltaY) { |
|||
deltaX = deltaX || 0; |
|||
deltaY = deltaY || 0; |
|||
|
|||
this.identifier = identifier; |
|||
this.target = target; |
|||
this.clientX = pos.clientX + deltaX; |
|||
this.clientY = pos.clientY + deltaY; |
|||
this.screenX = pos.screenX + deltaX; |
|||
this.screenY = pos.screenY + deltaY; |
|||
this.pageX = pos.pageX + deltaX; |
|||
this.pageY = pos.pageY + deltaY; |
|||
} |
|||
|
|||
/** |
|||
* create empty touchlist with the methods |
|||
* @constructor |
|||
* @returns touchList |
|||
*/ |
|||
function TouchList() { |
|||
var touchList = []; |
|||
|
|||
touchList.item = function (index) { |
|||
return this[index] || null; |
|||
}; |
|||
|
|||
// specified by Mozilla
|
|||
touchList.identifiedTouch = function (id) { |
|||
return this[id + 1] || null; |
|||
}; |
|||
|
|||
return touchList; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* Simple trick to fake touch event support |
|||
* this is enough for most libraries like Modernizr and Hammer |
|||
*/ |
|||
function fakeTouchSupport() { |
|||
var objs = [window, document.documentElement]; |
|||
var props = ['ontouchstart', 'ontouchmove', 'ontouchcancel', 'ontouchend']; |
|||
|
|||
for (var o = 0; o < objs.length; o++) { |
|||
for (var p = 0; p < props.length; p++) { |
|||
if (objs[o] && objs[o][props[p]] == undefined) { |
|||
objs[o][props[p]] = null; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* we don't have to emulate on a touch device |
|||
* @returns {boolean} |
|||
*/ |
|||
function hasTouchSupport() { |
|||
return ("ontouchstart" in window) || // touch events
|
|||
(window.Modernizr && window.Modernizr.touch) || // modernizr
|
|||
(navigator.msMaxTouchPoints || navigator.maxTouchPoints) > 2; // pointer events
|
|||
} |
|||
|
|||
/** |
|||
* disable mouseevents on the page |
|||
* @param ev |
|||
*/ |
|||
function preventMouseEvents(ev) { |
|||
// 注释启用默认事件
|
|||
// ev.preventDefault();
|
|||
// ev.stopPropagation();
|
|||
} |
|||
|
|||
/** |
|||
* only trigger touches when the left mousebutton has been pressed |
|||
* @param touchType |
|||
* @returns {Function} |
|||
*/ |
|||
function onMouse(touchType) { |
|||
return function (ev) { |
|||
// prevent mouse events
|
|||
preventMouseEvents(ev); |
|||
|
|||
if (ev.which !== 1) { |
|||
return; |
|||
} |
|||
|
|||
// The EventTarget on which the touch point started when it was first placed on the surface,
|
|||
// even if the touch point has since moved outside the interactive area of that element.
|
|||
// also, when the target doesnt exist anymore, we update it
|
|||
if (ev.type == 'mousedown' || !eventTarget || (eventTarget && !eventTarget.dispatchEvent)) { |
|||
eventTarget = ev.target; |
|||
} |
|||
|
|||
// shiftKey has been lost, so trigger a touchend
|
|||
if (isMultiTouch && !ev.shiftKey) { |
|||
triggerTouch('touchend', ev); |
|||
isMultiTouch = false; |
|||
} |
|||
|
|||
triggerTouch(touchType, ev); |
|||
|
|||
// we're entering the multi-touch mode!
|
|||
if (!isMultiTouch && ev.shiftKey) { |
|||
isMultiTouch = true; |
|||
multiTouchStartPos = { |
|||
pageX: ev.pageX, |
|||
pageY: ev.pageY, |
|||
clientX: ev.clientX, |
|||
clientY: ev.clientY, |
|||
screenX: ev.screenX, |
|||
screenY: ev.screenY |
|||
}; |
|||
triggerTouch('touchstart', ev); |
|||
} |
|||
|
|||
// reset
|
|||
if (ev.type == 'mouseup') { |
|||
multiTouchStartPos = null; |
|||
isMultiTouch = false; |
|||
eventTarget = null; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* trigger a touch event |
|||
* @param eventName |
|||
* @param mouseEv |
|||
*/ |
|||
function triggerTouch(eventName, mouseEv) { |
|||
var touchEvent = document.createEvent('Event'); |
|||
touchEvent.initEvent(eventName, true, true); |
|||
|
|||
touchEvent.altKey = mouseEv.altKey; |
|||
touchEvent.ctrlKey = mouseEv.ctrlKey; |
|||
touchEvent.metaKey = mouseEv.metaKey; |
|||
touchEvent.shiftKey = mouseEv.shiftKey; |
|||
|
|||
touchEvent.touches = getActiveTouches(mouseEv, eventName); |
|||
touchEvent.targetTouches = getActiveTouches(mouseEv, eventName); |
|||
touchEvent.changedTouches = getChangedTouches(mouseEv, eventName); |
|||
|
|||
eventTarget.dispatchEvent(touchEvent); |
|||
} |
|||
|
|||
/** |
|||
* create a touchList based on the mouse event |
|||
* @param mouseEv |
|||
* @returns {TouchList} |
|||
*/ |
|||
function createTouchList(mouseEv) { |
|||
var touchList = new TouchList(); |
|||
|
|||
if (isMultiTouch) { |
|||
var f = TouchEmulator.multiTouchOffset; |
|||
var deltaX = multiTouchStartPos.pageX - mouseEv.pageX; |
|||
var deltaY = multiTouchStartPos.pageY - mouseEv.pageY; |
|||
|
|||
touchList.push(new Touch(eventTarget, 1, multiTouchStartPos, (deltaX * -1) - f, (deltaY * -1) + f)); |
|||
touchList.push(new Touch(eventTarget, 2, multiTouchStartPos, deltaX + f, deltaY - f)); |
|||
} else { |
|||
touchList.push(new Touch(eventTarget, 1, mouseEv, 0, 0)); |
|||
} |
|||
|
|||
return touchList; |
|||
} |
|||
|
|||
/** |
|||
* receive all active touches |
|||
* @param mouseEv |
|||
* @returns {TouchList} |
|||
*/ |
|||
function getActiveTouches(mouseEv, eventName) { |
|||
// empty list
|
|||
if (mouseEv.type == 'mouseup') { |
|||
return new TouchList(); |
|||
} |
|||
|
|||
var touchList = createTouchList(mouseEv); |
|||
if (isMultiTouch && mouseEv.type != 'mouseup' && eventName == 'touchend') { |
|||
touchList.splice(1, 1); |
|||
} |
|||
return touchList; |
|||
} |
|||
|
|||
/** |
|||
* receive a filtered set of touches with only the changed pointers |
|||
* @param mouseEv |
|||
* @param eventName |
|||
* @returns {TouchList} |
|||
*/ |
|||
function getChangedTouches(mouseEv, eventName) { |
|||
var touchList = createTouchList(mouseEv); |
|||
|
|||
// we only want to return the added/removed item on multitouch
|
|||
// which is the second pointer, so remove the first pointer from the touchList
|
|||
//
|
|||
// but when the mouseEv.type is mouseup, we want to send all touches because then
|
|||
// no new input will be possible
|
|||
if (isMultiTouch && mouseEv.type != 'mouseup' && |
|||
(eventName == 'touchstart' || eventName == 'touchend')) { |
|||
touchList.splice(0, 1); |
|||
} |
|||
|
|||
return touchList; |
|||
} |
|||
|
|||
/** |
|||
* show the touchpoints on the screen |
|||
*/ |
|||
function showTouches(ev) { |
|||
var touch, i, el, styles; |
|||
|
|||
// first all visible touches
|
|||
for (i = 0; i < ev.touches.length; i++) { |
|||
touch = ev.touches[i]; |
|||
el = touchElements[touch.identifier]; |
|||
if (!el) { |
|||
el = touchElements[touch.identifier] = document.createElement("div"); |
|||
document.body.appendChild(el); |
|||
} |
|||
|
|||
styles = TouchEmulator.template(touch); |
|||
for (var prop in styles) { |
|||
el.style[prop] = styles[prop]; |
|||
} |
|||
} |
|||
|
|||
// remove all ended touches
|
|||
if (ev.type == 'touchend' || ev.type == 'touchcancel') { |
|||
for (i = 0; i < ev.changedTouches.length; i++) { |
|||
touch = ev.changedTouches[i]; |
|||
el = touchElements[touch.identifier]; |
|||
if (el) { |
|||
el.parentNode.removeChild(el); |
|||
delete touchElements[touch.identifier]; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* TouchEmulator initializer |
|||
*/ |
|||
function TouchEmulator() { |
|||
if (hasTouchSupport()) { |
|||
return; |
|||
} |
|||
|
|||
fakeTouchSupport(); |
|||
|
|||
window.addEventListener("mousedown", onMouse('touchstart'), true); |
|||
window.addEventListener("mousemove", onMouse('touchmove'), true); |
|||
window.addEventListener("mouseup", onMouse('touchend'), true); |
|||
|
|||
window.addEventListener("mouseenter", preventMouseEvents, true); |
|||
window.addEventListener("mouseleave", preventMouseEvents, true); |
|||
window.addEventListener("mouseout", preventMouseEvents, true); |
|||
window.addEventListener("mouseover", preventMouseEvents, true); |
|||
|
|||
// it uses itself!
|
|||
window.addEventListener("touchstart", showTouches, true); |
|||
window.addEventListener("touchmove", showTouches, true); |
|||
window.addEventListener("touchend", showTouches, true); |
|||
window.addEventListener("touchcancel", showTouches, true); |
|||
} |
|||
|
|||
// start distance when entering the multitouch mode
|
|||
TouchEmulator.multiTouchOffset = 75; |
|||
|
|||
/** |
|||
* css template for the touch rendering |
|||
* @param touch |
|||
* @returns object |
|||
*/ |
|||
TouchEmulator.template = function (touch) { |
|||
var size = 0; |
|||
var transform = 'translate(' + (touch.clientX - (size / 2)) + 'px, ' + (touch.clientY - (size / 2)) + 'px)'; |
|||
return { |
|||
position: 'fixed', |
|||
left: 0, |
|||
top: 0, |
|||
background: '#fff', |
|||
border: 'solid 1px #999', |
|||
opacity: .6, |
|||
borderRadius: '100%', |
|||
height: size + 'px', |
|||
width: size + 'px', |
|||
padding: 0, |
|||
margin: 0, |
|||
display: 'block', |
|||
overflow: 'hidden', |
|||
pointerEvents: 'none', |
|||
webkitUserSelect: 'none', |
|||
mozUserSelect: 'none', |
|||
userSelect: 'none', |
|||
webkitTransform: transform, |
|||
mozTransform: transform, |
|||
transform: transform, |
|||
zIndex: 100 |
|||
} |
|||
}; |
|||
|
|||
// export
|
|||
if (typeof define == "function" && define.amd) { |
|||
define(function () { |
|||
return TouchEmulator; |
|||
}); |
|||
} else if (typeof module != "undefined" && module.exports) { |
|||
module.exports = TouchEmulator; |
|||
} else { |
|||
window[exportName] = TouchEmulator; |
|||
} |
|||
})(window, document, "TouchEmulator"); |
@ -0,0 +1,20 @@ |
|||
@font-face { |
|||
font-family: "customicons"; /* Project id 2878519 */ |
|||
src:url('/static/customicons.ttf') format('truetype'); |
|||
} |
|||
|
|||
.customicons { |
|||
font-family: "customicons" !important; |
|||
} |
|||
|
|||
.youxi:before { |
|||
content: "\e60e"; |
|||
} |
|||
|
|||
.wenjian:before { |
|||
content: "\e60f"; |
|||
} |
|||
|
|||
.zhuanfa:before { |
|||
content: "\e610"; |
|||
} |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1005 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,75 @@ |
|||
import api from '@/common/request.api.js' |
|||
import authtoken from "@/utils/auth.token.js" |
|||
import Vue from 'vue' |
|||
import Vuex from 'vuex' |
|||
Vue.use(Vuex) |
|||
const store = new Vuex.Store({ |
|||
state: { |
|||
token: authtoken.getToken(), |
|||
hasLogin: false, |
|||
userinfo: {} |
|||
}, |
|||
mutations: { |
|||
SET_TOKEN: (state, token) => { |
|||
state.token = token |
|||
authtoken.setToken(token) |
|||
}, |
|||
SET_HASLOGIN: (state, hasLogin) => { |
|||
state.hasLogin = hasLogin |
|||
}, |
|||
SET_USERINFO: (state, userinfo) => { |
|||
state.userinfo = userinfo |
|||
} |
|||
}, |
|||
getters: { |
|||
token: state => state.token, |
|||
hasLogin: state => state.hasLogin, |
|||
userinfo: state => state.userinfo, |
|||
}, |
|||
actions: { |
|||
login({ |
|||
commit |
|||
}, loginUserInfo) { |
|||
return new Promise((resolve, reject) => { |
|||
api.login(loginUserInfo).then(res => { |
|||
console.log('login-result-info:', res) |
|||
commit('SET_HASLOGIN', true) |
|||
commit('SET_TOKEN', res.token) |
|||
commit('SET_USERINFO', { |
|||
userid: '123456', |
|||
name: res.name |
|||
}) |
|||
resolve(res) |
|||
}).catch(err => { |
|||
reject(err) |
|||
}) |
|||
}) |
|||
}, |
|||
logined({ |
|||
commit |
|||
}, loginUserInfo) { |
|||
return new Promise((resolve, reject) => { |
|||
commit('SET_HASLOGIN', true) |
|||
commit('SET_TOKEN', loginUserInfo.token) |
|||
commit('SET_USERINFO', { |
|||
userid: '123456', |
|||
name: loginUserInfo.name |
|||
}) |
|||
resolve() |
|||
}) |
|||
}, |
|||
logout({ |
|||
commit, |
|||
state |
|||
}) { |
|||
return new Promise((resolve, reject) => { |
|||
commit('SET_HASLOGIN', false) |
|||
commit('SET_TOKEN', null) |
|||
commit('SET_USERINFO', null) |
|||
resolve() |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
|
|||
export default store |
@ -0,0 +1,42 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh-CN"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|||
<link rel="shortcut icon" type="image/x-icon" href="https://cdn.uviewui.com/uview/common/favicon.ico"> |
|||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> |
|||
<title> |
|||
<%= htmlWebpackPlugin.options.title %> |
|||
</title> |
|||
<!-- 正式发布的时候使用,开发期间不启用。↓ --> |
|||
<script src="/static/common/js/touch-emulator.js"></script> |
|||
<script> |
|||
TouchEmulator(); |
|||
</script> |
|||
<style> |
|||
::-webkit-scrollbar{ |
|||
display: none; |
|||
} |
|||
</style> |
|||
<!-- 正式发布的时候使用,开发期间不启用。↑ --> |
|||
<script> |
|||
document.addEventListener('DOMContentLoaded', function() { |
|||
document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px' |
|||
}) |
|||
</script> |
|||
<link rel="stylesheet" href="<%= BASE_URL %>static/index.css" /> |
|||
</head> |
|||
<body> |
|||
<!-- 该文件为 H5 平台的模板 HTML,并非应用入口。 --> |
|||
<!-- 请勿在此文件编写页面代码或直接运行此文件。 --> |
|||
<!-- 详见文档:https://uniapp.dcloud.io/collocation/manifest?id=h5-template --> |
|||
<noscript> |
|||
<strong>本站点必须要开启JavaScript才能运行</strong> |
|||
</noscript> |
|||
<div id="app"></div> |
|||
<!-- built files will be auto injected --> |
|||
<script> |
|||
/*BAIDU_STAT*/ |
|||
</script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,7 @@ |
|||
/** |
|||
* 下方引入的为uView UI的集成样式文件,为scss预处理器,其中包含了一些"u-"开头的自定义变量 |
|||
* 使用的时候,请将下面的一行复制到您的uniapp项目根目录的uni.scss中即可 |
|||
* uView自定义的css类名和scss变量,均以"u-"开头,不会造成冲突,请放心使用 |
|||
*/ |
|||
@import '@/uni_modules/uni-scss/variables.scss'; |
|||
@import '@/uni_modules/uview-ui/theme.scss'; |
@ -0,0 +1,320 @@ |
|||
## 2.5.0-20230101(2023-01-01) |
|||
- 秋云图表组件 修改条件编译顺序,确保uniapp的cli方式的项目依赖不完整时可以正常显示 |
|||
- 秋云图表组件 恢复props属性directory的使用,以修复vue3项目中,开启echarts后,echarts目录识别错误的bug |
|||
- uCharts.js 修复区域图、混合图只有一个数据时图表显示不正确的bug |
|||
- uCharts.js 修复折线图、区域图中时间轴类别图表tooltip指示点显示不正确的bug |
|||
- uCharts.js 修复x轴使用labelCount时,并且boundaryGap = 'justify' 并且关闭Y轴显示的时候,最后一个坐标值不显示的bug |
|||
- uCharts.js 修复折线图只有一组数据时 ios16 渲染颜色不正确的bug |
|||
- uCharts.js 修复玫瑰图半径显示不正确的bug |
|||
- uCharts.js 柱状图、山峰图增加正负图功能,y轴网格如果需要显示0轴则由 min max 及 splitNumber 确定,后续版本优化自动显示0轴 |
|||
- uCharts.js 柱状图column增加 opts.extra.column.labelPosition,数据标签位置,有效值为 outside外部, insideTop内顶部, center内中间, bottom内底部 |
|||
- uCharts.js 雷达图radar增加 opts.extra.radar.labelShow,否显示各项标识文案是,默认true |
|||
- uCharts.js 提示窗tooltip增加 opts.extra.tooltip.boxPadding,提示窗边框填充距离,默认3px |
|||
- uCharts.js 提示窗tooltip增加 opts.extra.tooltip.fontSize,提示窗字体大小配置,默认13px |
|||
- uCharts.js 提示窗tooltip增加 opts.extra.tooltip.lineHeight,提示窗文字行高,默认20px |
|||
- uCharts.js 提示窗tooltip增加 opts.extra.tooltip.legendShow,是否显示左侧图例,默认true |
|||
- uCharts.js 提示窗tooltip增加 opts.extra.tooltip.legendShape,图例形状,图例标识样式,有效值为 auto自动跟随图例, diamond◆, circle●, triangle▲, square■, rect▬, line- |
|||
- uCharts.js 标记线markLine增加 opts.extra.markLine.labelFontSize,字体大小配置,默认13px |
|||
- uCharts.js 标记线markLine增加 opts.extra.markLine.labelPadding,标签边框内填充距离,默认6px |
|||
- uCharts.js 折线图line增加 opts.extra.line.linearType,渐变色类型,可选值 none关闭渐变色,custom 自定义渐变色。使用自定义渐变色时请赋值serie.linearColor作为颜色值 |
|||
- uCharts.js 折线图line增加 serie.linearColor,渐变色数组,格式为2维数组[起始位置,颜色值],例如[[0,'#0EE2F8'],[0.3,'#2BDCA8'],[0.6,'#1890FF'],[1,'#9A60B4']] |
|||
- uCharts.js 折线图line增加 opts.extra.line.onShadow,是否开启折线阴影,开启后请赋值serie.setShadow阴影设置 |
|||
- uCharts.js 折线图line增加 serie.setShadow,阴影配置,格式为4位数组:[offsetX,offsetY,blur,color] |
|||
- uCharts.js 折线图line增加 opts.extra.line.animation,动画效果方向,可选值为vertical 垂直动画效果,horizontal 水平动画效果 |
|||
- uCharts.js X轴xAxis增加 opts.xAxis.lineHeight,X轴字体行高,默认20px |
|||
- uCharts.js X轴xAxis增加 opts.xAxis.marginTop,X轴文字距离轴线的距离,默认0px |
|||
- uCharts.js X轴xAxis增加 opts.xAxis.title,当前X轴标题 |
|||
- uCharts.js X轴xAxis增加 opts.xAxis.titleFontSize,标题字体大小,默认13px |
|||
- uCharts.js X轴xAxis增加 opts.xAxis.titleOffsetY,标题纵向偏移距离,负数为向上偏移,正数向下偏移 |
|||
- uCharts.js X轴xAxis增加 opts.xAxis.titleOffsetX,标题横向偏移距离,负数为向左偏移,正数向右偏移 |
|||
- uCharts.js X轴xAxis增加 opts.xAxis.titleFontColor,标题字体颜色,默认#666666 |
|||
|
|||
## 报错TypeError: Cannot read properties of undefined (reading 'length') |
|||
- 如果是uni-modules版本组件,请先登录HBuilderX账号; |
|||
- 在HBuilderX中的manifest.json,点击重新获取uniapp的appid,或者删除appid重新粘贴,重新运行; |
|||
- 如果是cli项目请使用码云上的非uniCloud版本组件; |
|||
- 或者添加uniCloud的依赖; |
|||
- 或者使用原生uCharts; |
|||
## 2.4.5-20221130(2022-11-30) |
|||
- uCharts.js 优化tooltip当文字很多变为左侧显示时,如果画布仍显显示不下,提示框错位置变为以左侧0位置起画 |
|||
- uCharts.js 折线图修复特殊情况下只有单点数据,并改变线宽后点变为圆形的bug |
|||
- uCharts.js 修复Y轴disabled启用后无效并报错的bug |
|||
- uCharts.js 修复仪表盘起始结束角度特殊情况下显示不正确的bug |
|||
- uCharts.js 雷达图新增参数 opts.extra.radar.radius , 自定义雷达图半径 |
|||
- uCharts.js 折线图、区域图增加tooltip指示点,opts.extra.line.activeType/opts.extra.area.activeType,可选值"none"不启用激活指示点,"hollow"空心点模式,"solid"实心点模式 |
|||
## 2.4.4-20221102(2022-11-02) |
|||
- 秋云图表组件 修复使用echarts时reload、reshow无法调用重新渲染的bug,[详见码云PR](https://gitee.com/uCharts/uCharts/pulls/40) |
|||
- 秋云图表组件 修复使用echarts时,初始化时宽高不正确的bug,[详见码云PR](https://gitee.com/uCharts/uCharts/pulls/42) |
|||
- 秋云图表组件 修复uniapp的h5使用history模式时,无法加载echarts的bug |
|||
- 秋云图表组件 小程序端@complete、@scrollLeft、@scrollRight、@getTouchStart、@getTouchMove、@getTouchEnd事件增加opts参数传出,方便一些特殊需求的交互获取数据。 |
|||
|
|||
- uCharts.js 修复calTooltipYAxisData方法内formatter格式化方法未与y轴方法同步的问题,[详见码云PR](https://gitee.com/uCharts/uCharts/pulls/43) |
|||
- uCharts.js 地图新增参数opts.series[i].fillOpacity,以透明度方式来设置颜色过度效果,[详见码云PR](https://gitee.com/uCharts/uCharts/pulls/38) |
|||
- uCharts.js 地图新增参数opts.extra.map.active,是否启用点击激活变色 |
|||
- uCharts.js 地图新增参数opts.extra.map.activeTextColor,是否启用点击激活变色 |
|||
- uCharts.js 地图新增渲染完成事件renderComplete |
|||
- uCharts.js 漏斗图修复当部分数据相同时tooltip提示窗点击错误的bug |
|||
- uCharts.js 漏斗图新增参数series.data[i].centerText 居中标签文案 |
|||
- uCharts.js 漏斗图新增参数series.data[i].centerTextSize 居中标签文案字体大小,默认opts.fontSize |
|||
- uCharts.js 漏斗图新增参数series.data[i].centerTextColor 居中标签文案字体颜色,默认#FFFFFF |
|||
- uCharts.js 漏斗图新增参数opts.extra.funnel.minSize 最小值的最小宽度,默认0 |
|||
- uCharts.js 进度条新增参数opts.extra.arcbar.direction,动画方向,可选值为cw顺时针、ccw逆时针 |
|||
- uCharts.js 混合图新增参数opts.extra.mix.line.width,折线的宽度,默认2 |
|||
- uCharts.js 修复tooltip开启horizentalLine水平横线标注时,图表显示错位的bug |
|||
- uCharts.js 优化tooltip当文字很多变为左侧显示时,如果画布仍显显示不下,提示框错位置变为以左侧0位置起画 |
|||
- uCharts.js 修复开启滚动条后X轴文字超出绘图区域后的隐藏逻辑 |
|||
- uCharts.js 柱状图、条状图修复堆叠模式不能通过{value,color}赋值单个柱子颜色的问题 |
|||
- uCharts.js 气泡图修复不识别series.textSize和series.textColor的bug |
|||
|
|||
## 报错TypeError: Cannot read properties of undefined (reading 'length') |
|||
1. 如果是uni-modules版本组件,请先登录HBuilderX账号; |
|||
2. 在HBuilderX中的manifest.json,点击重新获取uniapp的appid,或者删除appid重新粘贴,重新运行; |
|||
3. 如果是cli项目请使用码云上的非uniCloud版本组件; |
|||
4. 或者添加uniCloud的依赖; |
|||
5. 或者使用原生uCharts; |
|||
## 2.4.3-20220505(2022-05-05) |
|||
- 秋云图表组件 修复开启canvas2d后将series赋值为空数组显示加载图标时,再次赋值后画布闪动的bug |
|||
- 秋云图表组件 修复升级hbx最新版后ECharts的highlight方法报错的bug |
|||
- uCharts.js 雷达图新增参数opts.extra.radar.gridEval,数据点位网格抽希,默认1 |
|||
- uCharts.js 雷达图新增参数opts.extra.radar.axisLabel, 是否显示刻度点值,默认false |
|||
- uCharts.js 雷达图新增参数opts.extra.radar.axisLabelTofix,刻度点值小数位数,默认0 |
|||
- uCharts.js 雷达图新增参数opts.extra.radar.labelPointShow,是否显示末端刻度圆点,默认false |
|||
- uCharts.js 雷达图新增参数opts.extra.radar.labelPointRadius,刻度圆点的半径,默认3 |
|||
- uCharts.js 雷达图新增参数opts.extra.radar.labelPointColor,刻度圆点的颜色,默认#cccccc |
|||
- uCharts.js 雷达图新增参数opts.extra.radar.linearType,渐变色类型,可选值"none"关闭渐变,"custom"开启渐变 |
|||
- uCharts.js 雷达图新增参数opts.extra.radar.customColor,自定义渐变颜色,数组类型对应series的数组长度以匹配不同series颜色的不同配色方案,例如["#FA7D8D", "#EB88E2"] |
|||
- uCharts.js 雷达图优化支持series.textColor、series.textSize属性 |
|||
- uCharts.js 柱状图中温度计式图标,优化支持全圆角类型,修复边框有缝隙的bug,详见官网【演示】中的温度计图表 |
|||
- uCharts.js 柱状图新增参数opts.extra.column.activeWidth,当前点击柱状图的背景宽度,默认一个单元格单位 |
|||
- uCharts.js 混合图增加opts.extra.mix.area.gradient 区域图是否开启渐变色 |
|||
- uCharts.js 混合图增加opts.extra.mix.area.opacity 区域图透明度,默认0.2 |
|||
- uCharts.js 饼图、圆环图、玫瑰图、漏斗图,增加opts.series[0].data[i].labelText,自定义标签文字,避免formatter格式化的繁琐,详见官网【演示】中的饼图 |
|||
- uCharts.js 饼图、圆环图、玫瑰图、漏斗图,增加opts.series[0].data[i].labelShow,自定义是否显示某一个指示标签,避免因饼图类别太多导致标签重复或者居多导致图形变形的问题,详见官网【演示】中的饼图 |
|||
- uCharts.js 增加opts.series[i].legendText/opts.series[0].data[i].legendText(与series.name同级)自定义图例显示文字的方法 |
|||
- uCharts.js 优化X轴、Y轴formatter格式化方法增加形参,统一为fromatter:function(value,index,opts){} |
|||
- uCharts.js 修复横屏模式下无法使用双指缩放方法的bug |
|||
- uCharts.js 修复当只有一条数据或者多条数据值相等的时候Y轴自动计算的最大值错误的bug |
|||
- 【官网模板】增加外部自定义图例与图表交互的例子,[点击跳转](https://www.ucharts.cn/v2/#/layout/info?id=2) |
|||
|
|||
## 注意:非unimodules 版本如因更新 hbx 至 3.4.7 导致报错如下,请到码云更新非 unimodules 版本组件,[点击跳转](https://gitee.com/uCharts/uCharts/tree/master/uni-app/uCharts-%E7%BB%84%E4%BB%B6) |
|||
> Error in callback for immediate watcher "uchartsOpts": "SyntaxError: Unexpected token u in JSON at position 0" |
|||
## 2.4.2-20220421(2022-04-21) |
|||
- 秋云图表组件 修复HBX升级3.4.6.20220420版本后echarts报错的问题 |
|||
## 2.4.2-20220420(2022-04-20) |
|||
## 重要!此版本uCharts新增了很多功能,修复了诸多已知问题 |
|||
- 秋云图表组件 新增onzoom开启双指缩放功能(仅uCharts),前提需要直角坐标系类图表类型,并且ontouch为true、opts.enableScroll为true,详见实例项目K线图 |
|||
- 秋云图表组件 新增optsWatch是否监听opts变化,关闭optsWatch后,动态修改opts不会触发图表重绘 |
|||
- 秋云图表组件 修复开启canvas2d功能后,动态更新数据后画布闪动的bug |
|||
- 秋云图表组件 去除directory属性,改为自动获取echarts.min.js路径(升级不受影响) |
|||
- 秋云图表组件 增加getImage()方法及@getImage事件,通过ref调用getImage()方法获,触发@getImage事件获取当前画布的base64图片文件流。 |
|||
- 秋云图表组件 支付宝、字节跳动、飞书、快手小程序支持开启canvas2d同层渲染设置。 |
|||
- 秋云图表组件 新增加【非uniCloud】版本组件,避免有些不需要uniCloud的使用组件发布至小程序需要提交隐私声明问题,请到码云[【非uniCloud版本】](https://gitee.com/uCharts/uCharts/tree/master/uni-app/uCharts-%E7%BB%84%E4%BB%B6),或npm[【非uniCloud版本】](https://www.npmjs.com/package/@qiun/uni-ucharts)下载使用。 |
|||
- uCharts.js 新增dobuleZoom双指缩放功能 |
|||
- uCharts.js 新增山峰图type="mount",数据格式为饼图类格式,不需要传入categories,具体详见新版官网在线演示 |
|||
- uCharts.js 修复折线图当数据中存在null时tooltip报错的bug |
|||
- uCharts.js 修复饼图类当画布比较小时自动计算的半径是负数报错的bug |
|||
- uCharts.js 统一各图表类型的series.formatter格式化方法的形参为(val, index, series, opts),方便格式化时有更多参数可用 |
|||
- uCharts.js 标记线功能增加labelText自定义显示文字,增加labelAlign标签显示位置(左侧或右侧),增加标签显示位置微调labelOffsetX、labelOffsetY |
|||
- uCharts.js 修复条状图当数值很小时开启圆角后样式错误的bug |
|||
- uCharts.js 修复X轴开启disabled后,X轴仍占用空间的bug |
|||
- uCharts.js 修复X轴开启滚动条并且开启rotateLabel后,X轴文字与滚动条重叠的bug |
|||
- uCharts.js 增加X轴rotateAngle文字旋转自定义角度,取值范围(-90至90) |
|||
- uCharts.js 修复地图文字标签层级显示不正确的bug |
|||
- uCharts.js 修复饼图、圆环图、玫瑰图当数据全部为0的时候不显示数据标签的bug |
|||
- uCharts.js 修复当opts.padding上边距为0时,Y轴顶部刻度标签位置不正确的bug |
|||
|
|||
## 另外我们还开发了各大原生小程序组件,已发布至码云和npm |
|||
[https://gitee.com/uCharts/uCharts](https://gitee.com/uCharts/uCharts) |
|||
[https://www.npmjs.com/~qiun](https://www.npmjs.com/~qiun) |
|||
|
|||
## 对于原生uCharts文档我们已上线新版官方网站,详情点击下面链接进入官网 |
|||
[https://www.uCharts.cn/v2/](https://www.ucharts.cn/v2/) |
|||
## 2.3.7-20220122(2022-01-22) |
|||
## 重要!使用vue3编译,请使用cli模式并升级至最新依赖,HbuilderX编译需要使用3.3.8以上版本 |
|||
- uCharts.js 修复uni-app平台组件模式使用vue3编译到小程序报错的bug。 |
|||
## 2.3.7-20220118(2022-01-18) |
|||
## 注意,使用vue3的前提是需要3.3.8.20220114-alpha版本的HBuilder! |
|||
## 2.3.67-20220118(2022-01-18) |
|||
- 秋云图表组件 组件初步支持vue3,全端编译会有些问题,具体详见下面修改: |
|||
1. 小程序端运行时,在uni_modules文件夹的qiun-data-charts.js中搜索 new uni_modules_qiunDataCharts_js_sdk_uCharts_uCharts.uCharts,将.uCharts去掉。 |
|||
2. 小程序端发行时,在uni_modules文件夹的qiun-data-charts.js中搜索 new e.uCharts,将.uCharts去掉,变为 new e。 |
|||
3. 如果觉得上述步骤比较麻烦,如果您的项目只编译到小程序端,可以修改u-charts.js最后一行导出方式,将 export default uCharts;变更为 export default { uCharts: uCharts }; 这样变更后,H5和App端的renderjs会有问题,请开发者自行选择。(此问题非组件问题,请等待DC官方修复Vue3的小程序端) |
|||
## 2.3.6-20220111(2022-01-11) |
|||
- 秋云图表组件 修改组件 props 属性中的 background 默认值为 rgba(0,0,0,0) |
|||
## 2.3.6-20211201(2021-12-01) |
|||
- uCharts.js 修复bar条状图开启圆角模式时,值很小时圆角渲染错误的bug |
|||
## 2.3.5-20211014(2021-10-15) |
|||
- uCharts.js 增加vue3的编译支持(仅原生uCharts,qiun-data-charts组件后续会支持,请关注更新) |
|||
## 2.3.4-20211012(2021-10-12) |
|||
- 秋云图表组件 修复 mac os x 系统 mouseover 事件丢失的 bug |
|||
## 2.3.3-20210706(2021-07-06) |
|||
- uCharts.js 增加雷达图开启数据点值(opts.dataLabel)的显示 |
|||
## 2.3.2-20210627(2021-06-27) |
|||
- 秋云图表组件 修复tooltipCustom个别情况下传值不正确报错TypeError: Cannot read property 'name' of undefined的bug |
|||
## 2.3.1-20210616(2021-06-16) |
|||
- uCharts.js 修复圆角柱状图使用4角圆角时,当数值过大时不正确的bug |
|||
## 2.3.0-20210612(2021-06-12) |
|||
- uCharts.js 【重要】uCharts增加nvue兼容,可在nvue项目中使用gcanvas组件渲染uCharts,[详见码云uCharts-demo-nvue](https://gitee.com/uCharts/uCharts) |
|||
- 秋云图表组件 增加tapLegend属性,是否开启图例点击交互事件 |
|||
- 秋云图表组件 getIndex事件中增加返回uCharts实例中的opts参数,以便在页面中调用参数 |
|||
- 示例项目 pages/other/other.vue增加app端自定义tooltip的方法,详见showOptsTooltip方法 |
|||
## 2.2.1-20210603(2021-06-03) |
|||
- uCharts.js 修复饼图、圆环图、玫瑰图,当起始角度不为0时,tooltip位置不准确的bug |
|||
- uCharts.js 增加温度计式柱状图开启顶部半圆形的配置 |
|||
## 2.2.0-20210529(2021-05-29) |
|||
- uCharts.js 增加条状图type="bar" |
|||
- 示例项目 pages/ucharts/ucharts.vue增加条状图的demo |
|||
## 2.1.7-20210524(2021-05-24) |
|||
- uCharts.js 修复大数据量模式下曲线图不平滑的bug |
|||
## 2.1.6-20210523(2021-05-23) |
|||
- 秋云图表组件 修复小程序端开启滚动条更新数据后滚动条位置不符合预期的bug |
|||
## 2.1.5-2021051702(2021-05-17) |
|||
- uCharts.js 修复自定义Y轴min和max值为0时不能正确显示的bug |
|||
## 2.1.5-20210517(2021-05-17) |
|||
- uCharts.js 修复Y轴自定义min和max时,未按指定的最大值最小值显示坐标轴刻度的bug |
|||
## 2.1.4-20210516(2021-05-16) |
|||
- 秋云图表组件 优化onWindowResize防抖方法 |
|||
- 秋云图表组件 修复APP端uCharts更新数据时,清空series显示loading图标后再显示图表,图表抖动的bug |
|||
- uCharts.js 修复开启canvas2d后,x轴、y轴、series自定义字体大小未按比例缩放的bug |
|||
- 示例项目 修复format-e.vue拼写错误导致app端使用uCharts渲染图表 |
|||
## 2.1.3-20210513(2021-05-13) |
|||
- 秋云图表组件 修改uCharts变更chartData数据为updateData方法,支持带滚动条的数据动态打点 |
|||
- 秋云图表组件 增加onWindowResize防抖方法 fix by ど誓言,如尘般染指流年づ |
|||
- 秋云图表组件 H5或者APP变更chartData数据显示loading图表时,原数据闪现的bug |
|||
- 秋云图表组件 props增加errorReload禁用错误点击重新加载的方法 |
|||
- uCharts.js 增加tooltip显示category(x轴对应点位)标题的功能,opts.extra.tooltip.showCategory,默认为false |
|||
- uCharts.js 修复mix混合图只有柱状图时,tooltip的分割线显示位置不正确的bug |
|||
- uCharts.js 修复开启滚动条,图表在拖动中动态打点,滚动条位置不正确的bug |
|||
- uCharts.js 修复饼图类数据格式为echarts数据格式,series为空数组报错的bug |
|||
- 示例项目 修改uCharts.js更新到v2.1.2版本后,@getIndex方法获取索引值变更为e.currentIndex.index |
|||
- 示例项目 pages/updata/updata.vue增加滚动条拖动更新(数据动态打点)的demo |
|||
- 示例项目 pages/other/other.vue增加errorReload禁用错误点击重新加载的demo |
|||
## 2.1.2-20210509(2021-05-09) |
|||
秋云图表组件 修复APP端初始化时就传入chartData或lacaldata不显示图表的bug |
|||
## 2.1.1-20210509(2021-05-09) |
|||
- 秋云图表组件 变更ECharts的eopts配置在renderjs内执行,支持在config-echarts.js配置文件内写function配置。 |
|||
- 秋云图表组件 修复APP端报错Prop being mutated: "onmouse"错误的bug。 |
|||
- 秋云图表组件 修复APP端报错Error: Not Found:Page[6][-1,27] at view.umd.min.js:1的bug。 |
|||
## 2.1.0-20210507(2021-05-07) |
|||
- 秋云图表组件 修复初始化时就有数据或者数据更新的时候loading加载动画闪动的bug |
|||
- uCharts.js 修复x轴format方法categories为字符串类型时返回NaN的bug |
|||
- uCharts.js 修复series.textColor、legend.fontColor未执行全局默认颜色的bug |
|||
## 2.1.0-20210506(2021-05-06) |
|||
- 秋云图表组件 修复极个别情况下报错item.properties undefined的bug |
|||
- 秋云图表组件 修复极个别情况下关闭加载动画reshow不起作用,无法显示图表的bug |
|||
- 示例项目 pages/ucharts/ucharts.vue 增加时间轴折线图(type="tline")、时间轴区域图(type="tarea")、散点图(type="scatter")、气泡图demo(type="bubble")、倒三角形漏斗图(opts.extra.funnel.type="triangle")、金字塔形漏斗图(opts.extra.funnel.type="pyramid") |
|||
- 示例项目 pages/format-u/format-u.vue 增加X轴format格式化示例 |
|||
- uCharts.js 升级至v2.1.0版本 |
|||
- uCharts.js 修复 玫瑰图面积模式点击tooltip位置不正确的bug |
|||
- uCharts.js 修复 玫瑰图点击图例,只剩一个类别显示空白的bug |
|||
- uCharts.js 修复 饼图类图点击图例,其他图表tooltip位置某些情况下不准的bug |
|||
- uCharts.js 修复 x轴为矢量轴(时间轴)情况下,点击tooltip位置不正确的bug |
|||
- uCharts.js 修复 词云图获取点击索引偶尔不准的bug |
|||
- uCharts.js 增加 直角坐标系图表X轴format格式化方法(原生uCharts.js用法请使用formatter) |
|||
- uCharts.js 增加 漏斗图扩展配置,倒三角形(opts.extra.funnel.type="triangle"),金字塔形(opts.extra.funnel.type="pyramid") |
|||
- uCharts.js 增加 散点图(opts.type="scatter")、气泡图(opts.type="bubble") |
|||
- 后期计划 完善散点图、气泡图,增加markPoints标记点,增加横向条状图。 |
|||
## 2.0.0-20210502(2021-05-02) |
|||
- uCharts.js 修复词云图获取点击索引不正确的bug |
|||
## 2.0.0-20210501(2021-05-01) |
|||
- 秋云图表组件 修复QQ小程序、百度小程序在关闭动画效果情况下,v-for循环使用图表,显示不正确的bug |
|||
## 2.0.0-20210426(2021-04-26) |
|||
- 秋云图表组件 修复QQ小程序不支持canvas2d的bug |
|||
- 秋云图表组件 修复钉钉小程序某些情况点击坐标计算错误的bug |
|||
- uCharts.js 增加 extra.column.categoryGap 参数,柱状图类每个category点位(X轴点)柱子组之间的间距 |
|||
- uCharts.js 增加 yAxis.data[i].titleOffsetY 参数,标题纵向偏移距离,负数为向上偏移,正数向下偏移 |
|||
- uCharts.js 增加 yAxis.data[i].titleOffsetX 参数,标题横向偏移距离,负数为向左偏移,正数向右偏移 |
|||
- uCharts.js 增加 extra.gauge.labelOffset 参数,仪表盘标签文字径向便宜距离,默认13px |
|||
## 2.0.0-20210422-2(2021-04-22) |
|||
秋云图表组件 修复 formatterAssign 未判断 args[key] == null 的情况导致栈溢出的 bug |
|||
## 2.0.0-20210422(2021-04-22) |
|||
- 秋云图表组件 修复H5、APP、支付宝小程序、微信小程序canvas2d模式下横屏模式的bug |
|||
## 2.0.0-20210421(2021-04-21) |
|||
- uCharts.js 修复多行图例的情况下,图例在上方或者下方时,图例float为左侧或者右侧时,第二行及以后的图例对齐方式不正确的bug |
|||
## 2.0.0-20210420(2021-04-20) |
|||
- 秋云图表组件 修复微信小程序开启canvas2d模式后,windows版微信小程序不支持canvas2d模式的bug |
|||
- 秋云图表组件 修改非uni_modules版本为v2.0版本qiun-data-charts组件 |
|||
## 2.0.0-20210419(2021-04-19) |
|||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 |
|||
## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX,如仍不好用,请重启电脑; |
|||
## 如果是cli项目,请尝试清理node_modules,重新install,还不行就删除项目,再重新install。 |
|||
## 此问题已于DCloud官方确认,HBuilderX下个版本会修复。 |
|||
## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn) |
|||
## <font color=#FF0000> 新手请先完整阅读帮助文档及常见问题3遍,右侧蓝色按钮示例项目请看2遍! </font> |
|||
## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) |
|||
## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
|||
- uCharts.js 修复混合图中柱状图单独设置颜色不生效的bug |
|||
- uCharts.js 修复多Y轴单独设置fontSize时,开启canvas2d后,未对应放大字体的bug |
|||
## 2.0.0-20210418(2021-04-18) |
|||
- 秋云图表组件 增加directory配置,修复H5端history模式下如果发布到二级目录无法正确加载echarts.min.js的bug |
|||
## 2.0.0-20210416(2021-04-16) |
|||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 |
|||
## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX,如仍不好用,请重启电脑; |
|||
## 如果是cli项目,请尝试清理node_modules,重新install,还不行就删除项目,再重新install。 |
|||
## 此问题已于DCloud官方确认,HBuilderX下个版本会修复。 |
|||
## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn) |
|||
## <font color=#FF0000> 新手请先完整阅读帮助文档及常见问题3遍,右侧蓝色按钮示例项目请看2遍! </font> |
|||
## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) |
|||
## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
|||
- 秋云图表组件 修复APP端某些情况下报错`Not Found Page`的bug,fix by 高级bug开发技术员 |
|||
- 示例项目 修复APP端v-for循环某些情况下报错`Not Found Page`的bug,fix by 高级bug开发技术员 |
|||
- uCharts.js 修复非直角坐标系tooltip提示窗右侧超出未变换方向显示的bug |
|||
## 2.0.0-20210415(2021-04-15) |
|||
- 秋云图表组件 修复H5端发布到二级目录下echarts无法加载的bug |
|||
- 秋云图表组件 修复某些情况下echarts.off('finished')移除监听事件报错的bug |
|||
## 2.0.0-20210414(2021-04-14) |
|||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 |
|||
## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX,如仍不好用,请重启电脑; |
|||
## 如果是cli项目,请尝试清理node_modules,重新install,还不行就删除项目,再重新install。 |
|||
## 此问题已于DCloud官方确认,HBuilderX下个版本会修复。 |
|||
## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn) |
|||
## <font color=#FF0000> 新手请先完整阅读帮助文档及常见问题3遍,右侧蓝色按钮示例项目请看2遍! </font> |
|||
## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) |
|||
## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
|||
- 秋云图表组件 修复H5端在cli项目下ECharts引用地址错误的bug |
|||
- 示例项目 增加ECharts的formatter用法的示例(详见示例项目format-e.vue) |
|||
- uCharts.js 增加圆环图中心背景色的配置extra.ring.centerColor |
|||
- uCharts.js 修复微信小程序安卓端柱状图开启透明色后显示不正确的bug |
|||
## 2.0.0-20210413(2021-04-13) |
|||
- 秋云图表组件 修复百度小程序多个图表真机未能正确获取根元素dom尺寸的bug |
|||
- 秋云图表组件 修复百度小程序横屏模式方向不正确的bug |
|||
- 秋云图表组件 修改ontouch时,@getTouchStart@getTouchMove@getTouchEnd的触发条件 |
|||
- uCharts.js 修复饼图类数据格式series属性不生效的bug |
|||
- uCharts.js 增加时序区域图 详见示例项目中ucharts.vue |
|||
## 2.0.0-20210412-2(2021-04-12) |
|||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 |
|||
## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX。如仍不好用,请重启电脑,此问题已于DCloud官方确认,HBuilderX下个版本会修复。 |
|||
## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) |
|||
## [图表组件在uniCloudAdmin中的应用 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
|||
- 秋云图表组件 修复uCharts在APP端横屏模式下不能正确渲染的bug |
|||
- 示例项目 增加ECharts柱状图渐变色、圆角柱状图、横向柱状图(条状图)的示例 |
|||
## 2.0.0-20210412(2021-04-12) |
|||
- 秋云图表组件 修复created中判断echarts导致APP端无法识别,改回mounted中判断echarts初始化 |
|||
- uCharts.js 修复2d模式下series.textOffset未乘像素比的bug |
|||
## 2.0.0-20210411(2021-04-11) |
|||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 |
|||
## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX,并清空小程序开发者工具缓存。 |
|||
## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) |
|||
## [图表组件在uniCloudAdmin中的应用 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
|||
- uCharts.js 折线图区域图增加connectNulls断点续连的功能,详见示例项目中ucharts.vue |
|||
- 秋云图表组件 变更初始化方法为created,变更type2d默认值为true,优化2d模式下组件初始化后dom获取不到的bug |
|||
- 秋云图表组件 修复左右布局时,右侧图表点击坐标错误的bug,修复tooltip柱状图自定义颜色显示object的bug |
|||
## 2.0.0-20210410(2021-04-10) |
|||
- 修复左右布局时,右侧图表点击坐标错误的bug,修复柱状图自定义颜色tooltip显示object的bug |
|||
- 增加标记线及柱状图自定义颜色的demo |
|||
## 2.0.0-20210409(2021-04-08) |
|||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧【使用HBuilderX导入插件】即可体验,DEMO演示及在线生成工具(v2.0文档)[https://demo.ucharts.cn](https://demo.ucharts.cn) |
|||
## 图表组件在uniCloudAdmin中的应用 [UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
|||
- uCharts.js 修复钉钉小程序百度小程序measureText不准确的bug,修复2d模式下饼图类activeRadius为按比例放大的bug |
|||
- 修复组件在支付宝小程序端点击位置不准确的bug |
|||
## 2.0.0-20210408(2021-04-07) |
|||
- 修复组件在支付宝小程序端不能显示的bug(目前支付宝小程不能点击交互,后续修复) |
|||
- uCharts.js 修复高分屏下柱状图类,圆弧进度条 自定义宽度不能按比例放大的bug |
|||
## 2.0.0-20210407(2021-04-06) |
|||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧【使用HBuilderX导入插件】即可体验,DEMO演示及在线生成工具(v2.0文档)[https://demo.ucharts.cn](https://demo.ucharts.cn) |
|||
## 增加 通过tofix和unit快速格式化y轴的demo add by `howcode` |
|||
## 增加 图表组件在uniCloudAdmin中的应用 [UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
|||
## 2.0.0-20210406(2021-04-05) |
|||
# 秋云图表组件+uCharts v2.0版本同步上线,使用方法详见https://demo.ucharts.cn帮助页 |
|||
## 2.0.0(2021-04-05) |
|||
# 秋云图表组件+uCharts v2.0版本同步上线,使用方法详见https://demo.ucharts.cn帮助页 |
@ -0,0 +1,162 @@ |
|||
<template> |
|||
<view class="container loading1"> |
|||
<view class="shape shape1"></view> |
|||
<view class="shape shape2"></view> |
|||
<view class="shape shape3"></view> |
|||
<view class="shape shape4"></view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'loading1', |
|||
data() { |
|||
return { |
|||
|
|||
}; |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped="true"> |
|||
.container { |
|||
width: 30px; |
|||
height: 30px; |
|||
position: relative; |
|||
} |
|||
.container.loading1 { |
|||
-webkit-transform: rotate(45deg); |
|||
transform: rotate(45deg); |
|||
} |
|||
|
|||
.container .shape { |
|||
position: absolute; |
|||
width: 10px; |
|||
height: 10px; |
|||
border-radius: 1px; |
|||
} |
|||
.container .shape.shape1 { |
|||
left: 0; |
|||
background-color: #1890FF; |
|||
} |
|||
.container .shape.shape2 { |
|||
right: 0; |
|||
background-color: #91CB74; |
|||
} |
|||
.container .shape.shape3 { |
|||
bottom: 0; |
|||
background-color: #FAC858; |
|||
} |
|||
.container .shape.shape4 { |
|||
bottom: 0; |
|||
right: 0; |
|||
background-color: #EE6666; |
|||
} |
|||
|
|||
.loading1 .shape1 { |
|||
-webkit-animation: animation1shape1 0.5s ease 0s infinite alternate; |
|||
animation: animation1shape1 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation1shape1 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(16px, 16px); |
|||
transform: translate(16px, 16px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation1shape1 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(16px, 16px); |
|||
transform: translate(16px, 16px); |
|||
} |
|||
} |
|||
.loading1 .shape2 { |
|||
-webkit-animation: animation1shape2 0.5s ease 0s infinite alternate; |
|||
animation: animation1shape2 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation1shape2 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-16px, 16px); |
|||
transform: translate(-16px, 16px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation1shape2 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-16px, 16px); |
|||
transform: translate(-16px, 16px); |
|||
} |
|||
} |
|||
.loading1 .shape3 { |
|||
-webkit-animation: animation1shape3 0.5s ease 0s infinite alternate; |
|||
animation: animation1shape3 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation1shape3 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(16px, -16px); |
|||
transform: translate(16px, -16px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation1shape3 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(16px, -16px); |
|||
transform: translate(16px, -16px); |
|||
} |
|||
} |
|||
.loading1 .shape4 { |
|||
-webkit-animation: animation1shape4 0.5s ease 0s infinite alternate; |
|||
animation: animation1shape4 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation1shape4 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-16px, -16px); |
|||
transform: translate(-16px, -16px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation1shape4 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-16px, -16px); |
|||
transform: translate(-16px, -16px); |
|||
} |
|||
} |
|||
|
|||
|
|||
</style> |
@ -0,0 +1,170 @@ |
|||
<template> |
|||
<view class="container loading2"> |
|||
<view class="shape shape1"></view> |
|||
<view class="shape shape2"></view> |
|||
<view class="shape shape3"></view> |
|||
<view class="shape shape4"></view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'loading2', |
|||
data() { |
|||
return { |
|||
|
|||
}; |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped="true"> |
|||
.container { |
|||
width: 30px; |
|||
height: 30px; |
|||
position: relative; |
|||
} |
|||
|
|||
.container.loading2 { |
|||
-webkit-transform: rotate(10deg); |
|||
transform: rotate(10deg); |
|||
} |
|||
.container.loading2 .shape { |
|||
border-radius: 5px; |
|||
} |
|||
.container.loading2{ |
|||
-webkit-animation: rotation 1s infinite; |
|||
animation: rotation 1s infinite; |
|||
} |
|||
|
|||
.container .shape { |
|||
position: absolute; |
|||
width: 10px; |
|||
height: 10px; |
|||
border-radius: 1px; |
|||
} |
|||
.container .shape.shape1 { |
|||
left: 0; |
|||
background-color: #1890FF; |
|||
} |
|||
.container .shape.shape2 { |
|||
right: 0; |
|||
background-color: #91CB74; |
|||
} |
|||
.container .shape.shape3 { |
|||
bottom: 0; |
|||
background-color: #FAC858; |
|||
} |
|||
.container .shape.shape4 { |
|||
bottom: 0; |
|||
right: 0; |
|||
background-color: #EE6666; |
|||
} |
|||
|
|||
|
|||
.loading2 .shape1 { |
|||
-webkit-animation: animation2shape1 0.5s ease 0s infinite alternate; |
|||
animation: animation2shape1 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation2shape1 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(20px, 20px); |
|||
transform: translate(20px, 20px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation2shape1 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(20px, 20px); |
|||
transform: translate(20px, 20px); |
|||
} |
|||
} |
|||
.loading2 .shape2 { |
|||
-webkit-animation: animation2shape2 0.5s ease 0s infinite alternate; |
|||
animation: animation2shape2 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation2shape2 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-20px, 20px); |
|||
transform: translate(-20px, 20px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation2shape2 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-20px, 20px); |
|||
transform: translate(-20px, 20px); |
|||
} |
|||
} |
|||
.loading2 .shape3 { |
|||
-webkit-animation: animation2shape3 0.5s ease 0s infinite alternate; |
|||
animation: animation2shape3 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation2shape3 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(20px, -20px); |
|||
transform: translate(20px, -20px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation2shape3 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(20px, -20px); |
|||
transform: translate(20px, -20px); |
|||
} |
|||
} |
|||
.loading2 .shape4 { |
|||
-webkit-animation: animation2shape4 0.5s ease 0s infinite alternate; |
|||
animation: animation2shape4 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation2shape4 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-20px, -20px); |
|||
transform: translate(-20px, -20px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation2shape4 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-20px, -20px); |
|||
transform: translate(-20px, -20px); |
|||
} |
|||
} |
|||
|
|||
</style> |
@ -0,0 +1,173 @@ |
|||
<template> |
|||
<view class="container loading3"> |
|||
<view class="shape shape1"></view> |
|||
<view class="shape shape2"></view> |
|||
<view class="shape shape3"></view> |
|||
<view class="shape shape4"></view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'loading3', |
|||
data() { |
|||
return { |
|||
|
|||
}; |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped="true"> |
|||
.container { |
|||
width: 30px; |
|||
height: 30px; |
|||
position: relative; |
|||
} |
|||
|
|||
.container.loading3 { |
|||
-webkit-animation: rotation 1s infinite; |
|||
animation: rotation 1s infinite; |
|||
} |
|||
.container.loading3 .shape1 { |
|||
border-top-left-radius: 10px; |
|||
} |
|||
.container.loading3 .shape2 { |
|||
border-top-right-radius: 10px; |
|||
} |
|||
.container.loading3 .shape3 { |
|||
border-bottom-left-radius: 10px; |
|||
} |
|||
.container.loading3 .shape4 { |
|||
border-bottom-right-radius: 10px; |
|||
} |
|||
|
|||
.container .shape { |
|||
position: absolute; |
|||
width: 10px; |
|||
height: 10px; |
|||
border-radius: 1px; |
|||
} |
|||
.container .shape.shape1 { |
|||
left: 0; |
|||
background-color: #1890FF; |
|||
} |
|||
.container .shape.shape2 { |
|||
right: 0; |
|||
background-color: #91CB74; |
|||
} |
|||
.container .shape.shape3 { |
|||
bottom: 0; |
|||
background-color: #FAC858; |
|||
} |
|||
.container .shape.shape4 { |
|||
bottom: 0; |
|||
right: 0; |
|||
background-color: #EE6666; |
|||
} |
|||
|
|||
.loading3 .shape1 { |
|||
-webkit-animation: animation3shape1 0.5s ease 0s infinite alternate; |
|||
animation: animation3shape1 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation3shape1 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(5px, 5px); |
|||
transform: translate(5px, 5px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation3shape1 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(5px, 5px); |
|||
transform: translate(5px, 5px); |
|||
} |
|||
} |
|||
.loading3 .shape2 { |
|||
-webkit-animation: animation3shape2 0.5s ease 0s infinite alternate; |
|||
animation: animation3shape2 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation3shape2 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-5px, 5px); |
|||
transform: translate(-5px, 5px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation3shape2 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-5px, 5px); |
|||
transform: translate(-5px, 5px); |
|||
} |
|||
} |
|||
.loading3 .shape3 { |
|||
-webkit-animation: animation3shape3 0.5s ease 0s infinite alternate; |
|||
animation: animation3shape3 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation3shape3 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(5px, -5px); |
|||
transform: translate(5px, -5px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation3shape3 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(5px, -5px); |
|||
transform: translate(5px, -5px); |
|||
} |
|||
} |
|||
.loading3 .shape4 { |
|||
-webkit-animation: animation3shape4 0.5s ease 0s infinite alternate; |
|||
animation: animation3shape4 0.5s ease 0s infinite alternate; |
|||
} |
|||
|
|||
@-webkit-keyframes animation3shape4 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-5px, -5px); |
|||
transform: translate(-5px, -5px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation3shape4 { |
|||
from { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
to { |
|||
-webkit-transform: translate(-5px, -5px); |
|||
transform: translate(-5px, -5px); |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,222 @@ |
|||
<template> |
|||
<view class="container loading5"> |
|||
<view class="shape shape1"></view> |
|||
<view class="shape shape2"></view> |
|||
<view class="shape shape3"></view> |
|||
<view class="shape shape4"></view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'loading5', |
|||
data() { |
|||
return { |
|||
|
|||
}; |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped="true"> |
|||
.container { |
|||
width: 30px; |
|||
height: 30px; |
|||
position: relative; |
|||
} |
|||
|
|||
.container.loading5 .shape { |
|||
width: 15px; |
|||
height: 15px; |
|||
} |
|||
|
|||
.container .shape { |
|||
position: absolute; |
|||
width: 10px; |
|||
height: 10px; |
|||
border-radius: 1px; |
|||
} |
|||
.container .shape.shape1 { |
|||
left: 0; |
|||
background-color: #1890FF; |
|||
} |
|||
.container .shape.shape2 { |
|||
right: 0; |
|||
background-color: #91CB74; |
|||
} |
|||
.container .shape.shape3 { |
|||
bottom: 0; |
|||
background-color: #FAC858; |
|||
} |
|||
.container .shape.shape4 { |
|||
bottom: 0; |
|||
right: 0; |
|||
background-color: #EE6666; |
|||
} |
|||
|
|||
.loading5 .shape1 { |
|||
animation: animation5shape1 2s ease 0s infinite reverse; |
|||
} |
|||
|
|||
@-webkit-keyframes animation5shape1 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(0, 15px); |
|||
transform: translate(0, 15px); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(15px, 15px); |
|||
transform: translate(15px, 15px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(15px, 0); |
|||
transform: translate(15px, 0); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation5shape1 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(0, 15px); |
|||
transform: translate(0, 15px); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(15px, 15px); |
|||
transform: translate(15px, 15px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(15px, 0); |
|||
transform: translate(15px, 0); |
|||
} |
|||
} |
|||
.loading5 .shape2 { |
|||
animation: animation5shape2 2s ease 0s infinite reverse; |
|||
} |
|||
|
|||
@-webkit-keyframes animation5shape2 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(-15px, 0); |
|||
transform: translate(-15px, 0); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(-15px, 15px); |
|||
transform: translate(-15px, 15px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(0, 15px); |
|||
transform: translate(0, 15px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation5shape2 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(-15px, 0); |
|||
transform: translate(-15px, 0); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(-15px, 15px); |
|||
transform: translate(-15px, 15px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(0, 15px); |
|||
transform: translate(0, 15px); |
|||
} |
|||
} |
|||
.loading5 .shape3 { |
|||
animation: animation5shape3 2s ease 0s infinite reverse; |
|||
} |
|||
|
|||
@-webkit-keyframes animation5shape3 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(15px, 0); |
|||
transform: translate(15px, 0); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(15px, -15px); |
|||
transform: translate(15px, -15px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(0, -15px); |
|||
transform: translate(0, -15px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation5shape3 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(15px, 0); |
|||
transform: translate(15px, 0); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(15px, -15px); |
|||
transform: translate(15px, -15px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(0, -15px); |
|||
transform: translate(0, -15px); |
|||
} |
|||
} |
|||
.loading5 .shape4 { |
|||
animation: animation5shape4 2s ease 0s infinite reverse; |
|||
} |
|||
|
|||
@-webkit-keyframes animation5shape4 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(0, -15px); |
|||
transform: translate(0, -15px); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(-15px, -15px); |
|||
transform: translate(-15px, -15px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(-15px, 0); |
|||
transform: translate(-15px, 0); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation5shape4 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(0, -15px); |
|||
transform: translate(0, -15px); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(-15px, -15px); |
|||
transform: translate(-15px, -15px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(-15px, 0); |
|||
transform: translate(-15px, 0); |
|||
} |
|||
} |
|||
|
|||
</style> |
@ -0,0 +1,229 @@ |
|||
<template> |
|||
<view class="container loading6"> |
|||
<view class="shape shape1"></view> |
|||
<view class="shape shape2"></view> |
|||
<view class="shape shape3"></view> |
|||
<view class="shape shape4"></view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'loading6', |
|||
data() { |
|||
return { |
|||
|
|||
}; |
|||
} |
|||
} |
|||
</script> |
|||
<style scoped="true"> |
|||
.container { |
|||
width: 30px; |
|||
height: 30px; |
|||
position: relative; |
|||
} |
|||
|
|||
.container.loading6 { |
|||
-webkit-animation: rotation 1s infinite; |
|||
animation: rotation 1s infinite; |
|||
} |
|||
.container.loading6 .shape { |
|||
width: 12px; |
|||
height: 12px; |
|||
border-radius: 2px; |
|||
} |
|||
.container .shape { |
|||
position: absolute; |
|||
width: 10px; |
|||
height: 10px; |
|||
border-radius: 1px; |
|||
} |
|||
.container .shape.shape1 { |
|||
left: 0; |
|||
background-color: #1890FF; |
|||
} |
|||
.container .shape.shape2 { |
|||
right: 0; |
|||
background-color: #91CB74; |
|||
} |
|||
.container .shape.shape3 { |
|||
bottom: 0; |
|||
background-color: #FAC858; |
|||
} |
|||
.container .shape.shape4 { |
|||
bottom: 0; |
|||
right: 0; |
|||
background-color: #EE6666; |
|||
} |
|||
|
|||
|
|||
.loading6 .shape1 { |
|||
-webkit-animation: animation6shape1 2s linear 0s infinite normal; |
|||
animation: animation6shape1 2s linear 0s infinite normal; |
|||
} |
|||
|
|||
@-webkit-keyframes animation6shape1 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(0, 18px); |
|||
transform: translate(0, 18px); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(18px, 18px); |
|||
transform: translate(18px, 18px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(18px, 0); |
|||
transform: translate(18px, 0); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation6shape1 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(0, 18px); |
|||
transform: translate(0, 18px); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(18px, 18px); |
|||
transform: translate(18px, 18px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(18px, 0); |
|||
transform: translate(18px, 0); |
|||
} |
|||
} |
|||
.loading6 .shape2 { |
|||
-webkit-animation: animation6shape2 2s linear 0s infinite normal; |
|||
animation: animation6shape2 2s linear 0s infinite normal; |
|||
} |
|||
|
|||
@-webkit-keyframes animation6shape2 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(-18px, 0); |
|||
transform: translate(-18px, 0); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(-18px, 18px); |
|||
transform: translate(-18px, 18px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(0, 18px); |
|||
transform: translate(0, 18px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation6shape2 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(-18px, 0); |
|||
transform: translate(-18px, 0); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(-18px, 18px); |
|||
transform: translate(-18px, 18px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(0, 18px); |
|||
transform: translate(0, 18px); |
|||
} |
|||
} |
|||
.loading6 .shape3 { |
|||
-webkit-animation: animation6shape3 2s linear 0s infinite normal; |
|||
animation: animation6shape3 2s linear 0s infinite normal; |
|||
} |
|||
|
|||
@-webkit-keyframes animation6shape3 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(18px, 0); |
|||
transform: translate(18px, 0); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(18px, -18px); |
|||
transform: translate(18px, -18px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(0, -18px); |
|||
transform: translate(0, -18px); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation6shape3 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(18px, 0); |
|||
transform: translate(18px, 0); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(18px, -18px); |
|||
transform: translate(18px, -18px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(0, -18px); |
|||
transform: translate(0, -18px); |
|||
} |
|||
} |
|||
.loading6 .shape4 { |
|||
-webkit-animation: animation6shape4 2s linear 0s infinite normal; |
|||
animation: animation6shape4 2s linear 0s infinite normal; |
|||
} |
|||
|
|||
@-webkit-keyframes animation6shape4 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(0, -18px); |
|||
transform: translate(0, -18px); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(-18px, -18px); |
|||
transform: translate(-18px, -18px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(-18px, 0); |
|||
transform: translate(-18px, 0); |
|||
} |
|||
} |
|||
|
|||
@keyframes animation6shape4 { |
|||
0% { |
|||
-webkit-transform: translate(0, 0); |
|||
transform: translate(0, 0); |
|||
} |
|||
25% { |
|||
-webkit-transform: translate(0, -18px); |
|||
transform: translate(0, -18px); |
|||
} |
|||
50% { |
|||
-webkit-transform: translate(-18px, -18px); |
|||
transform: translate(-18px, -18px); |
|||
} |
|||
75% { |
|||
-webkit-transform: translate(-18px, 0); |
|||
transform: translate(-18px, 0); |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,36 @@ |
|||
<template> |
|||
<view> |
|||
<Loading1 v-if="loadingType==1"/> |
|||
<Loading2 v-if="loadingType==2"/> |
|||
<Loading3 v-if="loadingType==3"/> |
|||
<Loading4 v-if="loadingType==4"/> |
|||
<Loading5 v-if="loadingType==5"/> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import Loading1 from "./loading1.vue"; |
|||
import Loading2 from "./loading2.vue"; |
|||
import Loading3 from "./loading3.vue"; |
|||
import Loading4 from "./loading4.vue"; |
|||
import Loading5 from "./loading5.vue"; |
|||
export default { |
|||
components:{Loading1,Loading2,Loading3,Loading4,Loading5}, |
|||
name: 'qiun-loading', |
|||
props: { |
|||
loadingType: { |
|||
type: Number, |
|||
default: 2 |
|||
}, |
|||
}, |
|||
data() { |
|||
return { |
|||
|
|||
}; |
|||
}, |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
|
|||
</style> |
@ -0,0 +1,422 @@ |
|||
/* |
|||
* uCharts® |
|||
* 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台 |
|||
* Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
|
|||
* Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|||
* 复制使用请保留本段注释,感谢支持开源! |
|||
* |
|||
* uCharts®官方网站 |
|||
* https://www.uCharts.cn
|
|||
* |
|||
* 开源地址: |
|||
* https://gitee.com/uCharts/uCharts
|
|||
* |
|||
* uni-app插件市场地址: |
|||
* http://ext.dcloud.net.cn/plugin?id=271
|
|||
* |
|||
*/ |
|||
|
|||
// 通用配置项
|
|||
|
|||
// 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
|
|||
const color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc']; |
|||
|
|||
const cfe = { |
|||
//demotype为自定义图表类型
|
|||
"type": ["pie", "ring", "rose", "funnel", "line", "column", "area", "radar", "gauge","candle","demotype"], |
|||
//增加自定义图表类型,如果需要categories,请在这里加入您的图表类型例如最后的"demotype"
|
|||
"categories": ["line", "column", "area", "radar", "gauge", "candle","demotype"], |
|||
//instance为实例变量承载属性,option为eopts承载属性,不要删除
|
|||
"instance": {}, |
|||
"option": {}, |
|||
//下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
|
|||
"formatter":{ |
|||
"tooltipDemo1":function(res){ |
|||
let result = '' |
|||
for (let i in res) { |
|||
if (i == 0) { |
|||
result += res[i].axisValueLabel + '年销售额' |
|||
} |
|||
let value = '--' |
|||
if (res[i].data !== null) { |
|||
value = res[i].data |
|||
} |
|||
// #ifdef H5
|
|||
result += '\n' + res[i].seriesName + ':' + value + ' 万元' |
|||
// #endif
|
|||
|
|||
// #ifdef APP-PLUS
|
|||
result += '<br/>' + res[i].marker + res[i].seriesName + ':' + value + ' 万元' |
|||
// #endif
|
|||
} |
|||
return result; |
|||
}, |
|||
legendFormat:function(name){ |
|||
return "自定义图例+"+name; |
|||
}, |
|||
yAxisFormatDemo:function (value, index) { |
|||
return value + '元'; |
|||
}, |
|||
seriesFormatDemo:function(res){ |
|||
return res.name + '年' + res.value + '元'; |
|||
} |
|||
}, |
|||
//这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在eopts参数,会将demotype与eopts中option合并后渲染图表。
|
|||
"demotype":{ |
|||
"color": color, |
|||
//在这里填写echarts的option即可
|
|||
|
|||
}, |
|||
//下面是自定义配置,请添加项目所需的通用配置
|
|||
"column": { |
|||
"color": color, |
|||
"title": { |
|||
"text": '' |
|||
}, |
|||
"tooltip": { |
|||
"trigger": 'axis' |
|||
}, |
|||
"grid": { |
|||
"top": 30, |
|||
"bottom": 50, |
|||
"right": 15, |
|||
"left": 40 |
|||
}, |
|||
"legend": { |
|||
"bottom": 'left', |
|||
}, |
|||
"toolbox": { |
|||
"show": false, |
|||
}, |
|||
"xAxis": { |
|||
"type": 'category', |
|||
"axisLabel": { |
|||
"color": '#666666' |
|||
}, |
|||
"axisLine": { |
|||
"lineStyle": { |
|||
"color": '#CCCCCC' |
|||
} |
|||
}, |
|||
"boundaryGap": true, |
|||
"data": [] |
|||
}, |
|||
"yAxis": { |
|||
"type": 'value', |
|||
"axisTick": { |
|||
"show": false, |
|||
}, |
|||
"axisLabel": { |
|||
"color": '#666666' |
|||
}, |
|||
"axisLine": { |
|||
"lineStyle": { |
|||
"color": '#CCCCCC' |
|||
} |
|||
}, |
|||
}, |
|||
"seriesTemplate": { |
|||
"name": '', |
|||
"type": 'bar', |
|||
"data": [], |
|||
"barwidth": 20, |
|||
"label": { |
|||
"show": true, |
|||
"color": "#666666", |
|||
"position": 'top', |
|||
}, |
|||
}, |
|||
}, |
|||
"line": { |
|||
"color": color, |
|||
"title": { |
|||
"text": '' |
|||
}, |
|||
"tooltip": { |
|||
"trigger": 'axis' |
|||
}, |
|||
"grid": { |
|||
"top": 30, |
|||
"bottom": 50, |
|||
"right": 15, |
|||
"left": 40 |
|||
}, |
|||
"legend": { |
|||
"bottom": 'left', |
|||
}, |
|||
"toolbox": { |
|||
"show": false, |
|||
}, |
|||
"xAxis": { |
|||
"type": 'category', |
|||
"axisLabel": { |
|||
"color": '#666666' |
|||
}, |
|||
"axisLine": { |
|||
"lineStyle": { |
|||
"color": '#CCCCCC' |
|||
} |
|||
}, |
|||
"boundaryGap": true, |
|||
"data": [] |
|||
}, |
|||
"yAxis": { |
|||
"type": 'value', |
|||
"axisTick": { |
|||
"show": false, |
|||
}, |
|||
"axisLabel": { |
|||
"color": '#666666' |
|||
}, |
|||
"axisLine": { |
|||
"lineStyle": { |
|||
"color": '#CCCCCC' |
|||
} |
|||
}, |
|||
}, |
|||
"seriesTemplate": { |
|||
"name": '', |
|||
"type": 'line', |
|||
"data": [], |
|||
"barwidth": 20, |
|||
"label": { |
|||
"show": true, |
|||
"color": "#666666", |
|||
"position": 'top', |
|||
}, |
|||
}, |
|||
}, |
|||
"area": { |
|||
"color": color, |
|||
"title": { |
|||
"text": '' |
|||
}, |
|||
"tooltip": { |
|||
"trigger": 'axis' |
|||
}, |
|||
"grid": { |
|||
"top": 30, |
|||
"bottom": 50, |
|||
"right": 15, |
|||
"left": 40 |
|||
}, |
|||
"legend": { |
|||
"bottom": 'left', |
|||
}, |
|||
"toolbox": { |
|||
"show": false, |
|||
}, |
|||
"xAxis": { |
|||
"type": 'category', |
|||
"axisLabel": { |
|||
"color": '#666666' |
|||
}, |
|||
"axisLine": { |
|||
"lineStyle": { |
|||
"color": '#CCCCCC' |
|||
} |
|||
}, |
|||
"boundaryGap": true, |
|||
"data": [] |
|||
}, |
|||
"yAxis": { |
|||
"type": 'value', |
|||
"axisTick": { |
|||
"show": false, |
|||
}, |
|||
"axisLabel": { |
|||
"color": '#666666' |
|||
}, |
|||
"axisLine": { |
|||
"lineStyle": { |
|||
"color": '#CCCCCC' |
|||
} |
|||
}, |
|||
}, |
|||
"seriesTemplate": { |
|||
"name": '', |
|||
"type": 'line', |
|||
"data": [], |
|||
"areaStyle": {}, |
|||
"label": { |
|||
"show": true, |
|||
"color": "#666666", |
|||
"position": 'top', |
|||
}, |
|||
}, |
|||
}, |
|||
"pie": { |
|||
"color": color, |
|||
"title": { |
|||
"text": '' |
|||
}, |
|||
"tooltip": { |
|||
"trigger": 'item' |
|||
}, |
|||
"grid": { |
|||
"top": 40, |
|||
"bottom": 30, |
|||
"right": 15, |
|||
"left": 15 |
|||
}, |
|||
"legend": { |
|||
"bottom": 'left', |
|||
}, |
|||
"seriesTemplate": { |
|||
"name": '', |
|||
"type": 'pie', |
|||
"data": [], |
|||
"radius": '50%', |
|||
"label": { |
|||
"show": true, |
|||
"color": "#666666", |
|||
"position": 'top', |
|||
}, |
|||
}, |
|||
}, |
|||
"ring": { |
|||
"color": color, |
|||
"title": { |
|||
"text": '' |
|||
}, |
|||
"tooltip": { |
|||
"trigger": 'item' |
|||
}, |
|||
"grid": { |
|||
"top": 40, |
|||
"bottom": 30, |
|||
"right": 15, |
|||
"left": 15 |
|||
}, |
|||
"legend": { |
|||
"bottom": 'left', |
|||
}, |
|||
"seriesTemplate": { |
|||
"name": '', |
|||
"type": 'pie', |
|||
"data": [], |
|||
"radius": ['40%', '70%'], |
|||
"avoidLabelOverlap": false, |
|||
"label": { |
|||
"show": true, |
|||
"color": "#666666", |
|||
"position": 'top', |
|||
}, |
|||
"labelLine": { |
|||
"show": true |
|||
}, |
|||
}, |
|||
}, |
|||
"rose": { |
|||
"color": color, |
|||
"title": { |
|||
"text": '' |
|||
}, |
|||
"tooltip": { |
|||
"trigger": 'item' |
|||
}, |
|||
"legend": { |
|||
"top": 'bottom' |
|||
}, |
|||
"seriesTemplate": { |
|||
"name": '', |
|||
"type": 'pie', |
|||
"data": [], |
|||
"radius": "55%", |
|||
"center": ['50%', '50%'], |
|||
"roseType": 'area', |
|||
}, |
|||
}, |
|||
"funnel": { |
|||
"color": color, |
|||
"title": { |
|||
"text": '' |
|||
}, |
|||
"tooltip": { |
|||
"trigger": 'item', |
|||
"formatter": "{b} : {c}%" |
|||
}, |
|||
"legend": { |
|||
"top": 'bottom' |
|||
}, |
|||
"seriesTemplate": { |
|||
"name": '', |
|||
"type": 'funnel', |
|||
"left": '10%', |
|||
"top": 60, |
|||
"bottom": 60, |
|||
"width": '80%', |
|||
"min": 0, |
|||
"max": 100, |
|||
"minSize": '0%', |
|||
"maxSize": '100%', |
|||
"sort": 'descending', |
|||
"gap": 2, |
|||
"label": { |
|||
"show": true, |
|||
"position": 'inside' |
|||
}, |
|||
"labelLine": { |
|||
"length": 10, |
|||
"lineStyle": { |
|||
"width": 1, |
|||
"type": 'solid' |
|||
} |
|||
}, |
|||
"itemStyle": { |
|||
"bordercolor": '#fff', |
|||
"borderwidth": 1 |
|||
}, |
|||
"emphasis": { |
|||
"label": { |
|||
"fontSize": 20 |
|||
} |
|||
}, |
|||
"data": [], |
|||
}, |
|||
}, |
|||
"gauge": { |
|||
"color": color, |
|||
"tooltip": { |
|||
"formatter": '{a} <br/>{b} : {c}%' |
|||
}, |
|||
"seriesTemplate": { |
|||
"name": '业务指标', |
|||
"type": 'gauge', |
|||
"detail": {"formatter": '{value}%'}, |
|||
"data": [{"value": 50, "name": '完成率'}] |
|||
}, |
|||
}, |
|||
"candle": { |
|||
"xAxis": { |
|||
"data": [] |
|||
}, |
|||
"yAxis": {}, |
|||
"color": color, |
|||
"title": { |
|||
"text": '' |
|||
}, |
|||
"dataZoom": [{ |
|||
"type": 'inside', |
|||
"xAxisIndex": [0, 1], |
|||
"start": 10, |
|||
"end": 100 |
|||
}, |
|||
{ |
|||
"show": true, |
|||
"xAxisIndex": [0, 1], |
|||
"type": 'slider', |
|||
"bottom": 10, |
|||
"start": 10, |
|||
"end": 100 |
|||
} |
|||
], |
|||
"seriesTemplate": { |
|||
"name": '', |
|||
"type": 'k', |
|||
"data": [], |
|||
}, |
|||
} |
|||
} |
|||
|
|||
export default cfe; |
@ -0,0 +1,606 @@ |
|||
/* |
|||
* uCharts® |
|||
* 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台 |
|||
* Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
|
|||
* Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|||
* 复制使用请保留本段注释,感谢支持开源! |
|||
* |
|||
* uCharts®官方网站 |
|||
* https://www.uCharts.cn
|
|||
* |
|||
* 开源地址: |
|||
* https://gitee.com/uCharts/uCharts
|
|||
* |
|||
* uni-app插件市场地址: |
|||
* http://ext.dcloud.net.cn/plugin?id=271
|
|||
* |
|||
*/ |
|||
|
|||
// 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
|
|||
const color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc']; |
|||
|
|||
//事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改
|
|||
const formatDateTime = (timeStamp, returnType)=>{ |
|||
var date = new Date(); |
|||
date.setTime(timeStamp * 1000); |
|||
var y = date.getFullYear(); |
|||
var m = date.getMonth() + 1; |
|||
m = m < 10 ? ('0' + m) : m; |
|||
var d = date.getDate(); |
|||
d = d < 10 ? ('0' + d) : d; |
|||
var h = date.getHours(); |
|||
h = h < 10 ? ('0' + h) : h; |
|||
var minute = date.getMinutes(); |
|||
var second = date.getSeconds(); |
|||
minute = minute < 10 ? ('0' + minute) : minute; |
|||
second = second < 10 ? ('0' + second) : second; |
|||
if(returnType == 'full'){return y + '-' + m + '-' + d + ' '+ h +':' + minute + ':' + second;} |
|||
if(returnType == 'y-m-d'){return y + '-' + m + '-' + d;} |
|||
if(returnType == 'h:m'){return h +':' + minute;} |
|||
if(returnType == 'h:m:s'){return h +':' + minute +':' + second;} |
|||
return [y, m, d, h, minute, second]; |
|||
} |
|||
|
|||
const cfu = { |
|||
//demotype为自定义图表类型,一般不需要自定义图表类型,只需要改根节点上对应的类型即可
|
|||
"type":["pie","ring","rose","word","funnel","map","arcbar","line","column","mount","bar","area","radar","gauge","candle","mix","tline","tarea","scatter","bubble","demotype"], |
|||
"range":["饼状图","圆环图","玫瑰图","词云图","漏斗图","地图","圆弧进度条","折线图","柱状图","山峰图","条状图","区域图","雷达图","仪表盘","K线图","混合图","时间轴折线","时间轴区域","散点图","气泡图","自定义类型"], |
|||
//增加自定义图表类型,如果需要categories,请在这里加入您的图表类型,例如最后的"demotype"
|
|||
//自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴(矢量x轴)类图表,没有categories,不需要加入categories
|
|||
"categories":["line","column","mount","bar","area","radar","gauge","candle","mix","demotype"], |
|||
//instance为实例变量承载属性,不要删除
|
|||
"instance":{}, |
|||
//option为opts及eopts承载属性,不要删除
|
|||
"option":{}, |
|||
//下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
|
|||
"formatter":{ |
|||
"yAxisDemo1":function(val, index, opts){return val+'元'}, |
|||
"yAxisDemo2":function(val, index, opts){return val.toFixed(2)}, |
|||
"xAxisDemo1":function(val, index, opts){return val+'年';}, |
|||
"xAxisDemo2":function(val, index, opts){return formatDateTime(val,'h:m')}, |
|||
"seriesDemo1":function(val, index, series, opts){return val+'元'}, |
|||
"tooltipDemo1":function(item, category, index, opts){ |
|||
if(index==0){ |
|||
return '随便用'+item.data+'年' |
|||
}else{ |
|||
return '其他我没改'+item.data+'天' |
|||
} |
|||
}, |
|||
"pieDemo":function(val, index, series, opts){ |
|||
if(index !== undefined){ |
|||
return series[index].name+':'+series[index].data+'元' |
|||
} |
|||
}, |
|||
}, |
|||
//这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。
|
|||
"demotype":{ |
|||
//我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
|
|||
"type": "line", |
|||
"color": color, |
|||
"padding": [15,10,0,15], |
|||
"xAxis": { |
|||
"disableGrid": true, |
|||
}, |
|||
"yAxis": { |
|||
"gridType": "dash", |
|||
"dashLength": 2, |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"line": { |
|||
"type": "curve", |
|||
"width": 2 |
|||
}, |
|||
} |
|||
}, |
|||
//下面是自定义配置,请添加项目所需的通用配置
|
|||
"pie":{ |
|||
"type": "pie", |
|||
"color": color, |
|||
"padding": [5,5,5,5], |
|||
"extra": { |
|||
"pie": { |
|||
"activeOpacity": 0.5, |
|||
"activeRadius": 10, |
|||
"offsetAngle": 0, |
|||
"labelWidth": 15, |
|||
"border": true, |
|||
"borderWidth": 3, |
|||
"borderColor": "#FFFFFF" |
|||
}, |
|||
} |
|||
}, |
|||
"ring":{ |
|||
"type": "ring", |
|||
"color": color, |
|||
"padding": [5,5,5,5], |
|||
"rotate": false, |
|||
"dataLabel": true, |
|||
"legend": { |
|||
"show": true, |
|||
"position": "right", |
|||
"lineHeight": 25, |
|||
}, |
|||
"title": { |
|||
"name": "收益率", |
|||
"fontSize": 15, |
|||
"color": "#666666" |
|||
}, |
|||
"subtitle": { |
|||
"name": "70%", |
|||
"fontSize": 25, |
|||
"color": "#7cb5ec" |
|||
}, |
|||
"extra": { |
|||
"ring": { |
|||
"ringWidth":30, |
|||
"activeOpacity": 0.5, |
|||
"activeRadius": 10, |
|||
"offsetAngle": 0, |
|||
"labelWidth": 15, |
|||
"border": true, |
|||
"borderWidth": 3, |
|||
"borderColor": "#FFFFFF" |
|||
}, |
|||
}, |
|||
}, |
|||
"rose":{ |
|||
"type": "rose", |
|||
"color": color, |
|||
"padding": [5,5,5,5], |
|||
"legend": { |
|||
"show": true, |
|||
"position": "left", |
|||
"lineHeight": 25, |
|||
}, |
|||
"extra": { |
|||
"rose": { |
|||
"type": "area", |
|||
"minRadius": 50, |
|||
"activeOpacity": 0.5, |
|||
"activeRadius": 10, |
|||
"offsetAngle": 0, |
|||
"labelWidth": 15, |
|||
"border": false, |
|||
"borderWidth": 2, |
|||
"borderColor": "#FFFFFF" |
|||
}, |
|||
} |
|||
}, |
|||
"word":{ |
|||
"type": "word", |
|||
"color": color, |
|||
"extra": { |
|||
"word": { |
|||
"type": "normal", |
|||
"autoColors": false |
|||
} |
|||
} |
|||
}, |
|||
"funnel":{ |
|||
"type": "funnel", |
|||
"color": color, |
|||
"padding": [15,15,0,15], |
|||
"extra": { |
|||
"funnel": { |
|||
"activeOpacity": 0.3, |
|||
"activeWidth": 10, |
|||
"border": true, |
|||
"borderWidth": 2, |
|||
"borderColor": "#FFFFFF", |
|||
"fillOpacity": 1, |
|||
"labelAlign": "right" |
|||
}, |
|||
} |
|||
}, |
|||
"map":{ |
|||
"type": "map", |
|||
"color": color, |
|||
"padding": [0,0,0,0], |
|||
"dataLabel": true, |
|||
"extra": { |
|||
"map": { |
|||
"border": true, |
|||
"borderWidth": 1, |
|||
"borderColor": "#666666", |
|||
"fillOpacity": 0.6, |
|||
"activeBorderColor": "#F04864", |
|||
"activeFillColor": "#FACC14", |
|||
"activeFillOpacity": 1 |
|||
}, |
|||
} |
|||
}, |
|||
"arcbar":{ |
|||
"type": "arcbar", |
|||
"color": color, |
|||
"title": { |
|||
"name": "百分比", |
|||
"fontSize": 25, |
|||
"color": "#00FF00" |
|||
}, |
|||
"subtitle": { |
|||
"name": "默认标题", |
|||
"fontSize": 15, |
|||
"color": "#666666" |
|||
}, |
|||
"extra": { |
|||
"arcbar": { |
|||
"type": "default", |
|||
"width": 12, |
|||
"backgroundColor": "#E9E9E9", |
|||
"startAngle": 0.75, |
|||
"endAngle": 0.25, |
|||
"gap": 2 |
|||
} |
|||
} |
|||
}, |
|||
"line":{ |
|||
"type": "line", |
|||
"color": color, |
|||
"padding": [15,10,0,15], |
|||
"xAxis": { |
|||
"disableGrid": true, |
|||
}, |
|||
"yAxis": { |
|||
"gridType": "dash", |
|||
"dashLength": 2, |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"line": { |
|||
"type": "straight", |
|||
"width": 2, |
|||
"activeType": "hollow" |
|||
}, |
|||
} |
|||
}, |
|||
"tline":{ |
|||
"type": "line", |
|||
"color": color, |
|||
"padding": [15,10,0,15], |
|||
"xAxis": { |
|||
"disableGrid": false, |
|||
"boundaryGap":"justify", |
|||
}, |
|||
"yAxis": { |
|||
"gridType": "dash", |
|||
"dashLength": 2, |
|||
"data":[ |
|||
{ |
|||
"min":0, |
|||
"max":80 |
|||
} |
|||
] |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"line": { |
|||
"type": "curve", |
|||
"width": 2, |
|||
"activeType": "hollow" |
|||
}, |
|||
} |
|||
}, |
|||
"tarea":{ |
|||
"type": "area", |
|||
"color": color, |
|||
"padding": [15,10,0,15], |
|||
"xAxis": { |
|||
"disableGrid": true, |
|||
"boundaryGap":"justify", |
|||
}, |
|||
"yAxis": { |
|||
"gridType": "dash", |
|||
"dashLength": 2, |
|||
"data":[ |
|||
{ |
|||
"min":0, |
|||
"max":80 |
|||
} |
|||
] |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"area": { |
|||
"type": "curve", |
|||
"opacity": 0.2, |
|||
"addLine": true, |
|||
"width": 2, |
|||
"gradient": true, |
|||
"activeType": "hollow" |
|||
}, |
|||
} |
|||
}, |
|||
"column":{ |
|||
"type": "column", |
|||
"color": color, |
|||
"padding": [15,15,0,5], |
|||
"xAxis": { |
|||
"disableGrid": true, |
|||
}, |
|||
"yAxis": { |
|||
"data":[{"min":0}] |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"column": { |
|||
"type": "group", |
|||
"width": 30, |
|||
"activeBgColor": "#000000", |
|||
"activeBgOpacity": 0.08 |
|||
}, |
|||
} |
|||
}, |
|||
"mount":{ |
|||
"type": "mount", |
|||
"color": color, |
|||
"padding": [15,15,0,5], |
|||
"xAxis": { |
|||
"disableGrid": true, |
|||
}, |
|||
"yAxis": { |
|||
"data":[{"min":0}] |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"mount": { |
|||
"type": "mount", |
|||
"widthRatio": 1.5, |
|||
}, |
|||
} |
|||
}, |
|||
"bar":{ |
|||
"type": "bar", |
|||
"color": color, |
|||
"padding": [15,30,0,5], |
|||
"xAxis": { |
|||
"boundaryGap":"justify", |
|||
"disableGrid":false, |
|||
"min":0, |
|||
"axisLine":false |
|||
}, |
|||
"yAxis": { |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"bar": { |
|||
"type": "group", |
|||
"width": 30, |
|||
"meterBorde": 1, |
|||
"meterFillColor": "#FFFFFF", |
|||
"activeBgColor": "#000000", |
|||
"activeBgOpacity": 0.08 |
|||
}, |
|||
} |
|||
}, |
|||
"area":{ |
|||
"type": "area", |
|||
"color": color, |
|||
"padding": [15,15,0,15], |
|||
"xAxis": { |
|||
"disableGrid": true, |
|||
}, |
|||
"yAxis": { |
|||
"gridType": "dash", |
|||
"dashLength": 2, |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"area": { |
|||
"type": "straight", |
|||
"opacity": 0.2, |
|||
"addLine": true, |
|||
"width": 2, |
|||
"gradient": false, |
|||
"activeType": "hollow" |
|||
}, |
|||
} |
|||
}, |
|||
"radar":{ |
|||
"type": "radar", |
|||
"color": color, |
|||
"padding": [5,5,5,5], |
|||
"dataLabel": false, |
|||
"legend": { |
|||
"show": true, |
|||
"position": "right", |
|||
"lineHeight": 25, |
|||
}, |
|||
"extra": { |
|||
"radar": { |
|||
"gridType": "radar", |
|||
"gridColor": "#CCCCCC", |
|||
"gridCount": 3, |
|||
"opacity": 0.2, |
|||
"max": 200, |
|||
"labelShow": true |
|||
}, |
|||
} |
|||
}, |
|||
"gauge":{ |
|||
"type": "gauge", |
|||
"color": color, |
|||
"title": { |
|||
"name": "66Km/H", |
|||
"fontSize": 25, |
|||
"color": "#2fc25b", |
|||
"offsetY": 50 |
|||
}, |
|||
"subtitle": { |
|||
"name": "实时速度", |
|||
"fontSize": 15, |
|||
"color": "#1890ff", |
|||
"offsetY": -50 |
|||
}, |
|||
"extra": { |
|||
"gauge": { |
|||
"type": "default", |
|||
"width": 30, |
|||
"labelColor": "#666666", |
|||
"startAngle": 0.75, |
|||
"endAngle": 0.25, |
|||
"startNumber": 0, |
|||
"endNumber": 100, |
|||
"labelFormat": "", |
|||
"splitLine": { |
|||
"fixRadius": 0, |
|||
"splitNumber": 10, |
|||
"width": 30, |
|||
"color": "#FFFFFF", |
|||
"childNumber": 5, |
|||
"childWidth": 12 |
|||
}, |
|||
"pointer": { |
|||
"width": 24, |
|||
"color": "auto" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"candle":{ |
|||
"type": "candle", |
|||
"color": color, |
|||
"padding": [15,15,0,15], |
|||
"enableScroll": true, |
|||
"enableMarkLine": true, |
|||
"dataLabel": false, |
|||
"xAxis": { |
|||
"labelCount": 4, |
|||
"itemCount": 40, |
|||
"disableGrid": true, |
|||
"gridColor": "#CCCCCC", |
|||
"gridType": "solid", |
|||
"dashLength": 4, |
|||
"scrollShow": true, |
|||
"scrollAlign": "left", |
|||
"scrollColor": "#A6A6A6", |
|||
"scrollBackgroundColor": "#EFEBEF" |
|||
}, |
|||
"yAxis": { |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"candle": { |
|||
"color": { |
|||
"upLine": "#f04864", |
|||
"upFill": "#f04864", |
|||
"downLine": "#2fc25b", |
|||
"downFill": "#2fc25b" |
|||
}, |
|||
"average": { |
|||
"show": true, |
|||
"name": ["MA5","MA10","MA30"], |
|||
"day": [5,10,20], |
|||
"color": ["#1890ff","#2fc25b","#facc14"] |
|||
} |
|||
}, |
|||
"markLine": { |
|||
"type": "dash", |
|||
"dashLength": 5, |
|||
"data": [ |
|||
{ |
|||
"value": 2150, |
|||
"lineColor": "#f04864", |
|||
"showLabel": true |
|||
}, |
|||
{ |
|||
"value": 2350, |
|||
"lineColor": "#f04864", |
|||
"showLabel": true |
|||
} |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
"mix":{ |
|||
"type": "mix", |
|||
"color": color, |
|||
"padding": [15,15,0,15], |
|||
"xAxis": { |
|||
"disableGrid": true, |
|||
}, |
|||
"yAxis": { |
|||
"disabled": false, |
|||
"disableGrid": false, |
|||
"splitNumber": 5, |
|||
"gridType": "dash", |
|||
"dashLength": 4, |
|||
"gridColor": "#CCCCCC", |
|||
"padding": 10, |
|||
"showTitle": true, |
|||
"data": [] |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"mix": { |
|||
"column": { |
|||
"width": 20 |
|||
} |
|||
}, |
|||
} |
|||
}, |
|||
"scatter":{ |
|||
"type": "scatter", |
|||
"color":color, |
|||
"padding":[15,15,0,15], |
|||
"dataLabel":false, |
|||
"xAxis": { |
|||
"disableGrid": false, |
|||
"gridType":"dash", |
|||
"splitNumber":5, |
|||
"boundaryGap":"justify", |
|||
"min":0 |
|||
}, |
|||
"yAxis": { |
|||
"disableGrid": false, |
|||
"gridType":"dash", |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"scatter": { |
|||
}, |
|||
} |
|||
}, |
|||
"bubble":{ |
|||
"type": "bubble", |
|||
"color":color, |
|||
"padding":[15,15,0,15], |
|||
"xAxis": { |
|||
"disableGrid": false, |
|||
"gridType":"dash", |
|||
"splitNumber":5, |
|||
"boundaryGap":"justify", |
|||
"min":0, |
|||
"max":250 |
|||
}, |
|||
"yAxis": { |
|||
"disableGrid": false, |
|||
"gridType":"dash", |
|||
"data":[{ |
|||
"min":0, |
|||
"max":150 |
|||
}] |
|||
}, |
|||
"legend": { |
|||
}, |
|||
"extra": { |
|||
"bubble": { |
|||
"border":2, |
|||
"opacity": 0.5, |
|||
}, |
|||
} |
|||
} |
|||
} |
|||
|
|||
export default cfu; |
@ -0,0 +1,5 @@ |
|||
# uCharts JSSDK说明 |
|||
1、如不使用uCharts组件,可直接引用u-charts.js,打包编译后会`自动压缩`,压缩后体积约为`120kb`。 |
|||
2、如果120kb的体积仍需压缩,请手到uCharts官网通过在线定制选择您需要的图表。 |
|||
3、config-ucharts.js为uCharts组件的用户配置文件,升级前请`自行备份config-ucharts.js`文件,以免被强制覆盖。 |
|||
4、config-echarts.js为ECharts组件的用户配置文件,升级前请`自行备份config-echarts.js`文件,以免被强制覆盖。 |
@ -0,0 +1,201 @@ |
|||
Apache License |
|||
Version 2.0, January 2004 |
|||
http://www.apache.org/licenses/ |
|||
|
|||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
|||
|
|||
1. Definitions. |
|||
|
|||
"License" shall mean the terms and conditions for use, reproduction, |
|||
and distribution as defined by Sections 1 through 9 of this document. |
|||
|
|||
"Licensor" shall mean the copyright owner or entity authorized by |
|||
the copyright owner that is granting the License. |
|||
|
|||
"Legal Entity" shall mean the union of the acting entity and all |
|||
other entities that control, are controlled by, or are under common |
|||
control with that entity. For the purposes of this definition, |
|||
"control" means (i) the power, direct or indirect, to cause the |
|||
direction or management of such entity, whether by contract or |
|||
otherwise, or (ii) ownership of fifty percent (50%) or more of the |
|||
outstanding shares, or (iii) beneficial ownership of such entity. |
|||
|
|||
"You" (or "Your") shall mean an individual or Legal Entity |
|||
exercising permissions granted by this License. |
|||
|
|||
"Source" form shall mean the preferred form for making modifications, |
|||
including but not limited to software source code, documentation |
|||
source, and configuration files. |
|||
|
|||
"Object" form shall mean any form resulting from mechanical |
|||
transformation or translation of a Source form, including but |
|||
not limited to compiled object code, generated documentation, |
|||
and conversions to other media types. |
|||
|
|||
"Work" shall mean the work of authorship, whether in Source or |
|||
Object form, made available under the License, as indicated by a |
|||
copyright notice that is included in or attached to the work |
|||
(an example is provided in the Appendix below). |
|||
|
|||
"Derivative Works" shall mean any work, whether in Source or Object |
|||
form, that is based on (or derived from) the Work and for which the |
|||
editorial revisions, annotations, elaborations, or other modifications |
|||
represent, as a whole, an original work of authorship. For the purposes |
|||
of this License, Derivative Works shall not include works that remain |
|||
separable from, or merely link (or bind by name) to the interfaces of, |
|||
the Work and Derivative Works thereof. |
|||
|
|||
"Contribution" shall mean any work of authorship, including |
|||
the original version of the Work and any modifications or additions |
|||
to that Work or Derivative Works thereof, that is intentionally |
|||
submitted to Licensor for inclusion in the Work by the copyright owner |
|||
or by an individual or Legal Entity authorized to submit on behalf of |
|||
the copyright owner. For the purposes of this definition, "submitted" |
|||
means any form of electronic, verbal, or written communication sent |
|||
to the Licensor or its representatives, including but not limited to |
|||
communication on electronic mailing lists, source code control systems, |
|||
and issue tracking systems that are managed by, or on behalf of, the |
|||
Licensor for the purpose of discussing and improving the Work, but |
|||
excluding communication that is conspicuously marked or otherwise |
|||
designated in writing by the copyright owner as "Not a Contribution." |
|||
|
|||
"Contributor" shall mean Licensor and any individual or Legal Entity |
|||
on behalf of whom a Contribution has been received by Licensor and |
|||
subsequently incorporated within the Work. |
|||
|
|||
2. Grant of Copyright License. Subject to the terms and conditions of |
|||
this License, each Contributor hereby grants to You a perpetual, |
|||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
|||
copyright license to reproduce, prepare Derivative Works of, |
|||
publicly display, publicly perform, sublicense, and distribute the |
|||
Work and such Derivative Works in Source or Object form. |
|||
|
|||
3. Grant of Patent License. Subject to the terms and conditions of |
|||
this License, each Contributor hereby grants to You a perpetual, |
|||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
|||
(except as stated in this section) patent license to make, have made, |
|||
use, offer to sell, sell, import, and otherwise transfer the Work, |
|||
where such license applies only to those patent claims licensable |
|||
by such Contributor that are necessarily infringed by their |
|||
Contribution(s) alone or by combination of their Contribution(s) |
|||
with the Work to which such Contribution(s) was submitted. If You |
|||
institute patent litigation against any entity (including a |
|||
cross-claim or counterclaim in a lawsuit) alleging that the Work |
|||
or a Contribution incorporated within the Work constitutes direct |
|||
or contributory patent infringement, then any patent licenses |
|||
granted to You under this License for that Work shall terminate |
|||
as of the date such litigation is filed. |
|||
|
|||
4. Redistribution. You may reproduce and distribute copies of the |
|||
Work or Derivative Works thereof in any medium, with or without |
|||
modifications, and in Source or Object form, provided that You |
|||
meet the following conditions: |
|||
|
|||
(a) You must give any other recipients of the Work or |
|||
Derivative Works a copy of this License; and |
|||
|
|||
(b) You must cause any modified files to carry prominent notices |
|||
stating that You changed the files; and |
|||
|
|||
(c) You must retain, in the Source form of any Derivative Works |
|||
that You distribute, all copyright, patent, trademark, and |
|||
attribution notices from the Source form of the Work, |
|||
excluding those notices that do not pertain to any part of |
|||
the Derivative Works; and |
|||
|
|||
(d) If the Work includes a "NOTICE" text file as part of its |
|||
distribution, then any Derivative Works that You distribute must |
|||
include a readable copy of the attribution notices contained |
|||
within such NOTICE file, excluding those notices that do not |
|||
pertain to any part of the Derivative Works, in at least one |
|||
of the following places: within a NOTICE text file distributed |
|||
as part of the Derivative Works; within the Source form or |
|||
documentation, if provided along with the Derivative Works; or, |
|||
within a display generated by the Derivative Works, if and |
|||
wherever such third-party notices normally appear. The contents |
|||
of the NOTICE file are for informational purposes only and |
|||
do not modify the License. You may add Your own attribution |
|||
notices within Derivative Works that You distribute, alongside |
|||
or as an addendum to the NOTICE text from the Work, provided |
|||
that such additional attribution notices cannot be construed |
|||
as modifying the License. |
|||
|
|||
You may add Your own copyright statement to Your modifications and |
|||
may provide additional or different license terms and conditions |
|||
for use, reproduction, or distribution of Your modifications, or |
|||
for any such Derivative Works as a whole, provided Your use, |
|||
reproduction, and distribution of the Work otherwise complies with |
|||
the conditions stated in this License. |
|||
|
|||
5. Submission of Contributions. Unless You explicitly state otherwise, |
|||
any Contribution intentionally submitted for inclusion in the Work |
|||
by You to the Licensor shall be under the terms and conditions of |
|||
this License, without any additional terms or conditions. |
|||
Notwithstanding the above, nothing herein shall supersede or modify |
|||
the terms of any separate license agreement you may have executed |
|||
with Licensor regarding such Contributions. |
|||
|
|||
6. Trademarks. This License does not grant permission to use the trade |
|||
names, trademarks, service marks, or product names of the Licensor, |
|||
except as required for reasonable and customary use in describing the |
|||
origin of the Work and reproducing the content of the NOTICE file. |
|||
|
|||
7. Disclaimer of Warranty. Unless required by applicable law or |
|||
agreed to in writing, Licensor provides the Work (and each |
|||
Contributor provides its Contributions) on an "AS IS" BASIS, |
|||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
|||
implied, including, without limitation, any warranties or conditions |
|||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
|||
PARTICULAR PURPOSE. You are solely responsible for determining the |
|||
appropriateness of using or redistributing the Work and assume any |
|||
risks associated with Your exercise of permissions under this License. |
|||
|
|||
8. Limitation of Liability. In no event and under no legal theory, |
|||
whether in tort (including negligence), contract, or otherwise, |
|||
unless required by applicable law (such as deliberate and grossly |
|||
negligent acts) or agreed to in writing, shall any Contributor be |
|||
liable to You for damages, including any direct, indirect, special, |
|||
incidental, or consequential damages of any character arising as a |
|||
result of this License or out of the use or inability to use the |
|||
Work (including but not limited to damages for loss of goodwill, |
|||
work stoppage, computer failure or malfunction, or any and all |
|||
other commercial damages or losses), even if such Contributor |
|||
has been advised of the possibility of such damages. |
|||
|
|||
9. Accepting Warranty or Additional Liability. While redistributing |
|||
the Work or Derivative Works thereof, You may choose to offer, |
|||
and charge a fee for, acceptance of support, warranty, indemnity, |
|||
or other liability obligations and/or rights consistent with this |
|||
License. However, in accepting such obligations, You may act only |
|||
on Your own behalf and on Your sole responsibility, not on behalf |
|||
of any other Contributor, and only if You agree to indemnify, |
|||
defend, and hold each Contributor harmless for any liability |
|||
incurred by, or claims asserted against, such Contributor by reason |
|||
of your accepting any such warranty or additional liability. |
|||
|
|||
END OF TERMS AND CONDITIONS |
|||
|
|||
APPENDIX: How to apply the Apache License to your work. |
|||
|
|||
To apply the Apache License to your work, attach the following |
|||
boilerplate notice, with the fields enclosed by brackets "[]" |
|||
replaced with your own identifying information. (Don't include |
|||
the brackets!) The text should be enclosed in the appropriate |
|||
comment syntax for the file format. We also recommend that a |
|||
file or class name and description of purpose be included on the |
|||
same "printed page" as the copyright notice for easier |
|||
identification within third-party archives. |
|||
|
|||
Copyright [yyyy] [name of copyright owner] |
|||
|
|||
Licensed under the Apache License, Version 2.0 (the "License"); |
|||
you may not use this file except in compliance with the License. |
|||
You may obtain a copy of the License at |
|||
|
|||
http://www.apache.org/licenses/LICENSE-2.0 |
|||
|
|||
Unless required by applicable law or agreed to in writing, software |
|||
distributed under the License is distributed on an "AS IS" BASIS, |
|||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
See the License for the specific language governing permissions and |
|||
limitations under the License. |
@ -0,0 +1,81 @@ |
|||
{ |
|||
"id": "qiun-data-charts", |
|||
"displayName": "秋云 ucharts echarts 高性能跨全端图表组件", |
|||
"version": "2.5.0-20230101", |
|||
"description": "uCharts 新增正负柱状图!支持H5及APP用 ucharts echarts 渲染图表,uniapp可视化首选组件", |
|||
"keywords": [ |
|||
"ucharts", |
|||
"echarts", |
|||
"f2", |
|||
"图表", |
|||
"可视化" |
|||
], |
|||
"repository": "https://gitee.com/uCharts/uCharts", |
|||
"engines": { |
|||
"HBuilderX": "^3.3.8" |
|||
}, |
|||
"dcloudext": { |
|||
"sale": { |
|||
"regular": { |
|||
"price": "0.00" |
|||
}, |
|||
"sourcecode": { |
|||
"price": "0.00" |
|||
} |
|||
}, |
|||
"contact": { |
|||
"qq": "474119" |
|||
}, |
|||
"declaration": { |
|||
"ads": "无", |
|||
"data": "插件不采集任何数据", |
|||
"permissions": "无" |
|||
}, |
|||
"npmurl": "https://www.npmjs.com/~qiun", |
|||
"type": "component-vue" |
|||
}, |
|||
"uni_modules": { |
|||
"dependencies": [], |
|||
"encrypt": [], |
|||
"platforms": { |
|||
"cloud": { |
|||
"tcb": "y", |
|||
"aliyun": "y" |
|||
}, |
|||
"client": { |
|||
"App": { |
|||
"app-vue": "y", |
|||
"app-nvue": "y" |
|||
}, |
|||
"H5-mobile": { |
|||
"Safari": "y", |
|||
"Android Browser": "y", |
|||
"微信浏览器(Android)": "y", |
|||
"QQ浏览器(Android)": "y" |
|||
}, |
|||
"H5-pc": { |
|||
"Chrome": "y", |
|||
"IE": "y", |
|||
"Edge": "y", |
|||
"Firefox": "y", |
|||
"Safari": "y" |
|||
}, |
|||
"小程序": { |
|||
"微信": "y", |
|||
"阿里": "y", |
|||
"百度": "y", |
|||
"字节跳动": "y", |
|||
"QQ": "y" |
|||
}, |
|||
"快应用": { |
|||
"华为": "y", |
|||
"联盟": "y" |
|||
}, |
|||
"Vue": { |
|||
"vue2": "y", |
|||
"vue3": "y" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,84 @@ |
|||
 |
|||
|
|||
|
|||
[](https://gitee.com/uCharts/uCharts/stargazers) |
|||
[](https://gitee.com/uCharts/uCharts/members) |
|||
[](https://www.apache.org/licenses/LICENSE-2.0.html) |
|||
[](https://www.npmjs.com/~qiun) |
|||
|
|||
|
|||
## uCharts简介 |
|||
|
|||
`uCharts`是一款基于`canvas API`开发的适用于所有前端应用的图表库,开发者编写一套代码,可运行到 Web、iOS、Android(基于 uni-app / taro )、以及各种小程序(微信/支付宝/百度/头条/飞书/QQ/快手/钉钉/淘宝)、快应用等更多支持 canvas API 的平台。 |
|||
|
|||
## 官方网站 |
|||
|
|||
## [https://www.ucharts.cn](https://www.ucharts.cn) |
|||
|
|||
## 快速体验 |
|||
|
|||
一套代码编到多个平台,依次扫描二维码,亲自体验uCharts图表跨平台效果!其他平台请自行编译。 |
|||
|
|||
 |
|||
|
|||
 |
|||
|
|||
## 致开发者 |
|||
|
|||
感谢各位开发者`五年`来对秋云及uCharts的支持,uCharts的进步离不开各位开发者的鼓励与贡献。为更好的帮助各位开发者使用图表工具,我们推出了新版官网,增加了在线定制、问答社区、在线配置等一些增值服务,为确保您能更好的应用图表组件,建议您先`仔细阅读官网指南`以及`常见问题`,而不是下载下来`直接使用`。如仍然不能解决,请到`官网社区`或开通会员后加入`专属VIP会员群`提问将会很快得到回答。 |
|||
|
|||
## 视频教程 |
|||
|
|||
## [uCharts新手入门教程](https://www.bilibili.com/video/BV1qA411Q7se/?share_source=copy_web&vd_source=42a1242f9aaade6427736af69eb2e1d9) |
|||
|
|||
|
|||
## 社群支持 |
|||
|
|||
uCharts官方拥有5个2000人的QQ群及专属VIP会员群支持,庞大的用户量证明我们一直在努力,请各位放心使用!uCharts的开源图表组件的开发,团队付出了大量的时间与精力,经过四来的考验,不会有比较明显的bug,请各位放心使用。如果您有更好的想法,可以在`码云提交Pull Requests`以帮助更多开发者完成需求,再次感谢各位对uCharts的鼓励与支持! |
|||
|
|||
#### 官方交流群 |
|||
- 交流群1:371774600(已满) |
|||
- 交流群2:619841586(已满) |
|||
- 交流群3:955340127(已满) |
|||
- 交流群4:641669795(已满) |
|||
- 交流群5:236294809(只能扫码加入) |
|||
|
|||
 |
|||
|
|||
- 口令`uniapp` |
|||
|
|||
#### 专属VIP会员群 |
|||
- 开通会员后详见【账号详情】页面中顶部的滚动通知 |
|||
- 口令`您的用户ID` |
|||
|
|||
## 版权信息 |
|||
|
|||
uCharts始终坚持开源,遵循 [Apache Licence 2.0](https://www.apache.org/licenses/LICENSE-2.0.html) 开源协议,意味着您无需支付任何费用,即可将uCharts应用到您的产品中。 |
|||
|
|||
注意:这并不意味着您可以将uCharts应用到非法的领域,比如涉及赌博,暴力等方面。如因此产生纠纷或法律问题,uCharts相关方及秋云科技不承担任何责任。 |
|||
|
|||
## 合作伙伴 |
|||
|
|||
[](https://www.diygw.com/) |
|||
[](https://gitee.com/howcode/has-chat) |
|||
[](https://www.uviewui.com/) |
|||
[](https://ext.dcloud.net.cn/plugin?id=7088) |
|||
[](https://ext.dcloud.net.cn/publisher?id=202) |
|||
[](https://www.firstui.cn/) |
|||
[](https://ext.dcloud.net.cn/plugin?id=5169) |
|||
[](https://www.graceui.com/) |
|||
|
|||
|
|||
## 更新记录 |
|||
|
|||
详见官网指南中说明,[点击此处查看](https://www.ucharts.cn/v2/#/guide/index?id=100) |
|||
|
|||
|
|||
## 相关链接 |
|||
- [uCharts官网](https://www.ucharts.cn) |
|||
- [DCloud插件市场地址](https://ext.dcloud.net.cn/plugin?id=271) |
|||
- [uCharts码云开源托管地址](https://gitee.com/uCharts/uCharts) [](https://gitee.com/uCharts/uCharts/stargazers) |
|||
- [uCharts npm开源地址](https://www.ucharts.cn) |
|||
- [ECharts官网](https://echarts.apache.org/zh/index.html) |
|||
- [ECharts配置手册](https://echarts.apache.org/zh/option.html) |
|||
- [图表组件在项目中的应用 ReportPlus数据报表](https://www.ucharts.cn/v2/#/layout/info?id=1) |
@ -0,0 +1,31 @@ |
|||
## 1.2.1(2022-09-05) |
|||
- 修复 当 text 超过 max-num 时,badge 的宽度计算是根据 text 的长度计算,更改为 css 计算实际展示宽度,详见:[https://ask.dcloud.net.cn/question/150473](https://ask.dcloud.net.cn/question/150473) |
|||
## 1.2.0(2021-11-19) |
|||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) |
|||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-badge](https://uniapp.dcloud.io/component/uniui/uni-badge) |
|||
## 1.1.7(2021-11-08) |
|||
- 优化 升级ui |
|||
- 修改 size 属性默认值调整为 small |
|||
- 修改 type 属性,默认值调整为 error,info 替换 default |
|||
## 1.1.6(2021-09-22) |
|||
- 修复 在字节小程序上样式不生效的 bug |
|||
## 1.1.5(2021-07-30) |
|||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) |
|||
## 1.1.4(2021-07-29) |
|||
- 修复 去掉 nvue 不支持css 的 align-self 属性,nvue 下不暂支持 absolute 属性 |
|||
## 1.1.3(2021-06-24) |
|||
- 优化 示例项目 |
|||
## 1.1.1(2021-05-12) |
|||
- 新增 组件示例地址 |
|||
## 1.1.0(2021-05-12) |
|||
- 新增 uni-badge 的 absolute 属性,支持定位 |
|||
- 新增 uni-badge 的 offset 属性,支持定位偏移 |
|||
- 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点 |
|||
- 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+ |
|||
- 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式 |
|||
## 1.0.7(2021-05-07) |
|||
- 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug |
|||
- 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug |
|||
- 新增 uni-badge 属性 custom-style, 支持自定义样式 |
|||
## 1.0.6(2021-02-04) |
|||
- 调整为uni_modules目录规范 |
@ -0,0 +1,268 @@ |
|||
<template> |
|||
<view class="uni-badge--x"> |
|||
<slot /> |
|||
<text v-if="text" :class="classNames" :style="[positionStyle, customStyle, dotStyle]" |
|||
class="uni-badge" @click="onClick()">{{displayValue}}</text> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
/** |
|||
* Badge 数字角标 |
|||
* @description 数字角标一般和其它控件(列表、9宫格等)配合使用,用于进行数量提示,默认为实心灰色背景 |
|||
* @tutorial https://ext.dcloud.net.cn/plugin?id=21 |
|||
* @property {String} text 角标内容 |
|||
* @property {String} size = [normal|small] 角标内容 |
|||
* @property {String} type = [info|primary|success|warning|error] 颜色类型 |
|||
* @value info 灰色 |
|||
* @value primary 蓝色 |
|||
* @value success 绿色 |
|||
* @value warning 黄色 |
|||
* @value error 红色 |
|||
* @property {String} inverted = [true|false] 是否无需背景颜色 |
|||
* @property {Number} maxNum 展示封顶的数字值,超过 99 显示 99+ |
|||
* @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上 |
|||
* @value rightTop 右上 |
|||
* @value rightBottom 右下 |
|||
* @value leftTop 左上 |
|||
* @value leftBottom 左下 |
|||
* @property {Array[number]} offset 距定位角中心点的偏移量,只有存在 absolute 属性时有效,例如:[-10, -10] 表示向外偏移 10px,[10, 10] 表示向 absolute 指定的内偏移 10px |
|||
* @property {String} isDot = [true|false] 是否显示为一个小点 |
|||
* @event {Function} click 点击 Badge 触发事件 |
|||
* @example <uni-badge text="1"></uni-badge> |
|||
*/ |
|||
|
|||
export default { |
|||
name: 'UniBadge', |
|||
emits: ['click'], |
|||
props: { |
|||
type: { |
|||
type: String, |
|||
default: 'error' |
|||
}, |
|||
inverted: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
isDot: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
maxNum: { |
|||
type: Number, |
|||
default: 99 |
|||
}, |
|||
absolute: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
offset: { |
|||
type: Array, |
|||
default () { |
|||
return [0, 0] |
|||
} |
|||
}, |
|||
text: { |
|||
type: [String, Number], |
|||
default: '' |
|||
}, |
|||
size: { |
|||
type: String, |
|||
default: 'small' |
|||
}, |
|||
customStyle: { |
|||
type: Object, |
|||
default () { |
|||
return {} |
|||
} |
|||
} |
|||
}, |
|||
data() { |
|||
return {}; |
|||
}, |
|||
computed: { |
|||
width() { |
|||
return String(this.text).length * 8 + 12 |
|||
}, |
|||
classNames() { |
|||
const { |
|||
inverted, |
|||
type, |
|||
size, |
|||
absolute |
|||
} = this |
|||
return [ |
|||
inverted ? 'uni-badge--' + type + '-inverted' : '', |
|||
'uni-badge--' + type, |
|||
'uni-badge--' + size, |
|||
absolute ? 'uni-badge--absolute' : '' |
|||
].join(' ') |
|||
}, |
|||
positionStyle() { |
|||
if (!this.absolute) return {} |
|||
let w = this.width / 2, |
|||
h = 10 |
|||
if (this.isDot) { |
|||
w = 5 |
|||
h = 5 |
|||
} |
|||
const x = `${- w + this.offset[0]}px` |
|||
const y = `${- h + this.offset[1]}px` |
|||
|
|||
const whiteList = { |
|||
rightTop: { |
|||
right: x, |
|||
top: y |
|||
}, |
|||
rightBottom: { |
|||
right: x, |
|||
bottom: y |
|||
}, |
|||
leftBottom: { |
|||
left: x, |
|||
bottom: y |
|||
}, |
|||
leftTop: { |
|||
left: x, |
|||
top: y |
|||
} |
|||
} |
|||
const match = whiteList[this.absolute] |
|||
return match ? match : whiteList['rightTop'] |
|||
}, |
|||
dotStyle() { |
|||
if (!this.isDot) return {} |
|||
return { |
|||
width: '10px', |
|||
minWidth: '0', |
|||
height: '10px', |
|||
padding: '0', |
|||
borderRadius: '10px' |
|||
} |
|||
}, |
|||
displayValue() { |
|||
const { |
|||
isDot, |
|||
text, |
|||
maxNum |
|||
} = this |
|||
return isDot ? '' : (Number(text) > maxNum ? `${maxNum}+` : text) |
|||
} |
|||
}, |
|||
methods: { |
|||
onClick() { |
|||
this.$emit('click'); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" > |
|||
$uni-primary: #2979ff !default; |
|||
$uni-success: #4cd964 !default; |
|||
$uni-warning: #f0ad4e !default; |
|||
$uni-error: #dd524d !default; |
|||
$uni-info: #909399 !default; |
|||
|
|||
|
|||
$bage-size: 12px; |
|||
$bage-small: scale(0.8); |
|||
|
|||
.uni-badge--x { |
|||
/* #ifdef APP-NVUE */ |
|||
// align-self: flex-start; |
|||
/* #endif */ |
|||
/* #ifndef APP-NVUE */ |
|||
display: inline-block; |
|||
/* #endif */ |
|||
position: relative; |
|||
} |
|||
|
|||
.uni-badge--absolute { |
|||
position: absolute; |
|||
} |
|||
|
|||
.uni-badge--small { |
|||
transform: $bage-small; |
|||
transform-origin: center center; |
|||
} |
|||
|
|||
.uni-badge { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
overflow: hidden; |
|||
box-sizing: border-box; |
|||
/* #endif */ |
|||
justify-content: center; |
|||
flex-direction: row; |
|||
height: 20px; |
|||
min-width: 20px; |
|||
padding: 0 4px; |
|||
line-height: 18px; |
|||
color: #fff; |
|||
border-radius: 100px; |
|||
background-color: $uni-info; |
|||
background-color: transparent; |
|||
border: 1px solid #fff; |
|||
text-align: center; |
|||
font-family: 'Helvetica Neue', Helvetica, sans-serif; |
|||
font-feature-settings: "tnum"; |
|||
font-size: $bage-size; |
|||
/* #ifdef H5 */ |
|||
z-index: 999; |
|||
cursor: pointer; |
|||
/* #endif */ |
|||
|
|||
&--info { |
|||
color: #fff; |
|||
background-color: $uni-info; |
|||
} |
|||
|
|||
&--primary { |
|||
background-color: $uni-primary; |
|||
} |
|||
|
|||
&--success { |
|||
background-color: $uni-success; |
|||
} |
|||
|
|||
&--warning { |
|||
background-color: $uni-warning; |
|||
} |
|||
|
|||
&--error { |
|||
background-color: $uni-error; |
|||
} |
|||
|
|||
&--inverted { |
|||
padding: 0 5px 0 0; |
|||
color: $uni-info; |
|||
} |
|||
|
|||
&--info-inverted { |
|||
color: $uni-info; |
|||
background-color: transparent; |
|||
} |
|||
|
|||
&--primary-inverted { |
|||
color: $uni-primary; |
|||
background-color: transparent; |
|||
} |
|||
|
|||
&--success-inverted { |
|||
color: $uni-success; |
|||
background-color: transparent; |
|||
} |
|||
|
|||
&--warning-inverted { |
|||
color: $uni-warning; |
|||
background-color: transparent; |
|||
} |
|||
|
|||
&--error-inverted { |
|||
color: $uni-error; |
|||
background-color: transparent; |
|||
} |
|||
|
|||
} |
|||
</style> |
@ -0,0 +1,85 @@ |
|||
{ |
|||
"id": "uni-badge", |
|||
"displayName": "uni-badge 数字角标", |
|||
"version": "1.2.1", |
|||
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。", |
|||
"keywords": [ |
|||
"", |
|||
"badge", |
|||
"uni-ui", |
|||
"uniui", |
|||
"数字角标", |
|||
"徽章" |
|||
], |
|||
"repository": "https://github.com/dcloudio/uni-ui", |
|||
"engines": { |
|||
"HBuilderX": "" |
|||
}, |
|||
"directories": { |
|||
"example": "../../temps/example_temps" |
|||
}, |
|||
"dcloudext": { |
|||
"sale": { |
|||
"regular": { |
|||
"price": "0.00" |
|||
}, |
|||
"sourcecode": { |
|||
"price": "0.00" |
|||
} |
|||
}, |
|||
"contact": { |
|||
"qq": "" |
|||
}, |
|||
"declaration": { |
|||
"ads": "无", |
|||
"data": "无", |
|||
"permissions": "无" |
|||
}, |
|||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", |
|||
"type": "component-vue" |
|||
}, |
|||
"uni_modules": { |
|||
"dependencies": ["uni-scss"], |
|||
"encrypt": [], |
|||
"platforms": { |
|||
"cloud": { |
|||
"tcb": "y", |
|||
"aliyun": "y" |
|||
}, |
|||
"client": { |
|||
"App": { |
|||
"app-vue": "y", |
|||
"app-nvue": "y" |
|||
}, |
|||
"H5-mobile": { |
|||
"Safari": "y", |
|||
"Android Browser": "y", |
|||
"微信浏览器(Android)": "y", |
|||
"QQ浏览器(Android)": "y" |
|||
}, |
|||
"H5-pc": { |
|||
"Chrome": "y", |
|||
"IE": "y", |
|||
"Edge": "y", |
|||
"Firefox": "y", |
|||
"Safari": "y" |
|||
}, |
|||
"小程序": { |
|||
"微信": "y", |
|||
"阿里": "y", |
|||
"百度": "y", |
|||
"字节跳动": "y", |
|||
"QQ": "y" |
|||
}, |
|||
"快应用": { |
|||
"华为": "y", |
|||
"联盟": "y" |
|||
}, |
|||
"Vue": { |
|||
"vue2": "y", |
|||
"vue3": "y" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
## Badge 数字角标 |
|||
> **组件名:uni-badge** |
|||
> 代码块: `uBadge` |
|||
|
|||
数字角标一般和其它控件(列表、9宫格等)配合使用,用于进行数量提示,默认为实心灰色背景, |
|||
|
|||
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-badge) |
|||
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 |
|||
|
|||
|
@ -0,0 +1,6 @@ |
|||
## 0.1.2(2022-06-08) |
|||
- 修复 微信小程序 separator 不显示问题 |
|||
## 0.1.1(2022-06-02) |
|||
- 新增 支持 uni.scss 修改颜色 |
|||
## 0.1.0(2022-04-21) |
|||
- 初始化 |
@ -0,0 +1,121 @@ |
|||
<template> |
|||
<view class="uni-breadcrumb-item"> |
|||
<view :class="{ |
|||
'uni-breadcrumb-item--slot': true, |
|||
'uni-breadcrumb-item--slot-link': to && currentPage !== to |
|||
}" @click="navTo"> |
|||
<slot /> |
|||
</view> |
|||
<i v-if="separatorClass" class="uni-breadcrumb-item--separator" :class="separatorClass" /> |
|||
<text v-else class="uni-breadcrumb-item--separator">{{ separator }}</text> |
|||
</view> |
|||
</template> |
|||
<script> |
|||
/** |
|||
* BreadcrumbItem 面包屑导航子组件 |
|||
* @property {String/Object} to 路由跳转页面路径/对象 |
|||
* @property {Boolean} replace 在使用 to 进行路由跳转时,启用 replace 将不会向 history 添加新记录(仅 h5 支持) |
|||
*/ |
|||
export default { |
|||
data() { |
|||
return { |
|||
currentPage: "" |
|||
} |
|||
}, |
|||
options: { |
|||
virtualHost: true |
|||
}, |
|||
props: { |
|||
to: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
replace:{ |
|||
type: Boolean, |
|||
default: false |
|||
} |
|||
}, |
|||
inject: { |
|||
uniBreadcrumb: { |
|||
from: "uniBreadcrumb", |
|||
default: null |
|||
} |
|||
}, |
|||
created(){ |
|||
const pages = getCurrentPages() |
|||
const page = pages[pages.length-1] |
|||
|
|||
if(page){ |
|||
this.currentPage = `/${page.route}` |
|||
} |
|||
}, |
|||
computed: { |
|||
separator() { |
|||
return this.uniBreadcrumb.separator |
|||
}, |
|||
separatorClass() { |
|||
return this.uniBreadcrumb.separatorClass |
|||
} |
|||
}, |
|||
methods: { |
|||
navTo() { |
|||
const { to } = this |
|||
|
|||
if (!to || this.currentPage === to){ |
|||
return |
|||
} |
|||
|
|||
if(this.replace){ |
|||
uni.redirectTo({ |
|||
url:to |
|||
}) |
|||
}else{ |
|||
uni.navigateTo({ |
|||
url:to |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss"> |
|||
$uni-primary: #2979ff !default; |
|||
$uni-base-color: #6a6a6a !default; |
|||
$uni-main-color: #3a3a3a !default; |
|||
.uni-breadcrumb-item { |
|||
display: flex; |
|||
align-items: center; |
|||
white-space: nowrap; |
|||
font-size: 14px; |
|||
|
|||
&--slot { |
|||
color: $uni-base-color; |
|||
padding: 0 10px; |
|||
|
|||
&-link { |
|||
color: $uni-main-color; |
|||
font-weight: bold; |
|||
/* #ifndef APP-NVUE */ |
|||
cursor: pointer; |
|||
/* #endif */ |
|||
|
|||
&:hover { |
|||
color: $uni-primary; |
|||
} |
|||
} |
|||
} |
|||
|
|||
&--separator { |
|||
font-size: 12px; |
|||
color: $uni-base-color; |
|||
} |
|||
|
|||
&:first-child &--slot { |
|||
padding-left: 0; |
|||
} |
|||
|
|||
&:last-child &--separator { |
|||
display: none; |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,41 @@ |
|||
<template> |
|||
<view class="uni-breadcrumb"> |
|||
<slot /> |
|||
</view> |
|||
</template> |
|||
<script> |
|||
/** |
|||
* Breadcrumb 面包屑导航父组件 |
|||
* @description 显示当前页面的路径,快速返回之前的任意页面 |
|||
* @tutorial https://ext.dcloud.net.cn/plugin?id=xxx |
|||
* @property {String} separator 分隔符,默认为斜杠'/' |
|||
* @property {String} separatorClass 图标分隔符 class |
|||
*/ |
|||
export default { |
|||
options: { |
|||
virtualHost: true |
|||
}, |
|||
props: { |
|||
separator: { |
|||
type: String, |
|||
default: '/' |
|||
}, |
|||
separatorClass: { |
|||
type: String, |
|||
default: '' |
|||
} |
|||
}, |
|||
|
|||
provide() { |
|||
return { |
|||
uniBreadcrumb: this |
|||
} |
|||
} |
|||
|
|||
} |
|||
</script> |
|||
<style lang="scss"> |
|||
.uni-breadcrumb { |
|||
display: flex; |
|||
} |
|||
</style> |
@ -0,0 +1,88 @@ |
|||
{ |
|||
"id": "uni-breadcrumb", |
|||
"displayName": "uni-breadcrumb 面包屑", |
|||
"version": "0.1.2", |
|||
"description": "Breadcrumb 面包屑", |
|||
"keywords": [ |
|||
"uni-breadcrumb", |
|||
"breadcrumb", |
|||
"uni-ui", |
|||
"面包屑导航", |
|||
"面包屑" |
|||
], |
|||
"repository": "", |
|||
"engines": { |
|||
"HBuilderX": "^3.1.0" |
|||
}, |
|||
"directories": { |
|||
"example": "../../temps/example_temps" |
|||
}, |
|||
"dcloudext": { |
|||
"category": [ |
|||
"前端组件", |
|||
"通用组件" |
|||
], |
|||
"sale": { |
|||
"regular": { |
|||
"price": "0.00" |
|||
}, |
|||
"sourcecode": { |
|||
"price": "0.00" |
|||
} |
|||
}, |
|||
"contact": { |
|||
"qq": "" |
|||
}, |
|||
"declaration": { |
|||
"ads": "无", |
|||
"data": "无", |
|||
"permissions": "无" |
|||
}, |
|||
"npmurl": "" |
|||
}, |
|||
"uni_modules": { |
|||
"dependencies": [], |
|||
"encrypt": [], |
|||
"platforms": { |
|||
"cloud": { |
|||
"tcb": "y", |
|||
"aliyun": "y" |
|||
}, |
|||
"client": { |
|||
"Vue": { |
|||
"vue2": "y", |
|||
"vue3": "y" |
|||
}, |
|||
"App": { |
|||
"app-vue": "y", |
|||
"app-nvue": "n" |
|||
}, |
|||
"H5-mobile": { |
|||
"Safari": "y", |
|||
"Android Browser": "y", |
|||
"微信浏览器(Android)": "y", |
|||
"QQ浏览器(Android)": "y" |
|||
}, |
|||
"H5-pc": { |
|||
"Chrome": "y", |
|||
"IE": "y", |
|||
"Edge": "y", |
|||
"Firefox": "y", |
|||
"Safari": "y" |
|||
}, |
|||
"小程序": { |
|||
"微信": "y", |
|||
"阿里": "u", |
|||
"百度": "u", |
|||
"字节跳动": "u", |
|||
"QQ": "u", |
|||
"京东": "u" |
|||
}, |
|||
"快应用": { |
|||
"华为": "u", |
|||
"联盟": "u" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,66 @@ |
|||
|
|||
## breadcrumb 面包屑导航 |
|||
> **组件名:uni-breadcrumb** |
|||
> 代码块: `ubreadcrumb` |
|||
|
|||
显示当前页面的路径,快速返回之前的任意页面。 |
|||
|
|||
### 安装方式 |
|||
|
|||
本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。 |
|||
|
|||
如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55) |
|||
|
|||
### 基本用法 |
|||
|
|||
在 ``template`` 中使用组件 |
|||
|
|||
```html |
|||
<uni-breadcrumb separator="/"> |
|||
<uni-breadcrumb-item v-for="(route,index) in routes" :key="index" :to="route.to">{{route.name}}</uni-breadcrumb-item> |
|||
</uni-breadcrumb> |
|||
``` |
|||
|
|||
```js |
|||
export default { |
|||
name: "uni-stat-breadcrumb", |
|||
data() { |
|||
return { |
|||
routes: [{ |
|||
to: '/A', |
|||
name: 'A页面' |
|||
}, { |
|||
to: '/B', |
|||
name: 'B页面' |
|||
}, { |
|||
to: '/C', |
|||
name: 'C页面' |
|||
}] |
|||
}; |
|||
} |
|||
} |
|||
``` |
|||
|
|||
|
|||
## API |
|||
|
|||
### Breadcrumb Props |
|||
|
|||
|属性名 |类型 |默认值 |说明 | |
|||
|:-: |:-: |:-: |:-: | |
|||
|separator |String |斜杠'/' |分隔符 | |
|||
|separatorClass |String | |图标分隔符 class | |
|||
|
|||
### Breadcrumb Item Props |
|||
|
|||
|属性名 |类型 |默认值 |说明 | |
|||
|:-: |:-: |:-: |:-: | |
|||
|to |String | |路由跳转页面路径 | |
|||
|replace|Boolean | |在使用 to 进行路由跳转时,启用 replace 将不会向 history 添加新记录(仅 h5 支持) | |
|||
|
|||
|
|||
|
|||
|
|||
## 组件示例 |
|||
|
|||
点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/breadcrumb/breadcrumb](https://hellouniapp.dcloud.net.cn/pages/extUI/breadcrumb/breadcrumb) |
@ -0,0 +1,20 @@ |
|||
## 1.4.7(2022-09-16) |
|||
- 可以使用 uni-scss 控制主题色 |
|||
## 1.4.6(2022-09-08) |
|||
- fix: 表头年月切换,导致改变当前日期为选择月1号,且未触发change事件 |
|||
## 1.4.5(2022-02-25) |
|||
- 修复 条件编译 nvue 不支持的 css 样式 |
|||
## 1.4.4(2022-02-25) |
|||
- 修复 条件编译 nvue 不支持的 css 样式 |
|||
## 1.4.3(2021-09-22) |
|||
- 修复 startDate、 endDate 属性失效的 bug |
|||
## 1.4.2(2021-08-24) |
|||
- 新增 支持国际化 |
|||
## 1.4.1(2021-08-05) |
|||
- 修复 弹出层被 tabbar 遮盖 bug |
|||
## 1.4.0(2021-07-30) |
|||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) |
|||
## 1.3.16(2021-05-12) |
|||
- 新增 组件示例地址 |
|||
## 1.3.15(2021-02-04) |
|||
- 调整为uni_modules目录规范 |
@ -0,0 +1,546 @@ |
|||
/** |
|||
* @1900-2100区间内的公历、农历互转 |
|||
* @charset UTF-8 |
|||
* @github https://github.com/jjonline/calendar.js
|
|||
* @Author Jea杨(JJonline@JJonline.Cn) |
|||
* @Time 2014-7-21 |
|||
* @Time 2016-8-13 Fixed 2033hex、Attribution Annals |
|||
* @Time 2016-9-25 Fixed lunar LeapMonth Param Bug |
|||
* @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year |
|||
* @Version 1.0.3 |
|||
* @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
|
|||
* @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
|
|||
*/ |
|||
/* eslint-disable */ |
|||
var calendar = { |
|||
|
|||
/** |
|||
* 农历1900-2100的润大小信息表 |
|||
* @Array Of Property |
|||
* @return Hex |
|||
*/ |
|||
lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909
|
|||
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919
|
|||
0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929
|
|||
0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939
|
|||
0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949
|
|||
0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959
|
|||
0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969
|
|||
0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979
|
|||
0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989
|
|||
0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999
|
|||
0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009
|
|||
0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019
|
|||
0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029
|
|||
0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039
|
|||
0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049
|
|||
/** Add By JJonline@JJonline.Cn**/ |
|||
0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059
|
|||
0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069
|
|||
0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079
|
|||
0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089
|
|||
0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099
|
|||
0x0d520], // 2100
|
|||
|
|||
/** |
|||
* 公历每个月份的天数普通表 |
|||
* @Array Of Property |
|||
* @return Number |
|||
*/ |
|||
solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], |
|||
|
|||
/** |
|||
* 天干地支之天干速查表 |
|||
* @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] |
|||
* @return Cn string |
|||
*/ |
|||
Gan: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'], |
|||
|
|||
/** |
|||
* 天干地支之地支速查表 |
|||
* @Array Of Property |
|||
* @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"] |
|||
* @return Cn string |
|||
*/ |
|||
Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'], |
|||
|
|||
/** |
|||
* 天干地支之地支速查表<=>生肖 |
|||
* @Array Of Property |
|||
* @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] |
|||
* @return Cn string |
|||
*/ |
|||
Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a'], |
|||
|
|||
/** |
|||
* 24节气速查表 |
|||
* @Array Of Property |
|||
* @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"] |
|||
* @return Cn string |
|||
*/ |
|||
solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'], |
|||
|
|||
/** |
|||
* 1900-2100各年的24节气日期速查表 |
|||
* @Array Of Property |
|||
* @return 0x string For splice |
|||
*/ |
|||
sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', |
|||
'97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', |
|||
'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f', |
|||
'97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa', |
|||
'97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f', |
|||
'97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', |
|||
'97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', |
|||
'97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', |
|||
'97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722', |
|||
'7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', |
|||
'97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', |
|||
'9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', |
|||
'97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', |
|||
'9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', |
|||
'9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa', |
|||
'97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', |
|||
'9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721', |
|||
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', |
|||
'977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', |
|||
'7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', |
|||
'977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', |
|||
'977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', |
|||
'7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', |
|||
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', |
|||
'7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722', |
|||
'7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', |
|||
'7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', |
|||
'7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', |
|||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', |
|||
'7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', |
|||
'7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', |
|||
'7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721', |
|||
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5', |
|||
'7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35', |
|||
'665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', |
|||
'7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', |
|||
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35', |
|||
'7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'], |
|||
|
|||
/** |
|||
* 数字转中文速查表 |
|||
* @Array Of Property |
|||
* @trans ['日','一','二','三','四','五','六','七','八','九','十'] |
|||
* @return Cn string |
|||
*/ |
|||
nStr1: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341'], |
|||
|
|||
/** |
|||
* 日期转农历称呼速查表 |
|||
* @Array Of Property |
|||
* @trans ['初','十','廿','卅'] |
|||
* @return Cn string |
|||
*/ |
|||
nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'], |
|||
|
|||
/** |
|||
* 月份转农历称呼速查表 |
|||
* @Array Of Property |
|||
* @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] |
|||
* @return Cn string |
|||
*/ |
|||
nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a'], |
|||
|
|||
/** |
|||
* 返回农历y年一整年的总天数 |
|||
* @param lunar Year |
|||
* @return Number |
|||
* @eg:var count = calendar.lYearDays(1987) ;//count=387
|
|||
*/ |
|||
lYearDays: function (y) { |
|||
var i; var sum = 348 |
|||
for (i = 0x8000; i > 0x8; i >>= 1) { sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0 } |
|||
return (sum + this.leapDays(y)) |
|||
}, |
|||
|
|||
/** |
|||
* 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 |
|||
* @param lunar Year |
|||
* @return Number (0-12) |
|||
* @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
|
|||
*/ |
|||
leapMonth: function (y) { // 闰字编码 \u95f0
|
|||
return (this.lunarInfo[y - 1900] & 0xf) |
|||
}, |
|||
|
|||
/** |
|||
* 返回农历y年闰月的天数 若该年没有闰月则返回0 |
|||
* @param lunar Year |
|||
* @return Number (0、29、30) |
|||
* @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
|
|||
*/ |
|||
leapDays: function (y) { |
|||
if (this.leapMonth(y)) { |
|||
return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29) |
|||
} |
|||
return (0) |
|||
}, |
|||
|
|||
/** |
|||
* 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法 |
|||
* @param lunar Year |
|||
* @return Number (-1、29、30) |
|||
* @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
|
|||
*/ |
|||
monthDays: function (y, m) { |
|||
if (m > 12 || m < 1) { return -1 }// 月份参数从1至12,参数错误返回-1
|
|||
return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29) |
|||
}, |
|||
|
|||
/** |
|||
* 返回公历(!)y年m月的天数 |
|||
* @param solar Year |
|||
* @return Number (-1、28、29、30、31) |
|||
* @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
|
|||
*/ |
|||
solarDays: function (y, m) { |
|||
if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1
|
|||
var ms = m - 1 |
|||
if (ms == 1) { // 2月份的闰平规律测算后确认返回28或29
|
|||
return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28) |
|||
} else { |
|||
return (this.solarMonth[ms]) |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* 农历年份转换为干支纪年 |
|||
* @param lYear 农历年的年份数 |
|||
* @return Cn string |
|||
*/ |
|||
toGanZhiYear: function (lYear) { |
|||
var ganKey = (lYear - 3) % 10 |
|||
var zhiKey = (lYear - 3) % 12 |
|||
if (ganKey == 0) ganKey = 10// 如果余数为0则为最后一个天干
|
|||
if (zhiKey == 0) zhiKey = 12// 如果余数为0则为最后一个地支
|
|||
return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1] |
|||
}, |
|||
|
|||
/** |
|||
* 公历月、日判断所属星座 |
|||
* @param cMonth [description] |
|||
* @param cDay [description] |
|||
* @return Cn string |
|||
*/ |
|||
toAstro: function (cMonth, cDay) { |
|||
var s = '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf' |
|||
var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22] |
|||
return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7'// 座
|
|||
}, |
|||
|
|||
/** |
|||
* 传入offset偏移量返回干支 |
|||
* @param offset 相对甲子的偏移量 |
|||
* @return Cn string |
|||
*/ |
|||
toGanZhi: function (offset) { |
|||
return this.Gan[offset % 10] + this.Zhi[offset % 12] |
|||
}, |
|||
|
|||
/** |
|||
* 传入公历(!)y年获得该年第n个节气的公历日期 |
|||
* @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起 |
|||
* @return day Number |
|||
* @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
|
|||
*/ |
|||
getTerm: function (y, n) { |
|||
if (y < 1900 || y > 2100) { return -1 } |
|||
if (n < 1 || n > 24) { return -1 } |
|||
var _table = this.sTermInfo[y - 1900] |
|||
var _info = [ |
|||
parseInt('0x' + _table.substr(0, 5)).toString(), |
|||
parseInt('0x' + _table.substr(5, 5)).toString(), |
|||
parseInt('0x' + _table.substr(10, 5)).toString(), |
|||
parseInt('0x' + _table.substr(15, 5)).toString(), |
|||
parseInt('0x' + _table.substr(20, 5)).toString(), |
|||
parseInt('0x' + _table.substr(25, 5)).toString() |
|||
] |
|||
var _calday = [ |
|||
_info[0].substr(0, 1), |
|||
_info[0].substr(1, 2), |
|||
_info[0].substr(3, 1), |
|||
_info[0].substr(4, 2), |
|||
|
|||
_info[1].substr(0, 1), |
|||
_info[1].substr(1, 2), |
|||
_info[1].substr(3, 1), |
|||
_info[1].substr(4, 2), |
|||
|
|||
_info[2].substr(0, 1), |
|||
_info[2].substr(1, 2), |
|||
_info[2].substr(3, 1), |
|||
_info[2].substr(4, 2), |
|||
|
|||
_info[3].substr(0, 1), |
|||
_info[3].substr(1, 2), |
|||
_info[3].substr(3, 1), |
|||
_info[3].substr(4, 2), |
|||
|
|||
_info[4].substr(0, 1), |
|||
_info[4].substr(1, 2), |
|||
_info[4].substr(3, 1), |
|||
_info[4].substr(4, 2), |
|||
|
|||
_info[5].substr(0, 1), |
|||
_info[5].substr(1, 2), |
|||
_info[5].substr(3, 1), |
|||
_info[5].substr(4, 2) |
|||
] |
|||
return parseInt(_calday[n - 1]) |
|||
}, |
|||
|
|||
/** |
|||
* 传入农历数字月份返回汉语通俗表示法 |
|||
* @param lunar month |
|||
* @return Cn string |
|||
* @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
|
|||
*/ |
|||
toChinaMonth: function (m) { // 月 => \u6708
|
|||
if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1
|
|||
var s = this.nStr3[m - 1] |
|||
s += '\u6708'// 加上月字
|
|||
return s |
|||
}, |
|||
|
|||
/** |
|||
* 传入农历日期数字返回汉字表示法 |
|||
* @param lunar day |
|||
* @return Cn string |
|||
* @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
|
|||
*/ |
|||
toChinaDay: function (d) { // 日 => \u65e5
|
|||
var s |
|||
switch (d) { |
|||
case 10: |
|||
s = '\u521d\u5341'; break |
|||
case 20: |
|||
s = '\u4e8c\u5341'; break |
|||
break |
|||
case 30: |
|||
s = '\u4e09\u5341'; break |
|||
break |
|||
default : |
|||
s = this.nStr2[Math.floor(d / 10)] |
|||
s += this.nStr1[d % 10] |
|||
} |
|||
return (s) |
|||
}, |
|||
|
|||
/** |
|||
* 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春” |
|||
* @param y year |
|||
* @return Cn string |
|||
* @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
|
|||
*/ |
|||
getAnimal: function (y) { |
|||
return this.Animals[(y - 4) % 12] |
|||
}, |
|||
|
|||
/** |
|||
* 传入阳历年月日获得详细的公历、农历object信息 <=>JSON |
|||
* @param y solar year |
|||
* @param m solar month |
|||
* @param d solar day |
|||
* @return JSON object |
|||
* @eg:console.log(calendar.solar2lunar(1987,11,01)); |
|||
*/ |
|||
solar2lunar: function (y, m, d) { // 参数区间1900.1.31~2100.12.31
|
|||
// 年份限定、上限
|
|||
if (y < 1900 || y > 2100) { |
|||
return -1// undefined转换为数字变为NaN
|
|||
} |
|||
// 公历传参最下限
|
|||
if (y == 1900 && m == 1 && d < 31) { |
|||
return -1 |
|||
} |
|||
// 未传参 获得当天
|
|||
if (!y) { |
|||
var objDate = new Date() |
|||
} else { |
|||
var objDate = new Date(y, parseInt(m) - 1, d) |
|||
} |
|||
var i; var leap = 0; var temp = 0 |
|||
// 修正ymd参数
|
|||
var y = objDate.getFullYear() |
|||
var m = objDate.getMonth() + 1 |
|||
var d = objDate.getDate() |
|||
var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000 |
|||
for (i = 1900; i < 2101 && offset > 0; i++) { |
|||
temp = this.lYearDays(i) |
|||
offset -= temp |
|||
} |
|||
if (offset < 0) { |
|||
offset += temp; i-- |
|||
} |
|||
|
|||
// 是否今天
|
|||
var isTodayObj = new Date() |
|||
var isToday = false |
|||
if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) { |
|||
isToday = true |
|||
} |
|||
// 星期几
|
|||
var nWeek = objDate.getDay() |
|||
var cWeek = this.nStr1[nWeek] |
|||
// 数字表示周几顺应天朝周一开始的惯例
|
|||
if (nWeek == 0) { |
|||
nWeek = 7 |
|||
} |
|||
// 农历年
|
|||
var year = i |
|||
var leap = this.leapMonth(i) // 闰哪个月
|
|||
var isLeap = false |
|||
|
|||
// 效验闰月
|
|||
for (i = 1; i < 13 && offset > 0; i++) { |
|||
// 闰月
|
|||
if (leap > 0 && i == (leap + 1) && isLeap == false) { |
|||
--i |
|||
isLeap = true; temp = this.leapDays(year) // 计算农历闰月天数
|
|||
} else { |
|||
temp = this.monthDays(year, i)// 计算农历普通月天数
|
|||
} |
|||
// 解除闰月
|
|||
if (isLeap == true && i == (leap + 1)) { isLeap = false } |
|||
offset -= temp |
|||
} |
|||
// 闰月导致数组下标重叠取反
|
|||
if (offset == 0 && leap > 0 && i == leap + 1) { |
|||
if (isLeap) { |
|||
isLeap = false |
|||
} else { |
|||
isLeap = true; --i |
|||
} |
|||
} |
|||
if (offset < 0) { |
|||
offset += temp; --i |
|||
} |
|||
// 农历月
|
|||
var month = i |
|||
// 农历日
|
|||
var day = offset + 1 |
|||
// 天干地支处理
|
|||
var sm = m - 1 |
|||
var gzY = this.toGanZhiYear(year) |
|||
|
|||
// 当月的两个节气
|
|||
// bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year`
|
|||
var firstNode = this.getTerm(y, (m * 2 - 1))// 返回当月「节」为几日开始
|
|||
var secondNode = this.getTerm(y, (m * 2))// 返回当月「节」为几日开始
|
|||
|
|||
// 依据12节气修正干支月
|
|||
var gzM = this.toGanZhi((y - 1900) * 12 + m + 11) |
|||
if (d >= firstNode) { |
|||
gzM = this.toGanZhi((y - 1900) * 12 + m + 12) |
|||
} |
|||
|
|||
// 传入的日期的节气与否
|
|||
var isTerm = false |
|||
var Term = null |
|||
if (firstNode == d) { |
|||
isTerm = true |
|||
Term = this.solarTerm[m * 2 - 2] |
|||
} |
|||
if (secondNode == d) { |
|||
isTerm = true |
|||
Term = this.solarTerm[m * 2 - 1] |
|||
} |
|||
// 日柱 当月一日与 1900/1/1 相差天数
|
|||
var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10 |
|||
var gzD = this.toGanZhi(dayCyclical + d - 1) |
|||
// 该日期所属的星座
|
|||
var astro = this.toAstro(m, d) |
|||
|
|||
return { 'lYear': year, 'lMonth': month, 'lDay': day, 'Animal': this.getAnimal(year), 'IMonthCn': (isLeap ? '\u95f0' : '') + this.toChinaMonth(month), 'IDayCn': this.toChinaDay(day), 'cYear': y, 'cMonth': m, 'cDay': d, 'gzYear': gzY, 'gzMonth': gzM, 'gzDay': gzD, 'isToday': isToday, 'isLeap': isLeap, 'nWeek': nWeek, 'ncWeek': '\u661f\u671f' + cWeek, 'isTerm': isTerm, 'Term': Term, 'astro': astro } |
|||
}, |
|||
|
|||
/** |
|||
* 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON |
|||
* @param y lunar year |
|||
* @param m lunar month |
|||
* @param d lunar day |
|||
* @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可] |
|||
* @return JSON object |
|||
* @eg:console.log(calendar.lunar2solar(1987,9,10)); |
|||
*/ |
|||
lunar2solar: function (y, m, d, isLeapMonth) { // 参数区间1900.1.31~2100.12.1
|
|||
var isLeapMonth = !!isLeapMonth |
|||
var leapOffset = 0 |
|||
var leapMonth = this.leapMonth(y) |
|||
var leapDay = this.leapDays(y) |
|||
if (isLeapMonth && (leapMonth != m)) { return -1 }// 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
|
|||
if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) { return -1 }// 超出了最大极限值
|
|||
var day = this.monthDays(y, m) |
|||
var _day = day |
|||
// bugFix 2016-9-25
|
|||
// if month is leap, _day use leapDays method
|
|||
if (isLeapMonth) { |
|||
_day = this.leapDays(y, m) |
|||
} |
|||
if (y < 1900 || y > 2100 || d > _day) { return -1 }// 参数合法性效验
|
|||
|
|||
// 计算农历的时间差
|
|||
var offset = 0 |
|||
for (var i = 1900; i < y; i++) { |
|||
offset += this.lYearDays(i) |
|||
} |
|||
var leap = 0; var isAdd = false |
|||
for (var i = 1; i < m; i++) { |
|||
leap = this.leapMonth(y) |
|||
if (!isAdd) { // 处理闰月
|
|||
if (leap <= i && leap > 0) { |
|||
offset += this.leapDays(y); isAdd = true |
|||
} |
|||
} |
|||
offset += this.monthDays(y, i) |
|||
} |
|||
// 转换闰月农历 需补充该年闰月的前一个月的时差
|
|||
if (isLeapMonth) { offset += day } |
|||
// 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
|
|||
var stmap = Date.UTC(1900, 1, 30, 0, 0, 0) |
|||
var calObj = new Date((offset + d - 31) * 86400000 + stmap) |
|||
var cY = calObj.getUTCFullYear() |
|||
var cM = calObj.getUTCMonth() + 1 |
|||
var cD = calObj.getUTCDate() |
|||
|
|||
return this.solar2lunar(cY, cM, cD) |
|||
} |
|||
} |
|||
|
|||
export default calendar |
@ -0,0 +1,12 @@ |
|||
{ |
|||
"uni-calender.ok": "ok", |
|||
"uni-calender.cancel": "cancel", |
|||
"uni-calender.today": "today", |
|||
"uni-calender.MON": "MON", |
|||
"uni-calender.TUE": "TUE", |
|||
"uni-calender.WED": "WED", |
|||
"uni-calender.THU": "THU", |
|||
"uni-calender.FRI": "FRI", |
|||
"uni-calender.SAT": "SAT", |
|||
"uni-calender.SUN": "SUN" |
|||
} |
@ -0,0 +1,8 @@ |
|||
import en from './en.json' |
|||
import zhHans from './zh-Hans.json' |
|||
import zhHant from './zh-Hant.json' |
|||
export default { |
|||
en, |
|||
'zh-Hans': zhHans, |
|||
'zh-Hant': zhHant |
|||
} |
@ -0,0 +1,12 @@ |
|||
{ |
|||
"uni-calender.ok": "确定", |
|||
"uni-calender.cancel": "取消", |
|||
"uni-calender.today": "今日", |
|||
"uni-calender.SUN": "日", |
|||
"uni-calender.MON": "一", |
|||
"uni-calender.TUE": "二", |
|||
"uni-calender.WED": "三", |
|||
"uni-calender.THU": "四", |
|||
"uni-calender.FRI": "五", |
|||
"uni-calender.SAT": "六" |
|||
} |
@ -0,0 +1,12 @@ |
|||
{ |
|||
"uni-calender.ok": "確定", |
|||
"uni-calender.cancel": "取消", |
|||
"uni-calender.today": "今日", |
|||
"uni-calender.SUN": "日", |
|||
"uni-calender.MON": "一", |
|||
"uni-calender.TUE": "二", |
|||
"uni-calender.WED": "三", |
|||
"uni-calender.THU": "四", |
|||
"uni-calender.FRI": "五", |
|||
"uni-calender.SAT": "六" |
|||
} |
@ -0,0 +1,188 @@ |
|||
<template> |
|||
<view class="uni-calendar-item__weeks-box" :class="{ |
|||
'uni-calendar-item--disable':weeks.disable, |
|||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, |
|||
'uni-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay) , |
|||
'uni-calendar-item--before-checked':weeks.beforeMultiple, |
|||
'uni-calendar-item--multiple': weeks.multiple, |
|||
'uni-calendar-item--after-checked':weeks.afterMultiple, |
|||
}" |
|||
@click="choiceDate(weeks)"> |
|||
<view class="uni-calendar-item__weeks-box-item"> |
|||
<text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text> |
|||
<text class="uni-calendar-item__weeks-box-text" :class="{ |
|||
'uni-calendar-item--isDay-text': weeks.isDay, |
|||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, |
|||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, |
|||
'uni-calendar-item--before-checked':weeks.beforeMultiple, |
|||
'uni-calendar-item--multiple': weeks.multiple, |
|||
'uni-calendar-item--after-checked':weeks.afterMultiple, |
|||
'uni-calendar-item--disable':weeks.disable, |
|||
}">{{weeks.date}}</text> |
|||
<text v-if="!lunar&&!weeks.extraInfo && weeks.isDay" class="uni-calendar-item__weeks-lunar-text" :class="{ |
|||
'uni-calendar-item--isDay-text':weeks.isDay, |
|||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, |
|||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, |
|||
'uni-calendar-item--before-checked':weeks.beforeMultiple, |
|||
'uni-calendar-item--multiple': weeks.multiple, |
|||
'uni-calendar-item--after-checked':weeks.afterMultiple, |
|||
}">{{todayText}}</text> |
|||
<text v-if="lunar&&!weeks.extraInfo" class="uni-calendar-item__weeks-lunar-text" :class="{ |
|||
'uni-calendar-item--isDay-text':weeks.isDay, |
|||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, |
|||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, |
|||
'uni-calendar-item--before-checked':weeks.beforeMultiple, |
|||
'uni-calendar-item--multiple': weeks.multiple, |
|||
'uni-calendar-item--after-checked':weeks.afterMultiple, |
|||
'uni-calendar-item--disable':weeks.disable, |
|||
}">{{weeks.isDay ? todayText : (weeks.lunar.IDayCn === '初一'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text> |
|||
<text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uni-calendar-item__weeks-lunar-text" :class="{ |
|||
'uni-calendar-item--extra':weeks.extraInfo.info, |
|||
'uni-calendar-item--isDay-text':weeks.isDay, |
|||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, |
|||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, |
|||
'uni-calendar-item--before-checked':weeks.beforeMultiple, |
|||
'uni-calendar-item--multiple': weeks.multiple, |
|||
'uni-calendar-item--after-checked':weeks.afterMultiple, |
|||
'uni-calendar-item--disable':weeks.disable, |
|||
}">{{weeks.extraInfo.info}}</text> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
initVueI18n |
|||
} from '@dcloudio/uni-i18n' |
|||
import messages from './i18n/index.js' |
|||
const { t } = initVueI18n(messages) |
|||
export default { |
|||
emits:['change'], |
|||
props: { |
|||
weeks: { |
|||
type: Object, |
|||
default () { |
|||
return {} |
|||
} |
|||
}, |
|||
calendar: { |
|||
type: Object, |
|||
default: () => { |
|||
return {} |
|||
} |
|||
}, |
|||
selected: { |
|||
type: Array, |
|||
default: () => { |
|||
return [] |
|||
} |
|||
}, |
|||
lunar: { |
|||
type: Boolean, |
|||
default: false |
|||
} |
|||
}, |
|||
computed: { |
|||
todayText() { |
|||
return t("uni-calender.today") |
|||
}, |
|||
}, |
|||
methods: { |
|||
choiceDate(weeks) { |
|||
this.$emit('change', weeks) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
$uni-font-size-base:14px; |
|||
$uni-text-color:#333; |
|||
$uni-font-size-sm:12px; |
|||
$uni-color-error: #e43d33; |
|||
$uni-opacity-disabled: 0.3; |
|||
$uni-text-color-disable:#c0c0c0; |
|||
$uni-primary: #2979ff !default; |
|||
.uni-calendar-item__weeks-box { |
|||
flex: 1; |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: column; |
|||
justify-content: center; |
|||
align-items: center; |
|||
} |
|||
|
|||
.uni-calendar-item__weeks-box-text { |
|||
font-size: $uni-font-size-base; |
|||
color: $uni-text-color; |
|||
} |
|||
|
|||
.uni-calendar-item__weeks-lunar-text { |
|||
font-size: $uni-font-size-sm; |
|||
color: $uni-text-color; |
|||
} |
|||
|
|||
.uni-calendar-item__weeks-box-item { |
|||
position: relative; |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: column; |
|||
justify-content: center; |
|||
align-items: center; |
|||
width: 100rpx; |
|||
height: 100rpx; |
|||
} |
|||
|
|||
.uni-calendar-item__weeks-box-circle { |
|||
position: absolute; |
|||
top: 5px; |
|||
right: 5px; |
|||
width: 8px; |
|||
height: 8px; |
|||
border-radius: 8px; |
|||
background-color: $uni-color-error; |
|||
|
|||
} |
|||
|
|||
.uni-calendar-item--disable { |
|||
background-color: rgba(249, 249, 249, $uni-opacity-disabled); |
|||
color: $uni-text-color-disable; |
|||
} |
|||
|
|||
.uni-calendar-item--isDay-text { |
|||
color: $uni-primary; |
|||
} |
|||
|
|||
.uni-calendar-item--isDay { |
|||
background-color: $uni-primary; |
|||
opacity: 0.8; |
|||
color: #fff; |
|||
} |
|||
|
|||
.uni-calendar-item--extra { |
|||
color: $uni-color-error; |
|||
opacity: 0.8; |
|||
} |
|||
|
|||
.uni-calendar-item--checked { |
|||
background-color: $uni-primary; |
|||
color: #fff; |
|||
opacity: 0.8; |
|||
} |
|||
|
|||
.uni-calendar-item--multiple { |
|||
background-color: $uni-primary; |
|||
color: #fff; |
|||
opacity: 0.8; |
|||
} |
|||
.uni-calendar-item--before-checked { |
|||
background-color: #ff5a5f; |
|||
color: #fff; |
|||
} |
|||
.uni-calendar-item--after-checked { |
|||
background-color: #ff5a5f; |
|||
color: #fff; |
|||
} |
|||
</style> |
@ -0,0 +1,562 @@ |
|||
<template> |
|||
<view class="uni-calendar"> |
|||
<view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}" @click="clean"></view> |
|||
<view v-if="insert || show" class="uni-calendar__content" :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow}"> |
|||
<view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top"> |
|||
<view class="uni-calendar__header-btn-box" @click="close"> |
|||
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{cancelText}}</text> |
|||
</view> |
|||
<view class="uni-calendar__header-btn-box" @click="confirm"> |
|||
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{okText}}</text> |
|||
</view> |
|||
</view> |
|||
<view class="uni-calendar__header"> |
|||
<view class="uni-calendar__header-btn-box" @click.stop="pre"> |
|||
<view class="uni-calendar__header-btn uni-calendar--left"></view> |
|||
</view> |
|||
<picker mode="date" :value="date" fields="month" @change="bindDateChange"> |
|||
<text class="uni-calendar__header-text">{{ (nowDate.year||'') +' / '+( nowDate.month||'')}}</text> |
|||
</picker> |
|||
<view class="uni-calendar__header-btn-box" @click.stop="next"> |
|||
<view class="uni-calendar__header-btn uni-calendar--right"></view> |
|||
</view> |
|||
<text class="uni-calendar__backtoday" @click="backtoday">{{todayText}}</text> |
|||
|
|||
</view> |
|||
<view class="uni-calendar__box"> |
|||
<view v-if="showMonth" class="uni-calendar__box-bg"> |
|||
<text class="uni-calendar__box-bg-text">{{nowDate.month}}</text> |
|||
</view> |
|||
<view class="uni-calendar__weeks"> |
|||
<view class="uni-calendar__weeks-day"> |
|||
<text class="uni-calendar__weeks-day-text">{{SUNText}}</text> |
|||
</view> |
|||
<view class="uni-calendar__weeks-day"> |
|||
<text class="uni-calendar__weeks-day-text">{{monText}}</text> |
|||
</view> |
|||
<view class="uni-calendar__weeks-day"> |
|||
<text class="uni-calendar__weeks-day-text">{{TUEText}}</text> |
|||
</view> |
|||
<view class="uni-calendar__weeks-day"> |
|||
<text class="uni-calendar__weeks-day-text">{{WEDText}}</text> |
|||
</view> |
|||
<view class="uni-calendar__weeks-day"> |
|||
<text class="uni-calendar__weeks-day-text">{{THUText}}</text> |
|||
</view> |
|||
<view class="uni-calendar__weeks-day"> |
|||
<text class="uni-calendar__weeks-day-text">{{FRIText}}</text> |
|||
</view> |
|||
<view class="uni-calendar__weeks-day"> |
|||
<text class="uni-calendar__weeks-day-text">{{SATText}}</text> |
|||
</view> |
|||
</view> |
|||
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex"> |
|||
<view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex"> |
|||
<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate"></calendar-item> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import Calendar from './util.js'; |
|||
import calendarItem from './uni-calendar-item.vue' |
|||
import { |
|||
initVueI18n |
|||
} from '@dcloudio/uni-i18n' |
|||
import messages from './i18n/index.js' |
|||
const { t } = initVueI18n(messages) |
|||
/** |
|||
* Calendar 日历 |
|||
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等 |
|||
* @tutorial https://ext.dcloud.net.cn/plugin?id=56 |
|||
* @property {String} date 自定义当前时间,默认为今天 |
|||
* @property {Boolean} lunar 显示农历 |
|||
* @property {String} startDate 日期选择范围-开始日期 |
|||
* @property {String} endDate 日期选择范围-结束日期 |
|||
* @property {Boolean} range 范围选择 |
|||
* @property {Boolean} insert = [true|false] 插入模式,默认为false |
|||
* @value true 弹窗模式 |
|||
* @value false 插入模式 |
|||
* @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容 |
|||
* @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}] |
|||
* @property {Boolean} showMonth 是否选择月份为背景 |
|||
* @event {Function} change 日期改变,`insert :ture` 时生效 |
|||
* @event {Function} confirm 确认选择`insert :false` 时生效 |
|||
* @event {Function} monthSwitch 切换月份时触发 |
|||
* @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" /> |
|||
*/ |
|||
export default { |
|||
components: { |
|||
calendarItem |
|||
}, |
|||
emits:['close','confirm','change','monthSwitch'], |
|||
props: { |
|||
date: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
selected: { |
|||
type: Array, |
|||
default () { |
|||
return [] |
|||
} |
|||
}, |
|||
lunar: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
startDate: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
endDate: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
range: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
insert: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
showMonth: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
clearDate: { |
|||
type: Boolean, |
|||
default: true |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
show: false, |
|||
weeks: [], |
|||
calendar: {}, |
|||
nowDate: '', |
|||
aniMaskShow: false |
|||
} |
|||
}, |
|||
computed:{ |
|||
/** |
|||
* for i18n |
|||
*/ |
|||
|
|||
okText() { |
|||
return t("uni-calender.ok") |
|||
}, |
|||
cancelText() { |
|||
return t("uni-calender.cancel") |
|||
}, |
|||
todayText() { |
|||
return t("uni-calender.today") |
|||
}, |
|||
monText() { |
|||
return t("uni-calender.MON") |
|||
}, |
|||
TUEText() { |
|||
return t("uni-calender.TUE") |
|||
}, |
|||
WEDText() { |
|||
return t("uni-calender.WED") |
|||
}, |
|||
THUText() { |
|||
return t("uni-calender.THU") |
|||
}, |
|||
FRIText() { |
|||
return t("uni-calender.FRI") |
|||
}, |
|||
SATText() { |
|||
return t("uni-calender.SAT") |
|||
}, |
|||
SUNText() { |
|||
return t("uni-calender.SUN") |
|||
}, |
|||
}, |
|||
watch: { |
|||
date(newVal) { |
|||
// this.cale.setDate(newVal) |
|||
this.init(newVal) |
|||
}, |
|||
startDate(val){ |
|||
this.cale.resetSatrtDate(val) |
|||
this.cale.setDate(this.nowDate.fullDate) |
|||
this.weeks = this.cale.weeks |
|||
}, |
|||
endDate(val){ |
|||
this.cale.resetEndDate(val) |
|||
this.cale.setDate(this.nowDate.fullDate) |
|||
this.weeks = this.cale.weeks |
|||
}, |
|||
selected(newVal) { |
|||
this.cale.setSelectInfo(this.nowDate.fullDate, newVal) |
|||
this.weeks = this.cale.weeks |
|||
} |
|||
}, |
|||
created() { |
|||
// 获取日历方法实例 |
|||
this.cale = new Calendar({ |
|||
// date: new Date(), |
|||
selected: this.selected, |
|||
startDate: this.startDate, |
|||
endDate: this.endDate, |
|||
range: this.range, |
|||
}) |
|||
// 选中某一天 |
|||
// this.cale.setDate(this.date) |
|||
this.init(this.date) |
|||
// this.setDay |
|||
}, |
|||
methods: { |
|||
// 取消穿透 |
|||
clean() {}, |
|||
bindDateChange(e) { |
|||
const value = e.detail.value + '-1' |
|||
console.log(this.cale.getDate(value)); |
|||
this.setDate(value) |
|||
}, |
|||
/** |
|||
* 初始化日期显示 |
|||
* @param {Object} date |
|||
*/ |
|||
init(date) { |
|||
this.cale.setDate(date) |
|||
this.weeks = this.cale.weeks |
|||
this.nowDate = this.calendar = this.cale.getInfo(date) |
|||
}, |
|||
/** |
|||
* 打开日历弹窗 |
|||
*/ |
|||
open() { |
|||
// 弹窗模式并且清理数据 |
|||
if (this.clearDate && !this.insert) { |
|||
this.cale.cleanMultipleStatus() |
|||
// this.cale.setDate(this.date) |
|||
this.init(this.date) |
|||
} |
|||
this.show = true |
|||
this.$nextTick(() => { |
|||
setTimeout(() => { |
|||
this.aniMaskShow = true |
|||
}, 50) |
|||
}) |
|||
}, |
|||
/** |
|||
* 关闭日历弹窗 |
|||
*/ |
|||
close() { |
|||
this.aniMaskShow = false |
|||
this.$nextTick(() => { |
|||
setTimeout(() => { |
|||
this.show = false |
|||
this.$emit('close') |
|||
}, 300) |
|||
}) |
|||
}, |
|||
/** |
|||
* 确认按钮 |
|||
*/ |
|||
confirm() { |
|||
this.setEmit('confirm') |
|||
this.close() |
|||
}, |
|||
/** |
|||
* 变化触发 |
|||
*/ |
|||
change() { |
|||
if (!this.insert) return |
|||
this.setEmit('change') |
|||
}, |
|||
/** |
|||
* 选择月份触发 |
|||
*/ |
|||
monthSwitch() { |
|||
let { |
|||
year, |
|||
month |
|||
} = this.nowDate |
|||
this.$emit('monthSwitch', { |
|||
year, |
|||
month: Number(month) |
|||
}) |
|||
}, |
|||
/** |
|||
* 派发事件 |
|||
* @param {Object} name |
|||
*/ |
|||
setEmit(name) { |
|||
let { |
|||
year, |
|||
month, |
|||
date, |
|||
fullDate, |
|||
lunar, |
|||
extraInfo |
|||
} = this.calendar |
|||
this.$emit(name, { |
|||
range: this.cale.multipleStatus, |
|||
year, |
|||
month, |
|||
date, |
|||
fulldate: fullDate, |
|||
lunar, |
|||
extraInfo: extraInfo || {} |
|||
}) |
|||
}, |
|||
/** |
|||
* 选择天触发 |
|||
* @param {Object} weeks |
|||
*/ |
|||
choiceDate(weeks) { |
|||
if (weeks.disable) return |
|||
this.calendar = weeks |
|||
// 设置多选 |
|||
this.cale.setMultiple(this.calendar.fullDate) |
|||
this.weeks = this.cale.weeks |
|||
this.change() |
|||
}, |
|||
/** |
|||
* 回到今天 |
|||
*/ |
|||
backtoday() { |
|||
console.log(this.cale.getDate(new Date()).fullDate); |
|||
let date = this.cale.getDate(new Date()).fullDate |
|||
// this.cale.setDate(date) |
|||
this.init(date) |
|||
this.change() |
|||
}, |
|||
/** |
|||
* 上个月 |
|||
*/ |
|||
pre() { |
|||
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate |
|||
this.setDate(preDate) |
|||
this.monthSwitch() |
|||
|
|||
}, |
|||
/** |
|||
* 下个月 |
|||
*/ |
|||
next() { |
|||
const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate |
|||
this.setDate(nextDate) |
|||
this.monthSwitch() |
|||
}, |
|||
/** |
|||
* 设置日期 |
|||
* @param {Object} date |
|||
*/ |
|||
setDate(date) { |
|||
this.cale.setDate(date) |
|||
this.weeks = this.cale.weeks |
|||
this.nowDate = this.cale.getInfo(date) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
$uni-bg-color-mask: rgba($color: #000000, $alpha: 0.4); |
|||
$uni-border-color: #EDEDED; |
|||
$uni-text-color: #333; |
|||
$uni-bg-color-hover:#f1f1f1; |
|||
$uni-font-size-base:14px; |
|||
$uni-text-color-placeholder: #808080; |
|||
$uni-color-subtitle: #555555; |
|||
$uni-text-color-grey:#999; |
|||
.uni-calendar { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.uni-calendar__mask { |
|||
position: fixed; |
|||
bottom: 0; |
|||
top: 0; |
|||
left: 0; |
|||
right: 0; |
|||
background-color: $uni-bg-color-mask; |
|||
transition-property: opacity; |
|||
transition-duration: 0.3s; |
|||
opacity: 0; |
|||
/* #ifndef APP-NVUE */ |
|||
z-index: 99; |
|||
/* #endif */ |
|||
} |
|||
|
|||
.uni-calendar--mask-show { |
|||
opacity: 1 |
|||
} |
|||
|
|||
.uni-calendar--fixed { |
|||
position: fixed; |
|||
/* #ifdef APP-NVUE */ |
|||
bottom: 0; |
|||
/* #endif */ |
|||
left: 0; |
|||
right: 0; |
|||
transition-property: transform; |
|||
transition-duration: 0.3s; |
|||
transform: translateY(460px); |
|||
/* #ifndef APP-NVUE */ |
|||
bottom: calc(var(--window-bottom)); |
|||
z-index: 99; |
|||
/* #endif */ |
|||
} |
|||
|
|||
.uni-calendar--ani-show { |
|||
transform: translateY(0); |
|||
} |
|||
|
|||
.uni-calendar__content { |
|||
background-color: #fff; |
|||
} |
|||
|
|||
.uni-calendar__header { |
|||
position: relative; |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: row; |
|||
justify-content: center; |
|||
align-items: center; |
|||
height: 50px; |
|||
border-bottom-color: $uni-border-color; |
|||
border-bottom-style: solid; |
|||
border-bottom-width: 1px; |
|||
} |
|||
|
|||
.uni-calendar--fixed-top { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: row; |
|||
justify-content: space-between; |
|||
border-top-color: $uni-border-color; |
|||
border-top-style: solid; |
|||
border-top-width: 1px; |
|||
} |
|||
|
|||
.uni-calendar--fixed-width { |
|||
width: 50px; |
|||
// padding: 0 15px; |
|||
} |
|||
|
|||
.uni-calendar__backtoday { |
|||
position: absolute; |
|||
right: 0; |
|||
top: 25rpx; |
|||
padding: 0 5px; |
|||
padding-left: 10px; |
|||
height: 25px; |
|||
line-height: 25px; |
|||
font-size: 12px; |
|||
border-top-left-radius: 25px; |
|||
border-bottom-left-radius: 25px; |
|||
color: $uni-text-color; |
|||
background-color: $uni-bg-color-hover; |
|||
} |
|||
|
|||
.uni-calendar__header-text { |
|||
text-align: center; |
|||
width: 100px; |
|||
font-size: $uni-font-size-base; |
|||
color: $uni-text-color; |
|||
} |
|||
|
|||
.uni-calendar__header-btn-box { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: row; |
|||
align-items: center; |
|||
justify-content: center; |
|||
width: 50px; |
|||
height: 50px; |
|||
} |
|||
|
|||
.uni-calendar__header-btn { |
|||
width: 10px; |
|||
height: 10px; |
|||
border-left-color: $uni-text-color-placeholder; |
|||
border-left-style: solid; |
|||
border-left-width: 2px; |
|||
border-top-color: $uni-color-subtitle; |
|||
border-top-style: solid; |
|||
border-top-width: 2px; |
|||
} |
|||
|
|||
.uni-calendar--left { |
|||
transform: rotate(-45deg); |
|||
} |
|||
|
|||
.uni-calendar--right { |
|||
transform: rotate(135deg); |
|||
} |
|||
|
|||
|
|||
.uni-calendar__weeks { |
|||
position: relative; |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: row; |
|||
} |
|||
|
|||
.uni-calendar__weeks-item { |
|||
flex: 1; |
|||
} |
|||
|
|||
.uni-calendar__weeks-day { |
|||
flex: 1; |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: column; |
|||
justify-content: center; |
|||
align-items: center; |
|||
height: 45px; |
|||
border-bottom-color: #F5F5F5; |
|||
border-bottom-style: solid; |
|||
border-bottom-width: 1px; |
|||
} |
|||
|
|||
.uni-calendar__weeks-day-text { |
|||
font-size: 14px; |
|||
} |
|||
|
|||
.uni-calendar__box { |
|||
position: relative; |
|||
} |
|||
|
|||
.uni-calendar__box-bg { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
justify-content: center; |
|||
align-items: center; |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
right: 0; |
|||
bottom: 0; |
|||
} |
|||
|
|||
.uni-calendar__box-bg-text { |
|||
font-size: 200px; |
|||
font-weight: bold; |
|||
color: $uni-text-color-grey; |
|||
opacity: 0.1; |
|||
text-align: center; |
|||
/* #ifndef APP-NVUE */ |
|||
line-height: 1; |
|||
/* #endif */ |
|||
} |
|||
</style> |
@ -0,0 +1,350 @@ |
|||
import CALENDAR from './calendar.js' |
|||
|
|||
class Calendar { |
|||
constructor({ |
|||
date, |
|||
selected, |
|||
startDate, |
|||
endDate, |
|||
range |
|||
} = {}) { |
|||
// 当前日期
|
|||
this.date = this.getDate(new Date()) // 当前初入日期
|
|||
// 打点信息
|
|||
this.selected = selected || []; |
|||
// 范围开始
|
|||
this.startDate = startDate |
|||
// 范围结束
|
|||
this.endDate = endDate |
|||
this.range = range |
|||
// 多选状态
|
|||
this.cleanMultipleStatus() |
|||
// 每周日期
|
|||
this.weeks = {} |
|||
// this._getWeek(this.date.fullDate)
|
|||
} |
|||
/** |
|||
* 设置日期 |
|||
* @param {Object} date |
|||
*/ |
|||
setDate(date) { |
|||
this.selectDate = this.getDate(date) |
|||
this._getWeek(this.selectDate.fullDate) |
|||
} |
|||
|
|||
/** |
|||
* 清理多选状态 |
|||
*/ |
|||
cleanMultipleStatus() { |
|||
this.multipleStatus = { |
|||
before: '', |
|||
after: '', |
|||
data: [] |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 重置开始日期 |
|||
*/ |
|||
resetSatrtDate(startDate) { |
|||
// 范围开始
|
|||
this.startDate = startDate |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 重置结束日期 |
|||
*/ |
|||
resetEndDate(endDate) { |
|||
// 范围结束
|
|||
this.endDate = endDate |
|||
} |
|||
|
|||
/** |
|||
* 获取任意时间 |
|||
*/ |
|||
getDate(date, AddDayCount = 0, str = 'day') { |
|||
if (!date) { |
|||
date = new Date() |
|||
} |
|||
if (typeof date !== 'object') { |
|||
date = date.replace(/-/g, '/') |
|||
} |
|||
const dd = new Date(date) |
|||
switch (str) { |
|||
case 'day': |
|||
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
|
|||
break |
|||
case 'month': |
|||
if (dd.getDate() === 31) { |
|||
dd.setDate(dd.getDate() + AddDayCount) |
|||
} else { |
|||
dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期
|
|||
} |
|||
break |
|||
case 'year': |
|||
dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期
|
|||
break |
|||
} |
|||
const y = dd.getFullYear() |
|||
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
|
|||
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
|
|||
return { |
|||
fullDate: y + '-' + m + '-' + d, |
|||
year: y, |
|||
month: m, |
|||
date: d, |
|||
day: dd.getDay() |
|||
} |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取上月剩余天数 |
|||
*/ |
|||
_getLastMonthDays(firstDay, full) { |
|||
let dateArr = [] |
|||
for (let i = firstDay; i > 0; i--) { |
|||
const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate() |
|||
dateArr.push({ |
|||
date: beforeDate, |
|||
month: full.month - 1, |
|||
lunar: this.getlunar(full.year, full.month - 1, beforeDate), |
|||
disable: true |
|||
}) |
|||
} |
|||
return dateArr |
|||
} |
|||
/** |
|||
* 获取本月天数 |
|||
*/ |
|||
_currentMonthDys(dateData, full) { |
|||
let dateArr = [] |
|||
let fullDate = this.date.fullDate |
|||
for (let i = 1; i <= dateData; i++) { |
|||
let nowDate = full.year + '-' + (full.month < 10 ? |
|||
full.month : full.month) + '-' + (i < 10 ? |
|||
'0' + i : i) |
|||
// 是否今天
|
|||
let isDay = fullDate === nowDate |
|||
// 获取打点信息
|
|||
let info = this.selected && this.selected.find((item) => { |
|||
if (this.dateEqual(nowDate, item.date)) { |
|||
return item |
|||
} |
|||
}) |
|||
|
|||
// 日期禁用
|
|||
let disableBefore = true |
|||
let disableAfter = true |
|||
if (this.startDate) { |
|||
// let dateCompBefore = this.dateCompare(this.startDate, fullDate)
|
|||
// disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate)
|
|||
disableBefore = this.dateCompare(this.startDate, nowDate) |
|||
} |
|||
|
|||
if (this.endDate) { |
|||
// let dateCompAfter = this.dateCompare(fullDate, this.endDate)
|
|||
// disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate)
|
|||
disableAfter = this.dateCompare(nowDate, this.endDate) |
|||
} |
|||
let multiples = this.multipleStatus.data |
|||
let checked = false |
|||
let multiplesStatus = -1 |
|||
if (this.range) { |
|||
if (multiples) { |
|||
multiplesStatus = multiples.findIndex((item) => { |
|||
return this.dateEqual(item, nowDate) |
|||
}) |
|||
} |
|||
if (multiplesStatus !== -1) { |
|||
checked = true |
|||
} |
|||
} |
|||
let data = { |
|||
fullDate: nowDate, |
|||
year: full.year, |
|||
date: i, |
|||
multiple: this.range ? checked : false, |
|||
beforeMultiple: this.dateEqual(this.multipleStatus.before, nowDate), |
|||
afterMultiple: this.dateEqual(this.multipleStatus.after, nowDate), |
|||
month: full.month, |
|||
lunar: this.getlunar(full.year, full.month, i), |
|||
disable: !(disableBefore && disableAfter), |
|||
isDay |
|||
} |
|||
if (info) { |
|||
data.extraInfo = info |
|||
} |
|||
|
|||
dateArr.push(data) |
|||
} |
|||
return dateArr |
|||
} |
|||
/** |
|||
* 获取下月天数 |
|||
*/ |
|||
_getNextMonthDays(surplus, full) { |
|||
let dateArr = [] |
|||
for (let i = 1; i < surplus + 1; i++) { |
|||
dateArr.push({ |
|||
date: i, |
|||
month: Number(full.month) + 1, |
|||
lunar: this.getlunar(full.year, Number(full.month) + 1, i), |
|||
disable: true |
|||
}) |
|||
} |
|||
return dateArr |
|||
} |
|||
|
|||
/** |
|||
* 获取当前日期详情 |
|||
* @param {Object} date |
|||
*/ |
|||
getInfo(date) { |
|||
if (!date) { |
|||
date = new Date() |
|||
} |
|||
const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate) |
|||
return dateInfo |
|||
} |
|||
|
|||
/** |
|||
* 比较时间大小 |
|||
*/ |
|||
dateCompare(startDate, endDate) { |
|||
// 计算截止时间
|
|||
startDate = new Date(startDate.replace('-', '/').replace('-', '/')) |
|||
// 计算详细项的截止时间
|
|||
endDate = new Date(endDate.replace('-', '/').replace('-', '/')) |
|||
if (startDate <= endDate) { |
|||
return true |
|||
} else { |
|||
return false |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 比较时间是否相等 |
|||
*/ |
|||
dateEqual(before, after) { |
|||
// 计算截止时间
|
|||
before = new Date(before.replace('-', '/').replace('-', '/')) |
|||
// 计算详细项的截止时间
|
|||
after = new Date(after.replace('-', '/').replace('-', '/')) |
|||
if (before.getTime() - after.getTime() === 0) { |
|||
return true |
|||
} else { |
|||
return false |
|||
} |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取日期范围内所有日期 |
|||
* @param {Object} begin |
|||
* @param {Object} end |
|||
*/ |
|||
geDateAll(begin, end) { |
|||
var arr = [] |
|||
var ab = begin.split('-') |
|||
var ae = end.split('-') |
|||
var db = new Date() |
|||
db.setFullYear(ab[0], ab[1] - 1, ab[2]) |
|||
var de = new Date() |
|||
de.setFullYear(ae[0], ae[1] - 1, ae[2]) |
|||
var unixDb = db.getTime() - 24 * 60 * 60 * 1000 |
|||
var unixDe = de.getTime() - 24 * 60 * 60 * 1000 |
|||
for (var k = unixDb; k <= unixDe;) { |
|||
k = k + 24 * 60 * 60 * 1000 |
|||
arr.push(this.getDate(new Date(parseInt(k))).fullDate) |
|||
} |
|||
return arr |
|||
} |
|||
/** |
|||
* 计算阴历日期显示 |
|||
*/ |
|||
getlunar(year, month, date) { |
|||
return CALENDAR.solar2lunar(year, month, date) |
|||
} |
|||
/** |
|||
* 设置打点 |
|||
*/ |
|||
setSelectInfo(data, value) { |
|||
this.selected = value |
|||
this._getWeek(data) |
|||
} |
|||
|
|||
/** |
|||
* 获取多选状态 |
|||
*/ |
|||
setMultiple(fullDate) { |
|||
let { |
|||
before, |
|||
after |
|||
} = this.multipleStatus |
|||
|
|||
if (!this.range) return |
|||
if (before && after) { |
|||
this.multipleStatus.before = '' |
|||
this.multipleStatus.after = '' |
|||
this.multipleStatus.data = [] |
|||
} else { |
|||
if (!before) { |
|||
this.multipleStatus.before = fullDate |
|||
} else { |
|||
this.multipleStatus.after = fullDate |
|||
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { |
|||
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after); |
|||
} else { |
|||
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before); |
|||
} |
|||
} |
|||
} |
|||
this._getWeek(fullDate) |
|||
} |
|||
|
|||
/** |
|||
* 获取每周数据 |
|||
* @param {Object} dateData |
|||
*/ |
|||
_getWeek(dateData) { |
|||
const { |
|||
year, |
|||
month |
|||
} = this.getDate(dateData) |
|||
let firstDay = new Date(year, month - 1, 1).getDay() |
|||
let currentDay = new Date(year, month, 0).getDate() |
|||
let dates = { |
|||
lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天
|
|||
currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数
|
|||
nextMonthDays: [], // 下个月开始几天
|
|||
weeks: [] |
|||
} |
|||
let canlender = [] |
|||
const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length) |
|||
dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData)) |
|||
canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays) |
|||
let weeks = {} |
|||
// 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天
|
|||
for (let i = 0; i < canlender.length; i++) { |
|||
if (i % 7 === 0) { |
|||
weeks[parseInt(i / 7)] = new Array(7) |
|||
} |
|||
weeks[parseInt(i / 7)][i % 7] = canlender[i] |
|||
} |
|||
this.canlender = canlender |
|||
this.weeks = weeks |
|||
} |
|||
|
|||
//静态方法
|
|||
// static init(date) {
|
|||
// if (!this.instance) {
|
|||
// this.instance = new Calendar(date);
|
|||
// }
|
|||
// return this.instance;
|
|||
// }
|
|||
} |
|||
|
|||
|
|||
export default Calendar |
@ -0,0 +1,85 @@ |
|||
{ |
|||
"id": "uni-calendar", |
|||
"displayName": "uni-calendar 日历", |
|||
"version": "1.4.7", |
|||
"description": "日历组件", |
|||
"keywords": [ |
|||
"uni-ui", |
|||
"uniui", |
|||
"日历", |
|||
"", |
|||
"打卡", |
|||
"日历选择" |
|||
], |
|||
"repository": "https://github.com/dcloudio/uni-ui", |
|||
"engines": { |
|||
"HBuilderX": "" |
|||
}, |
|||
"directories": { |
|||
"example": "../../temps/example_temps" |
|||
}, |
|||
"dcloudext": { |
|||
"sale": { |
|||
"regular": { |
|||
"price": "0.00" |
|||
}, |
|||
"sourcecode": { |
|||
"price": "0.00" |
|||
} |
|||
}, |
|||
"contact": { |
|||
"qq": "" |
|||
}, |
|||
"declaration": { |
|||
"ads": "无", |
|||
"data": "无", |
|||
"permissions": "无" |
|||
}, |
|||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", |
|||
"type": "component-vue" |
|||
}, |
|||
"uni_modules": { |
|||
"dependencies": [], |
|||
"encrypt": [], |
|||
"platforms": { |
|||
"cloud": { |
|||
"tcb": "y", |
|||
"aliyun": "y" |
|||
}, |
|||
"client": { |
|||
"App": { |
|||
"app-vue": "y", |
|||
"app-nvue": "y" |
|||
}, |
|||
"H5-mobile": { |
|||
"Safari": "y", |
|||
"Android Browser": "y", |
|||
"微信浏览器(Android)": "y", |
|||
"QQ浏览器(Android)": "y" |
|||
}, |
|||
"H5-pc": { |
|||
"Chrome": "y", |
|||
"IE": "y", |
|||
"Edge": "y", |
|||
"Firefox": "y", |
|||
"Safari": "y" |
|||
}, |
|||
"小程序": { |
|||
"微信": "y", |
|||
"阿里": "y", |
|||
"百度": "y", |
|||
"字节跳动": "y", |
|||
"QQ": "y" |
|||
}, |
|||
"快应用": { |
|||
"华为": "u", |
|||
"联盟": "u" |
|||
}, |
|||
"Vue": { |
|||
"vue2": "y", |
|||
"vue3": "y" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,103 @@ |
|||
|
|||
|
|||
## Calendar 日历 |
|||
> **组件名:uni-calendar** |
|||
> 代码块: `uCalendar` |
|||
|
|||
|
|||
日历组件 |
|||
|
|||
> **注意事项** |
|||
> 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。 |
|||
> - 本组件农历转换使用的js是 [@1900-2100区间内的公历、农历互转](https://github.com/jjonline/calendar.js) |
|||
> - 仅支持自定义组件模式 |
|||
> - `date`属性传入的应该是一个 String ,如: 2019-06-27 ,而不是 new Date() |
|||
> - 通过 `insert` 属性来确定当前的事件是 @change 还是 @confirm 。理应合并为一个事件,但是为了区分模式,现使用两个事件,这里需要注意 |
|||
> - 弹窗模式下无法阻止后面的元素滚动,如有需要阻止,请在弹窗弹出后,手动设置滚动元素为不可滚动 |
|||
|
|||
|
|||
### 安装方式 |
|||
|
|||
本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。 |
|||
|
|||
如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55) |
|||
|
|||
### 基本用法 |
|||
|
|||
在 ``template`` 中使用组件 |
|||
|
|||
```html |
|||
<view> |
|||
<uni-calendar |
|||
:insert="true" |
|||
:lunar="true" |
|||
:start-date="'2019-3-2'" |
|||
:end-date="'2019-5-20'" |
|||
@change="change" |
|||
/> |
|||
</view> |
|||
``` |
|||
|
|||
### 通过方法打开日历 |
|||
|
|||
需要设置 `insert` 为 `false` |
|||
|
|||
```html |
|||
<view> |
|||
<uni-calendar |
|||
ref="calendar" |
|||
:insert="false" |
|||
@confirm="confirm" |
|||
/> |
|||
<button @click="open">打开日历</button> |
|||
</view> |
|||
``` |
|||
|
|||
```javascript |
|||
|
|||
export default { |
|||
data() { |
|||
return {}; |
|||
}, |
|||
methods: { |
|||
open(){ |
|||
this.$refs.calendar.open(); |
|||
}, |
|||
confirm(e) { |
|||
console.log(e); |
|||
} |
|||
} |
|||
}; |
|||
|
|||
``` |
|||
|
|||
|
|||
## API |
|||
|
|||
### Calendar Props |
|||
|
|||
| 属性名 | 类型 | 默认值| 说明 | |
|||
| | | |
|||
| date | String |- | 自定义当前时间,默认为今天 | |
|||
| lunar | Boolean | false | 显示农历 | |
|||
| startDate | String |- | 日期选择范围-开始日期 | |
|||
| endDate | String |- | 日期选择范围-结束日期 | |
|||
| range | Boolean | false | 范围选择 | |
|||
| insert | Boolean | false | 插入模式,可选值,ture:插入模式;false:弹窗模式;默认为插入模式 | |
|||
|clearDate |Boolean |true |弹窗模式是否清空上次选择内容 | |
|||
| selected | Array |- | 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}] | |
|||
|showMonth | Boolean | true | 是否显示月份为背景 | |
|||
|
|||
### Calendar Events |
|||
|
|||
| 事件名 | 说明 |返回值| |
|||
| | | | |
|||
| open | 弹出日历组件,`insert :false` 时生效|- | |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
## 组件示例 |
|||
|
|||
点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/calendar/calendar](https://hellouniapp.dcloud.net.cn/pages/extUI/calendar/calendar) |
@ -0,0 +1,26 @@ |
|||
## 1.3.1(2021-12-20) |
|||
- 修复 在vue页面下略缩图显示不正常的bug |
|||
## 1.3.0(2021-11-19) |
|||
- 重构插槽的用法 ,header 替换为 title |
|||
- 新增 actions 插槽 |
|||
- 新增 cover 封面图属性和插槽 |
|||
- 新增 padding 内容默认内边距离 |
|||
- 新增 margin 卡片默认外边距离 |
|||
- 新增 spacing 卡片默认内边距 |
|||
- 新增 shadow 卡片阴影属性 |
|||
- 取消 mode 属性,可使用组合插槽代替 |
|||
- 取消 note 属性 ,使用actions插槽代替 |
|||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) |
|||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-card](https://uniapp.dcloud.io/component/uniui/uni-card) |
|||
## 1.2.1(2021-07-30) |
|||
- 优化 vue3下事件警告的问题 |
|||
## 1.2.0(2021-07-13) |
|||
- 组件兼容 vue3,如何创建vue3项目详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) |
|||
## 1.1.8(2021-07-01) |
|||
- 优化 图文卡片无图片加载时,提供占位图标 |
|||
- 新增 header 插槽,自定义卡片头部( 图文卡片 mode="style" 时,不支持) |
|||
- 修复 thumbnail 不存在仍然占位的 bug |
|||
## 1.1.7(2021-05-12) |
|||
- 新增 组件示例地址 |
|||
## 1.1.6(2021-02-04) |
|||
- 调整为uni_modules目录规范 |
@ -0,0 +1,271 @@ |
|||
<template> |
|||
<view class="uni-card" :class="{ 'uni-card--full': isFull, 'uni-card--shadow': isShadow,'uni-card--border':border}" |
|||
:style="{'margin':isFull?0:margin,'padding':spacing,'box-shadow':isShadow?shadow:''}"> |
|||
<!-- 封面 --> |
|||
<slot name="cover"> |
|||
<view v-if="cover" class="uni-card__cover"> |
|||
<image class="uni-card__cover-image" mode="widthFix" @click="onClick('cover')" :src="cover"></image> |
|||
</view> |
|||
</slot> |
|||
<slot name="title"> |
|||
<view v-if="title || extra" class="uni-card__header"> |
|||
<!-- 卡片标题 --> |
|||
<view class="uni-card__header-box" @click="onClick('title')"> |
|||
<view v-if="thumbnail" class="uni-card__header-avatar"> |
|||
<image class="uni-card__header-avatar-image" :src="thumbnail" mode="aspectFit" /> |
|||
</view> |
|||
<view class="uni-card__header-content"> |
|||
<text class="uni-card__header-content-title uni-ellipsis">{{ title }}</text> |
|||
<text v-if="title&&subTitle" |
|||
class="uni-card__header-content-subtitle uni-ellipsis">{{ subTitle }}</text> |
|||
</view> |
|||
</view> |
|||
<view class="uni-card__header-extra" @click="onClick('extra')"> |
|||
<text class="uni-card__header-extra-text">{{ extra }}</text> |
|||
</view> |
|||
</view> |
|||
</slot> |
|||
<!-- 卡片内容 --> |
|||
<view class="uni-card__content" :style="{padding:padding}" @click="onClick('content')"> |
|||
<slot></slot> |
|||
</view> |
|||
<view class="uni-card__actions" @click="onClick('actions')"> |
|||
<slot name="actions"></slot> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
/** |
|||
* Card 卡片 |
|||
* @description 卡片视图组件 |
|||
* @tutorial https://ext.dcloud.net.cn/plugin?id=22 |
|||
* @property {String} title 标题文字 |
|||
* @property {String} subTitle 副标题 |
|||
* @property {Number} padding 内容内边距 |
|||
* @property {Number} margin 卡片外边距 |
|||
* @property {Number} spacing 卡片内边距 |
|||
* @property {String} extra 标题额外信息 |
|||
* @property {String} cover 封面图(本地路径需要引入) |
|||
* @property {String} thumbnail 标题左侧缩略图 |
|||
* @property {Boolean} is-full = [true | false] 卡片内容是否通栏,为 true 时将去除padding值 |
|||
* @property {Boolean} is-shadow = [true | false] 卡片内容是否开启阴影 |
|||
* @property {String} shadow 卡片阴影 |
|||
* @property {Boolean} border 卡片边框 |
|||
* @event {Function} click 点击 Card 触发事件 |
|||
*/ |
|||
export default { |
|||
name: 'UniCard', |
|||
emits: ['click'], |
|||
props: { |
|||
title: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
subTitle: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
padding: { |
|||
type: String, |
|||
default: '10px' |
|||
}, |
|||
margin: { |
|||
type: String, |
|||
default: '15px' |
|||
}, |
|||
spacing: { |
|||
type: String, |
|||
default: '0 10px' |
|||
}, |
|||
extra: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
cover: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
thumbnail: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
isFull: { |
|||
// 内容区域是否通栏 |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
isShadow: { |
|||
// 是否开启阴影 |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
shadow: { |
|||
type: String, |
|||
default: '0px 0px 3px 1px rgba(0, 0, 0, 0.08)' |
|||
}, |
|||
border: { |
|||
type: Boolean, |
|||
default: true |
|||
} |
|||
}, |
|||
methods: { |
|||
onClick(type) { |
|||
this.$emit('click', type) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
$uni-border-3: #EBEEF5 !default; |
|||
$uni-shadow-base:0 0px 6px 1px rgba($color: #a5a5a5, $alpha: 0.2) !default; |
|||
$uni-main-color: #3a3a3a !default; |
|||
$uni-base-color: #6a6a6a !default; |
|||
$uni-secondary-color: #909399 !default; |
|||
$uni-spacing-sm: 8px !default; |
|||
$uni-border-color:$uni-border-3; |
|||
$uni-shadow: $uni-shadow-base; |
|||
$uni-card-title: 15px; |
|||
$uni-cart-title-color:$uni-main-color; |
|||
$uni-card-subtitle: 12px; |
|||
$uni-cart-subtitle-color:$uni-secondary-color; |
|||
$uni-card-spacing: 10px; |
|||
$uni-card-content-color: $uni-base-color; |
|||
|
|||
.uni-card { |
|||
margin: $uni-card-spacing; |
|||
padding: 0 $uni-spacing-sm; |
|||
border-radius: 4px; |
|||
overflow: hidden; |
|||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif; |
|||
background-color: #fff; |
|||
flex: 1; |
|||
|
|||
.uni-card__cover { |
|||
position: relative; |
|||
margin-top: $uni-card-spacing; |
|||
flex-direction: row; |
|||
overflow: hidden; |
|||
border-radius: 4px; |
|||
.uni-card__cover-image { |
|||
flex: 1; |
|||
// width: 100%; |
|||
/* #ifndef APP-PLUS */ |
|||
vertical-align: middle; |
|||
/* #endif */ |
|||
} |
|||
} |
|||
|
|||
.uni-card__header { |
|||
display: flex; |
|||
border-bottom: 1px $uni-border-color solid; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
padding: $uni-card-spacing; |
|||
overflow: hidden; |
|||
|
|||
.uni-card__header-box { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex: 1; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.uni-card__header-avatar { |
|||
width: 40px; |
|||
height: 40px; |
|||
overflow: hidden; |
|||
border-radius: 5px; |
|||
margin-right: $uni-card-spacing; |
|||
.uni-card__header-avatar-image { |
|||
flex: 1; |
|||
width: 40px; |
|||
height: 40px; |
|||
} |
|||
} |
|||
|
|||
.uni-card__header-content { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: column; |
|||
justify-content: center; |
|||
flex: 1; |
|||
// height: 40px; |
|||
overflow: hidden; |
|||
|
|||
.uni-card__header-content-title { |
|||
font-size: $uni-card-title; |
|||
color: $uni-cart-title-color; |
|||
// line-height: 22px; |
|||
} |
|||
|
|||
.uni-card__header-content-subtitle { |
|||
font-size: $uni-card-subtitle; |
|||
margin-top: 5px; |
|||
color: $uni-cart-subtitle-color; |
|||
} |
|||
} |
|||
|
|||
.uni-card__header-extra { |
|||
line-height: 12px; |
|||
|
|||
.uni-card__header-extra-text { |
|||
font-size: 12px; |
|||
color: $uni-cart-subtitle-color; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.uni-card__content { |
|||
padding: $uni-card-spacing; |
|||
font-size: 14px; |
|||
color: $uni-card-content-color; |
|||
line-height: 22px; |
|||
} |
|||
|
|||
.uni-card__actions { |
|||
font-size: 12px; |
|||
} |
|||
} |
|||
|
|||
.uni-card--border { |
|||
border-top: 1px solid $uni-border-color; |
|||
border-bottom: 1px solid $uni-border-color; |
|||
} |
|||
|
|||
.uni-card--shadow { |
|||
position: relative; |
|||
/* #ifndef APP-NVUE */ |
|||
box-shadow: $uni-shadow; |
|||
/* #endif */ |
|||
} |
|||
|
|||
.uni-card--full { |
|||
margin: 0; |
|||
border-left-width: 0; |
|||
border-left-width: 0; |
|||
border-radius: 0; |
|||
} |
|||
|
|||
/* #ifndef APP-NVUE */ |
|||
.uni-card--full:after { |
|||
border-radius: 0; |
|||
} |
|||
|
|||
/* #endif */ |
|||
.uni-ellipsis { |
|||
/* #ifndef APP-NVUE */ |
|||
overflow: hidden; |
|||
white-space: nowrap; |
|||
text-overflow: ellipsis; |
|||
/* #endif */ |
|||
/* #ifdef APP-NVUE */ |
|||
lines: 1; |
|||
/* #endif */ |
|||
} |
|||
</style> |
@ -0,0 +1,90 @@ |
|||
{ |
|||
"id": "uni-card", |
|||
"displayName": "uni-card 卡片", |
|||
"version": "1.3.1", |
|||
"description": "Card 组件,提供常见的卡片样式。", |
|||
"keywords": [ |
|||
"uni-ui", |
|||
"uniui", |
|||
"card", |
|||
"", |
|||
"卡片" |
|||
], |
|||
"repository": "https://github.com/dcloudio/uni-ui", |
|||
"engines": { |
|||
"HBuilderX": "" |
|||
}, |
|||
"directories": { |
|||
"example": "../../temps/example_temps" |
|||
}, |
|||
"dcloudext": { |
|||
"category": [ |
|||
"前端组件", |
|||
"通用组件" |
|||
], |
|||
"sale": { |
|||
"regular": { |
|||
"price": "0.00" |
|||
}, |
|||
"sourcecode": { |
|||
"price": "0.00" |
|||
} |
|||
}, |
|||
"contact": { |
|||
"qq": "" |
|||
}, |
|||
"declaration": { |
|||
"ads": "无", |
|||
"data": "无", |
|||
"permissions": "无" |
|||
}, |
|||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" |
|||
}, |
|||
"uni_modules": { |
|||
"dependencies": [ |
|||
"uni-icons", |
|||
"uni-scss" |
|||
], |
|||
"encrypt": [], |
|||
"platforms": { |
|||
"cloud": { |
|||
"tcb": "y", |
|||
"aliyun": "y" |
|||
}, |
|||
"client": { |
|||
"App": { |
|||
"app-vue": "y", |
|||
"app-nvue": "y" |
|||
}, |
|||
"H5-mobile": { |
|||
"Safari": "y", |
|||
"Android Browser": "y", |
|||
"微信浏览器(Android)": "y", |
|||
"QQ浏览器(Android)": "y" |
|||
}, |
|||
"H5-pc": { |
|||
"Chrome": "y", |
|||
"IE": "y", |
|||
"Edge": "y", |
|||
"Firefox": "y", |
|||
"Safari": "y" |
|||
}, |
|||
"小程序": { |
|||
"微信": "y", |
|||
"阿里": "y", |
|||
"百度": "y", |
|||
"字节跳动": "y", |
|||
"QQ": "y" |
|||
}, |
|||
"快应用": { |
|||
"华为": "u", |
|||
"联盟": "u" |
|||
}, |
|||
"Vue": { |
|||
"vue2": "y", |
|||
"vue3": "y" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |