jmash-core-mp 0.1.6 → 0.1.8
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/lib/api/region/index.d.ts +7 -0
- package/lib/api/region/index.js +19 -0
- package/lib/api/region/types.d.ts +19 -0
- package/lib/api/types.d.ts +14 -0
- package/lib/index.d.ts +1 -1
- package/lib/types/core.d.ts +20 -0
- package/package.json +1 -1
- package/src/api/region/index.ts +23 -0
- package/src/api/region/types.ts +36 -0
- package/src/api/types.ts +20 -0
- package/src/components/common/jmash-avatar-edit.mpx +154 -0
- package/src/components/common/jmash-cascader-region.mpx +112 -0
- package/src/components/common/jmash-none-data.mpx +77 -0
- package/src/components/common/jmash-pic-swiper.mpx +72 -0
- package/src/components/common/jmash-popup.mpx +138 -0
- package/src/components/common/jmash-search.mpx +127 -0
- package/src/components/common/jmash-single-btn.mpx +54 -0
- package/src/components/common/jmash-stepper.mpx +214 -0
- package/src/components/common/jmash-textarea.mpx +88 -0
- package/src/components/common/jmash-top-navigation.mpx +200 -0
- package/src/components/common/jmash-upload-picture.mpx +171 -0
- package/src/index.ts +1 -1
- package/src/styles/index.scss +1 -27
- package/src/styles/vars.scss +27 -0
- package/src/types/core.ts +29 -0
- package/lib/components/auth-user/jmash-update-user.web.mpx.d.ts +0 -1
- package/lib/components/auth-user/jmash-user.mpx.d.ts +0 -1
- package/lib/components/core/jmash-login.ali.mpx.d.ts +0 -1
- package/lib/components/core/jmash-login.mpx.d.ts +0 -1
- package/lib/components/core/jmash-login.web.mpx.d.ts +0 -1
- package/src/components/common/auth-search.mpx +0 -31
- /package/lib/{app.mpx.d.ts → api/region/types.js} +0 -0
- /package/lib/{components/auth-user/jmash-update-user.mpx.d.ts → api/types.js} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DictRegionList, DictRegionReq } from "./types";
|
|
2
|
+
import { ResponseData } from "../../types/core";
|
|
3
|
+
declare class RegionApiImpl {
|
|
4
|
+
findList(query?: DictRegionReq): Promise<ResponseData<DictRegionList>>;
|
|
5
|
+
}
|
|
6
|
+
declare const regionApi: RegionApiImpl;
|
|
7
|
+
export { regionApi };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { grpc } from "../../utils/grpc";
|
|
2
|
+
import { config } from "../../utils/config";
|
|
3
|
+
import mpx from "@mpxjs/core";
|
|
4
|
+
class RegionApiImpl {
|
|
5
|
+
// 查询列表信息地区信息
|
|
6
|
+
findList(query) {
|
|
7
|
+
if (query) {
|
|
8
|
+
query.hasEnable = query.enable !== undefined;
|
|
9
|
+
}
|
|
10
|
+
grpc.clearEmpty(query);
|
|
11
|
+
return mpx.xfetch.fetch({
|
|
12
|
+
url: "/v1/region/dict_region/list/" + config.tenant,
|
|
13
|
+
method: "GET",
|
|
14
|
+
data: query,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const regionApi = new RegionApiImpl();
|
|
19
|
+
export { regionApi };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface DictRegionReq {
|
|
2
|
+
tenant?: string;
|
|
3
|
+
hasEnable?: boolean;
|
|
4
|
+
enable?: boolean;
|
|
5
|
+
parentId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DictRegionList {
|
|
8
|
+
results: Array<DictRegionModel>;
|
|
9
|
+
}
|
|
10
|
+
export interface DictRegionModel {
|
|
11
|
+
regionId?: string;
|
|
12
|
+
regionCode?: string;
|
|
13
|
+
regionName?: string;
|
|
14
|
+
text?: string;
|
|
15
|
+
value?: string;
|
|
16
|
+
hasChildren?: boolean;
|
|
17
|
+
regionType?: string;
|
|
18
|
+
children?: Array<DictRegionModel>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface EventBase {
|
|
2
|
+
changedTouches?: any;
|
|
3
|
+
currentTarget: EventTarget;
|
|
4
|
+
target?: EventTarget;
|
|
5
|
+
type?: string;
|
|
6
|
+
detail?: any;
|
|
7
|
+
touches: any;
|
|
8
|
+
}
|
|
9
|
+
export interface EventTarget {
|
|
10
|
+
dataset: any;
|
|
11
|
+
id: string | number;
|
|
12
|
+
offsetLeft?: number;
|
|
13
|
+
offsetTop?: number;
|
|
14
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { AppConfig, ResponseData, ValidateData } from "./types/core";
|
|
1
|
+
export type { AppConfig, ResponseData, ValidateData, EventBase, EventTarget, CanvasResponse } from "./types/core";
|
|
2
2
|
export type { Entry, DictEntryModel } from "./api/dict/types";
|
|
3
3
|
export { EntryDict, EnumDict } from "./api/dicts";
|
|
4
4
|
export { mpxFetch } from "./utils/request";
|
package/lib/types/core.d.ts
CHANGED
|
@@ -19,3 +19,23 @@ export interface ValidateData {
|
|
|
19
19
|
validate: boolean;
|
|
20
20
|
message: string;
|
|
21
21
|
}
|
|
22
|
+
export interface EventBase {
|
|
23
|
+
changedTouches?: any;
|
|
24
|
+
currentTarget: EventTarget;
|
|
25
|
+
target?: EventTarget;
|
|
26
|
+
type?: string;
|
|
27
|
+
detail?: any;
|
|
28
|
+
touches: any;
|
|
29
|
+
}
|
|
30
|
+
export interface EventTarget {
|
|
31
|
+
dataset: any;
|
|
32
|
+
id: string | number;
|
|
33
|
+
offsetLeft?: number;
|
|
34
|
+
offsetTop?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface CanvasResponse {
|
|
37
|
+
width?: number;
|
|
38
|
+
height?: number;
|
|
39
|
+
nodeCanvasType?: string;
|
|
40
|
+
node: any;
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DictRegionList, DictRegionReq } from "./types";
|
|
2
|
+
import { ResponseData } from "../../types/core";
|
|
3
|
+
import { grpc } from "../../utils/grpc";
|
|
4
|
+
import { config } from "../../utils/config";
|
|
5
|
+
import mpx from "@mpxjs/core";
|
|
6
|
+
|
|
7
|
+
class RegionApiImpl {
|
|
8
|
+
// 查询列表信息地区信息
|
|
9
|
+
findList(query?: DictRegionReq): Promise<ResponseData<DictRegionList>> {
|
|
10
|
+
if (query) {
|
|
11
|
+
query.hasEnable = query.enable !== undefined;
|
|
12
|
+
}
|
|
13
|
+
grpc.clearEmpty(query);
|
|
14
|
+
return mpx.xfetch.fetch({
|
|
15
|
+
url: "/v1/region/dict_region/list/" + config.tenant,
|
|
16
|
+
method: "GET",
|
|
17
|
+
data: query,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const regionApi = new RegionApiImpl();
|
|
23
|
+
export { regionApi };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// 地区信息查询
|
|
2
|
+
export interface DictRegionReq {
|
|
3
|
+
// 租户
|
|
4
|
+
tenant?: string;
|
|
5
|
+
// 是否包含状态
|
|
6
|
+
hasEnable?: boolean;
|
|
7
|
+
// 是否启用
|
|
8
|
+
enable?: boolean;
|
|
9
|
+
// 上级ID
|
|
10
|
+
parentId?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// 地区信息列表
|
|
14
|
+
export interface DictRegionList {
|
|
15
|
+
// 当前页内容
|
|
16
|
+
results: Array<DictRegionModel>;
|
|
17
|
+
}
|
|
18
|
+
// 地区信息实体
|
|
19
|
+
export interface DictRegionModel {
|
|
20
|
+
// 地区ID
|
|
21
|
+
regionId?: string;
|
|
22
|
+
// 地区编码
|
|
23
|
+
regionCode?: string;
|
|
24
|
+
// 地区名称
|
|
25
|
+
regionName?: string;
|
|
26
|
+
// 用来构造组件---地区名称
|
|
27
|
+
text?: string;
|
|
28
|
+
// 用来构造组件---地区编码
|
|
29
|
+
value?: string;
|
|
30
|
+
// 是否包含子节点
|
|
31
|
+
hasChildren?: boolean;
|
|
32
|
+
// 地区类型
|
|
33
|
+
regionType?: string;
|
|
34
|
+
// 子节点
|
|
35
|
+
children?: Array<DictRegionModel>;
|
|
36
|
+
}
|
package/src/api/types.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// 事件基础
|
|
2
|
+
export interface EventBase {
|
|
3
|
+
// 在触摸事件中使用,表示触摸点的状态
|
|
4
|
+
changedTouches?: any;
|
|
5
|
+
// 事件绑定的元素
|
|
6
|
+
currentTarget: EventTarget;
|
|
7
|
+
// 指向触发事件的目标节点
|
|
8
|
+
target?: EventTarget;
|
|
9
|
+
// 事件的类型,指示事件的具体类型,如 click, input, blur
|
|
10
|
+
type?: string;
|
|
11
|
+
detail?: any;
|
|
12
|
+
touches: any;
|
|
13
|
+
}
|
|
14
|
+
// 事件绑定的元素
|
|
15
|
+
export interface EventTarget {
|
|
16
|
+
dataset: any;
|
|
17
|
+
id: string | number;
|
|
18
|
+
offsetLeft?: number;
|
|
19
|
+
offsetTop?: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 头像背景盒子 -->
|
|
3
|
+
<button plain class="auth-image-box-bgc" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
|
|
4
|
+
<!-- 显示的头像 -->
|
|
5
|
+
<image class="image-box-show" src="{{ avatar }}" mode="aspectFit" />
|
|
6
|
+
<!-- 提示选择头像图片 -->
|
|
7
|
+
<image class="select-image" src="{{ resourceUrl + 'camera2x.png' }}" mode="aspectFit" />
|
|
8
|
+
</button>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import mpx, { createComponent, ref } from "@mpxjs/core";
|
|
13
|
+
import { config } from "../../utils/config";
|
|
14
|
+
import { fileApi } from "../../api/files/index";
|
|
15
|
+
import { EventBase } from "../../api/types";
|
|
16
|
+
|
|
17
|
+
createComponent({
|
|
18
|
+
properties: {
|
|
19
|
+
// 头像路径 form绑定的这个属性
|
|
20
|
+
value: {
|
|
21
|
+
type: String,
|
|
22
|
+
value: "",
|
|
23
|
+
observer() {
|
|
24
|
+
this.avatar = this.value ? fileApi.imageUrl(this.value, 320, 320, "trans") : this.avatar;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
// logo图片路径-全路径 编辑回显使用
|
|
28
|
+
logoImg: {
|
|
29
|
+
type: String,
|
|
30
|
+
value: "",
|
|
31
|
+
observer() {
|
|
32
|
+
this.avatar = this.logoImg || this.avatar;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
// 是否显示默认logo
|
|
36
|
+
logo: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
value: false,
|
|
39
|
+
observer() {
|
|
40
|
+
this.avatar = this.logo ? this.defaultlogo : this.avatar;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
// 路径的类型,全路径状态为true,相对路径状态为false
|
|
44
|
+
pathType: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
value: false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
setup() {
|
|
50
|
+
let resourceUrl = config.resourceUrl + "/images/icon_image/";
|
|
51
|
+
// 默认头像图片
|
|
52
|
+
let avatar = ref(resourceUrl + "/images/components/gray_head2x.png");
|
|
53
|
+
// 默认logo图片
|
|
54
|
+
let defaultlogo = ref(resourceUrl + "/images/components/gray_logo.png");
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
resourceUrl,
|
|
58
|
+
avatar,
|
|
59
|
+
defaultlogo,
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
lifetimes: {
|
|
63
|
+
attached() {
|
|
64
|
+
if (this.value !== "") {
|
|
65
|
+
this.avatar = this.pathType ? this.value : fileApi.imageUrl(this.value, 320, 320, "trans");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
methods: {
|
|
70
|
+
// 选择头像
|
|
71
|
+
onChooseAvatar(e: EventBase) {
|
|
72
|
+
const { avatarUrl } = e.detail;
|
|
73
|
+
if (!avatarUrl) {
|
|
74
|
+
mpx.showToast({ title: "请选择图片", icon: "none" });
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
mpx.showLoading({ title: "上传中..." });
|
|
79
|
+
|
|
80
|
+
fileApi.uploadFile(avatarUrl).then(res => {
|
|
81
|
+
console.log("上传结果:", res);
|
|
82
|
+
const { fileSrc } = res || {};
|
|
83
|
+
// 检查返回数据
|
|
84
|
+
if (!fileSrc) {
|
|
85
|
+
mpx.showToast({ title: "上传结果异常", icon: "none" });
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 生成图片URL
|
|
90
|
+
const imageUrl = fileApi.imageUrl(fileSrc, 320, 320, "trans");
|
|
91
|
+
console.log("生成的图片URL:", imageUrl);
|
|
92
|
+
|
|
93
|
+
// 更新头像
|
|
94
|
+
this.avatar = imageUrl;
|
|
95
|
+
this.triggerEvent("change", res, {});
|
|
96
|
+
|
|
97
|
+
mpx.showToast({ title: "上传成功", icon: "success" });
|
|
98
|
+
}).catch((err) => {
|
|
99
|
+
console.error("上传失败:", err);
|
|
100
|
+
mpx.showToast({
|
|
101
|
+
title: "图片上传失败",
|
|
102
|
+
icon: "none",
|
|
103
|
+
duration: 2000
|
|
104
|
+
});
|
|
105
|
+
}).finally(() => {
|
|
106
|
+
mpx.hideLoading();
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<style lang="scss">
|
|
114
|
+
@use "../../styles/index.scss" as *;
|
|
115
|
+
|
|
116
|
+
// 头像背景盒子
|
|
117
|
+
.auth-image-box-bgc {
|
|
118
|
+
position: relative;
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
width: 160rpx !important;
|
|
123
|
+
height: 160rpx;
|
|
124
|
+
border: none;
|
|
125
|
+
border-radius: $border-radius;
|
|
126
|
+
padding: 0;
|
|
127
|
+
|
|
128
|
+
// 显示的头像
|
|
129
|
+
.image-box-show {
|
|
130
|
+
width: 160rpx;
|
|
131
|
+
height: 160rpx;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 提示选择头像图片
|
|
135
|
+
.select-image {
|
|
136
|
+
position: absolute;
|
|
137
|
+
width: 48rpx;
|
|
138
|
+
height: 48rpx;
|
|
139
|
+
bottom: 0;
|
|
140
|
+
right: 0;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.image-box-bgc[plain] {
|
|
145
|
+
border: 2rpx solid #e0e0e0;
|
|
146
|
+
}
|
|
147
|
+
</style>
|
|
148
|
+
|
|
149
|
+
<script type="application/json">
|
|
150
|
+
{
|
|
151
|
+
"component": true,
|
|
152
|
+
"usingComponents": {}
|
|
153
|
+
}
|
|
154
|
+
</script>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 地区级联选择弹窗 -->
|
|
3
|
+
<cube-cascade-picker-popup wx:ref="cascadeRegion" title="请选择所在地区" list="{{ regionOption }}"
|
|
4
|
+
bind:cancel="handleRegionClose" bind:confirm="handleConfirm" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { createComponent, ref } from "@mpxjs/core";
|
|
9
|
+
import { EventBase } from "../../api/types";
|
|
10
|
+
import { regionApi } from "../../api/region/index";
|
|
11
|
+
import { DictRegionModel } from "../../api/region/types";
|
|
12
|
+
|
|
13
|
+
createComponent({
|
|
14
|
+
options: {
|
|
15
|
+
styleIsolation: "apply-shared",
|
|
16
|
+
},
|
|
17
|
+
properties: {
|
|
18
|
+
// 是否显示弹框
|
|
19
|
+
show: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
value: false,
|
|
22
|
+
observer() {
|
|
23
|
+
if (this.show) {
|
|
24
|
+
this.$refs.cascadeRegion?.show();
|
|
25
|
+
} else {
|
|
26
|
+
this.$refs.cascadeRegion?.hide();
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
setup() {
|
|
32
|
+
// 地区选项
|
|
33
|
+
let regionOption = ref([] as DictRegionModel[]);
|
|
34
|
+
// 选中的地区值
|
|
35
|
+
let cascaderValue = ref("");
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
regionOption,
|
|
39
|
+
cascaderValue,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
lifetimes: {
|
|
43
|
+
ready() {
|
|
44
|
+
// 初始化加载地区
|
|
45
|
+
this.regionOption.length = 0;
|
|
46
|
+
this.fetchRegionData("");
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
// 关闭弹框
|
|
51
|
+
handleRegionClose() {
|
|
52
|
+
this.$refs.cascadeRegion?.hide();
|
|
53
|
+
this.triggerEvent("close", false);
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
// 确认选择
|
|
57
|
+
handleConfirm(e: EventBase) {
|
|
58
|
+
const selectedOptions = e.detail;
|
|
59
|
+
this.triggerEvent("cascaderValue", selectedOptions.selectedText);
|
|
60
|
+
// 关闭弹框
|
|
61
|
+
this.handleRegionClose();
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
// 异步加载数据
|
|
65
|
+
async fetchRegionData(regionId: string = "") {
|
|
66
|
+
try {
|
|
67
|
+
const res = await regionApi.findList({
|
|
68
|
+
parentId: regionId,
|
|
69
|
+
enable: true,
|
|
70
|
+
});
|
|
71
|
+
// 递归加载并转换子级数据
|
|
72
|
+
const regionData = await Promise.all(
|
|
73
|
+
res.data.results.map(async (item) => {
|
|
74
|
+
const regionItem: Record<string, any> = {
|
|
75
|
+
id: item.regionId,
|
|
76
|
+
text: item.regionName,
|
|
77
|
+
value: item.regionCode,
|
|
78
|
+
hasChildren: item.hasChildren,
|
|
79
|
+
regionType: item.regionType,
|
|
80
|
+
};
|
|
81
|
+
// 如果有子节点且不是最后级别,递归加载
|
|
82
|
+
if (item.hasChildren && item.regionType !== "town") {
|
|
83
|
+
const childrenData = await this.fetchRegionData(item.regionId);
|
|
84
|
+
if (childrenData.length > 0) {
|
|
85
|
+
regionItem.children = childrenData;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return regionItem;
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
if (!regionId) {
|
|
92
|
+
this.regionOption = [...this.regionOption, ...regionData];
|
|
93
|
+
}
|
|
94
|
+
console.log("级联地区数组==>", this.regionOption);
|
|
95
|
+
return regionData;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<script type="application/json">
|
|
105
|
+
{
|
|
106
|
+
"component": true,
|
|
107
|
+
"usingComponents": {
|
|
108
|
+
"cube-cascade-picker": "@mpxjs/mpx-cube-ui/src/components/cascade-picker/index",
|
|
109
|
+
"cube-cascade-picker-popup": "@mpxjs/mpx-cube-ui/src/components/cascade-picker-popup/index"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</script>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="auth-none-data" style="margin-top: {{ marginTop }}rpx; padding-top: {{ paddingTop }}rpx;">
|
|
3
|
+
<image src="{{ resourceUrl + imgUrl }}" mode="heightFix" style="width: {{ imgWidth }};height: {{ imgHeight }};" />
|
|
4
|
+
<view class="holder-text" style="color: {{ contentColor }};">{{ content }}</view>
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { createComponent } from "@mpxjs/core"
|
|
9
|
+
import { config } from "../../utils/config";
|
|
10
|
+
|
|
11
|
+
createComponent({
|
|
12
|
+
properties: {
|
|
13
|
+
// 上外边距
|
|
14
|
+
marginTop: {
|
|
15
|
+
type: Number,
|
|
16
|
+
value: 300
|
|
17
|
+
},
|
|
18
|
+
// 上内边距
|
|
19
|
+
paddingTop: {
|
|
20
|
+
type: Number,
|
|
21
|
+
value: 0
|
|
22
|
+
},
|
|
23
|
+
// 文本内容
|
|
24
|
+
content: {
|
|
25
|
+
type: String,
|
|
26
|
+
value: "暂无数据"
|
|
27
|
+
},
|
|
28
|
+
// 图片的宽
|
|
29
|
+
imgWidth: {
|
|
30
|
+
type: String,
|
|
31
|
+
value: "auto"
|
|
32
|
+
},
|
|
33
|
+
// 图片的高
|
|
34
|
+
imgHeight: {
|
|
35
|
+
type: String,
|
|
36
|
+
value: "125px"
|
|
37
|
+
},
|
|
38
|
+
// 图片的路径
|
|
39
|
+
imgUrl: {
|
|
40
|
+
type: String,
|
|
41
|
+
value: "/components/contacts_nomore2x.png"
|
|
42
|
+
},
|
|
43
|
+
contentColor: {
|
|
44
|
+
type: String,
|
|
45
|
+
value: "#b6b6b6"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
setup() {
|
|
49
|
+
let resourceUrl = config.resourceUrl + "/images/"
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
resourceUrl
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style lang="scss">
|
|
59
|
+
@use "../../styles/index.scss" as *;
|
|
60
|
+
|
|
61
|
+
.auth-none-data {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
|
|
67
|
+
.holder-text {
|
|
68
|
+
font-size: $font-size;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
72
|
+
|
|
73
|
+
<script type="application/json">
|
|
74
|
+
{
|
|
75
|
+
"component": true
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 商品详情-轮播图 -->
|
|
3
|
+
<swiper indicator-dots="{{ true }}" indicator-color="#fff" autoplay="{{ true }}" class="swiper-box"
|
|
4
|
+
style="height: {{ height }}px;">
|
|
5
|
+
<block wx:for="{{ goodsPics }}" wx:key="index">
|
|
6
|
+
<swiper-item>
|
|
7
|
+
<image class="swiper-img" src="{{ imageUrl + item }}" bind:tap="handlePreview" data-url="{{ item }}" />
|
|
8
|
+
</swiper-item>
|
|
9
|
+
</block>
|
|
10
|
+
</swiper>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import mpx, { createComponent, ref } from "@mpxjs/core"
|
|
15
|
+
import { config } from "../../utils/config";
|
|
16
|
+
import { EventBase } from "../../api/types";
|
|
17
|
+
|
|
18
|
+
createComponent({
|
|
19
|
+
setup() {
|
|
20
|
+
// 静态图片资源
|
|
21
|
+
let imageUrl = config.baseUrl + "/v1/file/image/clip/750/750/"
|
|
22
|
+
// 接口资源路径
|
|
23
|
+
let pathUrl = config.baseUrl + "/v1/file/path/"
|
|
24
|
+
// 屏幕高度
|
|
25
|
+
let height = ref(mpx.getWindowInfo().windowWidth)
|
|
26
|
+
return {
|
|
27
|
+
imageUrl,
|
|
28
|
+
pathUrl,
|
|
29
|
+
height
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
properties: {
|
|
33
|
+
// 轮播图数组-商品图
|
|
34
|
+
goodsPics: {
|
|
35
|
+
type: Array,
|
|
36
|
+
value: [] as Array<string>
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
methods: {
|
|
40
|
+
// 查看图片预览
|
|
41
|
+
handlePreview(e: EventBase) {
|
|
42
|
+
const url = e.currentTarget.dataset.url
|
|
43
|
+
const path = this.pathUrl + url
|
|
44
|
+
const pathArr = this.goodsPics.map((item) => {
|
|
45
|
+
return this.pathUrl + item
|
|
46
|
+
})
|
|
47
|
+
mpx.previewImage({
|
|
48
|
+
current: path,
|
|
49
|
+
urls: pathArr
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<style lang="scss">
|
|
57
|
+
.swiper-box {
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.swiper-img {
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 100%;
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
66
|
+
|
|
67
|
+
<script type="application/json">
|
|
68
|
+
{
|
|
69
|
+
"component": true,
|
|
70
|
+
"usingComponents": {}
|
|
71
|
+
}
|
|
72
|
+
</script>
|