diff --git a/env/.env b/env/.env index fe28e99..0de6b1a 100644 --- a/env/.env +++ b/env/.env @@ -7,10 +7,11 @@ VITE_WX_APPID = 'wxf2c6d4b7361366b4' # h5部署网站的base,配置到 manifest.config.ts 里的 h5.router.base 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_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_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 # 后端接口 - 测试环境(通过 process.env.NODE_ENV = development) -# 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://127.0.0.1:48080 +# SHOPRO_DEV_BASE_URL = http://47.99.70.12:48080 ### SHOPRO_DEV_BASE_URL = http://yunai.natapp1.cc # 后端接口前缀(一般不建议调整) diff --git a/src/manifest.json b/src/manifest.json index f258510..d2340f5 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,6 +1,6 @@ { "name": "宠屋", - "appid": "H57F2ACE4", + "appid": "__UNI__9D479DC", "description": "", "versionName": "1.0.0", "versionCode": "100", diff --git a/src/pages/address/index.vue b/src/pages/address/index.vue index cb62734..2a59165 100644 --- a/src/pages/address/index.vue +++ b/src/pages/address/index.vue @@ -12,7 +12,7 @@ {{ address.type }} - {{ address.name }} {{ address.phone }} - + {{ address.name }} {{ address.mobile }} - {{ `${address['province']}-${address['city']}-${address['district']}` }} diff --git a/src/pages/login/phone.vue b/src/pages/login/phone.vue index 8978786..92f410f 100644 --- a/src/pages/login/phone.vue +++ b/src/pages/login/phone.vue @@ -38,7 +38,7 @@ import { ref, onMounted, onUnmounted } from 'vue' import { httpGet, httpPost } from '@/utils/http' import { useUserStore } from '@/store/user' import TopBar from '@/components/TopBar.vue' -import { imgUrl } from '@/utils/commUtils' +import { imgUrl, toast, toPath } from "@/utils/commUtils"; const userStore = useUserStore() @@ -50,26 +50,15 @@ let timer = null const sendCode = async () => { if (countdown.value === 0) { if (!phoneNumber.value) { - uni.showToast({ - title: '请输入手机号', - icon: 'none', - }) + toast('请输入手机号') return } - console.log('发送验证码到', phoneNumber.value) const res = await httpGet('/public/getCode', { phone: phoneNumber.value }) - console.log(res) countdown.value = 60 - if (res.code == 200) { - uni.showToast({ - title: res.message, - icon: 'none', - }) + if (res.code === 200) { + toast(res.message) } else { - uni.showToast({ - title: res.message, - icon: 'none', - }) + toast(res.message) } timer = setInterval(() => { countdown.value -= 1 @@ -96,29 +85,24 @@ const login = async () => { return } const res = await httpPost('/public/login', {}, { phone: phoneNumber.value, code: code.value }) - if (res.code == 200) { - uni.showToast({ - title: res.message, - icon: 'none', + if (res.code === 200) { + toast(res.message) + const data = res.data + 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') - if (userRes.code == 200) { + if (userRes.code === 200) { userStore.setUserInfo(userRes.data) - uni.switchTab({ - url: '/pages/index/index', - }) + toPath('/') } else { - uni.showToast({ - title: userRes.message, - icon: 'none', - }) + toast(userRes.message || '登录失败请重新登录!') } } else { - uni.showToast({ - title: res.message, - icon: 'none', - }) + toast(res.message || '登录失败请重新登录!') } } diff --git a/src/pages/order/order-detail.vue b/src/pages/order/order-detail.vue index d694683..7dbae4c 100644 --- a/src/pages/order/order-detail.vue +++ b/src/pages/order/order-detail.vue @@ -49,7 +49,7 @@ 下单用户: - {{ orderDetail.user.nickname }} ({{ orderDetail.user.phone }}) + {{ orderDetail.user.nickname }} ({{ orderDetail.user.mobile }}) 用户地址: diff --git a/src/pages/settings/index.vue b/src/pages/settings/index.vue index 22b4ce1..d7288ad 100644 --- a/src/pages/settings/index.vue +++ b/src/pages/settings/index.vue @@ -46,7 +46,7 @@ 手机号绑定 - {{ sinfo.phone }} + {{ sinfo.mobile }} diff --git a/src/scss/index.scss b/src/scss/index.scss index b5ad77f..62a7dbf 100644 --- a/src/scss/index.scss +++ b/src/scss/index.scss @@ -3,8 +3,8 @@ // 字体文件 @font-face { - font-family: OPPOSANS; - src: url('@/scss/font/OPPOSANS-M-subfont.ttf'); + // font-family: OPPOSANS; + // src: url('@/scss/font/OPPOSANS-M-subfont.ttf'); } .font-OPPOSANS { font-family: OPPOSANS; diff --git a/src/service/userService.js b/src/service/userService.js index 9033b8b..d6313fa 100644 --- a/src/service/userService.js +++ b/src/service/userService.js @@ -7,7 +7,7 @@ import { httpGet } from "@/utils/http" export const getUserInfo = async () => { try { const userRes = await httpGet('/user/userinfo') - if (userRes.code == 200) { + if (userRes.code === 200) { useUserStore().setUserInfo(userRes.data) return userRes.data } diff --git a/src/store/user.js b/src/store/user.js index c0a2ea2..86e305b 100644 --- a/src/store/user.js +++ b/src/store/user.js @@ -6,17 +6,16 @@ const initState = { avatar: '', id: null, name: '', - phone: '', - email: '', - typeId: '', + mobile: '', + cardId: '', createTime: '', updateTime: '', token: '', sex: '', - openid: '', // 微信openid,如果不为空就证明用户是用微信登录的 isRealName: false, isPetNursery: false, - shopLoginUser: null, + expiresTime: '', + refreshToken: '', } export const useUserStore = defineStore( diff --git a/tootls/文件处理工具.py b/tootls/文件处理工具.py index 511ea7e..a83bb1c 100644 --- a/tootls/文件处理工具.py +++ b/tootls/文件处理工具.py @@ -4,6 +4,7 @@ from tkinter import filedialog, scrolledtext, ttk from tkinter import Menu from PIL import Image + # 搜索指定关键字的函数 def search_keyword_in_files(directory, keyword, output_text): 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 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) try: - with open(file_path, 'r', encoding='utf-8') as f: + with open(file_path, "r", encoding="utf-8") as f: content = f.read() count = content.count(keyword) 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: output_text.insert(tk.END, f"读取文件 {file_path} 出错: {e}\n") output_text.insert(tk.END, "搜索完成。\n") + # 找出不包含指定关键字的文件 def find_files_without_keyword(directory, keyword, output_text): 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 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) try: - with open(file_path, 'r', encoding='utf-8') as f: + with open(file_path, "r", encoding="utf-8") as f: content = f.read() 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: output_text.insert(tk.END, f"读取文件 {file_path} 出错: {e}\n") output_text.insert(tk.END, "查找未包含关键字的文件完成。\n") + # 替换文件内容中的指定字符串 def replace_in_files(directory, search_text, replace_text, output_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 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) try: - with open(file_path, 'r', encoding='utf-8') as f: + with open(file_path, "r", encoding="utf-8") as f: content = f.read() if search_text in content: 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) - 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: output_text.insert(tk.END, f"处理文件 {file_path} 时出错: {e}\n") output_text.insert(tk.END, "替换完成。\n") + # 转换指定颜色为透明色的功能 def convert_color_to_transparent(image_path, color, output_text): img = Image.open(image_path) @@ -83,10 +101,12 @@ def convert_color_to_transparent(image_path, color, output_text): img.save(new_path) output_text.insert(tk.END, f"处理后的图片保存为 '{new_path}'\n") + # 清空输出框的函数 def clear_output(output_text): output_text.delete(1.0, tk.END) + # 添加右键菜单 def add_right_click_menu(output_text): menu = Menu(output_text, tearoff=0) @@ -97,6 +117,7 @@ def add_right_click_menu(output_text): output_text.bind("", show_menu) + # 创建GUI界面 def create_gui(): root = tk.Tk() @@ -104,7 +125,7 @@ def create_gui(): root.geometry("800x500") notebook = ttk.Notebook(root) - notebook.pack(fill='both', expand=True) + notebook.pack(fill="both", expand=True) search_frame = ttk.Frame(notebook) notebook.add(search_frame, text="搜索和替换") @@ -121,8 +142,13 @@ def create_gui(): keyword_entry.pack(pady=5) ttk.Label(left_frame_search, text="请输入要搜索的关键字:").pack(pady=5) - search_button = ttk.Button(left_frame_search, text="搜索文件夹", - command=lambda: browse_directory_for_search(keyword_entry.get(), output_text_search)) + search_button = ttk.Button( + left_frame_search, + text="搜索文件夹", + command=lambda: browse_directory_for_search( + keyword_entry.get(), output_text_search + ), + ) search_button.pack(pady=5) search_text_entry = ttk.Entry(left_frame_search) @@ -133,12 +159,22 @@ def create_gui(): replace_text_entry.pack(pady=5) ttk.Label(left_frame_search, text="请输入新文本:").pack(pady=5) - replace_button = ttk.Button(left_frame_search, text="替换文件夹中的内容", - command=lambda: browse_directory_for_replace(search_text_entry.get(), replace_text_entry.get(), output_text_search)) + replace_button = ttk.Button( + 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) - search_missing_button = ttk.Button(left_frame_search, text="查找不包含关键字的文件", - command=lambda: browse_directory_for_missing(keyword_entry.get(), output_text_search)) + search_missing_button = ttk.Button( + left_frame_search, + text="查找不包含关键字的文件", + command=lambda: browse_directory_for_missing( + keyword_entry.get(), output_text_search + ), + ) search_missing_button.pack(pady=5) output_text_search = scrolledtext.ScrolledText(search_frame, width=70) @@ -150,8 +186,13 @@ def create_gui(): color_entry.pack(pady=5) ttk.Label(image_frame, text="请输入要透明化的颜色 (r,g,b):").pack(pady=5) - trans_button = ttk.Button(image_frame, text="使图片透明", - command=lambda: browse_image_for_transparency(tuple(map(int, color_entry.get().split(','))), output_text_image)) + trans_button = ttk.Button( + image_frame, + text="使图片透明", + command=lambda: browse_image_for_transparency( + tuple(map(int, color_entry.get().split(","))), output_text_image + ), + ) trans_button.pack(pady=5) 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.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) root.mainloop() + # 辅助函数 def browse_directory_for_search(keyword, output_text): directory = filedialog.askdirectory() @@ -174,29 +218,38 @@ def browse_directory_for_search(keyword, output_text): output_text.insert(tk.END, f"正在 {directory} 中搜索关键字: '{keyword}'\n") search_keyword_in_files(directory, keyword, output_text) + def browse_directory_for_replace(search_text, replace_text, output_text): directory = filedialog.askdirectory() 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) + def browse_directory_for_missing(keyword, output_text): directory = filedialog.askdirectory() 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) + def browse_image_for_transparency(color, output_text): image_path = filedialog.askopenfilename() if image_path: convert_color_to_transparent(image_path, color, output_text) + def save_notes(note_text): file_path = filedialog.asksaveasfilename(defaultextension=".txt") 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)) note_text.insert(tk.END, f"记事本已保存到 {file_path}\n") + if __name__ == "__main__": create_gui()