소스 검색

修改和优化

快乐的梦鱼 2 달 전
부모
커밋
906fff1856
9개의 변경된 파일113개의 추가작업 그리고 30개의 파일을 삭제
  1. 1 1
      src/common/config/AppCofig.ts
  2. 3 0
      src/env.d.ts
  3. 14 0
      src/pages.json
  4. 2 1
      src/pages/dig/forms/common.vue
  5. 12 0
      src/pages/home/about/about.vue
  6. 12 0
      src/pages/home/about/contract.vue
  7. 27 24
      src/pages/index.vue
  8. 24 3
      src/pages/user/index.vue
  9. 18 1
      vite.config.ts

+ 1 - 1
src/common/config/AppCofig.ts

@@ -3,7 +3,7 @@
  * 说明:应用静态配置
  */
 export default {
-  version: '0.0.1',
+  version: '1.0.0',
   appId: 'wx954621c03f2fa912',
   qqMapKey: 'TOIBZ-CA4WB-OFQUF-J3XG4-EEB2J-DXBX7',
   amapKey: '34eb1d57f93720a871bd11a90af0c91c',

+ 3 - 0
src/env.d.ts

@@ -6,3 +6,6 @@ declare module '*.vue' {
   const component: DefineComponent<{}, {}, any>
   export default component
 }
+
+declare const __BUILD_GUID__: string;
+declare const __BUILD_TIMESTAMP__: number;

+ 14 - 0
src/pages.json

@@ -148,6 +148,20 @@
         "navigationBarTitleText": "注册成为志愿者",
         "enablePullDownRefresh": false
       }
