Ver Fonte

Merge remote-tracking branch 'origin/master'

john há 8 meses atrás
pai
commit
a877ae919d

+ 10 - 6
deployment.sh

@@ -4,13 +4,17 @@
 current_git_branch_latest_short_id=`git rev-parse --short HEAD`
 version=$(grep '"version"' package.json | sed -E 's/.*"version": "([^"]+)".*/\1/')
 project_name=$(grep '"name"' package.json | sed -E 's/.*"name": "([^"]+)".*/\1/')
-docker_name="$project_name:$version-$current_git_branch_latest_short_id"
-save_file_name="$version-$current_git_branch_latest_short_id.tar"
+# docker_name="$project_name:$version-$current_git_branch_latest_short_id"
+docker_name="new_cash_book_node:$version-$current_git_branch_latest_short_id"
+save_file_name="new_cash_book_node_$version-$current_git_branch_latest_short_id.tar"
 
 # 执行命令
-cd ./frontEndMobile && npm run build
+cd ./frontEndMobile
+yarn install --registry=https://registry.npmmirror.com && npm run build
 rm -rf ../node_expores/public
 cp -rf ./dist ../node_expores/public
-# docker build -t $docker_name .
-# cd ../
-# docker save -o ./$save_file_name $docker_name
+cd ../node_expores
+yarn install --registry=https://registry.npmmirror.com
+docker build -t $docker_name .
+cd ../
+docker save -o ./$save_file_name $docker_name

+ 3 - 2
frontEndMobile/index.html

@@ -3,8 +3,9 @@
   <head>
     <meta charset="UTF-8" />
     <link rel="icon" type="image/svg+xml" href="/vite.svg" />
-    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <title>Vite + Vue + TS</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" viewport-fit="cover" />
+    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
+    <title>记录</title>
   </head>
   <body>
     <div id="app"></div>

+ 5 - 1
frontEndMobile/package.json

@@ -24,7 +24,8 @@
     "qs": "^6.13.0",
     "vant": "^4.9.8",
     "vue": "^3.5.12",
-    "vue-router": "^4.4.5"
+    "vue-router": "^4.4.5",
+    "vue3-hash-calendar": "^1.1.3"
   },
   "volta": {
     "node": "18.20.4"
@@ -34,7 +35,10 @@
     "@types/vue": "^2.0.0",
     "@vitejs/plugin-vue": "^5.1.5",
     "@vue/compiler-sfc": "^3.5.12",
+    "less": "^4.2.0",
     "path": "^0.12.7",
+    "sass": "^1.81.0",
+    "sass-embedded": "^1.81.0",
     "typescript": "~5.6.2",
     "vite": "^5.4.10",
     "vue-tsc": "^2.1.8"

+ 73 - 24
frontEndMobile/src/App.vue

@@ -1,32 +1,81 @@
 <script setup lang="ts">
-import HelloWorld from './components/HelloWorld.vue'
-import tabbar from '@/components/tabbar.vue'
+import { showToast } from 'vant'
+import { watch, ref, onMounted } from 'vue'
+import { useRouter, useRoute } from 'vue-router'
+
+const router = useRouter()
+const route = useRoute()
+const title = ref('首页')
+const isBack = ref(false)
+const active = ref('首页')
+const isTabbar = ref(true)
+
+watch(
+  route,
+  (newValue) => {
+    title.value = `${newValue.meta.title || '首页'}`
+  },
+  {
+    deep: true
+  }
+)
+
+watch(title, (newValue) => {
+  pageInit(newValue)
+})
+const onClickLeft = () => {
+  router.go(-1)
+}
+
+function pageInit(newValue) {
+  isBack.value = ['首页', '我的'].indexOf(newValue) < 0
+  isTabbar.value = ['首页', '我的'].indexOf(newValue) > -1
+  if(['首页', '我的', '记账'].indexOf(newValue) > -1) {
+    active.value = newValue
+  }
+}
+
+onMounted(() => {
+  setTimeout(() => {
+    title.value = `${route.meta.title || '首页'}`
+  }, 300)
+
+})
 </script>
 
 <template>
-  <!-- <div>
-    <a href="https://vite.dev" target="_blank">
-      <img src="/vite.svg" class="logo" alt="Vite logo" />
-    </a>
-    <a href="https://vuejs.org/" target="_blank">
-      <img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
-    </a>
-  </div> -->
-  <!-- <HelloWorld msg="Vite + Vue" /><tabbar /> -->
-  <RouterView />
+  <van-nav-bar
+    :title="title"
+    :left-text="isBack ? '返回' : ''"
+    :left-arrow="isBack"
+    @click-left="onClickLeft"
+  />
+  <div :class="['view-box', !isTabbar && 'no-tabbar']">
+    <RouterView />
+  </div>
+  <van-tabbar v-model="active" v-if="isTabbar || false">
+    <van-tabbar-item name="首页" to="/home" icon="balance-list-o">明细</van-tabbar-item>
+    <van-tabbar-item name="记账" to="/accountLog" class="add-box" icon="add-o">记账</van-tabbar-item>
+    <van-tabbar-item name="我的" to="/me" icon="contact-o">我的</van-tabbar-item>
+  </van-tabbar>
 </template>
 
-<style scoped>
-/* .logo {
-  height: 6em;
-  padding: 1.5em;
-  will-change: filter;
-  transition: filter 300ms;
-}
-.logo:hover {
-  filter: drop-shadow(0 0 2em #646cffaa);
+<style scoped lang="scss">
+.view-box {
+  height: calc(
+    100vh - 98px + constant(safe-area-inset-bottom)
+  ); /* 兼容 iOS < 11.2 */
+  height: calc(
+    100vh - 98px + env(safe-area-inset-bottom)
+  ); /* 兼容 iOS >= 11.2 */
+  overflow-y: scroll;
+  &.no-tabbar {
+    height: calc(
+      100vh - 46px + constant(safe-area-inset-bottom)
+    ); /* 兼容 iOS < 11.2 */
+    height: calc(
+      100vh - 46px + constant(ssafe-area-inset-bottom)
+    ); /* 兼容 iOS >= 11.2 */
+  }
 }
