UI适配后端大范围更新

This commit is contained in:
aiShuiJiaoDeXioShou 2024-09-19 01:44:11 +08:00
parent 83beb3513c
commit bdabf5e452
10 changed files with 109 additions and 72 deletions

9
env/.env vendored
View File

@ -7,10 +7,11 @@ VITE_WX_APPID = 'wxf2c6d4b7361366b4'
# h5部署网站的base配置到 manifest.config.ts 里的 h5.router.base # h5部署网站的base配置到 manifest.config.ts 里的 h5.router.base
VITE_APP_PUBLIC_BASE=/acdr/ VITE_APP_PUBLIC_BASE=/acdr/
VITE_SERVER_BASEURL = 'http://47.99.70.12:28184/api' # VITE_SERVER_BASEURL = 'http://47.99.70.12:28184/api'
# VITE_UPLOAD_BASEURL = 'http://47.99.70.12:28184' # VITE_UPLOAD_BASEURL = 'http://47.99.70.12:28184'
# VITE_SERVER_BASEURL = 'http://localhost:28184/api' # VITE_SERVER_BASEURL = 'http://localhost:28184/api'
VITE_WS_BASEURL = 'ws://47.99.70.12:28184/api' VITE_SERVER_BASEURL = 'http://localhost:48080/app-api'
# VITE_WS_BASEURL = 'ws://47.99.70.12:28184/api'
VITE_UPLOAD_BASEURL = 'http://localhost:28184' VITE_UPLOAD_BASEURL = 'http://localhost:28184'
VITE_OSS_BASEURL = 'http://116.204.119.171:9000/linghe' VITE_OSS_BASEURL = 'http://116.204.119.171:9000/linghe'
@ -25,8 +26,8 @@ SHOPRO_VERSION = v1.8.3
SHOPRO_BASE_URL = http://api-dashboard.yudao.iocoder.cn SHOPRO_BASE_URL = http://api-dashboard.yudao.iocoder.cn
# 后端接口 - 测试环境(通过 process.env.NODE_ENV = development # 后端接口 - 测试环境(通过 process.env.NODE_ENV = development
# SHOPRO_DEV_BASE_URL = http://127.0.0.1:48080 SHOPRO_DEV_BASE_URL = http://127.0.0.1:48080
SHOPRO_DEV_BASE_URL = http://47.99.70.12:48080 # SHOPRO_DEV_BASE_URL = http://47.99.70.12:48080
### SHOPRO_DEV_BASE_URL = http://yunai.natapp1.cc ### SHOPRO_DEV_BASE_URL = http://yunai.natapp1.cc
# 后端接口前缀(一般不建议调整) # 后端接口前缀(一般不建议调整)

View File

