Просмотр исходного кода

✨ feat(config): 更新生产环境配置和用户界面优化

- 将API基础URL切换至开发环境地址
- 更新小程序AppID为新的测试应用
- 将租户ID从1更改为2

🐛 fix(auth): 修复用户信息存储和调试日志问题

- 移除首页多余的调试console.log和console.debug语句
- 修复用户信息存储键名不一致问题(userInfo改为user)
- 注释掉auth工具中的调试日志输出

📞 chore(profile): 更新客服电话号码

- 将客服电话从057985101558更改为0574-65120616

🔧 chore(goods): 添加商品管理调试日志

- 在商品管理组件中添加供应商和商户数据日志输出
- 在创建商品时添加请求数据日志输出
yourname 1 неделя назад
Родитель
Сommit
96c4fdd900

+ 4 - 3
mini/.env.production

@@ -2,9 +2,10 @@
 # TARO_APP_ID="生产环境下的小程序 AppID"
 # TARO_APP_ID="生产环境下的小程序 AppID"
 
 
 # API配置
 # API配置
-TARO_APP_API_BASE_URL=https://api.yqingkj.com/
-# https://d8d-ai-vscode-8080-186-175-template-22-group.r.d8d.fun
+TARO_APP_API_BASE_URL=https://d8d-ai-vscode-8080-186-175-template-22-group.r.d8d.fun
+# https://api.yqingkj.com
+# 
 API_VERSION=v1
 API_VERSION=v1
 
 
 # 租户ID
 # 租户ID
-TARO_APP_TENANT_ID=1
+TARO_APP_TENANT_ID=2

+ 1 - 1
mini/project.config.json

@@ -2,7 +2,7 @@
   "miniprogramRoot": "./dist",
   "miniprogramRoot": "./dist",
   "projectname": "mini",
   "projectname": "mini",
   "description": "",
   "description": "",
