修复bug

This commit is contained in:
2026-02-26 08:46:33 +08:00
parent 6d7cad25ea
commit 455e4536d4
66 changed files with 376 additions and 65 deletions

24
check_encodings.py Normal file
View File

@@ -0,0 +1,24 @@
import os
def check_encoding(directory):
for root, dirs, files in os.walk(directory):
for file in files:
if file.endswith('.uvue') or file.endswith('.uts'):
filepath = os.path.join(root, file)
try:
with open(filepath, 'rb') as f:
raw = f.read()
# Check for BOM
if raw.startswith(b'\xef\xbb\xbf'):
print(f"BOM detected: {filepath}")
# Try decoding as UTF-8
raw.decode('utf-8')
except Exception as e:
print(f"Potential encoding error or mojibake in: {filepath}")
check_encoding(r'd:\骅锋\mall\pages\mall\admin')
check_encoding(r'd:\骅锋\mall\layouts')

56
check_file_tags.py Normal file
View File

@@ -0,0 +1,56 @@
import sys
import re
def check_file(file_path):
print(f"Checking {file_path}")
try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
tags = ['template', 'script', 'style', 'view', 'text', 'image', 'scroll-view', 'input', 'textarea', 'button', 'swiper', 'swiper-item', 'component', 'slot']
for tag in tags:
# Count open tags: <tag> or <tag ...>
# Avoid matching <template> when looking for <temp>
# Regex: <tag(\s|>)
open_pattern = re.compile(f"<{tag}(\\s|>)")
# Count close tags: </tag>
close_pattern = re.compile(f"</{tag}\\s*>")
# Count self-closing tags: <tag ... />
# Note: Vue/HTML void elements like <input>, <img (image)> allow self-closing or no closing.
# But non-void elements like <view>, <text>, <textarea> must verify.
opens = len(open_pattern.findall(content))
closes = len(close_pattern.findall(content))
# Simple check for now.
# Some tags like <input> don't need closing.
void_tags = ['input', 'image', 'img', 'br', 'hr']
if tag in void_tags:
# For void tags, we don't strictly require equality, but good to know usage.
# In standard HTML <input> doesn't have </input>.
# In Uni-app x/Vue, <input /> is common.
pass
else:
if opens != closes:
print(f" [ERROR] {tag}: open={opens}, close={closes}")
else:
# print(f" [OK] {tag}: {opens}")
pass
# Check for self-closing non-void tags which are often invalid in some parsers
for tag in ['view', 'text', 'textarea', 'button', 'swiper-item', 'scroll-view']:
self_closing = re.search(f"<{tag}[^>]*/>", content)
if self_closing:
print(f" [CRITICAL] Found self-closing <{tag} /> which might be invalid!")
except Exception as e:
print(f"Error checking {file_path}: {e}")
if __name__ == "__main__":
if len(sys.argv) > 1:
for arg in sys.argv[1:]:
check_file(arg)
else:
print("Usage: python check_file_tags.py <file_path>")

20
check_one.py Normal file
View File

@@ -0,0 +1,20 @@
import sys
def check_file(file_path):
print(f"Checking {file_path}")
try:
content = open(file_path, 'r', encoding='utf-8').read()
tags = ['template', 'script', 'style', 'view', 'text', 'image', 'scroll-view', 'component', 'slot', 'input', 'textarea']
# Simple count check
for tag in tags:
o_count = content.count(f'<{tag}')
c_count = content.count(f'</{tag}>')
print(f" {tag}: open={o_count}, close={c_count}")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
check_file(sys.argv[1])

BIN
close_tags.txt Normal file

Binary file not shown.

View File

@@ -507,7 +507,7 @@ export class AkSupaQueryBuilder {
convertedData = result.data as T | Array<T>;
}
result.data = convertedData
const aaa = result as AkReqResponse<T | Array<T>
const aaa = result as AkReqResponse<T | Array<T>>
// const aaa = {
// status: result.status,
// data: convertedData,

View File

@@ -527,7 +527,7 @@ export class AkSupaQueryBuilder {
convertedData = result.data as T | Array<T>;
}
result.data = convertedData
const aaa = result as AkReqResponse<T | Array<T>
const aaa = result as AkReqResponse<T | Array<T>>
// const aaa = {
// status: result.status,
// data: convertedData,

25
fix_boms.py Normal file
View File