@ -1,6 +1,6 @@
{ {
"name": "宠屋", "name": "宠屋",
"appid": "H57F2ACE4", "appid": "__UNI__9D479DC",
"description": "", "description": "",
"versionName": "1.0.0", "versionName": "1.0.0",
"versionCode": "100", "versionCode": "100",

View File

@ -12,7 +12,7 @@
<view class="address-label"> <view class="address-label">
<view class="tag">{{ address.type }}</view> <view class="tag">{{ address.type }}</view>
<view class="address-detail"> <view class="address-detail">
{{ address.name }} {{ address.phone }} - {{ address.name }} {{ address.mobile }} -
{{ `${address['province']}-${address['city']}-${address['district']}` }} {{ `${address['province']}-${address['city']}-${address['district']}` }}
</view> </view>
</view> </view>

View File

@ -38,7 +38,7 @@ import { ref, onMounted, onUnmounted } from 'vue'
import { httpGet, httpPost } from '@/utils/http' import { httpGet, httpPost } from '@/utils/http'
import { useUserStore } from '@/store/user' import { useUserStore } from '@/store/user'
import TopBar from '@/components/TopBar.vue' import TopBar from '@/components/TopBar.vue'
import { imgUrl } from '@/utils/commUtils' import { imgUrl, toast, toPath } from "@/utils/commUtils";
const userStore = useUserStore() const userStore = useUserStore()
@ -50,26 +50,15 @@ let timer = null
const sendCode = async () => { const sendCode = async () => {
if (countdown.value === 0) { if (countdown.value === 0) {
if (!phoneNumber.value) { if (!phoneNumber.value) {
uni.showToast({ toast('请输入手机号')
title: '请输入手机号',
icon: 'none',
})
return return
} }
console.log('发送验证码到', phoneNumber.value)
const res = await httpGet('/public/getCode', { phone: phoneNumber.value }) const res = await httpGet('/public/getCode', { phone: phoneNumber.value })
console.log(res)
countdown.value = 60 countdown.value = 60
if (res.code == 200) { if (res.code === 200) {
uni.showToast({ toast(res.message)
title: res.message,
icon: 'none',
})
} else { } else {
uni.showToast({ toast(res.message)
title: res.message,
icon: 'none',
})
} }
timer = setInterval(() => { timer = setInterval(() => {
countdown.value -= 1 countdown.value -= 1
@ -96,29 +85,24 @@ const login = async () => {
return return
} }
const res = await httpPost('/public/login', {}, { phone: phoneNumber.value, code: code.value }) const res = await httpPost('/public/login', {}, { phone: phoneNumber.value, code: code.value })
if (res.code == 200) { if (res.code === 200) {
uni.showToast({ toast(res.message)
title: res.message, const data = res.data
icon: 'none', userStore.setUserInfo({
id: data.userId ,
token: data.accessToken,
expiresTime: data.expiresTime,
refreshToken: data.refreshToken
}) })
userStore.setUserInfo({ token: res.data.userToken, shopLoginUser: res.data.shopLoginUser })
const userRes = await httpGet('/user/userinfo') const userRes = await httpGet('/user/userinfo')
if (userRes.code == 200) { if (userRes.code === 200) {
userStore.setUserInfo(userRes.data) userStore.setUserInfo(userRes.data)
uni.switchTab({ toPath('/')
url: '/pages/index/index',
})
} else { } else {
uni.showToast({ toast(userRes.message || '登录失败请重新登录!')
title: userRes.message,
icon: 'none',
})
} }
} else { } else {
uni.showToast({ toast(res.message || '登录失败请重新登录!')
title: res.message,
icon: 'none',
})
} }
} }

View File

@ -49,7 +49,7 @@
<view class="user-info text-sm text-gray-700 mb-4"> <view class="user-info text-sm text-gray-700 mb-4">
<view> <view>
<text>下单用户:</text> <text>下单用户:</text>
{{ orderDetail.user.nickname }} ({{ orderDetail.user.phone }}) {{ orderDetail.user.nickname }} ({{ orderDetail.user.mobile }})
</view> </view>
<view> <view>
<text>用户地址:</text> <text>用户地址:</text>

View File

@ -46,7 +46,7 @@
</view> </view>
<view class="wd-cell" @click="goToBindPhone"> <view class="wd-cell" @click="goToBindPhone">
<text class="text-gray-800">手机号绑定</text> <text class="text-gray-800">手机号绑定</text>
<text class="text-gray-400 ml-auto">{{ sinfo.phone }}</text> <text class="text-gray-400 ml-auto">{{ sinfo.mobile }}</text>
<wd-icon name="right" size="16" class="ml-2"></wd-icon> <wd-icon name="right" size="16" class="ml-2"></wd-icon>
</view> </view>
<view class="wd-cell" @click="!sinfo.isAuth ? goToRealNameAuth() : toast('你已经实名了')"> <view class="wd-cell" @click="!sinfo.isAuth ? goToRealNameAuth() : toast('你已经实名了')">

View File

@ -3,8 +3,8 @@
// 字体文件 // 字体文件
@font-face { @font-face {
font-family: OPPOSANS; // font-family: OPPOSANS;
src: url('@/scss/font/OPPOSANS-M-subfont.ttf'); // src: url('@/scss/font/OPPOSANS-M-subfont.ttf');
} }
.font-OPPOSANS { .font-OPPOSANS {
font-family: OPPOSANS; font-family: OPPOSANS;

View File

@ -7,7 +7,7 @@ import { httpGet } from "@/utils/http"
export const getUserInfo = async () => { export const getUserInfo = async () => {
try { try {
const userRes = await httpGet('/user/userinfo') const userRes = await httpGet('/user/userinfo')
if (userRes.code == 200) { if (userRes.code === 200) {
useUserStore().setUserInfo(userRes.data) useUserStore().setUserInfo(userRes.data)
return userRes.data return userRes.data
} }

View File

@ -6,17 +6,16 @@ const initState = {
avatar: '', avatar: '',
id: null, id: null,
name: '', name: '',
phone: '', mobile: '',
email: '', cardId: '',
typeId: '',
createTime: '', createTime: '',
updateTime: '', updateTime: '',
token: '', token: '',
sex: '', sex: '',
openid: '', // 微信openid如果不为空就证明用户是用微信登录的
isRealName: false, isRealName: false,
isPetNursery: false, isPetNursery: false,
shopLoginUser: null, expiresTime: '',
refreshToken: '',
} }
export const useUserStore = defineStore( export const useUserStore = defineStore(

View File

@ -4,6 +4,7 @@ from tkinter import filedialog, scrolledtext, ttk
from tkinter import Menu from tkinter import Menu
from PIL import Image from PIL import Image
# 搜索指定关键字的函数 # 搜索指定关键字的函数
def search_keyword_in_files(directory, keyword, output_text): def search_keyword_in_files(directory, keyword, output_text):
if not keyword: if not keyword:
@ -12,18 +13,24 @@ def search_keyword_in_files(directory, keyword, output_text):
for root, dirs, files in os.walk(directory): for root, dirs, files in os.walk(directory):
for file in files: for file in files:
if file.endswith(('.js', '.json', '.vue', '.ts', '.py', '.java', '.cpp')): if file.endswith(
(".js", ".json", ".vue", ".ts", ".py", ".java", ".cpp", ".xml")
):
file_path = os.path.join(root, file) file_path = os.path.join(root, file)
try: try:
with open(file_path, 'r', encoding='utf-8') as f: with open(file_path, "r", encoding="utf-8") as f:
content = f.read() content = f.read()
count = content.count(keyword) count = content.count(keyword)
if count > 0: if count > 0:
output_text.insert(tk.END, f"{file_path} 中找到 '{keyword}',共 {count}\n") output_text.insert(
tk.END,
f"{file_path} 中找到 '{keyword}',共 {count}\n",
)
except Exception as e: except Exception as e:
output_text.insert(tk.END, f"读取文件 {file_path} 出错: {e}\n") output_text.insert(tk.END, f"读取文件 {file_path} 出错: {e}\n")
output_text.insert(tk.END, "搜索完成。\n") output_text.insert(tk.END, "搜索完成。\n")
# 找出不包含指定关键字的文件 # 找出不包含指定关键字的文件
def find_files_without_keyword(directory, keyword, output_text): def find_files_without_keyword(directory, keyword, output_text):
if not keyword: if not keyword:
@ -32,17 +39,22 @@ def find_files_without_keyword(directory, keyword, output_text):
for root, dirs, files in os.walk(directory): for root, dirs, files in os.walk(directory):
for file in files: for file in files:
if file.endswith(('.js', '.json', '.vue', '.ts', '.py', '.java', '.cpp')): if file.endswith(
(".js", ".json", ".vue", ".ts", ".py", ".java", ".cpp", ".xml")
):
file_path = os.path.join(root, file) file_path = os.path.join(root, file)
try: try:
with open(file_path, 'r', encoding='utf-8') as f: with open(file_path, "r", encoding="utf-8") as f:
content = f.read() content = f.read()
if keyword not in content: if keyword not in content:
output_text.insert(tk.END, f"'{keyword}' 未在文件 {file_path} 中找到。\n") output_text.insert(
tk.END, f"'{keyword}' 未在文件 {file_path} 中找到。\n"
)
except Exception as e: except Exception as e:
output_text.insert(tk.END, f"读取文件 {file_path} 出错: {e}\n") output_text.insert(tk.END, f"读取文件 {file_path} 出错: {e}\n")
output_text.insert(tk.END, "查找未包含关键字的文件完成。\n") output_text.insert(tk.END, "查找未包含关键字的文件完成。\n")
# 替换文件内容中的指定字符串 # 替换文件内容中的指定字符串
def replace_in_files(directory, search_text, replace_text, output_text): def replace_in_files(directory, search_text, replace_text, output_text):
if not search_text or not replace_text: if not search_text or not replace_text:
@ -51,20 +63,26 @@ def replace_in_files(directory, search_text, replace_text, output_text):
for root, dirs, files in os.walk(directory): for root, dirs, files in os.walk(directory):
for file in files: for file in files:
if file.endswith(('.js', '.json', '.vue', '.ts', '.py', '.java', '.cpp')): if file.endswith(
(".js", ".json", ".vue", ".ts", ".py", ".java", ".cpp", ".xml")
):
file_path = os.path.join(root, file) file_path = os.path.join(root, file)
try: try:
with open(file_path, 'r', encoding='utf-8') as f: with open(file_path, "r", encoding="utf-8") as f:
content = f.read() content = f.read()
if search_text in content: if search_text in content:
new_content = content.replace(search_text, replace_text) new_content = content.replace(search_text, replace_text)
with open(file_path, 'w', encoding='utf-8') as f: with open(file_path, "w", encoding="utf-8") as f:
f.write(new_content) f.write(new_content)
output_text.insert(tk.END, f"{file_path} 中替换 '{search_text}''{replace_text}'\n") output_text.insert(
tk.END,
f"{file_path} 中替换 '{search_text}''{replace_text}'\n",
)
except Exception as e: except Exception as e:
output_text.insert(tk.END, f"处理文件 {file_path} 时出错: {e}\n") output_text.insert(tk.END, f"处理文件 {file_path} 时出错: {e}\n")
output_text.insert(tk.END, "替换完成。\n") output_text.insert(tk.END, "替换完成。\n")
# 转换指定颜色为透明色的功能 # 转换指定颜色为透明色的功能
def convert_color_to_transparent(image_path, color, output_text): def convert_color_to_transparent(image_path, color, output_text):
img = Image.open(image_path) img = Image.open(image_path)
@ -83,10 +101,12 @@ def convert_color_to_transparent(image_path, color, output_text):
img.save(new_path) img.save(new_path)
output_text.insert(tk.END, f"处理后的图片保存为 '{new_path}'\n") output_text.insert(tk.END, f"处理后的图片保存为 '{new_path}'\n")
# 清空输出框的函数 # 清空输出框的函数
def clear_output(output_text): def clear_output(output_text):
output_text.delete(1.0, tk.END) output_text.delete(1.0, tk.END)
# 添加右键菜单 # 添加右键菜单
def add_right_click_menu(output_text): def add_right_click_menu(output_text):
menu = Menu(output_text, tearoff=0) menu = Menu(output_text, tearoff=0)
@ -97,6 +117,7 @@ def add_right_click_menu(output_text):
output_text.bind("<Button-3>", show_menu) output_text.bind("<Button-3>", show_menu)
# 创建GUI界面 # 创建GUI界面
def create_gui(): def create_gui():
root = tk.Tk() root = tk.Tk()
@ -104,7 +125,7 @@ def create_gui():
root.geometry("800x500") root.geometry("800x500")
notebook = ttk.Notebook(root) notebook = ttk.Notebook(root)
notebook.pack(fill='both', expand=True) notebook.pack(fill="both", expand=True)
search_frame = ttk.Frame(notebook) search_frame = ttk.Frame(notebook)
notebook.add(search_frame, text="搜索和替换") notebook.add(search_frame, text="搜索和替换")
@ -121,8 +142,13 @@ def create_gui():
keyword_entry.pack(pady=5) keyword_entry.pack(pady=5)
ttk.Label(left_frame_search, text="请输入要搜索的关键字:").pack(pady=5) ttk.Label(left_frame_search, text="请输入要搜索的关键字:").pack(pady=5)
search_button = ttk.Button(left_frame_search, text="搜索文件夹", search_button = ttk.Button(
command=lambda: browse_directory_for_search(keyword_entry.get(), output_text_search)) left_frame_search,
text="搜索文件夹",
command=lambda: browse_directory_for_search(
keyword_entry.get(), output_text_search
),
)
search_button.pack(pady=5) search_button.pack(pady=5)
search_text_entry = ttk.Entry(left_frame_search) search_text_entry = ttk.Entry(left_frame_search)
@ -133,12 +159,22 @@ def create_gui():
replace_text_entry.pack(pady=5) replace_text_entry.pack(pady=5)
ttk.Label(left_frame_search, text="请输入新文本:").pack(pady=5) ttk.Label(left_frame_search, text="请输入新文本:").pack(pady=5)
replace_button = ttk.Button(left_frame_search, text="替换文件夹中的内容", replace_button = ttk.Button(
command=lambda: browse_directory_for_replace(search_text_entry.get(), replace_text_entry.get(), output_text_search)) left_frame_search,
text="替换文件夹中的内容",
command=lambda: browse_directory_for_replace(
search_text_entry.get(), replace_text_entry.get(), output_text_search
),
)
replace_button.pack(pady=5) replace_button.pack(pady=5)
search_missing_button = ttk.Button(left_frame_search, text="查找不包含关键字的文件", search_missing_button = ttk.Button(
command=lambda: browse_directory_for_missing(keyword_entry.get(), output_text_search)) left_frame_search,
text="查找不包含关键字的文件",
command=lambda: browse_directory_for_missing(
keyword_entry.get(), output_text_search
),
)
search_missing_button.pack(pady=5) search_missing_button.pack(pady=5)
output_text_search = scrolledtext.ScrolledText(search_frame, width=70) output_text_search = scrolledtext.ScrolledText(search_frame, width=70)
@ -150,8 +186,13 @@ def create_gui():
color_entry.pack(pady=5) color_entry.pack(pady=5)
ttk.Label(image_frame, text="请输入要透明化的颜色 (r,g,b):").pack(pady=5) ttk.Label(image_frame, text="请输入要透明化的颜色 (r,g,b):").pack(pady=5)
trans_button = ttk.Button(image_frame, text="使图片透明", trans_button = ttk.Button(
command=lambda: browse_image_for_transparency(tuple(map(int, color_entry.get().split(','))), output_text_image)) image_frame,
text="使图片透明",
command=lambda: browse_image_for_transparency(
tuple(map(int, color_entry.get().split(","))), output_text_image
),
)
trans_button.pack(pady=5) trans_button.pack(pady=5)
output_text_image = scrolledtext.ScrolledText(image_frame, width=70) output_text_image = scrolledtext.ScrolledText(image_frame, width=70)
@ -162,11 +203,14 @@ def create_gui():
note_text = scrolledtext.ScrolledText(note_frame, width=70) note_text = scrolledtext.ScrolledText(note_frame, width=70)
note_text.pack(padx=10, pady=10, fill=tk.BOTH, expand=True) note_text.pack(padx=10, pady=10, fill=tk.BOTH, expand=True)
save_button = ttk.Button(note_frame, text="保存记事本", command=lambda: save_notes(note_text)) save_button = ttk.Button(
note_frame, text="保存记事本", command=lambda: save_notes(note_text)
)
save_button.pack(pady=10) save_button.pack(pady=10)
root.mainloop() root.mainloop()
# 辅助函数 # 辅助函数
def browse_directory_for_search(keyword, output_text): def browse_directory_for_search(keyword, output_text):
directory = filedialog.askdirectory() directory = filedialog.askdirectory()
@ -174,29 +218,38 @@ def browse_directory_for_search(keyword, output_text):
output_text.insert(tk.END, f"正在 {directory} 中搜索关键字: '{keyword}'\n") output_text.insert(tk.END, f"正在 {directory} 中搜索关键字: '{keyword}'\n")
search_keyword_in_files(directory, keyword, output_text) search_keyword_in_files(directory, keyword, output_text)
def browse_directory_for_replace(search_text, replace_text, output_text): def browse_directory_for_replace(search_text, replace_text, output_text):
directory = filedialog.askdirectory() directory = filedialog.askdirectory()
if directory: if directory:
output_text.insert(tk.END, f"{directory} 中将 '{search_text}' 替换为 '{replace_text}'\n") output_text.insert(
tk.END, f"{directory} 中将 '{search_text}' 替换为 '{replace_text}'\n"
)
replace_in_files(directory, search_text, replace_text, output_text) replace_in_files(directory, search_text, replace_text, output_text)
def browse_directory_for_missing(keyword, output_text): def browse_directory_for_missing(keyword, output_text):
directory = filedialog.askdirectory() directory = filedialog.askdirectory()
if directory: if directory:
output_text.insert(tk.END, f"正在 {directory} 中查找未包含关键字 '{keyword}' 的文件。\n") output_text.insert(
tk.END, f"正在 {directory} 中查找未包含关键字 '{keyword}' 的文件。\n"
)
find_files_without_keyword(directory, keyword, output_text) find_files_without_keyword(directory, keyword, output_text)
def browse_image_for_transparency(color, output_text): def browse_image_for_transparency(color, output_text):
image_path = filedialog.askopenfilename() image_path = filedialog.askopenfilename()
if image_path: if image_path:
convert_color_to_transparent(image_path, color, output_text) convert_color_to_transparent(image_path, color, output_text)
def save_notes(note_text): def save_notes(note_text):
file_path = filedialog.asksaveasfilename(defaultextension=".txt") file_path = filedialog.asksaveasfilename(defaultextension=".txt")
if file_path: if file_path:
with open(file_path, 'w') as file: with open(file_path, "w") as file:
file.write(note_text.get(1.0, tk.END)) file.write(note_text.get(1.0, tk.END))
note_text.insert(tk.END, f"记事本已保存到 {file_path}\n") note_text.insert(tk.END, f"记事本已保存到 {file_path}\n")
if __name__ == "__main__": if __name__ == "__main__":
create_gui() create_gui()