jmash-core-mp 0.1.76 → 0.1.78
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/.editorconfig +9 -9
- package/.gitignore +8 -0
- package/.npmignore +44 -0
- package/README.md +60 -60
- package/babel.config.json +34 -34
- package/eslint.config.mjs +7 -7
- package/lib/api/auth/index.d.ts +22 -22
- package/lib/api/auth/index.js +211 -211
- package/lib/api/auth/types.d.ts +90 -90
- package/lib/api/auth/types.js +9 -9
- package/lib/api/cms/index.d.ts +20 -20
- package/lib/api/cms/index.js +161 -161
- package/lib/api/cms/types.d.ts +201 -201
- package/lib/api/cms/types.js +1 -1
- package/lib/api/constant.d.ts +6 -6
- package/lib/api/constant.js +8 -8
- package/lib/api/dict/index.d.ts +24 -24
- package/lib/api/dict/index.js +51 -51
- package/lib/api/dict/types.d.ts +40 -40
- package/lib/api/dict/types.js +1 -1
- package/lib/api/dicts.d.ts +32 -32
- package/lib/api/dicts.js +118 -118
- package/lib/api/files/index.d.ts +25 -25
- package/lib/api/files/index.js +134 -134
- package/lib/api/files/types.d.ts +38 -38
- package/lib/api/files/types.js +1 -1
- package/lib/api/index.d.ts +5 -5
- package/lib/api/index.js +8 -8
- package/lib/api/myorgan/index.d.ts +8 -8
- package/lib/api/myorgan/index.js +24 -24
- package/lib/api/myorgan/types.d.ts +22 -22
- package/lib/api/myorgan/types.js +1 -1
- package/lib/api/region/index.d.ts +7 -7
- package/lib/api/region/index.js +20 -20
- package/lib/api/region/types.d.ts +19 -19
- package/lib/api/region/types.js +1 -1
- package/lib/api/shop/index.d.ts +11 -11
- package/lib/api/shop/index.js +53 -53
- package/lib/api/shop/types.d.ts +123 -123
- package/lib/api/shop/types.js +1 -1
- package/lib/api/storage/index.d.ts +11 -11
- package/lib/api/storage/index.js +53 -53
- package/lib/api/storage/types.d.ts +39 -39
- package/lib/api/storage/types.js +1 -1
- package/lib/api/types.d.ts +43 -43
- package/lib/api/types.js +1 -1
- package/lib/components/organ/browser-organ-list.mpx.d.ts +1 -1
- package/lib/components/organ/my-organ-list.mpx.d.ts +1 -1
- package/lib/components/{auth-user/jmash-update-user.mpx.d.ts → organ/organ-search.mpx.d.ts} +1 -1
- package/lib/components/{auth-user/jmash-user.mpx.d.ts → shop/branch-search.mpx.d.ts} +1 -1
- package/lib/components/{core/jmash-login.mpx.d.ts → shop/shop-search.mpx.d.ts} +1 -1
- package/lib/index.d.ts +28 -28
- package/lib/index.js +23 -23
- package/lib/{packages/pages/auth/setting-page.mpx.d.ts → pages/branch-search.mpx.d.ts} +1 -1
- package/lib/pages/organ-search.mpx.d.ts +1 -0
- package/lib/pages/organ.mpx.d.ts +1 -1
- package/lib/pages/shop-search.mpx.d.ts +1 -0
- package/lib/store/organ.d.ts +19 -19
- package/lib/store/organ.js +83 -83
- package/lib/store/shop.d.ts +18 -18
- package/lib/store/shop.js +104 -104
- package/lib/store/user.d.ts +35 -35
- package/lib/store/user.js +243 -243
- package/lib/utils/common.d.ts +37 -35
- package/lib/utils/common.js +178 -165
- package/lib/utils/config.d.ts +5 -5
- package/lib/utils/config.js +36 -36
- package/lib/utils/db.d.ts +52 -52
- package/lib/utils/db.js +202 -202
- package/lib/utils/grpc.d.ts +5 -5
- package/lib/utils/grpc.js +20 -20
- package/lib/utils/net.d.ts +7 -7
- package/lib/utils/net.js +15 -15
- package/lib/utils/request.d.ts +2 -2
- package/lib/utils/request.js +114 -114
- package/lib/utils/share.d.ts +16 -16
- package/lib/utils/share.js +196 -196
- package/mpx.config.js +38 -38
- package/package.json +1 -1
- package/pnpm-workspace.yaml +5 -0
- package/postcss.config.js +11 -11
- package/project.config.json +24 -24
- package/project.private.config.json +13 -13
- package/public/index.html +15 -15
- package/src/api/auth/index.ts +241 -241
- package/src/api/auth/types.ts +173 -173
- package/src/api/cms/index.ts +218 -218
- package/src/api/cms/types.ts +385 -385
- package/src/api/constant.ts +8 -8
- package/src/api/dict/index.ts +68 -68
- package/src/api/dict/types.ts +73 -73
- package/src/api/dicts.ts +132 -132
- package/src/api/files/index.ts +162 -162
- package/src/api/files/types.ts +67 -67
- package/src/api/index.ts +15 -15
- package/src/api/myorgan/index.ts +29 -29
- package/src/api/myorgan/types.ts +42 -42
- package/src/api/region/index.ts +24 -24
- package/src/api/region/types.ts +36 -36
- package/src/api/shop/index.ts +74 -74
- package/src/api/shop/types.ts +244 -244
- package/src/api/storage/index.ts +74 -74
- package/src/api/storage/types.ts +74 -74
- package/src/api/types.ts +74 -74
- package/src/app.mpx +78 -78
- package/src/components/auth-user/jmash-logout.mpx +93 -93
- package/src/components/auth-user/jmash-update-user.mpx +387 -387
- package/src/components/auth-user/jmash-update-user.web.mpx +367 -367
- package/src/components/auth-user/jmash-user.mpx +310 -310
- package/src/components/cms/jmash-cms-activity-item.mpx +207 -207
- package/src/components/cms/jmash-cms-activity-list.mpx +357 -357
- package/src/components/cms/jmash-cms-article-item.mpx +221 -221
- package/src/components/cms/jmash-cms-article-list.mpx +248 -248
- package/src/components/cms/jmash-cms-article-view.mpx +131 -131
- package/src/components/cms/jmash-cms-article.mpx +231 -231
- package/src/components/cms/jmash-cms-like.mpx +151 -151
- package/src/components/cms/jmash-cms-location-list.mpx +286 -286
- package/src/components/cms/jmash-cms-location.mpx +256 -256
- package/src/components/cms/jmash-cms-product-item.mpx +185 -185
- package/src/components/cms/jmash-cms-product-list.mpx +230 -230
- package/src/components/common/jmash-avatar-edit.mpx +154 -154
- package/src/components/common/jmash-cascader-region.mpx +118 -118
- package/src/components/common/jmash-cell-group.mpx +206 -206
- package/src/components/common/jmash-code-interest-popup.mpx +223 -223
- package/src/components/common/jmash-form-cell.mpx +491 -525
- package/src/components/common/jmash-menu.mpx +129 -129
- package/src/components/common/jmash-none-data.mpx +95 -95
- package/src/components/common/jmash-pic-swiper.mpx +72 -72
- package/src/components/common/jmash-popup.mpx +138 -138
- package/src/components/common/jmash-search.mpx +130 -130
- package/src/components/common/jmash-single-btn.mpx +53 -53
- package/src/components/common/jmash-stepper.mpx +236 -236
- package/src/components/common/jmash-swipe-cell.mpx +153 -153
- package/src/components/common/jmash-tab-bar.mpx +58 -58
- package/src/components/common/jmash-textarea.mpx +88 -88
- package/src/components/common/jmash-top-navigation.mpx +203 -203
- package/src/components/common/jmash-upload-picture.mpx +199 -199
- package/src/components/core/jmash-cms-protocol.mpx +72 -72
- package/src/components/core/jmash-login.ali.mpx +284 -284
- package/src/components/core/jmash-login.mpx +378 -378
- package/src/components/core/jmash-login.web.mpx +420 -420
- package/src/components/core/jmash-popup-login.ali.mpx +312 -312
- package/src/components/core/jmash-popup-login.mpx +414 -416
- package/src/components/core/jmash-popup-login.web.mpx +389 -389
- package/src/components/organ/browser-organ-list.mpx +66 -66
- package/src/components/organ/my-organ-list.mpx +67 -67
- package/src/components/organ/organ-item.mpx +124 -124
- package/src/components/organ/organ-search.mpx +148 -148
- package/src/components/organ/organ-selected-item.mpx +88 -88
- package/src/components/shop/branch-item.mpx +111 -111
- package/src/components/shop/branch-search.mpx +142 -142
- package/src/components/shop/shop-item.mpx +112 -112
- package/src/components/shop/shop-search.mpx +142 -142
- package/src/components/shop/shop-selected-item.mpx +89 -89
- package/src/custom-tab-bar/index.mpx +10 -10
- package/src/global.d.ts +11 -11
- package/src/index.ts +94 -94
- package/src/packages/index.mpx +16 -16
- package/src/packages/pages/auth/cms-protocol.mpx +35 -35
- package/src/packages/pages/auth/login.mpx +62 -62
- package/src/packages/pages/auth/setting-page.mpx +134 -134
- package/src/packages/pages/auth/update-user.mpx +17 -17
- package/src/packages/pages/cms/cms-activity-list.mpx +86 -86
- package/src/packages/pages/cms/cms-article-list.mpx +88 -88
- package/src/packages/pages/cms/cms-article.mpx +32 -32
- package/src/packages/pages/cms/cms-location-list.mpx +83 -83
- package/src/packages/pages/cms/cms-location.mpx +32 -32
- package/src/packages/pages/cms/cms-product-list.mpx +88 -88
- package/src/packages/pages/share/scan.mpx +103 -103
- package/src/pages/basic-component.mpx +30 -30
- package/src/pages/branch-search.mpx +60 -60
- package/src/pages/half-home.mpx +58 -58
- package/src/pages/home.mpx +54 -54
- package/src/pages/home2.mpx +45 -45
- package/src/pages/index.mpx +43 -43
- package/src/pages/organ-search.mpx +60 -60
- package/src/pages/organ.mpx +105 -105
- package/src/pages/shop-search.mpx +60 -60
- package/src/pages/tabbar/home.mpx +114 -114
- package/src/pages/tabbar/mall.mpx +87 -87
- package/src/pages/tabbar/my.mpx +79 -79
- package/src/pages/tabbar/organ.mpx +86 -86
- package/src/store/organ.ts +100 -100
- package/src/store/shop.ts +130 -130
- package/src/store/user.ts +288 -288
- package/src/styles/index.scss +20 -20
- package/src/styles/vars.scss +27 -27
- package/src/utils/common.ts +196 -178
- package/src/utils/config.ts +43 -43
- package/src/utils/db.ts +229 -229
- package/src/utils/grpc.ts +21 -21
- package/src/utils/net.ts +18 -18
- package/src/utils/request.ts +126 -126
- package/src/utils/share.ts +194 -194
- package/static/ali/mini.project.json +4 -4
- package/static/dd/project.config.json +15 -15
- package/static/swan/project.swan.json +14 -14
- package/static/tt/project.config.json +11 -11
- package/static/wx/project.config.json +40 -40
- package/uno.config.js +9 -9
- package/lib/packages/pages/share/scan.mpx.d.ts +0 -1
|
@@ -1,199 +1,199 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 上传图片组件 -->
|
|
3
|
-
<view class="upload-picture-box">
|
|
4
|
-
<block wx:for="{{ imageArray }}" wx:key="index">
|
|
5
|
-
<view class="image_box">
|
|
6
|
-
<image wx:if="{{ baseUrl }}" class="upload_image" src="{{ baseUrl + item }}" />
|
|
7
|
-
<image wx:if="{{ resourceUrl }}" class="del_image" src="{{ resourceUrl + 'file_del_icon.png' }}" mode="widthFix"
|
|
8
|
-
data-index="{{ index }}" bind:tap="handleDel" />
|
|
9
|
-
</view>
|
|
10
|
-
</block>
|
|
11
|
-
<view wx:if="{{ imageArray.length < limit }}" class="upload-box" bind:tap="handleUploadImage">
|
|
12
|
-
<image wx:if="{{ resourceUrl }}" class="upload-icon" src="{{ resourceUrl + 'upload_icon.png' }}"
|
|
13
|
-
mode="widthFix" />
|
|
14
|
-
<text>添加图片</text>
|
|
15
|
-
</view>
|
|
16
|
-
</view>
|
|
17
|
-
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script lang="ts">
|
|
21
|
-
import mpx, { createComponent, ref, watch } from "@mpxjs/core";
|
|
22
|
-
import { EventBase } from "../../api/types";
|
|
23
|
-
import { db } from "../../utils/db";
|
|
24
|
-
|
|
25
|
-
createComponent({
|
|
26
|
-
options: {
|
|
27
|
-
styleIsolation: "apply-shared",
|
|
28
|
-
},
|
|
29
|
-
properties: {
|
|
30
|
-
// 上传图片数量限制
|
|
31
|
-
limit: {
|
|
32
|
-
type: Number,
|
|
33
|
-
value: 6
|
|
34
|
-
},
|
|
35
|
-
// 回显图片(字符串或数组)
|
|
36
|
-
value: {
|
|
37
|
-
type: null,
|
|
38
|
-
value: ""
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
setup(props) {
|
|
42
|
-
let config = getApp().globalData.config;
|
|
43
|
-
// 资源路径
|
|
44
|
-
let resourceUrl = config.resourceUrl + "/images/mall/";
|
|
45
|
-
// 图片路径
|
|
46
|
-
let baseUrl = config.baseUrl + "/v1/file/image/clip/100/100/";
|
|
47
|
-
// 上传图片数组
|
|
48
|
-
let imageArray = ref([] as Array<string>);
|
|
49
|
-
|
|
50
|
-
// 回显已有图片(value 支持字符串或数组)
|
|
51
|
-
watch(() => props.value, (val) => {
|
|
52
|
-
if (Array.isArray(val)) {
|
|
53
|
-
imageArray.value = val;
|
|
54
|
-
} else if (val) {
|
|
55
|
-
imageArray.value = [val];
|
|
56
|
-
} else {
|
|
57
|
-
imageArray.value = [];
|
|
58
|
-
}
|
|
59
|
-
}, { immediate: true });
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
resourceUrl,
|
|
63
|
-
baseUrl,
|
|
64
|
-
imageArray,
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
methods: {
|
|
68
|
-
handleUploadImage() {
|
|
69
|
-
if (this.imageArray.length > this.limit - 1) {
|
|
70
|
-
mpx.showToast({
|
|
71
|
-
title: "图片最多上传" + this.limit + "张",
|
|
72
|
-
icon: "none",
|
|
73
|
-
duration: 2000
|
|
74
|
-
});
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
mpx.showActionSheet({
|
|
78
|
-
itemList: ["从相册中选择", "拍照"],
|
|
79
|
-
itemColor: "#486aff",
|
|
80
|
-
success: (res) => {
|
|
81
|
-
if (res.tapIndex === 0) {
|
|
82
|
-
this.chooseWxHeadImage("album");
|
|
83
|
-
} else if (res.tapIndex === 1) {
|
|
84
|
-
this.chooseWxHeadImage("camera");
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
chooseWxHeadImage: function (type: any) {
|
|
90
|
-
let config = getApp().globalData.config;
|
|
91
|
-
const expire = db.isTokenExpires();
|
|
92
|
-
const token: string = (!expire && db.getToken()) ? "Bearer " + db.getToken() : "";
|
|
93
|
-
mpx.chooseMedia({
|
|
94
|
-
count: this.limit,
|
|
95
|
-
mediaType: ['image'],
|
|
96
|
-
sizeType: ["original", "compressed"],
|
|
97
|
-
sourceType: [type],
|
|
98
|
-
success: (res) => {
|
|
99
|
-
console.log('chooseImage success, temp path is', res)
|
|
100
|
-
const files = res.tempFiles || [];
|
|
101
|
-
// 逐个上传
|
|
102
|
-
files.forEach((file: any) => {
|
|
103
|
-
mpx.uploadFile({
|
|
104
|
-
url: config.baseUrl + "/v1/file/upload?tenant=" + config.tenant,
|
|
105
|
-
filePath: file.tempFilePath,
|
|
106
|
-
header: {
|
|
107
|
-
"Content-Type": "multipart/form-data",
|
|
108
|
-
"Authorization": token
|
|
109
|
-
},
|
|
110
|
-
formData: {
|
|
111
|
-
method: "POST",
|
|
112
|
-
},
|
|
113
|
-
name: "file",
|
|
114
|
-
success: (response) => {
|
|
115
|
-
console.log(response);
|
|
116
|
-
if (response.statusCode === 200) {
|
|
117
|
-
const src = JSON.parse(response.data).fileSrc;
|
|
118
|
-
this.imageArray.push(src);
|
|
119
|
-
this.triggerEvent("getImageArray", this.imageArray);
|
|
120
|
-
} else {
|
|
121
|
-
mpx.showToast({
|
|
122
|
-
title: "图片上传失败",
|
|
123
|
-
icon: "none",
|
|
124
|
-
duration: 2000
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
})
|
|
132
|
-
},
|
|
133
|
-
// 删除图片
|
|
134
|
-
handleDel(e: EventBase) {
|
|
135
|
-
this.imageArray.splice(e.currentTarget.dataset.index, 1);
|
|
136
|
-
// 使用this.triggerEvent传索引值给页面
|
|
137
|
-
this.triggerEvent("getImageArray", this.imageArray);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
})
|
|
141
|
-
</script>
|
|
142
|
-
|
|
143
|
-
<style lang="scss">
|
|
144
|
-
.upload-picture-box {
|
|
145
|
-
display: flex;
|
|
146
|
-
align-items: center;
|
|
147
|
-
flex-wrap: wrap;
|
|
148
|
-
gap: 20rpx;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.upload_image {
|
|
152
|
-
width: 196rpx;
|
|
153
|
-
height: 196rpx;
|
|
154
|
-
vertical-align: top;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.upload-box {
|
|
158
|
-
border: 2rpx dashed #dddddd;
|
|
159
|
-
font-size: 24rpx;
|
|
160
|
-
display: flex;
|
|
161
|
-
flex-direction: column;
|
|
162
|
-
width: 196rpx;
|
|
163
|
-
height: 196rpx;
|
|
164
|
-
justify-content: center;
|
|
165
|
-
align-items: center;
|
|
166
|
-
// flex: 0 0 calc((100% - 42rpx)/3);
|
|
167
|
-
|
|
168
|
-
.upload-icon {
|
|
169
|
-
width: 60rpx;
|
|
170
|
-
margin-bottom: 10rpx;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.image_box {
|
|
175
|
-
position: relative;
|
|
176
|
-
width: 196rpx;
|
|
177
|
-
height: 196rpx;
|
|
178
|
-
// flex: 0 0 calc((100% - 42rpx)/3);
|
|
179
|
-
// margin: 0 20rpx 20rpx 0;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.image_box:nth-child(3n) {
|
|
183
|
-
margin-right: 0;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.del_image {
|
|
187
|
-
width: 36rpx;
|
|
188
|
-
position: absolute;
|
|
189
|
-
right: -10rpx;
|
|
190
|
-
top: -10rpx;
|
|
191
|
-
}
|
|
192
|
-
</style>
|
|
193
|
-
|
|
194
|
-
<script type="application/json">
|
|
195
|
-
{
|
|
196
|
-
"component": true,
|
|
197
|
-
"usingComponents": {}
|
|
198
|
-
}
|
|
199
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 上传图片组件 -->
|
|
3
|
+
<view class="upload-picture-box">
|
|
4
|
+
<block wx:for="{{ imageArray }}" wx:key="index">
|
|
5
|
+
<view class="image_box">
|
|
6
|
+
<image wx:if="{{ baseUrl }}" class="upload_image" src="{{ baseUrl + item }}" />
|
|
7
|
+
<image wx:if="{{ resourceUrl }}" class="del_image" src="{{ resourceUrl + 'file_del_icon.png' }}" mode="widthFix"
|
|
8
|
+
data-index="{{ index }}" bind:tap="handleDel" />
|
|
9
|
+
</view>
|
|
10
|
+
</block>
|
|
11
|
+
<view wx:if="{{ imageArray.length < limit }}" class="upload-box" bind:tap="handleUploadImage">
|
|
12
|
+
<image wx:if="{{ resourceUrl }}" class="upload-icon" src="{{ resourceUrl + 'upload_icon.png' }}"
|
|
13
|
+
mode="widthFix" />
|
|
14
|
+
<text>添加图片</text>
|
|
15
|
+
</view>
|
|
16
|
+
</view>
|
|
17
|
+
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import mpx, { createComponent, ref, watch } from "@mpxjs/core";
|
|
22
|
+
import { EventBase } from "../../api/types";
|
|
23
|
+
import { db } from "../../utils/db";
|
|
24
|
+
|
|
25
|
+
createComponent({
|
|
26
|
+
options: {
|
|
27
|
+
styleIsolation: "apply-shared",
|
|
28
|
+
},
|
|
29
|
+
properties: {
|
|
30
|
+
// 上传图片数量限制
|
|
31
|
+
limit: {
|
|
32
|
+
type: Number,
|
|
33
|
+
value: 6
|
|
34
|
+
},
|
|
35
|
+
// 回显图片(字符串或数组)
|
|
36
|
+
value: {
|
|
37
|
+
type: null,
|
|
38
|
+
value: ""
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
setup(props) {
|
|
42
|
+
let config = getApp().globalData.config;
|
|
43
|
+
// 资源路径
|
|
44
|
+
let resourceUrl = config.resourceUrl + "/images/mall/";
|
|
45
|
+
// 图片路径
|
|
46
|
+
let baseUrl = config.baseUrl + "/v1/file/image/clip/100/100/";
|
|
47
|
+
// 上传图片数组
|
|
48
|
+
let imageArray = ref([] as Array<string>);
|
|
49
|
+
|
|
50
|
+
// 回显已有图片(value 支持字符串或数组)
|
|
51
|
+
watch(() => props.value, (val) => {
|
|
52
|
+
if (Array.isArray(val)) {
|
|
53
|
+
imageArray.value = val;
|
|
54
|
+
} else if (val) {
|
|
55
|
+
imageArray.value = [val];
|
|
56
|
+
} else {
|
|
57
|
+
imageArray.value = [];
|
|
58
|
+
}
|
|
59
|
+
}, { immediate: true });
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
resourceUrl,
|
|
63
|
+
baseUrl,
|
|
64
|
+
imageArray,
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
methods: {
|
|
68
|
+
handleUploadImage() {
|
|
69
|
+
if (this.imageArray.length > this.limit - 1) {
|
|
70
|
+
mpx.showToast({
|
|
71
|
+
title: "图片最多上传" + this.limit + "张",
|
|
72
|
+
icon: "none",
|
|
73
|
+
duration: 2000
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
mpx.showActionSheet({
|
|
78
|
+
itemList: ["从相册中选择", "拍照"],
|
|
79
|
+
itemColor: "#486aff",
|
|
80
|
+
success: (res) => {
|
|
81
|
+
if (res.tapIndex === 0) {
|
|
82
|
+
this.chooseWxHeadImage("album");
|
|
83
|
+
} else if (res.tapIndex === 1) {
|
|
84
|
+
this.chooseWxHeadImage("camera");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
chooseWxHeadImage: function (type: any) {
|
|
90
|
+
let config = getApp().globalData.config;
|
|
91
|
+
const expire = db.isTokenExpires();
|
|
92
|
+
const token: string = (!expire && db.getToken()) ? "Bearer " + db.getToken() : "";
|
|
93
|
+
mpx.chooseMedia({
|
|
94
|
+
count: this.limit,
|
|
95
|
+
mediaType: ['image'],
|
|
96
|
+
sizeType: ["original", "compressed"],
|
|
97
|
+
sourceType: [type],
|
|
98
|
+
success: (res) => {
|
|
99
|
+
console.log('chooseImage success, temp path is', res)
|
|
100
|
+
const files = res.tempFiles || [];
|
|
101
|
+
// 逐个上传
|
|
102
|
+
files.forEach((file: any) => {
|
|
103
|
+
mpx.uploadFile({
|
|
104
|
+
url: config.baseUrl + "/v1/file/upload?tenant=" + config.tenant,
|
|
105
|
+
filePath: file.tempFilePath,
|
|
106
|
+
header: {
|
|
107
|
+
"Content-Type": "multipart/form-data",
|
|
108
|
+
"Authorization": token
|
|
109
|
+
},
|
|
110
|
+
formData: {
|
|
111
|
+
method: "POST",
|
|
112
|
+
},
|
|
113
|
+
name: "file",
|
|
114
|
+
success: (response) => {
|
|
115
|
+
console.log(response);
|
|
116
|
+
if (response.statusCode === 200) {
|
|
117
|
+
const src = JSON.parse(response.data).fileSrc;
|
|
118
|
+
this.imageArray.push(src);
|
|
119
|
+
this.triggerEvent("getImageArray", this.imageArray);
|
|
120
|
+
} else {
|
|
121
|
+
mpx.showToast({
|
|
122
|
+
title: "图片上传失败",
|
|
123
|
+
icon: "none",
|
|
124
|
+
duration: 2000
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
},
|
|
133
|
+
// 删除图片
|
|
134
|
+
handleDel(e: EventBase) {
|
|
135
|
+
this.imageArray.splice(e.currentTarget.dataset.index, 1);
|
|
136
|
+
// 使用this.triggerEvent传索引值给页面
|
|
137
|
+
this.triggerEvent("getImageArray", this.imageArray);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
</script>
|
|
142
|
+
|
|
143
|
+
<style lang="scss">
|
|
144
|
+
.upload-picture-box {
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
flex-wrap: wrap;
|
|
148
|
+
gap: 20rpx;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.upload_image {
|
|
152
|
+
width: 196rpx;
|
|
153
|
+
height: 196rpx;
|
|
154
|
+
vertical-align: top;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.upload-box {
|
|
158
|
+
border: 2rpx dashed #dddddd;
|
|
159
|
+
font-size: 24rpx;
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
width: 196rpx;
|
|
163
|
+
height: 196rpx;
|
|
164
|
+
justify-content: center;
|
|
165
|
+
align-items: center;
|
|
166
|
+
// flex: 0 0 calc((100% - 42rpx)/3);
|
|
167
|
+
|
|
168
|
+
.upload-icon {
|
|
169
|
+
width: 60rpx;
|
|
170
|
+
margin-bottom: 10rpx;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.image_box {
|
|
175
|
+
position: relative;
|
|
176
|
+
width: 196rpx;
|
|
177
|
+
height: 196rpx;
|
|
178
|
+
// flex: 0 0 calc((100% - 42rpx)/3);
|
|
179
|
+
// margin: 0 20rpx 20rpx 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.image_box:nth-child(3n) {
|
|
183
|
+
margin-right: 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.del_image {
|
|
187
|
+
width: 36rpx;
|
|
188
|
+
position: absolute;
|
|
189
|
+
right: -10rpx;
|
|
190
|
+
top: -10rpx;
|
|
191
|
+
}
|
|
192
|
+
</style>
|
|
193
|
+
|
|
194
|
+
<script type="application/json">
|
|
195
|
+
{
|
|
196
|
+
"component": true,
|
|
197
|
+
"usingComponents": {}
|
|
198
|
+
}
|
|
199
|
+
</script>
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="cms_box" wx:for="{{ contents }}" wx:key="*this">
|
|
3
|
-
<view class="cms_title">{{ title }}</view>
|
|
4
|
-
<rich-text nodes="{{ item.infoContent }}"></rich-text>
|
|
5
|
-
</view>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
import { createComponent, ref, toRefs, watch } from '@mpxjs/core'
|
|
10
|
-
import { cmsApi } from '../../api/cms/index'
|
|
11
|
-
|
|
12
|
-
createComponent({
|
|
13
|
-
properties: {
|
|
14
|
-
// 站点ID
|
|
15
|
-
siteId: {
|
|
16
|
-
type: String,
|
|
17
|
-
value: ""
|
|
18
|
-
},
|
|
19
|
-
// 租户
|
|
20
|
-
tenant: {
|
|
21
|
-
type: String,
|
|
22
|
-
value: ""
|
|
23
|
-
},
|
|
24
|
-
// 别名
|
|
25
|
-
channelAlias: {
|
|
26
|
-
type: String,
|
|
27
|
-
value: ""
|
|
28
|
-
},
|
|
29
|
-
// refreshKey
|
|
30
|
-
refreshKey: {
|
|
31
|
-
type: Number,
|
|
32
|
-
value: 0
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
setup(props) {
|
|
36
|
-
let contents = ref([{ contentId: "123" }]);
|
|
37
|
-
let title = ref("");
|
|
38
|
-
const { refreshKey } = toRefs(props)
|
|
39
|
-
watch(refreshKey, () => {
|
|
40
|
-
if (!props.channelAlias) return;
|
|
41
|
-
cmsApi.findCmsContentInfo({ siteId: props.siteId, channelAlias: props.channelAlias, tenant: props.tenant }).then(({ data }) => {
|
|
42
|
-
console.log(data)
|
|
43
|
-
title.value = data.cmsInfo.infoTitle;
|
|
44
|
-
contents.value = data.infoContentResults;
|
|
45
|
-
console.log(contents)
|
|
46
|
-
})
|
|
47
|
-
})
|
|
48
|
-
return {
|
|
49
|
-
title,
|
|
50
|
-
contents
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
})
|
|
54
|
-
</script>
|
|
55
|
-
|
|
56
|
-
<style lang="scss">
|
|
57
|
-
.cms_box {
|
|
58
|
-
padding: 15px 3%;
|
|
59
|
-
font-size: 28rpx;
|
|
60
|
-
line-height: 25px;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.cms_title {
|
|
64
|
-
text-align: center;
|
|
65
|
-
}
|
|
66
|
-
</style>
|
|
67
|
-
|
|
68
|
-
<script type="application/json">
|
|
69
|
-
{
|
|
70
|
-
"component": true,
|
|
71
|
-
"usingComponents": {}
|
|
72
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<view class="cms_box" wx:for="{{ contents }}" wx:key="*this">
|
|
3
|
+
<view class="cms_title">{{ title }}</view>
|
|
4
|
+
<rich-text nodes="{{ item.infoContent }}"></rich-text>
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import { createComponent, ref, toRefs, watch } from '@mpxjs/core'
|
|
10
|
+
import { cmsApi } from '../../api/cms/index'
|
|
11
|
+
|
|
12
|
+
createComponent({
|
|
13
|
+
properties: {
|
|
14
|
+
// 站点ID
|
|
15
|
+
siteId: {
|
|
16
|
+
type: String,
|
|
17
|
+
value: ""
|
|
18
|
+
},
|
|
19
|
+
// 租户
|
|
20
|
+
tenant: {
|
|
21
|
+
type: String,
|
|
22
|
+
value: ""
|
|
23
|
+
},
|
|
24
|
+
// 别名
|
|
25
|
+
channelAlias: {
|
|
26
|
+
type: String,
|
|
27
|
+
value: ""
|
|
28
|
+
},
|
|
29
|
+
// refreshKey
|
|
30
|
+
refreshKey: {
|
|
31
|
+
type: Number,
|
|
32
|
+
value: 0
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
setup(props) {
|
|
36
|
+
let contents = ref([{ contentId: "123" }]);
|
|
37
|
+
let title = ref("");
|
|
38
|
+
const { refreshKey } = toRefs(props)
|
|
39
|
+
watch(refreshKey, () => {
|
|
40
|
+
if (!props.channelAlias) return;
|
|
41
|
+
cmsApi.findCmsContentInfo({ siteId: props.siteId, channelAlias: props.channelAlias, tenant: props.tenant }).then(({ data }) => {
|
|
42
|
+
console.log(data)
|
|
43
|
+
title.value = data.cmsInfo.infoTitle;
|
|
44
|
+
contents.value = data.infoContentResults;
|
|
45
|
+
console.log(contents)
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
return {
|
|
49
|
+
title,
|
|
50
|
+
contents
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<style lang="scss">
|
|
57
|
+
.cms_box {
|
|
58
|
+
padding: 15px 3%;
|
|
59
|
+
font-size: 28rpx;
|
|
60
|
+
line-height: 25px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.cms_title {
|
|
64
|
+
text-align: center;
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
67
|
+
|
|
68
|
+
<script type="application/json">
|
|
69
|
+
{
|
|
70
|
+
"component": true,
|
|
71
|
+
"usingComponents": {}
|
|
72
|
+
}
|
|
73
73
|
</script>
|