@@ -0,0 +1,25 @@
import os
def fix_bom(directory):
count = 0
for root, dirs, files in os.walk(directory):
for file in files:
if file.endswith('.uvue') or file.endswith('.uts') or file.endswith('.json'):
filepath = os.path.join(root, file)
try:
with open(filepath, 'rb') as f:
raw = f.read()
if raw.startswith(b'\xef\xbb\xbf'):
# Remove BOM
new_content = raw[3:]
with open(filepath, 'wb') as f:
f.write(new_content)
print(f"Fixed BOM: {filepath}")
count += 1
except Exception as e:
pass
return count
print(f"Total files fixed: {fix_bom(r'd:\骅锋\mall')}")

75
fix_encoding.py Normal file
View File

@@ -0,0 +1,75 @@
import os
file_path = r'd:\骅锋\mall\pages\mall\admin\order-management.uvue'
# The goal is to rewrite the file as UTF-8 without BOM with clean content
content = """<template>
<AdminLayout :currentPage="currentPage">
<view class="admin-page">
<view class="admin-sections">
<view class="admin-card Header">
<text class="Title">订单</text>
<text class="SubTitle">order-management</text>
</view>
<view class="admin-card Card">
<text class="Label">页面参数query</text>
<text class="Mono">{{ params }}</text>
</view>
</view>
</view>
</AdminLayout>
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const params = ref('')
const currentPage = ref('order-list')
onLoad((options: Record<string, string>) => {
params.value = JSON.stringify(options ?? {})
const tab = options['tab'] || ''
if (tab == 'stats') currentPage.value = 'order-stats'
else if (tab == 'aftersale') currentPage.value = 'order-aftersale'
else if (tab == 'cashier') currentPage.value = 'order-cashier'
else if (tab == 'verify') currentPage.value = 'order-verify'
else if (tab == 'config') currentPage.value = 'order-config'
})
</script>
<style>
.Header {
}
.Title {
font-size: 36rpx;
font-weight: 700;
}
.SubTitle {
margin-top: 8rpx;
font-size: 24rpx;
opacity: 0.7;
}
.Card {
}
.Label {
font-size: 26rpx;
font-weight: 600;
margin-bottom: 12rpx;
}
.Mono {
font-size: 24rpx;
font-family: monospace;
line-height: 36rpx;
word-break: break-all;
}
</style>
"""
with open(file_path, 'w', encoding='utf-8') as f:
f.write(content)
print(f"Successfully fixed {file_path}")

View File

@@ -17,7 +17,7 @@
@toggle="toggleMainAsideCollapse"
@menu-click="onTopMenuClick"
:asideWidth="ASIDE_W"
/>
></AdminAside>
<!-- 二级侧边栏 (1:1 复刻 CRMEB 抽屉/Dock 平滑切换) -->
<AdminSubSider
@@ -31,7 +31,7 @@
:asideWidth="layoutMode === 'mobile' ? 0 : ASIDE_W"
:width="SUB_W"
@sub-click="onSubClick"
/>
></AdminSubSider>
<!-- 右侧内容区 -->
<view
@@ -46,7 +46,7 @@
@search="onSearch"
@refresh="onRefresh"
@notify="onNotify"
/>
></AdminHeader>
<!-- 标签页 (CRMEB风格) - 移动端可以隐藏或滚动 -->
<AdminTagsView
@@ -58,16 +58,16 @@
@close-other="onCloseOther"
@close-all="onCloseAll"
@refresh="onRefresh"
/>
></AdminTagsView>
<!-- 内容展示区 (内部路由渲染) -->
<view class="content-scroll">
<view class="content-inner" :class="{ 'is-mobile': isMobile }">
<slot></slot>
<component :is="currentComponent" v-if="!isPageLoading && currentComponent != null" />
<AdminPageLoading v-if="isPageLoading" />
<component :is="currentComponent" v-if="!isPageLoading && currentComponent != null"></component>
<AdminPageLoading v-if="isPageLoading"></AdminPageLoading>
</view>
<AdminFooter />
<AdminFooter></AdminFooter>
</view>
</view>
</view>

View File

@@ -1,2 +1,2 @@
// Bridge entry to ensure Vite serves JS MIME while loading UTS entry.
import './main.uts'
import "./main.uts";

BIN
open_tags.txt Normal file

Binary file not shown.

View File

@@ -49,7 +49,7 @@
<view class="form-item row">
<text class="label">网站描述:</text>
<view class="form-content">
<textarea class="form-textarea" v-model="config.description" placeholder="网站描述" />
<textarea class="form-textarea" v-model="config.description" placeholder="网站描述"></textarea>
<text class="tip">网站描述</text>
</view>
</view>

