黄琪勇 5 місяців тому
батько
коміт
79eb315705
9 змінених файлів з 121 додано та 695 видалено
  1. 1 1
      .env.development
  2. 19 0
      eslint.config.js
  3. 2 2
      index.html
  4. 37 687
      package-lock.json
  5. 2 1
      package.json
  6. 16 0
      postcss.config.cjs
  7. BIN
      public/favicon.ico
  8. 41 0
      src/type.d.ts
  9. 3 4
      vite.config.ts

+ 1 - 1
.env.development

@@ -1,2 +1,2 @@
 
-VITE_APP_URL = "http://localhost:9527/pptApi"
+VITE_APP_URL = "http://localhost:9525/rhythmApi"

+ 19 - 0
eslint.config.js

@@ -19,6 +19,25 @@ export default [
    {
       name: "app/custom-rules",
       rules: {
+         "no-debugger": process.env.NODE_ENV == "production" ? 2 : 1,
+         "no-unreachable": process.env.NODE_ENV == "production" ? 2 : 1, //return 警告不报错
+         "no-undef": "off", // 没有声明的变量
+         "vue/no-v-html": "off",
+         "no-irregular-whitespace": "off",
+         "vue/html-self-closing": [
+            "error",
+            {
+               html: {
+                  void: "always",
+                  normal: "never",
+                  component: "always"
+               },
+               svg: "always",
+               math: "always"
+            }
+         ],
+         "vue/multi-word-component-names": "off", // 关闭驼峰命名
+         "@typescript-eslint/no-unused-expressions": "off", // 关闭规则提示
          /* ts相关 */
          "@typescript-eslint/no-empty-function": "off", // 可以为空函数
          "@typescript-eslint/explicit-module-boundary-types": "off", //函数不需要返回类型也可以

+ 2 - 2
index.html

@@ -44,7 +44,7 @@
                width: 16px;
                height: 16px;
                border-radius: 50%;
-               background: #569cfe;
+               background: #1fa1ff;
                opacity: 0.5;
             }
             .firstLoading .loadingBox .loadingItem:nth-child(2) {
@@ -52,7 +52,7 @@
             }
             .firstLoading .loadingTip {
                font-size: 20px;
-               color: #569cfe;
+               color: #1fa1ff;
             }
             @keyframes rotate {
                from {

Різницю між файлами не показано, бо вона завелика
+ 37 - 687
package-lock.json


+ 2 - 1
package.json

@@ -17,6 +17,7 @@
       "axios": "^1.7.9",
       "nprogress": "^0.2.0",
       "pinia": "^2.3.0",
+      "vant": "^4.9.15",
       "vue": "^3.5.13",
       "vue-router": "^4.5.0"
    },
@@ -31,11 +32,11 @@
       "eslint": "^9.14.0",
       "eslint-plugin-vue": "^9.30.0",
       "npm-run-all2": "^7.0.2",
+      "postcss-pxtorem": "^6.1.0",
       "prettier": "^3.3.3",
       "sass": "^1.83.0",
       "typescript": "~5.6.3",
       "vite": "^6.0.5",
-      "vite-plugin-vue-devtools": "^7.6.8",
       "vue-tsc": "^2.1.10"
    }
 }

+ 16 - 0
postcss.config.cjs

@@ -0,0 +1,16 @@
+// postcss.config.js
+module.exports = {
+   plugins: {
+      "postcss-pxtorem": {
+         rootValue: 18, // 换算的基数
+         selectorBlackList: ["-nopx"], // 忽略转换正则匹配项 列入一些ui库, ['.el'] 就是忽略elementUI库
+         propList: ["*"],
+         exclude: file => {
+            if (file.includes("index.html")) {
+               return true
+            }
+            return false
+         }
+      }
+   }
+}

BIN
public/favicon.ico


+ 41 - 0
src/type.d.ts

@@ -0,0 +1,41 @@
+/**
+ * 全局类型定义
+ */
+
+/** 接口返回值 */
+declare interface apiResDataType {
+   code: number | "ERR_CANCELED"
+   data: any
+   message: string
+}
+
+/**
+ *type tool
+ */
+
+/**
+ * 提取obj中的某个属性的值类型
+ *
+ *例: type a={b:{c:1}}
+ *
+ * type c=ExtractVByK<a,"b"> /{c:number}
+ */
+declare type ExtractVByK<T extends Record<string, any>, P extends keyof T> = T[P]
+
+/**
+ * 获取 数组的类型
+ *
+ * 例: type a=string[]
+ *
+ * type b=ArrElement< a >  //string       另外: type b=a[number] 可以获取数组的类型,同时也能获取元祖的类型
+ */
+declare type ArrElement<ArrType extends any[]> = ArrType extends (infer ElementType)[] ? ElementType : never
+
+/**
+ * 将obj的某些类型变为可选
+ *
+ * 例: type a={a:string,b:string,c:string}
+ *
+ * type b=ObjPartial< a , 'a'|'b' >  //{a?:string,b?:string,c:string}
+ */
+declare type ObjPartial<T extends Record<string, any>, P extends keyof T> = Partial<Pick<T, P>> & Omit<T, P>

+ 3 - 4
vite.config.ts

@@ -3,11 +3,10 @@ import { fileURLToPath, URL } from "node:url"
 import { defineConfig } from "vite"
 import vue from "@vitejs/plugin-vue"
 import vueJsx from "@vitejs/plugin-vue-jsx"
-import vueDevTools from "vite-plugin-vue-devtools"
 
 // https://vite.dev/config/
 export default defineConfig({
-   plugins: [vue(), vueJsx(), vueDevTools()],
+   plugins: [vue(), vueJsx()],
    css: {
       preprocessorOptions: {
          scss: {
@@ -25,10 +24,10 @@ export default defineConfig({
       host: "0.0.0.0",
       proxy: {
          // 正则表达式写法
-         "^/pptApi/.*": {
+         "^/rhythmApi/.*": {
             target: "https://dev.kt.colexiu.com",
             changeOrigin: true,
-            rewrite: path => path.replace(/^\/pptApi/, "")
+            rewrite: path => path.replace(/^\/rhythmApi/, "")
          }
       }
    }

Деякі файли не було показано, через те що забагато файлів було змінено