-.logo.vue:hover {
-  filter: drop-shadow(0 0 2em #42b883aa);
-} */
 </style>

+ 44 - 0
frontEndMobile/src/api/api.ts

@@ -0,0 +1,44 @@
+// src/services/api.ts
+
+import http from './http';
+
+// 定义接口类型
+interface User {
+  id: number;
+  name: string;
+  email: string;
+}
+
+// 登陆
+export const loginUser = async (params): Promise<User[]> => {
+  const response = await http.post<User[]>('/api/v1/login', params);
+  return response.data;
+};
+// 获取用户列表
+export const getUserInfo = async (): Promise<User[]> => {
+  const response = await http.post<User[]>('/api/v1/auth/user_info');
+  return response.data;
+};
+
+// 获取单个用户
+export const fetchUserById = async (id: number): Promise<User> => {
+  const response = await http.get<User>(`/users/${id}`);
+  return response.data;
+};
+
+// 创建新用户
+export const createUser = async (user: Omit<User, 'id'>): Promise<User> => {
+  const response = await http.post<User>('/users', user);
+  return response.data;
+};
+
+// 更新用户
+export const updateUser = async (id: number, user: Partial<User>): Promise<User> => {
+  const response = await http.put<User>(`/users/${id}`, user);
+  return response.data;
+};
+
+// 删除用户
+export const deleteUser = async (id: number): Promise<void> => {
+  await http.delete(`/users/${id}`);
+};

+ 48 - 0
frontEndMobile/src/api/http.ts

@@ -0,0 +1,48 @@
+// src/services/http.ts
+
+import axios, { AxiosInstance } from 'axios';
+import router from '@/router';
+
+// 创建一个 Axios 实例
+const http: AxiosInstance = axios.create({
+  baseURL: 'http://127.0.0.1:3000', // 替换为你的 API 基础 URL
+  timeout: 10000, // 请求超时时间
+  headers: {
+    'Content-Type': 'application/json',
+  },
+});
+
+// 请求拦截器
+http.interceptors.request.use(
+  config => {
+    // 在发送请求之前做些什么(例如添加 token)
+    const token = localStorage.getItem('token');
+    if (token) {
+      config.headers.Authorization = `${token}`;
+    }
+    return config;
+  },
+  error => {
+    // 处理请求错误
+    return Promise.reject(error);
+  }
+);
+
+// 响应拦截器
+http.interceptors.response.use(
+  response => {
+    // 对响应数据做点什么
+    return response;
+  },
+  error => {
+    if (error.status === 400) {
+      router.push({
+        name: 'login'
+      })
+    }
+    // 处理响应错误
+    return Promise.reject(error);
+  }
+);
+
+export default http;

+ 63 - 0
frontEndMobile/src/components/RecordInRow.vue

@@ -0,0 +1,63 @@
+<template>
+  <div
+    v-for="(item, index) in time_record_list"
+    :key="`${yearStr}_${monthlyStr}_${index}`"
+    class="records_time_box"
+  >
+    <div class="time-box">
+      <div>11月30日</div>
+      <div>
+        <span>收入: 888</span>
+        <span>支出: 888</span>
+      </div>
+    </div>
+    <!-- 日期 -->
+    <div
+      v-for="(record, recordIndex) in item.record_list"
+      class="record-box"
+      :key="`${yearStr}_${monthlyStr}_${index}_${recordIndex}`"
+    >
+      <div>零食</div>
+      <div>-8</div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { toRefs, defineProps } from 'vue'
+
+const props = defineProps({
+  time_record_list: Object,
+  yearStr: String,
+  monthlyStr: String
+})
+
+const { time_record_list } = toRefs(props)
+const { yearStr } = toRefs(props)
+const { monthlyStr } = toRefs(props)
+</script>
+
+<style lang="scss" scoped>
+/* 当月详细账单 */
+.records-box {
+  background-color: #999;
+  overflow-y: scroll;
+  height: calc(100vh - 96px - 75px);
+  border-top: 1px solid #999;
+  .records_time_box {
+    border-bottom: 1px solid #999;
+    .time-box {
+      display: flex;
+      justify-content: space-between;
+      padding: 5px 12px;
+      font-size: 12px;
+      color: #999;
+    }
+    .record-box {
+      display: flex;
+      justify-content: space-between;
+      padding: 5px 12px;
+    }
+  }
+}
+</style>

+ 4 - 1
frontEndMobile/src/main.ts

@@ -1,8 +1,11 @@
 import { createApp } from 'vue'
 // 1. 引入你需要的组件
 import vant from 'vant'
+import VueHashCalendar from 'vue3-hash-calendar';
+
 // 2. 引入组件样式
 import 'vant/lib/index.css'
+import 'vue3-hash-calendar/es/index.css';
 
 import { createPinia } from 'pinia'
 
@@ -20,5 +23,5 @@ setupRouter(app);
 setupStore(app);
 app.use(pinia)
 app.use(vant)
-app.use(vant)
+app.use(VueHashCalendar)
 app.mount('#app')

+ 0 - 2
frontEndMobile/src/router/routes/index.ts

@@ -9,9 +9,7 @@ console.log(66666, modules);
 const routes: RouteRecordRaw[] = []
 
 Object.keys(modules).forEach((key) => {
-  console.log(12, key)
   const modulesRoutes = modules[key].default || {}
-
   let modRoutesList = []
   if (Array.isArray(modulesRoutes)) {
     modRoutesList = [...modulesRoutes]

+ 23 - 0
frontEndMobile/src/router/routes/modules/common.ts

@@ -1,3 +1,4 @@
+import { title } from 'process'
 import type { RouteRecordRaw } from 'vue-router'
 
 // 路由规则
@@ -5,11 +6,33 @@ const routes: RouteRecordRaw[] = [
   {
     path: '/home',
     name: 'home',
+    meta: {
+      title: '首页'
+    },
     component: () => import('@/views/HomePage.vue')
   },
+  {
+    path: '/me',
+    name: 'me',
+    meta: {
+      title: '我的'
+    },
+    component: () => import('@/views/MePage.vue')
+  },
+  {
+    path: '/accountLog',
+    name: 'accountLog',
+    meta: {
+      title: '记账'
+    },
+    component: () => import('@/views/AccountLogPage.vue')
+  },
   {
     path: '/login',
     name: 'login',
+    meta: {
+      title: '登陆'
+    },
     component: () => import('@/views/LoginPage.vue')
   }
 ]

+ 5 - 61
frontEndMobile/src/style.css

@@ -3,9 +3,8 @@
   line-height: 1.5;
   font-weight: 400;
 
-  color-scheme: light dark;
-  color: rgba(255, 255, 255, 0.87);
-  background-color: #242424;
+  /* color-scheme: light dark; */
+  /* color: rgba(255, 255, 255, 0.87); */
 
   font-synthesis: none;
   text-rendering: optimizeLegibility;
@@ -13,67 +12,12 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
-a {
-  font-weight: 500;
-  color: #646cff;
-  text-decoration: inherit;
-}
-a:hover {
-  color: #535bf2;
-}
-
-body {
-  margin: 0;
-  display: flex;
-  place-items: center;
-  min-width: 320px;
-  min-height: 100vh;
-}
-
-h1 {
-  font-size: 3.2em;
-  line-height: 1.1;
-}
-
-button {
-  border-radius: 8px;
-  border: 1px solid transparent;
-  padding: 0.6em 1.2em;
-  font-size: 1em;
-  font-weight: 500;
-  font-family: inherit;
-  background-color: #1a1a1a;
-  cursor: pointer;
-  transition: border-color 0.25s;
-}
-button:hover {
-  border-color: #646cff;
-}
-button:focus,
-button:focus-visible {
-  outline: 4px auto -webkit-focus-ring-color;
-}
-
-.card {
-  padding: 2em;
-}
-
 #app {
   max-width: 1280px;
+  height: 100vh;
+  overflow: hidden;
   margin: 0 auto;
-  padding: 2rem;
+  padding: 0;
   text-align: center;
 }
 
-@media (prefers-color-scheme: light) {
-  :root {
-    color: #213547;
-    background-color: #ffffff;
-  }
-  a:hover {
-    color: #747bff;
-  }
-  button {
-    background-color: #f9f9f9;
-  }
-}

+ 41 - 0
frontEndMobile/src/views/AccountLogPage.vue

@@ -0,0 +1,41 @@
+<template>
+  <vue-hash-calendar
+    :change-year-fast="true"
+    @change="calendarChange"
+    show-arrow
+  />
+  <!-- <div @click="getuserToken">getuserToken</div>
+  <br />
+  <div @click="getuserInfo">getuserInfo</div>
+
+  <br /> -->
+
+  <!-- mark-date 标记 -->
+</template>
+
+<script setup>
+import { onMounted } from 'vue'
+import dayjs from 'dayjs'
+import { loginUser, getUserInfo } from '@/api/api.ts'
+async function getuserToken() {
+  const res = await loginUser({
+    account: 'x.czvufulcym@qqxhjl.ee',
+    account_type: 2,
+    password: 'admin'
+  })
+  console.log(13, res.data.token)
+  window.localStorage.setItem('token', res.data.token)
+}
+async function getuserInfo() {
+  const res = await getUserInfo()
+  console.log(13, res)
+}
+
+onMounted(() => {
+  console.log('home onShow')
+})
+
+const calendarChange = (date) => {
+  console.log(40, dayjs(date).format('YYYY-MM-DD'))
+}
+</script>

+ 126 - 3
frontEndMobile/src/views/HomePage.vue

@@ -1,16 +1,104 @@
 <template>
-    <div>Home
+  <div>
+    <div class="time-box title-fs">
+      <div class="yarn-box">
+        <div class="year" @click="selectTime">{{ yearStr }}年</div>
+        <div>收入</div>
+      </div>
+      <div class="yarn-box space-between">
+        <div>支出</div>
+        <div><van-icon name="eye-o" /></div>
+      </div>
+    </div>
+    <div class="time-box">
+      <div class="yarn-box">
+        <div class="year right-line" @click="selectTime">
+          {{ monthlyStr }}月
+        </div>
+        <div>0.00</div>
+      </div>
+      <div class="yarn-box">
+        <div>99999</div>
+      </div>
+    </div>
+  </div>
 
+  <!-- 时间列表 -->
+  <div class="records-box">
+    <RecordInRow :time_record_list="time_record_list" :monthlyStr="monthlyStr" :yearStr=yearStr></RecordInRow>
+  </div>
 
-    <div @click="getLogin">getget</div>
-    </div>
+  <!-- 选择时间 -->
+  <van-action-sheet v-model:show="showSelectTime" title="" :closeable="false">
+    <van-date-picker
+      @cancel="cancelSelectTime"
+      @confirm="confirmSelectTime"
+      :columns-type="['year', 'month']"
+      v-model="currentDateAfter"
+      title="选择日期"
+    />
+  </van-action-sheet>
 </template>
 
 <script setup>
+import { ref, computed, watch, onMounted } from 'vue'
 import {register} from '@/api/base'
+import dayjs from 'dayjs'
+import RecordInRow from "@/components/RecordInRow.vue"
+
+const showSelectTime = ref(false)
+const currentDate = ref([])
+const currentDateAfter = ref([])
+
+const time_record_list = ref([])
+
+const selectTime = () => {
+  if (!currentDate.value.length) {
+    const timeStr = dayjs().format('YYYY,MM')
+    currentDate.value = timeStr.split(',')
+  }
+  showSelectTime.value = true
+
+  currentDateAfter.value = currentDate.value
+}
+
+const cancelSelectTime = () => {
+  showSelectTime.value = false
+}
+
+const confirmSelectTime = ({ selectedValues }) => {
+  currentDate.value = selectedValues
+  cancelSelectTime()
+}
 
+const yearStr = computed(() => {
+  if (!currentDate.value.length) {
+    const timeStr = dayjs().format('YYYY,MM')
+    return timeStr.split(',')[0]
+  }
+  return `${currentDate.value[0]}`
+})
+const monthlyStr = computed(() => {
+  if (!currentDate.value.length) {
+    const timeStr = dayjs().format('YYYY,MM')
+    return timeStr.split(',')[1]
+  }
+  return `${currentDate.value[1]}`
+})
 
+onMounted(() => {
+  for (let index = 0; index < 40; index++) {
+    const elm = {
+      name: 'name' + index,
+      record_list: []
+    }
+    for (let j = 0; j < 10; j++) {
+      elm.record_list.push({})
+    }
 
+    time_record_list.value.push(elm)
+  }
+})
 async function getLogin() {
   await register({
       "account": "x.czvufulcym@qqxhjl.ee",
@@ -19,3 +107,38 @@ async function getLogin() {
   })
 }
 </script>
+
+<style scoped lang="scss">
+.time-box {
+  display: flex;
+  justify-content: space-between;
+  padding: 0 12px 12px;
+
+  .yarn-box {
+    width: 40%;
+    display: flex;
+
+    .year {
+      width: 60px;
+      &.right-line {
+        text-align: left;
+      }
+    }
+  }
+  font-size: 20px;
+  &.title-fs {
+    font-size: 12px;
+    padding-bottom: 0;
+    padding-top: 12px;
+    .yarn-box {
+      text-align: left;
+    }
+    .yarn-box.space-between {
+      justify-content: space-between;
+    }
+  }
+}
+
+
+</style>
+>>>>>>> origin/master

+ 38 - 2
frontEndMobile/src/views/LoginPage.vue

@@ -1,3 +1,39 @@
 <template>
-    <div>login</div>
-</template>
+    <div>
+      <van-form @submit="onSubmit">
+        <van-cell-group inset>
+          <van-field
+            v-model="username"
+            name="用户名"
+            label="用户名"
+            placeholder="用户名"
+            :rules="[{ required: true, message: '请填写用户名' }]"
+          />
+          <van-field
+            v-model="password"
+            type="password"
+            name="密码"
+            label="密码"
+            placeholder="密码"
+            :rules="[{ required: true, message: '请填写密码' }]"
+          />
+        </van-cell-group>
+        <div style="margin: 16px">
+          <van-button round block type="primary" native-type="submit">
+            提交
+          </van-button>
+        </div>
+      </van-form>
+    </div>
+  </template>
+
+  <script setup>
+  import { ref } from 'vue'
+  const password = ref('')
+  const username = ref('')
+
+  function onSubmit() {
+
+  }
+
+  </script>

+ 3 - 0
frontEndMobile/src/views/MePage.vue

@@ -0,0 +1,3 @@
+<template>
+  <div>me</div>
+</template>

+ 33 - 19
frontEndMobile/vite.config.ts

@@ -1,27 +1,41 @@
-import { defineConfig } from 'vite'
-import vue from '@vitejs/plugin-vue'
-import { resolve, dirname } from 'path';
-import { fileURLToPath } from 'url';
-
-
-// 获取当前文件的目录
-// const __dirname = dirname(fileURLToPath(import.meta.url));
+import { defineConfig } from 'vite';
+import vue from '@vitejs/plugin-vue';
+import { resolve } from 'path';
 
 // https://vitejs.dev/config/
 export default defineConfig({
- resolve: {
-   alias: {
-     '@': resolve(__dirname, './src')
-   }
- },
+  // 路径解析
+  resolve: {
+    alias: {
+      '@': resolve(__dirname, './src'), // 使用 '@' 作为 src 路径别名
+    },
+  },
+  // 插件配置
   plugins: [vue()],
+  // 开发服务器配置
   server: {
-    host: 'localhost',
-    port: 3031,
-    open: true // 启动服务时自动打开浏览器
+    host: '0.0.0.0', // 允许外部设备访问
+    port: 3032, // 自定义端口
+    open: true, // 启动服务时自动打开默认浏览器
+    strictPort: true, // 如果端口被占用,则直接退出,而不是尝试下一个可用端口
+    cors: true, // 启用 CORS
   },
+  // 构建配置
   build: {
     outDir: 'dist', // 构建输出目录
-    sourcemap: true, // 生成 sourcemap 以便于调试
-  }
-})
+    sourcemap: true, // 生成 source map,便于调试
+    chunkSizeWarningLimit: 500, // 调整 chunk 大小警告阈值(默认 500KB)
+    rollupOptions: {
+      output: {
+        manualChunks: {
+          // 将依赖拆分成独立的 chunk
+          vendor: ['vue'], // 单独打包 Vue 相关库
+        },
+      },
+    },
+  },
+  // 其他优化选项
+  optimizeDeps: {
+    include: ['vue'], // 提前优化 vue 相关依赖
+  },
+});

Diff do ficheiro suprimidas por serem muito extensas
+ 818 - 2
frontEndMobile/yarn.lock


+ 0 - 19
node_expores/Dockerfile

@@ -1,27 +1,8 @@
-# 使用 node 18 作为基础镜像
 FROM node:18.20.4
-
-# 设置工作目录
 WORKDIR /app
-
-# 安装 yarn@1
-# RUN npm install -g yarn@1 --registry=https://registry.npmmirror.com
-
-# 将 package.json 和 yarn.lock 拷贝到容器中
-# COPY package.json yarn.lock ./
 COPY package*.json ./
-
-# 安装依赖,并设置国内镜像
 RUN npm install
-
-# 拷贝项目的所有文件到容器中
 COPY . .
-
-# 对外暴露 8080 端口
 EXPOSE 3000
-
-# 设置 files 目录为一个卷,以便于数据持久化或文件共享
 VOLUME /app/base_files
-
-# 启动应用(根据您项目的启动命令修改)
 CMD ["node", "app.js"]

+ 1 - 1
node_expores/app.js

@@ -20,7 +20,7 @@ app.use(express.static('public'));
 
 // 全局启用 CORS
 const corsOptions = {
-    origin: 'http://localhost:3000', // 仅允许这个来源
+    origin: 'http://localhost:3032', // 仅允许这个来源
     methods: ['GET', 'POST', "PUT", "DELETE"], // 允许的 HTTP 方法
     allowedHeaders: ['Content-Type', 'Authorization'], // 允许的头部
 };

+ 10 - 10
node_expores/environment/index.js

@@ -1,19 +1,19 @@
 function dbInfo() {
   // 根据需要更新db的数据配置
-  return {
-    host: "localhost",
-    port: 3306,
-    user: "root",
-    password: "12345678",
-    database: "cashbook",
-  };
   // return {
-  //   host: "192.168.2.103",
-  //   port: 6806,
+  //   host: "localhost",
+  //   port: 3306,
   //   user: "root",
-  //   password: "admin",
+  //   password: "12345678",
   //   database: "cashbook",
   // };
+  return {
+    host: "192.168.2.101",
+    port: 6806,
+    user: "root",
+    password: "admin",
+    database: "cashbook",
+  };
 }
 
 

+ 8 - 9
node_expores/router/authors/index.js

@@ -1,11 +1,7 @@
 // 添加账本
 import express from "express";
 import { generateToken, aes_encrypt, shanghaiTime } from "#utils";
-import {
-  isHaveUserByUserId,
-  auth_insert,
-  isLoginUserByUserId,
-} from "#db";
+import { isHaveUserByUserId, auth_insert, isLoginUserByUserId } from "#db";
 const router = express.Router();
 import { v4 as uuidv4 } from "uuid";
 
@@ -22,7 +18,10 @@ router.post("/register", async function (req, res) {
   const user_id = uuidv4();
 
   if (await isHaveUserByUserId({ user_id, mobile: account, email: account })) {
-    res.status(500).send("当前注册信息有重复,请检查之后重新提交!");
+    res.send({
+      code: 500,
+      msg: "当前注册信息有重复,请检查之后重新提交!",
+    });
     return;
   }
   // 写入数据
@@ -56,9 +55,9 @@ router.post("/", async function (req, res) {
     });
     return;
   }
-  delete islogin.password
-  delete islogin.login_type
-  delete islogin.id
+  delete islogin.password;
+  delete islogin.login_type;
+  delete islogin.id;
   const token = generateToken(islogin);
   res.json({
     code: 200,

+ 6 - 11
node_expores/yarn.lock

@@ -219,11 +219,6 @@ crypto@^1.0.1:
   resolved "https://registry.npmmirror.com/crypto/-/crypto-1.0.1.tgz#2af1b7cad8175d24c8a1b0778255794a21803037"
   integrity sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==
 
-dayjs-plugin-utc@^0.1.2:
-  version "0.1.2"
-  resolved "https://registry.npmmirror.com/dayjs-plugin-utc/-/dayjs-plugin-utc-0.1.2.tgz#48e552407024143922d6499a40f6c765f8c93d03"
-  integrity sha512-ExERH5o3oo6jFOdkvMP3gytTCQ9Ksi5PtylclJWghr7k7m3o2U5QrwtdiJkOxLOH4ghr0EKhpqGefzGz1VvVJg==
-
 dayjs@^1.11.13:
   version "1.11.13"
   resolved "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz#92430b0139055c3ebb60150aa13e860a4b5a366c"
@@ -638,9 +633,9 @@ object-assign@^4:
   integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
 
 object-inspect@^1.13.1:
-  version "1.13.2"
-  resolved "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff"
-  integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==
+  version "1.13.3"
+  resolved "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.3.tgz#f14c183de51130243d6d18ae149375ff50ea488a"
+  integrity sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==
 
 on-finished@2.4.1:
   version "2.4.1"
@@ -854,9 +849,9 @@ utils-merge@1.0.1:
   integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==
 
 uuid@^11.0.2:
-  version "11.0.2"
-  resolved "https://registry.npmmirror.com/uuid/-/uuid-11.0.2.tgz#a8d68ba7347d051e7ea716cc8dcbbab634d66875"
-  integrity sha512-14FfcOJmqdjbBPdDjFQyk/SdT4NySW4eM0zcG+HqbHP5jzuH56xO3J1DGhgs/cEMCfwYi3HQI1gnTO62iaG+tQ==
+  version "11.0.3"
+  resolved "https://registry.npmmirror.com/uuid/-/uuid-11.0.3.tgz#248451cac9d1a4a4128033e765d137e2b2c49a3d"
+  integrity sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg==
 
 vary@^1, vary@~1.1.2:
   version "1.1.2"

+ 4 - 0
yarn.lock

@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff