Преглед на файлове

build: 处理一些console

菲鸽 преди 1 година
родител
ревизия
f2177da894
променени са 5 файла, в които са добавени 7 реда и са изтрити 9 реда
  1. 0 1
      manifest.config.ts
  2. 3 3
      src/hooks/useUpload.ts
  3. 1 1
      src/interceptors/request.ts
  4. 1 1
      src/pages/index/index.vue
  5. 2 3
      src/utils/index.ts

+ 0 - 1
manifest.config.ts

@@ -5,7 +5,6 @@ import { loadEnv } from 'vite'
 
 // 获取环境变量的范例
 const env = loadEnv(process.env.NODE_ENV!, path.resolve(process.cwd(), 'env'))
-// console.log(env)
 const {
   VITE_APP_TITLE,
   VITE_UNI_APPID,

+ 3 - 3
src/hooks/useUpload.ts

@@ -23,7 +23,7 @@ export default function useUpload<T = string>(formData: Record<string, any> = {}
         uploadFile<T>({ tempFilePath, formData, data, error, loading })
       },
       fail: (err) => {
-        console.log('uni.chooseMedia err->', err)
+        console.error('uni.chooseMedia err->', err)
         error.value = true
       },
     })
@@ -37,7 +37,7 @@ export default function useUpload<T = string>(formData: Record<string, any> = {}
         uploadFile<T>({ tempFilePath, formData, data, error, loading })
       },
       fail: (err) => {
-        console.log('uni.chooseImage err->', err)
+        console.error('uni.chooseImage err->', err)
         error.value = true
       },
     })
@@ -57,7 +57,7 @@ function uploadFile<T>({ tempFilePath, formData, data, error, loading }) {
       data.value = uploadFileRes.data as T
     },
     fail: (err) => {
-      console.log('uni.uploadFile err->', err)
+      console.error('uni.uploadFile err->', err)
       error.value = true
     },
     complete: () => {

+ 1 - 1
src/interceptors/request.ts

@@ -28,7 +28,7 @@ const httpInterceptor = {
     // 非 http 开头需拼接地址
     if (!options.url.startsWith('http')) {
       // #ifdef H5
-      console.log(__VITE_APP_PROXY__)
+      // console.log(__VITE_APP_PROXY__)
       if (JSON.parse(__VITE_APP_PROXY__)) {
         // 啥都不需要做
       } else {

+ 1 - 1
src/pages/index/index.vue

@@ -43,7 +43,7 @@ const author = ref('菲鸽')
 const description = ref(
   'unibest 是一个集成了多种工具和技术的 uniapp 开发模板,由 uniapp + Vue3 + Ts + Vite4 + UnoCss + UniUI + VSCode 构建,模板具有代码提示、自动格式化、统一配置、代码片段等功能,并内置了许多常用的基本组件和基本功能,让你编写 uniapp 拥有 best 体验。',
 )
-
+// 测试 uni API 自动引入
 onLoad(() => {
   console.log(author)
 })

+ 2 - 3
src/utils/index.ts

@@ -1,4 +1,3 @@
-// @ts-expect-error import json file
 import { pages, subPackages, tabBar } from '@/pages.json'
 
 /** 判断当前页面是否是tabbar页  */
@@ -31,7 +30,7 @@ export const currRoute = () => {
   // console.log('lastPage.options:', (lastPage as any).options)
   // 经过多端测试,只有 fullPath 靠谱,其他都不靠谱
   const { fullPath } = currRoute as { fullPath: string }
-  console.log(fullPath)
+  // console.log(fullPath)
   // eg: /pages/login/index?redirect=%2Fpages%2Fdemo%2Fbase%2Froute-interceptor (小程序)
   // eg: /pages/login/index?redirect=%2Fpages%2Froute-interceptor%2Findex%3Fname%3Dfeige%26age%3D30(h5)
   return getUrlObj(fullPath)
@@ -97,7 +96,7 @@ export const getAllPages = (key = 'needLogin') => {
       })
   })
   const result = [...mainPages, ...subPages]
-  console.log(`getAllPages by ${key} result: `, result)
+  // console.log(`getAllPages by ${key} result: `, result)
   return result
 }