Skip to content

Commit

Permalink
be: qr width
Browse files Browse the repository at this point in the history
  • Loading branch information
getrebuild committed Dec 8, 2023
1 parent e46b6c1 commit c8d7341
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ public static BufferedImage createBarCode(String content, int width, int height,
protected static BitMatrix createBarCodeImage(String content, BarcodeFormat format, int width, int height) {
Map<EncodeHintType, Object> hints = new HashMap<>();
hints.put(EncodeHintType.CHARACTER_SET, AppUtils.UTF8);
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L); // 高级别导致空白边框???
hints.put(EncodeHintType.MARGIN, 0);
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
hints.put(EncodeHintType.MARGIN, 1);

try {
if (format == BarcodeFormat.QR_CODE) {
width = height = Math.max(width, height);
if (width <= 0) width = height = 80;
if (width <= 0) width = height = 120;

} else {
final int base = 64;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/web/assets/js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $(document).ready(() => {
}, 200)
}

$('.h5-mobile img').attr('src', `${rb.baseUrl}/commons/barcode/render-qr?w=150&t=${$encode($('.h5-mobile a').attr('href'))}`)
$('.h5-mobile img').attr('src', `${rb.baseUrl}/commons/barcode/render-qr?w=296&t=${$encode($('.h5-mobile a').attr('href'))}`)

$.get('/user/live-wallpaper', (res) => {
if (res.error_code !== 0 || !res.data) return
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/web/assets/js/rb-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -2389,7 +2389,7 @@ class RbFormBarcode extends RbFormElement {
onClick={() => {
RbAlert.create(
<div className="mb-4">
<img src={`${codeUrl}&w=${isbar ? 64 * 2 : 80 * 2.5}`} alt={this.state.value} />
<img src={`${codeUrl}&w=${isbar ? 64 * 2 : 80 * 3}`} alt={this.state.value} style={{ maxWidth: '100%' }} />
{!isbar && <div className="text-muted mt-3 mb-1 text-break">{this.state.value}</div>}
</div>,
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/web/signup/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
<span class="up-1">[[${bundle.L('手机版')}]]</span>
</a>
<div class="dropdown-menu shadow-lg">
<div class="p-1">
<div>
<img class="w-100" alt="Mobile QR" />
</div>
</div>
Expand Down

0 comments on commit c8d7341

Please sign in to comment.