@kyfe/ks-query-table 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.bitmap +38 -0
- package/.editorconfig +5 -0
- package/.env.dev +2 -0
- package/.env.gray +2 -0
- package/.env.prod +2 -0
- package/.env.stg +3 -0
- package/.env.uat +2 -0
- package/.eslintignore +1 -0
- package/.eslintrc.js +25 -0
- package/.gitmodules +4 -0
- package/.prettierrc +11 -0
- package/README.md +15 -0
- package/babel.config.js +10 -0
- package/build-apm.sh +9 -0
- package/build.sh +16 -0
- package/config/index.js +20 -0
- package/jsconfig.json +7 -0
- package/kuasheng-sdk/index.js +80 -0
- package/kuasheng-sdk/lib/assets.js +304 -0
- package/kuasheng-sdk/lib/context.js +199 -0
- package/kuasheng-sdk/lib/layout.js +346 -0
- package/kuasheng-sdk/lib/location.js +46 -0
- package/kuasheng-sdk/lib/media.js +342 -0
- package/kuasheng-sdk/lib/navigation.js +30 -0
- package/kuasheng-sdk/lib/request.js +76 -0
- package/kuasheng-sdk/lib/system.js +190 -0
- package/kuasheng-sdk/lib/userinfo.js +98 -0
- package/kuasheng-sdk/util/check.js +102 -0
- package/kuasheng-sdk/util/config.js +47 -0
- package/kuasheng-sdk/util/device.js +25 -0
- package/kuasheng-sdk/util/error.js +19 -0
- package/kuasheng-sdk/util/funtional.js +153 -0
- package/kuasheng-sdk/util/mixin.js +36 -0
- package/kuasheng-sdk/util/requestUtil.js +41 -0
- package/kuasheng-sdk/util/response.js +33 -0
- package/kuasheng-sdk/util/warn.js +35 -0
- package/kuasheng-ui/CHANGELOG.md +9 -0
- package/kuasheng-ui/components/card.vue +57 -0
- package/kuasheng-ui/components/ks-area-select/README.md +43 -0
- package/kuasheng-ui/components/ks-area-select/area-picker.vue +554 -0
- package/kuasheng-ui/components/ks-area-select/area-search.vue +363 -0
- package/kuasheng-ui/components/ks-area-select/areas-pop.vue +56 -0
- package/kuasheng-ui/components/ks-area-select/common.js +183 -0
- package/kuasheng-ui/components/ks-area-select/index.vue +355 -0
- package/kuasheng-ui/components/ks-area-select/mixins.js +216 -0
- package/kuasheng-ui/components/ks-area-single-select/README.md +50 -0
- package/kuasheng-ui/components/ks-area-single-select/hot-city.js +45 -0
- package/kuasheng-ui/components/ks-area-single-select/index.vue +324 -0
- package/kuasheng-ui/components/ks-calendar/index.vue +269 -0
- package/kuasheng-ui/components/ks-call-phone/call-tips.vue +70 -0
- package/kuasheng-ui/components/ks-call-phone/call.vue +178 -0
- package/kuasheng-ui/components/ks-call-phone/index.js +48 -0
- package/kuasheng-ui/components/ks-call-phone/index.vue +131 -0
- package/kuasheng-ui/components/ks-call-phone//345/221/274/345/217/253/347/273/204/344/273/266.md +0 -0
- package/kuasheng-ui/components/ks-date-picker/README.md +23 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-bottom.vue +123 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-dropdown.vue +80 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-right.vue +87 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-top.vue +88 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker.js +15 -0
- package/kuasheng-ui/components/ks-date-picker/date-range-select.vue +92 -0
- package/kuasheng-ui/components/ks-date-picker/date-select.vue +65 -0
- package/kuasheng-ui/components/ks-date-picker/date-week-month.vue +131 -0
- package/kuasheng-ui/components/ks-date-picker/index.js +12 -0
- package/kuasheng-ui/components/ks-date-picker/mixin.js +92 -0
- package/kuasheng-ui/components/ks-date-picker/month-range-select.vue +129 -0
- package/kuasheng-ui/components/ks-date-picker/month-select.vue +85 -0
- package/kuasheng-ui/components/ks-date-picker/quarter-select.vue +94 -0
- package/kuasheng-ui/components/ks-date-picker/style.less +121 -0
- package/kuasheng-ui/components/ks-date-picker/utils.js +109 -0
- package/kuasheng-ui/components/ks-date-picker/week-select.vue +99 -0
- package/kuasheng-ui/components/ks-decrypt/index.vue +159 -0
- package/kuasheng-ui/components/ks-employee/README.md +78 -0
- package/kuasheng-ui/components/ks-employee/employee-input.vue +173 -0
- package/kuasheng-ui/components/ks-employee/employee-list.vue +662 -0
- package/kuasheng-ui/components/ks-employee/employee-popup.vue +197 -0
- package/kuasheng-ui/components/ks-employee/employee-search.vue +250 -0
- package/kuasheng-ui/components/ks-employee/employee-selected.vue +173 -0
- package/kuasheng-ui/components/ks-employee/index.js +17 -0
- package/kuasheng-ui/components/ks-employee/package-lock.json +5 -0
- package/kuasheng-ui/components/ks-employee/package.json +15 -0
- package/kuasheng-ui/components/ks-employee/yarn.lock +4 -0
- package/kuasheng-ui/components/ks-field-money/index.js +8 -0
- package/kuasheng-ui/components/ks-field-money/index.vue +212 -0
- package/kuasheng-ui/components/ks-field-money/package.json +11 -0
- package/kuasheng-ui/components/ks-field-money/utils.js +65 -0
- package/kuasheng-ui/components/ks-field-money//351/207/221/351/242/235/350/275/254/346/215/242/345/231/250.md +0 -0
- package/kuasheng-ui/components/ks-history-search/history-input.vue +131 -0
- package/kuasheng-ui/components/ks-history-search/history-list.vue +188 -0
- package/kuasheng-ui/components/ks-history-search/img/delete.png +0 -0
- package/kuasheng-ui/components/ks-history-search/index.js +9 -0
- package/kuasheng-ui/components/ks-history-search/index.vue +125 -0
- package/kuasheng-ui/components/ks-history-search/package-lock.json +5 -0
- package/kuasheng-ui/components/ks-history-search/package.json +15 -0
- package/kuasheng-ui/components/ks-history-search/utils.js +35 -0
- package/kuasheng-ui/components/ks-input-search/index.vue +106 -0
- package/kuasheng-ui/components/ks-list/index.vue +75 -0
- package/kuasheng-ui/components/ks-loading/index.js +16 -0
- package/kuasheng-ui/components/ks-month/index.vue +47 -0
- package/kuasheng-ui/components/ks-month/package.json +3 -0
- package/kuasheng-ui/components/ks-month/range.vue +172 -0
- package/kuasheng-ui/components/ks-month/single.vue +136 -0
- package/kuasheng-ui/components/ks-month/style.less +125 -0
- package/kuasheng-ui/components/ks-month/utils.js +35 -0
- package/kuasheng-ui/components/ks-nav/index.vue +264 -0
- package/kuasheng-ui/components/ks-nav-bar.js +35 -0
- package/kuasheng-ui/components/ks-org/ks-org-tree.vue +247 -0
- package/kuasheng-ui/components/ks-org/ks-popup-tree.vue +154 -0
- package/kuasheng-ui/components/ks-org/ks-tree-input.vue +240 -0
- package/kuasheng-ui/components/ks-org/ks-tree-node.vue +94 -0
- package/kuasheng-ui/components/ks-org/ks-tree.vue +229 -0
- package/kuasheng-ui/components/ks-org/utils.js +54 -0
- package/kuasheng-ui/components/ks-popover/index.vue +457 -0
- package/kuasheng-ui/components/ks-popover/mixin.js +28 -0
- package/kuasheng-ui/components/ks-popover/utils.js +60 -0
- package/kuasheng-ui/components/ks-pull-refresh/index.vue +43 -0
- package/kuasheng-ui/components/ks-quarter/index.vue +256 -0
- package/kuasheng-ui/components/ks-table/README.md +103 -0
- package/kuasheng-ui/components/ks-table/cell.vue +31 -0
- package/kuasheng-ui/components/ks-table/index.js +8 -0
- package/kuasheng-ui/components/ks-table/index.less +486 -0
- package/kuasheng-ui/components/ks-table/index.vue +1088 -0
- package/kuasheng-ui/components/ks-table/package.json +12 -0
- package/kuasheng-ui/components/ks-table/release.md +7 -0
- package/kuasheng-ui/components/ks-toast.js +35 -0
- package/kuasheng-ui/components/ks-upload/index.vue +174 -0
- package/kuasheng-ui/components/ks-user-access.vue +229 -0
- package/kuasheng-ui/components/no-data/README.md +45 -0
- package/kuasheng-ui/components/no-data/image.js +1 -0
- package/kuasheng-ui/components/no-data/index.vue +83 -0
- package/kuasheng-ui/components/notice-bar.vue +16 -0
- package/kuasheng-ui/components/steps.js +11 -0
- package/kuasheng-ui/components/tabs.vue +40 -0
- package/kuasheng-ui/index.js +239 -0
- package/kuasheng-ui/patch/datetime-picker/datetimePicker.md +0 -0
- package/kuasheng-ui/patch/datetime-picker/index.js +46 -0
- package/kuasheng-ui/patch/datetime-picker/utils.js +78 -0
- package/kuasheng-ui/patch/field/field.md +1 -0
- package/kuasheng-ui/patch/field/index.js +122 -0
- package/kuasheng-ui/patch/field/utils.js +36 -0
- package/kuasheng-ui/patch/form/form.md +7 -0
- package/kuasheng-ui/patch/form/index.js +106 -0
- package/kuasheng-ui/patch/index.js +12 -0
- package/kuasheng-ui/patch/pagination/index.js +78 -0
- package/kuasheng-ui/style/animation-ui.less +31 -0
- package/kuasheng-ui/style/font/number/font-number1.otf +0 -0
- package/kuasheng-ui/style/font/number/font-number2.ttf +0 -0
- package/kuasheng-ui/style/images/checked.svg +1 -0
- package/kuasheng-ui/style/images/success.svg +1 -0
- package/kuasheng-ui/style/index.less +6 -0
- package/kuasheng-ui/style/kuasheng-ui.less +207 -0
- package/kuasheng-ui/style/reset-vant.less +307 -0
- package/kuasheng-ui/style/vant-var.less +138 -0
- package/kuasheng-ui/utils/apis.js +17 -0
- package/kuasheng-ui/utils/axios-adapter.js +47 -0
- package/kuasheng-ui/utils/bem.js +39 -0
- package/kuasheng-ui/utils/bus.js +97 -0
- package/kuasheng-ui/utils/common.js +88 -0
- package/kuasheng-ui/utils/decrypt/config.js +12 -0
- package/kuasheng-ui/utils/decrypt/decrypt-api.js +139 -0
- package/kuasheng-ui/utils/decrypt/index.js +6 -0
- package/kuasheng-ui/utils/decrypt/mask.js +36 -0
- package/kuasheng-ui/utils/decrypt/virtual.js +44 -0
- package/kuasheng-ui/utils/directive.js +57 -0
- package/kuasheng-ui/utils/directive.md +23 -0
- package/kuasheng-ui/utils/drcheck-plugin.js +219 -0
- package/kuasheng-ui/utils/error-plugin.js +88 -0
- package/kuasheng-ui/utils/filter.js +149 -0
- package/kuasheng-ui/utils/http-interceptors.js +18 -0
- package/kuasheng-ui/utils/http.js +140 -0
- package/kuasheng-ui/utils/index.js +5 -0
- package/kuasheng-ui/utils/init-event.js +20 -0
- package/kuasheng-ui/utils/log.js +309 -0
- package/kuasheng-ui/utils/token.js +9 -0
- package/kuasheng-ui/utils/type.js +45 -0
- package/kuasheng-ui/utils/validate.js +20 -0
- package/kuasheng-ui/utils/watermark.js +67 -0
- package/kuasheng-ui/version.js +1 -0
- package/ky-apm/client.js +37 -0
- package/ky-apm/customHttp.js +38 -0
- package/ky-apm/index.js +68 -0
- package/ky-apm/plugins/performance.js +84 -0
- package/ky-apm/plugins/self-error.js +26 -0
- package/ky-apm/warn-log.js +3 -0
- package/package.json +81 -10
- package/plugin/ks-chii-webpack-html/index.js +53 -0
- package/plugin/ks-chii-webpack-html/package.json +16 -0
- package/postcss.config.js +15 -0
- package/public/capsule-positon.js +50 -0
- package/public/fonts/DingTalkJinBuTi.ttf +0 -0
- package/public/framework/axios@0.19.0.min.js +9 -0
- package/public/framework/fastclick@1.0.6.min.js +1 -0
- package/public/framework/iconfont/iconfont.css +91 -0
- package/public/framework/iconfont/iconfont.js +1 -0
- package/public/framework/iconfont/iconfont.json +142 -0
- package/public/framework/iconfont/iconfont.ttf +0 -0
- package/public/framework/iconfont/iconfont.woff +0 -0
- package/public/framework/iconfont/iconfont.woff2 +0 -0
- package/public/framework/vant@2.5.6.min.js +7 -0
- package/public/framework/vue-router@3.1.3.min.js +6 -0
- package/public/framework/vue@2.6.10.runtime.min.js +6 -0
- package/public/framework/vuex@3.1.1.min.js +6 -0
- package/public/index.html +260 -0
- package/public/ks@3.0.8.umd.min.js +1 -0
- package/public/ksui@4.0.27.umd.min.js +10 -0
- package/public/status-bar-preset.js +39 -0
- package/{index.js → qt-npm/index.js} +3 -3
- package/qt-npm/package.json +13 -0
- package/src/App.vue +204 -0
- package/src/README.md +15 -0
- package/src/common/README.md +94 -0
- package/src/common/http/axios-adapter.js +47 -0
- package/src/common/http/common.js +88 -0
- package/src/common/http/http-interceptors.js +18 -0
- package/src/common/http/http-lock.js +45 -0
- package/src/common/http/index.js +163 -0
- package/src/common/http/token.js +9 -0
- package/src/common/styles/font/AlibabaSans102Ver2-Md.ttf +0 -0
- package/src/common/styles/font.less +12 -0
- package/src/common/styles/variables.less +43 -0
- package/src/common/utils/index.js +1 -0
- package/src/common/utils/platform/README.md +1 -0
- package/src/common/utils/platform/android/.gitkeep +0 -0
- package/src/common/utils/platform/core/index.js +24 -0
- package/src/common/utils/platform/index.js +164 -0
- package/src/common/utils/platform/ios/.gitkeep +0 -0
- package/src/common/utils/platform/subscribe/helper.js +38 -0
- package/src/common/utils/platform/subscribe/index.js +204 -0
- package/src/common/utils/platform/subscribe/table-animation.js +75 -0
- package/src/config/index.js +31 -0
- package/src/config.js +1 -0
- package/src/main.js +73 -0
- package/src/router.js +52 -0
- package/src/view/home/config.js +101 -0
- package/src/view/home/demo1.vue +223 -0
- package/src/view/home/demo2.vue +124 -0
- package/src/view/home/demo3.vue +51 -0
- package/src/view/home/demo4.vue +140 -0
- package/src/view/home/index.vue +97 -0
- package/src/view/home/query-table/README.md +45 -0
- package/src/view/home/query-table/api/index.js +12 -0
- package/src/view/home/query-table/assets/horizontal-back.svg +1 -0
- package/src/view/home/query-table/components/pe-table/cell.js +181 -0
- package/src/view/home/query-table/components/pe-table/collapse.js +334 -0
- package/src/view/home/query-table/components/pe-table/empty.vue +48 -0
- package/src/view/home/query-table/components/pe-table/header.js +328 -0
- package/src/view/home/query-table/components/pe-table/images/abnormal.png +0 -0
- package/src/view/home/query-table/components/pe-table/images/empty.png +0 -0
- package/src/view/home/query-table/components/pe-table/images/fold.svg +1 -0
- package/src/view/home/query-table/components/pe-table/images/sort.svg +1 -0
- package/src/view/home/query-table/components/pe-table/images/sorting.svg +1 -0
- package/src/view/home/query-table/components/pe-table/images/unfold.svg +1 -0
- package/src/view/home/query-table/components/pe-table/index.vue +847 -0
- package/src/view/home/query-table/components/pe-table/load-more.js +46 -0
- package/src/view/home/query-table/components/pe-table/props/index.js +193 -0
- package/src/view/home/query-table/components/pe-table/row.vue +118 -0
- package/src/view/home/query-table/components/pe-table/scrollbar.js +424 -0
- package/src/view/home/query-table/components/pe-table/stretch-damping.js +112 -0
- package/src/view/home/query-table/components/pe-table/style/cell.less +89 -0
- package/src/view/home/query-table/components/pe-table/style/empty.less +48 -0
- package/src/view/home/query-table/components/pe-table/style/header.less +141 -0
- package/src/view/home/query-table/components/pe-table/style/index.less +88 -0
- package/src/view/home/query-table/components/pe-table/style/load-more.less +61 -0
- package/src/view/home/query-table/components/pe-table/style/row.less +6 -0
- package/src/view/home/query-table/components/pe-table/table-loading.vue +120 -0
- package/src/view/home/query-table/components/pe-table/table-total.vue +57 -0
- package/src/view/home/query-table/components/pe-table/utils/animate.js +80 -0
- package/src/view/home/query-table/components/pe-table/utils/columns.js +290 -0
- package/src/view/home/query-table/components/pe-table/utils/data.js +12 -0
- package/src/view/home/query-table/components/pe-table/utils/fixed.js +69 -0
- package/src/view/home/query-table/components/pe-table/utils/formatter.js +327 -0
- package/src/view/home/query-table/components/pe-table/utils/render-cells.js +424 -0
- package/src/view/home/query-table/components/pe-table/utils/slot.js +28 -0
- package/src/view/home/query-table/components/pe-table/utils/tools.js +84 -0
- package/src/view/home/query-table/components/pe-table/utils/touch-scroll.js +417 -0
- package/src/view/home/query-table/components/query-table/index.vue +497 -0
- package/src/view/home/query-table/components/query-table/mixins/column-mixin.js +102 -0
- package/src/view/home/query-table/components/query-table/mixins/column-setting.js +143 -0
- package/src/view/home/query-table/components/query-table/mixins/data-mixin.js +519 -0
- package/src/view/home/query-table/components/query-table/mixins/pagination-mixin.js +26 -0
- package/src/view/home/query-table/components/query-table/mixins/table-fixed.js +130 -0
- package/src/view/home/query-table/components/query-table/mixins/table-horizontal.js +119 -0
- package/src/view/home/query-table/components/table-horizontal.vue +99 -0
- package/src/view/home/query-table/components/table-pagination.vue +32 -0
- package/src/view/home/query-table/components/table-settings/assets/arrpw-up.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/disabled-down.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/disabled-up.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/down.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/up.svg +1 -0
- package/src/view/home/query-table/components/table-settings/index.less +294 -0
- package/src/view/home/query-table/components/table-settings/index.vue +260 -0
- package/src/view/home/query-table/components/table-settings/settings.vue +479 -0
- package/src/view/home/query-table/components/table-settings/test.js +626 -0
- package/src/view/home/query-table/components/table-settings//344/270/252/346/200/247/350/256/276/347/275/256.md +0 -0
- package/src/view/home/query-table/components/tooltip.js +124 -0
- package/src/view/home/query-table/hooks/use-cache-promise.js +27 -0
- package/src/view/home/query-table/hooks/use-column-config.js +190 -0
- package/src/view/home/query-table/hooks/use-encryption.js +0 -0
- package/src/view/home/query-table/hooks/use-generic-search.js +95 -0
- package/src/view/home/query-table/index.js +7 -0
- package/src/view/home/query-table/store/column-store.js +0 -0
- package/src/view/home/query-table/styles/table.less +24 -0
- package/src/view/home/query-table/utils/column.js +36 -0
- package/src/view/home/query-table/utils/config.js +12 -0
- package/src/view/home/query-table/utils/encryption.js +32 -0
- package/src/view/home/query-table/utils/http.js +1 -0
- package/src/view/home/query-table/utils/localStorage.js +35 -0
- package/src/view/home//351/246/226/351/241/265.md +0 -0
- package/src/web.js +99 -0
- package/vue.config.js +131 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 吴焕隆
|
|
3
|
+
* @Date: 2019-09-11 10:25:01
|
|
4
|
+
* @Last Modified by: 吴焕隆
|
|
5
|
+
* @Last Modified time: 2020-03-19 15:09:45
|
|
6
|
+
* 用户信息相关接口
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { KSEXPROT_RPCNAME, KSThrottle_MaxWait, KSThrottle_Option, KSBridgeLogErrorCodes } from '../util/config'
|
|
10
|
+
import { throttle } from '../util/funtional'
|
|
11
|
+
import KsBridgeError from '../util/error'
|
|
12
|
+
|
|
13
|
+
const plugin = {
|
|
14
|
+
moduleName: 'userinfo',
|
|
15
|
+
desc: '用来获取当前登录信息相关方法',
|
|
16
|
+
|
|
17
|
+
// 获取用户信息
|
|
18
|
+
getUserInfo: throttle(() => new Promise((resolve, reject) => {
|
|
19
|
+
window[KSEXPROT_RPCNAME].callFunc({
|
|
20
|
+
method: 'getUserInfo',
|
|
21
|
+
params: {}
|
|
22
|
+
}).then(resp => {
|
|
23
|
+
const { userInfo } = resp
|
|
24
|
+
// 安卓有可能会存在,有userinfo,但是里面的值是空的情况
|
|
25
|
+
if (!userInfo || !userInfo.id) {
|
|
26
|
+
reject(new KsBridgeError(`userInfo为空`, KSBridgeLogErrorCodes.RESULT_ERROR))
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
resolve(resp)
|
|
30
|
+
}).catch(err => {
|
|
31
|
+
reject(err)
|
|
32
|
+
})
|
|
33
|
+
}), KSThrottle_MaxWait, KSThrottle_Option),
|
|
34
|
+
|
|
35
|
+
// 打开聊天页面
|
|
36
|
+
// warn:需要调用员工工号获取userId的方法:iaa.user.getOpenId
|
|
37
|
+
// 暂不可用
|
|
38
|
+
openSession: throttle(({ userId = '' }) => window[KSEXPROT_RPCNAME].callFunc({
|
|
39
|
+
method: 'openSession',
|
|
40
|
+
params: {
|
|
41
|
+
userId
|
|
42
|
+
}
|
|
43
|
+
}), KSThrottle_MaxWait, KSThrottle_Option),
|
|
44
|
+
|
|
45
|
+
// 打开聊天页面
|
|
46
|
+
// warn:需要调用员工工号获取userId的方法:iaa.user.getOpenId
|
|
47
|
+
// 暂不可用
|
|
48
|
+
openTeamSession: throttle(({ tid = '' }) => window[KSEXPROT_RPCNAME].callFunc({
|
|
49
|
+
method: 'openTeamSession',
|
|
50
|
+
params: {
|
|
51
|
+
tid
|
|
52
|
+
}
|
|
53
|
+
}), KSThrottle_MaxWait, KSThrottle_Option),
|
|
54
|
+
|
|
55
|
+
// 打开个人明细页
|
|
56
|
+
// warn:需要调用员工工号获取userId的方法:iaa.user.getOpenId
|
|
57
|
+
openProfile: throttle(({ userId = '' }) => window[KSEXPROT_RPCNAME].callFunc({
|
|
58
|
+
method: 'openProfile',
|
|
59
|
+
params: {
|
|
60
|
+
userId
|
|
61
|
+
}
|
|
62
|
+
}), KSThrottle_MaxWait, KSThrottle_Option),
|
|
63
|
+
|
|
64
|
+
// 选取跨声通讯录
|
|
65
|
+
// 需要:跨声版本 > 2.15
|
|
66
|
+
// selectedEmployees已经选择的成员的openId,逗号链接
|
|
67
|
+
selectEmployee: throttle(({ selectedEmployees = '' }) => new Promise((resolve, reject) => {
|
|
68
|
+
window[KSEXPROT_RPCNAME].callFunc({
|
|
69
|
+
method: 'selectEmployee',
|
|
70
|
+
params: {
|
|
71
|
+
selectedEmployees
|
|
72
|
+
}
|
|
73
|
+
}).then(resp => {
|
|
74
|
+
resolve(resp)
|
|
75
|
+
}).catch(err => {
|
|
76
|
+
reject(err)
|
|
77
|
+
})
|
|
78
|
+
}), KSThrottle_MaxWait, KSThrottle_Option),
|
|
79
|
+
|
|
80
|
+
//搜索最近联系人方法名:searchRecentContact 入参:"keyword":"名字","recentCount":6"
|
|
81
|
+
searchRecentContact: ({ keyword = '', recentCount = 6 }) => new Promise((resolve, reject) => {
|
|
82
|
+
window[KSEXPROT_RPCNAME].callFunc({
|
|
83
|
+
method: 'searchRecentContact',
|
|
84
|
+
params: {
|
|
85
|
+
keyword,
|
|
86
|
+
recentCount
|
|
87
|
+
}
|
|
88
|
+
}).then(resp => {
|
|
89
|
+
resolve(resp)
|
|
90
|
+
}).catch(err => {
|
|
91
|
+
reject(err)
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const install = () => {
|
|
97
|
+
return plugin
|
|
98
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 吴焕隆
|
|
3
|
+
* @Date: 2019-09-11 11:23:41
|
|
4
|
+
* @Last Modified by: 吴焕隆
|
|
5
|
+
* @Last Modified time: 2019-10-28 14:59:40
|
|
6
|
+
* 验证签名
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { throwError, warn, info } from './warn'
|
|
10
|
+
import KsBridgeError from './error'
|
|
11
|
+
import { KSEXPROT_RPCNAME, KSBridgeLogErrorCodes } from './config'
|
|
12
|
+
|
|
13
|
+
// 判断字符串是否为空
|
|
14
|
+
export const isEmptyStr = (str) => {
|
|
15
|
+
if (typeof str == 'string' && str && str.trim().length !== 0) {
|
|
16
|
+
return false
|
|
17
|
+
}
|
|
18
|
+
warn('参数不能为空')
|
|
19
|
+
return true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const isEmptyArray = (array) => {
|
|
23
|
+
if (typeof array == 'object' && array && array.length !== 0) {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
warn('参数不能为空')
|
|
27
|
+
return true
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const isObject = (value) => {
|
|
31
|
+
var type = typeof value;
|
|
32
|
+
return value != null && (type == 'object' || type == 'function');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const isType = (val, type, isCustomType = false) => {
|
|
36
|
+
if (type === 'NaN') {
|
|
37
|
+
return isNaN(val)
|
|
38
|
+
} else if (Object.prototype.toString.call(val) === `[object Object]` && type !== 'Object' && isCustomType) {
|
|
39
|
+
return val instanceof type
|
|
40
|
+
} else {
|
|
41
|
+
return Object.prototype.toString.call(val) === `[object ${type}]`
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const plugin = {
|
|
46
|
+
auth: ({
|
|
47
|
+
moduleId,
|
|
48
|
+
signature,
|
|
49
|
+
nonceStr,
|
|
50
|
+
timestamp,
|
|
51
|
+
jsApi = []
|
|
52
|
+
}) => {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
if (isEmptyStr(moduleId)) {
|
|
55
|
+
const err = new KsBridgeError('moduleId不能为空', KSBridgeLogErrorCodes.PARAMS_IS_NOT_EMPTY)
|
|
56
|
+
throwError(err)
|
|
57
|
+
reject(err)
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (isEmptyStr(signature)) {
|
|
62
|
+
const err = new KsBridgeError('signature不能为空', KSBridgeLogErrorCodes.PARAMS_IS_NOT_EMPTY)
|
|
63
|
+
throwError(err)
|
|
64
|
+
reject(err)
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (isEmptyStr(nonceStr)) {
|
|
69
|
+
const err = new KsBridgeError('nonceStr不能为空', KSBridgeLogErrorCodes.PARAMS_IS_NOT_EMPTY)
|
|
70
|
+
throwError(err)
|
|
71
|
+
reject(err)
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (isEmptyStr(timestamp)) {
|
|
76
|
+
const err = new KsBridgeError('timestamp不能为空', KSBridgeLogErrorCodes.PARAMS_IS_NOT_EMPTY)
|
|
77
|
+
throwError(err)
|
|
78
|
+
reject(err)
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
window[KSEXPROT_RPCNAME].callFunc({
|
|
83
|
+
method: 'auth',
|
|
84
|
+
params: {
|
|
85
|
+
moduleId,
|
|
86
|
+
signature,
|
|
87
|
+
nonceStr,
|
|
88
|
+
timestamp
|
|
89
|
+
}
|
|
90
|
+
}).then(resp => {
|
|
91
|
+
info('签名验证成功')
|
|
92
|
+
resolve(resp)
|
|
93
|
+
}).catch((err) => {
|
|
94
|
+
throwError(err)
|
|
95
|
+
reject(err)
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export const install = () => {
|
|
101
|
+
return plugin
|
|
102
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 吴焕隆
|
|
3
|
+
* @Date: 2019-09-10 17:42:12
|
|
4
|
+
* @Last Modified by: 吴焕隆
|
|
5
|
+
* @Last Modified time: 2020-03-20 15:06:04
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const KSEXPROT_RPCNAME = 'ks'
|
|
9
|
+
|
|
10
|
+
export const KS_BRIDGE = 'ksJsBridge'
|
|
11
|
+
|
|
12
|
+
// jssdk 版本号
|
|
13
|
+
export const KS_BRIDGE_VERSION = '2.0.0'
|
|
14
|
+
|
|
15
|
+
export const KSBridgeLogPrefix = '[ks-jssdk]:'
|
|
16
|
+
|
|
17
|
+
// 模块请求接口节流时间,700毫秒内点击只一次有效
|
|
18
|
+
export const KSThrottle_MaxWait = 700
|
|
19
|
+
export const KSThrottle_Option = {
|
|
20
|
+
leading: true,
|
|
21
|
+
trailing: false
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 自定义的错误码
|
|
25
|
+
export const KSBridgeLogErrorCodes = {
|
|
26
|
+
|
|
27
|
+
CHECK_FAIL: 1000,
|
|
28
|
+
|
|
29
|
+
EVN_NOT_SUPPORT: 5500,
|
|
30
|
+
ENV_NOT_SUPPORT_WEBKIT_OR_WEBKIT_MESSAGEHANDLERS: 5501,
|
|
31
|
+
|
|
32
|
+
IOS_NATIVE_CONTEXT_NOT_FOUND: 1404,
|
|
33
|
+
ANDROID_NATIVE_CONTEXT_NOT_FOUND: 2404,
|
|
34
|
+
|
|
35
|
+
CMD_IS_NOT_AN_OBJ: 4500,
|
|
36
|
+
CMD_IS_CANCEL: 4509,
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
PARSE_REQUEST_ERR: 5000,
|
|
40
|
+
PARSE_RESPONSE_ERR: 5001,
|
|
41
|
+
|
|
42
|
+
PARAMS_IS_TYPE_ERR: 5503,
|
|
43
|
+
PARAMS_IS_NOT_EMPTY: 5504,
|
|
44
|
+
PARSE_ANDROID_RES_ERR: 5505,
|
|
45
|
+
|
|
46
|
+
PARAMS_ERROR: 7000
|
|
47
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 吴焕隆
|
|
3
|
+
* @Date: 2019-10-28 15:05:02
|
|
4
|
+
* @Last Modified by: 吴焕隆
|
|
5
|
+
* @Last Modified time: 2019-10-28 15:05:02
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const ua = navigator.userAgent
|
|
9
|
+
const isAndroid = /(Android);?[\s/]+([\d.]+)?(.*Mobile)/.test(ua)
|
|
10
|
+
const isIpad = /(iPad).*OS\s([\d_]+)/.test(ua)
|
|
11
|
+
const isIpod = /(iPod)(.*OS\s([\d_]+))?/.test(ua)
|
|
12
|
+
const isIphone = !isIpad && /(iPhone\sOS)\s([\d_]+)/.test(ua)
|
|
13
|
+
const isWechat = /micromessenger/i.test(ua)
|
|
14
|
+
const isAlipay = /alipayclient/i.test(ua)
|
|
15
|
+
const isAndroidPad = /^(?!.*Mobile).*(Android);?[\s/]+([\d.]+)?/.test(ua)
|
|
16
|
+
|
|
17
|
+
export default{
|
|
18
|
+
isAndroid,
|
|
19
|
+
isIpad,
|
|
20
|
+
isIpod,
|
|
21
|
+
isIphone,
|
|
22
|
+
isWechat,
|
|
23
|
+
isAlipay,
|
|
24
|
+
isAndroidPad
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 吴焕隆
|
|
3
|
+
* @Date: 2019-09-10 17:19:29
|
|
4
|
+
* @Last Modified by: 吴焕隆
|
|
5
|
+
* @Last Modified time: 2019-10-28 15:04:57
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export default class KsBridgeError extends Error {
|
|
9
|
+
constructor(message, code) {
|
|
10
|
+
super()
|
|
11
|
+
|
|
12
|
+
this.message = message
|
|
13
|
+
// this.stack = (new Error()).stack
|
|
14
|
+
|
|
15
|
+
this.name = this.name
|
|
16
|
+
this.code = code
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 吴焕隆
|
|
3
|
+
* @Date: 2019-10-28 14:52:32
|
|
4
|
+
* @Last Modified by: 吴焕隆
|
|
5
|
+
* @Last Modified time: 2020-04-01 14:42:30
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { isObject } from './check'
|
|
9
|
+
|
|
10
|
+
var nativeMax = Math.max,
|
|
11
|
+
nativeMin = Math.min;
|
|
12
|
+
|
|
13
|
+
export const debounce = (func, wait, options) => {
|
|
14
|
+
var lastArgs,
|
|
15
|
+
lastThis,
|
|
16
|
+
maxWait,
|
|
17
|
+
result,
|
|
18
|
+
timerId,
|
|
19
|
+
lastCallTime,
|
|
20
|
+
lastInvokeTime = 0,
|
|
21
|
+
leading = false,
|
|
22
|
+
maxing = false,
|
|
23
|
+
trailing = true;
|
|
24
|
+
|
|
25
|
+
if (typeof func != 'function') {
|
|
26
|
+
throw new TypeError('FUNC_ERROR_TEXT');
|
|
27
|
+
}
|
|
28
|
+
wait = Number(wait) || 0;
|
|
29
|
+
if (isObject(options)) {
|
|
30
|
+
leading = !!options.leading;
|
|
31
|
+
maxing = 'maxWait' in options;
|
|
32
|
+
maxWait = maxing ? nativeMax(Number(options.maxWait) || 0, wait) : maxWait;
|
|
33
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function invokeFunc(time) {
|
|
37
|
+
var args = lastArgs,
|
|
38
|
+
thisArg = lastThis;
|
|
39
|
+
|
|
40
|
+
lastArgs = lastThis = undefined;
|
|
41
|
+
lastInvokeTime = time;
|
|
42
|
+
result = func.apply(thisArg, args);
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function leadingEdge(time) {
|
|
47
|
+
// Reset any `maxWait` timer.
|
|
48
|
+
lastInvokeTime = time;
|
|
49
|
+
// Start the timer for the trailing edge.
|
|
50
|
+
timerId = setTimeout(timerExpired, wait);
|
|
51
|
+
// Invoke the leading edge.
|
|
52
|
+
return leading ? invokeFunc(time) : result;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function remainingWait(time) {
|
|
56
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
57
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
58
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
59
|
+
|
|
60
|
+
return maxing
|
|
61
|
+
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
62
|
+
: timeWaiting;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function shouldInvoke(time) {
|
|
66
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
67
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
68
|
+
|
|
69
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
70
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
71
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
72
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
73
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function timerExpired() {
|
|
77
|
+
var time = new Date().getTime();
|
|
78
|
+
if (shouldInvoke(time)) {
|
|
79
|
+
return trailingEdge(time);
|
|
80
|
+
}
|
|
81
|
+
// Restart the timer.
|
|
82
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function trailingEdge(time) {
|
|
86
|
+
timerId = undefined;
|
|
87
|
+
|
|
88
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
89
|
+
// debounced at least once.
|
|
90
|
+
if (trailing && lastArgs) {
|
|
91
|
+
return invokeFunc(time);
|
|
92
|
+
}
|
|
93
|
+
lastArgs = lastThis = undefined;
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function cancel() {
|
|
98
|
+
if (timerId !== undefined) {
|
|
99
|
+
clearTimeout(timerId);
|
|
100
|
+
}
|
|
101
|
+
lastInvokeTime = 0;
|
|
102
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function flush() {
|
|
106
|
+
return timerId === undefined ? result : trailingEdge(new Date().getTime());
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function debounced() {
|
|
110
|
+
var time = new Date().getTime(),
|
|
111
|
+
isInvoking = shouldInvoke(time);
|
|
112
|
+
|
|
113
|
+
lastArgs = arguments;
|
|
114
|
+
lastThis = this;
|
|
115
|
+
lastCallTime = time;
|
|
116
|
+
|
|
117
|
+
if (isInvoking) {
|
|
118
|
+
if (timerId === undefined) {
|
|
119
|
+
return leadingEdge(lastCallTime);
|
|
120
|
+
}
|
|
121
|
+
if (maxing) {
|
|
122
|
+
// Handle invocations in a tight loop.
|
|
123
|
+
timerId = setTimeout(timerExpired, wait);
|
|
124
|
+
return invokeFunc(lastCallTime);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (timerId === undefined) {
|
|
128
|
+
timerId = setTimeout(timerExpired, wait);
|
|
129
|
+
}
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
debounced.cancel = cancel;
|
|
133
|
+
debounced.flush = flush;
|
|
134
|
+
return debounced;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export const throttle = (func, wait, options) => {
|
|
138
|
+
var leading = true,
|
|
139
|
+
trailing = true;
|
|
140
|
+
|
|
141
|
+
if (typeof func != 'function') {
|
|
142
|
+
throw new TypeError('FUNC_ERROR_TEXT');
|
|
143
|
+
}
|
|
144
|
+
if (isObject(options)) {
|
|
145
|
+
leading = 'leading' in options ? !!options.leading : leading;
|
|
146
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
147
|
+
}
|
|
148
|
+
return debounce(func, wait, {
|
|
149
|
+
'leading': leading,
|
|
150
|
+
'maxWait': wait,
|
|
151
|
+
'trailing': trailing
|
|
152
|
+
});
|
|
153
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 吴焕隆
|
|
3
|
+
* @Date: 2019-09-11 12:00:10
|
|
4
|
+
* @Last Modified by: 吴焕隆
|
|
5
|
+
* @Last Modified time: 2019-10-28 15:04:53
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { info } from './warn'
|
|
9
|
+
import { KSEXPROT_RPCNAME } from './config'
|
|
10
|
+
|
|
11
|
+
export default class Mixin {
|
|
12
|
+
static merge(plugins) {
|
|
13
|
+
|
|
14
|
+
plugins.forEach((plugin) => {
|
|
15
|
+
let modelName = plugin.modelName
|
|
16
|
+
if (modelName) {
|
|
17
|
+
info(`混合${modelName}模块开始`)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Object.keys(plugin).forEach(function (key) {
|
|
21
|
+
if (['modelName', 'desc', 'moduleId'].indexOf(key) != 0) {
|
|
22
|
+
// console.log(window[KSEXPROT_RPCNAME])
|
|
23
|
+
Object.defineProperty(window[KSEXPROT_RPCNAME], key, {
|
|
24
|
+
enumerable: false,
|
|
25
|
+
configurable: false,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: plugin[key]
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
if (modelName) {
|
|
32
|
+
info(`混合${modelName}模块完成`)
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 把get请求的数据转换为 ${url}?a=1&b=2
|
|
3
|
+
* @param {*} url
|
|
4
|
+
* @param {*} data
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const emulateURL = (url, data) => {
|
|
8
|
+
let paramsArray = []
|
|
9
|
+
|
|
10
|
+
Object.keys(data).forEach(key => paramsArray.push(key + '=' + data[key]))
|
|
11
|
+
|
|
12
|
+
if (url.search(/\?/) === -1) {
|
|
13
|
+
url += '?' + paramsArray.join('&')
|
|
14
|
+
} else {
|
|
15
|
+
url += '&' + paramsArray.join('&')
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const checkRequestCode = (resp) => {
|
|
20
|
+
|
|
21
|
+
if (typeof resp == 'Object') {
|
|
22
|
+
if (resp.code == 0) {
|
|
23
|
+
return {
|
|
24
|
+
...resp,
|
|
25
|
+
isSucc: true
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
...resp,
|
|
31
|
+
isSucc: false
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
code: -1,
|
|
37
|
+
isSucc: false,
|
|
38
|
+
data: undefined,
|
|
39
|
+
msg: resp.msg
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 吴焕隆
|
|
3
|
+
* @Date: 2019-09-11 10:27:57
|
|
4
|
+
* @Last Modified by: 吴焕隆
|
|
5
|
+
* @Last Modified time: 2019-10-24 15:20:18
|
|
6
|
+
* 返回数据协议
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export default class KsResponse {
|
|
10
|
+
constructor({ event, action, code = 0, msg, data = {} }) {
|
|
11
|
+
this.event = event
|
|
12
|
+
this.action = action
|
|
13
|
+
this.code = code
|
|
14
|
+
this.msg = msg
|
|
15
|
+
this.data = data
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static SuccessResponse = {
|
|
19
|
+
event: '',
|
|
20
|
+
action: '',
|
|
21
|
+
code: 0,
|
|
22
|
+
msg: '',
|
|
23
|
+
data: {}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static CancelResponse = {
|
|
27
|
+
event: '',
|
|
28
|
+
action: '',
|
|
29
|
+
code: -1,
|
|
30
|
+
msg: '用户取消操作',
|
|
31
|
+
data: {}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 吴焕隆
|
|
3
|
+
* @Date: 2019-09-10 17:22:48
|
|
4
|
+
* @Last Modified by: 吴焕隆
|
|
5
|
+
* @Last Modified time: 2019-10-28 15:04:43
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { KSEXPROT_RPCNAME, KSBridgeLogPrefix } from './config'
|
|
9
|
+
|
|
10
|
+
// 提示log
|
|
11
|
+
export const info = (message) => {
|
|
12
|
+
if (window[KSEXPROT_RPCNAME]._debug) {
|
|
13
|
+
typeof console !== 'undefined' && console.info(`${KSBridgeLogPrefix} ${message}`)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 警告log
|
|
18
|
+
export const warn = (message) => {
|
|
19
|
+
if (window[KSEXPROT_RPCNAME]._debug) {
|
|
20
|
+
typeof console !== 'undefined' && console.warn(`${KSBridgeLogPrefix} ${message}`)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 像上抛异常,会通过ks.error抛出
|
|
25
|
+
export const throwError = (errMsg, reject) => {
|
|
26
|
+
if (typeof reject == 'function') {
|
|
27
|
+
reject(errMsg)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (reject) {
|
|
31
|
+
window[KSEXPROT_RPCNAME]._errorHander(errMsg)
|
|
32
|
+
} else {
|
|
33
|
+
// warn('jssdk 内部错误,请跨声联系相关人员')
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ksui-card" :class="{'ksui-card__round': round}">
|
|
3
|
+
<div v-if="title !== undefined || $slots.header" class="ksui-card__header">
|
|
4
|
+
<slot v-if="$slots.header" name="header"></slot>
|
|
5
|
+
<h3 v-else>{{title}}</h3>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="ksui-card__body">
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</div>
|
|
10
|
+
<div v-if="$slots.footer" class="ksui-card__footer">
|
|
11
|
+
<slot name="footer"></slot>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
name: 'card',
|
|
19
|
+
props: {
|
|
20
|
+
title: String,
|
|
21
|
+
round: Boolean
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<style lang="less">
|
|
27
|
+
.ksui-card {
|
|
28
|
+
background-color: #fff;
|
|
29
|
+
border: 1px solid #f0f0f0;
|
|
30
|
+
&__round {
|
|
31
|
+
border-radius: 4px;
|
|
32
|
+
box-shadow: 0 1px 3px rgba(0,0,0,.1);
|
|
33
|
+
}
|
|
34
|
+
&__header {
|
|
35
|
+
border-bottom: 1px solid #e5e5e5;
|
|
36
|
+
// margin: 0 16px;
|
|
37
|
+
padding: 12px 16px;
|
|
38
|
+
h3 {
|
|
39
|
+
margin: 0;
|
|
40
|
+
padding: 0;
|
|
41
|
+
line-height: 20px;
|
|
42
|
+
font-size: 16px;
|
|
43
|
+
font-weight: 500;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
&__body {
|
|
47
|
+
padding: 8px 16px;
|
|
48
|
+
}
|
|
49
|
+
&__footer {
|
|
50
|
+
border-top: 1px solid #e5e5e5;
|
|
51
|
+
line-height: 20px;
|
|
52
|
+
// margin: 0 16px;
|
|
53
|
+
padding: 12px 16px;
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
</style>
|