@cloudbase/lowcode-builder 1.8.44-alpha.0 → 1.8.44-alpha.2
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/builder.web.js +1 -1
- package/lib/builder/config/index.d.ts +1 -1
- package/lib/builder/config/index.js +1 -1
- package/lib/builder/mp/index.js +8 -9
- package/lib/builder.web.js +1 -1
- package/lib/utils/transform.d.ts +1 -1
- package/lib/utils/transform.js +69 -63
- package/package.json +1 -1
- package/template/mp/common/modal/index.js +200 -0
- package/template/mp/common/modal/index.json +5 -0
- package/template/mp/common/modal/index.wxml +16 -0
- package/template/mp/common/modal/index.wxss +1 -0
- package/template/mp/common/modal/wd-modal.wxss +177 -0
- package/template/mp/common/privacyModal/index.json +2 -5
- package/template/mp/common/privacyModal/index.wxml +8 -8
- package/template/mp/common/privacyModal/index.wxss +15 -2
- package/template/mp/common/util.js +3 -16
- package/template/mp/page/api.js +1 -3
package/lib/utils/transform.d.ts
CHANGED
package/lib/utils/transform.js
CHANGED
|
@@ -1,69 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable no-new-func */
|
|
3
|
+
// import { transformSync } from '@babel/core';
|
|
2
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
5
|
exports.BabelTransform = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
// export function BabelTransform(
|
|
7
|
+
// code,
|
|
8
|
+
// options: {
|
|
9
|
+
// IIFE?: boolean;
|
|
10
|
+
// } = {},
|
|
11
|
+
// ) {
|
|
12
|
+
// const { IIFE = false } = options;
|
|
13
|
+
// /**
|
|
14
|
+
// * 如果 trim 完为空
|
|
15
|
+
// * 则原样不用再编译了
|
|
16
|
+
// */
|
|
17
|
+
// if (!code?.trim?.()) {
|
|
18
|
+
// return code;
|
|
19
|
+
// }
|
|
20
|
+
// try {
|
|
21
|
+
// /**
|
|
22
|
+
// * 如果是基础字面量的话
|
|
23
|
+
// * 可以直接使用原值,不用过babel
|
|
24
|
+
// */
|
|
25
|
+
// if (typeof code === 'string' && JSON.parse(code?.trim?.())) {
|
|
26
|
+
// return code;
|
|
27
|
+
// }
|
|
28
|
+
// } catch (e) {}
|
|
29
|
+
// try {
|
|
30
|
+
// const simpleWrapped = `(\n${code || 'undefined'}\n)`;
|
|
31
|
+
// const { code: expression } =
|
|
32
|
+
// transformSync(IIFE ? `(()=>${simpleWrapped})()` : simpleWrapped, {
|
|
33
|
+
// cwd: __dirname,
|
|
34
|
+
// sourceType: 'script',
|
|
35
|
+
// comments: false,
|
|
36
|
+
// // minified: true,
|
|
37
|
+
// presets: [
|
|
38
|
+
// [
|
|
39
|
+
// '@babel/preset-env',
|
|
40
|
+
// {
|
|
41
|
+
// targets: {
|
|
42
|
+
// /**
|
|
43
|
+
// * 支持 proxy 的版本
|
|
44
|
+
// * 低于这个版本完全无法支持
|
|
45
|
+
// */
|
|
46
|
+
// // browsers: ['chrome >= 49', 'iOS >= 10', 'safari >= 10'],
|
|
47
|
+
// /**
|
|
48
|
+
// * 一个相对较高的版本,包涵解构赋值,这样不用注入太多 polifill
|
|
49
|
+
// * 但是不包涵 options chain
|
|
50
|
+
// * 基本上是 es2019
|
|
51
|
+
// */
|
|
52
|
+
// browsers: ['chrome >= 67', 'iOS >= 12', 'safari >= 12'],
|
|
53
|
+
// },
|
|
54
|
+
// include: [
|
|
55
|
+
// // es2015
|
|
56
|
+
// '@babel/plugin-transform-arrow-functions',
|
|
57
|
+
// ],
|
|
58
|
+
// },
|
|
59
|
+
// ],
|
|
60
|
+
// ],
|
|
61
|
+
// }) || {};
|
|
62
|
+
// const res = expression?.replace?.(/;$/, '') || code;
|
|
63
|
+
// if (expression) {
|
|
64
|
+
// new Function(`return (\n${res}\n)`);
|
|
65
|
+
// }
|
|
66
|
+
// return res;
|
|
67
|
+
// } catch (e: any) {
|
|
68
|
+
// console.error(`transform [${code}] fail:`, e?.message);
|
|
69
|
+
// return code;
|
|
70
|
+
// }
|
|
71
|
+
// }
|
|
6
72
|
function BabelTransform(code, options = {}) {
|
|
7
|
-
|
|
8
|
-
const { IIFE = false } = options;
|
|
9
|
-
/**
|
|
10
|
-
* 如果 trim 完为空
|
|
11
|
-
* 则原样不用再编译了
|
|
12
|
-
*/
|
|
13
|
-
if (!((_a = code === null || code === void 0 ? void 0 : code.trim) === null || _a === void 0 ? void 0 : _a.call(code))) {
|
|
14
|
-
return code;
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
/**
|
|
18
|
-
* 如果是基础字面量的话
|
|
19
|
-
* 可以直接使用原值,不用过babel
|
|
20
|
-
*/
|
|
21
|
-
if (typeof code === 'string' && JSON.parse((_b = code === null || code === void 0 ? void 0 : code.trim) === null || _b === void 0 ? void 0 : _b.call(code))) {
|
|
22
|
-
return code;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
catch (e) { }
|
|
26
|
-
try {
|
|
27
|
-
const simpleWrapped = `(\n${code || 'undefined'}\n)`;
|
|
28
|
-
const { code: expression } = (0, core_1.transformSync)(IIFE ? `(()=>${simpleWrapped})()` : simpleWrapped, {
|
|
29
|
-
cwd: __dirname,
|
|
30
|
-
sourceType: 'script',
|
|
31
|
-
comments: false,
|
|
32
|
-
// minified: true,
|
|
33
|
-
presets: [
|
|
34
|
-
[
|
|
35
|
-
'@babel/preset-env',
|
|
36
|
-
{
|
|
37
|
-
targets: {
|
|
38
|
-
/**
|
|
39
|
-
* 支持 proxy 的版本
|
|
40
|
-
* 低于这个版本完全无法支持
|
|
41
|
-
*/
|
|
42
|
-
// browsers: ['chrome >= 49', 'iOS >= 10', 'safari >= 10'],
|
|
43
|
-
/**
|
|
44
|
-
* 一个相对较高的版本,包涵解构赋值,这样不用注入太多 polifill
|
|
45
|
-
* 但是不包涵 options chain
|
|
46
|
-
* 基本上是 es2019
|
|
47
|
-
*/
|
|
48
|
-
browsers: ['chrome >= 67', 'iOS >= 12', 'safari >= 12'],
|
|
49
|
-
},
|
|
50
|
-
include: [
|
|
51
|
-
// es2015
|
|
52
|
-
'@babel/plugin-transform-arrow-functions',
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
],
|
|
57
|
-
}) || {};
|
|
58
|
-
const res = ((_c = expression === null || expression === void 0 ? void 0 : expression.replace) === null || _c === void 0 ? void 0 : _c.call(expression, /;$/, '')) || code;
|
|
59
|
-
if (expression) {
|
|
60
|
-
new Function(`return (\n${res}\n)`);
|
|
61
|
-
}
|
|
62
|
-
return res;
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
console.error(`transform [${code}] fail:`, e === null || e === void 0 ? void 0 : e.message);
|
|
66
|
-
return code;
|
|
67
|
-
}
|
|
73
|
+
return '';
|
|
68
74
|
}
|
|
69
75
|
exports.BabelTransform = BabelTransform;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.8.44-alpha.
|
|
3
|
+
"version": "1.8.44-alpha.2",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
function classNames(...args) {
|
|
2
|
+
const classes = [];
|
|
3
|
+
|
|
4
|
+
for (let i = 0; i < args.length; i++) {
|
|
5
|
+
const arg = args[i];
|
|
6
|
+
if (!arg) continue;
|
|
7
|
+
|
|
8
|
+
const argType = typeof arg;
|
|
9
|
+
|
|
10
|
+
if (argType === 'string' || argType === 'number') {
|
|
11
|
+
classes.push(arg);
|
|
12
|
+
} else if (Array.isArray(arg)) {
|
|
13
|
+
if (arg.length) {
|
|
14
|
+
const inner = classes.push(classNames(...arg));
|
|
15
|
+
if (inner) {
|
|
16
|
+
classes.push(inner);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
} else if (argType === 'object') {
|
|
20
|
+
if (arg.toString === Object.prototype.toString) {
|
|
21
|
+
Object.keys(arg).forEach((key) => {
|
|
22
|
+
arg[key] && classes.push(key);
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
classes.push(arg.toString());
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return classes.join(' ');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const WD_PREFIX = 'wd'
|
|
34
|
+
|
|
35
|
+
Component({
|
|
36
|
+
options: {
|
|
37
|
+
virtualHost: true,
|
|
38
|
+
multipleSlots: true,
|
|
39
|
+
},
|
|
40
|
+
behaviors: [],
|
|
41
|
+
properties: {
|
|
42
|
+
className: {
|
|
43
|
+
type: String,
|
|
44
|
+
value: '',
|
|
45
|
+
},
|
|
46
|
+
style: {
|
|
47
|
+
type: String,
|
|
48
|
+
value: '',
|
|
49
|
+
},
|
|
50
|
+
id: {
|
|
51
|
+
type: String,
|
|
52
|
+
value: '',
|
|
53
|
+
},
|
|
54
|
+
defaultShow: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
value: false,
|
|
57
|
+
},
|
|
58
|
+
position: {
|
|
59
|
+
type: String,
|
|
60
|
+
value: 'bottom',
|
|
61
|
+
},
|
|
62
|
+
closeType: {
|
|
63
|
+
type: Array,
|
|
64
|
+
value: ['mask'],
|
|
65
|
+
},
|
|
66
|
+
defaultMaskShow: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
value: true,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
data: {
|
|
72
|
+
cls: '',
|
|
73
|
+
styleMain: '',
|
|
74
|
+
styleShow: '',
|
|
75
|
+
classPrefix: WD_PREFIX,
|
|
76
|
+
modalMaskClasses: '', // 遮罩层样式
|
|
77
|
+
modalBdClasses: '', // 主体内容样式
|
|
78
|
+
isBdShow: true, // 弹窗主体内容显示控制
|
|
79
|
+
isMaskShow: false, // 弹窗遮罩层显示控制
|
|
80
|
+
maskPreToShow: false, // 弹窗遮罩层预显示控制,为了动画
|
|
81
|
+
openInfo: null,
|
|
82
|
+
closeInfo: null,
|
|
83
|
+
},
|
|
84
|
+
lifetimes: {
|
|
85
|
+
attached() {
|
|
86
|
+
// this.updateWidgetAPI();
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
updateWidgetAPI() {
|
|
91
|
+
this.setReadonlyAttributes &&
|
|
92
|
+
this.setReadonlyAttributes({
|
|
93
|
+
open: this.onOpen.bind(this),
|
|
94
|
+
close: this.onClose.bind(this),
|
|
95
|
+
modalState: this.data.isBdShow ? 'open' : 'close',
|
|
96
|
+
openInfo: this.data.openInfo,
|
|
97
|
+
closeInfo: this.data.closeInfo,
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
/**
|
|
101
|
+
* 控制弹窗打开/关闭
|
|
102
|
+
* @param {Boolean} isOpen
|
|
103
|
+
*/
|
|
104
|
+
dealShow(isOpen) {
|
|
105
|
+
let setImmediately = {
|
|
106
|
+
maskPreToShow: true,
|
|
107
|
+
isMaskShow: !isOpen,
|
|
108
|
+
isBdShow: isOpen,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
if (!isOpen) {
|
|
112
|
+
setImmediately = {
|
|
113
|
+
isBdShow: isOpen,
|
|
114
|
+
isMaskShow: !isOpen,
|
|
115
|
+
maskPreToShow: false,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
this.setData(setImmediately);
|
|
120
|
+
|
|
121
|
+
this.triggerEvent(isOpen ? 'open' : 'close');
|
|
122
|
+
},
|
|
123
|
+
/**
|
|
124
|
+
* 关闭弹窗
|
|
125
|
+
*/
|
|
126
|
+
onClose(params) {
|
|
127
|
+
this.dealShow(false);
|
|
128
|
+
this.setData({ closeInfo: params?.info || params });
|
|
129
|
+
},
|
|
130
|
+
/**
|
|
131
|
+
* 开启弹窗
|
|
132
|
+
*/
|
|
133
|
+
onOpen(params) {
|
|
134
|
+
this.dealShow(true);
|
|
135
|
+
this.setData({ openInfo: params?.info || params });
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
* 点击遮罩层
|
|
139
|
+
*/
|
|
140
|
+
maskClick() {
|
|
141
|
+
if (this.data.closeType.includes('mask')) {
|
|
142
|
+
this.onClose();
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
observers: {
|
|
147
|
+
'style,className,position,isMaskShow,defaultMaskShow,isBdShow': function (
|
|
148
|
+
style,
|
|
149
|
+
className,
|
|
150
|
+
position,
|
|
151
|
+
isMaskShow,
|
|
152
|
+
defaultMaskShow,
|
|
153
|
+
isBdShow
|
|
154
|
+
) {
|
|
155
|
+
const defaultWidth = { center: 'calc(100% - 4.57rem)', bottom: '100%' }[
|
|
156
|
+
position
|
|
157
|
+
];
|
|
158
|
+
const styleShow = `width: ${defaultWidth};` + style;
|
|
159
|
+
const styleMain = style?.match(/(display:).*?(;)/g)?.join('');
|
|
160
|
+
|
|
161
|
+
// 响应式css api
|
|
162
|
+
const cls = classNames({
|
|
163
|
+
[`${WD_PREFIX}-modal`]: true,
|
|
164
|
+
[`${WD_PREFIX}-modal-center`]: position === 'center',
|
|
165
|
+
[`${WD_PREFIX}-mp-modal`]: true,
|
|
166
|
+
[`${WD_PREFIX}-mp-modal-hide`]: !isBdShow,
|
|
167
|
+
[className]: className,
|
|
168
|
+
});
|
|
169
|
+
// 遮罩层样式
|
|
170
|
+
const modalMaskClasses = classNames({
|
|
171
|
+
[`${WD_PREFIX}-modal-mask`]: true,
|
|
172
|
+
[`${WD_PREFIX}-modal-mask__fadein`]: true,
|
|
173
|
+
[`${WD_PREFIX}-modal-mask__fadeout`]: isMaskShow,
|
|
174
|
+
[`${WD_PREFIX}-modal-mask__hide`]: !defaultMaskShow,
|
|
175
|
+
});
|
|
176
|
+
// 主体内容样式
|
|
177
|
+
const modalBdClasses = classNames({
|
|
178
|
+
'weda-modal-new': true,
|
|
179
|
+
[`${WD_PREFIX}-modal-bd`]: true,
|
|
180
|
+
[`${WD_PREFIX}-modal-bd__toggle`]: isBdShow,
|
|
181
|
+
[`${WD_PREFIX}-modal-bd__box`]:
|
|
182
|
+
!defaultMaskShow && position === 'center',
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
this.setData({
|
|
186
|
+
styleMain,
|
|
187
|
+
styleShow,
|
|
188
|
+
cls,
|
|
189
|
+
modalMaskClasses,
|
|
190
|
+
modalBdClasses,
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
defaultShow: function (defaultShow) {
|
|
194
|
+
this.dealShow(defaultShow);
|
|
195
|
+
},
|
|
196
|
+
'isBdShow,openInfo,closeInfo': function () {
|
|
197
|
+
this.updateWidgetAPI();
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<view id="{{id}}" style="{{styleMain}}" class="{{cls}}">
|
|
2
|
+
<block wx:if="{{maskPreToShow}}">
|
|
3
|
+
<view class="{{modalMaskClasses}}" bindtap="maskClick" />
|
|
4
|
+
<view style="{{styleShow}}" class="{{modalBdClasses}}">
|
|
5
|
+
<view class="{{classPrefix + '-modal-bd__hd'}}">
|
|
6
|
+
<slot name="headerSlot"></slot>
|
|
7
|
+
</view>
|
|
8
|
+
<view class="{{classPrefix + '-modal-bd__main'}}">
|
|
9
|
+
<slot name="contentSlot"></slot>
|
|
10
|
+
</view>
|
|
11
|
+
<view class="{{classPrefix + '-modal-bd__ft'}}">
|
|
12
|
+
<slot name="footerSlot"></slot>
|
|
13
|
+
</view>
|
|
14
|
+
</view>
|
|
15
|
+
</block>
|
|
16
|
+
</view>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import './wd-modal.wxss';
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
@-webkit-keyframes wd-fadein {
|
|
3
|
+
0% {
|
|
4
|
+
opacity: 0;
|
|
5
|
+
}
|
|
6
|
+
100% {
|
|
7
|
+
opacity: 1;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
@keyframes wd-fadein {
|
|
11
|
+
0% {
|
|
12
|
+
opacity: 0;
|
|
13
|
+
}
|
|
14
|
+
100% {
|
|
15
|
+
opacity: 1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
@-webkit-keyframes wd-fadeout {
|
|
19
|
+
0% {
|
|
20
|
+
opacity: 1;
|
|
21
|
+
}
|
|
22
|
+
100% {
|
|
23
|
+
opacity: 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
@keyframes wd-fadeout {
|
|
27
|
+
0% {
|
|
28
|
+
opacity: 1;
|
|
29
|
+
}
|
|
30
|
+
100% {
|
|
31
|
+
opacity: 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.wd-modal {
|
|
35
|
+
position: fixed;
|
|
36
|
+
z-index: 1000;
|
|
37
|
+
}
|
|
38
|
+
.wd-modal-mask {
|
|
39
|
+
position: fixed;
|
|
40
|
+
top: 0;
|
|
41
|
+
bottom: 0;
|
|
42
|
+
left: 0;
|
|
43
|
+
right: 0;
|
|
44
|
+
background: rgba(0, 0, 0, 0.6);
|
|
45
|
+
-webkit-transition: all 0.3s;
|
|
46
|
+
transition: all 0.3s;
|
|
47
|
+
z-index: 1000;
|
|
48
|
+
}
|
|
49
|
+
.wd-modal-mask__fadein {
|
|
50
|
+
animation: wd-fadein 0.3s forwards;
|
|
51
|
+
}
|
|
52
|
+
.wd-modal-mask__fadeout {
|
|
53
|
+
animation: wd-fadeout 0.3s forwards;
|
|
54
|
+
}
|
|
55
|
+
.wd-modal-mask__hide {
|
|
56
|
+
background: transparent;
|
|
57
|
+
}
|
|
58
|
+
.wd-modal-bd {
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
position: fixed;
|
|
61
|
+
left: 50%;
|
|
62
|
+
bottom: 0;
|
|
63
|
+
background: #fff;
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
z-index: 1001;
|
|
66
|
+
transform: translate(-50%, 100%);
|
|
67
|
+
transition: all 0.3s;
|
|
68
|
+
height: inherit;
|
|
69
|
+
width: inherit;
|
|
70
|
+
overflow-y: auto;
|
|
71
|
+
border: 0.5px solid #dcdcdc;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
}
|
|
75
|
+
.wd-modal-bd__box {
|
|
76
|
+
box-shadow: 0px 6px 30px rgba(0, 0, 0, 0.05), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 8px 10px rgba(0, 0, 0, 0.08);
|
|
77
|
+
}
|
|
78
|
+
.wd-modal-bd__toggle {
|
|
79
|
+
transform: translate(-50%, 0);
|
|
80
|
+
}
|
|
81
|
+
.wd-modal-bd__hd {
|
|
82
|
+
display: flex;
|
|
83
|
+
justify-content: space-between;
|
|
84
|
+
align-items: center;
|
|
85
|
+
font: var(--wd-typography-title-lg);
|
|
86
|
+
}
|
|
87
|
+
.wd-modal-bd__hd:empty {
|
|
88
|
+
margin-bottom: 0;
|
|
89
|
+
}
|
|
90
|
+
.wd-modal-bd__hd .wd-icon {
|
|
91
|
+
margin-left: auto;
|
|
92
|
+
}
|
|
93
|
+
.wd-modal-bd__main {
|
|
94
|
+
flex: 1;
|
|
95
|
+
overflow-y: auto;
|
|
96
|
+
color: #16181a;
|
|
97
|
+
}
|
|
98
|
+
.wd-modal-bd__main:empty {
|
|
99
|
+
margin-top: 0;
|
|
100
|
+
}
|
|
101
|
+
.wd-modal-bd__ft {
|
|
102
|
+
position: relative;
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
justify-content: center;
|
|
106
|
+
}
|
|
107
|
+
.wd-modal-bd__ft:empty {
|
|
108
|
+
margin-top: 0;
|
|
109
|
+
}
|
|
110
|
+
.wd-modal-bd__ft .wd-btn {
|
|
111
|
+
margin-right: 12px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.wd-modal-center .wd-modal-bd {
|
|
115
|
+
bottom: 50%;
|
|
116
|
+
transform: translate(-50%, 50%);
|
|
117
|
+
opacity: 0;
|
|
118
|
+
}
|
|
119
|
+
.wd-modal-center .wd-modal-bd__toggle {
|
|
120
|
+
opacity: 1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.wd-modal {
|
|
124
|
+
left: 0;
|
|
125
|
+
bottom: 0;
|
|
126
|
+
right: 0;
|
|
127
|
+
top: 0;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: flex-end;
|
|
130
|
+
justify-content: center;
|
|
131
|
+
}
|
|
132
|
+
.wd-modal.wd-mp-modal-hide {
|
|
133
|
+
z-index: -1;
|
|
134
|
+
}
|
|
135
|
+
.wd-modal-center {
|
|
136
|
+
align-items: center;
|
|
137
|
+
}
|
|
138
|
+
.wd-modal-center .wd-modal-bd {
|
|
139
|
+
transform: unset;
|
|
140
|
+
}
|
|
141
|
+
.wd-modal-bd {
|
|
142
|
+
border-radius: 24rpx 24rpx 0 0;
|
|
143
|
+
padding: 64rpx 48rpx 48rpx 48rpx;
|
|
144
|
+
max-height: 1412rpx;
|
|
145
|
+
position: static;
|
|
146
|
+
}
|
|
147
|
+
.wd-modal-bd__hd {
|
|
148
|
+
margin-bottom: 16rpx;
|
|
149
|
+
}
|
|
150
|
+
.wd-modal-bd__main {
|
|
151
|
+
font-size: 32rpx;
|
|
152
|
+
}
|
|
153
|
+
.wd-modal-bd__ft {
|
|
154
|
+
margin-top: 48rpx;
|
|
155
|
+
}
|
|
156
|
+
.wd-modal-bd__ft-btn {
|
|
157
|
+
border-radius: 12rpx;
|
|
158
|
+
margin-right: 24rpx;
|
|
159
|
+
padding: 16rpx 48rpx;
|
|
160
|
+
font-size: 32rpx;
|
|
161
|
+
}
|
|
162
|
+
.wd-modal-bd__toggle {
|
|
163
|
+
transform: unset;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.wd-modal-center .wd-modal-bd {
|
|
167
|
+
border-radius: 24rpx;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.weda-modal-new.wd-modal-bd {
|
|
171
|
+
padding: 32rpx 24rpx 24rpx 24rpx;
|
|
172
|
+
padding-bottom: 24rpx;
|
|
173
|
+
padding-bottom: calc(constant(safe-area-inset-bottom) + 24rpx);
|
|
174
|
+
/* 兼容 iOS < 11.2 */
|
|
175
|
+
padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
|
|
176
|
+
/* 兼容 iOS >= 11.2 */
|
|
177
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"component": true,
|
|
3
|
-
"styleIsolation": "shared",
|
|
3
|
+
"styleIsolation": "apply-shared",
|
|
4
4
|
"usingComponents": {
|
|
5
|
-
"modal": "/
|
|
6
|
-
"text": "/materials/gsd-h5-react/components/wd-text/index",
|
|
7
|
-
"icon": "/materials/gsd-h5-react/components/wd-icon/index",
|
|
8
|
-
"wd-button": "/materials/gsd-h5-react/components/wd-button/index"
|
|
5
|
+
"modal": "/common/modal/index"
|
|
9
6
|
}
|
|
10
7
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<modal defaultShow="{{visible}}" closeType="{{[]}}">
|
|
2
|
-
<text
|
|
3
|
-
<icon style="color: rgba(0, 0, 0, 0.6);"
|
|
1
|
+
<modal className="privacy" defaultShow="{{visible}}" closeType="{{[]}}">
|
|
2
|
+
<text class="{{textClass}} wd-typography-title-lg" slot="headerSlot">{{title}}</text>
|
|
3
|
+
<view class="wd-icon t-icon t-icon-close wd-icon--md wd-mp-icon" style="color: rgba(0, 0, 0, 0.6);" bind:tap="handleDisagree" slot="headerSlot"></view>
|
|
4
4
|
|
|
5
|
-
<text style="display:inline;" level="body-default"
|
|
6
|
-
<text style="display:inline;color: var(--wd-color-brand)" level="body-default"
|
|
7
|
-
<text style="display:inline;" level="body-default"
|
|
5
|
+
<text class="{{textClass}}" style="display:inline;" level="body-default" slot="contentSlot">{{desc1}}</text>
|
|
6
|
+
<text class="{{textClass}}" style="display:inline;color: var(--wd-color-brand)" level="body-default" slot="contentSlot" bindtap="openPrivacyContract">{{urlTitle}}</text>
|
|
7
|
+
<text class="{{textClass}}" style="display:inline;" level="body-default" slot="contentSlot">{{desc2}}</text>
|
|
8
8
|
|
|
9
|
-
<
|
|
10
|
-
<button class="wd-btn wd-btn--primary wd-btn--base wd-btn--md wd-mp-btn" id="agree-btn"
|
|
9
|
+
<button class="privacy-btn wd-btn wd-btn--secondary wd-btn--outline wd-btn--md wd-mp-btn" slot="footerSlot" theme="secondary" variant="outline" size="md" bind:tap="handleDisagree">取消</button>
|
|
10
|
+
<button class="privacy-btn wd-btn wd-btn--primary wd-btn--base wd-btn--md wd-mp-btn" id="agree-btn" type="primary" variant="base" size="default" open-type="agreePrivacyAuthorization" bindtap="close" bindagreeprivacyauthorization="handleAgree" slot="footerSlot">同意</button>
|
|
11
11
|
</modal>
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
/* common/privacyModel/index.wxss */
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
.privacy .weda-modal-new {
|
|
3
4
|
padding: 32rpx 24rpx 24rpx 24rpx;
|
|
4
|
-
padding-bottom: 24rpx
|
|
5
|
+
padding-bottom: 24rpx;
|
|
6
|
+
padding-bottom: calc(constant(safe-area-inset-bottom) + 24rpx);
|
|
7
|
+
/* 兼容 iOS < 11.2 */
|
|
8
|
+
padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
|
|
9
|
+
/* 兼容 iOS >= 11.2 */
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.privacy-btn {
|
|
13
|
+
font-size: 28rpx;
|
|
14
|
+
width: 200rpx;
|
|
15
|
+
height: 70rpx;
|
|
16
|
+
line-height: 70rpx;
|
|
17
|
+
margin: 0
|
|
5
18
|
}
|
|
@@ -419,8 +419,8 @@ export async function getAuthConfig() {
|
|
|
419
419
|
|
|
420
420
|
let _AUTH_CACHE_MAP = {};
|
|
421
421
|
|
|
422
|
-
async function getAccessPermission(app, appId,
|
|
423
|
-
const cacheKey =
|
|
422
|
+
async function getAccessPermission(app, appId, pageId) {
|
|
423
|
+
const cacheKey = `${appId}-${pageId}`;
|
|
424
424
|
if (_AUTH_CACHE_MAP[cacheKey] !== undefined) {
|
|
425
425
|
return _AUTH_CACHE_MAP[cacheKey];
|
|
426
426
|
}
|
|
@@ -482,19 +482,7 @@ export async function checkAuth(app, appId, $page) {
|
|
|
482
482
|
return true;
|
|
483
483
|
}
|
|
484
484
|
wx.showNavigationBarLoading();
|
|
485
|
-
|
|
486
|
-
if ($page.packageName) {
|
|
487
|
-
if ($page.__internal__.subAppId) {
|
|
488
|
-
subAppId = $page.__internal__.subAppId
|
|
489
|
-
} else {
|
|
490
|
-
const matched = $page.packageName.match(/packages\/(.*)$/);
|
|
491
|
-
if (matched?.[1]) {
|
|
492
|
-
subAppId = `sub-${matched[1]}`
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
const requestList = [getAccessPermission(app, appId, subAppId, $page.id)];
|
|
485
|
+
const requestList = [getAccessPermission(app, appId, $page.id)];
|
|
498
486
|
// 暂时先认为有登录页则自定义登录功能开启且生效
|
|
499
487
|
if (loginPage) {
|
|
500
488
|
requestList.push(getAuthConfig(app));
|
|
@@ -553,7 +541,6 @@ export function redirectToLogin(currentPage) {
|
|
|
553
541
|
app.redirectTo({
|
|
554
542
|
pageId: loginPage.id,
|
|
555
543
|
params: {
|
|
556
|
-
packageName: currentPage.packageName || undefined,
|
|
557
544
|
sourcePageId: currentPage.id,
|
|
558
545
|
sourcePageParams: currentPage.params || currentPage.dataset?.params,
|
|
559
546
|
},
|
package/template/mp/page/api.js
CHANGED
|
@@ -2,10 +2,8 @@ import { $w as baseAPI } from '<%= subLevelPath %>../../app/weapps-api'
|
|
|
2
2
|
|
|
3
3
|
export const $page = {
|
|
4
4
|
__internal__: {
|
|
5
|
-
active: false
|
|
6
|
-
subAppId: '<%= subAppId %>',
|
|
5
|
+
active: false
|
|
7
6
|
},
|
|
8
|
-
packageName: '<%= packageName %>',
|
|
9
7
|
uuid: '<%= uuid %>',
|
|
10
8
|
label: '<%= label %>',
|
|
11
9
|
|