@kengic/uni 0.3.4-beta.1 → 0.3.5
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/dist/component/KgTabBar/KgTabBar.vue +81 -0
- package/dist/component/KgTabBar/index.ts +1 -0
- package/dist/component/index.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/service/http-client.ts +2 -2
- package/dist/service/index.ts +0 -63
- package/dist/util/index.ts +1 -1
- package/dist/util/{kg.util.ts → kg.ts} +29 -1
- package/package.json +13 -14
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :id="id" ref="ref01" class="kg-tab-bar">
|
|
3
|
+
<view :class="{ active: page?.route === 'pages/home/index' }" class="item" @tap.stop="goto('pages/home/index')">
|
|
4
|
+
<UniIcons :type="'home'" size="24"></UniIcons>
|
|
5
|
+
<text class="text">首页</text>
|
|
6
|
+
</view>
|
|
7
|
+
|
|
8
|
+
<view :class="{ active: page?.route === 'pages/my/index' }" class="item" @tap.stop="goto('pages/my/index')">
|
|
9
|
+
<UniIcons :type="'person'" size="24"></UniIcons>
|
|
10
|
+
<text class="text">我的</text>
|
|
11
|
+
</view>
|
|
12
|
+
</view>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts" name="KgTabBar" setup>
|
|
16
|
+
import { onMounted, ref } from 'vue';
|
|
17
|
+
import { UniIcons } from '../../uni';
|
|
18
|
+
import { Kg } from '../../util';
|
|
19
|
+
import { v4 as uuid } from 'uuid';
|
|
20
|
+
|
|
21
|
+
const id = uuid();
|
|
22
|
+
|
|
23
|
+
const ref01 = ref(null);
|
|
24
|
+
|
|
25
|
+
onMounted(() => {
|
|
26
|
+
/* #ifdef H5 */
|
|
27
|
+
ref01.value?.$el?.previousElementSibling?.classList?.add('kg-tab-bar-container');
|
|
28
|
+
/* #endif */
|
|
29
|
+
|
|
30
|
+
/* #ifdef APP-PLUS */
|
|
31
|
+
Kg.eval(`document.querySelector('#${id}').previousElementSibling.classList.add('kg-tab-bar-container');`);
|
|
32
|
+
/* #endif */
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const page = Kg.getCurrentPage();
|
|
36
|
+
|
|
37
|
+
function goto(path: string) {
|
|
38
|
+
if (path != 'pages/my/index') {
|
|
39
|
+
uni.redirectTo({ url: '/' + path });
|
|
40
|
+
} else {
|
|
41
|
+
uni.navigateTo({ url: '/' + path });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss" scoped>
|
|
47
|
+
.kg-tab-bar {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: space-around;
|
|
51
|
+
height: 50px;
|
|
52
|
+
background: #fff;
|
|
53
|
+
border-top: 1px solid #e5e5e5;
|
|
54
|
+
position: fixed;
|
|
55
|
+
bottom: 0px;
|
|
56
|
+
left: 0px;
|
|
57
|
+
right: 0px;
|
|
58
|
+
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.kg-tab-bar .item {
|
|
62
|
+
height: 100%;
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
flex: 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.kg-tab-bar .item.active {
|
|
71
|
+
color: #2979ff;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.kg-tab-bar .item.active .uni-icons {
|
|
75
|
+
color: #2979ff !important;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.kg-tab-bar .item .text {
|
|
79
|
+
font-size: 12px;
|
|
80
|
+
}
|
|
81
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as KgTabBar } from './KgTabBar.vue';
|
package/dist/component/index.ts
CHANGED
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
uni-button{border-radius:3px!important}
|
|
1
|
+
uni-button{border-radius:3px!important}.kg-tab-bar-container{padding-bottom:50px!important}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useAppStore } from '../store/app.store';
|
|
2
|
-
import {
|
|
2
|
+
import { Kg } from '../util';
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* 对请求做统一的拦截.
|
|
@@ -23,7 +23,7 @@ uni.addInterceptor('request', {
|
|
|
23
23
|
args.data = keys.map((i) => args.data[i]);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
args.data =
|
|
26
|
+
args.data = Kg.parseParams(args.data);
|
|
27
27
|
},
|
|
28
28
|
success(args) {
|
|
29
29
|
uni.hideLoading();
|
package/dist/service/index.ts
CHANGED
|
@@ -1,64 +1 @@
|
|
|
1
|
-
import { ref, Ref } from 'vue';
|
|
2
|
-
import { v4 as uuid } from 'uuid';
|
|
3
|
-
|
|
4
1
|
export * from './http-client';
|
|
5
|
-
|
|
6
|
-
type IUseKgAutoFocusInput = {
|
|
7
|
-
/** 文本框的内容. */
|
|
8
|
-
text: Ref<string>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 自动聚焦的文本框.
|
|
13
|
-
*/
|
|
14
|
-
function useKgAutoFocusInput(): IUseKgAutoFocusInput {
|
|
15
|
-
const text = ref('');
|
|
16
|
-
|
|
17
|
-
/* #ifdef APP-PLUS */
|
|
18
|
-
const inputID = uuid();
|
|
19
|
-
const view = new plus.nativeObj.View!(uuid(), {
|
|
20
|
-
opacity: 0,
|
|
21
|
-
top: '0px',
|
|
22
|
-
left: '0px',
|
|
23
|
-
height: '1px',
|
|
24
|
-
width: '1px',
|
|
25
|
-
});
|
|
26
|
-
view.drawInput(
|
|
27
|
-
{
|
|
28
|
-
top: '0px',
|
|
29
|
-
left: '0px',
|
|
30
|
-
width: '1px',
|
|
31
|
-
height: '1px',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
fontSize: '0px',
|
|
35
|
-
borderWidth: '0px',
|
|
36
|
-
onBlur() {
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
clearInterval(interval);
|
|
39
|
-
view.close();
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
inputID,
|
|
43
|
-
);
|
|
44
|
-
view.show();
|
|
45
|
-
|
|
46
|
-
uni.onKeyboardHeightChange((result) => {
|
|
47
|
-
if (result.height > 0) {
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
setTimeout(() => {
|
|
50
|
-
view.setInputFocusById(inputID, true);
|
|
51
|
-
}, 100);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// @ts-ignore
|
|
56
|
-
const interval = setInterval(() => {
|
|
57
|
-
text.value = view.getInputValueById(inputID) ?? '';
|
|
58
|
-
}, 10);
|
|
59
|
-
/* #endif */
|
|
60
|
-
|
|
61
|
-
return { text };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { type IUseKgAutoFocusInput, useKgAutoFocusInput };
|
package/dist/util/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './kg
|
|
1
|
+
export * from './kg';
|
|
@@ -5,7 +5,7 @@ import { useKgWarehouse } from '../component';
|
|
|
5
5
|
/**
|
|
6
6
|
* 通用工具.
|
|
7
7
|
*/
|
|
8
|
-
export class
|
|
8
|
+
export class Kg {
|
|
9
9
|
/**
|
|
10
10
|
* 处理请求参数.
|
|
11
11
|
* 1. 填充通用参数的值
|
|
@@ -43,6 +43,34 @@ export class KgUtil {
|
|
|
43
43
|
return resultParams;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* 获取当前页面.
|
|
48
|
+
* @see https://uniapp.dcloud.net.cn/api/window/window.html#getcurrentpages
|
|
49
|
+
*/
|
|
50
|
+
public static getCurrentPage(): Page.PageInstance<AnyObject, AnyObject> | null {
|
|
51
|
+
const pages = getCurrentPages();
|
|
52
|
+
const page = pages[pages.length - 1];
|
|
53
|
+
return page ?? null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 获取当前视图.
|
|
58
|
+
* @see https://uniapp.dcloud.net.cn/api/window/window.html#getappwebview
|
|
59
|
+
*/
|
|
60
|
+
public static getCurrentWebview(): PlusWebviewWebviewObject | null {
|
|
61
|
+
const page = Kg.getCurrentPage();
|
|
62
|
+
return page?.$getAppWebview?.() ?? null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 执行 javascript 代码.
|
|
67
|
+
* @see https://www.html5plus.org/doc/zh_cn/webview.html#plus.webview.WebviewObject.evalJS
|
|
68
|
+
* @param js 要执行的代码.
|
|
69
|
+
*/
|
|
70
|
+
public static eval(js: string): void {
|
|
71
|
+
Kg.getCurrentWebview()?.evalJS(js);
|
|
72
|
+
}
|
|
73
|
+
|
|
46
74
|
/**
|
|
47
75
|
* 处理请求参数: 解析字符串类型的参数值.
|
|
48
76
|
* @param value 参数的原始值.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kengic/uni",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "rimraf dist && vue-tsc && vite build",
|
|
6
6
|
"build:dev": "rimraf dist && vue-tsc && vite build --mode development",
|
|
@@ -8,19 +8,18 @@
|
|
|
8
8
|
"publish:all:patch": "npm run bump-version:patch && npm run publish:all",
|
|
9
9
|
"publish:all:minor": "npm run bump-version:minor && npm run publish:all",
|
|
10
10
|
"publish:all:major": "npm run bump-version:major && npm run publish:all",
|
|
11
|
-
"
|
|
12
|
-
"bump-to:luotao.c.wms-pda": "tsx scripts/bump-to.luotao.c.wms-pda.ts",
|
|
13
|
-
"copy-to:luotao.c.wms-pda": "npm run build:dev && tsx scripts/copy-to.luotao.c.wms-pda.ts",
|
|
14
|
-
"-------------------- D": "",
|
|
15
|
-
"bump-to:luotao.wms-pda": "tsx scripts/bump-to.luotao.wms-pda.ts",
|
|
16
|
-
"copy-to:luotao.wms-pda": "npm run build:dev && tsx scripts/copy-to.luotao.wms-pda.ts",
|
|
17
|
-
"copy-to:luotao.wms-pda--focus": "npm run build:dev && tsx scripts/copy-to.luotao.wms-pda--focus.ts",
|
|
18
|
-
"--------------------": "",
|
|
11
|
+
"------------------------------": "",
|
|
19
12
|
"gen:apis:WMS": "kengic-pont generate-apis --config kg.config.ts --origin WMS",
|
|
20
|
-
"
|
|
21
|
-
"bump-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
13
|
+
"- ----------------------------": "",
|
|
14
|
+
"bump-to:luotao.wms-pda--dev-1.0": "node scripts/bump-to.luotao.wms-pda--dev-1.0.mjs --experimental-default-type=module",
|
|
15
|
+
"copy-to:luotao.wms-pda--dev-1.0": "npm run build:dev && node scripts/copy-to.luotao.wms-pda--dev-1.0.mjs --experimental-default-type=module",
|
|
16
|
+
"copy-to:luotao.wms-pda--focus": "npm run build:dev && node scripts/copy-to.luotao.wms-pda--focus.mjs --experimental-default-type=module",
|
|
17
|
+
"-- ---------------------------": "",
|
|
18
|
+
"cnpm:sync": "cnpm sync @kengic/uni",
|
|
19
|
+
"bump-version:beta": "tsx scripts/bump.mjs beta",
|
|
20
|
+
"bump-version:major": "tsx scripts/bump.mjs major",
|
|
21
|
+
"bump-version:minor": "tsx scripts/bump.mjs minor",
|
|
22
|
+
"bump-version:patch": "tsx scripts/bump.mjs patch",
|
|
24
23
|
"publish:all": "tsx scripts/publish.ts",
|
|
25
24
|
"publish:npm": "npmrc kengic && npm publish ./ --registry https://registry.npmjs.org/ --access public"
|
|
26
25
|
},
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
38
|
"@dcloudio/types": "~3.3.3",
|
|
40
|
-
"@kengic/pont": "~1.2.
|
|
39
|
+
"@kengic/pont": "~1.2.11",
|
|
41
40
|
"@types/lodash-es": "~4.17.7",
|
|
42
41
|
"@types/node": "~18.14.6",
|
|
43
42
|
"@types/semver": "~7.3.13",
|