@hlw-uni/mp-vue 2.1.58 → 2.1.59
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/composables/request/index.d.ts +1 -1
- package/dist/composables/request/service.d.ts +9 -0
- package/dist/index.js +5 -0
- package/dist/index.mjs +5 -0
- package/package.json +2 -2
- package/src/components/hlw-custom/hlw-custom.vue +118 -0
- package/src/composables/request/index.ts +1 -1
- package/src/composables/request/service.ts +8 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useRequest, useUpload } from './client';
|
|
2
|
-
export { BaseService, ServiceNamespace, ServicePrefix } from './service';
|
|
2
|
+
export { BaseService, ServiceNamespace, ServicePrefix, PluginService } from './service';
|
|
3
3
|
export type { RequestClient } from './client';
|
|
4
4
|
export type { ApiResponse, PageResult, RequestConfig, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, UploadConfig, UploadResult, } from './types';
|
|
5
5
|
export type { ServiceNamespaceOptions, ServicePrefixOptions, ServiceRequestConfig } from './service';
|
|
@@ -92,3 +92,12 @@ export declare function ServicePrefix(value: string | ServicePrefixOptions): (ta
|
|
|
92
92
|
servicePrefix?: string;
|
|
93
93
|
};
|
|
94
94
|
}) => void;
|
|
95
|
+
/**
|
|
96
|
+
* 插件服务类装饰器。
|
|
97
|
+
* 自动使用 `import.meta.env.VITE_PLUGIN_NAME` 作为服务前缀。
|
|
98
|
+
*/
|
|
99
|
+
export declare function PluginService(target: {
|
|
100
|
+
prototype: {
|
|
101
|
+
servicePrefix?: string;
|
|
102
|
+
};
|
|
103
|
+
}): void;
|
package/dist/index.js
CHANGED
|
@@ -281,6 +281,7 @@ var __publicField = (obj, key, value) => {
|
|
|
281
281
|
}
|
|
282
282
|
return { uploading, upload };
|
|
283
283
|
}
|
|
284
|
+
var define_import_meta_env_default = {};
|
|
284
285
|
class BaseService {
|
|
285
286
|
/**
|
|
286
287
|
* 发送服务请求。会自动拼接前缀与命名空间。
|
|
@@ -336,6 +337,9 @@ var __publicField = (obj, key, value) => {
|
|
|
336
337
|
target.prototype.servicePrefix = typeof value === "string" ? value : value.prefix;
|
|
337
338
|
};
|
|
338
339
|
}
|
|
340
|
+
function PluginService(target) {
|
|
341
|
+
target.prototype.servicePrefix = define_import_meta_env_default.VITE_PLUGIN_NAME || "";
|
|
342
|
+
}
|
|
339
343
|
function useMsg() {
|
|
340
344
|
function toast(opts) {
|
|
341
345
|
const {
|
|
@@ -1399,6 +1403,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1399
1403
|
exports2.DEFAULT_THEMES = DEFAULT_THEMES;
|
|
1400
1404
|
exports2.FONT_PRESETS = FONT_PRESETS;
|
|
1401
1405
|
exports2.FONT_SCALE_KEY = FONT_SCALE_KEY;
|
|
1406
|
+
exports2.PluginService = PluginService;
|
|
1402
1407
|
exports2.ServiceNamespace = ServiceNamespace;
|
|
1403
1408
|
exports2.ServicePrefix = ServicePrefix;
|
|
1404
1409
|
exports2.THEME_CHANGE_EVENT = THEME_CHANGE_EVENT;
|
package/dist/index.mjs
CHANGED
|
@@ -280,6 +280,7 @@ function useUpload() {
|
|
|
280
280
|
}
|
|
281
281
|
return { uploading, upload };
|
|
282
282
|
}
|
|
283
|
+
var define_import_meta_env_default = {};
|
|
283
284
|
class BaseService {
|
|
284
285
|
/**
|
|
285
286
|
* 发送服务请求。会自动拼接前缀与命名空间。
|
|
@@ -335,6 +336,9 @@ function ServicePrefix(value) {
|
|
|
335
336
|
target.prototype.servicePrefix = typeof value === "string" ? value : value.prefix;
|
|
336
337
|
};
|
|
337
338
|
}
|
|
339
|
+
function PluginService(target) {
|
|
340
|
+
target.prototype.servicePrefix = define_import_meta_env_default.VITE_PLUGIN_NAME || "";
|
|
341
|
+
}
|
|
338
342
|
function useMsg() {
|
|
339
343
|
function toast(opts) {
|
|
340
344
|
const {
|
|
@@ -1399,6 +1403,7 @@ export {
|
|
|
1399
1403
|
DEFAULT_THEMES,
|
|
1400
1404
|
FONT_PRESETS,
|
|
1401
1405
|
FONT_SCALE_KEY,
|
|
1406
|
+
PluginService,
|
|
1402
1407
|
ServiceNamespace,
|
|
1403
1408
|
ServicePrefix,
|
|
1404
1409
|
THEME_CHANGE_EVENT,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hlw-uni/mp-vue",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.59",
|
|
4
4
|
"description": "hlw-uni 小程序运行时 — Vue 组件 + composables + theme + http + 工具集(合并自原 mp-core)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"typescript": "^4.9.5",
|
|
41
41
|
"vite": "5.2.8",
|
|
42
42
|
"vite-plugin-dts": "^4.5.4",
|
|
43
|
-
"vue": "^3.5.
|
|
43
|
+
"vue": "^3.5.34"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"md5": "^2.3.0",
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="contact-card">
|
|
3
|
+
<view class="contact-copy">
|
|
4
|
+
<text class="contact-title">{{ title }}</text>
|
|
5
|
+
<text class="contact-desc">{{ desc }}</text>
|
|
6
|
+
</view>
|
|
7
|
+
<button
|
|
8
|
+
class="contact-button"
|
|
9
|
+
open-type="contact"
|
|
10
|
+
:send-message-title="resolvedContact.title"
|
|
11
|
+
:send-message-path="resolvedContact.path"
|
|
12
|
+
:send-message-img="resolvedContact.img"
|
|
13
|
+
:show-message-card="resolvedContact.show"
|
|
14
|
+
>
|
|
15
|
+
<text class="iconfont icon-service" />
|
|
16
|
+
<text class="contact-button-text">{{ resolvedBtnTitle }}</text>
|
|
17
|
+
</button>
|
|
18
|
+
</view>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { computed } from "vue";
|
|
23
|
+
|
|
24
|
+
interface ContactConfig {
|
|
25
|
+
send_message_title?: string;
|
|
26
|
+
send_message_path?: string;
|
|
27
|
+
send_message_img?: string;
|
|
28
|
+
show_message_card?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const props = withDefaults(
|
|
32
|
+
defineProps<{
|
|
33
|
+
title: string;
|
|
34
|
+
desc: string;
|
|
35
|
+
btn_title?: string;
|
|
36
|
+
contact?: ContactConfig;
|
|
37
|
+
}>(),
|
|
38
|
+
{
|
|
39
|
+
btn_title: "",
|
|
40
|
+
contact: () => ({}),
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const resolvedBtnTitle = computed(() => {
|
|
45
|
+
return props.btn_title || "联系客服";
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const resolvedContact = computed(() => {
|
|
49
|
+
const c = props.contact || {};
|
|
50
|
+
return {
|
|
51
|
+
title: c.send_message_title ?? "",
|
|
52
|
+
path: c.send_message_path ?? "",
|
|
53
|
+
img: c.send_message_img ?? "",
|
|
54
|
+
show: c.show_message_card ?? false,
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<style scoped lang="scss">
|
|
60
|
+
.contact-card {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: space-between;
|
|
64
|
+
padding: var(--card-padding);
|
|
65
|
+
border: 1rpx solid var(--border-color-light);
|
|
66
|
+
border-radius: var(--card-radius);
|
|
67
|
+
background: linear-gradient(135deg, #ffffff 0%, rgba(49, 118, 255, 0.05) 100%);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.contact-copy {
|
|
71
|
+
display: flex;
|
|
72
|
+
min-width: 0;
|
|
73
|
+
flex: 1;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
margin-right: 22rpx;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.contact-title {
|
|
79
|
+
margin-bottom: 8rpx;
|
|
80
|
+
color: #1f2937;
|
|
81
|
+
font-size: var(--font-base);
|
|
82
|
+
line-height: 1.3;
|
|
83
|
+
letter-spacing: 3rpx;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.contact-desc {
|
|
87
|
+
color: #94a3b8;
|
|
88
|
+
font-size: var(--font-sm);
|
|
89
|
+
line-height: 1.45;
|
|
90
|
+
letter-spacing: 3rpx;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.contact-button {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
gap: 10rpx;
|
|
98
|
+
width: 176rpx;
|
|
99
|
+
height: 68rpx;
|
|
100
|
+
flex-shrink: 0;
|
|
101
|
+
margin: 0;
|
|
102
|
+
border-radius: var(--radius-full);
|
|
103
|
+
background: #3176ff;
|
|
104
|
+
color: #ffffff;
|
|
105
|
+
font: inherit;
|
|
106
|
+
line-height: 68rpx;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.contact-button .iconfont {
|
|
110
|
+
font-size: var(--font-sm);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.contact-button-text {
|
|
114
|
+
color: inherit;
|
|
115
|
+
font-size: var(--font-sm);
|
|
116
|
+
line-height: 1;
|
|
117
|
+
}
|
|
118
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useRequest, useUpload } from "./client";
|
|
2
|
-
export { BaseService, ServiceNamespace, ServicePrefix } from "./service";
|
|
2
|
+
export { BaseService, ServiceNamespace, ServicePrefix, PluginService } from "./service";
|
|
3
3
|
export type { RequestClient } from "./client";
|
|
4
4
|
export type {
|
|
5
5
|
ApiResponse,
|
|
@@ -116,3 +116,11 @@ export function ServicePrefix(value: string | ServicePrefixOptions) {
|
|
|
116
116
|
target.prototype.servicePrefix = typeof value === "string" ? value : value.prefix;
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 插件服务类装饰器。
|
|
122
|
+
* 自动使用 `import.meta.env.VITE_PLUGIN_NAME` 作为服务前缀。
|
|
123
|
+
*/
|
|
124
|
+
export function PluginService(target: { prototype: { servicePrefix?: string } }) {
|
|
125
|
+
target.prototype.servicePrefix = import.meta.env.VITE_PLUGIN_NAME || "";
|
|
126
|
+
}
|