uview-plus 3.6.29 → 3.7.13
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/README.md +20 -5
- package/changelog.md +352 -0
- package/components/u-action-sheet/actionSheet.js +2 -0
- package/components/u-action-sheet/props.js +10 -0
- package/components/u-action-sheet/u-action-sheet.vue +3 -3
- package/components/u-album/album.js +1 -1
- package/components/u-avatar/avatar.js +4 -4
- package/components/u-avatar-group/avatarGroup.js +4 -4
- package/components/u-back-top/backtop.js +4 -4
- package/components/u-badge/badge.js +4 -4
- package/components/u-box/box.js +24 -0
- package/components/u-box/props.js +37 -7
- package/components/u-box/u-box.vue +29 -14
- package/components/u-button/button.js +4 -4
- package/components/u-calendar/calendar.js +4 -4
- package/components/u-canvas/u-canvas.vue +423 -0
- package/components/u-car-keyboard/carKeyboard.js +4 -4
- package/components/u-cascader/u-cascader.vue +19 -10
- package/components/u-cate-tab/u-cate-tab.vue +14 -4
- package/components/u-cell/cell.js +4 -4
- package/components/u-cell-group/cellGroup.js +4 -4
- package/components/u-checkbox/checkbox.js +4 -4
- package/components/u-checkbox-group/checkboxGroup.js +4 -4
- package/components/u-checkbox-group/u-checkbox-group.vue +4 -1
- package/components/u-circle-progress/circleProgress.js +4 -4
- package/components/u-code/code.js +3 -3
- package/components/u-code-input/codeInput.js +4 -4
- package/components/u-col/col.js +4 -4
- package/components/u-collapse/collapse.js +4 -4
- package/components/u-collapse-item/collapseItem.js +4 -4
- package/components/u-column-notice/columnNotice.js +4 -4
- package/components/u-count-down/countDown.js +4 -4
- package/components/u-count-to/countTo.js +4 -4
- package/components/u-cropper/u-cropper.vue +6 -3
- package/components/u-datetime-picker/datetimePicker.js +4 -4
- package/components/u-divider/divider.js +4 -4
- package/components/u-dragsort/u-dragsort.vue +85 -72
- package/components/u-empty/empty.js +4 -4
- package/components/u-form/form.js +4 -4
- package/components/u-form-item/formItem.js +4 -4
- package/components/u-gap/gap.js +4 -4
- package/components/u-grid/grid.js +4 -4
- package/components/u-grid/u-grid.vue +1 -1
- package/components/u-grid-item/gridItem.js +4 -4
- package/components/u-icon/icon.js +4 -4
- package/components/u-image/image.js +4 -4
- package/components/u-index-anchor/indexAnchor.js +4 -4
- package/components/u-index-list/indexList.js +4 -4
- package/components/u-input/input.js +1 -1
- package/components/u-input/u-input.vue +5 -2
- package/components/u-keyboard/keyboard.js +4 -4
- package/components/u-line/line.js +4 -4
- package/components/u-line-progress/lineProgress.js +4 -4
- package/components/u-link/link.js +4 -4
- package/components/u-list/list.js +4 -4
- package/components/u-list/u-list.vue +4 -1
- package/components/u-list-item/listItem.js +4 -4
- package/components/u-loading-icon/loadingIcon.js +4 -4
- package/components/u-loading-page/loadingPage.js +4 -4
- package/components/u-loadmore/loadmore.js +4 -4
- package/components/u-modal/modal.js +5 -5
- package/components/u-navbar/navbar.js +4 -4
- package/components/u-no-network/noNetwork.js +4 -4
- package/components/u-no-network/u-no-network.vue +7 -3
- package/components/u-notice-bar/noticeBar.js +4 -4
- package/components/u-notify/notify.js +4 -4
- package/components/u-number-box/numberBox.js +4 -4
- package/components/u-number-keyboard/numberKeyboard.js +4 -4
- package/components/u-overlay/overlay.js +4 -4
- package/components/u-parse/props.js +1 -1
- package/components/u-picker/picker.js +4 -4
- package/components/u-picker/props.js +4 -0
- package/components/u-picker/u-picker.vue +1 -1
- package/components/u-popup/popup.js +4 -4
- package/components/u-qrcode/qrcode.js +17 -67
- package/components/u-qrcode/u-qrcode.vue +179 -86
- package/components/u-radio/radio.js +4 -4
- package/components/u-radio-group/radioGroup.js +3 -3
- package/components/u-rate/rate.js +4 -4
- package/components/u-read-more/readMore.js +4 -4
- package/components/u-row/row.js +4 -4
- package/components/u-row-notice/rowNotice.js +4 -4
- package/components/u-scroll-list/scrollList.js +4 -4
- package/components/u-search/search.js +7 -5
- package/components/u-search/u-search.vue +2 -2
- package/components/u-section/section.js +4 -4
- package/components/u-select/u-select.vue +7 -1
- package/components/u-signature/u-signature.vue +138 -137
- package/components/u-skeleton/skeleton.js +4 -4
- package/components/u-slider/props.js +17 -2
- package/components/u-slider/slider.js +10 -7
- package/components/u-slider/u-slider.vue +112 -35
- package/components/u-status-bar/statusBar.js +4 -4
- package/components/u-steps/steps.js +4 -4
- package/components/u-steps/u-steps.vue +1 -1
- package/components/u-steps-item/stepsItem.js +4 -4
- package/components/u-sticky/sticky.js +4 -4
- package/components/u-subsection/subsection.js +4 -4
- package/components/u-swipe-action/swipeAction.js +4 -4
- package/components/u-swipe-action-item/swipeActionItem.js +4 -4
- package/components/u-swiper/swiper.js +4 -4
- package/components/u-swiper-indicator/swipterIndicator.js +4 -4
- package/components/u-switch/switch.js +4 -4
- package/components/u-tabbar/tabbar.js +4 -4
- package/components/u-tabbar-item/tabbarItem.js +4 -4
- package/components/u-tabs/tabs.js +4 -4
- package/components/u-tabs/u-tabs.vue +83 -95
- package/components/u-tag/tag.js +4 -4
- package/components/u-text/text.js +4 -4
- package/components/u-textarea/textarea.js +4 -4
- package/components/u-toast/toast.js +4 -4
- package/components/u-toolbar/toolbar.js +4 -4
- package/components/u-tooltip/tooltip.js +4 -4
- package/components/u-transition/transition.js +4 -4
- package/components/u-upload/upload.js +4 -4
- package/libs/css/flex.scss +2 -1
- package/libs/function/index.js +9 -4
- package/libs/util/gcanvas/bridge/bridge-weex.js +2 -1
- package/libs/util/gcanvas/env/image.js +24 -16
- package/package.json +2 -4
- package/types/comps/radio.d.ts +6 -2
- package/types/func.d.ts +317 -0
- package/types/index.d.ts +73 -105
- package/components/u-scroll-list/other.js +0 -0
|
@@ -18,6 +18,7 @@ let QRCode = {};
|
|
|
18
18
|
return [c0, c1];
|
|
19
19
|
// 3 bytes
|
|
20
20
|
} else {
|
|
21
|
+
|
|
21
22
|
c0 = 224 + (code >> 12);
|
|
22
23
|
c1 = 128 + (code >> 6 & 63);
|
|
23
24
|
c2 = 128 + (code & 63);
|
|
@@ -1031,15 +1032,14 @@ let QRCode = {};
|
|
|
1031
1032
|
image: '',
|
|
1032
1033
|
imageSize: 30,
|
|
1033
1034
|
canvasId: opt.canvasId,
|
|
1034
|
-
|
|
1035
|
-
|
|
1035
|
+
ctx: opt.ctx,
|
|
1036
|
+
isNvue: opt.isNvue,
|
|
1037
|
+
vuectx: opt.vuectx,
|
|
1036
1038
|
usingComponents: opt.usingComponents,
|
|
1037
1039
|
showLoading: opt.showLoading,
|
|
1038
1040
|
loadingText: opt.loadingText,
|
|
1039
1041
|
};
|
|
1040
1042
|
|
|
1041
|
-
let canvas = null;
|
|
1042
|
-
|
|
1043
1043
|
if (typeof opt === 'string') { // 只编码ASCII字符串
|
|
1044
1044
|
opt = {
|
|
1045
1045
|
text: opt
|
|
@@ -1087,21 +1087,6 @@ let QRCode = {};
|
|
|
1087
1087
|
return options.foreground;
|
|
1088
1088
|
}
|
|
1089
1089
|
|
|
1090
|
-
let getCanvas = async (id) => {
|
|
1091
|
-
return new Promise((resolve, reject)=>{
|
|
1092
|
-
try {
|
|
1093
|
-
const query = uni.createSelectorQuery().in(this.options.context);
|
|
1094
|
-
query.select(`#${id}`)
|
|
1095
|
-
.fields({ node: true, size: true })
|
|
1096
|
-
.exec((res) => {
|
|
1097
|
-
resolve(res[0].node)
|
|
1098
|
-
})
|
|
1099
|
-
}
|
|
1100
|
-
catch (e) {
|
|
1101
|
-
console.error("createCanvasContextFail",e)
|
|
1102
|
-
}
|
|
1103
|
-
})
|
|
1104
|
-
}
|
|
1105
1090
|
// 创建canvas
|
|
1106
1091
|
let createCanvas = async function (options) {
|
|
1107
1092
|
let isApp = false;
|
|
@@ -1116,28 +1101,7 @@ let QRCode = {};
|
|
|
1116
1101
|
});
|
|
1117
1102
|
}
|
|
1118
1103
|
var ctx = '';
|
|
1119
|
-
|
|
1120
|
-
ctx = options.nvueContext;
|
|
1121
|
-
}
|
|
1122
|
-
else {
|
|
1123
|
-
// 获取canvas node节点
|
|
1124
|
-
canvas = await getCanvas(options.canvasId);
|
|
1125
|
-
// #ifdef MP
|
|
1126
|
-
// 不清楚是小程序的bug还是什么原因,canvas的node节点宽高和设置的宽高不一致 重新设置下
|
|
1127
|
-
canvas.width = options.size;
|
|
1128
|
-
canvas.height = options.size;
|
|
1129
|
-
// #endif
|
|
1130
|
-
// #ifdef APP
|
|
1131
|
-
ctx = uni.createCanvasContext(options.canvasId, options.context);
|
|
1132
|
-
// #endif
|
|
1133
|
-
// #ifndef APP
|
|
1134
|
-
ctx = canvas.getContext('2d');
|
|
1135
|
-
// #endif
|
|
1136
|
-
|
|
1137
|
-
}
|
|
1138
|
-
// 设置组件中data里面的ctx
|
|
1139
|
-
options.context.ctx = ctx;
|
|
1140
|
-
options.context.canvas = canvas;
|
|
1104
|
+
ctx = options.ctx;
|
|
1141
1105
|
|
|
1142
1106
|
var count = qrCodeAlg.getModuleCount();
|
|
1143
1107
|
var ratioSize = options.size;
|
|
@@ -1156,7 +1120,7 @@ let QRCode = {};
|
|
|
1156
1120
|
count: count,
|
|
1157
1121
|
options: options
|
|
1158
1122
|
});
|
|
1159
|
-
if (options.
|
|
1123
|
+
if (options.isNvue) {
|
|
1160
1124
|
ctx.setFillStyle(qrCodeAlg.modules[row][col] ? foreground : options.background);
|
|
1161
1125
|
} else {
|
|
1162
1126
|
ctx.fillStyle = qrCodeAlg.modules[row][col] ? foreground : options.background;
|
|
@@ -1168,26 +1132,10 @@ let QRCode = {};
|
|
|
1168
1132
|
var x = Number(((ratioSize - ratioImgSize) / 2).toFixed(2));
|
|
1169
1133
|
var y = Number(((ratioSize - ratioImgSize) / 2).toFixed(2));
|
|
1170
1134
|
drawRoundedRect(ctx, x, y, ratioImgSize, ratioImgSize, 2, 6, true, true)
|
|
1171
|
-
|
|
1172
|
-
ctx.drawImage(options.image, x, y, ratioImgSize, ratioImgSize);
|
|
1173
|
-
}
|
|
1174
|
-
else {
|
|
1175
|
-
// #ifdef H5 || APP
|
|
1176
|
-
const img = new Image();
|
|
1177
|
-
// #endif
|
|
1178
|
-
|
|
1179
|
-
// #ifndef H5 || APP
|
|
1180
|
-
const img = canvas.createImage();
|
|
1181
|
-
// #endif
|
|
1182
|
-
|
|
1183
|
-
img.onload = () => {
|
|
1184
|
-
ctx.drawImage(img, x, y, ratioImgSize, ratioImgSize);
|
|
1185
|
-
};
|
|
1186
|
-
img.src = options.image;
|
|
1187
|
-
}
|
|
1135
|
+
options.vuectx.drawImage(options.image, x, y, ratioImgSize, ratioImgSize);
|
|
1188
1136
|
// 画圆角矩形
|
|
1189
1137
|
function drawRoundedRect(ctxi, x, y, width, height, r, lineWidth, fill, stroke) {
|
|
1190
|
-
if (options.
|
|
1138
|
+
if (options.isNvue || isApp) {
|
|
1191
1139
|
ctxi.setLineWidth(lineWidth);
|
|
1192
1140
|
ctxi.setFillStyle(options.background);
|
|
1193
1141
|
ctxi.setStrokeStyle(options.background);
|
|
@@ -1222,11 +1170,11 @@ let QRCode = {};
|
|
|
1222
1170
|
}
|
|
1223
1171
|
setTimeout(() => {
|
|
1224
1172
|
// canvas2 绘制是自动的不需要手动绘制
|
|
1225
|
-
if(options.
|
|
1173
|
+
if(options.isNvue || isApp){
|
|
1226
1174
|
ctx.draw(true, () => {
|
|
1227
1175
|
// 保存到临时区域
|
|
1228
1176
|
setTimeout(() => {
|
|
1229
|
-
if (options.
|
|
1177
|
+
if (options.isNvue) {
|
|
1230
1178
|
ctx.toTempFilePath(
|
|
1231
1179
|
0,
|
|
1232
1180
|
0,
|
|
@@ -1251,6 +1199,7 @@ let QRCode = {};
|
|
|
1251
1199
|
canvasId: options.canvasId,
|
|
1252
1200
|
quality: Number(1),
|
|
1253
1201
|
success: function (res) {
|
|
1202
|
+
// console.log('绘制成功', res)
|
|
1254
1203
|
if (options.cbResult) {
|
|
1255
1204
|
// 由于官方还没有统一此接口的输出字段,所以先判定下 支付宝为 res.apFilePath
|
|
1256
1205
|
if (!empty(res.tempFilePath)) {
|
|
@@ -1263,6 +1212,7 @@ let QRCode = {};
|
|
|
1263
1212
|
}
|
|
1264
1213
|
},
|
|
1265
1214
|
fail: function (res) {
|
|
1215
|
+
console.log('绘制失败', res)
|
|
1266
1216
|
if (options.cbResult) {
|
|
1267
1217
|
options.cbResult(res)
|
|
1268
1218
|
}
|
|
@@ -1270,7 +1220,7 @@ let QRCode = {};
|
|
|
1270
1220
|
complete: function () {
|
|
1271
1221
|
uni.hideLoading();
|
|
1272
1222
|
},
|
|
1273
|
-
}, options.
|
|
1223
|
+
}, options.vuectx);
|
|
1274
1224
|
}
|
|
1275
1225
|
}, options.text.length + 100);
|
|
1276
1226
|
});
|
|
@@ -1279,7 +1229,7 @@ let QRCode = {};
|
|
|
1279
1229
|
options.cbResult("")
|
|
1280
1230
|
}
|
|
1281
1231
|
|
|
1282
|
-
}, options.usingComponents ?
|
|
1232
|
+
}, options.usingComponents ? 100 : 200);
|
|
1283
1233
|
}
|
|
1284
1234
|
createCanvas(this.options);
|
|
1285
1235
|
// 空判定
|
|
@@ -1302,10 +1252,10 @@ let QRCode = {};
|
|
|
1302
1252
|
};
|
|
1303
1253
|
QRCode.prototype.clear = function (fn) {
|
|
1304
1254
|
var ctx = '';
|
|
1305
|
-
if (options.
|
|
1306
|
-
ctx = options.
|
|
1255
|
+
if (options.isNvue) {
|
|
1256
|
+
ctx = options.ctx;
|
|
1307
1257
|
} else {
|
|
1308
|
-
uni.createCanvasContext(this.options.canvasId, this.options.
|
|
1258
|
+
uni.createCanvasContext(this.options.canvasId, this.options.vuectx)
|
|
1309
1259
|
}
|
|
1310
1260
|
ctx.clearRect(0, 0, this.options.size, this.options.size)
|
|
1311
1261
|
ctx.draw(false, () => {
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
}"
|
|
8
8
|
@longpress="longpress">
|
|
9
9
|
<view class="u-qrcode__content" @click="preview">
|
|
10
|
-
|
|
11
|
-
<!-- #ifndef APP-NVUE || APP-PLUS -->
|
|
10
|
+
<!-- #ifdef MP || H5 -->
|
|
12
11
|
<canvas
|
|
13
12
|
class="u-qrcode__canvas"
|
|
14
13
|
:id="cid"
|
|
@@ -25,17 +24,12 @@
|
|
|
25
24
|
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }" />
|
|
26
25
|
<!-- #endif -->
|
|
27
26
|
|
|
28
|
-
<!-- #ifdef APP-PLUS -->
|
|
29
|
-
<canvas
|
|
30
|
-
class="u-qrcode__canvas"
|
|
31
|
-
:id="cid"
|
|
32
|
-
:canvas-id="cid"
|
|
33
|
-
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }" />
|
|
34
|
-
<!-- #endif -->
|
|
35
|
-
|
|
36
27
|
<!-- #ifdef APP-NVUE -->
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
<web-view v-if="icon != ''" ref="web" src="/static/app-plus/up-canvas/local.html"
|
|
29
|
+
:style="'width:' + sizeLocal + 'px;height:' + sizeLocal + 'px'"
|
|
30
|
+
@onPostMessage="_onMessage" />
|
|
31
|
+
<gcanvas v-else class="u-qrcode__canvas" ref="gcanvess"
|
|
32
|
+
:style="{ width: sizeLocal + unit, height: sizeLocal + unit }">
|
|
39
33
|
</gcanvas>
|
|
40
34
|
<!-- #endif -->
|
|
41
35
|
<view v-if="showLoading && loading" class="u-qrcode__loading"
|
|
@@ -49,20 +43,27 @@
|
|
|
49
43
|
|
|
50
44
|
<script>
|
|
51
45
|
import QRCode from "./qrcode.js"
|
|
46
|
+
import { sleep } from '../../libs/function/index';
|
|
52
47
|
// #ifdef APP-NVUE
|
|
53
48
|
// https://github.com/dcloudio/NvueCanvasDemo/blob/master/README.md
|
|
54
49
|
import {
|
|
55
50
|
enable,
|
|
56
|
-
WeexBridge
|
|
51
|
+
WeexBridge,
|
|
52
|
+
Image as GImage
|
|
57
53
|
} from '../../libs/util/gcanvas/index.js';
|
|
54
|
+
import { nextTick } from "vue";
|
|
58
55
|
// #endif
|
|
59
56
|
let qrcode
|
|
57
|
+
// 20260201不能在data中存储canvas,否则会导致在微信小程序getContext获取不到canvas对象报错Cannot read property 'type'
|
|
58
|
+
let canvas = null
|
|
60
59
|
export default {
|
|
61
60
|
name: "u-qrcode",
|
|
62
61
|
props: {
|
|
63
62
|
cid: {
|
|
64
63
|
type: String,
|
|
65
|
-
default: () =>
|
|
64
|
+
default: () => {
|
|
65
|
+
return `u-qrcode-canvas${Math.floor(Math.random() * 1000000)}`
|
|
66
|
+
}
|
|
66
67
|
},
|
|
67
68
|
size: {
|
|
68
69
|
type: Number,
|
|
@@ -134,7 +135,7 @@ export default {
|
|
|
134
135
|
default: () => false
|
|
135
136
|
},
|
|
136
137
|
},
|
|
137
|
-
emits: ['result', 'longpressCallback'],
|
|
138
|
+
emits: ['preview', 'result', 'longpressCallback'],
|
|
138
139
|
data() {
|
|
139
140
|
return {
|
|
140
141
|
loading: false,
|
|
@@ -147,11 +148,10 @@ export default {
|
|
|
147
148
|
],
|
|
148
149
|
rootId: `rootId${Number(Math.random() * 100).toFixed(0)}`,
|
|
149
150
|
ganvas: null,
|
|
150
|
-
context: '',
|
|
151
151
|
canvasObj: {},
|
|
152
152
|
sizeLocal: this.size,
|
|
153
|
-
ctx: null,
|
|
154
|
-
|
|
153
|
+
ctx: null,
|
|
154
|
+
_ready: false
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
157
|
async mounted(){
|
|
@@ -159,17 +159,18 @@ export default {
|
|
|
159
159
|
if(this.useRootHeightAndWidth){
|
|
160
160
|
await this.setNewSize()
|
|
161
161
|
}
|
|
162
|
+
canvas = await this.getCanvasNode(this.cid)
|
|
162
163
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
164
|
+
if (!canvas) return
|
|
165
|
+
// #ifdef MP
|
|
166
|
+
// 不清楚是小程序的bug还是什么原因,canvas的node节点宽高和设置的宽高不一致 重新设置下
|
|
167
|
+
canvas.width = this.sizeLocal
|
|
168
|
+
canvas.height = this.sizeLocal
|
|
169
|
+
// #endif
|
|
170
|
+
// #ifdef APP-PLUS-NVUE
|
|
171
|
+
this.isNvue = true
|
|
172
|
+
// #endif
|
|
173
|
+
this.ctx = this.getUPCanvasContext('2d')
|
|
173
174
|
|
|
174
175
|
if (this.loadMake) {
|
|
175
176
|
if (!this._empty(this.val)) {
|
|
@@ -182,31 +183,52 @@ export default {
|
|
|
182
183
|
}
|
|
183
184
|
},
|
|
184
185
|
methods: {
|
|
186
|
+
_onMessage(e) {
|
|
187
|
+
// console.log('post message', e)
|
|
188
|
+
const message = e.detail.data[0]
|
|
189
|
+
switch (message.action) {
|
|
190
|
+
// web-view 初始化完毕
|
|
191
|
+
case 'onJSBridgeReady':
|
|
192
|
+
this._ready = true
|
|
193
|
+
this.$refs.web.evalJs('setContent('+JSON.stringify(this.$props) +')')
|
|
194
|
+
break
|
|
195
|
+
// qrcodeOk
|
|
196
|
+
case 'qrcodeOk':
|
|
197
|
+
this._result(message.imageData)
|
|
198
|
+
// this.$emit('load')
|
|
199
|
+
break
|
|
200
|
+
}
|
|
201
|
+
},
|
|
185
202
|
_makeCode() {
|
|
186
203
|
let that = this
|
|
204
|
+
if (!canvas) return
|
|
187
205
|
if (!this._empty(this.val)) {
|
|
188
206
|
// #ifndef APP-NVUE
|
|
189
207
|
this.loading = true
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
// #endif
|
|
209
|
+
// nvue下时因为gcanvas的GImage不生效,因此icon模式会采用webview
|
|
210
|
+
if ((this.icon == '' && that.isNvue) || !that.isNvue) {
|
|
211
|
+
qrcode = new QRCode({
|
|
212
|
+
vuectx: that, // 上下文环境
|
|
213
|
+
canvasId: that.cid, // canvas-id
|
|
214
|
+
ctx: that.ctx,
|
|
215
|
+
isNvue: that.isNvue,
|
|
216
|
+
usingComponents: that.usingComponents, // 是否是自定义组件
|
|
217
|
+
showLoading: false, // 是否显示loading
|
|
218
|
+
loadingText: that.loadingText, // loading文字
|
|
219
|
+
text: that.val, // 生成内容
|
|
220
|
+
size: that.sizeLocal, // 二维码大小
|
|
221
|
+
background: that.background, // 背景色
|
|
222
|
+
foreground: that.foreground, // 前景色
|
|
223
|
+
pdground: that.pdground, // 定位角点颜色
|
|
224
|
+
correctLevel: that.lv, // 容错级别
|
|
225
|
+
image: that.icon, // 二维码图标
|
|
226
|
+
imageSize: that.iconSize,// 二维码图标大小
|
|
227
|
+
cbResult: function (res) { // 生成二维码的回调
|
|
228
|
+
that._result(res)
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
}
|
|
210
232
|
} else {
|
|
211
233
|
uni.showToast({
|
|
212
234
|
title: '二维码内容不能为空',
|
|
@@ -232,7 +254,25 @@ export default {
|
|
|
232
254
|
});
|
|
233
255
|
}
|
|
234
256
|
});
|
|
235
|
-
}
|
|
257
|
+
} else {
|
|
258
|
+
this.toTempFilePath({
|
|
259
|
+
success: res => {
|
|
260
|
+
that.result = res.tempFilePath
|
|
261
|
+
uni.saveImageToPhotosAlbum({
|
|
262
|
+
filePath: that.result,
|
|
263
|
+
success: function () {
|
|
264
|
+
uni.showToast({
|
|
265
|
+
title: '二维码保存成功',
|
|
266
|
+
icon: 'success',
|
|
267
|
+
duration: 2000
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
},
|
|
272
|
+
fail: err => {
|
|
273
|
+
}
|
|
274
|
+
})
|
|
275
|
+
}
|
|
236
276
|
},
|
|
237
277
|
preview(e) {
|
|
238
278
|
// 预览图片
|
|
@@ -261,7 +301,7 @@ export default {
|
|
|
261
301
|
}, e)
|
|
262
302
|
},
|
|
263
303
|
async toTempFilePath({success, fail}) {
|
|
264
|
-
if (this.
|
|
304
|
+
if (this.ct) {
|
|
265
305
|
this.ctx.toTempFilePath(
|
|
266
306
|
0,
|
|
267
307
|
0,
|
|
@@ -277,13 +317,13 @@ export default {
|
|
|
277
317
|
);
|
|
278
318
|
}
|
|
279
319
|
else {
|
|
280
|
-
// #ifdef
|
|
320
|
+
// #ifdef H5
|
|
281
321
|
success({
|
|
282
322
|
tempFilePath: this.ctx.canvas.toDataURL("image/png", 1)
|
|
283
323
|
})
|
|
284
324
|
// #endif
|
|
285
325
|
|
|
286
|
-
// #
|
|
326
|
+
// #ifndef H5
|
|
287
327
|
uni.canvasToTempFilePath(
|
|
288
328
|
{
|
|
289
329
|
canvasId: this.cid,
|
|
@@ -294,19 +334,6 @@ export default {
|
|
|
294
334
|
},
|
|
295
335
|
this)
|
|
296
336
|
// #endif
|
|
297
|
-
|
|
298
|
-
// #ifndef MP-TOUTIAO || H5 || APP-PLUS
|
|
299
|
-
const canvas = await this.getNode(this.cid,true);
|
|
300
|
-
uni.canvasToTempFilePath(
|
|
301
|
-
{
|
|
302
|
-
canvas,
|
|
303
|
-
success :res => {
|
|
304
|
-
success(res)
|
|
305
|
-
},
|
|
306
|
-
fail: fail
|
|
307
|
-
},
|
|
308
|
-
this)
|
|
309
|
-
// #endif
|
|
310
337
|
}
|
|
311
338
|
},
|
|
312
339
|
async longpress() {
|
|
@@ -324,7 +351,7 @@ export default {
|
|
|
324
351
|
* @return {Promise<void>}
|
|
325
352
|
*/
|
|
326
353
|
async setNewSize(){
|
|
327
|
-
const rootNode = await this.
|
|
354
|
+
const rootNode = await this.getCanvasNode(this.rootId, false);
|
|
328
355
|
const { width , height } = rootNode;
|
|
329
356
|
// 将最短的设置为二维码 的size
|
|
330
357
|
if(width > height){
|
|
@@ -341,27 +368,93 @@ export default {
|
|
|
341
368
|
* @param isCanvas 是否为Canvas节点
|
|
342
369
|
* @return {Promise<unknown>}
|
|
343
370
|
*/
|
|
344
|
-
async
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
371
|
+
async getCanvasNode(id, isCanvas = true) {
|
|
372
|
+
let that = this
|
|
373
|
+
return new Promise((resolve, reject) => {
|
|
374
|
+
try {
|
|
375
|
+
// #ifdef APP-NVUE
|
|
376
|
+
setTimeout(() => {
|
|
377
|
+
/*获取元素引用*/
|
|
378
|
+
this.ganvas = this.$refs["gcanvess"]
|
|
379
|
+
/*通过元素引用获取canvas对象*/
|
|
380
|
+
let canvasNode = enable(this.ganvas, {
|
|
381
|
+
bridge: WeexBridge
|
|
382
|
+
})
|
|
383
|
+
resolve(canvasNode)
|
|
384
|
+
}, 200)
|
|
385
|
+
// #endif
|
|
386
|
+
// #ifndef APP-PLUS-NVUE
|
|
387
|
+
const query = uni.createSelectorQuery().in(that).select(`#${id}`);
|
|
388
|
+
query.fields({
|
|
389
|
+
node: true,
|
|
390
|
+
size: true
|
|
391
|
+
})
|
|
392
|
+
.exec((res) => {
|
|
393
|
+
if (isCanvas) {
|
|
394
|
+
if (res[0]?.node) {
|
|
395
|
+
resolve(res[0].node)
|
|
396
|
+
} else {
|
|
397
|
+
resolve(false)
|
|
398
|
+
console.error("获取节点出错", res)
|
|
399
|
+
}
|
|
400
|
+
} else {
|
|
401
|
+
resolve(res[0])
|
|
402
|
+
}
|
|
403
|
+
})
|
|
404
|
+
// #endif
|
|
405
|
+
} catch (e) {
|
|
406
|
+
console.error("获取节点失败", e)
|
|
407
|
+
}
|
|
408
|
+
})
|
|
364
409
|
},
|
|
410
|
+
getUPCanvasContext() {
|
|
411
|
+
// #ifdef APP-PLUS
|
|
412
|
+
return uni.createCanvasContext(this.cid, this);
|
|
413
|
+
// #endif
|
|
414
|
+
// #ifdef APP-PLUS-NVUE || MP || H5
|
|
415
|
+
return canvas.getContext('2d');
|
|
416
|
+
// #endif
|
|
417
|
+
},
|
|
418
|
+
drawImage(url, x, y, w, h) {
|
|
419
|
+
try {
|
|
420
|
+
let img = {}
|
|
421
|
+
// #ifdef APP-NVUE
|
|
422
|
+
img = new GImage();
|
|
423
|
+
// #endif
|
|
424
|
+
|
|
425
|
+
// #ifdef H5
|
|
426
|
+
// APP下不支持会一直卡住
|
|
427
|
+
img = new Image();
|
|
428
|
+
// #endif
|
|
429
|
+
|
|
430
|
+
// #ifdef MP
|
|
431
|
+
// 小程序2d
|
|
432
|
+
// https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImage.html
|
|
433
|
+
img = canvas.createImage();
|
|
434
|
+
// #endif
|
|
435
|
+
// #ifdef APP-NVUE
|
|
436
|
+
let that = this
|
|
437
|
+
// console.log(img)
|
|
438
|
+
img.onload = function(){
|
|
439
|
+
if (process.env.NODE_ENV === 'development') {
|
|
440
|
+
console.log('drawImage绘制2...')
|
|
441
|
+
}
|
|
442
|
+
that.cxt.drawImage(img, x, y, w, h);
|
|
443
|
+
}
|
|
444
|
+
// #endif
|
|
445
|
+
// #ifdef H5 || MP
|
|
446
|
+
img.onload = () => {
|
|
447
|
+
this.ctx.drawImage(img, x, y, w, h);
|
|
448
|
+
};
|
|
449
|
+
// #endif
|
|
450
|
+
img.src = url;
|
|
451
|
+
// #ifdef APP-VUE
|
|
452
|
+
this.ctx.drawImage(url, x, y, w, h);
|
|
453
|
+
// #endif
|
|
454
|
+
} catch (error) {
|
|
455
|
+
console.log('drawImage绘制出错', error)
|
|
456
|
+
}
|
|
457
|
+
},
|
|
365
458
|
|
|
366
459
|
selectClick(index) {
|
|
367
460
|
switch (index) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/radio.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// radio组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
6
|
* @LastAuthor : CPS
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/radioGroup.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// radio-group组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-18 22:43:09
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/rate.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// rate组件
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/readMore.js
|
|
9
9
|
*/
|
|
10
10
|
import { t } from '../../libs/i18n'
|
|
11
11
|
export default {
|
package/components/u-row/row.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/row.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// row
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/rowNotice.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// rowNotice
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author : LQ
|
|
3
3
|
* @Description :
|
|
4
|
-
* @version :
|
|
4
|
+
* @version : 3.0
|
|
5
5
|
* @Date : 2021-08-20 16:44:21
|
|
6
|
-
* @LastAuthor :
|
|
7
|
-
* @lastTime :
|
|
8
|
-
* @FilePath : /
|
|
6
|
+
* @LastAuthor : jry
|
|
7
|
+
* @lastTime : 2025-12-19 08:55:21
|
|
8
|
+
* @FilePath : /uview-plus/libs/config/props/scrollList.js
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
// scrollList
|