-  "appid": "wx224c7b7d5e4ed130",
+  "appid": "wxaa39f39d574805a5",
   "setting": {
   "setting": {
     "urlCheck": false,
     "urlCheck": false,
     "es6": false,
     "es6": false,

+ 5 - 20
mini/src/pages/index/index.tsx

@@ -245,8 +245,6 @@ const HomePage: React.FC = () => {
   // 未登录时先静默登录,检查是否是新用户
   // 未登录时先静默登录,检查是否是新用户
   React.useEffect(() => {
   React.useEffect(() => {
     const checkUserAndShowPrivacy = async () => {
     const checkUserAndShowPrivacy = async () => {
-      console.log("isLoggedIn:",isLoggedIn);
-      console.debug("isLoggedIn:",isLoggedIn);
       if (!isLoggedIn) {
       if (!isLoggedIn) {
         try {
         try {
           // 获取登录code
           // 获取登录code
@@ -266,19 +264,13 @@ const HomePage: React.FC = () => {
             }
             }
           })
           })
 
 
-          console.log("checkUserAndShowPrivacyResponse")
-          console.log(response)
           if (response.status === 200) {
           if (response.status === 200) {
             const { token, user, isNewUser } = await response.json()
             const { token, user, isNewUser } = await response.json()
 
 
             // 保存token和用户信息
             // 保存token和用户信息
             Taro.setStorageSync('userInfo', user)
             Taro.setStorageSync('userInfo', user)
             Taro.setStorageSync('mini_token', token)
             Taro.setStorageSync('mini_token', token)
-            console.log("userInfo")
-            console.log(user)
             setUser(user as any)
             setUser(user as any)
-            console.log("isNewUser")
-            console.log(isNewUser)
             // 如果是新用户,显示隐私弹框
             // 如果是新用户,显示隐私弹框
             if (isNewUser) {
             if (isNewUser) {
               setShowPrivacyModal(true)
               setShowPrivacyModal(true)
@@ -315,19 +307,12 @@ const HomePage: React.FC = () => {
     })
     })
 
 
     if (response.status === 200) {
     if (response.status === 200) {
-      console.debug("response")
-      console.debug(response)
       const { token, user, isNewUser } = await response.json();
       const { token, user, isNewUser } = await response.json();
       // Taro.setStorageSync('openid', token);
       // Taro.setStorageSync('openid', token);
-      Taro.setStorageSync('userInfo', JSON.stringify(user))
-
-      console.debug("token")
-      console.debug(token)
-      console.debug("user")
-      console.debug(user)
+      Taro.setStorageSync('user', JSON.stringify(user))
+      Taro.setStorageSync('user', JSON.stringify(user))
+      setUser(user as any) // 使用类型断言,mini-login 返回的用户类型与 me API 略有不同
       
       
-      console.debug("isNewUser")
-      console.debug(isNewUser)
       if(isNewUser){
       if(isNewUser){
 
 
       }else{
       }else{
@@ -341,6 +326,8 @@ const HomePage: React.FC = () => {
           const userNew = await meResponse.json()
           const userNew = await meResponse.json()
           if(userNew ){
           if(userNew ){
             Taro.setStorageSync('userInfo', JSON.stringify(userNew))
             Taro.setStorageSync('userInfo', JSON.stringify(userNew))
+            Taro.setStorageSync('user', JSON.stringify(userNew))
+            setUser(userNew as any) // 使用类型断言,mini-login 返回的用户类型与 me API 略有不同
             console.debug('静默登录成功,返回新用户信息')
             console.debug('静默登录成功,返回新用户信息')
             setShowPrivacyModal(false)  //隐藏框
             setShowPrivacyModal(false)  //隐藏框
             //加载广告
             //加载广告
@@ -350,10 +337,8 @@ const HomePage: React.FC = () => {
             console.debug("静默登录失败")
             console.debug("静默登录失败")
           }
           }
         }
         }
-       
         //加载商品列表啊
         //加载商品列表啊
         
         
-        
       }
       }
       // const { token: newToken } = await response.json()
       // const { token: newToken } = await response.json()
       // Taro.setStorageSync('mini_token', newToken)
       // Taro.setStorageSync('mini_token', newToken)

+ 1 - 1
mini/src/pages/profile/index.tsx

@@ -224,7 +224,7 @@ const ProfilePage: React.FC = () => {
 
 
   const handleCallCustomerService = () => {
   const handleCallCustomerService = () => {
     Taro.makePhoneCall({
     Taro.makePhoneCall({
-      phoneNumber: '057985101558'
+      phoneNumber: '0574-65120616'
     })
     })
   }
   }
 
 

+ 2 - 2
mini/src/utils/auth.tsx

@@ -333,8 +333,8 @@ export const AuthProvider: React.FC<PropsWithChildren> = ({ children }) => {
 
 
 export const useAuth = () => {
 export const useAuth = () => {
   const context = useContext(AuthContext)
   const context = useContext(AuthContext)
-  console.log("context:",context)
-  console.debug("context:",context)
+  //console.log("context:",context)
+  //console.debug("context:",context)
   if (context === undefined) {
   if (context === undefined) {
     throw new Error('useAuth must be used within an AuthProvider')
     throw new Error('useAuth must be used within an AuthProvider')
   }
   }

+ 4 - 0
packages/goods-management-ui-mt/src/components/GoodsManagement.tsx

@@ -157,6 +157,9 @@ export const GoodsManagement: React.FC = () => {
 
 
   // 默认选择第一个供应商和商户(仅创建表单且值为空时)
   // 默认选择第一个供应商和商户(仅创建表单且值为空时)
   useEffect(() => {
   useEffect(() => {
+    console.log("suppliersData:",suppliersData);
+    console.log("merchantsData",suppliersData);
+
     if (isCreateForm && isModalOpen) {
     if (isCreateForm && isModalOpen) {
       // 检查是否需要设置默认供应商
       // 检查是否需要设置默认供应商
       const currentSupplierId = createForm.getValues('supplierId');
       const currentSupplierId = createForm.getValues('supplierId');
@@ -177,6 +180,7 @@ export const GoodsManagement: React.FC = () => {
   // 创建商品
   // 创建商品
   const createMutation = useMutation({
   const createMutation = useMutation({
     mutationFn: async (data: CreateRequest) => {
     mutationFn: async (data: CreateRequest) => {
+      console.log("adddata:",data);
       const res = await goodsClientManager.get().index.$post({ json: data });
       const res = await goodsClientManager.get().index.$post({ json: data });
       if (res.status !== 201) throw new Error('创建商品失败');
       if (res.status !== 201) throw new Error('创建商品失败');
       return await res.json();
       return await res.json();