Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b02a848c0 | |||
| bde2d35756 |
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.0.46] - 2026-06-15
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
- 微信内打开商品页时顶部标题栏显示商品名称,不再显示"岩美"
|
||||||
|
|
||||||
|
## [1.0.45] - 2026-06-15
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
- 修复微信分享卡片标题仍显示"岩美"的问题(HTML 缩进导致字符串匹配失败)
|
||||||
|
- 微信分享卡片描述去掉"扫码验真"后缀
|
||||||
|
|
||||||
## [1.0.44] - 2026-06-15
|
## [1.0.44] - 2026-06-15
|
||||||
|
|
||||||
### 改进
|
### 改进
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"html"
|
"html"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -315,7 +316,9 @@ func (h *PublicHandler) ProductPage(c *gin.Context) {
|
|||||||
ogTags := buildProductOG(product, shopName, config.C.Storage.PublicURL)
|
ogTags := buildProductOG(product, shopName, config.C.Storage.PublicURL)
|
||||||
ogTitle := buildOGTitle(product)
|
ogTitle := buildOGTitle(product)
|
||||||
// 同时替换 <title> 标签,微信/飞书等平台有时优先读 <title> 而非 og:title
|
// 同时替换 <title> 标签,微信/飞书等平台有时优先读 <title> 而非 og:title
|
||||||
out := strings.Replace(idxHTML, "<title>岩美</title>", "<title>"+html.EscapeString(ogTitle)+"</title>", 1)
|
// 用正则替换避免缩进空格导致字符串不匹配
|
||||||
|
titleRe := regexp.MustCompile(`<title>[^<]*</title>`)
|
||||||
|
out := titleRe.ReplaceAllString(idxHTML, "<title>"+html.EscapeString(ogTitle)+"</title>")
|
||||||
out = strings.Replace(out, "</head>", ogTags+"</head>", 1)
|
out = strings.Replace(out, "</head>", ogTags+"</head>", 1)
|
||||||
// 禁止缓存,确保爬虫每次都能拿到最新 OG 标签
|
// 禁止缓存,确保爬虫每次都能拿到最新 OG 标签
|
||||||
c.Header("Cache-Control", "no-store")
|
c.Header("Cache-Control", "no-store")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'dart:math' as math;
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import '../../core/config/app_config.dart';
|
import '../../core/config/app_config.dart';
|
||||||
@@ -54,6 +55,13 @@ class _PublicProductScreenState extends State<PublicProductScreen> {
|
|||||||
);
|
);
|
||||||
final data = (resp.data as Map<String, dynamic>)['data'] as Map<String, dynamic>;
|
final data = (resp.data as Map<String, dynamic>)['data'] as Map<String, dynamic>;
|
||||||
setState(() { _data = data; _loading = false; });
|
setState(() { _data = data; _loading = false; });
|
||||||
|
// 更新浏览器标签标题(Flutter Web 会写 document.title)
|
||||||
|
final name = data['name'] as String? ?? '';
|
||||||
|
if (name.isNotEmpty) {
|
||||||
|
SystemChrome.setApplicationSwitcherDescription(
|
||||||
|
ApplicationSwitcherDescription(label: name, primaryColor: 0xFF8B2331),
|
||||||
|
);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setState(() { _error = e.toString(); _loading = false; });
|
setState(() { _error = e.toString(); _loading = false; });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user