View File

@@ -122,7 +122,7 @@
<view class="form-col">
<view class="label-box"><text class="label-txt">文章简介:</text></view>
<view class="input-box">
<textarea class="textarea-base" v-model="formIntro" placeholder="请输入" />
<textarea class="textarea-base" v-model="formIntro" placeholder="请输入"></textarea>
<text class="input-count">{{ formIntro.length }}/300</text>
</view>
</view>

View File

@@ -91,7 +91,7 @@
<view class="form-item row align-start">
<view class="label-box pt-10"><text class="required">*</text><text class="label-txt">分类简介:</text></view>
<view class="input-box">
<textarea class="textarea-mini" v-model="formDesc" placeholder="请输入分类简介" />
<textarea class="textarea-mini" v-model="formDesc" placeholder="请输入分类简介"></textarea>
</view>
</view>

View File

@@ -220,6 +220,8 @@
</view>
</view>
</view>
</view>
</view>
</view>
</template>

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="content-card">
<view class="tabs-row">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="finance-balance-stats">
<!-- 顶部数据统计卡片 (3列布局) -->
<view class="stats-grid">

View File

@@ -57,7 +57,7 @@
class="textarea-base"
v-model="feedbackText"
placeholder="请输入客服反馈内容"
/>
></textarea>
<text class="input-tip">暂无客服在线是,联系客服跳转的客服反馈页面的显示文字</text>
</view>
</view>

View File

@@ -116,7 +116,7 @@
<text class="label-txt">话术内容:</text>
</view>
<view class="input-box">
<textarea class="textarea-base" v-model="formData.content" placeholder="请输入话术内容" />
<textarea class="textarea-base" v-model="formData.content" placeholder="请输入话术内容"></textarea>
</view>
</view>

View File

@@ -1,4 +1,4 @@
<template>
<template>
<AdminLayout currentPage="data-city-data">
<view class="page">
<view class="header">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<AdminLayout currentPage="data-clear-data">
<view class="page">
<view class="header">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<AdminLayout currentPage="data-logistics-company">
<view class="page">
<view class="header">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 搜索栏 -->

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 顶部通知 -->

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 提示语 -->

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="admin-sections">
<view class="admin-card content-card">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 搜索栏 -->

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page api-management">
<!-- 左侧分类树 -->
<view class="sidebar-tree">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="page">
<view class="header">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page data-dictionary">
<view class="admin-sections">
<view class="admin-card">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="admin-sections">
<view class="admin-card">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page file-login-container">
<view class="login-card">
<view class="login-header">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<AdminLayout currentPage="external-account">
<view class="page">
<view class="header">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<AdminLayout currentPage="i18n-language-detail">
<view class="page">
<view class="header">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<AdminLayout currentPage="i18n-language-list">
<view class="page">
<view class="header">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<AdminLayout currentPage="i18n-region-list">
<view class="page">
<view class="header">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<AdminLayout currentPage="i18n-translate-config">
<view class="page">
<view class="header">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 提示栏 -->

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="admin-sections">
<view class="admin-grid-2">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 搜索栏 -->

View File

@@ -1,4 +1,4 @@
<template>
<template>
<AdminLayout currentPage="system-info">
<view class="page">
<view class="header">

View File

@@ -49,7 +49,7 @@
</view>
<view class="form-item">
<text class="label required">拼团简介:</text>
<textarea class="textarea" v-model="form.info" placeholder="请输入拼团简介" />
<textarea class="textarea" v-model="form.info" placeholder="请输入拼团简介"></textarea>
</view>
<view class="form-item">
<text class="label required">拼团时间:</text>

View File

@@ -15,6 +15,7 @@
</view>
</AdminLayout>
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'

View File

@@ -109,7 +109,7 @@
<view class="form-item">
<view class="label-box"><text class="label-txt">退货理由:</text></view>
<view class="input-box">
<textarea class="textarea-base" v-model="config.refundReasons" placeholder="请输入退货理由" />
<textarea class="textarea-base" v-model="config.refundReasons" placeholder="请输入退货理由"></textarea>
<text class="hint-txt">配置退货理由,一行一个理由</text>
</view>
</view>

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-main">
<!-- 头部搜索和操作 -->
<view class="search-card">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-main">
<view class="label-layout">
<!-- 左侧标签组 -->

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-main">
<!-- 头部搜索 -->
<view class="search-card">