+    },
+    {
+      "path": "pages/home/about/about",
+      "style": {
+        "navigationBarTitleText": "关于我们",
+        "enablePullDownRefresh": false
+      }
+    },
+    {
+      "path": "pages/home/about/contract",
+      "style": {
+        "navigationBarTitleText": "商务合作",
+        "enablePullDownRefresh": false
+      }
     }
   ],
   "globalStyle": {

+ 2 - 1
src/pages/dig/forms/common.vue

@@ -102,7 +102,8 @@ const { querys } = useLoadQuerys({
           querys.villageId, 
           querys.villageVolunteerId
         );
-        findId = list[0].id;
+        if (list?.length > 0)
+          findId = list[0].id;
       }
       formData = await VillageInfoApi.getInfo(
         collectStore.getCollectModuleId(querys.subType),

+ 12 - 0
src/pages/home/about/about.vue

@@ -0,0 +1,12 @@
+<template>
+  <FlexCol>
+    <H4>公司介绍页待补充</H4>
+  </FlexCol>
+</template>
+
+<script setup lang="ts">
+import H4 from '@/components/typography/H4.vue';
+import FlexCol from '@/components/layout/FlexCol.vue';
+
+
+</script>

+ 12 - 0
src/pages/home/about/contract.vue

@@ -0,0 +1,12 @@
+<template>
+  <FlexCol>
+    <H4>合作海报页待补充</H4>
+  </FlexCol>
+</template>
+
+<script setup lang="ts">
+import H4 from '@/components/typography/H4.vue';
+import FlexCol from '@/components/layout/FlexCol.vue';
+
+
+</script>

+ 27 - 24
src/pages/index.vue

@@ -1,29 +1,31 @@
 <template>
 	<view class="index">
-    <StatusBarSpace backgroundColor="transparent" />
-    <NavBar 
-      :title="title"
-      :titleScroll="false"
-      backgroundColor="transparent"
-      textColor="white"
-      align="left"
-    />
-    <HomeIndex v-if="tabIndex === 0" @goDiscover="tabIndex = 1" />
-    <DiscoverIndex v-else-if="tabIndex === 1" />
-    <DigIndex v-else-if="tabIndex === 2" />
-    <StoreIndex v-else-if="tabIndex === 3" />
-    <UserIndex v-else-if="tabIndex === 4" @goSubmit="tabIndex = 2" />
-    <TabBar
-      v-model:selectedTabIndex="tabIndex"
-      fixed
-      xbarSpace
-    >
-      <TabBarItem icon="/static/images/tabs/home.png" activeIcon="/static/images/tabs/home-active.png" text="首页" />
-      <TabBarItem icon="/static/images/tabs/discover.png" activeIcon="/static/images/tabs/discover-active.png" text="发现" />
-      <TabBarItem icon="/static/images/tabs/dig.png" hump :humpHeight="[ 10, 10 ]" :humpSpace="[20,20]" :iconSize="140" />
-      <TabBarItem icon="/static/images/tabs/store.png" activeIcon="/static/images/tabs/store-active.png" text="知识库" />
-      <TabBarItem icon="/static/images/tabs/user.png" activeIcon="/static/images/tabs/user-active.png" text="我的" />
-    </TabBar>
+    <CommonRoot>
+      <StatusBarSpace backgroundColor="transparent" />
+      <NavBar 
+        :title="title"
+        :titleScroll="false"
+        backgroundColor="transparent"
+        textColor="white"
+        align="left"
+      />
+      <HomeIndex v-if="tabIndex === 0" @goDiscover="tabIndex = 1" />
+      <DiscoverIndex v-else-if="tabIndex === 1" />
+      <DigIndex v-else-if="tabIndex === 2" />
+      <StoreIndex v-else-if="tabIndex === 3" />
+      <UserIndex v-else-if="tabIndex === 4" @goSubmit="tabIndex = 2" />
+      <TabBar
+        v-model:selectedTabIndex="tabIndex"
+        fixed
+        xbarSpace
+      >
+        <TabBarItem icon="/static/images/tabs/home.png" activeIcon="/static/images/tabs/home-active.png" text="首页" />
+        <TabBarItem icon="/static/images/tabs/discover.png" activeIcon="/static/images/tabs/discover-active.png" text="发现" />
+        <TabBarItem icon="/static/images/tabs/dig.png" hump :humpHeight="[ 10, 10 ]" :humpSpace="[20,20]" :iconSize="140" />
+        <TabBarItem icon="/static/images/tabs/store.png" activeIcon="/static/images/tabs/store-active.png" text="知识库" />
+        <TabBarItem icon="/static/images/tabs/user.png" activeIcon="/static/images/tabs/user-active.png" text="我的" />
+      </TabBar>
+    </CommonRoot>
 	</view>
 </template>
 
@@ -38,6 +40,7 @@ import UserIndex from './user/index.vue';
 import HomeIndex from './home/index.vue';
 import DiscoverIndex from './home/discover/index.vue';
 import StoreIndex from './home/store/index.vue';
+import CommonRoot from '@/components/dialog/CommonRoot.vue';
 
 const title = computed(() => {
   switch (tabIndex.value) {

+ 24 - 3
src/pages/user/index.vue

@@ -25,18 +25,25 @@
     <CellGroup round>
       <Cell icon="/static/images/user/icon-edit.png" title="我的投稿" showArrow touchable @click="$emit('goSubmit')" />
       <Cell icon="/static/images/user/icon-profile.png" title="编辑资料" showArrow touchable @click="goUserProfile" />
-      <Cell icon="/static/images/user/icon-function.png" title="关于我们" showArrow touchable />
-      <Cell icon="/static/images/user/icon-chat.png" title="商务合作" showArrow touchable />
+      <Cell icon="/static/images/user/icon-function.png" title="关于我们" showArrow touchable @click="navTo('/pages/home/about/about')" />
+      <Cell icon="/static/images/user/icon-chat.png" title="商务合作" showArrow touchable @click="navTo('/pages/home/about/contract')" />
       <Cell v-if="userInfo" icon="/static/images/user/icon-quit.png" title="退出登录" showArrow touchable @click="doLogout" />
     </CellGroup>
+    <Touchable direction="column" center :padding="40" :gap="10" @click="showBuildInfo">
+      <Text 
+        color="text.second"
+        :fontSize="22"
+        :text="`软件版本 ${AppCofig.version}`"
+      />
+    </Touchable>
   </FlexCol>
 </template>
 
 <script setup lang="ts">
 import { useAuthStore } from '@/store/auth';
 import { computed } from 'vue';
-import { confirm } from '@/components/utils/DialogAction';
 import { navTo } from '@/components/utils/PageAction';
+import { alert, confirm } from '@/components/dialog/CommonRoot';
 import UserHead from '@/static/images/user/avatar.png';
 import CellGroup from '@/components/basic/CellGroup.vue';
 import Cell from '@/components/basic/Cell.vue';
@@ -45,10 +52,24 @@ import H4 from '@/components/typography/H4.vue';
 import Height from '@/components/layout/space/Height.vue';
 import Touchable from '@/components/feedback/Touchable.vue';
 import FlexCol from '@/components/layout/FlexCol.vue';
+import Text from '@/components/basic/Text.vue';
+import AppCofig from '@/common/config/AppCofig';
+import { DateUtils } from '@imengyu/imengyu-utils';
 
 const authStore = useAuthStore();
 const userInfo = computed(() => authStore.userInfo);
+const buildTime = `${__BUILD_TIMESTAMP__}`
+const buildInfo = `${__BUILD_GUID__}`
 
+function showBuildInfo() {
+  alert({
+    title: '关于程序',
+    content: '版本: ' + AppCofig.version +
+     '\n构建时间:' + DateUtils.formatDate(new Date(parseInt(buildTime)), 'yyyy-MM-dd HH:mm:ss') + 
+        ' (' + buildTime + ')' + 
+     '\n构建GUID:' + buildInfo,
+  })
+}
 function goUserProfile() {
   userInfo.value ? navTo('/pages/user/update/profile') : navTo('/pages/user/login');
 }

+ 18 - 1
vite.config.ts

@@ -1,6 +1,19 @@
 import { defineConfig } from "vite";
+import { execSync } from 'child_process';
 import uni from "@dcloudio/vite-plugin-uni";
 
+// 获取当前git提交的ID
+function getGitCommitId() {
+  try {
+    // 执行git命令获取当前提交的SHA值
+    const commitId = execSync('git rev-parse HEAD').toString().trim();
+    return commitId;
+  } catch (error) {
+    console.error('获取git提交ID失败:', error);
+    return '';
+  }
+}
+
 // https://vitejs.dev/config/
 export default defineConfig({
   plugins: [uni()],
@@ -11,4 +24,8 @@ export default defineConfig({
       },
     },
   },
-});
+  define: {
+    __BUILD_GUID__: JSON.stringify(getGitCommitId()), //当前 git 提交的 id
+    __BUILD_TIMESTAMP__: Date.now() //时间戳(数字)
+  }
+});