.
diff --git a/README.MD b/README.MD
new file mode 100644
index 0000000..5b6f0e6
--- /dev/null
+++ b/README.MD
@@ -0,0 +1,126 @@
+
+
+🔥🔥🔥「e家宜业」开源物业管理系统
+
+ 无加密,无阉割,喜欢的话就点右上角 "Star" 支持一下吧,每一个"Star",都是我们持续更新的动力!
+
+
+## 项目介绍
+
+「e家宜业」是一整套智慧物业解决方案。实现了微信公众号、小程序、PC、H5、智能硬件多端打通,旨在提升物业公司效率、规范物业服务流程、提升物业服务满意度、加强小区智慧化建设、便捷业主服务。 后端采用Koa + Typescript轻量级构建,支持分布式部署;前端使用vue + view-design开发。
+
+希望通过开源促进产品的发展,能够结识有趣的灵魂,有想法的朋友。
+
+官网地址:[https://ejyy.chowa.cn](https://ejyy.chowa.cn)
+QQ交流群:786743759
+
+## 技术亮点
+
+* 自主独立研发,无阉割、无加密、真正的开源
+* web中台页面采用view-design开发,清爽易用
+* 轻量级开发方案,借助node.js高io、异步、cluster等特性
+* 完善的权限管理,精细到每一个菜单
+* 对接公众号和小程序,数据打通
+* 精细的ui界面和流畅的交互动画
+* 前后分离,二次开发方便
+* 支持定时任务和长连接
+* 可对接小区硬件设备
+
+## 页面展示
+
+### web端
+
+
+
+
+
+
+
+
+
+
+
+
+### 业主端
+
+
+
+
+
+
+
+
+
+
+
+
+### 员工端
+
+
+
+
+
+
+
+
+## 如何部署
+
+### 服务器环境推荐要求
+* Nignx
+* Node.js 12.1.0
+* MySQL 5.7
+* Redis
+
+### 部署文档
+- [部署前的准备](resource/README.MD)
+- [服务端部署](server/README.MD)
+- [web端部署](web/README.MD)
+- [业主端小程序](ower-mp/README.MD)
+- [员工端小程序](employee-mp/README.MD)
+- [公众号模板消息](oa/README.MD)
+- [短信消息模板](sms/README.MD)
+- [小区硬件接入](iot/README.MD)
+## 演示
+
+### web中台
+> 演示版为saas多物业公司版本,小区开通上略有差异
+
+[https://pc.ejyy.chowa.cn](https://pc.ejyy.chowa.cn)
+
+账号/密码:guest/guest123
+
+### 微信公众号
+
+
+### 业主小程序
+
+
+### 物业员工小程序
+
+
+
+## 开源版使用说明
+
+1.允许用于个人学习、教学案例、公益事业;
+
+2.如果商用必须保留版权信息(请尊重开源,开源不易),请自觉遵守,未经授权修改版权信息后自负,如果需要去版权请进群联系管理员或者微信扫描下方二维码;
+
+3.禁止将本项目的代码和资源进行任何形式的出售,产生的一切任何后果责任由侵权者自负。
+
+
+## 参与开发
+
+[欢迎反馈问题](https://github.com/chowa/ejyy/issues)
+[欢迎提交代码](https://github.com/chowa/ejyy/pulls)
+
+## 定制和二次开发
+
+>请加微信,请备注来意
+
+
+
+## 支持
+
+开源不易,欢迎给我打赏 ———— 以激励我持续更新和维护项目
+
+
diff --git a/employee-mp/.prettierignore b/employee-mp/.prettierignore
new file mode 100644
index 0000000..225c381
--- /dev/null
+++ b/employee-mp/.prettierignore
@@ -0,0 +1,2 @@
+*.png
+*.jpg
diff --git a/employee-mp/README.MD b/employee-mp/README.MD
new file mode 100644
index 0000000..1b9ac1c
--- /dev/null
+++ b/employee-mp/README.MD
@@ -0,0 +1,34 @@
+## 「e家宜业」员工端小程序
+
+> 请将本目录下`project.config.json`中的appid修改为对应的appid后发布,发布前记得前往小程序控制台配置api、上传下载白名单
+
+### 配置文件
+
+详见本目录下`src/config.js`
+
+```js
+// 服务端域名
+export const API_HOST = '';
+
+// 对象存储域名
+export const ASSETS_HOST = '';
+
+// 本地存储 token 字段名
+export const TOKEN_NAME = 'EJYY-TOKEN';
+
+// 本地存储 用户id 字段名
+export const USER_ID = 'USER_ID';
+
+// 服务端权限认证字段(修改请修改服务端配置 token.pc)
+export const AUTH_HEADER_NAME = 'ejyy-pc-token';
+
+// 微信最低版本
+export const WECHAT_VERSION = '7.0.0';
+
+// 微信sdk最低版本
+export const SDK_VERSION = '2.16.0';
+
+// 小程序版本
+export const VERSION = '1.1.7';
+
+```
diff --git a/employee-mp/package.json b/employee-mp/package.json
new file mode 100644
index 0000000..e9dc723
--- /dev/null
+++ b/employee-mp/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "ejyy-employee-mp",
+ "version": "1.0.0",
+ "description": "员工端小程序",
+ "author": "jixuecong@chowa.cn",
+ "scripts": {
+ "lint": "prettier --write src/*.js src/* src/**/* src/**/**/* src/**/**/**/* src/**/**/**/**/*"
+ }
+}
diff --git a/employee-mp/prettier.config.js b/employee-mp/prettier.config.js
new file mode 100644
index 0000000..48389cf
--- /dev/null
+++ b/employee-mp/prettier.config.js
@@ -0,0 +1,32 @@
+module.exports = {
+ printWidth: 120,
+ tabWidth: 4,
+ useTabs: false,
+ singleQuote: true,
+ semi: true,
+ trailingComma: 'none',
+ bracketSpacing: true,
+ jsxBracketSameLine: false,
+ arrowParens: 'avoid',
+ htmlWhitespaceSensitivity: 'ignore',
+ overrides: [
+ {
+ files: '*.wxml',
+ options: {
+ parser: 'html'
+ }
+ },
+ {
+ files: '*.wxss',
+ options: {
+ parser: 'css'
+ }
+ },
+ {
+ files: '*.wxs',
+ options: {
+ 'parser': 'babel'
+ }
+ }
+ ]
+};
diff --git a/employee-mp/project.config.json b/employee-mp/project.config.json
new file mode 100644
index 0000000..0cf8013
--- /dev/null
+++ b/employee-mp/project.config.json
@@ -0,0 +1,74 @@
+{
+ "packOptions": {
+ "ignore": []
+ },
+ "miniprogramRoot": "src/",
+ "setting": {
+ "urlCheck": false,
+ "es6": true,
+ "enhance": false,
+ "postcss": true,
+ "preloadBackgroundData": false,
+ "minified": true,
+ "newFeature": true,
+ "coverView": true,
+ "nodeModules": false,
+ "autoAudits": false,
+ "showShadowRootInWxmlPanel": false,
+ "scopeDataCheck": false,
+ "uglifyFileName": true,
+ "checkInvalidKey": true,
+ "checkSiteMap": true,
+ "uploadWithSourceMap": true,
+ "compileHotReLoad": false,
+ "lazyloadPlaceholderEnable": false,
+ "useMultiFrameRuntime": true,
+ "useApiHook": true,
+ "useApiHostProcess": true,
+ "babelSetting": {
+ "ignore": [],
+ "disablePlugins": [],
+ "outputPath": ""
+ },
+ "enableEngineNative": false,
+ "useIsolateContext": true,
+ "userConfirmedBundleSwitch": false,
+ "packNpmManually": false,
+ "packNpmRelationList": [],
+ "minifyWXSS": true,
+ "disableUseStrict": false,
+ "showES6CompileOption": false,
+ "useCompilerPlugins": false
+ },
+ "compileType": "miniprogram",
+ "libVersion": "2.16.0",
+ "appid": "wx66c9783ee867a8cb",
+ "projectname": "employee-mp@by ejyy",
+ "debugOptions": {
+ "hidedInDevtools": []
+ },
+ "isGameTourist": false,
+ "simulatorType": "wechat",
+ "simulatorPluginLibVersion": {},
+ "condition": {
+ "search": {
+ "list": []
+ },
+ "conversation": {
+ "list": []
+ },
+ "plugin": {
+ "list": []
+ },
+ "game": {
+ "currentL": -1,
+ "list": []
+ },
+ "gamePlugin": {
+ "list": []
+ },
+ "miniprogram": {
+ "list": []
+ }
+ }
+}
diff --git a/employee-mp/project.private.config.json b/employee-mp/project.private.config.json
new file mode 100644
index 0000000..04d8e3e
--- /dev/null
+++ b/employee-mp/project.private.config.json
@@ -0,0 +1,54 @@
+{
+ "setting": {},
+ "condition": {
+ "plugin": {
+ "list": []
+ },
+ "game": {
+ "list": []
+ },
+ "gamePlugin": {
+ "list": []
+ },
+ "miniprogram": {
+ "list": [
+ {
+ "name": "pages/home/index",
+ "pathName": "pages/home/index",
+ "query": "",
+ "scene": 1011
+ },
+ {
+ "name": "pages/vistor/index",
+ "pathName": "pages/vistor/index",
+ "query": "",
+ "scene": null
+ },
+ {
+ "name": "pages/home/repair",
+ "pathName": "pages/home/repair",
+ "query": "id=2",
+ "scene": null
+ },
+ {
+ "name": "pages/home/index",
+ "pathName": "pages/home/index",
+ "query": "",
+ "scene": 1011
+ },
+ {
+ "name": "疫情",
+ "pathName": "pages/epidemic/index",
+ "query": "",
+ "scene": 1011
+ },
+ {
+ "name": "",
+ "pathName": "pages/material/index",
+ "query": "id=1",
+ "scene": null
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/employee-mp/src/app.js b/employee-mp/src/app.js
new file mode 100644
index 0000000..94fa1f7
--- /dev/null
+++ b/employee-mp/src/app.js
@@ -0,0 +1,163 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import utils from './utils/index';
+
+App({
+ data: {
+ globalFetching: true,
+ userInfo: {
+ access: []
+ },
+ postInfo: {
+ community_list: [],
+ default_community_id: null
+ },
+ systemInfo: {},
+ navBarHeight: 'auto'
+ },
+
+ onLaunch() {
+ // 检查更新
+ this.checkUpdate();
+
+ // 适配
+ this.adaptive();
+
+ // 检查网络
+ this.checkNetwork();
+ },
+
+ onShow(opts) {
+ if (utils.storage.isLogin()) {
+ this.getUserInfo();
+ } else {
+ const query = [];
+ for (let key in opts.query) {
+ query.push(`${key}=${opts.query[key]}`);
+ }
+ const redirect = encodeURIComponent(`/${opts.path}${query.length ? '?' : ''}${query.join('&')}`);
+
+ return wx.redirectTo({
+ url: `/pages/login/index?redirect=${redirect}`
+ });
+ }
+ },
+
+ onPageNotFound() {
+ wx.redirectTo({
+ url: '/pages/error/general'
+ });
+ },
+
+ checkUpdate() {
+ const updateManager = wx.getUpdateManager();
+
+ updateManager.onCheckForUpdate(res => {
+ if (!res.hasUpdate) {
+ return;
+ }
+
+ wx.showLoading({
+ title: '版本更新中…',
+ mask: true
+ });
+
+ updateManager.onUpdateReady(() => {
+ wx.hideLoading();
+ wx.showModal({
+ title: '更新提示',
+ content: '新版本已经准备好,是否重启应用?',
+ success(res) {
+ if (res.confirm) {
+ updateManager.applyUpdate();
+ }
+ }
+ });
+ });
+
+ updateManager.onUpdateFailed(() => {
+ wx.hideLoading();
+ wx.showToast({
+ title: '更新失败',
+ icon: 'error'
+ });
+ });
+ });
+ },
+
+ adaptive() {
+ const systemInfo = wx.getSystemInfoSync();
+
+ // 导航胶囊
+ const { top, height } = wx.getMenuButtonBoundingClientRect();
+
+ this.data.systemInfo = systemInfo;
+ this.data.systemInfo.navBarHeight = (top - systemInfo.statusBarHeight) * 2 + height;
+ },
+
+ checkNetwork() {
+ wx.getNetworkType({
+ success: res => {
+ // 未连接网络
+ if (res.networkType === 'none') {
+ wx.redirectTo({ url: '/pages/error/network' });
+ }
+ }
+ });
+ },
+
+ getUserInfo() {
+ return utils
+ .request({
+ url: '/user/info',
+ method: 'get'
+ })
+ .then(res => {
+ this.updateData({
+ userInfo: res.data.userInfo,
+ postInfo: res.data.postInfo,
+ globalFetching: false
+ });
+ });
+ },
+
+ onDataFuns: [],
+
+ on(event, fn) {
+ if (event === 'data') {
+ this.onDataFuns.push(fn);
+ this.dataEmitter();
+ }
+ },
+ off(event, fn) {
+ if (event === 'data') {
+ this.onDataFuns.splice(
+ this.onDataFuns.findIndex(rfn => fn === rfn),
+ 1
+ );
+ }
+ },
+ dataEmitter() {
+ this.onDataFuns.forEach(fn => {
+ fn(this.data);
+ });
+ },
+ updateData(data) {
+ this.data = {
+ ...this.data,
+ ...data
+ };
+
+ this.dataEmitter();
+ }
+});
diff --git a/employee-mp/src/app.json b/employee-mp/src/app.json
new file mode 100644
index 0000000..8e91f76
--- /dev/null
+++ b/employee-mp/src/app.json
@@ -0,0 +1,58 @@
+{
+ "entryPagePath": "pages/home/index",
+ "pages": [
+ "pages/home/index",
+ "pages/login/index",
+ "pages/error/network",
+ "pages/error/general",
+ "pages/repair/index",
+ "pages/repair/detail",
+ "pages/complain/index",
+ "pages/complain/detail",
+ "pages/colleague/index",
+ "pages/colleague/detail",
+ "pages/epidemic/index",
+ "pages/vistor/index",
+ "pages/mission/index",
+ "pages/mission/detail",
+ "pages/mission/submit",
+ "pages/mission/report",
+ "pages/ower/index",
+ "pages/ower/detail",
+ "pages/fitment/index",
+ "pages/move_car/index",
+ "pages/move_car/concat",
+ "pages/inform/index",
+ "pages/party/index",
+ "pages/meeting/index",
+ "pages/sign/begin",
+ "pages/sign/finish",
+ "pages/leave/approve",
+ "pages/leave/index",
+ "pages/refound/approve",
+ "pages/refound/index",
+ "pages/purchase/index",
+ "pages/purchase/approve",
+ "pages/party/detail",
+ "pages/inform/detail",
+ "pages/leave/detail",
+ "pages/purchase/detail",
+ "pages/refound/detail",
+ "pages/refound/item",
+ "pages/purchase/item",
+ "pages/material/index"
+ ],
+ "window": {
+ "navigationBarBackgroundColor": "#ffffff",
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "e家宜业物业端",
+ "backgroundColor": "#f7f8fa",
+ "backgroundTextStyle": "light"
+ },
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于上下班打卡功能"
+ }
+ },
+ "sitemapLocation": "sitemap.json"
+}
diff --git a/employee-mp/src/app.wxss b/employee-mp/src/app.wxss
new file mode 100644
index 0000000..272f4ed
--- /dev/null
+++ b/employee-mp/src/app.wxss
@@ -0,0 +1,53 @@
+view,
+image,
+page,
+input,
+textarea,
+swiper {
+ box-sizing: border-box;
+ margin: 0;
+ padding: 0;
+}
+
+video,
+image {
+ display: block;
+}
+
+.placeholder {
+ color: #c8c9cc;
+}
+
+.section {
+ margin-top: 20px;
+}
+
+.btn-ml {
+ margin-left: 10px;
+}
+
+.container {
+ min-height: 100vh;
+ background: #f7f8fc;
+ position: relative;
+ overflow: hidden;
+ -webkit-font-smoothing: antialiased;
+ padding-bottom: constant(safe-area-inset-bottom);
+ padding-bottom: env(safe-area-inset-bottom);
+}
+
+image {
+ width: 100%;
+ height: 100%;
+}
+
+.load-more {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 16px 0;
+}
+
+.text-lighter {
+ color: #999;
+}
diff --git a/employee-mp/src/assets/common/chowa.png b/employee-mp/src/assets/common/chowa.png
new file mode 100644
index 0000000..02c658c
Binary files /dev/null and b/employee-mp/src/assets/common/chowa.png differ
diff --git a/employee-mp/src/assets/common/logo.png b/employee-mp/src/assets/common/logo.png
new file mode 100644
index 0000000..353e5ea
Binary files /dev/null and b/employee-mp/src/assets/common/logo.png differ
diff --git a/employee-mp/src/assets/login/welcome.jpg b/employee-mp/src/assets/login/welcome.jpg
new file mode 100644
index 0000000..1839ee8
Binary files /dev/null and b/employee-mp/src/assets/login/welcome.jpg differ
diff --git a/employee-mp/src/assets/recommand.jpg b/employee-mp/src/assets/recommand.jpg
new file mode 100644
index 0000000..9990534
Binary files /dev/null and b/employee-mp/src/assets/recommand.jpg differ
diff --git a/employee-mp/src/components/action-sheet/index.js b/employee-mp/src/components/action-sheet/index.js
new file mode 100644
index 0000000..969ff68
--- /dev/null
+++ b/employee-mp/src/components/action-sheet/index.js
@@ -0,0 +1,74 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { button } from '../mixins/button';
+import { openType } from '../mixins/open-type';
+CwComponent({
+ mixins: [button, openType],
+ props: {
+ show: Boolean,
+ title: String,
+ cancelText: String,
+ description: String,
+ round: {
+ type: Boolean,
+ value: true
+ },
+ zIndex: {
+ type: Number,
+ value: 100
+ },
+ actions: {
+ type: Array,
+ value: []
+ },
+ overlay: {
+ type: Boolean,
+ value: true
+ },
+ closeOnClickOverlay: {
+ type: Boolean,
+ value: true
+ },
+ closeOnClickAction: {
+ type: Boolean,
+ value: true
+ },
+ safeAreaInsetBottom: {
+ type: Boolean,
+ value: true
+ }
+ },
+ methods: {
+ onSelect(event) {
+ const { index } = event.currentTarget.dataset;
+ const item = this.data.actions[index];
+ if (item && !item.disabled && !item.loading) {
+ this.$emit('select', item);
+ if (this.data.closeOnClickAction) {
+ this.onClose();
+ }
+ }
+ },
+ onCancel() {
+ this.$emit('cancel');
+ },
+ onClose() {
+ this.$emit('close');
+ },
+ onClickOverlay() {
+ this.$emit('click-overlay');
+ this.onClose();
+ }
+ }
+});
diff --git a/employee-mp/src/components/action-sheet/index.json b/employee-mp/src/components/action-sheet/index.json
new file mode 100644
index 0000000..87be8cb
--- /dev/null
+++ b/employee-mp/src/components/action-sheet/index.json
@@ -0,0 +1,8 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index",
+ "cw-popup": "../popup/index",
+ "cw-loading": "../loading/index"
+ }
+}
diff --git a/employee-mp/src/components/action-sheet/index.wxml b/employee-mp/src/components/action-sheet/index.wxml
new file mode 100644
index 0000000..53ac4fa
--- /dev/null
+++ b/employee-mp/src/components/action-sheet/index.wxml
@@ -0,0 +1,65 @@
+
+
+
+
+
+ {{ description }}
+
+
+
+
+
+ {{ item.name }}
+ {{ item.subname }}
+
+
+
+
+
+
+
+
+ {{ cancelText }}
+
+
+
diff --git a/employee-mp/src/components/action-sheet/index.wxss b/employee-mp/src/components/action-sheet/index.wxss
new file mode 100644
index 0000000..8a694ed
--- /dev/null
+++ b/employee-mp/src/components/action-sheet/index.wxss
@@ -0,0 +1,80 @@
+@import '../common/index.wxss';
+
+.cw-action-sheet {
+ max-height: 90% !important;
+ color: #323233;
+}
+
+.cw-action-sheet__cancel,
+.cw-action-sheet__item {
+ padding: 14px 16px;
+ text-align: center;
+ font-size: 16px;
+ line-height: 22px;
+ background-color: #fff;
+}
+
+.cw-action-sheet__cancel--hover,
+.cw-action-sheet__item--hover {
+ background-color: #f2f3f5;
+}
+
+.cw-action-sheet__cancel:after,
+.cw-action-sheet__item:after {
+ border-width: 0;
+}
+
+.cw-action-sheet__cancel {
+ color: #646566;
+}
+
+.cw-action-sheet__gap {
+ display: block;
+ height: 8px;
+ background-color: #f7f8fa;
+}
+
+.cw-action-sheet__item--disabled {
+ color: #c8c9cc;
+}
+
+.cw-action-sheet__item--disabled.cw-action-sheet__item--hover {
+ background-color: #fff;
+}
+
+.cw-action-sheet__subname {
+ margin-top: 8px;
+ font-size: 12px;
+ color: #969799;
+ line-height: 20px;
+}
+
+.cw-action-sheet__header {
+ text-align: center;
+ font-weight: 500;
+ font-size: 16px;
+ line-height: 48px;
+}
+
+.cw-action-sheet__description {
+ text-align: center;
+ padding: 20px 16px;
+ color: #969799;
+ font-size: 14px;
+ line-height: 20px;
+}
+
+.cw-action-sheet__close {
+ position: absolute !important;
+ top: 0;
+ right: 0;
+ line-height: inherit !important;
+ padding: 0 16px;
+ font-size: 22px !important;
+ color: #c8c9cc;
+}
+
+.cw-action-sheet__loading {
+ display: -webkit-flex !important;
+ display: flex !important;
+}
diff --git a/employee-mp/src/components/button/index.js b/employee-mp/src/components/button/index.js
new file mode 100644
index 0000000..4c65d37
--- /dev/null
+++ b/employee-mp/src/components/button/index.js
@@ -0,0 +1,70 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { button } from '../mixins/button';
+import { openType } from '../mixins/open-type';
+import { canIUseFormFieldButton } from '../common/version';
+const mixins = [button, openType];
+if (canIUseFormFieldButton()) {
+ mixins.push('wx://form-field-button');
+}
+CwComponent({
+ mixins,
+ classes: ['hover-class', 'loading-class'],
+ data: {
+ baseStyle: ''
+ },
+ props: {
+ formType: String,
+ icon: String,
+ classPrefix: {
+ type: String,
+ value: 'cw-icon'
+ },
+ plain: Boolean,
+ block: Boolean,
+ round: Boolean,
+ square: Boolean,
+ loading: Boolean,
+ hairline: Boolean,
+ disabled: Boolean,
+ loadingText: String,
+ customStyle: String,
+ loadingType: {
+ type: String,
+ value: 'circular'
+ },
+ type: {
+ type: String,
+ value: 'default'
+ },
+ dataset: null,
+ size: {
+ type: String,
+ value: 'normal'
+ },
+ loadingSize: {
+ type: String,
+ value: '20px'
+ },
+ color: String
+ },
+ methods: {
+ onClick() {
+ if (!this.data.loading) {
+ this.$emit('click');
+ }
+ },
+ noop() {}
+ }
+});
diff --git a/employee-mp/src/components/button/index.json b/employee-mp/src/components/button/index.json
new file mode 100644
index 0000000..8b00ed6
--- /dev/null
+++ b/employee-mp/src/components/button/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index",
+ "cw-loading": "../loading/index"
+ }
+}
diff --git a/employee-mp/src/components/button/index.wxml b/employee-mp/src/components/button/index.wxml
new file mode 100644
index 0000000..a237571
--- /dev/null
+++ b/employee-mp/src/components/button/index.wxml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+ {{ loadingText }}
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/button/index.wxs b/employee-mp/src/components/button/index.wxs
new file mode 100644
index 0000000..76c5358
--- /dev/null
+++ b/employee-mp/src/components/button/index.wxs
@@ -0,0 +1,38 @@
+var style = require('../wxs/style.wxs');
+
+function rootStyle(data) {
+ if (!data.color) {
+ return data.customStyle;
+ }
+
+ var properties = {
+ color: data.plain ? data.color : '#fff',
+ background: data.plain ? null : data.color
+ };
+
+ // hide border when color is linear-gradient
+ if (data.color.indexOf('gradient') !== -1) {
+ properties.border = 0;
+ } else {
+ properties['border-color'] = data.color;
+ }
+
+ return style([properties, data.customStyle]);
+}
+
+function loadingColor(data) {
+ if (data.plain) {
+ return data.color ? data.color : '#c9c9c9';
+ }
+
+ if (data.type === 'default') {
+ return '#c9c9c9';
+ }
+
+ return '#fff';
+}
+
+module.exports = {
+ rootStyle: rootStyle,
+ loadingColor: loadingColor
+};
diff --git a/employee-mp/src/components/button/index.wxss b/employee-mp/src/components/button/index.wxss
new file mode 100644
index 0000000..d3fdf18
--- /dev/null
+++ b/employee-mp/src/components/button/index.wxss
@@ -0,0 +1,180 @@
+@import '../common/index.wxss';
+
+.cw-button {
+ position: relative;
+ display: -webkit-inline-flex;
+ display: inline-flex;
+ -webkit-align-items: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ box-sizing: border-box;
+ padding: 0;
+ text-align: center;
+ vertical-align: middle;
+ -webkit-appearance: none;
+ -webkit-text-size-adjust: 100%;
+ height: 44px;
+ line-height: 20px;
+ font-size: 16px;
+ transition: opacity 0.2s;
+ border-radius: 2px;
+}
+
+.cw-button:before {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ width: 100%;
+ height: 100%;
+ border: inherit;
+ border-radius: inherit;
+ -webkit-transform: translate(-50%, -50%);
+ transform: translate(-50%, -50%);
+ opacity: 0;
+ content: ' ';
+ background-color: #000;
+ border-color: #000;
+}
+
+.cw-button:after {
+ border-width: 0;
+}
+
+.cw-button--active:before {
+ opacity: 0.15;
+}
+
+.cw-button--unclickable:after {
+ display: none;
+}
+
+.cw-button--default {
+ color: #323233;
+ background: #fff;
+ border: 1px solid #ebedf0;
+}
+
+.cw-button--primary {
+ color: #fff;
+ background: #07c160;
+ border: 1px solid #07c160;
+}
+
+.cw-button--info {
+ color: #fff;
+ background: #1989fa;
+ border: 1px solid #1989fa;
+}
+
+.cw-button--danger {
+ color: #fff;
+ background: #ee0a24;
+ border: 1px solid #ee0a24;
+}
+
+.cw-button--warning {
+ color: #fff;
+ background: #ff976a;
+ border: 1px solid #ff976a;
+}
+
+.cw-button--plain {
+ background: #fff;
+}
+
+.cw-button--plain.cw-button--primary {
+ color: #07c160;
+}
+
+.cw-button--plain.cw-button--info {
+ color: #1989fa;
+}
+
+.cw-button--plain.cw-button--danger {
+ color: #ee0a24;
+}
+
+.cw-button--plain.cw-button--warning {
+ color: #ff976a;
+}
+
+.cw-button--large {
+ width: 100%;
+ height: 50px;
+}
+
+.cw-button--normal {
+ padding: 0 15px;
+ font-size: 14px;
+}
+
+.cw-button--small {
+ min-width: 60px;
+ height: 30px;
+ padding: 0 8px;
+ font-size: 12px;
+}
+
+.cw-button--mini {
+ display: inline-block;
+ min-width: 50px;
+ height: 22px;
+ font-size: 10px;
+}
+
+.cw-button--mini + .cw-button--mini {
+ margin-left: 5px;
+}
+
+.cw-button--block {
+ display: -webkit-flex;
+ display: flex;
+ width: 100%;
+}
+
+.cw-button--round {
+ border-radius: 999px;
+}
+
+.cw-button--square {
+ border-radius: 0;
+}
+
+.cw-button--disabled {
+ opacity: 0.5;
+}
+
+.cw-button__text {
+ display: inline;
+}
+
+.cw-button__icon + .cw-button__text:not(:empty),
+.cw-button__loading-text {
+ margin-left: 4px;
+}
+
+.cw-button__icon {
+ min-width: 1em;
+ line-height: inherit !important;
+ vertical-align: top;
+}
+
+.cw-button--hairline {
+ padding-top: 1px;
+ border-width: 0;
+}
+
+.cw-button--hairline:after {
+ border-color: inherit;
+ border-width: 1px;
+ border-radius: 4px;
+}
+
+.cw-button--hairline.cw-button--round:after {
+ border-radius: 999px;
+}
+
+.cw-button--hairline.cw-button--square:after {
+ border-radius: 0;
+}
diff --git a/employee-mp/src/components/calendar/calendar.wxml b/employee-mp/src/components/calendar/calendar.wxml
new file mode 100644
index 0000000..64825bb
--- /dev/null
+++ b/employee-mp/src/components/calendar/calendar.wxml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/calendar/components/header/index.js b/employee-mp/src/components/calendar/components/header/index.js
new file mode 100644
index 0000000..ebbb18d
--- /dev/null
+++ b/employee-mp/src/components/calendar/components/header/index.js
@@ -0,0 +1,28 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../../../common/component';
+CwComponent({
+ props: {
+ title: {
+ type: String,
+ value: '日期选择'
+ },
+ subtitle: String,
+ showTitle: Boolean,
+ showSubtitle: Boolean
+ },
+ data: {
+ weekdays: ['日', '一', '二', '三', '四', '五', '六']
+ },
+ methods: {}
+});
diff --git a/employee-mp/src/components/calendar/components/header/index.json b/employee-mp/src/components/calendar/components/header/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/calendar/components/header/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/calendar/components/header/index.wxml b/employee-mp/src/components/calendar/components/header/index.wxml
new file mode 100644
index 0000000..242fbe6
--- /dev/null
+++ b/employee-mp/src/components/calendar/components/header/index.wxml
@@ -0,0 +1,16 @@
+
diff --git a/employee-mp/src/components/calendar/components/header/index.wxss b/employee-mp/src/components/calendar/components/header/index.wxss
new file mode 100644
index 0000000..9f06053
--- /dev/null
+++ b/employee-mp/src/components/calendar/components/header/index.wxss
@@ -0,0 +1,37 @@
+@import '../../../common/index.wxss';
+
+.cw-calendar__header {
+ -webkit-flex-shrink: 0;
+ flex-shrink: 0;
+ box-shadow: 0 2px 10px rgba(125, 126, 128, 0.16);
+}
+
+.cw-calendar__header-subtitle,
+.cw-calendar__header-title {
+ text-align: center;
+ height: 44px;
+ font-weight: 500;
+ line-height: 44px;
+}
+
+.cw-calendar__header-title + .cw-calendar__header-title,
+.cw-calendar__header-title:empty {
+ display: none;
+}
+
+.cw-calendar__header-title:empty + .cw-calendar__header-title {
+ display: block !important;
+}
+
+.cw-calendar__weekdays {
+ display: -webkit-flex;
+ display: flex;
+}
+
+.cw-calendar__weekday {
+ -webkit-flex: 1;
+ flex: 1;
+ text-align: center;
+ font-size: 12px;
+ line-height: 30px;
+}
diff --git a/employee-mp/src/components/calendar/components/month/index.js b/employee-mp/src/components/calendar/components/month/index.js
new file mode 100644
index 0000000..ee50515
--- /dev/null
+++ b/employee-mp/src/components/calendar/components/month/index.js
@@ -0,0 +1,160 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../../../common/component';
+import { getMonthEndDay, compareDay, getPrevDay, getNextDay } from '../../utils';
+CwComponent({
+ props: {
+ date: {
+ type: null,
+ observer: 'setDays'
+ },
+ type: {
+ type: String,
+ observer: 'setDays'
+ },
+ color: String,
+ minDate: {
+ type: null,
+ observer: 'setDays'
+ },
+ maxDate: {
+ type: null,
+ observer: 'setDays'
+ },
+ showMark: Boolean,
+ rowHeight: null,
+ formatter: {
+ type: null,
+ observer: 'setDays'
+ },
+ currentDate: {
+ type: null,
+ observer: 'setDays'
+ },
+ allowSameDay: Boolean,
+ showSubtitle: Boolean,
+ showMonthTitle: Boolean
+ },
+ data: {
+ visible: true,
+ days: []
+ },
+ methods: {
+ onClick(event) {
+ const { index } = event.currentTarget.dataset;
+ const item = this.data.days[index];
+ if (item.type !== 'disabled') {
+ this.$emit('click', item);
+ }
+ },
+ setDays() {
+ const days = [];
+ const startDate = new Date(this.data.date);
+ const year = startDate.getFullYear();
+ const month = startDate.getMonth();
+ const totalDay = getMonthEndDay(startDate.getFullYear(), startDate.getMonth() + 1);
+ for (let day = 1; day <= totalDay; day++) {
+ const date = new Date(year, month, day);
+ const type = this.getDayType(date);
+ let config = {
+ date,
+ type,
+ text: day,
+ bottomInfo: this.getBottomInfo(type)
+ };
+ if (this.data.formatter) {
+ config = this.data.formatter(config);
+ }
+ days.push(config);
+ }
+ this.setData({ days });
+ },
+ getMultipleDayType(day) {
+ const { currentDate } = this.data;
+ if (!Array.isArray(currentDate)) {
+ return '';
+ }
+ const isSelected = date => currentDate.some(item => compareDay(item, date) === 0);
+ if (isSelected(day)) {
+ const prevDay = getPrevDay(day);
+ const nextDay = getNextDay(day);
+ const prevSelected = isSelected(prevDay);
+ const nextSelected = isSelected(nextDay);
+ if (prevSelected && nextSelected) {
+ return 'multiple-middle';
+ }
+ if (prevSelected) {
+ return 'end';
+ }
+ return nextSelected ? 'start' : 'multiple-selected';
+ }
+ return '';
+ },
+ getRangeDayType(day) {
+ const { currentDate, allowSameDay } = this.data;
+ if (!Array.isArray(currentDate)) {
+ return;
+ }
+ const [startDay, endDay] = currentDate;
+ if (!startDay) {
+ return;
+ }
+ const compareToStart = compareDay(day, startDay);
+ if (!endDay) {
+ return compareToStart === 0 ? 'start' : '';
+ }
+ const compareToEnd = compareDay(day, endDay);
+ if (compareToStart === 0 && compareToEnd === 0 && allowSameDay) {
+ return 'start-end';
+ }
+ if (compareToStart === 0) {
+ return 'start';
+ }
+ if (compareToEnd === 0) {
+ return 'end';
+ }
+ if (compareToStart > 0 && compareToEnd < 0) {
+ return 'middle';
+ }
+ },
+ getDayType(day) {
+ const { type, minDate, maxDate, currentDate } = this.data;
+ if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
+ return 'disabled';
+ }
+ if (type === 'single') {
+ return compareDay(day, currentDate) === 0 ? 'selected' : '';
+ }
+ if (type === 'multiple') {
+ return this.getMultipleDayType(day);
+ }
+ /* istanbul ignore else */
+ if (type === 'range') {
+ return this.getRangeDayType(day);
+ }
+ },
+ getBottomInfo(type) {
+ if (this.data.type === 'range') {
+ if (type === 'start') {
+ return '开始';
+ }
+ if (type === 'end') {
+ return '结束';
+ }
+ if (type === 'start-end') {
+ return '开始/结束';
+ }
+ }
+ }
+ }
+});
diff --git a/employee-mp/src/components/calendar/components/month/index.json b/employee-mp/src/components/calendar/components/month/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/calendar/components/month/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/calendar/components/month/index.wxml b/employee-mp/src/components/calendar/components/month/index.wxml
new file mode 100644
index 0000000..468ebb2
--- /dev/null
+++ b/employee-mp/src/components/calendar/components/month/index.wxml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ {{ computed.formatMonthTitle(date) }}
+
+
+
+
+ {{ computed.getMark(date) }}
+
+
+
+
+ {{ item.topInfo }}
+ {{ item.text }}
+
+ {{ item.bottomInfo }}
+
+
+
+
+ {{ item.topInfo }}
+ {{ item.text }}
+
+ {{ item.bottomInfo }}
+
+
+
+
+
diff --git a/employee-mp/src/components/calendar/components/month/index.wxs b/employee-mp/src/components/calendar/components/month/index.wxs
new file mode 100644
index 0000000..38f4dec
--- /dev/null
+++ b/employee-mp/src/components/calendar/components/month/index.wxs
@@ -0,0 +1,58 @@
+var utils = require('../../utils.wxs');
+
+function getMark(date) {
+ return getDate(date).getMonth() + 1;
+}
+
+var ROW_HEIGHT = 64;
+
+function getDayStyle(type, index, date, rowHeight, color) {
+ var style = [];
+ var offset = getDate(date).getDay();
+
+ if (index === 0) {
+ style.push(['margin-left', (100 * offset) / 7 + '%']);
+ }
+
+ if (rowHeight !== ROW_HEIGHT) {
+ style.push(['height', rowHeight + 'px']);
+ }
+
+ if (color) {
+ if (type === 'start' || type === 'end' || type === 'multiple-selected' || type === 'multiple-middle') {
+ style.push(['background', color]);
+ } else if (type === 'middle') {
+ style.push(['color', color]);
+ }
+ }
+
+ return style
+ .map(function(item) {
+ return item.join(':');
+ })
+ .join(';');
+}
+
+function formatMonthTitle(date) {
+ date = getDate(date);
+ return date.getFullYear() + '年' + (date.getMonth() + 1) + '月';
+}
+
+function getMonthStyle(visible, date, rowHeight) {
+ if (!visible) {
+ date = getDate(date);
+
+ var totalDay = utils.getMonthEndDay(date.getFullYear(), date.getMonth() + 1);
+ var offset = getDate(date).getDay();
+ var padding = Math.ceil((totalDay + offset) / 7) * rowHeight;
+
+ return 'padding-bottom:' + padding + 'px';
+ }
+}
+
+module.exports = {
+ getMark: getMark,
+ getDayStyle: getDayStyle,
+ formatMonthTitle: formatMonthTitle,
+ getMonthStyle: getMonthStyle
+};
diff --git a/employee-mp/src/components/calendar/components/month/index.wxss b/employee-mp/src/components/calendar/components/month/index.wxss
new file mode 100644
index 0000000..72c14e7
--- /dev/null
+++ b/employee-mp/src/components/calendar/components/month/index.wxss
@@ -0,0 +1,132 @@
+@import '../../../common/index.wxss';
+
+.cw-calendar {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-flex-direction: column;
+ flex-direction: column;
+ height: 100%;
+ background-color: #fff;
+}
+
+.cw-calendar__month-title {
+ text-align: center;
+ height: 44px;
+ font-weight: 500;
+ font-size: 14px;
+ line-height: 44px;
+}
+
+.cw-calendar__days {
+ position: relative;
+ display: -webkit-flex;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-user-select: none;
+ user-select: none;
+}
+
+.cw-calendar__month-mark {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ z-index: 0;
+ -webkit-transform: translate(-50%, -50%);
+ transform: translate(-50%, -50%);
+ pointer-events: none;
+ color: rgba(242, 243, 245, 0.8);
+ font-size: 160px;
+}
+
+.cw-calendar__day,
+.cw-calendar__selected-day {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ text-align: center;
+}
+
+.cw-calendar__day {
+ position: relative;
+ width: 14.285%;
+ height: 64px;
+ font-size: 16px;
+}
+
+.cw-calendar__day--end,
+.cw-calendar__day--multiple-middle,
+.cw-calendar__day--multiple-selected,
+.cw-calendar__day--start,
+.cw-calendar__day--start-end {
+ color: #fff;
+ background-color: #ee0a24;
+}
+
+.cw-calendar__day--start {
+ border-radius: 4px 0 0 4px;
+}
+
+.cw-calendar__day--end {
+ border-radius: 0 4px 4px 0;
+}
+
+.cw-calendar__day--multiple-selected,
+.cw-calendar__day--start-end {
+ border-radius: 4px;
+}
+
+.cw-calendar__day--middle {
+ color: #ee0a24;
+}
+
+.cw-calendar__day--middle:after {
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ background-color: currentColor;
+ content: '';
+ opacity: 0.1;
+}
+
+.cw-calendar__day--disabled {
+ cursor: default;
+ color: #c8c9cc;
+}
+
+.cw-calendar__bottom-info,
+.cw-calendar__top-info {
+ position: absolute;
+ right: 0;
+ left: 0;
+ font-size: 10px;
+ line-height: 14px;
+}
+
+@media (max-width: 350px) {
+ .cw-calendar__bottom-info,
+ .cw-calendar__top-info {
+ font-size: 9px;
+ }
+}
+
+.cw-calendar__top-info {
+ top: 6px;
+}
+
+.cw-calendar__bottom-info {
+ bottom: 6px;
+}
+
+.cw-calendar__selected-day {
+ width: 54px;
+ height: 54px;
+ color: #fff;
+ background-color: #ee0a24;
+ border-radius: 4px;
+}
diff --git a/employee-mp/src/components/calendar/index.js b/employee-mp/src/components/calendar/index.js
new file mode 100644
index 0000000..6d43a7f
--- /dev/null
+++ b/employee-mp/src/components/calendar/index.js
@@ -0,0 +1,289 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import {
+ ROW_HEIGHT,
+ getNextDay,
+ compareDay,
+ copyDates,
+ calcDateNum,
+ formatMonthTitle,
+ compareMonth,
+ getMonths,
+ getDayByOffset
+} from './utils';
+import Toast from '../toast/toast';
+import { requestAnimationFrame } from '../common/utils';
+CwComponent({
+ props: {
+ title: {
+ type: String,
+ value: '日期选择'
+ },
+ color: String,
+ show: {
+ type: Boolean,
+ observer(val) {
+ if (val) {
+ this.initRect();
+ this.scrollIntoView();
+ }
+ }
+ },
+ formatter: null,
+ confirmText: {
+ type: String,
+ value: '确定'
+ },
+ rangePrompt: String,
+ defaultDate: {
+ type: null,
+ observer(val) {
+ this.setData({ currentDate: val });
+ this.scrollIntoView();
+ }
+ },
+ allowSameDay: Boolean,
+ confirmDisabledText: String,
+ type: {
+ type: String,
+ value: 'single',
+ observer: 'reset'
+ },
+ minDate: {
+ type: null,
+ value: Date.now()
+ },
+ maxDate: {
+ type: null,
+ value: new Date(new Date().getFullYear(), new Date().getMonth() + 6, new Date().getDate()).getTime()
+ },
+ position: {
+ type: String,
+ value: 'bottom'
+ },
+ rowHeight: {
+ type: null,
+ value: ROW_HEIGHT
+ },
+ round: {
+ type: Boolean,
+ value: true
+ },
+ poppable: {
+ type: Boolean,
+ value: true
+ },
+ showMark: {
+ type: Boolean,
+ value: true
+ },
+ showTitle: {
+ type: Boolean,
+ value: true
+ },
+ showConfirm: {
+ type: Boolean,
+ value: true
+ },
+ showSubtitle: {
+ type: Boolean,
+ value: true
+ },
+ safeAreaInsetBottom: {
+ type: Boolean,
+ value: true
+ },
+ closeOnClickOverlay: {
+ type: Boolean,
+ value: true
+ },
+ maxRange: {
+ type: null,
+ value: null
+ }
+ },
+ data: {
+ subtitle: '',
+ currentDate: null,
+ scrollIntoView: ''
+ },
+ created() {
+ this.setData({
+ currentDate: this.getInitialDate()
+ });
+ },
+ mounted() {
+ if (this.data.show || !this.data.poppable) {
+ this.initRect();
+ this.scrollIntoView();
+ }
+ },
+ methods: {
+ reset() {
+ this.setData({ currentDate: this.getInitialDate() });
+ this.scrollIntoView();
+ },
+ initRect() {
+ if (this.contentObserver != null) {
+ this.contentObserver.disconnect();
+ }
+ const contentObserver = this.createIntersectionObserver({
+ thresholds: [0, 0.1, 0.9, 1],
+ observeAll: true
+ });
+ this.contentObserver = contentObserver;
+ contentObserver.relativeTo('.cw-calendar__body');
+ contentObserver.observe('.month', res => {
+ if (res.boundingClientRect.top <= res.relativeRect.top) {
+ // @ts-ignore
+ this.setData({ subtitle: formatMonthTitle(res.dataset.date) });
+ }
+ });
+ },
+ getInitialDate() {
+ const { type, defaultDate, minDate } = this.data;
+ if (type === 'range') {
+ const [startDay, endDay] = defaultDate || [];
+ return [startDay || minDate, endDay || getNextDay(new Date(minDate)).getTime()];
+ }
+ if (type === 'multiple') {
+ return defaultDate || [minDate];
+ }
+ return defaultDate || minDate;
+ },
+ scrollIntoView() {
+ requestAnimationFrame(() => {
+ const { currentDate, type, show, poppable, minDate, maxDate } = this.data;
+ // @ts-ignore
+ const targetDate = type === 'single' ? currentDate : currentDate[0];
+ const displayed = show || !poppable;
+ if (!targetDate || !displayed) {
+ return;
+ }
+ const months = getMonths(minDate, maxDate);
+ months.some((month, index) => {
+ if (compareMonth(month, targetDate) === 0) {
+ this.setData({ scrollIntoView: `month${index}` });
+ return true;
+ }
+ return false;
+ });
+ });
+ },
+ onOpen() {
+ this.$emit('open');
+ },
+ onOpened() {
+ this.$emit('opened');
+ },
+ onClose() {
+ this.$emit('close');
+ },
+ onClosed() {
+ this.$emit('closed');
+ },
+ onClickDay(event) {
+ const { date } = event.detail;
+ const { type, currentDate, allowSameDay } = this.data;
+ if (type === 'range') {
+ // @ts-ignore
+ const [startDay, endDay] = currentDate;
+ if (startDay && !endDay) {
+ const compareToStart = compareDay(date, startDay);
+ if (compareToStart === 1) {
+ this.select([startDay, date], true);
+ } else if (compareToStart === -1) {
+ this.select([date, null]);
+ } else if (allowSameDay) {
+ this.select([date, date]);
+ }
+ } else {
+ this.select([date, null]);
+ }
+ } else if (type === 'multiple') {
+ let selectedIndex;
+ // @ts-ignore
+ const selected = currentDate.some((dateItem, index) => {
+ const equal = compareDay(dateItem, date) === 0;
+ if (equal) {
+ selectedIndex = index;
+ }
+ return equal;
+ });
+ if (selected) {
+ // @ts-ignore
+ const cancelDate = currentDate.splice(selectedIndex, 1);
+ this.setData({ currentDate });
+ this.unselect(cancelDate);
+ } else {
+ // @ts-ignore
+ this.select([...currentDate, date]);
+ }
+ } else {
+ this.select(date, true);
+ }
+ },
+ unselect(dateArray) {
+ const date = dateArray[0];
+ if (date) {
+ this.$emit('unselect', copyDates(date));
+ }
+ },
+ select(date, complete) {
+ if (complete && this.data.type === 'range') {
+ const valid = this.checkRange(date);
+ if (!valid) {
+ // auto selected to max range if showConfirm
+ if (this.data.showConfirm) {
+ this.emit([date[0], getDayByOffset(date[0], this.data.maxRange - 1)]);
+ } else {
+ this.emit(date);
+ }
+ return;
+ }
+ }
+ this.emit(date);
+ if (complete && !this.data.showConfirm) {
+ this.onConfirm();
+ }
+ },
+ emit(date) {
+ const getTime = date => (date instanceof Date ? date.getTime() : date);
+ this.setData({
+ currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date)
+ });
+ this.$emit('select', copyDates(date));
+ },
+ checkRange(date) {
+ const { maxRange, rangePrompt } = this.data;
+ if (maxRange && calcDateNum(date) > maxRange) {
+ Toast({
+ context: this,
+ message: rangePrompt || `选择天数不能超过 ${maxRange} 天`
+ });
+ return false;
+ }
+ return true;
+ },
+ onConfirm() {
+ if (this.data.type === 'range' && !this.checkRange(this.data.currentDate)) {
+ return;
+ }
+ wx.nextTick(() => {
+ // @ts-ignore
+ this.$emit('confirm', copyDates(this.data.currentDate));
+ });
+ }
+ }
+});
diff --git a/employee-mp/src/components/calendar/index.json b/employee-mp/src/components/calendar/index.json
new file mode 100644
index 0000000..02c03b3
--- /dev/null
+++ b/employee-mp/src/components/calendar/index.json
@@ -0,0 +1,10 @@
+{
+ "component": true,
+ "usingComponents": {
+ "header": "./components/header/index",
+ "month": "./components/month/index",
+ "cw-button": "../button/index",
+ "cw-popup": "../popup/index",
+ "cw-toast": "../toast/index"
+ }
+}
diff --git a/employee-mp/src/components/calendar/index.wxml b/employee-mp/src/components/calendar/index.wxml
new file mode 100644
index 0000000..2a09586
--- /dev/null
+++ b/employee-mp/src/components/calendar/index.wxml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/calendar/index.wxs b/employee-mp/src/components/calendar/index.wxs
new file mode 100644
index 0000000..9829f71
--- /dev/null
+++ b/employee-mp/src/components/calendar/index.wxs
@@ -0,0 +1,36 @@
+var utils = require('./utils.wxs');
+
+function getMonths(minDate, maxDate) {
+ var months = [];
+ var cursor = getDate(minDate);
+
+ cursor.setDate(1);
+
+ do {
+ months.push(cursor.getTime());
+ cursor.setMonth(cursor.getMonth() + 1);
+ } while (utils.compareMonth(cursor, getDate(maxDate)) !== 1);
+
+ return months;
+}
+
+function getButtonDisabled(type, currentDate) {
+ if (currentDate == null) {
+ return true;
+ }
+
+ if (type === 'range') {
+ return !currentDate[0] || !currentDate[1];
+ }
+
+ if (type === 'multiple') {
+ return !currentDate.length;
+ }
+
+ return !currentDate;
+}
+
+module.exports = {
+ getMonths: getMonths,
+ getButtonDisabled: getButtonDisabled
+};
diff --git a/employee-mp/src/components/calendar/index.wxss b/employee-mp/src/components/calendar/index.wxss
new file mode 100644
index 0000000..69b368d
--- /dev/null
+++ b/employee-mp/src/components/calendar/index.wxss
@@ -0,0 +1,56 @@
+@import '../common/index.wxss';
+
+.cw-calendar {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-flex-direction: column;
+ flex-direction: column;
+ height: 100%;
+ background-color: #fff;
+}
+
+.cw-calendar__close-icon {
+ top: 11px;
+}
+
+.cw-calendar__popup--bottom,
+.cw-calendar__popup--top {
+ height: 80%;
+}
+
+.cw-calendar__popup--left,
+.cw-calendar__popup--right {
+ height: 100%;
+}
+
+.cw-calendar__body {
+ -webkit-flex: 1;
+ flex: 1;
+ overflow: auto;
+ -webkit-overflow-scrolling: touch;
+}
+
+.cw-calendar__footer {
+ -webkit-flex-shrink: 0;
+ flex-shrink: 0;
+ padding: 0 16px;
+}
+
+.cw-calendar__footer--safe-area-inset-bottom {
+ padding-bottom: env(safe-area-inset-bottom);
+}
+
+.cw-calendar__footer + .cw-calendar__footer,
+.cw-calendar__footer:empty {
+ display: none;
+}
+
+.cw-calendar__footer:empty + .cw-calendar__footer {
+ display: block !important;
+}
+
+.cw-calendar__confirm {
+ height: 36px !important;
+ margin: 7px 0 !important;
+ line-height: 34px !important;
+}
diff --git a/employee-mp/src/components/calendar/utils.js b/employee-mp/src/components/calendar/utils.js
new file mode 100644
index 0000000..34af769
--- /dev/null
+++ b/employee-mp/src/components/calendar/utils.js
@@ -0,0 +1,90 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export const ROW_HEIGHT = 64;
+export function formatMonthTitle(date) {
+ if (!(date instanceof Date)) {
+ date = new Date(date);
+ }
+ return `${date.getFullYear()}年${date.getMonth() + 1}月`;
+}
+export function compareMonth(date1, date2) {
+ if (!(date1 instanceof Date)) {
+ date1 = new Date(date1);
+ }
+ if (!(date2 instanceof Date)) {
+ date2 = new Date(date2);
+ }
+ const year1 = date1.getFullYear();
+ const year2 = date2.getFullYear();
+ const month1 = date1.getMonth();
+ const month2 = date2.getMonth();
+ if (year1 === year2) {
+ return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
+ }
+ return year1 > year2 ? 1 : -1;
+}
+export function compareDay(day1, day2) {
+ if (!(day1 instanceof Date)) {
+ day1 = new Date(day1);
+ }
+ if (!(day2 instanceof Date)) {
+ day2 = new Date(day2);
+ }
+ const compareMonthResult = compareMonth(day1, day2);
+ if (compareMonthResult === 0) {
+ const date1 = day1.getDate();
+ const date2 = day2.getDate();
+ return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
+ }
+ return compareMonthResult;
+}
+export function getDayByOffset(date, offset) {
+ date = new Date(date);
+ date.setDate(date.getDate() + offset);
+ return date;
+}
+export function getPrevDay(date) {
+ return getDayByOffset(date, -1);
+}
+export function getNextDay(date) {
+ return getDayByOffset(date, 1);
+}
+export function calcDateNum(date) {
+ const day1 = new Date(date[0]).getTime();
+ const day2 = new Date(date[1]).getTime();
+ return (day2 - day1) / (1000 * 60 * 60 * 24) + 1;
+}
+export function copyDates(dates) {
+ if (Array.isArray(dates)) {
+ return dates.map(date => {
+ if (date === null) {
+ return date;
+ }
+ return new Date(date);
+ });
+ }
+ return new Date(dates);
+}
+export function getMonthEndDay(year, month) {
+ return 32 - new Date(year, month - 1, 32).getDate();
+}
+export function getMonths(minDate, maxDate) {
+ const months = [];
+ const cursor = new Date(minDate);
+ cursor.setDate(1);
+ do {
+ months.push(cursor.getTime());
+ cursor.setMonth(cursor.getMonth() + 1);
+ } while (compareMonth(cursor, maxDate) !== 1);
+ return months;
+}
diff --git a/employee-mp/src/components/calendar/utils.wxs b/employee-mp/src/components/calendar/utils.wxs
new file mode 100644
index 0000000..8574070
--- /dev/null
+++ b/employee-mp/src/components/calendar/utils.wxs
@@ -0,0 +1,24 @@
+function getMonthEndDay(year, month) {
+ return 32 - getDate(year, month - 1, 32).getDate();
+}
+
+function compareMonth(date1, date2) {
+ date1 = getDate(date1);
+ date2 = getDate(date2);
+
+ var year1 = date1.getFullYear();
+ var year2 = date2.getFullYear();
+ var month1 = date1.getMonth();
+ var month2 = date2.getMonth();
+
+ if (year1 === year2) {
+ return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
+ }
+
+ return year1 > year2 ? 1 : -1;
+}
+
+module.exports = {
+ getMonthEndDay: getMonthEndDay,
+ compareMonth: compareMonth
+};
diff --git a/employee-mp/src/components/car-number/index.js b/employee-mp/src/components/car-number/index.js
new file mode 100644
index 0000000..2cbcd92
--- /dev/null
+++ b/employee-mp/src/components/car-number/index.js
@@ -0,0 +1,103 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+
+CwComponent({
+ props: {
+ isNewEnergy: Boolean
+ },
+ data: {
+ // 省份简写
+ provinces: [
+ ['京', '沪', '粤', '津', '冀', '晋', '蒙', '辽', '吉', '黑'],
+ ['苏', '浙', '皖', '闽', '赣', '鲁', '豫', '鄂', '湘'],
+ ['桂', '琼', '渝', '川', '贵', '云', '藏'],
+ ['陕', '甘', '青', '宁', '新']
+ ],
+ // 车牌输入
+ numbers: [
+ ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
+ ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K'],
+ ['L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V'],
+ ['W', 'X', 'Y', 'Z', '港', '澳', '学']
+ ],
+ carNumber: [],
+ keyboardVisible: false
+ },
+ methods: {
+ // 选中点击设置
+ bindChoose(e) {
+ const { carNumber, isNewEnergy } = this.data;
+
+ if ((carNumber.length === 7 && !isNewEnergy) || (carNumber.length === 8 && isNewEnergy)) {
+ return;
+ }
+
+ this.setData(
+ {
+ carNumber: carNumber.concat(e.target.dataset.val)
+ },
+ () => {
+ if (
+ (this.data.carNumber.length === 7 && !isNewEnergy) ||
+ (this.data.carNumber.length === 8 && isNewEnergy)
+ ) {
+ this.$emit('change', this.data.carNumber.join(''));
+ } else {
+ this.$emit('change', '');
+ }
+ }
+ );
+ },
+ bindDelChoose() {
+ const { carNumber } = this.data;
+
+ if (carNumber.length > 0) {
+ carNumber.pop();
+ this.setData({
+ carNumber
+ });
+ }
+ },
+ closeKeyboard() {
+ this.setData({
+ keyboardVisible: false
+ });
+ },
+ openKeyboard() {
+ const query = this.createSelectorQuery();
+
+ query.select('.cw-car-number-items').boundingClientRect();
+ query.exec(res => {
+ wx.pageScrollTo({
+ scrollTop: res[0].top,
+ duration: 500
+ });
+ });
+
+ this.setData({
+ keyboardVisible: true
+ });
+ },
+ clear() {
+ this.setData(
+ {
+ carNumber: []
+ },
+ () => {
+ this.$emit('change', '');
+ }
+ );
+ }
+ }
+});
diff --git a/employee-mp/src/components/car-number/index.json b/employee-mp/src/components/car-number/index.json
new file mode 100644
index 0000000..85e5843
--- /dev/null
+++ b/employee-mp/src/components/car-number/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index"
+ }
+}
diff --git a/employee-mp/src/components/car-number/index.wxml b/employee-mp/src/components/car-number/index.wxml
new file mode 100644
index 0000000..c5bec9e
--- /dev/null
+++ b/employee-mp/src/components/car-number/index.wxml
@@ -0,0 +1,63 @@
+
+
+
+ {{carNumber[0] || ""}}
+ {{carNumber[1] || ""}}
+
+
+ {{carNumber[2] || ''}}
+ {{carNumber[3] || ''}}
+ {{carNumber[4] || ''}}
+ {{carNumber[5] || ''}}
+ {{carNumber[6] || ''}}
+
+
+ {{carNumber[7] || ''}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{itemlist}}
+
+
+
+
+
+
+
+
+
+
+ {{itemlist}}
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/car-number/index.wxss b/employee-mp/src/components/car-number/index.wxss
new file mode 100644
index 0000000..fcb88f7
--- /dev/null
+++ b/employee-mp/src/components/car-number/index.wxss
@@ -0,0 +1,140 @@
+/* 虚拟键盘 */
+.cw-keyboard {
+ height: auto;
+ background: #d1d5d9;
+ position: fixed;
+ bottom: 0;
+ width: 100%;
+ left: 0;
+ padding-bottom: constant(safe-area-inset-bottom);
+ padding-bottom: env(safe-area-inset-bottom);
+ z-index: 60;
+}
+
+.cw-keyboard-item {
+ padding: 10rpx 0 5rpx 0;
+ position: relative;
+ display: block;
+}
+
+/* 关闭虚拟键盘 */
+.cw-keyboard-close {
+ height: 70rpx;
+ background-color: #eee;
+ overflow: hidden;
+}
+
+.cw-keyboard-close-btn {
+ float: right;
+ line-height: 70rpx;
+ font-size: 20px;
+ padding-right: 30rpx;
+}
+
+/* 虚拟键盘-省缩写 */
+/* 虚拟键盘-行 */
+.cw-keyboard-line {
+ margin: 0 auto;
+ text-align: center;
+}
+
+.cw-iscarnumber .cw-keyboard-line {
+ text-align: left;
+ margin-left: 5rpx;
+}
+
+/* 虚拟键盘-单个按钮 */
+.cw-keyboard-btn {
+ font-size: 17px;
+ color: #333333;
+ background: #fff;
+ display: inline-block;
+ padding: 18rpx 0;
+ width: 63rpx;
+ text-align: center;
+ box-shadow: 0 2rpx 0 0 #999999;
+ border-radius: 10rpx;
+ margin: 5rpx 6rpx;
+}
+
+.cw-keyboard-btn:active {
+ background: #f5f5f5;
+}
+
+/* 虚拟键盘-删除按钮 */
+.cw-keyboard-del {
+ font-size: 22px;
+ color: #333333;
+ background: #a7b0bc;
+ display: inline-block;
+ padding: 8rpx 0;
+ text-align: center;
+ width: 96rpx;
+ box-shadow: 0 2rpx 0 0 #999999;
+ border-radius: 10rpx;
+ margin: 5rpx;
+ position: absolute;
+ bottom: 5rpx;
+ right: 6rpx;
+}
+
+.cw-keyboard-del-font {
+ font-size: 25px;
+}
+
+/* 车牌号码 */
+.cw-car-number-items {
+ text-align: left;
+ color: #323232;
+}
+
+.cw-car-number-items-box {
+ width: 152rpx;
+ height: 90rpx;
+ border: 2rpx solid #cccccc;
+ border-radius: 4rpx;
+ display: inline-block;
+ vertical-align: middle;
+ position: relative;
+ margin-right: 30rpx;
+ text-align: right;
+}
+
+.cw-car-number-items-box-list {
+ width: 72rpx;
+ height: 70rpx;
+ line-height: 70rpx;
+ text-align: center;
+ display: inline-block;
+ font-size: 18px;
+ margin: 10rpx 0;
+ vertical-align: middle;
+}
+
+.cw-car-number-items-province {
+ border-right: 1rpx solid #ccc;
+}
+
+.cw-car-number-items-box::after {
+ content: '';
+ width: 6rpx;
+ height: 6rpx;
+ position: absolute;
+ right: -22rpx;
+ top: 40rpx;
+ border-radius: 50%;
+ background-color: #ccc;
+}
+
+.cw-car-number-item {
+ width: 76rpx;
+ height: 90rpx;
+ font-size: 18px;
+ text-align: center;
+ border: 2rpx solid #cccccc;
+ border-radius: 4rpx;
+ line-height: 90rpx;
+ display: inline-block;
+ margin: 0 4rpx;
+ vertical-align: middle;
+}
diff --git a/employee-mp/src/components/card/index.js b/employee-mp/src/components/card/index.js
new file mode 100644
index 0000000..0db9618
--- /dev/null
+++ b/employee-mp/src/components/card/index.js
@@ -0,0 +1,54 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { link } from '../mixins/link';
+import { CwComponent } from '../common/component';
+CwComponent({
+ classes: ['num-class', 'desc-class', 'thumb-class', 'title-class', 'price-class', 'origin-price-class'],
+ mixins: [link],
+ props: {
+ tag: String,
+ num: String,
+ desc: String,
+ thumb: String,
+ title: String,
+ price: {
+ type: String,
+ observer: 'updatePrice'
+ },
+ centered: Boolean,
+ lazyLoad: Boolean,
+ thumbLink: String,
+ originPrice: String,
+ thumbMode: {
+ type: String,
+ value: 'aspectFit'
+ },
+ currency: {
+ type: String,
+ value: '¥'
+ }
+ },
+ methods: {
+ updatePrice() {
+ const { price } = this.data;
+ const priceArr = price.toString().split('.');
+ this.setData({
+ integerStr: priceArr[0],
+ decimalStr: priceArr[1] ? `.${priceArr[1]}` : ''
+ });
+ },
+ onClickThumb() {
+ this.jumpLink('thumbLink');
+ }
+ }
+});
diff --git a/employee-mp/src/components/card/index.json b/employee-mp/src/components/card/index.json
new file mode 100644
index 0000000..c273f07
--- /dev/null
+++ b/employee-mp/src/components/card/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-tag": "../tag/index"
+ }
+}
diff --git a/employee-mp/src/components/card/index.wxml b/employee-mp/src/components/card/index.wxml
new file mode 100644
index 0000000..55d976d
--- /dev/null
+++ b/employee-mp/src/components/card/index.wxml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/card/index.wxss b/employee-mp/src/components/card/index.wxss
new file mode 100644
index 0000000..79ba17d
--- /dev/null
+++ b/employee-mp/src/components/card/index.wxss
@@ -0,0 +1,120 @@
+@import '../common/index.wxss';
+
+.cw-card {
+ position: relative;
+ box-sizing: border-box;
+ padding: 8px 16px;
+ font-size: 12px;
+ color: #323233;
+ background-color: #fafafa;
+}
+
+.cw-card__header {
+ display: -webkit-flex;
+ display: flex;
+}
+
+.cw-card__header--center {
+ -webkit-align-items: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+}
+
+.cw-card__thumb {
+ position: relative;
+ -webkit-flex: none;
+ flex: none;
+ width: 88px;
+ height: 88px;
+ margin-right: 8px;
+}
+
+.cw-card__thumb:empty {
+ display: none;
+}
+
+.cw-card__img {
+ width: 100%;
+ height: 100%;
+ border-radius: 8px;
+}
+
+.cw-card__content {
+ position: relative;
+ display: -webkit-flex;
+ display: flex;
+ -webkit-flex: 1;
+ flex: 1;
+ -webkit-flex-direction: column;
+ flex-direction: column;
+ -webkit-justify-content: space-between;
+ justify-content: space-between;
+ min-width: 0;
+ min-height: 88px;
+}
+
+.cw-card__content--center {
+ -webkit-justify-content: center;
+ justify-content: center;
+}
+
+.cw-card__desc,
+.cw-card__title {
+ word-wrap: break-word;
+}
+
+.cw-card__title {
+ font-weight: 700;
+ line-height: 16px;
+}
+
+.cw-card__desc {
+ line-height: 20px;
+ color: #646566;
+}
+
+.cw-card__bottom {
+ line-height: 20px;
+}
+
+.cw-card__price {
+ display: inline-block;
+ font-weight: 700;
+ color: #ee0a24;
+ font-size: 12px;
+}
+
+.cw-card__price-integer {
+ font-size: 16px;
+}
+
+.cw-card__price-decimal,
+.cw-card__price-integer {
+ font-family: Avenir-Heavy, PingFang SC, Helvetica Neue, Arial, sans-serif;
+}
+
+.cw-card__origin-price {
+ display: inline-block;
+ margin-left: 5px;
+ text-decoration: line-through;
+ font-size: 10px;
+ color: #646566;
+}
+
+.cw-card__num {
+ float: right;
+}
+
+.cw-card__tag {
+ position: absolute !important;
+ top: 2px;
+ left: 0;
+}
+
+.cw-card__footer {
+ -webkit-flex: none;
+ flex: none;
+ width: 100%;
+ text-align: right;
+}
diff --git a/employee-mp/src/components/cell-group/index.js b/employee-mp/src/components/cell-group/index.js
new file mode 100644
index 0000000..7d2bca2
--- /dev/null
+++ b/employee-mp/src/components/cell-group/index.js
@@ -0,0 +1,22 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+CwComponent({
+ props: {
+ title: String,
+ border: {
+ type: Boolean,
+ value: true
+ }
+ }
+});
diff --git a/employee-mp/src/components/cell-group/index.json b/employee-mp/src/components/cell-group/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/cell-group/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/cell-group/index.wxml b/employee-mp/src/components/cell-group/index.wxml
new file mode 100644
index 0000000..750ccd7
--- /dev/null
+++ b/employee-mp/src/components/cell-group/index.wxml
@@ -0,0 +1,6 @@
+
+ {{ title }}
+
+
+
+
diff --git a/employee-mp/src/components/cell-group/index.wxss b/employee-mp/src/components/cell-group/index.wxss
new file mode 100644
index 0000000..44fbfb9
--- /dev/null
+++ b/employee-mp/src/components/cell-group/index.wxss
@@ -0,0 +1,8 @@
+@import '../common/index.wxss';
+
+.cw-cell-group__title {
+ padding: 16px 16px 8px;
+ font-size: 14px;
+ line-height: 16px;
+ color: #969799;
+}
diff --git a/employee-mp/src/components/cell/index.js b/employee-mp/src/components/cell/index.js
new file mode 100644
index 0000000..a1a8c17
--- /dev/null
+++ b/employee-mp/src/components/cell/index.js
@@ -0,0 +1,45 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { link } from '../mixins/link';
+import { CwComponent } from '../common/component';
+CwComponent({
+ classes: ['title-class', 'label-class', 'value-class', 'right-icon-class', 'hover-class'],
+ mixins: [link],
+ props: {
+ title: null,
+ value: null,
+ icon: String,
+ size: String,
+ label: String,
+ center: Boolean,
+ isLink: Boolean,
+ isDetail: Boolean,
+ required: Boolean,
+ clickable: Boolean,
+ titleWidth: String,
+ customStyle: String,
+ arrowDirection: String,
+ useLabelSlot: Boolean,
+ border: {
+ type: Boolean,
+ value: true
+ },
+ titleStyle: String
+ },
+ methods: {
+ onClick(event) {
+ this.$emit('click', event.detail);
+ this.jumpLink();
+ }
+ }
+});
diff --git a/employee-mp/src/components/cell/index.json b/employee-mp/src/components/cell/index.json
new file mode 100644
index 0000000..85e5843
--- /dev/null
+++ b/employee-mp/src/components/cell/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index"
+ }
+}
diff --git a/employee-mp/src/components/cell/index.wxml b/employee-mp/src/components/cell/index.wxml
new file mode 100644
index 0000000..38ddc18
--- /dev/null
+++ b/employee-mp/src/components/cell/index.wxml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+ {{ title }}
+
+
+
+
+ {{ label }}
+
+
+
+
+ {{ value }}
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/cell/index.wxs b/employee-mp/src/components/cell/index.wxs
new file mode 100644
index 0000000..e4f2f16
--- /dev/null
+++ b/employee-mp/src/components/cell/index.wxs
@@ -0,0 +1,16 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function titleStyle(data) {
+ return style([
+ {
+ 'max-width': addUnit(data.titleWidth),
+ 'min-width': addUnit(data.titleWidth)
+ },
+ data.titleStyle
+ ]);
+}
+
+module.exports = {
+ titleStyle: titleStyle
+};
diff --git a/employee-mp/src/components/cell/index.wxss b/employee-mp/src/components/cell/index.wxss
new file mode 100644
index 0000000..ccca3d4
--- /dev/null
+++ b/employee-mp/src/components/cell/index.wxss
@@ -0,0 +1,141 @@
+@import '../common/index.wxss';
+
+.cw-cell {
+ position: relative;
+ display: -webkit-flex;
+ display: flex;
+ box-sizing: border-box;
+ width: 100%;
+ padding: 10px 16px;
+ font-size: 14px;
+ line-height: 24px;
+ color: #323233;
+ background-color: #fff;
+}
+
+.cw-cell:after {
+ position: absolute;
+ box-sizing: border-box;
+ -webkit-transform-origin: center;
+ transform-origin: center;
+ content: ' ';
+ pointer-events: none;
+ right: 16px;
+ bottom: 0;
+ left: 16px;
+ border-bottom: 1px solid #ebedf0;
+ transform: scaleY(0.5);
+}
+
+.cw-cell--borderless:after {
+ display: none;
+}
+
+.cw-cell-group {
+ background-color: #fff;
+}
+
+.cw-cell__label {
+ margin-top: 3px;
+ font-size: 12px;
+ line-height: 18px;
+ color: #969799;
+}
+
+.cw-cell__value {
+ overflow: hidden;
+ text-align: right;
+ vertical-align: middle;
+ color: #969799;
+ margin-left: 12px;
+}
+
+.cw-cell__value.only {
+ margin-left: 0;
+}
+
+.cw-cell__title {
+ flex: auto;
+}
+.cw-cell__value {
+ flex: auto;
+}
+
+.cw-cell--detail .cw-cell__title {
+ flex: none;
+}
+
+.cw-cell--detail .cw-cell__value {
+ color: #323233;
+}
+
+.cw-cell__title:empty,
+.cw-cell__value:empty {
+ display: none;
+}
+
+.cw-cell__left-icon-wrap,
+.cw-cell__right-icon-wrap {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ height: 24px;
+ font-size: 16px;
+}
+
+.cw-cell__left-icon-wrap {
+ margin-right: 4px;
+}
+
+.cw-cell__right-icon-wrap {
+ margin-left: 4px;
+ color: #969799;
+}
+
+.cw-cell__left-icon {
+ vertical-align: middle;
+}
+
+.cw-cell__left-icon,
+.cw-cell__right-icon {
+ line-height: 24px;
+}
+
+.cw-cell--clickable.cw-cell--hover {
+ background-color: #f2f3f5;
+}
+
+.cw-cell--required {
+ overflow: visible;
+}
+
+.cw-cell--required:before {
+ position: absolute;
+ content: '*';
+ left: 8px;
+ font-size: 14px;
+ color: #ee0a24;
+}
+
+.cw-cell--center {
+ -webkit-align-items: center;
+ align-items: center;
+}
+
+.cw-cell--large {
+ padding-top: 12px;
+ padding-bottom: 12px;
+}
+
+.cw-cell--large .cw-cell__title {
+ font-size: 16px;
+}
+
+.cw-cell--large .cw-cell__value {
+ font-size: 16px;
+}
+
+.cw-cell--large .cw-cell__label {
+ font-size: 14px;
+}
diff --git a/employee-mp/src/components/checkbox-group/index.js b/employee-mp/src/components/checkbox-group/index.js
new file mode 100644
index 0000000..021607e
--- /dev/null
+++ b/employee-mp/src/components/checkbox-group/index.js
@@ -0,0 +1,43 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { useChildren } from '../common/relation';
+import { CwComponent } from '../common/component';
+CwComponent({
+ field: true,
+ relation: useChildren('checkbox', function(target) {
+ this.updateChild(target);
+ }),
+ props: {
+ max: Number,
+ value: {
+ type: Array,
+ observer: 'updateChildren'
+ },
+ disabled: {
+ type: Boolean,
+ observer: 'updateChildren'
+ }
+ },
+ methods: {
+ updateChildren() {
+ this.children.forEach(child => this.updateChild(child));
+ },
+ updateChild(child) {
+ const { value, disabled } = this.data;
+ child.setData({
+ value: value.indexOf(child.data.name) !== -1,
+ parentDisabled: disabled
+ });
+ }
+ }
+});
diff --git a/employee-mp/src/components/checkbox-group/index.json b/employee-mp/src/components/checkbox-group/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/checkbox-group/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/checkbox-group/index.wxml b/employee-mp/src/components/checkbox-group/index.wxml
new file mode 100644
index 0000000..4fa864c
--- /dev/null
+++ b/employee-mp/src/components/checkbox-group/index.wxml
@@ -0,0 +1 @@
+
diff --git a/employee-mp/src/components/checkbox-group/index.wxss b/employee-mp/src/components/checkbox-group/index.wxss
new file mode 100644
index 0000000..ecfdfde
--- /dev/null
+++ b/employee-mp/src/components/checkbox-group/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';
diff --git a/employee-mp/src/components/checkbox/index.js b/employee-mp/src/components/checkbox/index.js
new file mode 100644
index 0000000..0aa5d65
--- /dev/null
+++ b/employee-mp/src/components/checkbox/index.js
@@ -0,0 +1,87 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { useParent } from '../common/relation';
+import { CwComponent } from '../common/component';
+function emit(target, value) {
+ target.$emit('input', value);
+ target.$emit('change', value);
+}
+CwComponent({
+ field: true,
+ relation: useParent('checkbox-group'),
+ classes: ['icon-class', 'label-class'],
+ props: {
+ name: null,
+ value: Boolean,
+ disabled: Boolean,
+ useIconSlot: Boolean,
+ checkedColor: String,
+ labelPosition: {
+ type: String,
+ value: 'right'
+ },
+ labelDisabled: Boolean,
+ shape: {
+ type: String,
+ value: 'round'
+ },
+ iconSize: {
+ type: null,
+ value: 20
+ }
+ },
+ data: {
+ parentDisabled: false
+ },
+ methods: {
+ emitChange(value) {
+ if (this.parent) {
+ this.setParentValue(this.parent, value);
+ } else {
+ emit(this, value);
+ }
+ },
+ toggle() {
+ const { parentDisabled, disabled, value } = this.data;
+ if (!disabled && !parentDisabled) {
+ this.emitChange(!value);
+ }
+ },
+ onClickLabel() {
+ const { labelDisabled, parentDisabled, disabled, value } = this.data;
+ if (!disabled && !labelDisabled && !parentDisabled) {
+ this.emitChange(!value);
+ }
+ },
+ setParentValue(parent, value) {
+ const parentValue = parent.data.value.slice();
+ const { name } = this.data;
+ const { max } = parent.data;
+ if (value) {
+ if (max && parentValue.length >= max) {
+ return;
+ }
+ if (parentValue.indexOf(name) === -1) {
+ parentValue.push(name);
+ emit(parent, parentValue);
+ }
+ } else {
+ const index = parentValue.indexOf(name);
+ if (index !== -1) {
+ parentValue.splice(index, 1);
+ emit(parent, parentValue);
+ }
+ }
+ }
+ }
+});
diff --git a/employee-mp/src/components/checkbox/index.json b/employee-mp/src/components/checkbox/index.json
new file mode 100644
index 0000000..85e5843
--- /dev/null
+++ b/employee-mp/src/components/checkbox/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index"
+ }
+}
diff --git a/employee-mp/src/components/checkbox/index.wxml b/employee-mp/src/components/checkbox/index.wxml
new file mode 100644
index 0000000..7b2810b
--- /dev/null
+++ b/employee-mp/src/components/checkbox/index.wxml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/checkbox/index.wxs b/employee-mp/src/components/checkbox/index.wxs
new file mode 100644
index 0000000..67c9f66
--- /dev/null
+++ b/employee-mp/src/components/checkbox/index.wxs
@@ -0,0 +1,19 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) {
+ var styles = {
+ 'font-size': addUnit(iconSize)
+ };
+
+ if (checkedColor && value && !disabled && !parentDisabled) {
+ styles['border-color'] = checkedColor;
+ styles['background-color'] = checkedColor;
+ }
+
+ return style(styles);
+}
+
+module.exports = {
+ iconStyle: iconStyle
+};
diff --git a/employee-mp/src/components/checkbox/index.wxss b/employee-mp/src/components/checkbox/index.wxss
new file mode 100644
index 0000000..3a45bfb
--- /dev/null
+++ b/employee-mp/src/components/checkbox/index.wxss
@@ -0,0 +1,77 @@
+@import '../common/index.wxss';
+
+.cw-checkbox {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ overflow: hidden;
+ -webkit-user-select: none;
+ user-select: none;
+}
+
+.cw-checkbox__icon-wrap,
+.cw-checkbox__label {
+ line-height: 20px;
+}
+
+.cw-checkbox__icon-wrap {
+ -webkit-flex: none;
+ flex: none;
+}
+
+.cw-checkbox__icon {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ box-sizing: border-box;
+ width: 1em;
+ height: 1em;
+ color: transparent;
+ text-align: center;
+ transition-property: color, border-color, background-color;
+ font-size: 20px;
+ border: 1px solid #c8c9cc;
+ transition-duration: 0.2s;
+}
+
+.cw-checkbox__icon--round {
+ border-radius: 100%;
+}
+
+.cw-checkbox__icon--checked {
+ color: #fff;
+ background-color: #1989fa;
+ border-color: #1989fa;
+}
+
+.cw-checkbox__icon--disabled {
+ background-color: #ebedf0;
+ border-color: #c8c9cc;
+}
+
+.cw-checkbox__icon--disabled.cw-checkbox__icon--checked {
+ color: #c8c9cc;
+}
+
+.cw-checkbox__label {
+ word-wrap: break-word;
+ margin-left: 10px;
+ color: #323233;
+}
+
+.cw-checkbox__label--left {
+ float: left;
+ margin: 0 10px 0 0;
+}
+
+.cw-checkbox__label--disabled {
+ color: #c8c9cc;
+}
+
+.cw-checkbox__label:empty {
+ margin: 0;
+}
diff --git a/employee-mp/src/components/circle/canvas.js b/employee-mp/src/components/circle/canvas.js
new file mode 100644
index 0000000..2c43b2d
--- /dev/null
+++ b/employee-mp/src/components/circle/canvas.js
@@ -0,0 +1,55 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export function adaptor(ctx) {
+ // @ts-ignore
+ return Object.assign(ctx, {
+ setStrokeStyle(val) {
+ ctx.strokeStyle = val;
+ },
+ setLineWidth(val) {
+ ctx.lineWidth = val;
+ },
+ setLineCap(val) {
+ ctx.lineCap = val;
+ },
+ setFillStyle(val) {
+ ctx.fillStyle = val;
+ },
+ setFontSize(val) {
+ ctx.font = String(val);
+ },
+ setGlobalAlpha(val) {
+ ctx.globalAlpha = val;
+ },
+ setLineJoin(val) {
+ ctx.lineJoin = val;
+ },
+ setTextAlign(val) {
+ ctx.textAlign = val;
+ },
+ setMiterLimit(val) {
+ ctx.miterLimit = val;
+ },
+ setShadow(offsetX, offsetY, blur, color) {
+ ctx.shadowOffsetX = offsetX;
+ ctx.shadowOffsetY = offsetY;
+ ctx.shadowBlur = blur;
+ ctx.shadowColor = color;
+ },
+ setTextBaseline(val) {
+ ctx.textBaseline = val;
+ },
+ createCircularGradient() {},
+ draw() {}
+ });
+}
diff --git a/employee-mp/src/components/circle/index.js b/employee-mp/src/components/circle/index.js
new file mode 100644
index 0000000..af95f4e
--- /dev/null
+++ b/employee-mp/src/components/circle/index.js
@@ -0,0 +1,194 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { BLUE, WHITE } from '../common/color';
+import { CwComponent } from '../common/component';
+import { getSystemInfoSync } from '../common/utils';
+import { isObj } from '../common/validator';
+import { canIUseCanvas2d } from '../common/version';
+import { adaptor } from './canvas';
+function format(rate) {
+ return Math.min(Math.max(rate, 0), 100);
+}
+const PERIMETER = 2 * Math.PI;
+const BEGIN_ANGLE = -Math.PI / 2;
+const STEP = 1;
+CwComponent({
+ props: {
+ text: String,
+ lineCap: {
+ type: String,
+ value: 'round'
+ },
+ value: {
+ type: Number,
+ value: 0,
+ observer: 'reRender'
+ },
+ speed: {
+ type: Number,
+ value: 50
+ },
+ size: {
+ type: Number,
+ value: 100,
+ observer() {
+ this.drawCircle(this.currentValue);
+ }
+ },
+ fill: String,
+ layerColor: {
+ type: String,
+ value: WHITE
+ },
+ color: {
+ type: null,
+ value: BLUE,
+ observer() {
+ this.setHoverColor().then(() => {
+ this.drawCircle(this.currentValue);
+ });
+ }
+ },
+ type: {
+ type: String,
+ value: ''
+ },
+ strokeWidth: {
+ type: Number,
+ value: 4
+ },
+ clockwise: {
+ type: Boolean,
+ value: true
+ }
+ },
+ data: {
+ hoverColor: BLUE
+ },
+ methods: {
+ getContext() {
+ const { type, size } = this.data;
+ if (type === '' || !canIUseCanvas2d()) {
+ const ctx = wx.createCanvasContext('cw-circle', this);
+ return Promise.resolve(ctx);
+ }
+ const dpr = getSystemInfoSync().pixelRatio;
+ return new Promise(resolve => {
+ wx.createSelectorQuery()
+ .in(this)
+ .select('#cw-circle')
+ .node()
+ .exec(res => {
+ const canvas = res[0].node;
+ const ctx = canvas.getContext(type);
+ if (!this.inited) {
+ this.inited = true;
+ canvas.width = size * dpr;
+ canvas.height = size * dpr;
+ ctx.scale(dpr, dpr);
+ }
+ resolve(adaptor(ctx));
+ });
+ });
+ },
+ setHoverColor() {
+ const { color, size } = this.data;
+ if (isObj(color)) {
+ return this.getContext().then(context => {
+ const LinearColor = context.createLinearGradient(size, 0, 0, 0);
+ Object.keys(color)
+ .sort((a, b) => parseFloat(a) - parseFloat(b))
+ .map(key => LinearColor.addColorStop(parseFloat(key) / 100, color[key]));
+ this.hoverColor = LinearColor;
+ });
+ }
+ this.hoverColor = color;
+ return Promise.resolve();
+ },
+ presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) {
+ const { strokeWidth, lineCap, clockwise, size } = this.data;
+ const position = size / 2;
+ const radius = position - strokeWidth / 2;
+ context.setStrokeStyle(strokeStyle);
+ context.setLineWidth(strokeWidth);
+ context.setLineCap(lineCap);
+ context.beginPath();
+ context.arc(position, position, radius, beginAngle, endAngle, !clockwise);
+ context.stroke();
+ if (fill) {
+ context.setFillStyle(fill);
+ context.fill();
+ }
+ },
+ renderLayerCircle(context) {
+ const { layerColor, fill } = this.data;
+ this.presetCanvas(context, layerColor, 0, PERIMETER, fill);
+ },
+ renderHoverCircle(context, formatValue) {
+ const { clockwise } = this.data;
+ // 结束角度
+ const progress = PERIMETER * (formatValue / 100);
+ const endAngle = clockwise ? BEGIN_ANGLE + progress : 3 * Math.PI - (BEGIN_ANGLE + progress);
+ this.presetCanvas(context, this.hoverColor, BEGIN_ANGLE, endAngle);
+ },
+ drawCircle(currentValue) {
+ const { size } = this.data;
+ this.getContext().then(context => {
+ context.clearRect(0, 0, size, size);
+ this.renderLayerCircle(context);
+ const formatValue = format(currentValue);
+ if (formatValue !== 0) {
+ this.renderHoverCircle(context, formatValue);
+ }
+ context.draw();
+ });
+ },
+ reRender() {
+ // tofector 动画暂时没有想到好的解决方案
+ const { value, speed } = this.data;
+ if (speed <= 0 || speed > 1000) {
+ this.drawCircle(value);
+ return;
+ }
+ this.clearInterval();
+ this.currentValue = this.currentValue || 0;
+ this.interval = setInterval(() => {
+ if (this.currentValue !== value) {
+ if (this.currentValue < value) {
+ this.currentValue += STEP;
+ } else {
+ this.currentValue -= STEP;
+ }
+ this.drawCircle(this.currentValue);
+ } else {
+ this.clearInterval();
+ }
+ }, 1000 / speed);
+ },
+ clearInterval() {
+ if (this.interval) {
+ clearInterval(this.interval);
+ this.interval = null;
+ }
+ }
+ },
+ mounted() {
+ this.currentValue = this.data.value;
+ this.setHoverColor().then(() => {
+ this.drawCircle(this.currentValue);
+ });
+ },
+ destroyed() {
+ this.clearInterval();
+ }
+});
diff --git a/employee-mp/src/components/circle/index.json b/employee-mp/src/components/circle/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/circle/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/circle/index.wxml b/employee-mp/src/components/circle/index.wxml
new file mode 100644
index 0000000..7cbceb7
--- /dev/null
+++ b/employee-mp/src/components/circle/index.wxml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+ {{ text }}
+
diff --git a/employee-mp/src/components/circle/index.wxss b/employee-mp/src/components/circle/index.wxss
new file mode 100644
index 0000000..8d02a25
--- /dev/null
+++ b/employee-mp/src/components/circle/index.wxss
@@ -0,0 +1,17 @@
+@import '../common/index.wxss';
+
+.cw-circle {
+ position: relative;
+ display: inline-block;
+ text-align: center;
+}
+
+.cw-circle__text {
+ position: absolute;
+ top: 50%;
+ left: 0;
+ width: 100%;
+ -webkit-transform: translateY(-50%);
+ transform: translateY(-50%);
+ color: #323233;
+}
diff --git a/employee-mp/src/components/col/index.js b/employee-mp/src/components/col/index.js
new file mode 100644
index 0000000..b65ad27
--- /dev/null
+++ b/employee-mp/src/components/col/index.js
@@ -0,0 +1,21 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { useParent } from '../common/relation';
+import { CwComponent } from '../common/component';
+CwComponent({
+ relation: useParent('row'),
+ props: {
+ span: Number,
+ offset: Number
+ }
+});
diff --git a/employee-mp/src/components/col/index.json b/employee-mp/src/components/col/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/col/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/col/index.wxml b/employee-mp/src/components/col/index.wxml
new file mode 100644
index 0000000..71f3735
--- /dev/null
+++ b/employee-mp/src/components/col/index.wxml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/employee-mp/src/components/col/index.wxs b/employee-mp/src/components/col/index.wxs
new file mode 100644
index 0000000..ff756ac
--- /dev/null
+++ b/employee-mp/src/components/col/index.wxs
@@ -0,0 +1,17 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function rootStyle(data) {
+ if (!data.gutter) {
+ return '';
+ }
+
+ return style({
+ 'padding-right': addUnit(data.gutter / 2),
+ 'padding-left': addUnit(data.gutter / 2)
+ });
+}
+
+module.exports = {
+ rootStyle: rootStyle
+};
diff --git a/employee-mp/src/components/col/index.wxss b/employee-mp/src/components/col/index.wxss
new file mode 100644
index 0000000..42c1046
--- /dev/null
+++ b/employee-mp/src/components/col/index.wxss
@@ -0,0 +1,198 @@
+@import '../common/index.wxss';
+
+.cw-col {
+ float: left;
+ box-sizing: border-box;
+}
+
+.cw-col--1 {
+ width: 4.16666667%;
+}
+
+.cw-col--offset-1 {
+ margin-left: 4.16666667%;
+}
+
+.cw-col--2 {
+ width: 8.33333333%;
+}
+
+.cw-col--offset-2 {
+ margin-left: 8.33333333%;
+}
+
+.cw-col--3 {
+ width: 12.5%;
+}
+
+.cw-col--offset-3 {
+ margin-left: 12.5%;
+}
+
+.cw-col--4 {
+ width: 16.66666667%;
+}
+
+.cw-col--offset-4 {
+ margin-left: 16.66666667%;
+}
+
+.cw-col--5 {
+ width: 20.83333333%;
+}
+
+.cw-col--offset-5 {
+ margin-left: 20.83333333%;
+}
+
+.cw-col--6 {
+ width: 25%;
+}
+
+.cw-col--offset-6 {
+ margin-left: 25%;
+}
+
+.cw-col--7 {
+ width: 29.16666667%;
+}
+
+.cw-col--offset-7 {
+ margin-left: 29.16666667%;
+}
+
+.cw-col--8 {
+ width: 33.33333333%;
+}
+
+.cw-col--offset-8 {
+ margin-left: 33.33333333%;
+}
+
+.cw-col--9 {
+ width: 37.5%;
+}
+
+.cw-col--offset-9 {
+ margin-left: 37.5%;
+}
+
+.cw-col--10 {
+ width: 41.66666667%;
+}
+
+.cw-col--offset-10 {
+ margin-left: 41.66666667%;
+}
+
+.cw-col--11 {
+ width: 45.83333333%;
+}
+
+.cw-col--offset-11 {
+ margin-left: 45.83333333%;
+}
+
+.cw-col--12 {
+ width: 50%;
+}
+
+.cw-col--offset-12 {
+ margin-left: 50%;
+}
+
+.cw-col--13 {
+ width: 54.16666667%;
+}
+
+.cw-col--offset-13 {
+ margin-left: 54.16666667%;
+}
+
+.cw-col--14 {
+ width: 58.33333333%;
+}
+
+.cw-col--offset-14 {
+ margin-left: 58.33333333%;
+}
+
+.cw-col--15 {
+ width: 62.5%;
+}
+
+.cw-col--offset-15 {
+ margin-left: 62.5%;
+}
+
+.cw-col--16 {
+ width: 66.66666667%;
+}
+
+.cw-col--offset-16 {
+ margin-left: 66.66666667%;
+}
+
+.cw-col--17 {
+ width: 70.83333333%;
+}
+
+.cw-col--offset-17 {
+ margin-left: 70.83333333%;
+}
+
+.cw-col--18 {
+ width: 75%;
+}
+
+.cw-col--offset-18 {
+ margin-left: 75%;
+}
+
+.cw-col--19 {
+ width: 79.16666667%;
+}
+
+.cw-col--offset-19 {
+ margin-left: 79.16666667%;
+}
+
+.cw-col--20 {
+ width: 83.33333333%;
+}
+
+.cw-col--offset-20 {
+ margin-left: 83.33333333%;
+}
+
+.cw-col--21 {
+ width: 87.5%;
+}
+
+.cw-col--offset-21 {
+ margin-left: 87.5%;
+}
+
+.cw-col--22 {
+ width: 91.66666667%;
+}
+
+.cw-col--offset-22 {
+ margin-left: 91.66666667%;
+}
+
+.cw-col--23 {
+ width: 95.83333333%;
+}
+
+.cw-col--offset-23 {
+ margin-left: 95.83333333%;
+}
+
+.cw-col--24 {
+ width: 100%;
+}
+
+.cw-col--offset-24 {
+ margin-left: 100%;
+}
diff --git a/employee-mp/src/components/collapse-item/animate.js b/employee-mp/src/components/collapse-item/animate.js
new file mode 100644
index 0000000..1693ee8
--- /dev/null
+++ b/employee-mp/src/components/collapse-item/animate.js
@@ -0,0 +1,90 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { canIUseAnimate } from '../common/version';
+import { getRect } from '../common/utils';
+function useAnimate(context, expanded, mounted, height) {
+ const selector = '.cw-collapse-item__wrapper';
+ if (expanded) {
+ context.animate(
+ selector,
+ [
+ { height: 0, ease: 'ease-in-out', offset: 0 },
+ { height: `${height}px`, ease: 'ease-in-out', offset: 1 },
+ { height: `auto`, ease: 'ease-in-out', offset: 1 }
+ ],
+ mounted ? 300 : 0,
+ () => {
+ context.clearAnimation(selector);
+ }
+ );
+ return;
+ }
+ context.animate(
+ selector,
+ [
+ { height: `${height}px`, ease: 'ease-in-out', offset: 0 },
+ { height: 0, ease: 'ease-in-out', offset: 1 }
+ ],
+ 300,
+ () => {
+ context.clearAnimation(selector);
+ }
+ );
+}
+function useAnimation(context, expanded, mounted, height) {
+ const animation = wx.createAnimation({
+ duration: 0,
+ timingFunction: 'ease-in-out'
+ });
+ if (expanded) {
+ if (height === 0) {
+ animation
+ .height('auto')
+ .top(1)
+ .step();
+ } else {
+ animation
+ .height(height)
+ .top(1)
+ .step({
+ duration: mounted ? 300 : 1
+ })
+ .height('auto')
+ .step();
+ }
+ context.setData({
+ animation: animation.export()
+ });
+ return;
+ }
+ animation
+ .height(height)
+ .top(0)
+ .step({ duration: 1 })
+ .height(0)
+ .step({
+ duration: 300
+ });
+ context.setData({
+ animation: animation.export()
+ });
+}
+export function setContentAnimate(context, expanded, mounted) {
+ getRect(context, '.cw-collapse-item__content')
+ .then(rect => rect.height)
+ .then(height => {
+ canIUseAnimate()
+ ? useAnimate(context, expanded, mounted, height)
+ : useAnimation(context, expanded, mounted, height);
+ });
+}
diff --git a/employee-mp/src/components/collapse-item/index.js b/employee-mp/src/components/collapse-item/index.js
new file mode 100644
index 0000000..ef7b3af
--- /dev/null
+++ b/employee-mp/src/components/collapse-item/index.js
@@ -0,0 +1,69 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { useParent } from '../common/relation';
+import { setContentAnimate } from './animate';
+CwComponent({
+ classes: ['title-class', 'content-class'],
+ relation: useParent('collapse'),
+ props: {
+ name: null,
+ title: null,
+ value: null,
+ icon: String,
+ label: String,
+ disabled: Boolean,
+ clickable: Boolean,
+ border: {
+ type: Boolean,
+ value: true
+ },
+ isLink: {
+ type: Boolean,
+ value: true
+ }
+ },
+ data: {
+ expanded: false
+ },
+ mounted() {
+ this.updateExpanded();
+ this.mounted = true;
+ },
+ methods: {
+ updateExpanded() {
+ if (!this.parent) {
+ return;
+ }
+ const { value, accordion } = this.parent.data;
+ const { children = [] } = this.parent;
+ const { name } = this.data;
+ const index = children.indexOf(this);
+ const currentName = name == null ? index : name;
+ const expanded = accordion ? value === currentName : (value || []).some(name => name === currentName);
+ if (expanded !== this.data.expanded) {
+ setContentAnimate(this, expanded, this.mounted);
+ }
+ this.setData({ index, expanded });
+ },
+ onClick() {
+ if (this.data.disabled) {
+ return;
+ }
+ const { name, expanded } = this.data;
+ const index = this.parent.children.indexOf(this);
+ const currentName = name == null ? index : name;
+ this.parent.switch(currentName, !expanded);
+ }
+ }
+});
diff --git a/employee-mp/src/components/collapse-item/index.json b/employee-mp/src/components/collapse-item/index.json
new file mode 100644
index 0000000..51e706d
--- /dev/null
+++ b/employee-mp/src/components/collapse-item/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-cell": "../cell/index"
+ }
+}
diff --git a/employee-mp/src/components/collapse-item/index.wxml b/employee-mp/src/components/collapse-item/index.wxml
new file mode 100644
index 0000000..9ed8147
--- /dev/null
+++ b/employee-mp/src/components/collapse-item/index.wxml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/collapse-item/index.wxss b/employee-mp/src/components/collapse-item/index.wxss
new file mode 100644
index 0000000..98290e4
--- /dev/null
+++ b/employee-mp/src/components/collapse-item/index.wxss
@@ -0,0 +1,35 @@
+@import '../common/index.wxss';
+
+.cw-collapse-item__title .cw-cell__right-icon {
+ -webkit-transform: rotate(90deg);
+ transform: rotate(90deg);
+ transition: -webkit-transform 0.3s;
+ transition: transform 0.3s;
+ transition: transform 0.3s, -webkit-transform 0.3s;
+}
+
+.cw-collapse-item__title--expanded .cw-cell__right-icon {
+ -webkit-transform: rotate(-90deg);
+ transform: rotate(-90deg);
+}
+
+.cw-collapse-item__title--disabled .cw-cell,
+.cw-collapse-item__title--disabled .cw-cell__right-icon {
+ color: #c8c9cc !important;
+}
+
+.cw-collapse-item__title--disabled .cw-cell--hover {
+ background-color: #fff !important;
+}
+
+.cw-collapse-item__wrapper {
+ overflow: hidden;
+}
+
+.cw-collapse-item__content {
+ padding: 15px;
+ color: #969799;
+ font-size: 13px;
+ line-height: 1.5;
+ background-color: #fff;
+}
diff --git a/employee-mp/src/components/collapse/index.js b/employee-mp/src/components/collapse/index.js
new file mode 100644
index 0000000..887a974
--- /dev/null
+++ b/employee-mp/src/components/collapse/index.js
@@ -0,0 +1,54 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { useChildren } from '../common/relation';
+CwComponent({
+ relation: useChildren('collapse-item'),
+ props: {
+ value: {
+ type: null,
+ observer: 'updateExpanded'
+ },
+ accordion: {
+ type: Boolean,
+ observer: 'updateExpanded'
+ },
+ border: {
+ type: Boolean,
+ value: true
+ }
+ },
+ methods: {
+ updateExpanded() {
+ this.children.forEach(child => {
+ child.updateExpanded();
+ });
+ },
+ switch(name, expanded) {
+ const { accordion, value } = this.data;
+ const changeItem = name;
+ if (!accordion) {
+ name = expanded ? (value || []).concat(name) : (value || []).filter(activeName => activeName !== name);
+ } else {
+ name = expanded ? name : '';
+ }
+ if (expanded) {
+ this.$emit('open', changeItem);
+ } else {
+ this.$emit('close', changeItem);
+ }
+ this.$emit('change', name);
+ this.$emit('input', name);
+ }
+ }
+});
diff --git a/employee-mp/src/components/collapse/index.json b/employee-mp/src/components/collapse/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/collapse/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/collapse/index.wxml b/employee-mp/src/components/collapse/index.wxml
new file mode 100644
index 0000000..9874045
--- /dev/null
+++ b/employee-mp/src/components/collapse/index.wxml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/employee-mp/src/components/collapse/index.wxss b/employee-mp/src/components/collapse/index.wxss
new file mode 100644
index 0000000..ecfdfde
--- /dev/null
+++ b/employee-mp/src/components/collapse/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';
diff --git a/employee-mp/src/components/colleague/index.js b/employee-mp/src/components/colleague/index.js
new file mode 100644
index 0000000..b97f60f
--- /dev/null
+++ b/employee-mp/src/components/colleague/index.js
@@ -0,0 +1,61 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import utils from '../../utils/index';
+
+const app = getApp();
+
+CwComponent({
+ props: {
+ show: Boolean
+ },
+ data: {
+ map: {}
+ },
+ beforeCreate() {
+ utils
+ .request({
+ url: '/option/colleague',
+ method: 'post',
+ data: {
+ community_id: app.data.postInfo.default_community_id
+ }
+ })
+ .then(res => {
+ const map = {};
+
+ res.data.list.forEach(item => {
+ if (item.department in map) {
+ map[item.department].users.push(item);
+ } else {
+ map[item.department] = {
+ name: item.department,
+ users: [item]
+ };
+ }
+ });
+
+ this.setData({ map });
+ });
+ },
+ methods: {
+ onClose() {
+ this.$emit('close');
+ },
+ select(e) {
+ const { id, name } = e.currentTarget.dataset;
+
+ this.$emit('select', { id, name });
+ }
+ }
+});
diff --git a/employee-mp/src/components/colleague/index.json b/employee-mp/src/components/colleague/index.json
new file mode 100644
index 0000000..20ebe64
--- /dev/null
+++ b/employee-mp/src/components/colleague/index.json
@@ -0,0 +1,8 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-cell": "../cell",
+ "cw-cell-group": "../cell-group",
+ "cw-popup": "../popup"
+ }
+}
diff --git a/employee-mp/src/components/colleague/index.wxml b/employee-mp/src/components/colleague/index.wxml
new file mode 100644
index 0000000..c174951
--- /dev/null
+++ b/employee-mp/src/components/colleague/index.wxml
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/employee-mp/src/components/colleague/index.wxss b/employee-mp/src/components/colleague/index.wxss
new file mode 100644
index 0000000..e69de29
diff --git a/employee-mp/src/components/common/color.js b/employee-mp/src/components/common/color.js
new file mode 100644
index 0000000..1770115
--- /dev/null
+++ b/employee-mp/src/components/common/color.js
@@ -0,0 +1,19 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export const RED = '#ee0a24';
+export const BLUE = '#1989fa';
+export const WHITE = '#fff';
+export const GREEN = '#07c160';
+export const ORANGE = '#ff976a';
+export const GRAY = '#323233';
+export const GRAY_DARK = '#969799';
diff --git a/employee-mp/src/components/common/component.js b/employee-mp/src/components/common/component.js
new file mode 100644
index 0000000..2954f8a
--- /dev/null
+++ b/employee-mp/src/components/common/component.js
@@ -0,0 +1,57 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { basic } from '../mixins/basic';
+function mapKeys(source, target, map) {
+ Object.keys(map).forEach(key => {
+ if (source[key]) {
+ target[map[key]] = source[key];
+ }
+ });
+}
+function CwComponent(cwtOptions) {
+ const options = {};
+ mapKeys(cwtOptions, options, {
+ data: 'data',
+ props: 'properties',
+ mixins: 'behaviors',
+ methods: 'methods',
+ beforeCreate: 'created',
+ created: 'attached',
+ mounted: 'ready',
+ destroyed: 'detached',
+ classes: 'externalClasses'
+ });
+ // add default externalClasses
+ options.externalClasses = options.externalClasses || [];
+ options.externalClasses.push('custom-class');
+ // add default behaviors
+ options.behaviors = options.behaviors || [];
+ options.behaviors.push(basic);
+ // add relations
+ const { relation } = cwtOptions;
+ if (relation) {
+ options.relations = relation.relations;
+ options.behaviors.push(relation.mixin);
+ }
+ // map field to form-field behavior
+ if (cwtOptions.field) {
+ options.behaviors.push('wx://form-field');
+ }
+ // add default options
+ options.options = {
+ multipleSlots: true,
+ addGlobalClass: true
+ };
+ Component(options);
+}
+export { CwComponent };
diff --git a/employee-mp/src/components/common/index.wxss b/employee-mp/src/components/common/index.wxss
new file mode 100644
index 0000000..03a567a
--- /dev/null
+++ b/employee-mp/src/components/common/index.wxss
@@ -0,0 +1,83 @@
+.cw-ellipsis {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+
+.cw-multi-ellipsis--l2 {
+ -webkit-line-clamp: 2;
+}
+
+.cw-multi-ellipsis--l2,
+.cw-multi-ellipsis--l3 {
+ display: -webkit-box;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ -webkit-box-orient: vertical;
+}
+
+.cw-multi-ellipsis--l3 {
+ -webkit-line-clamp: 3;
+}
+
+.cw-clearfix:after {
+ display: table;
+ clear: both;
+ content: '';
+}
+
+.cw-hairline,
+.cw-hairline--bottom,
+.cw-hairline--left,
+.cw-hairline--right,
+.cw-hairline--surround,
+.cw-hairline--top,
+.cw-hairline--top-bottom {
+ position: relative;
+}
+
+.cw-hairline--bottom:after,
+.cw-hairline--left:after,
+.cw-hairline--right:after,
+.cw-hairline--surround:after,
+.cw-hairline--top-bottom:after,
+.cw-hairline--top:after,
+.cw-hairline:after {
+ position: absolute;
+ box-sizing: border-box;
+ -webkit-transform-origin: center;
+ transform-origin: center;
+ content: ' ';
+ pointer-events: none;
+ top: -50%;
+ right: -50%;
+ bottom: -50%;
+ left: -50%;
+ border: 0 solid #ebedf0;
+ -webkit-transform: scale(0.5);
+ transform: scale(0.5);
+}
+
+.cw-hairline--top:after {
+ border-top-width: 1px;
+}
+
+.cw-hairline--left:after {
+ border-left-width: 1px;
+}
+
+.cw-hairline--right:after {
+ border-right-width: 1px;
+}
+
+.cw-hairline--bottom:after {
+ border-bottom-width: 1px;
+}
+
+.cw-hairline--top-bottom:after {
+ border-width: 1px 0;
+}
+
+.cw-hairline--surround:after {
+ border-width: 1px;
+}
diff --git a/employee-mp/src/components/common/relation.js b/employee-mp/src/components/common/relation.js
new file mode 100644
index 0000000..3303480
--- /dev/null
+++ b/employee-mp/src/components/common/relation.js
@@ -0,0 +1,74 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export function useParent(name, onEffect) {
+ const path = `../${name}/index`;
+ return {
+ relations: {
+ [path]: {
+ type: 'ancestor',
+ linked() {
+ onEffect && onEffect.call(this);
+ },
+ linkChanged() {
+ onEffect && onEffect.call(this);
+ },
+ unlinked() {
+ onEffect && onEffect.call(this);
+ }
+ }
+ },
+ mixin: Behavior({
+ created() {
+ Object.defineProperty(this, 'parent', {
+ get: () => this.getRelationNodes(path)[0]
+ });
+ Object.defineProperty(this, 'index', {
+ // @ts-ignore
+ get: () => {
+ var _a, _b;
+ return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.children) === null ||
+ _b === void 0
+ ? void 0
+ : _b.indexOf(this);
+ }
+ });
+ }
+ })
+ };
+}
+export function useChildren(name, onEffect) {
+ const path = `../${name}/index`;
+ return {
+ relations: {
+ [path]: {
+ type: 'descendant',
+ linked(target) {
+ onEffect && onEffect.call(this, target);
+ },
+ linkChanged(target) {
+ onEffect && onEffect.call(this, target);
+ },
+ unlinked(target) {
+ onEffect && onEffect.call(this, target);
+ }
+ }
+ },
+ mixin: Behavior({
+ created() {
+ Object.defineProperty(this, 'children', {
+ get: () => this.getRelationNodes(path) || []
+ });
+ }
+ })
+ };
+}
diff --git a/employee-mp/src/components/common/style/clearfix.wxss b/employee-mp/src/components/common/style/clearfix.wxss
new file mode 100644
index 0000000..23dc673
--- /dev/null
+++ b/employee-mp/src/components/common/style/clearfix.wxss
@@ -0,0 +1,5 @@
+.cw-clearfix:after {
+ display: table;
+ clear: both;
+ content: '';
+}
diff --git a/employee-mp/src/components/common/style/ellipsis.wxss b/employee-mp/src/components/common/style/ellipsis.wxss
new file mode 100644
index 0000000..aa123da
--- /dev/null
+++ b/employee-mp/src/components/common/style/ellipsis.wxss
@@ -0,0 +1,18 @@
+.cw-ellipsis {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+.cw-multi-ellipsis--l2 {
+ -webkit-line-clamp: 2;
+}
+.cw-multi-ellipsis--l2,
+.cw-multi-ellipsis--l3 {
+ display: -webkit-box;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ -webkit-box-orient: vertical;
+}
+.cw-multi-ellipsis--l3 {
+ -webkit-line-clamp: 3;
+}
diff --git a/employee-mp/src/components/common/style/hairline.wxss b/employee-mp/src/components/common/style/hairline.wxss
new file mode 100644
index 0000000..b0894a8
--- /dev/null
+++ b/employee-mp/src/components/common/style/hairline.wxss
@@ -0,0 +1,55 @@
+.cw-hairline,
+.cw-hairline--bottom,
+.cw-hairline--left,
+.cw-hairline--right,
+.cw-hairline--surround,
+.cw-hairline--top,
+.cw-hairline--top-bottom {
+ position: relative;
+}
+
+.cw-hairline--bottom:after,
+.cw-hairline--left:after,
+.cw-hairline--right:after,
+.cw-hairline--surround:after,
+.cw-hairline--top-bottom:after,
+.cw-hairline--top:after,
+.cw-hairline:after {
+ position: absolute;
+ box-sizing: border-box;
+ -webkit-transform-origin: center;
+ transform-origin: center;
+ content: ' ';
+ pointer-events: none;
+ top: -50%;
+ right: -50%;
+ bottom: -50%;
+ left: -50%;
+ border: 0 solid #ebedf0;
+ -webkit-transform: scale(0.5);
+ transform: scale(0.5);
+}
+
+.cw-hairline--top:after {
+ border-top-width: 1px;
+}
+
+.cw-hairline--left:after {
+ border-left-width: 1px;
+}
+
+.cw-hairline--right:after {
+ border-right-width: 1px;
+}
+
+.cw-hairline--bottom:after {
+ border-bottom-width: 1px;
+}
+
+.cw-hairline--top-bottom:after {
+ border-width: 1px 0;
+}
+
+.cw-hairline--surround:after {
+ border-width: 1px;
+}
diff --git a/employee-mp/src/components/common/utils.js b/employee-mp/src/components/common/utils.js
new file mode 100644
index 0000000..24659d1
--- /dev/null
+++ b/employee-mp/src/components/common/utils.js
@@ -0,0 +1,101 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { isDef, isNumber, isPlainObject, isPromise } from './validator';
+import { canIUseGroupSetData, canIUseNextTick } from './version';
+export function range(num, min, max) {
+ return Math.min(Math.max(num, min), max);
+}
+export function nextTick(cb) {
+ if (canIUseNextTick()) {
+ wx.nextTick(cb);
+ } else {
+ setTimeout(() => {
+ cb();
+ }, 1000 / 30);
+ }
+}
+let systemInfo;
+export function getSystemInfoSync() {
+ if (systemInfo == null) {
+ systemInfo = wx.getSystemInfoSync();
+ }
+ return systemInfo;
+}
+export function addUnit(value) {
+ if (!isDef(value)) {
+ return undefined;
+ }
+ value = String(value);
+ return isNumber(value) ? `${value}px` : value;
+}
+export function requestAnimationFrame(cb) {
+ const systemInfo = getSystemInfoSync();
+ if (systemInfo.platform === 'devtools') {
+ return setTimeout(() => {
+ cb();
+ }, 1000 / 30);
+ }
+ return wx
+ .createSelectorQuery()
+ .selectViewport()
+ .boundingClientRect()
+ .exec(() => {
+ cb();
+ });
+}
+export function pickExclude(obj, keys) {
+ if (!isPlainObject(obj)) {
+ return {};
+ }
+ return Object.keys(obj).reduce((prev, key) => {
+ if (!keys.includes(key)) {
+ prev[key] = obj[key];
+ }
+ return prev;
+ }, {});
+}
+export function getRect(context, selector) {
+ return new Promise(resolve => {
+ wx.createSelectorQuery()
+ .in(context)
+ .select(selector)
+ .boundingClientRect()
+ .exec((rect = []) => resolve(rect[0]));
+ });
+}
+export function getAllRect(context, selector) {
+ return new Promise(resolve => {
+ wx.createSelectorQuery()
+ .in(context)
+ .selectAll(selector)
+ .boundingClientRect()
+ .exec((rect = []) => resolve(rect[0]));
+ });
+}
+export function groupSetData(context, cb) {
+ if (canIUseGroupSetData()) {
+ context.groupSetData(cb);
+ } else {
+ cb();
+ }
+}
+export function toPromise(promiseLike) {
+ if (isPromise(promiseLike)) {
+ return promiseLike;
+ }
+ return Promise.resolve(promiseLike);
+}
+export function getCurrentPage() {
+ const pages = getCurrentPages();
+ return pages[pages.length - 1];
+}
diff --git a/employee-mp/src/components/common/validator.js b/employee-mp/src/components/common/validator.js
new file mode 100644
index 0000000..e804e84
--- /dev/null
+++ b/employee-mp/src/components/common/validator.js
@@ -0,0 +1,42 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export function isFunction(val) {
+ return typeof val === 'function';
+}
+export function isPlainObject(val) {
+ return val !== null && typeof val === 'object' && !Array.isArray(val);
+}
+export function isPromise(val) {
+ return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch);
+}
+export function isDef(value) {
+ return value !== undefined && value !== null;
+}
+export function isObj(x) {
+ const type = typeof x;
+ return x !== null && (type === 'object' || type === 'function');
+}
+export function isNumber(value) {
+ return /^\d+(\.\d+)?$/.test(value);
+}
+export function isBoolean(value) {
+ return typeof value === 'boolean';
+}
+const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
+const VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i;
+export function isImageUrl(url) {
+ return IMAGE_REGEXP.test(url);
+}
+export function isVideoUrl(url) {
+ return VIDEO_REGEXP.test(url);
+}
diff --git a/employee-mp/src/components/common/version.js b/employee-mp/src/components/common/version.js
new file mode 100644
index 0000000..eb022b3
--- /dev/null
+++ b/employee-mp/src/components/common/version.js
@@ -0,0 +1,57 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { getSystemInfoSync } from './utils';
+function compareVersion(v1, v2) {
+ v1 = v1.split('.');
+ v2 = v2.split('.');
+ const len = Math.max(v1.length, v2.length);
+ while (v1.length < len) {
+ v1.push('0');
+ }
+ while (v2.length < len) {
+ v2.push('0');
+ }
+ for (let i = 0; i < len; i++) {
+ const num1 = parseInt(v1[i], 10);
+ const num2 = parseInt(v2[i], 10);
+ if (num1 > num2) {
+ return 1;
+ }
+ if (num1 < num2) {
+ return -1;
+ }
+ }
+ return 0;
+}
+function gte(version) {
+ const system = getSystemInfoSync();
+ return compareVersion(system.SDKVersion, version) >= 0;
+}
+export function canIUseModel() {
+ return gte('2.9.3');
+}
+export function canIUseFormFieldButton() {
+ return gte('2.10.3');
+}
+export function canIUseAnimate() {
+ return gte('2.9.0');
+}
+export function canIUseGroupSetData() {
+ return gte('2.4.0');
+}
+export function canIUseNextTick() {
+ return wx.canIUse('nextTick');
+}
+export function canIUseCanvas2d() {
+ return gte('2.9.0');
+}
diff --git a/employee-mp/src/components/copyright/index.js b/employee-mp/src/components/copyright/index.js
new file mode 100644
index 0000000..ede7e0c
--- /dev/null
+++ b/employee-mp/src/components/copyright/index.js
@@ -0,0 +1,25 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import * as config from '../../config';
+
+CwComponent({
+ data: {
+ version: config.VERSION
+ },
+ props: {
+ fixed: Number,
+ dark: Boolean,
+ inTabPage: Boolean
+ }
+});
diff --git a/employee-mp/src/components/copyright/index.json b/employee-mp/src/components/copyright/index.json
new file mode 100644
index 0000000..85e5843
--- /dev/null
+++ b/employee-mp/src/components/copyright/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index"
+ }
+}
diff --git a/employee-mp/src/components/copyright/index.wxml b/employee-mp/src/components/copyright/index.wxml
new file mode 100644
index 0000000..bb9b2ce
--- /dev/null
+++ b/employee-mp/src/components/copyright/index.wxml
@@ -0,0 +1,10 @@
+
+
+
+
+
+ e家宜业 v{{ version }}
+ 卓瓦科技版权所有 保留所有权利
+ https://ejyy.chowa.cn
+
+
diff --git a/employee-mp/src/components/copyright/index.wxss b/employee-mp/src/components/copyright/index.wxss
new file mode 100644
index 0000000..d75c527
--- /dev/null
+++ b/employee-mp/src/components/copyright/index.wxss
@@ -0,0 +1,47 @@
+.cw-copyright {
+ padding: 34px 0;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ position: relative;
+ z-index: 5;
+ color: #d4d5d6;
+}
+
+.cw-copyright.dark {
+ color: #999;
+}
+
+.cw-copyright.fixed {
+ position: fixed;
+ left: 0;
+ right: 0;
+ bottom: constant(safe-area-inset-bottom);
+ bottom: env(safe-area-inset-bottom);
+}
+
+.cw-copyright.in-tab-page {
+ position: absolute;
+}
+
+.cw-copyright .chowa,
+.cw-copyright .logo {
+ font-size: 42px;
+ flex: none;
+}
+
+.cw-copyright .chowa {
+ margin-right: 8px;
+}
+
+.cw-copyright .cw-company {
+ margin-left: 16px;
+ flex: none;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ font-size: 12px;
+ line-height: 20px;
+}
diff --git a/employee-mp/src/components/count-down/index.js b/employee-mp/src/components/count-down/index.js
new file mode 100644
index 0000000..e4c9baa
--- /dev/null
+++ b/employee-mp/src/components/count-down/index.js
@@ -0,0 +1,111 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { isSameSecond, parseFormat, parseTimeData } from './utils';
+function simpleTick(fn) {
+ return setTimeout(fn, 30);
+}
+CwComponent({
+ props: {
+ useSlot: Boolean,
+ millisecond: Boolean,
+ time: {
+ type: Number,
+ observer: 'reset'
+ },
+ format: {
+ type: String,
+ value: 'HH:mm:ss'
+ },
+ autoStart: {
+ type: Boolean,
+ value: true
+ }
+ },
+ data: {
+ timeData: parseTimeData(0),
+ formattedTime: '0'
+ },
+ destroyed() {
+ clearTimeout(this.tid);
+ this.tid = null;
+ },
+ methods: {
+ // 开始
+ start() {
+ if (this.counting) {
+ return;
+ }
+ this.counting = true;
+ this.endTime = Date.now() + this.remain;
+ this.tick();
+ },
+ // 暂停
+ pause() {
+ this.counting = false;
+ clearTimeout(this.tid);
+ },
+ // 重置
+ reset() {
+ this.pause();
+ this.remain = this.data.time;
+ this.setRemain(this.remain);
+ if (this.data.autoStart) {
+ this.start();
+ }
+ },
+ tick() {
+ if (this.data.millisecond) {
+ this.microTick();
+ } else {
+ this.macroTick();
+ }
+ },
+ microTick() {
+ this.tid = simpleTick(() => {
+ this.setRemain(this.getRemain());
+ if (this.remain !== 0) {
+ this.microTick();
+ }
+ });
+ },
+ macroTick() {
+ this.tid = simpleTick(() => {
+ const remain = this.getRemain();
+ if (!isSameSecond(remain, this.remain) || remain === 0) {
+ this.setRemain(remain);
+ }
+ if (this.remain !== 0) {
+ this.macroTick();
+ }
+ });
+ },
+ getRemain() {
+ return Math.max(this.endTime - Date.now(), 0);
+ },
+ setRemain(remain) {
+ this.remain = remain;
+ const timeData = parseTimeData(remain);
+ if (this.data.useSlot) {
+ this.$emit('change', timeData);
+ }
+ this.setData({
+ formattedTime: parseFormat(this.data.format, timeData)
+ });
+ if (remain === 0) {
+ this.pause();
+ this.$emit('finish');
+ }
+ }
+ }
+});
diff --git a/employee-mp/src/components/count-down/index.json b/employee-mp/src/components/count-down/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/count-down/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/count-down/index.wxml b/employee-mp/src/components/count-down/index.wxml
new file mode 100644
index 0000000..0098c33
--- /dev/null
+++ b/employee-mp/src/components/count-down/index.wxml
@@ -0,0 +1,4 @@
+
+
+ {{ formattedTime }}
+
diff --git a/employee-mp/src/components/count-down/index.wxss b/employee-mp/src/components/count-down/index.wxss
new file mode 100644
index 0000000..bea14f3
--- /dev/null
+++ b/employee-mp/src/components/count-down/index.wxss
@@ -0,0 +1,7 @@
+@import '../common/index.wxss';
+
+.cw-count-down {
+ color: #323233;
+ font-size: 14px;
+ line-height: 20px;
+}
diff --git a/employee-mp/src/components/count-down/utils.js b/employee-mp/src/components/count-down/utils.js
new file mode 100644
index 0000000..f0cc9df
--- /dev/null
+++ b/employee-mp/src/components/count-down/utils.js
@@ -0,0 +1,65 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+function padZero(num, targetLength = 2) {
+ let str = num + '';
+ while (str.length < targetLength) {
+ str = '0' + str;
+ }
+ return str;
+}
+const SECOND = 1000;
+const MINUTE = 60 * SECOND;
+const HOUR = 60 * MINUTE;
+const DAY = 24 * HOUR;
+export function parseTimeData(time) {
+ const days = Math.floor(time / DAY);
+ const hours = Math.floor((time % DAY) / HOUR);
+ const minutes = Math.floor((time % HOUR) / MINUTE);
+ const seconds = Math.floor((time % MINUTE) / SECOND);
+ const milliseconds = Math.floor(time % SECOND);
+ return {
+ days,
+ hours,
+ minutes,
+ seconds,
+ milliseconds
+ };
+}
+export function parseFormat(format, timeData) {
+ const { days } = timeData;
+ let { hours, minutes, seconds, milliseconds } = timeData;
+ if (format.indexOf('DD') === -1) {
+ hours += days * 24;
+ } else {
+ format = format.replace('DD', padZero(days));
+ }
+ if (format.indexOf('HH') === -1) {
+ minutes += hours * 60;
+ } else {
+ format = format.replace('HH', padZero(hours));
+ }
+ if (format.indexOf('mm') === -1) {
+ seconds += minutes * 60;
+ } else {
+ format = format.replace('mm', padZero(minutes));
+ }
+ if (format.indexOf('ss') === -1) {
+ milliseconds += seconds * 1000;
+ } else {
+ format = format.replace('ss', padZero(seconds));
+ }
+ return format.replace('SSS', padZero(milliseconds, 3));
+}
+export function isSameSecond(time1, time2) {
+ return Math.floor(time1 / 1000) === Math.floor(time2 / 1000);
+}
diff --git a/employee-mp/src/components/datetime-picker/index.js b/employee-mp/src/components/datetime-picker/index.js
new file mode 100644
index 0000000..1c432f2
--- /dev/null
+++ b/employee-mp/src/components/datetime-picker/index.js
@@ -0,0 +1,317 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { isDef } from '../common/validator';
+import { pickerProps } from '../picker/shared';
+const currentYear = new Date().getFullYear();
+function isValidDate(date) {
+ return isDef(date) && !isNaN(new Date(date).getTime());
+}
+function range(num, min, max) {
+ return Math.min(Math.max(num, min), max);
+}
+function padZero(val) {
+ return `00${val}`.slice(-2);
+}
+function times(n, iteratee) {
+ let index = -1;
+ const result = Array(n < 0 ? 0 : n);
+ while (++index < n) {
+ result[index] = iteratee(index);
+ }
+ return result;
+}
+function getTrueValue(formattedValue) {
+ if (formattedValue === undefined) {
+ formattedValue = '1';
+ }
+ while (isNaN(parseInt(formattedValue, 10))) {
+ formattedValue = formattedValue.slice(1);
+ }
+ return parseInt(formattedValue, 10);
+}
+function getMonthEndDay(year, month) {
+ return 32 - new Date(year, month - 1, 32).getDate();
+}
+const defaultFormatter = (type, value) => value;
+CwComponent({
+ classes: ['active-class', 'toolbar-class', 'column-class'],
+ props: Object.assign(Object.assign({}, pickerProps), {
+ value: {
+ type: null,
+ observer: 'updateValue'
+ },
+ filter: null,
+ type: {
+ type: String,
+ value: 'datetime',
+ observer: 'updateValue'
+ },
+ showToolbar: {
+ type: Boolean,
+ value: true
+ },
+ formatter: {
+ type: null,
+ value: defaultFormatter
+ },
+ minDate: {
+ type: Number,
+ value: new Date(currentYear - 10, 0, 1).getTime(),
+ observer: 'updateValue'
+ },
+ maxDate: {
+ type: Number,
+ value: new Date(currentYear + 10, 11, 31).getTime(),
+ observer: 'updateValue'
+ },
+ minHour: {
+ type: Number,
+ value: 0,
+ observer: 'updateValue'
+ },
+ maxHour: {
+ type: Number,
+ value: 23,
+ observer: 'updateValue'
+ },
+ minMinute: {
+ type: Number,
+ value: 0,
+ observer: 'updateValue'
+ },
+ maxMinute: {
+ type: Number,
+ value: 59,
+ observer: 'updateValue'
+ }
+ }),
+ data: {
+ innerValue: Date.now(),
+ columns: []
+ },
+ methods: {
+ updateValue() {
+ const { data } = this;
+ const val = this.correctValue(data.value);
+ const isEqual = val === data.innerValue;
+ if (!isEqual) {
+ this.updateColumnValue(val).then(() => {
+ this.$emit('input', val);
+ });
+ } else {
+ this.updateColumns();
+ }
+ },
+ getPicker() {
+ if (this.picker == null) {
+ this.picker = this.selectComponent('.cw-datetime-picker');
+ const { picker } = this;
+ const { setColumnValues } = picker;
+ picker.setColumnValues = (...args) => setColumnValues.apply(picker, [...args, false]);
+ }
+ return this.picker;
+ },
+ updateColumns() {
+ const { formatter = defaultFormatter } = this.data;
+ const results = this.getOriginColumns().map(column => ({
+ values: column.values.map(value => formatter(column.type, value))
+ }));
+ return this.set({ columns: results });
+ },
+ getOriginColumns() {
+ const { filter } = this.data;
+ const results = this.getRanges().map(({ type, range }) => {
+ let values = times(range[1] - range[0] + 1, index => {
+ let value = range[0] + index;
+ value = type === 'year' ? `${value}` : padZero(value);
+ return value;
+ });
+ if (filter) {
+ values = filter(type, values);
+ }
+ return { type, values };
+ });
+ return results;
+ },
+ getRanges() {
+ const { data } = this;
+ if (data.type === 'time') {
+ return [
+ {
+ type: 'hour',
+ range: [data.minHour, data.maxHour]
+ },
+ {
+ type: 'minute',
+ range: [data.minMinute, data.maxMinute]
+ }
+ ];
+ }
+ const { maxYear, maxDate, maxMonth, maxHour, maxMinute } = this.getBoundary('max', data.innerValue);
+ const { minYear, minDate, minMonth, minHour, minMinute } = this.getBoundary('min', data.innerValue);
+ const result = [
+ {
+ type: 'year',
+ range: [minYear, maxYear]
+ },
+ {
+ type: 'month',
+ range: [minMonth, maxMonth]
+ },
+ {
+ type: 'day',
+ range: [minDate, maxDate]
+ },
+ {
+ type: 'hour',
+ range: [minHour, maxHour]
+ },
+ {
+ type: 'minute',
+ range: [minMinute, maxMinute]
+ }
+ ];
+ if (data.type === 'date') result.splice(3, 2);
+ if (data.type === 'year-month') result.splice(2, 3);
+ return result;
+ },
+ correctValue(value) {
+ const { data } = this;
+ // validate value
+ const isDateType = data.type !== 'time';
+ if (isDateType && !isValidDate(value)) {
+ value = data.minDate;
+ } else if (!isDateType && !value) {
+ const { minHour } = data;
+ value = `${padZero(minHour)}:00`;
+ }
+ // time type
+ if (!isDateType) {
+ let [hour, minute] = value.split(':');
+ hour = padZero(range(hour, data.minHour, data.maxHour));
+ minute = padZero(range(minute, data.minMinute, data.maxMinute));
+ return `${hour}:${minute}`;
+ }
+ // date type
+ value = Math.max(value, data.minDate);
+ value = Math.min(value, data.maxDate);
+ return value;
+ },
+ getBoundary(type, innerValue) {
+ const value = new Date(innerValue);
+ const boundary = new Date(this.data[`${type}Date`]);
+ const year = boundary.getFullYear();
+ let month = 1;
+ let date = 1;
+ let hour = 0;
+ let minute = 0;
+ if (type === 'max') {
+ month = 12;
+ date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
+ hour = 23;
+ minute = 59;
+ }
+ if (value.getFullYear() === year) {
+ month = boundary.getMonth() + 1;
+ if (value.getMonth() + 1 === month) {
+ date = boundary.getDate();
+ if (value.getDate() === date) {
+ hour = boundary.getHours();
+ if (value.getHours() === hour) {
+ minute = boundary.getMinutes();
+ }
+ }
+ }
+ }
+ return {
+ [`${type}Year`]: year,
+ [`${type}Month`]: month,
+ [`${type}Date`]: date,
+ [`${type}Hour`]: hour,
+ [`${type}Minute`]: minute
+ };
+ },
+ onCancel() {
+ this.$emit('cancel');
+ },
+ onConfirm() {
+ this.$emit('confirm', this.data.innerValue);
+ },
+ onChange() {
+ const { data } = this;
+ let value;
+ const picker = this.getPicker();
+ const originColumns = this.getOriginColumns();
+ if (data.type === 'time') {
+ const indexes = picker.getIndexes();
+ value = `${+originColumns[0].values[indexes[0]]}:${+originColumns[1].values[indexes[1]]}`;
+ } else {
+ const indexes = picker.getIndexes();
+ const values = indexes.map((value, index) => originColumns[index].values[value]);
+ const year = getTrueValue(values[0]);
+ const month = getTrueValue(values[1]);
+ const maxDate = getMonthEndDay(year, month);
+ let date = getTrueValue(values[2]);
+ if (data.type === 'year-month') {
+ date = 1;
+ }
+ date = date > maxDate ? maxDate : date;
+ let hour = 0;
+ let minute = 0;
+ if (data.type === 'datetime') {
+ hour = getTrueValue(values[3]);
+ minute = getTrueValue(values[4]);
+ }
+ value = new Date(year, month - 1, date, hour, minute);
+ }
+ value = this.correctValue(value);
+ this.updateColumnValue(value).then(() => {
+ this.$emit('input', value);
+ this.$emit('change', picker);
+ });
+ },
+ updateColumnValue(value) {
+ let values = [];
+ const { type } = this.data;
+ const formatter = this.data.formatter || defaultFormatter;
+ const picker = this.getPicker();
+ if (type === 'time') {
+ const pair = value.split(':');
+ values = [formatter('hour', pair[0]), formatter('minute', pair[1])];
+ } else {
+ const date = new Date(value);
+ values = [formatter('year', `${date.getFullYear()}`), formatter('month', padZero(date.getMonth() + 1))];
+ if (type === 'date') {
+ values.push(formatter('day', padZero(date.getDate())));
+ }
+ if (type === 'datetime') {
+ values.push(
+ formatter('day', padZero(date.getDate())),
+ formatter('hour', padZero(date.getHours())),
+ formatter('minute', padZero(date.getMinutes()))
+ );
+ }
+ }
+ return this.set({ innerValue: value })
+ .then(() => this.updateColumns())
+ .then(() => picker.setValues(values));
+ }
+ },
+ created() {
+ const innerValue = this.correctValue(this.data.value);
+ this.updateColumnValue(innerValue).then(() => {
+ this.$emit('input', innerValue);
+ });
+ }
+});
diff --git a/employee-mp/src/components/datetime-picker/index.json b/employee-mp/src/components/datetime-picker/index.json
new file mode 100644
index 0000000..8e19f5d
--- /dev/null
+++ b/employee-mp/src/components/datetime-picker/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-picker": "../picker/index"
+ }
+}
diff --git a/employee-mp/src/components/datetime-picker/index.wxml b/employee-mp/src/components/datetime-picker/index.wxml
new file mode 100644
index 0000000..658a5ac
--- /dev/null
+++ b/employee-mp/src/components/datetime-picker/index.wxml
@@ -0,0 +1,16 @@
+
diff --git a/employee-mp/src/components/datetime-picker/index.wxss b/employee-mp/src/components/datetime-picker/index.wxss
new file mode 100644
index 0000000..ecfdfde
--- /dev/null
+++ b/employee-mp/src/components/datetime-picker/index.wxss
@@ -0,0 +1 @@
+@import '../common/index.wxss';
diff --git a/employee-mp/src/components/definitions/index.js b/employee-mp/src/components/definitions/index.js
new file mode 100644
index 0000000..f150f20
--- /dev/null
+++ b/employee-mp/src/components/definitions/index.js
@@ -0,0 +1,13 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export {};
diff --git a/employee-mp/src/components/dialog/dialog.js b/employee-mp/src/components/dialog/dialog.js
new file mode 100644
index 0000000..f6ca05e
--- /dev/null
+++ b/employee-mp/src/components/dialog/dialog.js
@@ -0,0 +1,93 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+let queue = [];
+const defaultOptions = {
+ show: false,
+ title: '',
+ width: null,
+ theme: 'default',
+ message: '',
+ zIndex: 100,
+ overlay: true,
+ selector: '#cw-dialog',
+ className: '',
+ asyncClose: false,
+ beforeClose: null,
+ transition: 'scale',
+ customStyle: '',
+ messageAlign: '',
+ overlayStyle: '',
+ confirmButtonText: '确认',
+ cancelButtonText: '取消',
+ showConfirmButton: true,
+ showCancelButton: false,
+ closeOnClickOverlay: false,
+ confirmButtonOpenType: ''
+};
+let currentOptions = Object.assign({}, defaultOptions);
+function getContext() {
+ const pages = getCurrentPages();
+ return pages[pages.length - 1];
+}
+const Dialog = options => {
+ options = Object.assign(Object.assign({}, currentOptions), options);
+ return new Promise((resolve, reject) => {
+ const context = options.context || getContext();
+ const dialog = context.selectComponent(options.selector);
+ delete options.context;
+ delete options.selector;
+ if (dialog) {
+ dialog.setData(
+ Object.assign(
+ {
+ callback: (action, instance) => {
+ action === 'confirm' ? resolve(instance) : reject(instance);
+ }
+ },
+ options
+ )
+ );
+ wx.nextTick(() => {
+ dialog.setData({ show: true });
+ });
+ queue.push(dialog);
+ } else {
+ console.warn('未找到 cw-dialog 节点,请确认 selector 及 context 是否正确');
+ }
+ });
+};
+Dialog.alert = options => Dialog(options);
+Dialog.confirm = options => Dialog(Object.assign({ showCancelButton: true }, options));
+Dialog.close = () => {
+ queue.forEach(dialog => {
+ dialog.close();
+ });
+ queue = [];
+};
+Dialog.stopLoading = () => {
+ queue.forEach(dialog => {
+ dialog.stopLoading();
+ });
+};
+Dialog.currentOptions = currentOptions;
+Dialog.defaultOptions = defaultOptions;
+Dialog.setDefaultOptions = options => {
+ currentOptions = Object.assign(Object.assign({}, currentOptions), options);
+ Dialog.currentOptions = currentOptions;
+};
+Dialog.resetDefaultOptions = () => {
+ currentOptions = Object.assign({}, defaultOptions);
+ Dialog.currentOptions = currentOptions;
+};
+Dialog.resetDefaultOptions();
+export default Dialog;
diff --git a/employee-mp/src/components/dialog/index.js b/employee-mp/src/components/dialog/index.js
new file mode 100644
index 0000000..4a955f7
--- /dev/null
+++ b/employee-mp/src/components/dialog/index.js
@@ -0,0 +1,134 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { button } from '../mixins/button';
+import { openType } from '../mixins/open-type';
+import { GRAY, RED } from '../common/color';
+import { toPromise } from '../common/utils';
+CwComponent({
+ mixins: [button, openType],
+ props: {
+ show: {
+ type: Boolean,
+ observer(show) {
+ !show && this.stopLoading();
+ }
+ },
+ title: String,
+ message: String,
+ theme: {
+ type: String,
+ value: 'default'
+ },
+ useSlot: Boolean,
+ className: String,
+ customStyle: String,
+ asyncClose: Boolean,
+ messageAlign: String,
+ beforeClose: null,
+ overlayStyle: String,
+ useTitleSlot: Boolean,
+ showCancelButton: Boolean,
+ closeOnClickOverlay: Boolean,
+ confirmButtonOpenType: String,
+ width: null,
+ zIndex: {
+ type: Number,
+ value: 2000
+ },
+ confirmButtonText: {
+ type: String,
+ value: '确认'
+ },
+ cancelButtonText: {
+ type: String,
+ value: '取消'
+ },
+ confirmButtonColor: {
+ type: String,
+ value: RED
+ },
+ cancelButtonColor: {
+ type: String,
+ value: GRAY
+ },
+ showConfirmButton: {
+ type: Boolean,
+ value: true
+ },
+ overlay: {
+ type: Boolean,
+ value: true
+ },
+ transition: {
+ type: String,
+ value: 'scale'
+ }
+ },
+ data: {
+ loading: {
+ confirm: false,
+ cancel: false
+ },
+ callback: () => {}
+ },
+ methods: {
+ onConfirm() {
+ this.handleAction('confirm');
+ },
+ onCancel() {
+ this.handleAction('cancel');
+ },
+ onClickOverlay() {
+ this.close('overlay');
+ },
+ close(action) {
+ this.setData({ show: false });
+ wx.nextTick(() => {
+ this.$emit('close', action);
+ const { callback } = this.data;
+ if (callback) {
+ callback(action, this);
+ }
+ });
+ },
+ stopLoading() {
+ this.setData({
+ loading: {
+ confirm: false,
+ cancel: false
+ }
+ });
+ },
+ handleAction(action) {
+ this.$emit(action, { dialog: this });
+ const { asyncClose, beforeClose } = this.data;
+ if (!asyncClose && !beforeClose) {
+ this.close(action);
+ return;
+ }
+ this.setData({
+ [`loading.${action}`]: true
+ });
+ if (beforeClose) {
+ toPromise(beforeClose(action)).then(value => {
+ if (value) {
+ this.close(action);
+ } else {
+ this.stopLoading();
+ }
+ });
+ }
+ }
+ }
+});
diff --git a/employee-mp/src/components/dialog/index.json b/employee-mp/src/components/dialog/index.json
new file mode 100644
index 0000000..d1db410
--- /dev/null
+++ b/employee-mp/src/components/dialog/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-popup": "../popup/index",
+ "cw-button": "../button/index"
+ }
+}
diff --git a/employee-mp/src/components/dialog/index.wxml b/employee-mp/src/components/dialog/index.wxml
new file mode 100644
index 0000000..7657c26
--- /dev/null
+++ b/employee-mp/src/components/dialog/index.wxml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+ {{ message }}
+
+
+
+
diff --git a/employee-mp/src/components/dialog/index.wxss b/employee-mp/src/components/dialog/index.wxss
new file mode 100644
index 0000000..cc0a5ea
--- /dev/null
+++ b/employee-mp/src/components/dialog/index.wxss
@@ -0,0 +1,89 @@
+@import '../common/index.wxss';
+
+.cw-dialog {
+ top: 45% !important;
+ overflow: hidden;
+ width: 320px;
+ font-size: 16px;
+ border-radius: 16px;
+ background-color: #fff;
+}
+
+@media (max-width: 321px) {
+ .cw-dialog {
+ width: 90%;
+ }
+}
+
+.cw-dialog__header {
+ text-align: center;
+ padding-top: 24px;
+ font-weight: 500;
+ line-height: 24px;
+}
+
+.cw-dialog__header--isolated {
+ padding: 24px 0;
+}
+
+.cw-dialog__message {
+ overflow-y: auto;
+ text-align: center;
+ -webkit-overflow-scrolling: touch;
+ font-size: 14px;
+ line-height: 20px;
+ max-height: 60vh;
+ padding: 24px;
+}
+
+.cw-dialog__message-text {
+ word-wrap: break-word;
+}
+
+.cw-dialog__message--hasTitle {
+ padding-top: 8px;
+ color: #646566;
+}
+
+.cw-dialog__message--round-button {
+ padding-bottom: 16px;
+ color: #323233;
+}
+
+.cw-dialog__message--left {
+ text-align: left;
+}
+
+.cw-dialog__message--right {
+ text-align: right;
+}
+
+.cw-dialog__footer {
+ display: -webkit-flex;
+ display: flex;
+}
+
+.cw-dialog__footer--round-button {
+ position: relative !important;
+ padding: 8px 24px 16px !important;
+}
+
+.cw-dialog__button {
+ -webkit-flex: 1;
+ flex: 1;
+}
+
+.cw-dialog__cancel,
+.cw-dialog__confirm {
+ border: 0 !important;
+}
+
+.cw-dialog-bounce-enter {
+ transform: translate3d(-50%, -50%, 0) scale(0.7);
+ opacity: 0;
+}
+
+.cw-dialog-bounce-leave-active {
+ transform: translate3d(-50%, -50%, 0) scale(0.9);
+ opacity: 0;
+}
diff --git a/employee-mp/src/components/divider/index.js b/employee-mp/src/components/divider/index.js
new file mode 100644
index 0000000..8d4d113
--- /dev/null
+++ b/employee-mp/src/components/divider/index.js
@@ -0,0 +1,24 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+CwComponent({
+ props: {
+ dashed: Boolean,
+ hairline: Boolean,
+ contentPosition: String,
+ fontSize: String,
+ borderColor: String,
+ textColor: String,
+ customStyle: String
+ }
+});
diff --git a/employee-mp/src/components/divider/index.json b/employee-mp/src/components/divider/index.json
new file mode 100644
index 0000000..59a1db6
--- /dev/null
+++ b/employee-mp/src/components/divider/index.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
diff --git a/employee-mp/src/components/divider/index.wxml b/employee-mp/src/components/divider/index.wxml
new file mode 100644
index 0000000..9d47f21
--- /dev/null
+++ b/employee-mp/src/components/divider/index.wxml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/employee-mp/src/components/divider/index.wxs b/employee-mp/src/components/divider/index.wxs
new file mode 100644
index 0000000..42f5210
--- /dev/null
+++ b/employee-mp/src/components/divider/index.wxs
@@ -0,0 +1,17 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function rootStyle(data) {
+ return style([
+ {
+ 'border-color': data.borderColor,
+ color: data.textColor,
+ 'font-size': addUnit(data.fontSize)
+ },
+ data.customStyle
+ ]);
+}
+
+module.exports = {
+ rootStyle: rootStyle
+};
diff --git a/employee-mp/src/components/divider/index.wxss b/employee-mp/src/components/divider/index.wxss
new file mode 100644
index 0000000..93af82e
--- /dev/null
+++ b/employee-mp/src/components/divider/index.wxss
@@ -0,0 +1,60 @@
+@import '../common/index.wxss';
+
+.cw-divider {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ margin: 16px 0;
+ color: #969799;
+ font-size: 12px;
+ line-height: 24px;
+ border: 0 solid #ebedf0;
+}
+
+.cw-divider:after,
+.cw-divider:before {
+ display: block;
+ -webkit-flex: 1;
+ flex: 1;
+ box-sizing: border-box;
+ height: 1px;
+ border-color: inherit;
+ border-style: inherit;
+ border-width: 1px 0 0;
+}
+
+.cw-divider:before {
+ content: '';
+}
+
+.cw-divider--hairline:after,
+.cw-divider--hairline:before {
+ -webkit-transform: scaleY(0.5);
+ transform: scaleY(0.5);
+}
+
+.cw-divider--dashed {
+ border-style: dashed;
+}
+
+.cw-divider--center:before,
+.cw-divider--left:before,
+.cw-divider--right:before {
+ margin-right: 16px;
+}
+
+.cw-divider--center:after,
+.cw-divider--left:after,
+.cw-divider--right:after {
+ content: '';
+ margin-left: 16px;
+}
+
+.cw-divider--left:before {
+ max-width: 10%;
+}
+
+.cw-divider--right:after {
+ max-width: 10%;
+}
diff --git a/employee-mp/src/components/dropdown-item/index.js b/employee-mp/src/components/dropdown-item/index.js
new file mode 100644
index 0000000..acf8f52
--- /dev/null
+++ b/employee-mp/src/components/dropdown-item/index.js
@@ -0,0 +1,115 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { useParent } from '../common/relation';
+import { CwComponent } from '../common/component';
+CwComponent({
+ field: true,
+ relation: useParent('dropdown-menu', function() {
+ this.updateDataFromParent();
+ }),
+ props: {
+ value: {
+ type: null,
+ observer: 'rerender'
+ },
+ title: {
+ type: String,
+ observer: 'rerender'
+ },
+ disabled: Boolean,
+ titleClass: {
+ type: String,
+ observer: 'rerender'
+ },
+ options: {
+ type: Array,
+ value: [],
+ observer: 'rerender'
+ },
+ popupStyle: String
+ },
+ data: {
+ transition: true,
+ showPopup: false,
+ showWrapper: false,
+ displayTitle: ''
+ },
+ methods: {
+ rerender() {
+ wx.nextTick(() => {
+ var _a;
+ (_a = this.parent) === null || _a === void 0 ? void 0 : _a.updateItemListData();
+ });
+ },
+ updateDataFromParent() {
+ if (this.parent) {
+ const { overlay, duration, activeColor, closeOnClickOverlay, direction } = this.parent.data;
+ this.setData({
+ overlay,
+ duration,
+ activeColor,
+ closeOnClickOverlay,
+ direction
+ });
+ }
+ },
+ onOpen() {
+ this.$emit('open');
+ },
+ onOpened() {
+ this.$emit('opened');
+ },
+ onClose() {
+ this.$emit('close');
+ },
+ onClosed() {
+ this.$emit('closed');
+ this.setData({ showWrapper: false });
+ },
+ onOptionTap(event) {
+ const { option } = event.currentTarget.dataset;
+ const { value } = option;
+ const shouldEmitChange = this.data.value !== value;
+ this.setData({ showPopup: false, value });
+ this.$emit('close');
+ this.rerender();
+ if (shouldEmitChange) {
+ this.$emit('change', value);
+ }
+ },
+ toggle(show, options = {}) {
+ var _a;
+ const { showPopup } = this.data;
+ if (typeof show !== 'boolean') {
+ show = !showPopup;
+ }
+ if (show === showPopup) {
+ return;
+ }
+ this.setData({
+ transition: !options.immediate,
+ showPopup: show
+ });
+ if (show) {
+ (_a = this.parent) === null || _a === void 0
+ ? void 0
+ : _a.getChildWrapperStyle().then(wrapperStyle => {
+ this.setData({ wrapperStyle, showWrapper: true });
+ this.rerender();
+ });
+ } else {
+ this.rerender();
+ }
+ }
+ }
+});
diff --git a/employee-mp/src/components/dropdown-item/index.json b/employee-mp/src/components/dropdown-item/index.json
new file mode 100644
index 0000000..0b1bf7b
--- /dev/null
+++ b/employee-mp/src/components/dropdown-item/index.json
@@ -0,0 +1,8 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-popup": "../popup/index",
+ "cw-cell": "../cell/index",
+ "cw-icon": "../icon/index"
+ }
+}
diff --git a/employee-mp/src/components/dropdown-item/index.wxml b/employee-mp/src/components/dropdown-item/index.wxml
new file mode 100644
index 0000000..8b9ade0
--- /dev/null
+++ b/employee-mp/src/components/dropdown-item/index.wxml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+ {{ item.text }}
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/dropdown-item/index.wxss b/employee-mp/src/components/dropdown-item/index.wxss
new file mode 100644
index 0000000..be287dc
--- /dev/null
+++ b/employee-mp/src/components/dropdown-item/index.wxss
@@ -0,0 +1,30 @@
+@import '../common/index.wxss';
+
+.cw-dropdown-item {
+ position: fixed;
+ right: 0;
+ left: 0;
+ overflow: hidden;
+}
+
+.cw-dropdown-item__option {
+ text-align: left;
+}
+
+.cw-dropdown-item__option--active .cw-dropdown-item__icon,
+.cw-dropdown-item__option--active .cw-dropdown-item__title {
+ color: #ee0a24;
+}
+
+.cw-dropdown-item--up {
+ top: 0;
+}
+
+.cw-dropdown-item--down {
+ bottom: 0;
+}
+
+.cw-dropdown-item__icon {
+ display: block;
+ line-height: inherit;
+}
diff --git a/employee-mp/src/components/dropdown-item/shared.js b/employee-mp/src/components/dropdown-item/shared.js
new file mode 100644
index 0000000..f150f20
--- /dev/null
+++ b/employee-mp/src/components/dropdown-item/shared.js
@@ -0,0 +1,13 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export {};
diff --git a/employee-mp/src/components/dropdown-menu/index.js b/employee-mp/src/components/dropdown-menu/index.js
new file mode 100644
index 0000000..b85a3c8
--- /dev/null
+++ b/employee-mp/src/components/dropdown-menu/index.js
@@ -0,0 +1,120 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { useChildren } from '../common/relation';
+import { addUnit, getRect, getSystemInfoSync } from '../common/utils';
+let ARRAY = [];
+CwComponent({
+ field: true,
+ relation: useChildren('dropdown-item', function() {
+ this.updateItemListData();
+ }),
+ props: {
+ activeColor: {
+ type: String,
+ observer: 'updateChildrenData'
+ },
+ overlay: {
+ type: Boolean,
+ value: true,
+ observer: 'updateChildrenData'
+ },
+ zIndex: {
+ type: Number,
+ value: 10
+ },
+ duration: {
+ type: Number,
+ value: 200,
+ observer: 'updateChildrenData'
+ },
+ direction: {
+ type: String,
+ value: 'down',
+ observer: 'updateChildrenData'
+ },
+ closeOnClickOverlay: {
+ type: Boolean,
+ value: true,
+ observer: 'updateChildrenData'
+ },
+ closeOnClickOutside: {
+ type: Boolean,
+ value: true
+ }
+ },
+ data: {
+ itemListData: []
+ },
+ beforeCreate() {
+ const { windowHeight } = getSystemInfoSync();
+ this.windowHeight = windowHeight;
+ ARRAY.push(this);
+ },
+ destroyed() {
+ ARRAY = ARRAY.filter(item => item !== this);
+ },
+ methods: {
+ updateItemListData() {
+ this.setData({
+ itemListData: this.children.map(child => child.data)
+ });
+ },
+ updateChildrenData() {
+ this.children.forEach(child => {
+ child.updateDataFromParent();
+ });
+ },
+ toggleItem(active) {
+ this.children.forEach((item, index) => {
+ const { showPopup } = item.data;
+ if (index === active) {
+ item.toggle();
+ } else if (showPopup) {
+ item.toggle(false, { immediate: true });
+ }
+ });
+ },
+ close() {
+ this.children.forEach(child => {
+ child.toggle(false, { immediate: true });
+ });
+ },
+ getChildWrapperStyle() {
+ const { zIndex, direction } = this.data;
+ return getRect(this, '.cw-dropdown-menu').then(rect => {
+ const { top = 0, bottom = 0 } = rect;
+ const offset = direction === 'down' ? bottom : this.windowHeight - top;
+ let wrapperStyle = `z-index: ${zIndex};`;
+ if (direction === 'down') {
+ wrapperStyle += `top: ${addUnit(offset)};`;
+ } else {
+ wrapperStyle += `bottom: ${addUnit(offset)};`;
+ }
+ return wrapperStyle;
+ });
+ },
+ onTitleTap(event) {
+ const { index } = event.currentTarget.dataset;
+ const child = this.children[index];
+ if (!child.data.disabled) {
+ ARRAY.forEach(menuItem => {
+ if (menuItem && menuItem.data.closeOnClickOutside && menuItem !== this) {
+ menuItem.close();
+ }
+ });
+ this.toggleItem(index);
+ }
+ }
+ }
+});
diff --git a/employee-mp/src/components/dropdown-menu/index.json b/employee-mp/src/components/dropdown-menu/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/dropdown-menu/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/dropdown-menu/index.wxml b/employee-mp/src/components/dropdown-menu/index.wxml
new file mode 100644
index 0000000..a3aaf5c
--- /dev/null
+++ b/employee-mp/src/components/dropdown-menu/index.wxml
@@ -0,0 +1,23 @@
+
+
+
+
diff --git a/employee-mp/src/components/dropdown-menu/index.wxs b/employee-mp/src/components/dropdown-menu/index.wxs
new file mode 100644
index 0000000..b283b75
--- /dev/null
+++ b/employee-mp/src/components/dropdown-menu/index.wxs
@@ -0,0 +1,15 @@
+function displayTitle(item) {
+ if (item.title) {
+ return item.title;
+ }
+
+ var match = item.options.filter(function(option) {
+ return option.value === item.value;
+ });
+ var displayTitle = match.length ? match[0].text : '';
+ return displayTitle;
+}
+
+module.exports = {
+ displayTitle: displayTitle
+};
diff --git a/employee-mp/src/components/dropdown-menu/index.wxss b/employee-mp/src/components/dropdown-menu/index.wxss
new file mode 100644
index 0000000..63754d5
--- /dev/null
+++ b/employee-mp/src/components/dropdown-menu/index.wxss
@@ -0,0 +1,69 @@
+@import '../common/index.wxss';
+
+.cw-dropdown-menu {
+ display: -webkit-flex;
+ display: flex;
+ box-shadow: 0 2px 12px rgba(100, 101, 102, 0.12);
+ -webkit-user-select: none;
+ user-select: none;
+ height: 50px;
+ background-color: #fff;
+}
+
+.cw-dropdown-menu__item {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-flex: 1;
+ flex: 1;
+ -webkit-align-items: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ min-width: 0;
+}
+
+.cw-dropdown-menu__item:active {
+ opacity: 0.7;
+}
+
+.cw-dropdown-menu__item--disabled:active {
+ opacity: 1;
+}
+
+.cw-dropdown-menu__item--disabled .cw-dropdown-menu__title {
+ color: #969799;
+}
+
+.cw-dropdown-menu__title {
+ position: relative;
+ box-sizing: border-box;
+ max-width: 100%;
+ padding: 0 8px;
+ color: #323233;
+ font-size: 14px;
+ line-height: 18px;
+}
+
+.cw-dropdown-menu__title:after {
+ position: absolute;
+ top: 50%;
+ right: -4px;
+ margin-top: -5px;
+ border-color: transparent transparent currentcolor currentcolor;
+ border-style: solid;
+ border-width: 3px;
+ -webkit-transform: rotate(-45deg);
+ transform: rotate(-45deg);
+ opacity: 0.8;
+ content: '';
+}
+
+.cw-dropdown-menu__title--active {
+ color: #ee0a24;
+}
+
+.cw-dropdown-menu__title--down:after {
+ margin-top: -1px;
+ -webkit-transform: rotate(135deg);
+ transform: rotate(135deg);
+}
diff --git a/employee-mp/src/components/empty/index.js b/employee-mp/src/components/empty/index.js
new file mode 100644
index 0000000..e130702
--- /dev/null
+++ b/employee-mp/src/components/empty/index.js
@@ -0,0 +1,34 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+
+CwComponent({
+ props: {
+ description: {
+ type: String,
+ value: '暂无内容'
+ },
+ icon: {
+ type: String,
+ value: 'empty'
+ },
+ fixed: {
+ type: Boolean,
+ value: true
+ },
+ withCopyright: {
+ type: Boolean,
+ value: false
+ }
+ }
+});
diff --git a/employee-mp/src/components/empty/index.json b/employee-mp/src/components/empty/index.json
new file mode 100644
index 0000000..503bd1a
--- /dev/null
+++ b/employee-mp/src/components/empty/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon"
+ }
+}
diff --git a/employee-mp/src/components/empty/index.wxml b/employee-mp/src/components/empty/index.wxml
new file mode 100644
index 0000000..84069eb
--- /dev/null
+++ b/employee-mp/src/components/empty/index.wxml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+ {{ description }}
+
+
+
+
+
diff --git a/employee-mp/src/components/empty/index.wxss b/employee-mp/src/components/empty/index.wxss
new file mode 100644
index 0000000..01f3007
--- /dev/null
+++ b/employee-mp/src/components/empty/index.wxss
@@ -0,0 +1,39 @@
+@import '../common/index.wxss';
+.cw-empty {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ box-sizing: border-box;
+}
+
+.cw-empty.fixed {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: constant(safe-area-inset-bottom);
+ bottom: env(safe-area-inset-bottom);
+}
+
+.cw-empty.with-copyright {
+ padding-bottom: 122px;
+}
+
+.cw-empty__icon {
+ font-size: 154px;
+ color: #d8d8d8;
+ line-height: 1;
+}
+
+.cw-empty__description {
+ margin-top: 16px;
+ padding: 0 60px;
+ color: #989899;
+ font-size: 14px;
+ line-height: 20px;
+}
+
+.cw-empty__bottom {
+ margin-top: 24px;
+}
diff --git a/employee-mp/src/components/field/index.js b/employee-mp/src/components/field/index.js
new file mode 100644
index 0000000..cc0dc29
--- /dev/null
+++ b/employee-mp/src/components/field/index.js
@@ -0,0 +1,132 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { nextTick } from '../common/utils';
+import { CwComponent } from '../common/component';
+import { commonProps, inputProps, textareaProps } from './props';
+CwComponent({
+ field: true,
+ classes: ['input-class', 'right-icon-class', 'label-class'],
+ props: Object.assign(Object.assign(Object.assign(Object.assign({}, commonProps), inputProps), textareaProps), {
+ size: String,
+ icon: String,
+ label: String,
+ error: Boolean,
+ center: Boolean,
+ isLink: Boolean,
+ leftIcon: String,
+ rightIcon: String,
+ autosize: null,
+ required: Boolean,
+ iconClass: String,
+ clickable: Boolean,
+ inputAlign: String,
+ customStyle: String,
+ errorMessage: String,
+ arrowDirection: String,
+ showWordLimit: Boolean,
+ errorMessageAlign: String,
+ readonly: {
+ type: Boolean,
+ observer: 'setShowClear'
+ },
+ clearable: {
+ type: Boolean,
+ observer: 'setShowClear'
+ },
+ border: {
+ type: Boolean,
+ value: true
+ },
+ titleWidth: {
+ type: String,
+ value: '6.2em'
+ }
+ }),
+ data: {
+ focused: false,
+ innerValue: '',
+ showClear: false
+ },
+ created() {
+ this.value = this.data.value;
+ this.setData({ innerValue: this.value });
+ },
+ methods: {
+ onInput(event) {
+ const { value = '' } = event.detail || {};
+ this.value = value;
+ this.setShowClear();
+ this.emitChange();
+ },
+ onFocus(event) {
+ this.focused = true;
+ this.setShowClear();
+ this.$emit('focus', event.detail);
+ },
+ onBlur(event) {
+ this.focused = false;
+ this.setShowClear();
+ this.$emit('blur', event.detail);
+ },
+ onClickIcon() {
+ this.$emit('click-icon');
+ },
+ onClickInput(event) {
+ this.$emit('click-input', event.detail);
+ },
+ onClear() {
+ this.setData({ innerValue: '' });
+ this.value = '';
+ this.setShowClear();
+ nextTick(() => {
+ this.emitChange();
+ this.$emit('clear', '');
+ });
+ },
+ onConfirm(event) {
+ const { value = '' } = event.detail || {};
+ this.value = value;
+ this.setShowClear();
+ this.$emit('confirm', value);
+ },
+ setValue(value) {
+ this.value = value;
+ this.setShowClear();
+ if (value === '') {
+ this.setData({ innerValue: '' });
+ }
+ this.emitChange();
+ },
+ onLineChange(event) {
+ this.$emit('linechange', event.detail);
+ },
+ onKeyboardHeightChange(event) {
+ this.$emit('keyboardheightchange', event.detail);
+ },
+ emitChange() {
+ this.setData({ value: this.value });
+ nextTick(() => {
+ this.$emit('input', this.value);
+ this.$emit('change', this.value);
+ });
+ },
+ setShowClear() {
+ const { clearable, readonly } = this.data;
+ const { focused, value } = this;
+ this.setData({
+ showClear: !!clearable && !!focused && !!value && !readonly
+ });
+ },
+ noop() {}
+ }
+});
diff --git a/employee-mp/src/components/field/index.json b/employee-mp/src/components/field/index.json
new file mode 100644
index 0000000..d9ab7c8
--- /dev/null
+++ b/employee-mp/src/components/field/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-cell": "../cell/index",
+ "cw-icon": "../icon/index"
+ }
+}
diff --git a/employee-mp/src/components/field/index.wxml b/employee-mp/src/components/field/index.wxml
new file mode 100644
index 0000000..963f272
--- /dev/null
+++ b/employee-mp/src/components/field/index.wxml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+ {{ label }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ value.length >= maxlength ? maxlength : value.length }}
+
+ /{{ maxlength }}
+
+
+ {{ errorMessage }}
+
+
diff --git a/employee-mp/src/components/field/index.wxs b/employee-mp/src/components/field/index.wxs
new file mode 100644
index 0000000..44e4630
--- /dev/null
+++ b/employee-mp/src/components/field/index.wxs
@@ -0,0 +1,17 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function inputStyle(autosize) {
+ if (autosize && autosize.constructor === 'Object') {
+ return style({
+ 'min-height': addUnit(autosize.minHeight),
+ 'max-height': addUnit(autosize.maxHeight)
+ });
+ }
+
+ return '';
+}
+
+module.exports = {
+ inputStyle: inputStyle
+};
diff --git a/employee-mp/src/components/field/index.wxss b/employee-mp/src/components/field/index.wxss
new file mode 100644
index 0000000..4468404
--- /dev/null
+++ b/employee-mp/src/components/field/index.wxss
@@ -0,0 +1,167 @@
+@import '../common/index.wxss';
+
+.cw-field__label {
+ color: #323233;
+}
+
+.cw-field__label--disabled {
+ color: #c8c9cc;
+}
+
+.cw-field__body {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+}
+
+.cw-field__body--textarea {
+ box-sizing: border-box;
+ padding: 3.6px 0;
+ line-height: 1.2em;
+ min-height: 24px;
+}
+
+.cw-field__control:empty + .cw-field__control {
+ display: block;
+}
+
+.cw-field__control {
+ position: relative;
+ display: none;
+ box-sizing: border-box;
+ width: 100%;
+ margin: 0;
+ padding: 0;
+ line-height: inherit;
+ text-align: left;
+ background-color: initial;
+ border: 0;
+ resize: none;
+ color: #323233;
+ height: 24px;
+ min-height: 24px;
+}
+
+.cw-field__control:empty {
+ display: none;
+}
+
+.cw-field__control--textarea {
+ height: 18px;
+ min-height: 18px;
+}
+
+.cw-field__control--error {
+ color: #ee0a24;
+}
+
+.cw-field__control--disabled {
+ background-color: initial;
+ opacity: 1;
+ color: #c8c9cc;
+}
+
+.cw-field__control--center {
+ text-align: center;
+}
+
+.cw-field__control--right {
+ text-align: right;
+}
+
+.cw-field__control--custom {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ min-height: 24px;
+}
+
+.cw-field__placeholder {
+ position: absolute;
+ top: 0;
+ right: 0;
+ left: 0;
+ pointer-events: none;
+ color: #c8c9cc;
+}
+
+.cw-field__placeholder--error {
+ color: #ee0a24;
+}
+
+.cw-field__icon-root {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ min-height: 24px;
+}
+
+.cw-field__clear-root,
+.cw-field__icon-container {
+ line-height: inherit;
+ vertical-align: middle;
+ padding: 0 8px;
+ margin-right: -8px;
+}
+
+.cw-field__button,
+.cw-field__clear-root,
+.cw-field__icon-container {
+ -webkit-flex-shrink: 0;
+ flex-shrink: 0;
+}
+
+.cw-field__clear-root {
+ font-size: 16px;
+ color: #c8c9cc;
+}
+
+.cw-field__icon-container {
+ font-size: 16px;
+ color: #969799;
+}
+
+.cw-field__icon-container:empty {
+ display: none;
+}
+
+.cw-field__button {
+ padding-left: 8px;
+}
+
+.cw-field__button:empty {
+ display: none;
+}
+
+.cw-field__error-message {
+ text-align: left;
+ font-size: 12px;
+ color: #ee0a24;
+}
+
+.cw-field__error-message--center {
+ text-align: center;
+}
+
+.cw-field__error-message--right {
+ text-align: right;
+}
+
+.cw-field__word-limit {
+ text-align: right;
+ margin-top: 4px;
+ color: #646566;
+ font-size: 12px;
+ line-height: 16px;
+}
+
+.cw-field__word-num {
+ display: inline;
+}
+
+.cw-field__word-num--full {
+ color: #ee0a24;
+}
diff --git a/employee-mp/src/components/field/input.wxml b/employee-mp/src/components/field/input.wxml
new file mode 100644
index 0000000..a18fe80
--- /dev/null
+++ b/employee-mp/src/components/field/input.wxml
@@ -0,0 +1,27 @@
+
diff --git a/employee-mp/src/components/field/props.js b/employee-mp/src/components/field/props.js
new file mode 100644
index 0000000..81d1aa9
--- /dev/null
+++ b/employee-mp/src/components/field/props.js
@@ -0,0 +1,75 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export const commonProps = {
+ value: {
+ type: String,
+ observer(value) {
+ if (value !== this.value) {
+ this.setData({ innerValue: value });
+ this.value = value;
+ }
+ }
+ },
+ placeholder: String,
+ placeholderStyle: String,
+ placeholderClass: String,
+ disabled: Boolean,
+ maxlength: {
+ type: Number,
+ value: -1
+ },
+ cursorSpacing: {
+ type: Number,
+ value: 50
+ },
+ autoFocus: Boolean,
+ focus: Boolean,
+ cursor: {
+ type: Number,
+ value: -1
+ },
+ selectionStart: {
+ type: Number,
+ value: -1
+ },
+ selectionEnd: {
+ type: Number,
+ value: -1
+ },
+ adjustPosition: {
+ type: Boolean,
+ value: true
+ },
+ holdKeyboard: Boolean
+};
+export const inputProps = {
+ type: {
+ type: String,
+ value: 'text'
+ },
+ password: Boolean,
+ confirmType: String,
+ confirmHold: Boolean
+};
+export const textareaProps = {
+ autoHeight: Boolean,
+ fixed: Boolean,
+ showConfirmBar: {
+ type: Boolean,
+ value: true
+ },
+ disableDefaultPadding: {
+ type: Boolean,
+ value: true
+ }
+};
diff --git a/employee-mp/src/components/field/textarea.wxml b/employee-mp/src/components/field/textarea.wxml
new file mode 100644
index 0000000..a493500
--- /dev/null
+++ b/employee-mp/src/components/field/textarea.wxml
@@ -0,0 +1,29 @@
+
diff --git a/employee-mp/src/components/grid-item/index.js b/employee-mp/src/components/grid-item/index.js
new file mode 100644
index 0000000..8812a07
--- /dev/null
+++ b/employee-mp/src/components/grid-item/index.js
@@ -0,0 +1,59 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { useParent } from '../common/relation';
+import { link } from '../mixins/link';
+CwComponent({
+ relation: useParent('grid'),
+ classes: ['content-class', 'icon-class', 'text-class'],
+ mixins: [link],
+ props: {
+ icon: String,
+ iconColor: String,
+ dot: Boolean,
+ info: null,
+ badge: null,
+ text: String,
+ useSlot: Boolean
+ },
+ data: {
+ viewStyle: ''
+ },
+ mounted() {
+ this.updateStyle();
+ },
+ methods: {
+ updateStyle() {
+ if (!this.parent) {
+ return;
+ }
+ const { data, children } = this.parent;
+ const { columnNum, border, square, gutter, clickable, center, direction, iconSize } = data;
+ this.setData({
+ center,
+ border,
+ square,
+ gutter,
+ clickable,
+ direction,
+ iconSize,
+ index: children.indexOf(this),
+ columnNum
+ });
+ },
+ onClick() {
+ this.$emit('click');
+ this.jumpLink();
+ }
+ }
+});
diff --git a/employee-mp/src/components/grid-item/index.json b/employee-mp/src/components/grid-item/index.json
new file mode 100644
index 0000000..85e5843
--- /dev/null
+++ b/employee-mp/src/components/grid-item/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index"
+ }
+}
diff --git a/employee-mp/src/components/grid-item/index.wxml b/employee-mp/src/components/grid-item/index.wxml
new file mode 100644
index 0000000..6f66d63
--- /dev/null
+++ b/employee-mp/src/components/grid-item/index.wxml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ text }}
+
+
+
+
+
diff --git a/employee-mp/src/components/grid-item/index.wxs b/employee-mp/src/components/grid-item/index.wxs
new file mode 100644
index 0000000..21202f0
--- /dev/null
+++ b/employee-mp/src/components/grid-item/index.wxs
@@ -0,0 +1,28 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function wrapperStyle(data) {
+ var width = 100 / data.columnNum + '%';
+
+ return style({
+ width: width,
+ 'padding-top': data.square ? width : null,
+ 'padding-right': addUnit(data.gutter),
+ 'margin-top': data.index >= data.columnNum && !data.square ? addUnit(data.gutter) : null
+ });
+}
+
+function contentStyle(data) {
+ return data.square
+ ? style({
+ right: addUnit(data.gutter),
+ bottom: addUnit(data.gutter),
+ height: 'auto'
+ })
+ : '';
+}
+
+module.exports = {
+ wrapperStyle: wrapperStyle,
+ contentStyle: contentStyle
+};
diff --git a/employee-mp/src/components/grid-item/index.wxss b/employee-mp/src/components/grid-item/index.wxss
new file mode 100644
index 0000000..06faf7c
--- /dev/null
+++ b/employee-mp/src/components/grid-item/index.wxss
@@ -0,0 +1,79 @@
+@import '../common/index.wxss';
+
+.cw-grid-item {
+ position: relative;
+ float: left;
+ box-sizing: border-box;
+}
+
+.cw-grid-item--square {
+ height: 0;
+}
+
+.cw-grid-item__content {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-flex-direction: column;
+ flex-direction: column;
+ box-sizing: border-box;
+ height: 100%;
+ padding: 16px 8px;
+ background-color: #fff;
+}
+
+.cw-grid-item__content:after {
+ z-index: 1;
+ border-width: 0 1px 1px 0;
+ borderborderborder-top-width: 0;
+}
+
+.cw-grid-item__content--surround:after {
+ border-width: 1px;
+}
+
+.cw-grid-item__content--center {
+ -webkit-align-items: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+}
+
+.cw-grid-item__content--square {
+ position: absolute;
+ top: 0;
+ right: 0;
+ left: 0;
+}
+
+.cw-grid-item__content--horizontal {
+ -webkit-flex-direction: row;
+ flex-direction: row;
+}
+
+.cw-grid-item__content--horizontal .cw-grid-item__icon + .cw-grid-item__text {
+ margin-top: 0;
+ margin-left: 8px;
+}
+
+.cw-grid-item__content--clickable:active {
+ background-color: #f2f3f5;
+}
+
+.cw-grid-item__icon {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ font-size: 26px;
+ height: 26px;
+}
+
+.cw-grid-item__text {
+ word-wrap: break-word;
+ color: #646566;
+ font-size: 12px;
+}
+
+.cw-grid-item__icon + .cw-grid-item__text {
+ margin-top: 8px;
+}
diff --git a/employee-mp/src/components/grid/index.js b/employee-mp/src/components/grid/index.js
new file mode 100644
index 0000000..8a1019c
--- /dev/null
+++ b/employee-mp/src/components/grid/index.js
@@ -0,0 +1,62 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { useChildren } from '../common/relation';
+CwComponent({
+ relation: useChildren('grid-item'),
+ props: {
+ square: {
+ type: Boolean,
+ observer: 'updateChildren'
+ },
+ gutter: {
+ type: null,
+ value: 0,
+ observer: 'updateChildren'
+ },
+ clickable: {
+ type: Boolean,
+ observer: 'updateChildren'
+ },
+ columnNum: {
+ type: Number,
+ value: 4,
+ observer: 'updateChildren'
+ },
+ center: {
+ type: Boolean,
+ value: true,
+ observer: 'updateChildren'
+ },
+ border: {
+ type: Boolean,
+ value: true,
+ observer: 'updateChildren'
+ },
+ direction: {
+ type: String,
+ observer: 'updateChildren'
+ },
+ iconSize: {
+ type: String,
+ observer: 'updateChildren'
+ }
+ },
+ methods: {
+ updateChildren() {
+ this.children.forEach(child => {
+ child.updateStyle();
+ });
+ }
+ }
+});
diff --git a/employee-mp/src/components/grid/index.json b/employee-mp/src/components/grid/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/grid/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/grid/index.wxml b/employee-mp/src/components/grid/index.wxml
new file mode 100644
index 0000000..4f94db6
--- /dev/null
+++ b/employee-mp/src/components/grid/index.wxml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/employee-mp/src/components/grid/index.wxs b/employee-mp/src/components/grid/index.wxs
new file mode 100644
index 0000000..d2ed758
--- /dev/null
+++ b/employee-mp/src/components/grid/index.wxs
@@ -0,0 +1,12 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function rootStyle(data) {
+ return style({
+ 'padding-left': addUnit(data.gutter)
+ });
+}
+
+module.exports = {
+ rootStyle: rootStyle
+};
diff --git a/employee-mp/src/components/grid/index.wxss b/employee-mp/src/components/grid/index.wxss
new file mode 100644
index 0000000..ec1990a
--- /dev/null
+++ b/employee-mp/src/components/grid/index.wxss
@@ -0,0 +1,7 @@
+@import '../common/index.wxss';
+
+.cw-grid {
+ position: relative;
+ box-sizing: border-box;
+ overflow: hidden;
+}
diff --git a/employee-mp/src/components/icon/index.js b/employee-mp/src/components/icon/index.js
new file mode 100644
index 0000000..717df64
--- /dev/null
+++ b/employee-mp/src/components/icon/index.js
@@ -0,0 +1,39 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+CwComponent({
+ props: {
+ dot: Boolean,
+ info: null,
+ size: null,
+ color: String,
+ customStyle: String,
+ classPrefix: {
+ type: String,
+ value: 'cw-icon'
+ },
+ name: {
+ type: String,
+ observer(val) {
+ this.setData({
+ isImageName: val.indexOf('/') !== -1
+ });
+ }
+ }
+ },
+ methods: {
+ onClick() {
+ this.$emit('click');
+ }
+ }
+});
diff --git a/employee-mp/src/components/icon/index.json b/employee-mp/src/components/icon/index.json
new file mode 100644
index 0000000..4271510
--- /dev/null
+++ b/employee-mp/src/components/icon/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-info": "../info/index"
+ }
+}
diff --git a/employee-mp/src/components/icon/index.wxml b/employee-mp/src/components/icon/index.wxml
new file mode 100644
index 0000000..1fec07b
--- /dev/null
+++ b/employee-mp/src/components/icon/index.wxml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
diff --git a/employee-mp/src/components/icon/index.wxss b/employee-mp/src/components/icon/index.wxss
new file mode 100644
index 0000000..7819a93
--- /dev/null
+++ b/employee-mp/src/components/icon/index.wxss
@@ -0,0 +1,190 @@
+@import '../common/index.wxss';
+
+@font-face {
+ font-family: 'cw-iconfont';
+ src: url('//at.alicdn.com/t/font_2824992_alsen8ctlhu.woff2?t=1632713256950') format('woff2'),
+ url('//at.alicdn.com/t/font_2824992_alsen8ctlhu.woff?t=1632713256950') format('woff'),
+ url('//at.alicdn.com/t/font_2824992_alsen8ctlhu.ttf?t=1632713256950') format('truetype');
+}
+
+.cw-icon {
+ position: relative;
+ display: inline-block;
+ font-family: 'cw-iconfont';
+ line-height: 1;
+ font-size: inherit;
+ text-rendering: auto;
+ -webkit-font-smoothing: antialiased;
+}
+
+.cw-icon-connect:before {
+ content: '\e856';
+}
+
+.cw-icon-approver:before {
+ content: '\e852';
+}
+
+.cw-icon-user:before {
+ content: '\e853';
+}
+
+.cw-icon-notice:before {
+ content: '\e854';
+}
+
+.cw-icon-judge:before {
+ content: '\e855';
+}
+
+.cw-icon-backspace:before {
+ content: '\e815';
+}
+
+.cw-icon-keyboard-hide:before {
+ content: '\e816';
+}
+
+.cw-icon-photograph:before {
+ content: '\e824';
+}
+
+.cw-icon-gotowork:before {
+ content: '\e850';
+}
+
+.cw-icon-gotohome:before {
+ content: '\e851';
+}
+
+.cw-icon-movecar:before {
+ content: '\e7dd';
+}
+
+.cw-icon-ower:before {
+ content: '\e84f';
+}
+
+.cw-icon-warehouse:before {
+ content: '\e84e';
+}
+
+.cw-icon-inform:before {
+ content: '\e849';
+}
+
+.cw-icon-meeting:before {
+ content: '\e84a';
+}
+
+.cw-icon-party:before {
+ content: '\e84b';
+}
+
+.cw-icon-xgfy:before {
+ content: '\e84c';
+}
+
+.cw-icon-refound:before {
+ content: '\e84d';
+}
+
+.cw-icon-leave:before {
+ content: '\e848';
+}
+
+.cw-icon-maintain1:before {
+ content: '\e844';
+}
+
+.cw-icon-report:before {
+ content: '\e845';
+}
+
+.cw-icon-fitment:before {
+ content: '\e846';
+}
+
+.cw-icon-footprint:before {
+ content: '\e847';
+}
+
+.cw-icon-arrow-down:before {
+ content: '\e830';
+}
+
+.cw-icon-arrow-up:before {
+ content: '\e831';
+}
+
+.cw-icon-arrow:before {
+ content: '\e832';
+}
+
+.cw-icon-arrow-left:before {
+ content: '\e833';
+}
+
+.cw-icon-chowa:before {
+ content: '\e834';
+}
+
+.cw-icon-success:before {
+ content: '\e835';
+}
+
+.cw-icon-fail:before {
+ content: '\e836';
+}
+
+.cw-icon-maintain:before {
+ content: '\e837';
+}
+
+.cw-icon-cross:before {
+ content: '\e838';
+}
+
+.cw-icon-empty:before {
+ content: '\e839';
+}
+
+.cw-icon-neterror:before {
+ content: '\e83a';
+}
+
+.cw-icon-logo:before {
+ content: '\e83b';
+}
+
+.cw-icon-local:before {
+ content: '\e83c';
+}
+
+.cw-icon-plus:before {
+ content: '\e83d';
+}
+
+.cw-icon-mission:before {
+ content: '\e83e';
+}
+
+.cw-icon-star:before {
+ content: '\e83f';
+}
+
+.cw-icon-vistor:before {
+ content: '\e840';
+}
+
+.cw-icon-scan:before {
+ content: '\e841';
+}
+
+.cw-icon-phone:before {
+ content: '\e842';
+}
+
+.cw-icon-errgeneral:before {
+ content: '\e843';
+}
diff --git a/employee-mp/src/components/image-cropper/index.js b/employee-mp/src/components/image-cropper/index.js
new file mode 100644
index 0000000..15d91a5
--- /dev/null
+++ b/employee-mp/src/components/image-cropper/index.js
@@ -0,0 +1,1227 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+Component({
+ properties: {
+ /**
+ * 图片路径
+ */
+ imgSrc: {
+ type: String
+ },
+ /**
+ * 裁剪框高度
+ */
+ height: {
+ type: Number,
+ value: 200
+ },
+ /**
+ * 裁剪框宽度
+ */
+ width: {
+ type: Number,
+ value: 200
+ },
+ /**
+ * 裁剪框最小尺寸
+ */
+ min_width: {
+ type: Number,
+ value: 100
+ },
+ min_height: {
+ type: Number,
+ value: 100
+ },
+ /**
+ * 裁剪框最大尺寸
+ */
+ max_width: {
+ type: Number,
+ value: 300
+ },
+ max_height: {
+ type: Number,
+ value: 300
+ },
+ /**
+ * 裁剪框禁止拖动
+ */
+ disable_width: {
+ type: Boolean,
+ value: false
+ },
+ disable_height: {
+ type: Boolean,
+ value: false
+ },
+ /**
+ * 锁定裁剪框比例
+ */
+ disable_ratio: {
+ type: Boolean,
+ value: false
+ },
+ /**
+ * 生成的图片尺寸相对剪裁框的比例
+ */
+ export_scale: {
+ type: Number,
+ value: 3
+ },
+ /**
+ * 生成的图片质量0-1
+ */
+ quality: {
+ type: Number,
+ value: 1
+ },
+ cut_top: {
+ type: Number,
+ value: null
+ },
+ cut_left: {
+ type: Number,
+ value: null
+ },
+ /**
+ * canvas上边距(不设置默认不显示)
+ */
+ canvas_top: {
+ type: Number,
+ value: null
+ },
+ /**
+ * canvas左边距(不设置默认不显示)
+ */
+ canvas_left: {
+ type: Number,
+ value: null
+ },
+ /**
+ * 图片宽度
+ */
+ img_width: {
+ type: null,
+ value: null
+ },
+ /**
+ * 图片高度
+ */
+ img_height: {
+ type: null,
+ value: null
+ },
+ /**
+ * 图片缩放比
+ */
+ scale: {
+ type: Number,
+ value: 1
+ },
+ /**
+ * 图片旋转角度
+ */
+ angle: {
+ type: Number,
+ value: 0
+ },
+ /**
+ * 最小缩放比
+ */
+ min_scale: {
+ type: Number,
+ value: 0.5
+ },
+ /**
+ * 最大缩放比
+ */
+ max_scale: {
+ type: Number,
+ value: 2
+ },
+ /**
+ * 是否禁用旋转
+ */
+ disable_rotate: {
+ type: Boolean,
+ value: false
+ },
+ /**
+ * 是否限制移动范围(剪裁框只能在图片内)
+ */
+ limit_move: {
+ type: Boolean,
+ value: false
+ }
+ },
+ data: {
+ el: 'cw-image-cropper', //暂时无用
+ info: wx.getSystemInfoSync(),
+ MOVE_THROTTLE: null, //触摸移动节流settimeout
+ MOVE_THROTTLE_FLAG: true, //节流标识
+ INIT_IMGWIDTH: 0, //图片设置尺寸,此值不变(记录最初设定的尺寸)
+ INIT_IMGHEIGHT: 0, //图片设置尺寸,此值不变(记录最初设定的尺寸)
+ TIME_BG: null, //背景变暗延时函数
+ TIME_CUT_CENTER: null,
+ _touch_img_relative: [
+ {
+ x: 0,
+ y: 0
+ }
+ ], //鼠标和图片中心的相对位置
+ _flag_cut_touch: false, //是否是拖动裁剪框
+ _hypotenuse_length: 0, //双指触摸时斜边长度
+ _flag_img_endtouch: false, //是否结束触摸
+ _flag_bright: true, //背景是否亮
+ _canvas_overflow: true, //canvas缩略图是否在屏幕外面
+ _canvas_width: 200,
+ _canvas_height: 200,
+ origin_x: 0.5, //图片旋转中心
+ origin_y: 0.5, //图片旋转中心
+ _cut_animation: false, //是否开启图片和裁剪框过渡
+ _img_top: wx.getSystemInfoSync().windowHeight / 2, //图片上边距
+ _img_left: wx.getSystemInfoSync().windowWidth / 2, //图片左边距
+ watch: {
+ //监听截取框宽高变化
+ width(value, that) {
+ if (value < that.data.min_width) {
+ that.setData({
+ width: that.data.min_width
+ });
+ }
+ that._computeCutSize();
+ },
+ height(value, that) {
+ if (value < that.data.min_height) {
+ that.setData({
+ height: that.data.min_height
+ });
+ }
+ that._computeCutSize();
+ },
+ angle(value, that) {
+ //停止居中裁剪框,继续修改图片位置
+ that._moveStop();
+ if (that.data.limit_move) {
+ if (that.data.angle % 90) {
+ that.setData({
+ angle: Math.round(that.data.angle / 90) * 90
+ });
+ return;
+ }
+ }
+ },
+ _cut_animation(value, that) {
+ //开启过渡300毫秒之后自动关闭
+ clearTimeout(that.data._cut_animation_time);
+ if (value) {
+ that.data._cut_animation_time = setTimeout(() => {
+ that.setData({
+ _cut_animation: false
+ });
+ }, 300);
+ }
+ },
+ limit_move(value, that) {
+ if (value) {
+ if (that.data.angle % 90) {
+ that.setData({
+ angle: Math.round(that.data.angle / 90) * 90
+ });
+ }
+ that._imgMarginDetectionScale();
+ !that.data._canvas_overflow && that._draw();
+ }
+ },
+ canvas_top(value, that) {
+ that._canvasDetectionPosition();
+ },
+ canvas_left(value, that) {
+ that._canvasDetectionPosition();
+ },
+ imgSrc(value, that) {
+ that.pushImg();
+ },
+ cut_top(value, that) {
+ that._cutDetectionPosition();
+ if (that.data.limit_move) {
+ !that.data._canvas_overflow && that._draw();
+ }
+ },
+ cut_left(value, that) {
+ that._cutDetectionPosition();
+ if (that.data.limit_move) {
+ !that.data._canvas_overflow && that._draw();
+ }
+ }
+ }
+ },
+ attached() {
+ this.data.info = wx.getSystemInfoSync();
+
+ //启用数据监听
+ this._watcher();
+ this.data.INIT_IMGWIDTH = this.data.img_width;
+ this.data.INIT_IMGHEIGHT = this.data.img_height;
+ this.setData({
+ _canvas_height: this.data.height,
+ _canvas_width: this.data.width
+ });
+ this._initCanvas();
+ this.data.imgSrc && (this.data.imgSrc = this.data.imgSrc);
+ //根据开发者设置的图片目标尺寸计算实际尺寸
+ this._initImageSize();
+ //设置裁剪框大小>设置图片尺寸>绘制canvas
+ this._computeCutSize();
+ //检查裁剪框是否在范围内
+ this._cutDetectionPosition();
+ //检查canvas是否在范围内
+ this._canvasDetectionPosition();
+ //初始化完成
+ this.triggerEvent('load', {
+ cropper: this
+ });
+ },
+ methods: {
+ /**
+ * 上传图片
+ */
+ upload() {
+ let that = this;
+ wx.chooseImage({
+ count: 1,
+ sizeType: ['original', 'compressed'],
+ sourceType: ['album', 'camera'],
+ success: res => {
+ const tempFilePaths = res.tempFilePaths[0];
+ that.pushImg(tempFilePaths);
+ },
+ fail: () => {
+ wx.navigateBack({ delta: 1 });
+ }
+ });
+ },
+ /**
+ * 返回图片信息
+ */
+ getImg(getCallback) {
+ this._draw(() => {
+ wx.canvasToTempFilePath(
+ {
+ width: this.data.width * this.data.export_scale,
+ height: Math.round(this.data.height * this.data.export_scale),
+ destWidth: this.data.width * this.data.export_scale,
+ destHeight: Math.round(this.data.height) * this.data.export_scale,
+ fileType: 'jpg',
+ quality: this.data.quality,
+ canvasId: this.data.el,
+ success: res => {
+ getCallback({
+ url: res.tempFilePath,
+ width: this.data.width * this.data.export_scale,
+ height: this.data.height * this.data.export_scale
+ });
+ }
+ },
+ this
+ );
+ });
+ },
+ /**
+ * 设置图片动画
+ * {
+ * x:10,//图片在原有基础上向下移动10px
+ * y:10,//图片在原有基础上向右移动10px
+ * angle:10,//图片在原有基础上旋转10deg
+ * scale:0.5,//图片在原有基础上增加0.5倍
+ * }
+ */
+ setTransform(transform) {
+ if (!transform) return;
+ if (!this.data.disable_rotate) {
+ this.setData({
+ angle: transform.angle ? this.data.angle + transform.angle : this.data.angle
+ });
+ }
+ var scale = this.data.scale;
+ if (transform.scale) {
+ scale = this.data.scale + transform.scale;
+ scale = scale <= this.data.min_scale ? this.data.min_scale : scale;
+ scale = scale >= this.data.max_scale ? this.data.max_scale : scale;
+ }
+ this.data.scale = scale;
+ let cutX = this.data.cut_left;
+ let cutY = this.data.cut_top;
+ if (transform.cutX) {
+ this.setData({
+ cut_left: cutX + transform.cutX
+ });
+ this.data.watch.cut_left(null, this);
+ }
+ if (transform.cutY) {
+ this.setData({
+ cut_top: cutY + transform.cutY
+ });
+ this.data.watch.cut_top(null, this);
+ }
+ this.data._img_top = transform.y ? this.data._img_top + transform.y : this.data._img_top;
+ this.data._img_left = transform.x ? this.data._img_left + transform.x : this.data._img_left;
+ //图像边缘检测,防止截取到空白
+ this._imgMarginDetectionScale();
+ //停止居中裁剪框,继续修改图片位置
+ this._moveDuring();
+ this.setData({
+ scale: this.data.scale,
+ _img_top: this.data._img_top,
+ _img_left: this.data._img_left
+ });
+ !this.data._canvas_overflow && this._draw();
+ //可以居中裁剪框了
+ this._moveStop(); //结束操作
+ },
+ /**
+ * 设置剪裁框位置
+ */
+ setCutXY(x, y) {
+ this.setData({
+ cut_top: y,
+ cut_left: x
+ });
+ },
+ /**
+ * 设置剪裁框尺寸
+ */
+ setCutSize(w, h) {
+ this.setData({
+ width: w,
+ height: h
+ });
+ this._computeCutSize();
+ },
+ /**
+ * 设置剪裁框和图片居中
+ */
+ setCutCenter() {
+ let cut_top =
+ (this.data.info.windowHeight -
+ this.data.height -
+ (this.data.info.screenHeight - this.data.info.safeArea.bottom) -
+ 44) *
+ 0.5;
+ let cut_left = (this.data.info.windowWidth - this.data.width) * 0.5;
+ //顺序不能变
+ this.setData({
+ _img_top: this.data._img_top - this.data.cut_top + cut_top,
+ cut_top: cut_top, //截取的框上边距
+ _img_left: this.data._img_left - this.data.cut_left + cut_left,
+ cut_left: cut_left //截取的框左边距
+ });
+ },
+ _setCutCenter() {
+ let cut_top =
+ (this.data.info.windowHeight -
+ this.data.height -
+ (this.data.info.screenHeight - this.data.info.safeArea.bottom) -
+ 44) *
+ 0.5;
+ let cut_left = (this.data.info.windowWidth - this.data.width) * 0.5;
+ this.setData({
+ cut_top: cut_top, //截取的框上边距
+ cut_left: cut_left //截取的框左边距
+ });
+ },
+ /**
+ * 设置剪裁框宽度-即将废弃
+ */
+ setWidth(width) {
+ this.setData({
+ width: width
+ });
+ this._computeCutSize();
+ },
+ /**
+ * 设置剪裁框高度-即将废弃
+ */
+ setHeight(height) {
+ this.setData({
+ height: height
+ });
+ this._computeCutSize();
+ },
+ /**
+ * 是否锁定旋转
+ */
+ setDisableRotate(value) {
+ this.data.disable_rotate = value;
+ },
+ /**
+ * 是否限制移动
+ */
+ setLimitMove(value) {
+ this.setData({
+ _cut_animation: true,
+ limit_move: !!value
+ });
+ },
+ /**
+ * 初始化图片,包括位置、大小、旋转角度
+ */
+ imgReset() {
+ const info = wx.getSystemInfoSync();
+
+ this.setData({
+ scale: 1,
+ angle: 0,
+ _img_top: (info.windowHeight - (info.screenHeight - info.safeArea.bottom) - 44) / 2,
+ _img_left: info.windowWidth / 2
+ });
+ },
+ /**
+ * 加载(更换)图片
+ */
+ pushImg(src) {
+ if (src) {
+ this.setData({
+ imgSrc: src
+ });
+ //发现是手动赋值直接返回,交给watch处理
+ return;
+ }
+
+ // getImageInfo接口传入 src: '' 会导致内存泄漏
+
+ if (!this.data.imgSrc) return;
+ wx.getImageInfo({
+ src: this.data.imgSrc,
+ success: res => {
+ this.data.imageObject = res;
+ //图片非本地路径需要换成本地路径
+ if (this.data.imgSrc.search(/tmp/) == -1) {
+ this.setData({
+ imgSrc: res.path
+ });
+ }
+ //计算最后图片尺寸
+ this._imgComputeSize();
+ if (this.data.limit_move) {
+ //限制移动,不留空白处理
+ this._imgMarginDetectionScale();
+ }
+ this._draw();
+ },
+ fail: err => {
+ this.setData({
+ imgSrc: ''
+ });
+ }
+ });
+ },
+ imageLoad(e) {
+ setTimeout(() => {
+ this.triggerEvent('imageload', this.data.imageObject);
+ }, 1000);
+ },
+ /**
+ * 设置图片放大缩小
+ */
+ setScale(scale) {
+ if (!scale) return;
+ this.setData({
+ scale: scale
+ });
+ !this.data._canvas_overflow && this._draw();
+ },
+ /**
+ * 设置图片旋转角度
+ */
+ setAngle(angle) {
+ if (!angle) return;
+ this.setData({
+ _cut_animation: true,
+ angle: angle
+ });
+ this._imgMarginDetectionScale();
+ !this.data._canvas_overflow && this._draw();
+ },
+ _initCanvas() {
+ //初始化canvas
+ if (!this.data.ctx) {
+ this.data.ctx = wx.createCanvasContext('cw-image-cropper', this);
+ }
+ },
+ /**
+ * 根据开发者设置的图片目标尺寸计算实际尺寸
+ */
+ _initImageSize() {
+ //处理宽高特殊单位 %>px
+ if (
+ this.data.INIT_IMGWIDTH &&
+ typeof this.data.INIT_IMGWIDTH == 'string' &&
+ this.data.INIT_IMGWIDTH.indexOf('%') != -1
+ ) {
+ let width = this.data.INIT_IMGWIDTH.replace('%', '');
+ this.data.INIT_IMGWIDTH = this.data.img_width = (this.data.info.windowWidth / 100) * width;
+ }
+ if (
+ this.data.INIT_IMGHEIGHT &&
+ typeof this.data.INIT_IMGHEIGHT == 'string' &&
+ this.data.INIT_IMGHEIGHT.indexOf('%') != -1
+ ) {
+ let height = this.data.img_height.replace('%', '');
+ this.data.INIT_IMGHEIGHT = this.data.img_height = (this.data.info.windowHeight / 100) * height;
+ }
+ },
+ /**
+ * 检测剪裁框位置是否在允许的范围内(屏幕内)
+ */
+ _cutDetectionPosition() {
+ let _cutDetectionPositionTop = () => {
+ //检测上边距是否在范围内
+ if (this.data.cut_top < 0) {
+ this.setData({
+ cut_top: 0
+ });
+ }
+ if (this.data.cut_top > this.data.info.windowHeight - this.data.height) {
+ this.setData({
+ cut_top: this.data.info.windowHeight - this.data.height
+ });
+ }
+ },
+ _cutDetectionPositionLeft = () => {
+ //检测左边距是否在范围内
+ if (this.data.cut_left < 0) {
+ this.setData({
+ cut_left: 0
+ });
+ }
+ if (this.data.cut_left > this.data.info.windowWidth - this.data.width) {
+ this.setData({
+ cut_left: this.data.info.windowWidth - this.data.width
+ });
+ }
+ };
+ //裁剪框坐标处理(如果只写一个参数则另一个默认为0,都不写默认居中)
+ if (this.data.cut_top == null && this.data.cut_left == null) {
+ this._setCutCenter();
+ } else if (this.data.cut_top != null && this.data.cut_left != null) {
+ _cutDetectionPositionTop();
+ _cutDetectionPositionLeft();
+ } else if (this.data.cut_top != null && this.data.cut_left == null) {
+ _cutDetectionPositionTop();
+ this.setData({
+ cut_left: (this.data.info.windowWidth - this.data.width) / 2
+ });
+ } else if (this.data.cut_top == null && this.data.cut_left != null) {
+ _cutDetectionPositionLeft();
+ this.setData({
+ cut_top: (this.data.info.windowHeight - this.data.height) / 2
+ });
+ }
+ },
+ /**
+ * 检测canvas位置是否在允许的范围内(屏幕内)如果在屏幕外则不开启实时渲染
+ * 如果只写一个参数则另一个默认为0,都不写默认超出屏幕外
+ */
+ _canvasDetectionPosition() {
+ if (this.data.canvas_top == null && this.data.canvas_left == null) {
+ this.data._canvas_overflow = false;
+ this.setData({
+ canvas_top: -5000,
+ canvas_left: -5000
+ });
+ } else if (this.data.canvas_top != null && this.data.canvas_left != null) {
+ if (this.data.canvas_top < -this.data.height || this.data.canvas_top > this.data.info.windowHeight) {
+ this.data._canvas_overflow = true;
+ } else {
+ this.data._canvas_overflow = false;
+ }
+ } else if (this.data.canvas_top != null && this.data.canvas_left == null) {
+ this.setData({
+ canvas_left: 0
+ });
+ } else if (this.data.canvas_top == null && this.data.canvas_left != null) {
+ this.setData({
+ canvas_top: 0
+ });
+ if (this.data.canvas_left < -this.data.width || this.data.canvas_left > this.data.info.windowWidth) {
+ this.data._canvas_overflow = true;
+ } else {
+ this.data._canvas_overflow = false;
+ }
+ }
+ },
+ /**
+ * 图片边缘检测-位置
+ */
+ _imgMarginDetectionPosition(scale) {
+ if (!this.data.limit_move) return;
+ let left = this.data._img_left;
+ let top = this.data._img_top;
+ var scale = scale || this.data.scale;
+ let img_width = this.data.img_width;
+ let img_height = this.data.img_height;
+ if ((this.data.angle / 90) % 2) {
+ img_width = this.data.img_height;
+ img_height = this.data.img_width;
+ }
+ left =
+ this.data.cut_left + (img_width * scale) / 2 >= left
+ ? left
+ : this.data.cut_left + (img_width * scale) / 2;
+ left =
+ this.data.cut_left + this.data.width - (img_width * scale) / 2 <= left
+ ? left
+ : this.data.cut_left + this.data.width - (img_width * scale) / 2;
+ top =
+ this.data.cut_top + (img_height * scale) / 2 >= top
+ ? top
+ : this.data.cut_top + (img_height * scale) / 2;
+ top =
+ this.data.cut_top + this.data.height - (img_height * scale) / 2 <= top
+ ? top
+ : this.data.cut_top + this.data.height - (img_height * scale) / 2;
+ this.setData({
+ _img_left: left,
+ _img_top: top,
+ scale: scale
+ });
+ },
+ /**
+ * 图片边缘检测-缩放
+ */
+ _imgMarginDetectionScale() {
+ if (!this.data.limit_move) return;
+ let scale = this.data.scale;
+ let img_width = this.data.img_width;
+ let img_height = this.data.img_height;
+ if ((this.data.angle / 90) % 2) {
+ img_width = this.data.img_height;
+ img_height = this.data.img_width;
+ }
+ if (img_width * scale < this.data.width) {
+ scale = this.data.width / img_width;
+ }
+ if (img_height * scale < this.data.height) {
+ scale = Math.max(scale, this.data.height / img_height);
+ }
+ this._imgMarginDetectionPosition(scale);
+ },
+ _setData(obj) {
+ let data = {};
+ for (var key in obj) {
+ if (this.data[key] != obj[key]) {
+ data[key] = obj[key];
+ }
+ }
+ this.setData(data);
+ return data;
+ },
+ /**
+ * 计算图片尺寸
+ */
+ _imgComputeSize() {
+ let img_width = this.data.img_width,
+ img_height = this.data.img_height;
+ if (!this.data.INIT_IMGHEIGHT && !this.data.INIT_IMGWIDTH) {
+ //默认按图片最小边 = 对应裁剪框尺寸
+ img_width = this.data.imageObject.width;
+ img_height = this.data.imageObject.height;
+ if (img_width / img_height > this.data.width / this.data.height) {
+ img_height = this.data.height;
+ img_width = (this.data.imageObject.width / this.data.imageObject.height) * img_height;
+ } else {
+ img_width = this.data.width;
+ img_height = (this.data.imageObject.height / this.data.imageObject.width) * img_width;
+ }
+ } else if (this.data.INIT_IMGHEIGHT && !this.data.INIT_IMGWIDTH) {
+ img_width = (this.data.imageObject.width / this.data.imageObject.height) * this.data.INIT_IMGHEIGHT;
+ } else if (!this.data.INIT_IMGHEIGHT && this.data.INIT_IMGWIDTH) {
+ img_height = (this.data.imageObject.height / this.data.imageObject.width) * this.data.INIT_IMGWIDTH;
+ }
+ this.setData({
+ img_width: img_width,
+ img_height: img_height
+ });
+ },
+ //改变截取框大小
+ _computeCutSize() {
+ if (this.data.width > this.data.info.windowWidth) {
+ this.setData({
+ width: this.data.info.windowWidth
+ });
+ } else if (this.data.width + this.data.cut_left > this.data.info.windowWidth) {
+ this.setData({
+ cut_left: this.data.info.windowWidth - this.data.cut_left
+ });
+ }
+ if (this.data.height > this.data.info.windowHeight) {
+ this.setData({
+ height: this.data.info.windowHeight
+ });
+ } else if (this.data.height + this.data.cut_top > this.data.info.windowHeight) {
+ this.setData({
+ cut_top: this.data.info.windowHeight - this.data.cut_top
+ });
+ }
+ !this.data._canvas_overflow && this._draw();
+ },
+ //开始触摸
+ _start(event) {
+ this.data._flag_img_endtouch = false;
+ if (event.touches.length == 1) {
+ //单指拖动
+ this.data._touch_img_relative[0] = {
+ x: event.touches[0].clientX - this.data._img_left,
+ y: event.touches[0].clientY - this.data._img_top
+ };
+ } else {
+ //双指放大
+ let width = Math.abs(event.touches[0].clientX - event.touches[1].clientX);
+ let height = Math.abs(event.touches[0].clientY - event.touches[1].clientY);
+ this.data._touch_img_relative = [
+ {
+ x: event.touches[0].clientX - this.data._img_left,
+ y: event.touches[0].clientY - this.data._img_top
+ },
+ {
+ x: event.touches[1].clientX - this.data._img_left,
+ y: event.touches[1].clientY - this.data._img_top
+ }
+ ];
+ this.data._hypotenuse_length = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
+ }
+ !this.data._canvas_overflow && this._draw();
+ },
+ _move_throttle() {
+ //安卓需要节流
+ if (this.data.info.platform == 'android') {
+ clearTimeout(this.data.MOVE_THROTTLE);
+ this.data.MOVE_THROTTLE = setTimeout(() => {
+ this.data.MOVE_THROTTLE_FLAG = true;
+ }, 1000 / 40);
+ return this.data.MOVE_THROTTLE_FLAG;
+ } else {
+ this.data.MOVE_THROTTLE_FLAG = true;
+ }
+ },
+ _move(event) {
+ if (this.data._flag_img_endtouch || !this.data.MOVE_THROTTLE_FLAG) return;
+ this.data.MOVE_THROTTLE_FLAG = false;
+ this._move_throttle();
+ this._moveDuring();
+ if (event.touches.length == 1) {
+ //单指拖动
+ let left = event.touches[0].clientX - this.data._touch_img_relative[0].x,
+ top = event.touches[0].clientY - this.data._touch_img_relative[0].y;
+ //图像边缘检测,防止截取到空白
+ this.data._img_left = left;
+ this.data._img_top = top;
+ this._imgMarginDetectionPosition();
+ this.setData({
+ _img_left: this.data._img_left,
+ _img_top: this.data._img_top
+ });
+ } else {
+ //双指放大
+ let width = Math.abs(event.touches[0].clientX - event.touches[1].clientX),
+ height = Math.abs(event.touches[0].clientY - event.touches[1].clientY),
+ hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)),
+ scale = this.data.scale * (hypotenuse / this.data._hypotenuse_length),
+ current_deg = 0;
+ scale = scale <= this.data.min_scale ? this.data.min_scale : scale;
+ scale = scale >= this.data.max_scale ? this.data.max_scale : scale;
+ //图像边缘检测,防止截取到空白
+ this.data.scale = scale;
+ this._imgMarginDetectionScale();
+ //双指旋转(如果没禁用旋转)
+ let _touch_img_relative = [
+ {
+ x: event.touches[0].clientX - this.data._img_left,
+ y: event.touches[0].clientY - this.data._img_top
+ },
+ {
+ x: event.touches[1].clientX - this.data._img_left,
+ y: event.touches[1].clientY - this.data._img_top
+ }
+ ];
+ if (!this.data.disable_rotate) {
+ let first_atan = (180 / Math.PI) * Math.atan2(_touch_img_relative[0].y, _touch_img_relative[0].x);
+ let first_atan_old =
+ (180 / Math.PI) *
+ Math.atan2(this.data._touch_img_relative[0].y, this.data._touch_img_relative[0].x);
+ let second_atan = (180 / Math.PI) * Math.atan2(_touch_img_relative[1].y, _touch_img_relative[1].x);
+ let second_atan_old =
+ (180 / Math.PI) *
+ Math.atan2(this.data._touch_img_relative[1].y, this.data._touch_img_relative[1].x);
+ //当前旋转的角度
+ let first_deg = first_atan - first_atan_old,
+ second_deg = second_atan - second_atan_old;
+ if (first_deg != 0) {
+ current_deg = first_deg;
+ } else if (second_deg != 0) {
+ current_deg = second_deg;
+ }
+ }
+ this.data._touch_img_relative = _touch_img_relative;
+ this.data._hypotenuse_length = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
+ //更新视图
+ this.setData({
+ angle: this.data.angle + current_deg,
+ scale: this.data.scale
+ });
+ }
+ !this.data._canvas_overflow && this._draw();
+ },
+ //结束操作
+ _end(event) {
+ this.data._flag_img_endtouch = true;
+ this._moveStop();
+ },
+ //点击中间剪裁框处理
+ _click() {
+ if (!this.data.imgSrc) {
+ //调起上传
+ this.upload();
+ return;
+ }
+ // shit
+
+ this._draw(() => {
+ //生成图片并回调
+ wx.canvasToTempFilePath(
+ {
+ width: this.data.width * this.data.export_scale,
+ height: Math.round(this.data.height * this.data.export_scale),
+ destWidth: this.data.width * this.data.export_scale,
+ destHeight: Math.round(this.data.height) * this.data.export_scale,
+ fileType: 'jpg',
+ quality: this.data.quality,
+ canvasId: this.data.el,
+ success: res => {
+ this.triggerEvent('tapcut', {
+ url: res.tempFilePath,
+ width: this.data.width * this.data.export_scale,
+ height: this.data.height * this.data.export_scale
+ });
+ }
+ },
+ this
+ );
+ });
+ },
+ //渲染
+ _draw(callback) {
+ if (!this.data.imgSrc) return;
+ let draw = () => {
+ //图片实际大小
+ let img_width = this.data.img_width * this.data.scale * this.data.export_scale;
+ let img_height = this.data.img_height * this.data.scale * this.data.export_scale;
+ //canvas和图片的相对距离
+ var xpos = this.data._img_left - this.data.cut_left;
+ var ypos = this.data._img_top - this.data.cut_top;
+ //旋转画布
+ this.data.ctx.translate(xpos * this.data.export_scale, ypos * this.data.export_scale);
+ this.data.ctx.rotate((this.data.angle * Math.PI) / 180);
+ this.data.ctx.drawImage(this.data.imgSrc, -img_width / 2, -img_height / 2, img_width, img_height);
+ this.data.ctx.draw(false, () => {
+ callback && callback();
+ });
+ };
+ if (this.data.ctx.width != this.data.width || this.data.ctx.height != this.data.height) {
+ //优化拖动裁剪框,所以必须把宽高设置放在离用户触发渲染最近的地方
+ this.setData(
+ {
+ _canvas_height: this.data.height,
+ _canvas_width: this.data.width
+ },
+ () => {
+ //延迟40毫秒防止点击过快出现拉伸或裁剪过多
+ setTimeout(() => {
+ draw();
+ }, 40);
+ }
+ );
+ } else {
+ draw();
+ }
+ },
+ //裁剪框处理
+ _cutTouchMove(e) {
+ if (this.data._flag_cut_touch && this.data.MOVE_THROTTLE_FLAG) {
+ if (this.data.disable_ratio && (this.data.disable_width || this.data.disable_height)) return;
+ //节流
+ this.data.MOVE_THROTTLE_FLAG = false;
+ this._move_throttle();
+ let width = this.data.width,
+ height = this.data.height,
+ cut_top = this.data.cut_top,
+ cut_left = this.data.cut_left,
+ size_correct = () => {
+ width =
+ width <= this.data.max_width
+ ? width >= this.data.min_width
+ ? width
+ : this.data.min_width
+ : this.data.max_width;
+ height =
+ height <= this.data.max_height
+ ? height >= this.data.min_height
+ ? height
+ : this.data.min_height
+ : this.data.max_height;
+ },
+ size_inspect = () => {
+ if (
+ (width > this.data.max_width ||
+ width < this.data.min_width ||
+ height > this.data.max_height ||
+ height < this.data.min_height) &&
+ this.data.disable_ratio
+ ) {
+ size_correct();
+ return false;
+ } else {
+ size_correct();
+ return true;
+ }
+ };
+ height =
+ this.data.CUT_START.height +
+ (this.data.CUT_START.corner > 1 && this.data.CUT_START.corner < 4 ? 1 : -1) *
+ (this.data.CUT_START.y - e.touches[0].clientY);
+ switch (this.data.CUT_START.corner) {
+ case 1:
+ width = this.data.CUT_START.width + this.data.CUT_START.x - e.touches[0].clientX;
+ if (this.data.disable_ratio) {
+ height = width / (this.data.width / this.data.height);
+ }
+ if (!size_inspect()) return;
+ cut_left = this.data.CUT_START.cut_left - (width - this.data.CUT_START.width);
+ break;
+ case 2:
+ width = this.data.CUT_START.width + this.data.CUT_START.x - e.touches[0].clientX;
+ if (this.data.disable_ratio) {
+ height = width / (this.data.width / this.data.height);
+ }
+ if (!size_inspect()) return;
+ cut_top = this.data.CUT_START.cut_top - (height - this.data.CUT_START.height);
+ cut_left = this.data.CUT_START.cut_left - (width - this.data.CUT_START.width);
+ break;
+ case 3:
+ width = this.data.CUT_START.width - this.data.CUT_START.x + e.touches[0].clientX;
+ if (this.data.disable_ratio) {
+ height = width / (this.data.width / this.data.height);
+ }
+ if (!size_inspect()) return;
+ cut_top = this.data.CUT_START.cut_top - (height - this.data.CUT_START.height);
+ break;
+ case 4:
+ width = this.data.CUT_START.width - this.data.CUT_START.x + e.touches[0].clientX;
+ if (this.data.disable_ratio) {
+ height = width / (this.data.width / this.data.height);
+ }
+ if (!size_inspect()) return;
+ break;
+ }
+ if (!this.data.disable_width && !this.data.disable_height) {
+ this.setData({
+ width: width,
+ cut_left: cut_left,
+ height: height,
+ cut_top: cut_top
+ });
+ } else if (!this.data.disable_width) {
+ this.setData({
+ width: width,
+ cut_left: cut_left
+ });
+ } else if (!this.data.disable_height) {
+ this.setData({
+ height: height,
+ cut_top: cut_top
+ });
+ }
+ this._imgMarginDetectionScale();
+ }
+ },
+ _cutTouchStart(e) {
+ let currentX = e.touches[0].clientX;
+ let currentY = e.touches[0].clientY;
+ let cutbox_top4 = this.data.cut_top + this.data.height - 30;
+ let cutbox_bottom4 = this.data.cut_top + this.data.height + 20;
+ let cutbox_left4 = this.data.cut_left + this.data.width - 30;
+ let cutbox_right4 = this.data.cut_left + this.data.width + 30;
+
+ let cutbox_top3 = this.data.cut_top - 30;
+ let cutbox_bottom3 = this.data.cut_top + 30;
+ let cutbox_left3 = this.data.cut_left + this.data.width - 30;
+ let cutbox_right3 = this.data.cut_left + this.data.width + 30;
+
+ let cutbox_top2 = this.data.cut_top - 30;
+ let cutbox_bottom2 = this.data.cut_top + 30;
+ let cutbox_left2 = this.data.cut_left - 30;
+ let cutbox_right2 = this.data.cut_left + 30;
+
+ let cutbox_top1 = this.data.cut_top + this.data.height - 30;
+ let cutbox_bottom1 = this.data.cut_top + this.data.height + 30;
+ let cutbox_left1 = this.data.cut_left - 30;
+ let cutbox_right1 = this.data.cut_left + 30;
+ if (
+ currentX > cutbox_left4 &&
+ currentX < cutbox_right4 &&
+ currentY > cutbox_top4 &&
+ currentY < cutbox_bottom4
+ ) {
+ this._moveDuring();
+ this.data._flag_cut_touch = true;
+ this.data._flag_img_endtouch = true;
+ this.data.CUT_START = {
+ width: this.data.width,
+ height: this.data.height,
+ x: currentX,
+ y: currentY,
+ corner: 4
+ };
+ } else if (
+ currentX > cutbox_left3 &&
+ currentX < cutbox_right3 &&
+ currentY > cutbox_top3 &&
+ currentY < cutbox_bottom3
+ ) {
+ this._moveDuring();
+ this.data._flag_cut_touch = true;
+ this.data._flag_img_endtouch = true;
+ this.data.CUT_START = {
+ width: this.data.width,
+ height: this.data.height,
+ x: currentX,
+ y: currentY,
+ cut_top: this.data.cut_top,
+ cut_left: this.data.cut_left,
+ corner: 3
+ };
+ } else if (
+ currentX > cutbox_left2 &&
+ currentX < cutbox_right2 &&
+ currentY > cutbox_top2 &&
+ currentY < cutbox_bottom2
+ ) {
+ this._moveDuring();
+ this.data._flag_cut_touch = true;
+ this.data._flag_img_endtouch = true;
+ this.data.CUT_START = {
+ width: this.data.width,
+ height: this.data.height,
+ cut_top: this.data.cut_top,
+ cut_left: this.data.cut_left,
+ x: currentX,
+ y: currentY,
+ corner: 2
+ };
+ } else if (
+ currentX > cutbox_left1 &&
+ currentX < cutbox_right1 &&
+ currentY > cutbox_top1 &&
+ currentY < cutbox_bottom1
+ ) {
+ this._moveDuring();
+ this.data._flag_cut_touch = true;
+ this.data._flag_img_endtouch = true;
+ this.data.CUT_START = {
+ width: this.data.width,
+ height: this.data.height,
+ cut_top: this.data.cut_top,
+ cut_left: this.data.cut_left,
+ x: currentX,
+ y: currentY,
+ corner: 1
+ };
+ }
+ },
+ _cutTouchEnd(e) {
+ this._moveStop();
+ this.data._flag_cut_touch = false;
+ },
+ //停止移动时需要做的操作
+ _moveStop() {
+ //清空之前的自动居中延迟函数并添加最新的
+ clearTimeout(this.data.TIME_CUT_CENTER);
+ this.data.TIME_CUT_CENTER = setTimeout(() => {
+ //动画启动
+ if (!this.data._cut_animation) {
+ this.setData({
+ _cut_animation: true
+ });
+ }
+ this.setCutCenter();
+ }, 1000);
+ //清空之前的背景变化延迟函数并添加最新的
+ clearTimeout(this.data.TIME_BG);
+ this.data.TIME_BG = setTimeout(() => {
+ if (this.data._flag_bright) {
+ this.setData({
+ _flag_bright: false
+ });
+ }
+ }, 2000);
+ },
+ //移动中
+ _moveDuring() {
+ //清空之前的自动居中延迟函数
+ clearTimeout(this.data.TIME_CUT_CENTER);
+ //清空之前的背景变化延迟函数
+ clearTimeout(this.data.TIME_BG);
+ //高亮背景
+ if (!this.data._flag_bright) {
+ this.setData({
+ _flag_bright: true
+ });
+ }
+ },
+ //监听器
+ _watcher() {
+ Object.keys(this.data).forEach(v => {
+ this._observe(this.data, v, this.data.watch[v]);
+ });
+ },
+ _observe(obj, key, watchFun) {
+ var val = obj[key];
+ Object.defineProperty(obj, key, {
+ configurable: true,
+ enumerable: true,
+ set: value => {
+ val = value;
+ watchFun && watchFun(val, this);
+ },
+ get() {
+ if (
+ val &&
+ '_img_top|img_left||width|height|min_width|max_width|min_height|max_height|export_scale|cut_top|cut_left|canvas_top|canvas_left|img_width|img_height|scale|angle|min_scale|max_scale'.indexOf(
+ key
+ ) != -1
+ ) {
+ let ret = parseFloat(parseFloat(val).toFixed(3));
+ if (typeof val == 'string' && val.indexOf('%') != -1) {
+ ret += '%';
+ }
+ return ret;
+ }
+ return val;
+ }
+ });
+ },
+ _preventTouchMove() {}
+ }
+});
diff --git a/employee-mp/src/components/image-cropper/index.json b/employee-mp/src/components/image-cropper/index.json
new file mode 100644
index 0000000..b8ed052
--- /dev/null
+++ b/employee-mp/src/components/image-cropper/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-button": "../button"
+ }
+}
diff --git a/employee-mp/src/components/image-cropper/index.wxml b/employee-mp/src/components/image-cropper/index.wxml
new file mode 100644
index 0000000..e0dc1f1
--- /dev/null
+++ b/employee-mp/src/components/image-cropper/index.wxml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 确认
+
+
diff --git a/employee-mp/src/components/image-cropper/index.wxss b/employee-mp/src/components/image-cropper/index.wxss
new file mode 100644
index 0000000..995ef1b
--- /dev/null
+++ b/employee-mp/src/components/image-cropper/index.wxss
@@ -0,0 +1,153 @@
+.cw-image-cropper {
+ background: rgba(14, 13, 13, 0.8);
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100vw;
+ height: 100vh;
+ z-index: 1;
+}
+
+.cw-image-cropper .btn {
+ position: fixed !important;
+ left: 0;
+ right: 0;
+ z-index: 50;
+ bottom: constant(safe-area-inset-bottom);
+ bottom: env(safe-area-inset-bottom);
+ z-index: 999;
+}
+
+.cw-image-cropper .main {
+ position: absolute;
+ width: 100vw;
+ height: 100vh;
+ overflow: hidden;
+}
+
+.cw-image-cropper .content {
+ z-index: 9;
+ position: absolute;
+ width: 100vw;
+ height: 100vh;
+ display: flex;
+ flex-direction: column;
+ pointer-events: none;
+}
+
+.cw-image-cropper .bg_black {
+ background: rgba(0, 0, 0, 0.8) !important;
+}
+
+.cw-image-cropper .bg_gray {
+ background: rgba(0, 0, 0, 0.45);
+ transition-duration: 0.35s;
+}
+
+.cw-image-cropper .content > .content_top {
+ pointer-events: none;
+}
+
+.cw-image-cropper .content > .content_middle {
+ display: flex;
+ height: 200px;
+ width: 100%;
+}
+
+.cw-image-cropper .content_middle_middle {
+ width: 200px;
+ box-sizing: border-box;
+ position: relative;
+ transition-duration: 0.3s;
+}
+
+.cw-image-cropper .content_middle_right {
+ flex: auto;
+}
+
+.cw-image-cropper .content > .content_bottom {
+ flex: auto;
+}
+
+.cw-image-cropper .img {
+ z-index: 2;
+ top: 0;
+ left: 0;
+ position: absolute;
+ border: none;
+ width: 100%;
+ backface-visibility: hidden;
+ transform-origin: center;
+}
+
+.cw-image-cropper .cw-image-cropper-canvas {
+ position: fixed;
+ background: white;
+ width: 150px;
+ height: 150px;
+ z-index: 10;
+ top: -200%;
+ pointer-events: none;
+}
+
+.cw-image-cropper .border {
+ background: white;
+ pointer-events: auto;
+ position: absolute;
+}
+
+.cw-image-cropper .border-top-left {
+ left: -2.5px;
+ top: -2.5px;
+ height: 2.5px;
+ width: 33rpx;
+}
+
+.cw-image-cropper .border-top-right {
+ right: -2.5px;
+ top: -2.5px;
+ height: 2.5px;
+ width: 33rpx;
+}
+
+.cw-image-cropper .border-right-top {
+ top: -1px;
+ width: 2.5px;
+ height: 30rpx;
+ right: -2.5px;
+}
+
+.cw-image-cropper .border-right-bottom {
+ width: 2.5px;
+ height: 30rpx;
+ right: -2.5px;
+ bottom: -1px;
+}
+
+.cw-image-cropper .border-bottom-left {
+ height: 2.5px;
+ width: 33rpx;
+ bottom: -2.5px;
+ left: -2.5px;
+}
+
+.cw-image-cropper .border-bottom-right {
+ height: 2.5px;
+ width: 33rpx;
+ bottom: -2.5px;
+ right: -2.5px;
+}
+
+.cw-image-cropper .border-left-top {
+ top: -1px;
+ width: 2.5px;
+ height: 30rpx;
+ left: -2.5px;
+}
+
+.cw-image-cropper .border-left-bottom {
+ width: 2.5px;
+ height: 30rpx;
+ left: -2.5px;
+ bottom: -1px;
+}
diff --git a/employee-mp/src/components/image/index.js b/employee-mp/src/components/image/index.js
new file mode 100644
index 0000000..2176731
--- /dev/null
+++ b/employee-mp/src/components/image/index.js
@@ -0,0 +1,73 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { button } from '../mixins/button';
+import { openType } from '../mixins/open-type';
+CwComponent({
+ mixins: [button, openType],
+ classes: ['custom-class', 'loading-class', 'error-class', 'image-class'],
+ props: {
+ src: {
+ type: String,
+ observer() {
+ this.setData({
+ error: false,
+ loading: true
+ });
+ }
+ },
+ round: Boolean,
+ width: null,
+ height: null,
+ radius: null,
+ lazyLoad: Boolean,
+ useErrorSlot: Boolean,
+ useLoadingSlot: Boolean,
+ showMenuByLongpress: Boolean,
+ fit: {
+ type: String,
+ value: 'cover'
+ },
+ showError: {
+ type: Boolean,
+ value: true
+ },
+ showLoading: {
+ type: Boolean,
+ value: true
+ }
+ },
+ data: {
+ error: false,
+ loading: true,
+ viewStyle: ''
+ },
+ methods: {
+ onLoad(event) {
+ this.setData({
+ loading: false
+ });
+ this.$emit('load', event.detail);
+ },
+ onError(event) {
+ this.setData({
+ loading: false,
+ error: true
+ });
+ this.$emit('error', event.detail);
+ },
+ onClick(event) {
+ this.$emit('click', event.detail);
+ }
+ }
+});
diff --git a/employee-mp/src/components/image/index.json b/employee-mp/src/components/image/index.json
new file mode 100644
index 0000000..8b00ed6
--- /dev/null
+++ b/employee-mp/src/components/image/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index",
+ "cw-loading": "../loading/index"
+ }
+}
diff --git a/employee-mp/src/components/image/index.wxml b/employee-mp/src/components/image/index.wxml
new file mode 100644
index 0000000..7e34a34
--- /dev/null
+++ b/employee-mp/src/components/image/index.wxml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/image/index.wxs b/employee-mp/src/components/image/index.wxs
new file mode 100644
index 0000000..3fd27da
--- /dev/null
+++ b/employee-mp/src/components/image/index.wxs
@@ -0,0 +1,31 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function rootStyle(data) {
+ return style([
+ {
+ width: addUnit(data.width),
+ height: addUnit(data.height),
+ 'border-radius': addUnit(data.radius)
+ },
+ data.radius ? 'overflow: hidden' : null
+ ]);
+}
+
+var FIT_MODE_MAP = {
+ none: 'center',
+ fill: 'scaleToFill',
+ cover: 'aspectFill',
+ contain: 'aspectFit',
+ widthFix: 'widthFix',
+ heightFix: 'heightFix'
+};
+
+function mode(fit) {
+ return FIT_MODE_MAP[fit];
+}
+
+module.exports = {
+ rootStyle: rootStyle,
+ mode: mode
+};
diff --git a/employee-mp/src/components/image/index.wxss b/employee-mp/src/components/image/index.wxss
new file mode 100644
index 0000000..0182790
--- /dev/null
+++ b/employee-mp/src/components/image/index.wxss
@@ -0,0 +1,51 @@
+@import '../common/index.wxss';
+
+.cw-image {
+ position: relative;
+ display: inline-block;
+}
+
+.cw-image--round {
+ overflow: hidden;
+ border-radius: 50%;
+}
+
+.cw-image--round .cw-image__img {
+ border-radius: inherit;
+}
+
+.cw-image__error,
+.cw-image__img,
+.cw-image__loading {
+ display: block;
+ width: 100%;
+ height: 100%;
+}
+
+.cw-image__error,
+.cw-image__loading {
+ position: absolute;
+ top: 0;
+ left: 0;
+ display: -webkit-flex;
+ display: flex;
+ -webkit-flex-direction: column;
+ flex-direction: column;
+ -webkit-align-items: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ color: #969799;
+ font-size: 14px;
+ background-color: #f7f8fa;
+}
+
+.cw-image__loading-icon {
+ color: #dcdee0;
+ font-size: 32px !important;
+}
+
+.cw-image__error-icon {
+ color: #dcdee0;
+ font-size: 32px !important;
+}
diff --git a/employee-mp/src/components/index-anchor/index.js b/employee-mp/src/components/index-anchor/index.js
new file mode 100644
index 0000000..f415b72
--- /dev/null
+++ b/employee-mp/src/components/index-anchor/index.js
@@ -0,0 +1,37 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { getRect } from '../common/utils';
+import { CwComponent } from '../common/component';
+import { useParent } from '../common/relation';
+CwComponent({
+ relation: useParent('index-bar'),
+ props: {
+ useSlot: Boolean,
+ index: null
+ },
+ data: {
+ active: false,
+ wrapperStyle: '',
+ anchorStyle: ''
+ },
+ methods: {
+ scrollIntoView(scrollTop) {
+ getRect(this, '.cw-index-anchor-wrapper').then(rect => {
+ wx.pageScrollTo({
+ duration: 0,
+ scrollTop: scrollTop + rect.top - this.parent.data.stickyOffsetTop
+ });
+ });
+ }
+ }
+});
diff --git a/employee-mp/src/components/index-anchor/index.json b/employee-mp/src/components/index-anchor/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/index-anchor/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/index-anchor/index.wxml b/employee-mp/src/components/index-anchor/index.wxml
new file mode 100644
index 0000000..0505194
--- /dev/null
+++ b/employee-mp/src/components/index-anchor/index.wxml
@@ -0,0 +1,11 @@
+
+
+
+
+ {{ index }}
+
+
+
diff --git a/employee-mp/src/components/index-anchor/index.wxss b/employee-mp/src/components/index-anchor/index.wxss
new file mode 100644
index 0000000..ecc219f
--- /dev/null
+++ b/employee-mp/src/components/index-anchor/index.wxss
@@ -0,0 +1,17 @@
+@import '../common/index.wxss';
+
+.cw-index-anchor {
+ padding: 0 16px;
+ color: #323233;
+ font-weight: 500;
+ font-size: 14px;
+ line-height: 32px;
+ background-color: initial;
+}
+
+.cw-index-anchor--active {
+ right: 0;
+ left: 0;
+ color: #07c160;
+ background-color: #fff;
+}
diff --git a/employee-mp/src/components/index-bar/index.js b/employee-mp/src/components/index-bar/index.js
new file mode 100644
index 0000000..8581baf
--- /dev/null
+++ b/employee-mp/src/components/index-bar/index.js
@@ -0,0 +1,246 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { GREEN } from '../common/color';
+import { CwComponent } from '../common/component';
+import { useChildren } from '../common/relation';
+import { getRect } from '../common/utils';
+import { pageScrollMixin } from '../mixins/page-scroll';
+const indexList = () => {
+ const indexList = [];
+ const charCodeOfA = 'A'.charCodeAt(0);
+ for (let i = 0; i < 26; i++) {
+ indexList.push(String.fromCharCode(charCodeOfA + i));
+ }
+ return indexList;
+};
+CwComponent({
+ relation: useChildren('index-anchor', function() {
+ this.updateData();
+ }),
+ props: {
+ sticky: {
+ type: Boolean,
+ value: true
+ },
+ zIndex: {
+ type: Number,
+ value: 1
+ },
+ highlightColor: {
+ type: String,
+ value: GREEN
+ },
+ stickyOffsetTop: {
+ type: Number,
+ value: 0
+ },
+ indexList: {
+ type: Array,
+ value: indexList()
+ }
+ },
+ mixins: [
+ pageScrollMixin(function(event) {
+ this.scrollTop = (event === null || event === void 0 ? void 0 : event.scrollTop) || 0;
+ this.onScroll();
+ })
+ ],
+ data: {
+ activeAnchorIndex: null,
+ showSidebar: false
+ },
+ created() {
+ this.scrollTop = 0;
+ },
+ methods: {
+ updateData() {
+ wx.nextTick(() => {
+ if (this.timer != null) {
+ clearTimeout(this.timer);
+ }
+ this.timer = setTimeout(() => {
+ this.setData({
+ showSidebar: !!this.children.length
+ });
+ this.setRect().then(() => {
+ this.onScroll();
+ });
+ }, 0);
+ });
+ },
+ setRect() {
+ return Promise.all([this.setAnchorsRect(), this.setListRect(), this.setSiderbarRect()]);
+ },
+ setAnchorsRect() {
+ return Promise.all(
+ this.children.map(anchor =>
+ getRect(anchor, '.cw-index-anchor-wrapper').then(rect => {
+ Object.assign(anchor, {
+ height: rect.height,
+ top: rect.top + this.scrollTop
+ });
+ })
+ )
+ );
+ },
+ setListRect() {
+ return getRect(this, '.cw-index-bar').then(rect => {
+ Object.assign(this, {
+ height: rect.height,
+ top: rect.top + this.scrollTop
+ });
+ });
+ },
+ setSiderbarRect() {
+ return getRect(this, '.cw-index-bar__sidebar').then(res => {
+ this.sidebar = {
+ height: res.height,
+ top: res.top
+ };
+ });
+ },
+ setDiffData({ target, data }) {
+ const diffData = {};
+ Object.keys(data).forEach(key => {
+ if (target.data[key] !== data[key]) {
+ diffData[key] = data[key];
+ }
+ });
+ if (Object.keys(diffData).length) {
+ target.setData(diffData);
+ }
+ },
+ getAnchorRect(anchor) {
+ return getRect(anchor, '.cw-index-anchor-wrapper').then(rect => ({
+ height: rect.height,
+ top: rect.top
+ }));
+ },
+ getActiveAnchorIndex() {
+ const { children, scrollTop } = this;
+ const { sticky, stickyOffsetTop } = this.data;
+ for (let i = this.children.length - 1; i >= 0; i--) {
+ const preAnchorHeight = i > 0 ? children[i - 1].height : 0;
+ const reachTop = sticky ? preAnchorHeight + stickyOffsetTop : 0;
+ if (reachTop + scrollTop >= children[i].top) {
+ return i;
+ }
+ }
+ return -1;
+ },
+ onScroll() {
+ const { children = [], scrollTop } = this;
+ if (!children.length) {
+ return;
+ }
+ const { sticky, stickyOffsetTop, zIndex, highlightColor } = this.data;
+ const active = this.getActiveAnchorIndex();
+ this.setDiffData({
+ target: this,
+ data: {
+ activeAnchorIndex: active
+ }
+ });
+ if (sticky) {
+ let isActiveAnchorSticky = false;
+ if (active !== -1) {
+ isActiveAnchorSticky = children[active].top <= stickyOffsetTop + scrollTop;
+ }
+ children.forEach((item, index) => {
+ if (index === active) {
+ let wrapperStyle = '';
+ let anchorStyle = `
+ color: ${highlightColor};
+ `;
+ if (isActiveAnchorSticky) {
+ wrapperStyle = `
+ height: ${children[index].height}px;
+ `;
+ anchorStyle = `
+ position: fixed;
+ top: ${stickyOffsetTop}px;
+ z-index: ${zIndex};
+ color: ${highlightColor};
+ `;
+ }
+ this.setDiffData({
+ target: item,
+ data: {
+ active: true,
+ anchorStyle,
+ wrapperStyle
+ }
+ });
+ } else if (index === active - 1) {
+ const currentAnchor = children[index];
+ const currentOffsetTop = currentAnchor.top;
+ const targetOffsetTop = index === children.length - 1 ? this.top : children[index + 1].top;
+ const parentOffsetHeight = targetOffsetTop - currentOffsetTop;
+ const translateY = parentOffsetHeight - currentAnchor.height;
+ const anchorStyle = `
+ position: relative;
+ transform: translate3d(0, ${translateY}px, 0);
+ z-index: ${zIndex};
+ color: ${highlightColor};
+ `;
+ this.setDiffData({
+ target: item,
+ data: {
+ active: true,
+ anchorStyle
+ }
+ });
+ } else {
+ this.setDiffData({
+ target: item,
+ data: {
+ active: false,
+ anchorStyle: '',
+ wrapperStyle: ''
+ }
+ });
+ }
+ });
+ }
+ },
+ onClick(event) {
+ this.scrollToAnchor(event.target.dataset.index);
+ },
+ onTouchMove(event) {
+ const sidebarLength = this.children.length;
+ const touch = event.touches[0];
+ const itemHeight = this.sidebar.height / sidebarLength;
+ let index = Math.floor((touch.clientY - this.sidebar.top) / itemHeight);
+ if (index < 0) {
+ index = 0;
+ } else if (index > sidebarLength - 1) {
+ index = sidebarLength - 1;
+ }
+ this.scrollToAnchor(index);
+ },
+ onTouchStop() {
+ this.scrollToAnchorIndex = null;
+ },
+ scrollToAnchor(index) {
+ if (typeof index !== 'number' || this.scrollToAnchorIndex === index) {
+ return;
+ }
+ this.scrollToAnchorIndex = index;
+ const anchor = this.children.find(item => item.data.index === this.data.indexList[index]);
+ if (anchor) {
+ anchor.scrollIntoView(this.scrollTop);
+ this.$emit('select', anchor.data.index);
+ }
+ }
+ }
+});
diff --git a/employee-mp/src/components/index-bar/index.json b/employee-mp/src/components/index-bar/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/index-bar/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/index-bar/index.wxml b/employee-mp/src/components/index-bar/index.wxml
new file mode 100644
index 0000000..354ff74
--- /dev/null
+++ b/employee-mp/src/components/index-bar/index.wxml
@@ -0,0 +1,22 @@
+
+
+
+
+
diff --git a/employee-mp/src/components/index-bar/index.wxss b/employee-mp/src/components/index-bar/index.wxss
new file mode 100644
index 0000000..3270e22
--- /dev/null
+++ b/employee-mp/src/components/index-bar/index.wxss
@@ -0,0 +1,27 @@
+@import '../common/index.wxss';
+
+.cw-index-bar {
+ position: relative;
+}
+
+.cw-index-bar__sidebar {
+ position: fixed;
+ top: 50%;
+ right: 0;
+ display: -webkit-flex;
+ display: flex;
+ -webkit-flex-direction: column;
+ flex-direction: column;
+ text-align: center;
+ -webkit-transform: translateY(-50%);
+ transform: translateY(-50%);
+ -webkit-user-select: none;
+ user-select: none;
+}
+
+.cw-index-bar__index {
+ font-weight: 500;
+ padding: 0 4px 0 16px;
+ font-size: 10px;
+ line-height: 14px;
+}
diff --git a/employee-mp/src/components/info/index.js b/employee-mp/src/components/info/index.js
new file mode 100644
index 0000000..ed382a2
--- /dev/null
+++ b/employee-mp/src/components/info/index.js
@@ -0,0 +1,20 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+CwComponent({
+ props: {
+ dot: Boolean,
+ info: null,
+ customStyle: String
+ }
+});
diff --git a/employee-mp/src/components/info/index.json b/employee-mp/src/components/info/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/info/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/info/index.wxml b/employee-mp/src/components/info/index.wxml
new file mode 100644
index 0000000..0ac8f02
--- /dev/null
+++ b/employee-mp/src/components/info/index.wxml
@@ -0,0 +1,9 @@
+
+
+
+ {{ dot ? '' : info }}
+
diff --git a/employee-mp/src/components/info/index.wxss b/employee-mp/src/components/info/index.wxss
new file mode 100644
index 0000000..999b5be
--- /dev/null
+++ b/employee-mp/src/components/info/index.wxss
@@ -0,0 +1,36 @@
+@import '../common/index.wxss';
+
+.cw-info {
+ position: absolute;
+ top: 0;
+ right: 0;
+ display: -webkit-inline-flex;
+ display: inline-flex;
+ -webkit-align-items: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ box-sizing: border-box;
+ white-space: nowrap;
+ -webkit-transform: translate(50%, -50%);
+ transform: translate(50%, -50%);
+ -webkit-transform-origin: 100%;
+ transform-origin: 100%;
+ height: 16px;
+ min-width: 16px;
+ padding: 0 3px;
+ color: #fff;
+ font-weight: 500;
+ font-size: 12px;
+ background-color: #ee0a24;
+ border: 1px solid #fff;
+ border-radius: 16px;
+}
+
+.cw-info--dot {
+ min-width: 0;
+ border-radius: 100%;
+ width: 8px;
+ height: 8px;
+ background-color: #ee0a24;
+}
diff --git a/employee-mp/src/components/list-item-info/index.js b/employee-mp/src/components/list-item-info/index.js
new file mode 100644
index 0000000..5364371
--- /dev/null
+++ b/employee-mp/src/components/list-item-info/index.js
@@ -0,0 +1,19 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+
+CwComponent({
+ props: {
+ label: String
+ }
+});
diff --git a/employee-mp/src/components/list-item-info/index.json b/employee-mp/src/components/list-item-info/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/list-item-info/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/list-item-info/index.wxml b/employee-mp/src/components/list-item-info/index.wxml
new file mode 100644
index 0000000..b0dfeb5
--- /dev/null
+++ b/employee-mp/src/components/list-item-info/index.wxml
@@ -0,0 +1,6 @@
+
+ {{ label }}:
+
+
+
+
diff --git a/employee-mp/src/components/list-item-info/index.wxss b/employee-mp/src/components/list-item-info/index.wxss
new file mode 100644
index 0000000..a77b095
--- /dev/null
+++ b/employee-mp/src/components/list-item-info/index.wxss
@@ -0,0 +1,18 @@
+.list-item-info {
+ display: flex;
+ flex: row;
+ line-height: 20px;
+ font-size: 13px;
+}
+
+.list-item-info-label {
+ flex: none;
+ width: 80px;
+ color: #444;
+}
+
+.list-item-info-content {
+ flex: auto;
+ overflow: hidden;
+ color: #333;
+}
diff --git a/employee-mp/src/components/list-item/index.js b/employee-mp/src/components/list-item/index.js
new file mode 100644
index 0000000..737aa7d
--- /dev/null
+++ b/employee-mp/src/components/list-item/index.js
@@ -0,0 +1,29 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+
+CwComponent({
+ props: {
+ url: String,
+ title: String,
+ status: String,
+ useFooterSlot: Boolean
+ },
+ methods: {
+ goToDetail() {
+ if (this.data.url) {
+ wx.navigateTo({ url: this.data.url });
+ }
+ }
+ }
+});
diff --git a/employee-mp/src/components/list-item/index.json b/employee-mp/src/components/list-item/index.json
new file mode 100644
index 0000000..3587ff7
--- /dev/null
+++ b/employee-mp/src/components/list-item/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-panel": "../panel"
+ }
+}
diff --git a/employee-mp/src/components/list-item/index.wxml b/employee-mp/src/components/list-item/index.wxml
new file mode 100644
index 0000000..152f5f4
--- /dev/null
+++ b/employee-mp/src/components/list-item/index.wxml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/list-item/index.wxss b/employee-mp/src/components/list-item/index.wxss
new file mode 100644
index 0000000..733feb8
--- /dev/null
+++ b/employee-mp/src/components/list-item/index.wxss
@@ -0,0 +1,13 @@
+.list-item {
+ margin-bottom: 12px;
+}
+
+.list-item-inner {
+ padding: 12px 18px;
+}
+
+.list-item-footer {
+ display: flex;
+ flex-direction: row;
+ justify-content: flex-end;
+}
diff --git a/employee-mp/src/components/list/index.js b/employee-mp/src/components/list/index.js
new file mode 100644
index 0000000..4841709
--- /dev/null
+++ b/employee-mp/src/components/list/index.js
@@ -0,0 +1,40 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+
+CwComponent({
+ props: {
+ fetching: Boolean,
+ page_num: Number,
+ page_amount: Number,
+ list: Array,
+ empty: String,
+ icon: {
+ type: String,
+ value: 'empty'
+ },
+ fixed: {
+ type: Boolean,
+ value: true
+ },
+ inTabPage: {
+ type: Boolean,
+ value: false
+ },
+ useEmptySlot: Boolean,
+ withFilter: Boolean
+ },
+ data: {
+ page_size: 5
+ }
+});
diff --git a/employee-mp/src/components/list/index.json b/employee-mp/src/components/list/index.json
new file mode 100644
index 0000000..1e95b21
--- /dev/null
+++ b/employee-mp/src/components/list/index.json
@@ -0,0 +1,11 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-skeleton": "../skeleton",
+ "cw-divider": "../divider",
+ "cw-loading": "../loading",
+ "cw-empty": "../empty",
+ "cw-copyright": "../copyright",
+ "cw-list-item": "../list-item"
+ }
+}
diff --git a/employee-mp/src/components/list/index.wxml b/employee-mp/src/components/list/index.wxml
new file mode 100644
index 0000000..fef8b8f
--- /dev/null
+++ b/employee-mp/src/components/list/index.wxml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+ 只有这些数据了
+
+
+
+
+ 加载中...
+
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/list/index.wxss b/employee-mp/src/components/list/index.wxss
new file mode 100644
index 0000000..2d67e0b
--- /dev/null
+++ b/employee-mp/src/components/list/index.wxss
@@ -0,0 +1,50 @@
+.cw-list {
+ position: relative;
+ min-height: calc(100vh - constant(safe-area-inset-bottom));
+ min-height: calc(100vh - env(safe-area-inset-bottom));
+}
+
+.cw-list.with-filter {
+ margin-top: 10px;
+ min-height: calc(100vh - constant(safe-area-inset-bottom) - 54px);
+ min-height: calc(100vh - env(safe-area-inset-bottom) - 54px);
+}
+
+.cw-list.in-tab-page {
+ margin-top: 10px;
+ min-height: calc(100vh - constant(safe-area-inset-bottom) - 50px);
+ min-height: calc(100vh - env(safe-area-inset-bottom) - 50px);
+}
+
+.cw-list.with-filter.in-tab-page {
+ margin-top: 10px;
+ min-height: calc(100vh - constant(safe-area-inset-bottom) - 104px);
+ min-height: calc(100vh - env(safe-area-inset-bottom) - 104px);
+}
+
+.cw-list-loading-item {
+ margin-bottom: 12px;
+ background-color: #fff;
+}
+
+.cw-list-loading-item-header {
+ position: relative;
+ border-bottom: 1px solid #ebedf0;
+}
+
+.cw-list-loading-item-header:before {
+ content: '';
+ position: absolute;
+ top: 14px;
+ left: 0px;
+ bottom: 14px;
+ width: 4px;
+ background: #eee;
+}
+
+.cw-list-load-more {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 12px 0;
+}
diff --git a/employee-mp/src/components/loading/index.js b/employee-mp/src/components/loading/index.js
new file mode 100644
index 0000000..b4aead3
--- /dev/null
+++ b/employee-mp/src/components/loading/index.js
@@ -0,0 +1,28 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+CwComponent({
+ props: {
+ color: String,
+ vertical: Boolean,
+ type: {
+ type: String,
+ value: 'circular'
+ },
+ size: String,
+ textSize: String
+ },
+ data: {
+ array12: Array.from({ length: 12 })
+ }
+});
diff --git a/employee-mp/src/components/loading/index.json b/employee-mp/src/components/loading/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/loading/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/loading/index.wxml b/employee-mp/src/components/loading/index.wxml
new file mode 100644
index 0000000..0280dab
--- /dev/null
+++ b/employee-mp/src/components/loading/index.wxml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/loading/index.wxs b/employee-mp/src/components/loading/index.wxs
new file mode 100644
index 0000000..9faf304
--- /dev/null
+++ b/employee-mp/src/components/loading/index.wxs
@@ -0,0 +1,21 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function spinnerStyle(data) {
+ return style({
+ color: data.color,
+ width: addUnit(data.size),
+ height: addUnit(data.size)
+ });
+}
+
+function textStyle(data) {
+ return style({
+ 'font-size': addUnit(data.textSize)
+ });
+}
+
+module.exports = {
+ spinnerStyle: spinnerStyle,
+ textStyle: textStyle
+};
diff --git a/employee-mp/src/components/loading/index.wxss b/employee-mp/src/components/loading/index.wxss
new file mode 100644
index 0000000..f02489d
--- /dev/null
+++ b/employee-mp/src/components/loading/index.wxss
@@ -0,0 +1,145 @@
+@import '../common/index.wxss';
+
+:host {
+ font-size: 0;
+ line-height: 1;
+}
+
+.cw-loading {
+ display: -webkit-inline-flex;
+ display: inline-flex;
+ -webkit-align-items: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ color: #c8c9cc;
+}
+
+.cw-loading__spinner {
+ position: relative;
+ box-sizing: border-box;
+ width: 30px;
+ max-width: 100%;
+ max-height: 100%;
+ height: 30px;
+ animation: cw-rotate 0.8s linear infinite;
+}
+
+.cw-loading__spinner--spinner {
+ -webkit-animation-timing-function: steps(12);
+ animation-timing-function: steps(12);
+}
+
+.cw-loading__spinner--circular {
+ border: 1px solid transparent;
+ border-top-color: initial;
+ border-radius: 100%;
+}
+
+.cw-loading__text {
+ margin-left: 8px;
+ color: #969799;
+ font-size: 14px;
+ line-height: 20px;
+}
+
+.cw-loading__text:empty {
+ display: none;
+}
+
+.cw-loading--vertical {
+ -webkit-flex-direction: column;
+ flex-direction: column;
+}
+
+.cw-loading--vertical .cw-loading__text {
+ margin: 8px 0 0;
+}
+
+.cw-loading__dot {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+
+.cw-loading__dot:before {
+ display: block;
+ width: 2px;
+ height: 25%;
+ margin: 0 auto;
+ background-color: currentColor;
+ border-radius: 40%;
+ content: ' ';
+}
+
+.cw-loading__dot:first-of-type {
+ transform: rotate(30deg);
+ opacity: 1;
+}
+
+.cw-loading__dot:nth-of-type(2) {
+ transform: rotate(60deg);
+ opacity: 0.9375;
+}
+
+.cw-loading__dot:nth-of-type(3) {
+ transform: rotate(90deg);
+ opacity: 0.875;
+}
+
+.cw-loading__dot:nth-of-type(4) {
+ transform: rotate(120deg);
+ opacity: 0.8125;
+}
+
+.cw-loading__dot:nth-of-type(5) {
+ transform: rotate(150deg);
+ opacity: 0.75;
+}
+
+.cw-loading__dot:nth-of-type(6) {
+ transform: rotate(180deg);
+ opacity: 0.6875;
+}
+
+.cw-loading__dot:nth-of-type(7) {
+ transform: rotate(210deg);
+ opacity: 0.625;
+}
+
+.cw-loading__dot:nth-of-type(8) {
+ transform: rotate(240deg);
+ opacity: 0.5625;
+}
+
+.cw-loading__dot:nth-of-type(9) {
+ transform: rotate(270deg);
+ opacity: 0.5;
+}
+
+.cw-loading__dot:nth-of-type(10) {
+ transform: rotate(300deg);
+ opacity: 0.4375;
+}
+
+.cw-loading__dot:nth-of-type(11) {
+ transform: rotate(330deg);
+ opacity: 0.375;
+}
+
+.cw-loading__dot:nth-of-type(12) {
+ transform: rotate(1turn);
+ opacity: 0.3125;
+}
+
+@keyframes cw-rotate {
+ 0% {
+ transform: rotate(0deg);
+ }
+
+ to {
+ transform: rotate(1turn);
+ }
+}
diff --git a/employee-mp/src/components/mixins/basic.js b/employee-mp/src/components/mixins/basic.js
new file mode 100644
index 0000000..81f452a
--- /dev/null
+++ b/employee-mp/src/components/mixins/basic.js
@@ -0,0 +1,23 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export const basic = Behavior({
+ methods: {
+ $emit(name, detail, options) {
+ this.triggerEvent(name, detail, options);
+ },
+ set(data) {
+ this.setData(data);
+ return new Promise(resolve => wx.nextTick(resolve));
+ }
+ }
+});
diff --git a/employee-mp/src/components/mixins/button.js b/employee-mp/src/components/mixins/button.js
new file mode 100644
index 0000000..6a91876
--- /dev/null
+++ b/employee-mp/src/components/mixins/button.js
@@ -0,0 +1,27 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export const button = Behavior({
+ externalClasses: ['hover-class'],
+ properties: {
+ id: String,
+ lang: String,
+ businessId: Number,
+ sessionFrom: String,
+ sendMessageTitle: String,
+ sendMessagePath: String,
+ sendMessageImg: String,
+ showMessageCard: Boolean,
+ appParameter: String,
+ ariaLabel: String
+ }
+});
diff --git a/employee-mp/src/components/mixins/link.js b/employee-mp/src/components/mixins/link.js
new file mode 100644
index 0000000..d59778a
--- /dev/null
+++ b/employee-mp/src/components/mixins/link.js
@@ -0,0 +1,33 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export const link = Behavior({
+ properties: {
+ url: String,
+ linkType: {
+ type: String,
+ value: 'navigateTo'
+ }
+ },
+ methods: {
+ jumpLink(urlKey = 'url') {
+ const url = this.data[urlKey];
+ if (url) {
+ if (this.data.linkType === 'navigateTo' && getCurrentPages().length > 9) {
+ wx.redirectTo({ url });
+ } else {
+ wx[this.data.linkType]({ url });
+ }
+ }
+ }
+ }
+});
diff --git a/employee-mp/src/components/mixins/open-type.js b/employee-mp/src/components/mixins/open-type.js
new file mode 100644
index 0000000..cd6c1fe
--- /dev/null
+++ b/employee-mp/src/components/mixins/open-type.js
@@ -0,0 +1,38 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+// @ts-nocheck
+export const openType = Behavior({
+ properties: {
+ openType: String
+ },
+ methods: {
+ bindGetUserInfo(event) {
+ this.$emit('getuserinfo', event.detail);
+ },
+ bindContact(event) {
+ this.$emit('contact', event.detail);
+ },
+ bindGetPhoneNumber(event) {
+ this.$emit('getphonenumber', event.detail);
+ },
+ bindError(event) {
+ this.$emit('error', event.detail);
+ },
+ bindLaunchApp(event) {
+ this.$emit('launchapp', event.detail);
+ },
+ bindOpenSetting(event) {
+ this.$emit('opensetting', event.detail);
+ }
+ }
+});
diff --git a/employee-mp/src/components/mixins/page-scroll.js b/employee-mp/src/components/mixins/page-scroll.js
new file mode 100644
index 0000000..ec7052e
--- /dev/null
+++ b/employee-mp/src/components/mixins/page-scroll.js
@@ -0,0 +1,45 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { getCurrentPage } from '../common/utils';
+function onPageScroll(event) {
+ const { cwPageScroller = [] } = getCurrentPage();
+ cwPageScroller.forEach(scroller => {
+ if (typeof scroller === 'function') {
+ // @ts-ignore
+ scroller(event);
+ }
+ });
+}
+export const pageScrollMixin = scroller =>
+ Behavior({
+ attached() {
+ const page = getCurrentPage();
+ if (Array.isArray(page.cwPageScroller)) {
+ page.cwPageScroller.push(scroller.bind(this));
+ } else {
+ page.cwPageScroller =
+ typeof page.onPageScroll === 'function'
+ ? [page.onPageScroll.bind(page), scroller.bind(this)]
+ : [scroller.bind(this)];
+ }
+ page.onPageScroll = onPageScroll;
+ },
+ detached() {
+ var _a;
+ const page = getCurrentPage();
+ page.cwPageScroller =
+ ((_a = page.cwPageScroller) === null || _a === void 0
+ ? void 0
+ : _a.filter(item => item !== scroller)) || [];
+ }
+ });
diff --git a/employee-mp/src/components/mixins/touch.js b/employee-mp/src/components/mixins/touch.js
new file mode 100644
index 0000000..232b6ae
--- /dev/null
+++ b/employee-mp/src/components/mixins/touch.js
@@ -0,0 +1,48 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+// @ts-nocheck
+const MIN_DISTANCE = 10;
+function getDirection(x, y) {
+ if (x > y && x > MIN_DISTANCE) {
+ return 'horizontal';
+ }
+ if (y > x && y > MIN_DISTANCE) {
+ return 'vertical';
+ }
+ return '';
+}
+export const touch = Behavior({
+ methods: {
+ resetTouchStatus() {
+ this.direction = '';
+ this.deltaX = 0;
+ this.deltaY = 0;
+ this.offsetX = 0;
+ this.offsetY = 0;
+ },
+ touchStart(event) {
+ this.resetTouchStatus();
+ const touch = event.touches[0];
+ this.startX = touch.clientX;
+ this.startY = touch.clientY;
+ },
+ touchMove(event) {
+ const touch = event.touches[0];
+ this.deltaX = touch.clientX - this.startX;
+ this.deltaY = touch.clientY - this.startY;
+ this.offsetX = Math.abs(this.deltaX);
+ this.offsetY = Math.abs(this.deltaY);
+ this.direction = this.direction || getDirection(this.offsetX, this.offsetY);
+ }
+ }
+});
diff --git a/employee-mp/src/components/mixins/transition.js b/employee-mp/src/components/mixins/transition.js
new file mode 100644
index 0000000..5b7fbf3
--- /dev/null
+++ b/employee-mp/src/components/mixins/transition.js
@@ -0,0 +1,127 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+// @ts-nocheck
+import { requestAnimationFrame } from '../common/utils';
+import { isObj } from '../common/validator';
+const getClassNames = name => ({
+ enter: `cw-${name}-enter cw-${name}-enter-active enter-class enter-active-class`,
+ 'enter-to': `cw-${name}-enter-to cw-${name}-enter-active enter-to-class enter-active-class`,
+ leave: `cw-${name}-leave cw-${name}-leave-active leave-class leave-active-class`,
+ 'leave-to': `cw-${name}-leave-to cw-${name}-leave-active leave-to-class leave-active-class`
+});
+export function transition(showDefaultValue) {
+ return Behavior({
+ properties: {
+ customStyle: String,
+ // @ts-ignore
+ show: {
+ type: Boolean,
+ value: showDefaultValue,
+ observer: 'observeShow'
+ },
+ // @ts-ignore
+ duration: {
+ type: null,
+ value: 300,
+ observer: 'observeDuration'
+ },
+ name: {
+ type: String,
+ value: 'fade'
+ }
+ },
+ data: {
+ type: '',
+ inited: false,
+ display: false
+ },
+ ready() {
+ if (this.data.show === true) {
+ this.observeShow(true, false);
+ }
+ },
+ methods: {
+ observeShow(value, old) {
+ if (value === old) {
+ return;
+ }
+ value ? this.enter() : this.leave();
+ },
+ enter() {
+ const { duration, name } = this.data;
+ const classNames = getClassNames(name);
+ const currentDuration = isObj(duration) ? duration.enter : duration;
+ this.status = 'enter';
+ this.$emit('before-enter');
+ requestAnimationFrame(() => {
+ if (this.status !== 'enter') {
+ return;
+ }
+ this.$emit('enter');
+ this.setData({
+ inited: true,
+ display: true,
+ classes: classNames.enter,
+ currentDuration
+ });
+ requestAnimationFrame(() => {
+ if (this.status !== 'enter') {
+ return;
+ }
+ this.transitionEnded = false;
+ this.setData({ classes: classNames['enter-to'] });
+ });
+ });
+ },
+ leave() {
+ if (!this.data.display) {
+ return;
+ }
+ const { duration, name } = this.data;
+ const classNames = getClassNames(name);
+ const currentDuration = isObj(duration) ? duration.leave : duration;
+ this.status = 'leave';
+ this.$emit('before-leave');
+ requestAnimationFrame(() => {
+ if (this.status !== 'leave') {
+ return;
+ }
+ this.$emit('leave');
+ this.setData({
+ classes: classNames.leave,
+ currentDuration
+ });
+ requestAnimationFrame(() => {
+ if (this.status !== 'leave') {
+ return;
+ }
+ this.transitionEnded = false;
+ setTimeout(() => this.onTransitionEnd(), currentDuration);
+ this.setData({ classes: classNames['leave-to'] });
+ });
+ });
+ },
+ onTransitionEnd() {
+ if (this.transitionEnded) {
+ return;
+ }
+ this.transitionEnded = true;
+ this.$emit(`after-${this.status}`);
+ const { show, display } = this.data;
+ if (!show && display) {
+ this.setData({ display: false });
+ }
+ }
+ }
+ });
+}
diff --git a/employee-mp/src/components/nav-bar/index.js b/employee-mp/src/components/nav-bar/index.js
new file mode 100644
index 0000000..9e384e0
--- /dev/null
+++ b/employee-mp/src/components/nav-bar/index.js
@@ -0,0 +1,77 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { getRect, getSystemInfoSync } from '../common/utils';
+CwComponent({
+ classes: ['title-class'],
+ props: {
+ title: String,
+ fixed: {
+ type: Boolean,
+ observer: 'setHeight'
+ },
+ placeholder: {
+ type: Boolean,
+ observer: 'setHeight'
+ },
+ leftText: String,
+ rightText: String,
+ customStyle: String,
+ leftArrow: Boolean,
+ border: {
+ type: Boolean,
+ value: true
+ },
+ zIndex: {
+ type: Number,
+ value: 1
+ },
+ safeAreaInsetTop: {
+ type: Boolean,
+ value: true
+ }
+ },
+ data: {
+ height: 46
+ },
+ created() {
+ const { statusBarHeight } = getSystemInfoSync();
+ this.setData({
+ statusBarHeight,
+ height: 46 + statusBarHeight
+ });
+ },
+ mounted() {
+ this.setHeight();
+ },
+ methods: {
+ onClickLeft() {
+ this.$emit('click-left');
+ },
+ onClickRight() {
+ this.$emit('click-right');
+ },
+ setHeight() {
+ if (!this.data.fixed || !this.data.placeholder) {
+ return;
+ }
+ wx.nextTick(() => {
+ getRect(this, '.cw-nav-bar').then(res => {
+ if (res && 'height' in res) {
+ this.setData({ height: res.height });
+ }
+ });
+ });
+ }
+ }
+});
diff --git a/employee-mp/src/components/nav-bar/index.json b/employee-mp/src/components/nav-bar/index.json
new file mode 100644
index 0000000..85e5843
--- /dev/null
+++ b/employee-mp/src/components/nav-bar/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index"
+ }
+}
diff --git a/employee-mp/src/components/nav-bar/index.wxml b/employee-mp/src/components/nav-bar/index.wxml
new file mode 100644
index 0000000..f33b7a3
--- /dev/null
+++ b/employee-mp/src/components/nav-bar/index.wxml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{ leftText }}
+
+
+
+
+
+ {{ title }}
+
+
+
+
+ {{ rightText }}
+
+
+
+
+
diff --git a/employee-mp/src/components/nav-bar/index.wxs b/employee-mp/src/components/nav-bar/index.wxs
new file mode 100644
index 0000000..c05b448
--- /dev/null
+++ b/employee-mp/src/components/nav-bar/index.wxs
@@ -0,0 +1,12 @@
+var style = require('../wxs/style.wxs');
+
+function barStyle(data) {
+ return style({
+ 'z-index': data.zIndex,
+ 'padding-top': data.safeAreaInsetTop ? data.statusBarHeight + 'px' : 0
+ });
+}
+
+module.exports = {
+ barStyle: barStyle
+};
diff --git a/employee-mp/src/components/nav-bar/index.wxss b/employee-mp/src/components/nav-bar/index.wxss
new file mode 100644
index 0000000..7452598
--- /dev/null
+++ b/employee-mp/src/components/nav-bar/index.wxss
@@ -0,0 +1,74 @@
+@import '../common/index.wxss';
+
+.cw-nav-bar {
+ position: relative;
+ text-align: center;
+ -webkit-user-select: none;
+ user-select: none;
+ background-color: #fff;
+}
+
+.cw-nav-bar__content {
+ position: relative;
+ height: 100%;
+}
+
+.cw-nav-bar__text {
+ display: inline-block;
+ vertical-align: middle;
+ margin: 0 -16px;
+ padding: 0 16px;
+ color: #232323;
+}
+
+.cw-nav-bar__text--hover {
+ background-color: #f2f3f5;
+}
+
+.cw-nav-bar__arrow {
+ vertical-align: middle;
+ font-size: 16px !important;
+ color: #232323 !important;
+}
+
+.cw-nav-bar__arrow + .cw-nav-bar__text {
+ margin-left: -20px;
+ padding-left: 25px;
+}
+
+.cw-nav-bar--fixed {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+}
+
+.cw-nav-bar__title {
+ max-width: 60%;
+ margin: 0 auto;
+ color: #323233;
+ font-weight: 500;
+ font-size: 14px;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.cw-nav-bar__left,
+.cw-nav-bar__right {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ display: flex;
+ align-items: center;
+ font-size: 14px;
+}
+
+.cw-nav-bar__left {
+ left: 16px;
+}
+
+.cw-nav-bar__right {
+ right: 16px;
+}
diff --git a/employee-mp/src/components/notice-bar/index.js b/employee-mp/src/components/notice-bar/index.js
new file mode 100644
index 0000000..b01780f
--- /dev/null
+++ b/employee-mp/src/components/notice-bar/index.js
@@ -0,0 +1,130 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { getRect, requestAnimationFrame } from '../common/utils';
+CwComponent({
+ props: {
+ text: {
+ type: String,
+ value: '',
+ observer: 'init'
+ },
+ mode: {
+ type: String,
+ value: ''
+ },
+ url: {
+ type: String,
+ value: ''
+ },
+ openType: {
+ type: String,
+ value: 'navigate'
+ },
+ delay: {
+ type: Number,
+ value: 1
+ },
+ speed: {
+ type: Number,
+ value: 50,
+ observer: 'init'
+ },
+ scrollable: {
+ type: Boolean,
+ value: true
+ },
+ leftIcon: {
+ type: String,
+ value: ''
+ },
+ color: String,
+ backgroundColor: String,
+ background: String,
+ wrapable: Boolean
+ },
+ data: {
+ show: true
+ },
+ created() {
+ this.resetAnimation = wx.createAnimation({
+ duration: 0,
+ timingFunction: 'linear'
+ });
+ },
+ destroyed() {
+ this.timer && clearTimeout(this.timer);
+ },
+ mounted() {
+ this.init();
+ },
+ methods: {
+ init() {
+ requestAnimationFrame(() => {
+ Promise.all([getRect(this, '.cw-notice-bar__content'), getRect(this, '.cw-notice-bar__wrap')]).then(
+ rects => {
+ const [contentRect, wrapRect] = rects;
+ if (contentRect == null || wrapRect == null || !contentRect.width || !wrapRect.width) {
+ return;
+ }
+ const { speed, scrollable, delay } = this.data;
+ if (scrollable || wrapRect.width < contentRect.width) {
+ const duration = (contentRect.width / speed) * 1000;
+ this.wrapWidth = wrapRect.width;
+ this.contentWidth = contentRect.width;
+ this.duration = duration;
+ this.animation = wx.createAnimation({
+ duration,
+ timingFunction: 'linear',
+ delay
+ });
+ this.scroll();
+ }
+ }
+ );
+ });
+ },
+ scroll() {
+ this.timer && clearTimeout(this.timer);
+ this.timer = null;
+ this.setData({
+ animationData: this.resetAnimation
+ .translateX(this.wrapWidth)
+ .step()
+ .export()
+ });
+ requestAnimationFrame(() => {
+ this.setData({
+ animationData: this.animation
+ .translateX(-this.contentWidth)
+ .step()
+ .export()
+ });
+ });
+ this.timer = setTimeout(() => {
+ this.scroll();
+ }, this.duration);
+ },
+ onClickIcon(event) {
+ if (this.data.mode === 'closeable') {
+ this.timer && clearTimeout(this.timer);
+ this.timer = null;
+ this.setData({ show: false });
+ this.$emit('close', event.detail);
+ }
+ },
+ onClick(event) {
+ this.$emit('click', event);
+ }
+ }
+});
diff --git a/employee-mp/src/components/notice-bar/index.json b/employee-mp/src/components/notice-bar/index.json
new file mode 100644
index 0000000..85e5843
--- /dev/null
+++ b/employee-mp/src/components/notice-bar/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index"
+ }
+}
diff --git a/employee-mp/src/components/notice-bar/index.wxml b/employee-mp/src/components/notice-bar/index.wxml
new file mode 100644
index 0000000..67256c7
--- /dev/null
+++ b/employee-mp/src/components/notice-bar/index.wxml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+ {{ text }}
+
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/notice-bar/index.wxs b/employee-mp/src/components/notice-bar/index.wxs
new file mode 100644
index 0000000..a67582e
--- /dev/null
+++ b/employee-mp/src/components/notice-bar/index.wxs
@@ -0,0 +1,14 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function rootStyle(data) {
+ return style({
+ color: data.color,
+ 'background-color': data.backgroundColor,
+ background: data.background
+ });
+}
+
+module.exports = {
+ rootStyle: rootStyle
+};
diff --git a/employee-mp/src/components/notice-bar/index.wxss b/employee-mp/src/components/notice-bar/index.wxss
new file mode 100644
index 0000000..77e1d4a
--- /dev/null
+++ b/employee-mp/src/components/notice-bar/index.wxss
@@ -0,0 +1,71 @@
+@import '../common/index.wxss';
+
+.cw-notice-bar {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ height: 40px;
+ padding: 0 16px;
+ font-size: 14px;
+ color: #ed6a0c;
+ line-height: 24px;
+ background-color: #fffbe8;
+}
+
+.cw-notice-bar--withicon {
+ position: relative;
+ padding-right: 40px;
+}
+
+.cw-notice-bar--wrapable {
+ height: auto;
+ padding: 8px 16px;
+}
+
+.cw-notice-bar--wrapable .cw-notice-bar__wrap {
+ height: auto;
+}
+
+.cw-notice-bar--wrapable .cw-notice-bar__content {
+ position: relative;
+ white-space: normal;
+}
+
+.cw-notice-bar__left-icon {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ margin-right: 4px;
+ vertical-align: middle;
+}
+
+.cw-notice-bar__left-icon,
+.cw-notice-bar__right-icon {
+ font-size: 16px;
+ min-width: 22px;
+}
+
+.cw-notice-bar__right-icon {
+ position: absolute;
+ top: 10px;
+ right: 15px;
+}
+
+.cw-notice-bar__wrap {
+ position: relative;
+ -webkit-flex: 1;
+ flex: 1;
+ overflow: hidden;
+ height: 24px;
+}
+
+.cw-notice-bar__content {
+ position: absolute;
+ white-space: nowrap;
+}
+
+.cw-notice-bar__content.cw-ellipsis {
+ max-width: 100%;
+}
diff --git a/employee-mp/src/components/notify/index.js b/employee-mp/src/components/notify/index.js
new file mode 100644
index 0000000..2796243
--- /dev/null
+++ b/employee-mp/src/components/notify/index.js
@@ -0,0 +1,80 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { WHITE } from '../common/color';
+import { getSystemInfoSync } from '../common/utils';
+
+const app = getApp();
+
+CwComponent({
+ props: {
+ message: String,
+ background: String,
+ type: {
+ type: String,
+ value: 'danger'
+ },
+ color: {
+ type: String,
+ value: WHITE
+ },
+ duration: {
+ type: Number,
+ value: 3000
+ },
+ zIndex: {
+ type: Number,
+ value: 110
+ },
+ customNavBar: {
+ type: Boolean,
+ value: false
+ },
+ offsetTop: {
+ type: Number,
+ value: app.data.systemInfo.navBarHeight + app.data.systemInfo.statusBarHeight
+ },
+ top: null
+ },
+ data: {
+ show: false,
+ onOpened: null,
+ onClose: null,
+ onClick: null
+ },
+ methods: {
+ show() {
+ const { duration, onOpened } = this.data;
+ clearTimeout(this.timer);
+ this.setData({ show: true });
+ wx.nextTick(onOpened);
+ if (duration > 0 && duration !== Infinity) {
+ this.timer = setTimeout(() => {
+ this.hide();
+ }, duration);
+ }
+ },
+ hide() {
+ const { onClose } = this.data;
+ clearTimeout(this.timer);
+ this.setData({ show: false });
+ wx.nextTick(onClose);
+ },
+ onTap(event) {
+ const { onClick } = this.data;
+ if (onClick) {
+ onClick(event.detail);
+ }
+ }
+ }
+});
diff --git a/employee-mp/src/components/notify/index.json b/employee-mp/src/components/notify/index.json
new file mode 100644
index 0000000..4321f0f
--- /dev/null
+++ b/employee-mp/src/components/notify/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-transition": "../transition/index"
+ }
+}
diff --git a/employee-mp/src/components/notify/index.wxml b/employee-mp/src/components/notify/index.wxml
new file mode 100644
index 0000000..dc17bb2
--- /dev/null
+++ b/employee-mp/src/components/notify/index.wxml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ {{ message }}
+
+
diff --git a/employee-mp/src/components/notify/index.wxs b/employee-mp/src/components/notify/index.wxs
new file mode 100644
index 0000000..b917eb3
--- /dev/null
+++ b/employee-mp/src/components/notify/index.wxs
@@ -0,0 +1,21 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function rootStyle(data) {
+ return style({
+ 'z-index': data.zIndex,
+ top: addUnit(data.top)
+ });
+}
+
+function notifyStyle(data) {
+ return style({
+ background: data.background,
+ color: data.color
+ });
+}
+
+module.exports = {
+ rootStyle: rootStyle,
+ notifyStyle: notifyStyle
+};
diff --git a/employee-mp/src/components/notify/index.wxss b/employee-mp/src/components/notify/index.wxss
new file mode 100644
index 0000000..731f281
--- /dev/null
+++ b/employee-mp/src/components/notify/index.wxss
@@ -0,0 +1,33 @@
+@import '../common/index.wxss';
+
+.cw-notify {
+ text-align: center;
+ word-wrap: break-word;
+ padding: 6px 15px;
+ font-size: 14px;
+ line-height: 20px;
+}
+
+.cw-notify__container {
+ position: fixed;
+ top: 0;
+ left: 0;
+ box-sizing: border-box;
+ width: 100%;
+}
+
+.cw-notify--primary {
+ background-color: #1989fa;
+}
+
+.cw-notify--success {
+ background-color: #07c160;
+}
+
+.cw-notify--danger {
+ background-color: #ee0a24;
+}
+
+.cw-notify--warning {
+ background-color: #ff976a;
+}
diff --git a/employee-mp/src/components/notify/notify.js b/employee-mp/src/components/notify/notify.js
new file mode 100644
index 0000000..027d1fd
--- /dev/null
+++ b/employee-mp/src/components/notify/notify.js
@@ -0,0 +1,58 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { WHITE } from '../common/color';
+const defaultOptions = {
+ selector: '#cw-notify',
+ type: 'danger',
+ message: '',
+ background: '',
+ duration: 3000,
+ zIndex: 110,
+ top: 0,
+ color: WHITE,
+ customNavBar: false,
+ onClick: () => {},
+ onOpened: () => {},
+ onClose: () => {}
+};
+function parseOptions(message) {
+ if (message == null) {
+ return {};
+ }
+ return typeof message === 'string' ? { message } : message;
+}
+function getContext() {
+ const pages = getCurrentPages();
+ return pages[pages.length - 1];
+}
+export default function Notify(options) {
+ options = Object.assign(Object.assign({}, defaultOptions), parseOptions(options));
+ const context = options.context || getContext();
+ const notify = context.selectComponent(options.selector);
+ delete options.context;
+ delete options.selector;
+ if (notify) {
+ notify.setData(options);
+ notify.show();
+ return notify;
+ }
+ console.warn('未找到 cw-notify 节点,请确认 selector 及 context 是否正确');
+}
+Notify.clear = function(options) {
+ options = Object.assign(Object.assign({}, defaultOptions), parseOptions(options));
+ const context = options.context || getContext();
+ const notify = context.selectComponent(options.selector);
+ if (notify) {
+ notify.hide();
+ }
+};
diff --git a/employee-mp/src/components/overlay/index.js b/employee-mp/src/components/overlay/index.js
new file mode 100644
index 0000000..112443d
--- /dev/null
+++ b/employee-mp/src/components/overlay/index.js
@@ -0,0 +1,34 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+CwComponent({
+ props: {
+ show: Boolean,
+ customStyle: String,
+ duration: {
+ type: null,
+ value: 300
+ },
+ zIndex: {
+ type: Number,
+ value: 1
+ }
+ },
+ methods: {
+ onClick() {
+ this.$emit('click');
+ },
+ // for prevent touchmove
+ noop() {}
+ }
+});
diff --git a/employee-mp/src/components/overlay/index.json b/employee-mp/src/components/overlay/index.json
new file mode 100644
index 0000000..4321f0f
--- /dev/null
+++ b/employee-mp/src/components/overlay/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-transition": "../transition/index"
+ }
+}
diff --git a/employee-mp/src/components/overlay/index.wxml b/employee-mp/src/components/overlay/index.wxml
new file mode 100644
index 0000000..c012ed4
--- /dev/null
+++ b/employee-mp/src/components/overlay/index.wxml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/employee-mp/src/components/overlay/index.wxss b/employee-mp/src/components/overlay/index.wxss
new file mode 100644
index 0000000..a3f0c70
--- /dev/null
+++ b/employee-mp/src/components/overlay/index.wxss
@@ -0,0 +1,10 @@
+@import '../common/index.wxss';
+
+.cw-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background-color: rgba(0, 0, 0, 0.7);
+}
diff --git a/employee-mp/src/components/panel/index.js b/employee-mp/src/components/panel/index.js
new file mode 100644
index 0000000..3f246f3
--- /dev/null
+++ b/employee-mp/src/components/panel/index.js
@@ -0,0 +1,23 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+CwComponent({
+ classes: ['header-class', 'footer-class'],
+ props: {
+ desc: String,
+ title: String,
+ status: String,
+ useFooterSlot: Boolean,
+ clickable: Boolean
+ }
+});
diff --git a/employee-mp/src/components/panel/index.json b/employee-mp/src/components/panel/index.json
new file mode 100644
index 0000000..51e706d
--- /dev/null
+++ b/employee-mp/src/components/panel/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-cell": "../cell/index"
+ }
+}
diff --git a/employee-mp/src/components/panel/index.wxml b/employee-mp/src/components/panel/index.wxml
new file mode 100644
index 0000000..52d7858
--- /dev/null
+++ b/employee-mp/src/components/panel/index.wxml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/panel/index.wxss b/employee-mp/src/components/panel/index.wxss
new file mode 100644
index 0000000..638a2c5
--- /dev/null
+++ b/employee-mp/src/components/panel/index.wxss
@@ -0,0 +1,27 @@
+@import '../common/index.wxss';
+
+.cw-panel {
+ background: #fff;
+}
+
+.cw-panel__header-value {
+ color: #999;
+}
+
+.cw-panel__footer {
+ padding: 8px 16px;
+}
+
+.cw-panel__header:before {
+ content: '';
+ position: absolute;
+ top: 14px;
+ left: 0px;
+ bottom: 14px;
+ width: 4px;
+ background: #1989fa;
+}
+
+.cw-panel__clickable:before {
+ background: #ee0a24;
+}
diff --git a/employee-mp/src/components/picker-column/index.js b/employee-mp/src/components/picker-column/index.js
new file mode 100644
index 0000000..05fe593
--- /dev/null
+++ b/employee-mp/src/components/picker-column/index.js
@@ -0,0 +1,126 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { range } from '../common/utils';
+import { isObj } from '../common/validator';
+const DEFAULT_DURATION = 200;
+CwComponent({
+ classes: ['active-class'],
+ props: {
+ valueKey: String,
+ className: String,
+ itemHeight: Number,
+ visibleItemCount: Number,
+ initialOptions: {
+ type: Array,
+ value: []
+ },
+ defaultIndex: {
+ type: Number,
+ value: 0,
+ observer(value) {
+ this.setIndex(value);
+ }
+ }
+ },
+ data: {
+ startY: 0,
+ offset: 0,
+ duration: 0,
+ startOffset: 0,
+ options: [],
+ currentIndex: 0
+ },
+ created() {
+ const { defaultIndex, initialOptions } = this.data;
+ this.set({
+ currentIndex: defaultIndex,
+ options: initialOptions
+ }).then(() => {
+ this.setIndex(defaultIndex);
+ });
+ },
+ methods: {
+ getCount() {
+ return this.data.options.length;
+ },
+ onTouchStart(event) {
+ this.setData({
+ startY: event.touches[0].clientY,
+ startOffset: this.data.offset,
+ duration: 0
+ });
+ },
+ onTouchMove(event) {
+ const { data } = this;
+ const deltaY = event.touches[0].clientY - data.startY;
+ this.setData({
+ offset: range(data.startOffset + deltaY, -(this.getCount() * data.itemHeight), data.itemHeight)
+ });
+ },
+ onTouchEnd() {
+ const { data } = this;
+ if (data.offset !== data.startOffset) {
+ this.setData({ duration: DEFAULT_DURATION });
+ const index = range(Math.round(-data.offset / data.itemHeight), 0, this.getCount() - 1);
+ this.setIndex(index, true);
+ }
+ },
+ onClickItem(event) {
+ const { index } = event.currentTarget.dataset;
+ this.setIndex(index, true);
+ },
+ adjustIndex(index) {
+ const { data } = this;
+ const count = this.getCount();
+ index = range(index, 0, count);
+ for (let i = index; i < count; i++) {
+ if (!this.isDisabled(data.options[i])) return i;
+ }
+ for (let i = index - 1; i >= 0; i--) {
+ if (!this.isDisabled(data.options[i])) return i;
+ }
+ },
+ isDisabled(option) {
+ return isObj(option) && option.disabled;
+ },
+ getOptionText(option) {
+ const { data } = this;
+ return isObj(option) && data.valueKey in option ? option[data.valueKey] : option;
+ },
+ setIndex(index, userAction) {
+ const { data } = this;
+ index = this.adjustIndex(index) || 0;
+ const offset = -index * data.itemHeight;
+ if (index !== data.currentIndex) {
+ return this.set({ offset, currentIndex: index }).then(() => {
+ userAction && this.$emit('change', index);
+ });
+ }
+ return this.set({ offset });
+ },
+ setValue(value) {
+ const { options } = this.data;
+ for (let i = 0; i < options.length; i++) {
+ if (this.getOptionText(options[i]) === value) {
+ return this.setIndex(i);
+ }
+ }
+ return Promise.resolve();
+ },
+ getValue() {
+ const { data } = this;
+ return data.options[data.currentIndex];
+ }
+ }
+});
diff --git a/employee-mp/src/components/picker-column/index.json b/employee-mp/src/components/picker-column/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/picker-column/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/picker-column/index.wxml b/employee-mp/src/components/picker-column/index.wxml
new file mode 100644
index 0000000..530294d
--- /dev/null
+++ b/employee-mp/src/components/picker-column/index.wxml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ {{ computed.optionText(option, valueKey) }}
+
+
+
diff --git a/employee-mp/src/components/picker-column/index.wxs b/employee-mp/src/components/picker-column/index.wxs
new file mode 100644
index 0000000..2b18f9a
--- /dev/null
+++ b/employee-mp/src/components/picker-column/index.wxs
@@ -0,0 +1,33 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+
+function isObj(x) {
+ var type = typeof x;
+ return x !== null && (type === 'object' || type === 'function');
+}
+
+function optionText(option, valueKey) {
+ return isObj(option) && option[valueKey] != null ? option[valueKey] : option;
+}
+
+function rootStyle(data) {
+ return style({
+ height: addUnit(data.itemHeight * data.visibleItemCount)
+ });
+}
+
+function wrapperStyle(data) {
+ var offset = addUnit(data.offset + (data.itemHeight * (data.visibleItemCount - 1)) / 2);
+
+ return style({
+ transition: 'transform ' + data.duration + 'ms',
+ 'line-height': addUnit(data.itemHeight),
+ transform: 'translate3d(0, ' + offset + ', 0)'
+ });
+}
+
+module.exports = {
+ optionText: optionText,
+ rootStyle: rootStyle,
+ wrapperStyle: wrapperStyle
+};
diff --git a/employee-mp/src/components/picker-column/index.wxss b/employee-mp/src/components/picker-column/index.wxss
new file mode 100644
index 0000000..c3af130
--- /dev/null
+++ b/employee-mp/src/components/picker-column/index.wxss
@@ -0,0 +1,21 @@
+@import '../common/index.wxss';
+
+.cw-picker-column {
+ overflow: hidden;
+ text-align: center;
+ color: #000;
+ font-size: 16px;
+}
+
+.cw-picker-column__item {
+ padding: 0 5px;
+}
+
+.cw-picker-column__item--selected {
+ font-weight: 500;
+ color: #323233;
+}
+
+.cw-picker-column__item--disabled {
+ opacity: 0.3;
+}
diff --git a/employee-mp/src/components/picker/index.js b/employee-mp/src/components/picker/index.js
new file mode 100644
index 0000000..bb001bc
--- /dev/null
+++ b/employee-mp/src/components/picker/index.js
@@ -0,0 +1,151 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { pickerProps } from './shared';
+CwComponent({
+ classes: ['active-class', 'toolbar-class', 'column-class'],
+ props: Object.assign(Object.assign({}, pickerProps), {
+ valueKey: {
+ type: String,
+ value: 'text'
+ },
+ toolbarPosition: {
+ type: String,
+ value: 'top'
+ },
+ defaultIndex: {
+ type: Number,
+ value: 0
+ },
+ columns: {
+ type: Array,
+ value: [],
+ observer(columns = []) {
+ this.simple = columns.length && !columns[0].values;
+ if (Array.isArray(this.children) && this.children.length) {
+ this.setColumns().catch(() => {});
+ }
+ }
+ }
+ }),
+ beforeCreate() {
+ Object.defineProperty(this, 'children', {
+ get: () => this.selectAllComponents('.cw-picker__column') || []
+ });
+ },
+ methods: {
+ noop() {},
+ setColumns() {
+ const { data } = this;
+ const columns = this.simple ? [{ values: data.columns }] : data.columns;
+ const stack = columns.map((column, index) => this.setColumnValues(index, column.values));
+ return Promise.all(stack);
+ },
+ emit(event) {
+ const { type } = event.currentTarget.dataset;
+ if (this.simple) {
+ this.$emit(type, {
+ value: this.getColumnValue(0),
+ index: this.getColumnIndex(0)
+ });
+ } else {
+ this.$emit(type, {
+ value: this.getValues(),
+ index: this.getIndexes()
+ });
+ }
+ },
+ onChange(event) {
+ if (this.simple) {
+ this.$emit('change', {
+ picker: this,
+ value: this.getColumnValue(0),
+ index: this.getColumnIndex(0)
+ });
+ } else {
+ this.$emit('change', {
+ picker: this,
+ value: this.getValues(),
+ index: event.currentTarget.dataset.index
+ });
+ }
+ },
+ // get column instance by index
+ getColumn(index) {
+ return this.children[index];
+ },
+ // get column value by index
+ getColumnValue(index) {
+ const column = this.getColumn(index);
+ return column && column.getValue();
+ },
+ // set column value by index
+ setColumnValue(index, value) {
+ const column = this.getColumn(index);
+ if (column == null) {
+ return Promise.reject(new Error('setColumnValue: 对应列不存在'));
+ }
+ return column.setValue(value);
+ },
+ // get column option index by column index
+ getColumnIndex(columnIndex) {
+ return (this.getColumn(columnIndex) || {}).data.currentIndex;
+ },
+ // set column option index by column index
+ setColumnIndex(columnIndex, optionIndex) {
+ const column = this.getColumn(columnIndex);
+ if (column == null) {
+ return Promise.reject(new Error('setColumnIndex: 对应列不存在'));
+ }
+ return column.setIndex(optionIndex);
+ },
+ // get options of column by index
+ getColumnValues(index) {
+ return (this.children[index] || {}).data.options;
+ },
+ // set options of column by index
+ setColumnValues(index, options, needReset = true) {
+ const column = this.children[index];
+ if (column == null) {
+ return Promise.reject(new Error('setColumnValues: 对应列不存在'));
+ }
+ const isSame = JSON.stringify(column.data.options) === JSON.stringify(options);
+ if (isSame) {
+ return Promise.resolve();
+ }
+ return column.set({ options }).then(() => {
+ if (needReset) {
+ column.setIndex(0);
+ }
+ });
+ },
+ // get values of all columns
+ getValues() {
+ return this.children.map(child => child.getValue());
+ },
+ // set values of all columns
+ setValues(values) {
+ const stack = values.map((value, index) => this.setColumnValue(index, value));
+ return Promise.all(stack);
+ },
+ // get indexes of all columns
+ getIndexes() {
+ return this.children.map(child => child.data.currentIndex);
+ },
+ // set indexes of all columns
+ setIndexes(indexes) {
+ const stack = indexes.map((optionIndex, columnIndex) => this.setColumnIndex(columnIndex, optionIndex));
+ return Promise.all(stack);
+ }
+ }
+});
diff --git a/employee-mp/src/components/picker/index.json b/employee-mp/src/components/picker/index.json
new file mode 100644
index 0000000..f2215b9
--- /dev/null
+++ b/employee-mp/src/components/picker/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "picker-column": "../picker-column/index",
+ "loading": "../loading/index"
+ }
+}
diff --git a/employee-mp/src/components/picker/index.wxml b/employee-mp/src/components/picker/index.wxml
new file mode 100644
index 0000000..9e14ab8
--- /dev/null
+++ b/employee-mp/src/components/picker/index.wxml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/picker/index.wxs b/employee-mp/src/components/picker/index.wxs
new file mode 100644
index 0000000..34ff562
--- /dev/null
+++ b/employee-mp/src/components/picker/index.wxs
@@ -0,0 +1,40 @@
+var style = require('../wxs/style.wxs');
+var addUnit = require('../wxs/add-unit.wxs');
+var array = require('../wxs/array.wxs');
+
+function columnsStyle(data) {
+ return style({
+ height: addUnit(data.itemHeight * data.visibleItemCount)
+ });
+}
+
+function maskStyle(data) {
+ return style({
+ 'background-size': '100% ' + addUnit((data.itemHeight * (data.visibleItemCount - 1)) / 2)
+ });
+}
+
+function frameStyle(data) {
+ return style({
+ height: addUnit(data.itemHeight)
+ });
+}
+
+function columns(columns) {
+ if (!array.isArray(columns)) {
+ return [];
+ }
+
+ if (columns.length && !columns[0].values) {
+ return [{ values: columns }];
+ }
+
+ return columns;
+}
+
+module.exports = {
+ columnsStyle: columnsStyle,
+ frameStyle: frameStyle,
+ maskStyle: maskStyle,
+ columns: columns
+};
diff --git a/employee-mp/src/components/picker/index.wxss b/employee-mp/src/components/picker/index.wxss
new file mode 100644
index 0000000..2229a74
--- /dev/null
+++ b/employee-mp/src/components/picker/index.wxss
@@ -0,0 +1,102 @@
+@import '../common/index.wxss';
+
+.cw-picker {
+ position: relative;
+ overflow: hidden;
+ -webkit-text-size-adjust: 100%;
+ -webkit-user-select: none;
+ user-select: none;
+ background-color: #fff;
+}
+
+.cw-picker__toolbar {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-justify-content: space-between;
+ justify-content: space-between;
+ height: 44px;
+ line-height: 44px;
+}
+
+.cw-picker__cancel,
+.cw-picker__confirm {
+ padding: 0 16px;
+ font-size: 14px;
+}
+
+.cw-picker__cancel--hover,
+.cw-picker__confirm--hover {
+ opacity: 0.7;
+}
+
+.cw-picker__confirm {
+ color: #576b95;
+}
+
+.cw-picker__cancel {
+ color: #969799;
+}
+
+.cw-picker__title {
+ max-width: 50%;
+ text-align: center;
+ font-weight: 500;
+ font-size: 16px;
+}
+
+.cw-picker__columns {
+ position: relative;
+ display: -webkit-flex;
+ display: flex;
+}
+
+.cw-picker__column {
+ -webkit-flex: 1 1;
+ flex: 1 1;
+ width: 0;
+}
+
+.cw-picker__loading {
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ z-index: 4;
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ background-color: hsla(0, 0%, 100%, 0.9);
+}
+
+.cw-picker__mask {
+ top: 0;
+ left: 0;
+ z-index: 2;
+ width: 100%;
+ height: 100%;
+ background-image: linear-gradient(180deg, hsla(0, 0%, 100%, 0.9), hsla(0, 0%, 100%, 0.4)),
+ linear-gradient(0deg, hsla(0, 0%, 100%, 0.9), hsla(0, 0%, 100%, 0.4));
+ background-repeat: no-repeat;
+ background-position: top, bottom;
+ -webkit-backface-visibility: hidden;
+ backface-visibility: hidden;
+}
+
+.cw-picker__frame,
+.cw-picker__mask {
+ position: absolute;
+ pointer-events: none;
+}
+
+.cw-picker__frame {
+ top: 50%;
+ right: 16px;
+ left: 16px;
+ z-index: 1;
+ -webkit-transform: translateY(-50%);
+ transform: translateY(-50%);
+}
diff --git a/employee-mp/src/components/picker/shared.js b/employee-mp/src/components/picker/shared.js
new file mode 100644
index 0000000..e301d5a
--- /dev/null
+++ b/employee-mp/src/components/picker/shared.js
@@ -0,0 +1,33 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+export const pickerProps = {
+ title: String,
+ loading: Boolean,
+ showToolbar: Boolean,
+ cancelButtonText: {
+ type: String,
+ value: '取消'
+ },
+ confirmButtonText: {
+ type: String,
+ value: '确认'
+ },
+ visibleItemCount: {
+ type: Number,
+ value: 6
+ },
+ itemHeight: {
+ type: Number,
+ value: 44
+ }
+};
diff --git a/employee-mp/src/components/picker/toolbar.wxml b/employee-mp/src/components/picker/toolbar.wxml
new file mode 100644
index 0000000..f0761a1
--- /dev/null
+++ b/employee-mp/src/components/picker/toolbar.wxml
@@ -0,0 +1,21 @@
+
+
+ {{ cancelButtonText }}
+
+ {{ title }}
+
+ {{ confirmButtonText }}
+
+
diff --git a/employee-mp/src/components/popup/index.js b/employee-mp/src/components/popup/index.js
new file mode 100644
index 0000000..e38ea5e
--- /dev/null
+++ b/employee-mp/src/components/popup/index.js
@@ -0,0 +1,96 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { transition } from '../mixins/transition';
+CwComponent({
+ classes: [
+ 'enter-class',
+ 'enter-active-class',
+ 'enter-to-class',
+ 'leave-class',
+ 'leave-active-class',
+ 'leave-to-class',
+ 'close-icon-class'
+ ],
+ mixins: [transition(false)],
+ props: {
+ round: Boolean,
+ closeable: Boolean,
+ customStyle: String,
+ overlayStyle: String,
+ transition: {
+ type: String,
+ observer: 'observeClass'
+ },
+ zIndex: {
+ type: Number,
+ value: 100
+ },
+ overlay: {
+ type: Boolean,
+ value: true
+ },
+ closeIcon: {
+ type: String,
+ value: 'cross'
+ },
+ closeIconPosition: {
+ type: String,
+ value: 'top-right'
+ },
+ closeOnClickOverlay: {
+ type: Boolean,
+ value: true
+ },
+ position: {
+ type: String,
+ value: 'center',
+ observer: 'observeClass'
+ },
+ safeAreaInsetBottom: {
+ type: Boolean,
+ value: true
+ },
+ safeAreaInsetTop: {
+ type: Boolean,
+ value: false
+ }
+ },
+ created() {
+ this.observeClass();
+ },
+ methods: {
+ onClickCloseIcon() {
+ this.$emit('close');
+ },
+ onClickOverlay() {
+ this.$emit('click-overlay');
+ if (this.data.closeOnClickOverlay) {
+ this.$emit('close');
+ }
+ },
+ observeClass() {
+ const { transition, position, duration } = this.data;
+ const updateData = {
+ name: transition || position
+ };
+ if (transition === 'none') {
+ updateData.duration = 0;
+ this.originDuration = duration;
+ } else if (this.originDuration != null) {
+ updateData.duration = this.originDuration;
+ }
+ this.setData(updateData);
+ }
+ }
+});
diff --git a/employee-mp/src/components/popup/index.json b/employee-mp/src/components/popup/index.json
new file mode 100644
index 0000000..e107215
--- /dev/null
+++ b/employee-mp/src/components/popup/index.json
@@ -0,0 +1,7 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index",
+ "cw-overlay": "../overlay/index"
+ }
+}
diff --git a/employee-mp/src/components/popup/index.wxml b/employee-mp/src/components/popup/index.wxml
new file mode 100644
index 0000000..1a159ec
--- /dev/null
+++ b/employee-mp/src/components/popup/index.wxml
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/employee-mp/src/components/popup/index.wxs b/employee-mp/src/components/popup/index.wxs
new file mode 100644
index 0000000..d9f1bdb
--- /dev/null
+++ b/employee-mp/src/components/popup/index.wxs
@@ -0,0 +1,17 @@
+var style = require('../wxs/style.wxs');
+
+function popupStyle(data) {
+ return style([
+ {
+ 'z-index': data.zIndex,
+ '-webkit-transition-duration': data.currentDuration + 'ms',
+ 'transition-duration': data.currentDuration + 'ms'
+ },
+ data.display ? null : 'display: none',
+ data.customStyle
+ ]);
+}
+
+module.exports = {
+ popupStyle: popupStyle
+};
diff --git a/employee-mp/src/components/popup/index.wxss b/employee-mp/src/components/popup/index.wxss
new file mode 100644
index 0000000..94cb5ac
--- /dev/null
+++ b/employee-mp/src/components/popup/index.wxss
@@ -0,0 +1,167 @@
+@import '../common/index.wxss';
+
+.cw-popup {
+ position: fixed;
+ box-sizing: border-box;
+ max-height: 100%;
+ overflow-y: auto;
+ transition-timing-function: ease;
+ -webkit-animation: ease both;
+ animation: ease both;
+ -webkit-overflow-scrolling: touch;
+ background-color: #fff;
+}
+
+.cw-popup--center {
+ top: 50%;
+ left: 50%;
+ -webkit-transform: translate3d(-50%, -50%, 0);
+ transform: translate3d(-50%, -50%, 0);
+}
+
+.cw-popup--center.cw-popup--round {
+ border-radius: 16px;
+}
+
+.cw-popup--top {
+ top: 0;
+ left: 0;
+ width: 100%;
+}
+
+.cw-popup--top.cw-popup--round {
+ border-radius: 0 0 16px 16px;
+}
+
+.cw-popup--right {
+ top: 50%;
+ right: 0;
+ -webkit-transform: translate3d(0, -50%, 0);
+ transform: translate3d(0, -50%, 0);
+}
+
+.cw-popup--right.cw-popup--round {
+ border-radius: 16px 0 0 16px;
+}
+
+.cw-popup--bottom {
+ bottom: 0;
+ left: 0;
+ width: 100%;
+}
+
+.cw-popup--bottom.cw-popup--round {
+ border-radius: 16px 16px 0 0;
+}
+
+.cw-popup--left {
+ top: 50%;
+ left: 0;
+ -webkit-transform: translate3d(0, -50%, 0);
+ transform: translate3d(0, -50%, 0);
+}
+
+.cw-popup--left.cw-popup--round {
+ border-radius: 0 16px 16px 0;
+}
+
+.cw-popup--bottom.cw-popup--safe {
+ padding-bottom: env(safe-area-inset-bottom);
+}
+
+.cw-popup--safeTop {
+ padding-top: env(safe-area-inset-top);
+}
+
+.cw-popup__close-icon {
+ position: absolute;
+ z-index: 1;
+ color: #969799;
+ font-size: 18px;
+}
+
+.cw-popup__close-icon--top-left {
+ top: 16px;
+ left: 16px;
+}
+
+.cw-popup__close-icon--top-right {
+ top: 16px;
+ right: 16px;
+}
+
+.cw-popup__close-icon--bottom-left {
+ bottom: 16px;
+ left: 16px;
+}
+
+.cw-popup__close-icon--bottom-right {
+ right: 16px;
+ bottom: 16px;
+}
+
+.cw-popup__close-icon:active {
+ opacity: 0.6;
+}
+
+.cw-scale-enter-active,
+.cw-scale-leave-active {
+ transition-property: opacity, transform;
+}
+
+.cw-scale-enter,
+.cw-scale-leave-to {
+ transform: translate3d(-50%, -50%, 0) scale(0.7);
+ opacity: 0;
+}
+
+.cw-fade-enter-active,
+.cw-fade-leave-active {
+ transition-property: opacity;
+}
+
+.cw-fade-enter,
+.cw-fade-leave-to {
+ opacity: 0;
+}
+
+.cw-center-enter-active,
+.cw-center-leave-active {
+ transition-property: opacity;
+}
+
+.cw-center-enter,
+.cw-center-leave-to {
+ opacity: 0;
+}
+
+.cw-bottom-enter-active,
+.cw-bottom-leave-active,
+.cw-left-enter-active,
+.cw-left-leave-active,
+.cw-right-enter-active,
+.cw-right-leave-active,
+.cw-top-enter-active,
+.cw-top-leave-active {
+ transition-property: transform;
+}
+
+.cw-bottom-enter,
+.cw-bottom-leave-to {
+ transform: translate3d(0, 100%, 0);
+}
+
+.cw-top-enter,
+.cw-top-leave-to {
+ transform: translate3d(0, -100%, 0);
+}
+
+.cw-left-enter,
+.cw-left-leave-to {
+ transform: translate3d(-100%, -50%, 0);
+}
+
+.cw-right-enter,
+.cw-right-leave-to {
+ transform: translate3d(100%, -50%, 0);
+}
diff --git a/employee-mp/src/components/progress/index.js b/employee-mp/src/components/progress/index.js
new file mode 100644
index 0000000..9655ad9
--- /dev/null
+++ b/employee-mp/src/components/progress/index.js
@@ -0,0 +1,62 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { BLUE } from '../common/color';
+import { getRect } from '../common/utils';
+CwComponent({
+ props: {
+ inactive: Boolean,
+ percentage: {
+ type: Number,
+ observer: 'setLeft'
+ },
+ pivotText: String,
+ pivotColor: String,
+ trackColor: String,
+ showPivot: {
+ type: Boolean,
+ value: true
+ },
+ color: {
+ type: String,
+ value: BLUE
+ },
+ textColor: {
+ type: String,
+ value: '#fff'
+ },
+ strokeWidth: {
+ type: null,
+ value: 4
+ }
+ },
+ data: {
+ right: 0
+ },
+ mounted() {
+ this.setLeft();
+ },
+ methods: {
+ setLeft() {
+ Promise.all([getRect(this, '.cw-progress'), getRect(this, '.cw-progress__pivot')]).then(
+ ([portion, pivot]) => {
+ if (portion && pivot) {
+ this.setData({
+ right: (pivot.width * (this.data.percentage - 100)) / 100
+ });
+ }
+ }
+ );
+ }
+ }
+});
diff --git a/employee-mp/src/components/progress/index.json b/employee-mp/src/components/progress/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/progress/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/progress/index.wxml b/employee-mp/src/components/progress/index.wxml
new file mode 100644
index 0000000..afa859a
--- /dev/null
+++ b/employee-mp/src/components/progress/index.wxml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ {{ computed.pivotText(pivotText, percentage) }}
+
+
+
diff --git a/employee-mp/src/components/progress/index.wxs b/employee-mp/src/components/progress/index.wxs
new file mode 100644
index 0000000..32b25c8
--- /dev/null
+++ b/employee-mp/src/components/progress/index.wxs
@@ -0,0 +1,35 @@
+var utils = require('../wxs/utils.wxs');
+var style = require('../wxs/style.wxs');
+
+function pivotText(pivotText, percentage) {
+ return pivotText || percentage + '%';
+}
+
+function rootStyle(data) {
+ return style({
+ height: data.strokeWidth ? utils.addUnit(data.strokeWidth) : '',
+ background: data.trackColor
+ });
+}
+
+function portionStyle(data) {
+ return style({
+ background: data.inactive ? '#cacaca' : data.color,
+ width: data.percentage ? data.percentage + '%' : ''
+ });
+}
+
+function pivotStyle(data) {
+ return style({
+ color: data.textColor,
+ right: data.right + 'px',
+ background: data.pivotColor ? data.pivotColor : data.inactive ? '#cacaca' : data.color
+ });
+}
+
+module.exports = {
+ pivotText: pivotText,
+ rootStyle: rootStyle,
+ portionStyle: portionStyle,
+ pivotStyle: pivotStyle
+};
diff --git a/employee-mp/src/components/progress/index.wxss b/employee-mp/src/components/progress/index.wxss
new file mode 100644
index 0000000..56960cd
--- /dev/null
+++ b/employee-mp/src/components/progress/index.wxss
@@ -0,0 +1,32 @@
+@import '../common/index.wxss';
+
+.cw-progress {
+ position: relative;
+ height: 4px;
+ border-radius: 4px;
+ background: #ebedf0;
+}
+
+.cw-progress__portion {
+ position: absolute;
+ left: 0;
+ height: 100%;
+ border-radius: inherit;
+ background: #1989fa;
+}
+
+.cw-progress__pivot {
+ position: absolute;
+ top: 50%;
+ box-sizing: border-box;
+ min-width: 3.6em;
+ text-align: center;
+ word-break: keep-all;
+ border-radius: 1em;
+ transform: translateY(-50%);
+ color: #fff;
+ padding: 0 5px;
+ font-size: 10px;
+ line-height: 1.6;
+ background-color: #1989fa;
+}
diff --git a/employee-mp/src/components/radio-group/index.js b/employee-mp/src/components/radio-group/index.js
new file mode 100644
index 0000000..2089d24
--- /dev/null
+++ b/employee-mp/src/components/radio-group/index.js
@@ -0,0 +1,44 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { useChildren } from '../common/relation';
+CwComponent({
+ field: true,
+ relation: useChildren('radio', function(target) {
+ this.updateChild(target);
+ }),
+ props: {
+ value: {
+ type: null,
+ observer: 'updateChildren'
+ },
+ direction: String,
+ disabled: {
+ type: Boolean,
+ observer: 'updateChildren'
+ }
+ },
+ methods: {
+ updateChildren() {
+ this.children.forEach(child => this.updateChild(child));
+ },
+ updateChild(child) {
+ const { value, disabled, direction } = this.data;
+ child.setData({
+ value,
+ direction,
+ disabled: disabled || child.data.disabled
+ });
+ }
+ }
+});
diff --git a/employee-mp/src/components/radio-group/index.json b/employee-mp/src/components/radio-group/index.json
new file mode 100644
index 0000000..10e7f9d
--- /dev/null
+++ b/employee-mp/src/components/radio-group/index.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/employee-mp/src/components/radio-group/index.wxml b/employee-mp/src/components/radio-group/index.wxml
new file mode 100644
index 0000000..7f16f62
--- /dev/null
+++ b/employee-mp/src/components/radio-group/index.wxml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/employee-mp/src/components/radio-group/index.wxss b/employee-mp/src/components/radio-group/index.wxss
new file mode 100644
index 0000000..6a698dc
--- /dev/null
+++ b/employee-mp/src/components/radio-group/index.wxss
@@ -0,0 +1,7 @@
+@import '../common/index.wxss';
+.cw-radio-group--horizontal {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ flex-wrap: wrap;
+}
diff --git a/employee-mp/src/components/radio/index.js b/employee-mp/src/components/radio/index.js
new file mode 100644
index 0000000..505f655
--- /dev/null
+++ b/employee-mp/src/components/radio/index.js
@@ -0,0 +1,57 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+import { useParent } from '../common/relation';
+CwComponent({
+ field: true,
+ relation: useParent('radio-group'),
+ classes: ['icon-class', 'label-class'],
+ props: {
+ name: null,
+ value: null,
+ disabled: Boolean,
+ useIconSlot: Boolean,
+ checkedColor: String,
+ labelPosition: {
+ type: String,
+ value: 'right'
+ },
+ labelDisabled: Boolean,
+ shape: {
+ type: String,
+ value: 'round'
+ },
+ iconSize: {
+ type: null,
+ value: 20
+ }
+ },
+ methods: {
+ emitChange(value) {
+ const instance = this.parent || this;
+ instance.$emit('input', value);
+ instance.$emit('change', value);
+ },
+ onChange() {
+ if (!this.data.disabled) {
+ this.emitChange(this.data.name);
+ }
+ },
+ onClickLabel() {
+ const { disabled, labelDisabled, name } = this.data;
+ if (!disabled && !labelDisabled) {
+ this.emitChange(name);
+ }
+ }
+ }
+});
diff --git a/employee-mp/src/components/radio/index.json b/employee-mp/src/components/radio/index.json
new file mode 100644
index 0000000..85e5843
--- /dev/null
+++ b/employee-mp/src/components/radio/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index"
+ }
+}
diff --git a/employee-mp/src/components/radio/index.wxml b/employee-mp/src/components/radio/index.wxml
new file mode 100644
index 0000000..71282b1
--- /dev/null
+++ b/employee-mp/src/components/radio/index.wxml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/radio/index.wxss b/employee-mp/src/components/radio/index.wxss
new file mode 100644
index 0000000..6b8cde3
--- /dev/null
+++ b/employee-mp/src/components/radio/index.wxss
@@ -0,0 +1,77 @@
+@import '../common/index.wxss';
+
+.cw-radio {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ overflow: hidden;
+ -webkit-user-select: none;
+ user-select: none;
+}
+
+.cw-radio__icon-wrap {
+ -webkit-flex: none;
+ flex: none;
+}
+
+.cw-radio--horizontal {
+ margin-right: 12px;
+}
+
+.cw-radio__icon {
+ display: -webkit-flex;
+ display: flex;
+ -webkit-align-items: center;
+ align-items: center;
+ -webkit-justify-content: center;
+ justify-content: center;
+ box-sizing: border-box;
+ width: 1em;
+ height: 1em;
+ color: transparent;
+ text-align: center;
+ transition-property: color, border-color, background-color;
+ border: 1px solid #c8c9cc;
+ font-size: 20px;
+ transition-duration: 0.2s;
+}
+
+.cw-radio__icon--round {
+ border-radius: 100%;
+}
+
+.cw-radio__icon--checked {
+ color: #fff;
+ background-color: #1989fa;
+ border-color: #1989fa;
+}
+
+.cw-radio__icon--disabled {
+ background-color: #ebedf0;
+ border-color: #c8c9cc;
+}
+
+.cw-radio__icon--disabled.cw-radio__icon--checked {
+ color: #c8c9cc;
+}
+
+.cw-radio__label {
+ word-wrap: break-word;
+ margin-left: 10px;
+ color: #323233;
+ line-height: 20px;
+}
+
+.cw-radio__label--left {
+ float: left;
+ margin: 0 10px 0 0;
+}
+
+.cw-radio__label--disabled {
+ color: #c8c9cc;
+}
+
+.cw-radio__label:empty {
+ margin: 0;
+}
diff --git a/employee-mp/src/components/rate/index.js b/employee-mp/src/components/rate/index.js
new file mode 100644
index 0000000..4962af3
--- /dev/null
+++ b/employee-mp/src/components/rate/index.js
@@ -0,0 +1,98 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { getAllRect } from '../common/utils';
+import { CwComponent } from '../common/component';
+import { canIUseModel } from '../common/version';
+CwComponent({
+ field: true,
+ classes: ['icon-class'],
+ props: {
+ value: {
+ type: Number,
+ observer(value) {
+ if (value !== this.data.innerValue) {
+ this.setData({ innerValue: value });
+ }
+ }
+ },
+ readonly: Boolean,
+ disabled: Boolean,
+ allowHalf: Boolean,
+ size: null,
+ icon: {
+ type: String,
+ value: 'star'
+ },
+ voidIcon: {
+ type: String,
+ value: 'star'
+ },
+ color: {
+ type: String,
+ value: '#ffd21e'
+ },
+ voidColor: {
+ type: String,
+ value: '#c7c7c7'
+ },
+ disabledColor: {
+ type: String,
+ value: '#bdbdbd'
+ },
+ count: {
+ type: Number,
+ value: 5,
+ observer(value) {
+ this.setData({ innerCountArray: Array.from({ length: value }) });
+ }
+ },
+ gutter: null,
+ touchable: {
+ type: Boolean,
+ value: true
+ }
+ },
+ data: {
+ innerValue: 0,
+ innerCountArray: Array.from({ length: 5 })
+ },
+ methods: {
+ onSelect(event) {
+ const { data } = this;
+ const { score } = event.currentTarget.dataset;
+ if (!data.disabled && !data.readonly) {
+ this.setData({ innerValue: score + 1 });
+ if (canIUseModel()) {
+ this.setData({ value: score + 1 });
+ }
+ wx.nextTick(() => {
+ this.$emit('input', score + 1);
+ this.$emit('change', score + 1);
+ });
+ }
+ },
+ onTouchMove(event) {
+ const { touchable } = this.data;
+ if (!touchable) return;
+ const { clientX } = event.touches[0];
+ getAllRect(this, '.cw-rate__icon').then(list => {
+ const target = list
+ .sort(item => item.right - item.left)
+ .find(item => clientX >= item.left && clientX <= item.right);
+ if (target != null) {
+ this.onSelect(Object.assign(Object.assign({}, event), { currentTarget: target }));
+ }
+ });
+ }
+ }
+});
diff --git a/employee-mp/src/components/rate/index.json b/employee-mp/src/components/rate/index.json
new file mode 100644
index 0000000..85e5843
--- /dev/null
+++ b/employee-mp/src/components/rate/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "cw-icon": "../icon/index"
+ }
+}
diff --git a/employee-mp/src/components/rate/index.wxml b/employee-mp/src/components/rate/index.wxml
new file mode 100644
index 0000000..d68ba97
--- /dev/null
+++ b/employee-mp/src/components/rate/index.wxml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
diff --git a/employee-mp/src/components/rate/index.wxss b/employee-mp/src/components/rate/index.wxss
new file mode 100644
index 0000000..a9f2143
--- /dev/null
+++ b/employee-mp/src/components/rate/index.wxss
@@ -0,0 +1,27 @@
+@import '../common/index.wxss';
+
+.cw-rate {
+ display: -webkit-inline-flex;
+ display: inline-flex;
+ -webkit-user-select: none;
+ user-select: none;
+}
+
+.cw-rate__item {
+ position: relative;
+ padding: 0 2px;
+}
+
+.cw-rate__icon {
+ display: block;
+ height: 1em;
+ font-size: 20px;
+}
+
+.cw-rate__icon--half {
+ position: absolute;
+ top: 0;
+ width: 0.5em;
+ overflow: hidden;
+ left: 2px;
+}
diff --git a/employee-mp/src/components/rich-text/index.js b/employee-mp/src/components/rich-text/index.js
new file mode 100644
index 0000000..c017891
--- /dev/null
+++ b/employee-mp/src/components/rich-text/index.js
@@ -0,0 +1,106 @@
+/**
+ * +----------------------------------------------------------------------
+ * | 「e家宜业」 —— 助力物业服务升级,用心服务万千业主
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 2020~2021 https://www.chowa.com All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「e家宜业」和「卓瓦科技」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: jixuecong@chowa.cn
+ * +----------------------------------------------------------------------
+ */
+
+import { CwComponent } from '../common/component';
+
+CwComponent({
+ props: {
+ detail: {
+ type: Array,
+ observer(value) {
+ const traveNodes = nodes => {
+ if (!Array.isArray(nodes)) {
+ return [];
+ }
+
+ return nodes.map(item => transferNode(item));
+ };
+
+ const transferNode = node => {
+ if (typeof node === 'string') {
+ if (node.indexOf(' ') > -1 || node.indexOf('
+
+
+
+
+ We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.
+
+
+
+
+