View File

@@ -62,7 +62,7 @@
<view class="form-item-box row-align-start">
<view class="label-box"><text class="form-label font-star">保障内容:</text></view>
<view class="val-box">
<textarea class="textarea-ctrl" v-model="form.desc" placeholder="请输入保障内容" />
<textarea class="textarea-ctrl" v-model="form.desc" placeholder="请输入保障内容"></textarea>
</view>
</view>
<view class="form-item-box">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page-container">
<view class="page-header">
<view class="breadcrumb">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page-container">
<view class="page-header">
<view class="breadcrumb">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page-container">
<view class="login-wrapper">
<view class="login-card">

View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="admin-page">
<view class="page-header">
<view class="breadcrumb">

View File

@@ -47,7 +47,7 @@
v-model="formData.waf_config"
placeholder="请输入 WAF 配置"
maxlength="-1"
/>
></textarea>
<view class="form-tip">WAF配置验证参数过滤掉不需要的参数或拦截请求多个参数用回车换行分隔</view>
</view>
</view>

View File

@@ -68,7 +68,7 @@
<text class="label">描述</text>
<textarea class="textarea" placeholder="简要说明"
:value="editForm.description || ''"
@input="(e:any)=>editForm.description=e.detail.value" />
@input="(e:any)=>editForm.description=e.detail.value"></textarea>
</view>
<view class="form-row">
<view class="form-item half">
@@ -116,7 +116,7 @@
<text class="label">功能点(每行一个)</text>
<textarea class="textarea" placeholder="示例:\n- 支持X\n- 提供Y"
:value="featuresText"
@input="(e:any)=>featuresText=e.detail.value" />
@input="(e:any)=>featuresText=e.detail.value"></textarea>
</view>
</scroll-view>

View File

@@ -88,7 +88,7 @@
v-model="smartAddressInput"
placeholder="请输入完整地址,系统将自动识别省市区和详细地址"
@blur="parseSmartAddress"
maxlength="200" />
maxlength="200"></textarea>
<text class="smart-tip">例如北京市朝阳区三里屯SOHO A座</text>
</view>
@@ -108,7 +108,7 @@
<text class="form-label">详细地址</text>
<textarea class="form-textarea" v-model="newAddress.detail"
placeholder="街道、小区、楼栋、门牌号等"
maxlength="100" />
maxlength="100"></textarea>
</view>
<view class="form-item checkbox-item">

View File

@@ -46,7 +46,7 @@
class="desc-input"
placeholder="选填:补充详细的退款说明,有助于商家快速处理"
maxlength="200"
/>
></textarea>
</view>
<view class="submit-bar">

View File

@@ -75,7 +75,7 @@
<textarea class="remark-input"
v-model="remark"
placeholder="选填,请先和商家协商一致"
maxlength="100" />
maxlength="100"></textarea>
</view>
<!-- 价格明细 -->
@@ -214,7 +214,7 @@
v-model="smartAddressInput"
placeholder="粘贴如北京市朝阳区三里屯SOHO A座 张三 13800138000"
@input="parseSmartAddress"
maxlength="200" />
maxlength="200"></textarea>
<text class="smart-tip">自动识别:地址+姓名+电话(支持粘贴文本)</text>
</view>
@@ -234,7 +234,7 @@
<text class="form-label">详细地址</text>
<textarea class="form-textarea" v-model="newAddress.detail"
placeholder="街道、小区、楼栋、门牌号等"
maxlength="100" />
maxlength="100"></textarea>
</view>
<view class="form-item checkbox-item">

View File

@@ -25,7 +25,7 @@
class="comment-input"
placeholder="请输入您的评价内容,您的建议是我们改进的动力"
maxlength="200"
/>
></textarea>
<text class="word-count">{{ comment.length }}/200</text>
</view>

View File

@@ -45,7 +45,7 @@
<textarea class="review-textarea"
v-model="contents[index]"
placeholder="请写下您的使用感受,分享给其他小伙伴吧"
maxlength="500" />
maxlength="500"></textarea>
<text class="word-count">{{ contents[index]?.length || 0 }}/500</text>
</view>

View File

@@ -40,7 +40,7 @@
class="textarea-field"
maxlength="500"
auto-height
/>
></textarea>
</view>
<!-- 上传截图(可选) -->

View File

@@ -54,7 +54,7 @@
<!-- 备注 -->
<view class="form-item">
<text class="item-label">备注</text>
<textarea class="item-textarea" v-model="formData.remark" placeholder="请输入备注信息" />
<textarea class="item-textarea" v-model="formData.remark" placeholder="请输入备注信息"></textarea>
</view>
</scroll-view>

View File

@@ -54,7 +54,7 @@
<!-- 备注 -->
<view class="form-item">
<text class="item-label">备注</text>
<textarea class="item-textarea" v-model="formData.remark" placeholder="请输入备注信息" />
<textarea class="item-textarea" v-model="formData.remark" placeholder="请输入备注信息"></textarea>
</view>
</scroll-view>

View File

@@ -1,4 +1,4 @@
{
{
"pages": [
{
"path": "pages/mall/admin/homePage/index",

View File

@@ -1,4 +1,4 @@
{
{
"pages": [
{
"path": "pages/mall/admin/homePage/index",

51
scan_self_closing.py Normal file
View File

@@ -0,0 +1,51 @@
import os
import re
def scan_self_closing_tags(root_dir):
print(f"Scanning {root_dir} for suspicious self-closing tags...")
# Tags that are safe to self-close or are void elements
safe_tags = {
'image', 'img', 'input', 'br', 'hr', 'meta', 'link', 'col', 'base',
'area', 'embed', 'param', 'source', 'track', 'wbr',
'slot', 'template' # Maybe
}
suspicious_files = []
for subdir, dirs, files in os.walk(root_dir):
if 'node_modules' in subdir or 'unpackage' in subdir:
continue
for file in files:
if file.endswith('.uvue') or file.endswith('.vue'):
file_path = os.path.join(subdir, file)
try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
# Regex to find self-closing tags: <TagName ... />
# matches <TagName (anything but >) />
matches = re.finditer(r'<([a-zA-Z0-9-]+)([^>]*)/>', content)
found_issues = []
for match in matches:
tag_name = match.group(1)
if tag_name not in safe_tags:
# Start checking if it's a known component that might be problematic
# For now, report everything that isn't standard void
context = content[max(0, match.start()-20):min(len(content), match.end()+20)]
found_issues.append((tag_name, context.replace('\n', '\\n')))
if found_issues:
print(f"\nExample issues in {file_path}:")
for tag, ctx in found_issues:
print(f" Tag: <{tag} ... /> | Context: {ctx}")
suspicious_files.append(file_path)
except Exception as e:
print(f"Error reading {file_path}: {e}")
return suspicious_files
scan_self_closing_tags(r'.')

57
scan_tags.py Normal file
View File

@@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
import os
import re
def check_file(file_path):
try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
tags = ['view', 'text', 'image', 'scroll-view', 'component', 'slot', 'input', 'textarea', 'button', 'swiper-item', 'label', 'form', 'checkbox-group', 'radio-group', 'picker', 'navigator']
for tag in tags:
try:
open_matches = re.findall(f'<{tag}(\s|>)', content)
open_count = len(open_matches)
close_count = content.count(f'</{tag}>')
self_close_matches = re.findall(f'<{tag}[^>]*/>', content)
self_close_count = len(self_close_matches)
# Non-void tags should not be self-closing
# Special list of strictly non-void
strict_non_void = ['view', 'text', 'textarea', 'button', 'swiper-item', 'label', 'form', 'checkbox-group', 'radio-group', 'picker', 'navigator', 'scroll-view']
if tag in strict_non_void and self_close_count > 0:
print(f'[ERROR] Self-closing <{tag} /> found in {file_path} (Count: {self_close_count})')
# Balance check
# open_count includes self_close_count because of regex match
# open_count matches <tag> AND <tag />
# close_count matches </tag>
# Ideally: open_unique = open_count - self_close_count
# open_unique == close_count
# So open_count (all starts) - self_close_count (self closed) should equal close_count (ends)
# diff = (open_count - self_close_count) - close_count
diff = (open_count - self_close_count) - close_count
if diff != 0:
if tag not in ['input', 'image', 'img', 'br', 'hr']:
print(f'[ERROR] Unbalanced <{tag}> in {file_path}: open={open_count}, close={close_count}, self_close={self_close_count}, diff={diff}')
except:
pass
except Exception:
pass
def scan_dir(root_dir):
print('Scanning...')
for root, dirs, files in os.walk(root_dir):
for file in files:
if file.endswith('.uvue'):
check_file(os.path.join(root, file))
if __name__ == '__main__':
scan_dir(r'd:\骅锋\mall')