Browse Source

🎈 perf: 优化了部分细节

Pchen. 10 months ago
parent
commit
2b7fe462fe

+ 2 - 0
.gitignore

@@ -7,6 +7,8 @@ yarn-error.log*
 pnpm-debug.log*
 lerna-debug.log*
 
+.env
+
 node_modules
 dist
 dist-ssr

+ 1 - 1
src/app/lib/ServerAPI.js

@@ -1,6 +1,6 @@
 import { Core } from "./Core";
 
-let core = new Core('http://127.0.0.1:8091');
+let core = new Core(import.meta.env.VITE_API_URL);
 
 class ServerAPI {
     //用户相关

+ 8 - 4
src/components/Header.vue

@@ -22,15 +22,15 @@
                     </div>
                     <div class="item" @click="$router.push('/ClockIn')">
                         <el-icon>
-                            <Edit />
+                            <MapLocation />
                         </el-icon>
                         我的考勤
                     </div>
-                    <div class="item" @click="$router.push('/MyOrder')">
+                    <div class="item" @click="push('https://git.vthc.cn/Pchen0/Double_X_Attendance')">
                         <el-icon>
-                            <Postcard />
+                            <FolderOpened />
                         </el-icon>
-                        补卡申请
+                        代码仓库
                     </div>
                     <div class="item" v-if="app.user === undefined" @click="$router.push('/login')">
                         <el-icon>
@@ -109,6 +109,10 @@ if (user != undefined) {
         router.push('/login');
     })
 }
+
+const push = (url) => {
+    window.open(url);
+}
 </script>
 
 <style scoped>

+ 0 - 1
src/pages/Admin/ClockIn/components/AddItem.vue

@@ -61,7 +61,6 @@
 </template>
 
 <script setup>
-import { reactive, ref } from 'vue';
 import { useRouter } from 'vue-router';
 import { ServerAPI } from '../../../../app/lib/ServerAPI';
 import { App } from '../../../../app/app';

+ 7 - 8
src/pages/Admin/ClockIn/components/MapContainer.vue

@@ -10,7 +10,7 @@ const emit = defineEmits(['update']);
 
 let props = defineProps({
   position: {
-    type: Object,
+    type: Array,
     default: () => ([])
   },
   radius: {
@@ -30,16 +30,16 @@ watch(
 let map = null;
 let marker = ref('');
 let circle = ref('');
-let address = '';
+let address = ref(null);
 let geocoder;
 
 window._AMapSecurityConfig = {
-  serviceHost: "https://nsrh.ctbu.edu.cn/_AMapService",
+  serviceHost: import.meta.env.VITE_AMAP_HOST,
 };
 
 onMounted(() => {
   AMapLoader.load({
-    key: "d1f123693def8a412c976184daa4b60e",
+    key: import.meta.env.VITE_AMAP_KEY,
     version: "2.0",
   })
     .then((AMap) => {
@@ -92,13 +92,13 @@ const getAddress = async (position) => {
   })
   await geocoder.getAddress(position, function (status, result) {
     if (status === "complete" && result.info === "OK") {
-      address = result.regeocode.formattedAddress;
+      address.value = result.regeocode.formattedAddress;
     } else {
-      address = '未知';
+      address.value = '未知';
     }
     loading.close();
     //触发更新事件
-    emit('update', [position.KL, position.kT], address);
+    emit('update', [position.KL, position.kT], address.value);
   })
 }
 
@@ -108,7 +108,6 @@ const drawCircle = () => {
     center: props.position,
     radius: props.radius,
     borderWeight: 1,
-    strokeOpacity: 1,
     strokeOpacity: 0.2,
     fillOpacity: 0.4,
   })

+ 3 - 3
src/pages/ClockIn/components/MapContainer.vue

@@ -33,7 +33,7 @@ onMounted(() => {
   })
 
   AMapLoader.load({
-    key: "d1f123693def8a412c976184daa4b60e",
+    key: import.meta.env.VITE_AMAP_KEY,
     version: "2.0", 
   })
     .then((AMap) => {
@@ -46,7 +46,7 @@ onMounted(() => {
       AMap.plugin(["AMap.ToolBar", "AMap.Scale", "AMap.Geolocation", "AMap.CircleEditor", "AMap.Geocoder"], function () {
         var geolocation = new AMap.Geolocation({
           enableHighAccuracy: true,
-          timeout: 10000, 
+          timeout: 5000, 
           buttonPosition: 'RB',    //定位按钮的停靠位置
           buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
           zoomToAccuracy: true,
@@ -110,7 +110,7 @@ onMounted(() => {
 
 //解析定位错误信息
 function onError(data) {
-  alert(data.message);
+  ElMessage.error(`获取当前位置信息失败!${data.message}`);
 }
 
 onUnmounted(() => {

+ 18 - 19
src/pages/Main/Main.vue

@@ -15,45 +15,42 @@
             </el-icon>
             <span>我的考勤</span>
           </div>
-          <div class="button" @click="$router.push('/ClockIn')">
+          <div class="button"
+            @click="push('https://git.vthc.cn/Pchen0/Double_X_Attendance/src/master/README.md')">
             <el-icon :size="35">
               <List />
             </el-icon>
-            <span>补卡申请</span>
+            <span>操作文档</span>
           </div>
-          <div class="button" @click="$router.push('/')">
+          <div class="button" @click="push('https://git.vthc.cn/Pchen0/Double_X_Attendance.git')">
             <el-icon :size="35">
-              <PhoneFilled />
+              <Lollipop />
             </el-icon>
-            <span>占个位置</span>
+            <span>代码仓库</span>
           </div>
-          <div class="button" @click="$router.push('/')">
+          <div class="button" @click="$router.push('/Mine')">
             <el-icon :size="35">
-              <Lollipop />
+              <UserFilled />
             </el-icon>
-            <span>占个位置</span>
+            <span>个人中心</span>
           </div>
         </div>
       </div>
-
-      <el-button icon="ArrowDown" circle @click="scrollToSection('section2')" class="floating-button" />
+      <!-- <el-button icon="ArrowDown" circle @click="scrollToSection('section2')" class="floating-button" /> -->
     </div>
 
-    <div id="section2" class="section items">
+    <!-- TODO 首页没写完 -->
 
+    <!-- <div id="section2" class="section items">
     </div>
 
     <div id="section3" class="section items">
-
-    </div>
-
-
+    </div> -->
 
   </div>
-
-
+  <!-- 
   <el-backtop :right="70" :bottom="70" />
-  <Footer />
+  <Footer /> -->
 
 </template>
 
@@ -79,7 +76,9 @@ onMounted(async () => {
   }
 });
 
-provide('scrollToSection', scrollToSection);
+const push = (url) => {
+  window.open(url);
+}
 </script>
 
 <style scoped>

+ 21 - 9
src/pages/Mine/Mine.vue

@@ -48,18 +48,11 @@
                     <div class="button" @click="$router.push('/ClockInManage')"
                         v-if="permissions.includes('admin') || permissions.includes('manage')">
                         <el-icon :size="30">
-                            <SetUp />
+                            <Coin />
                         </el-icon>
                         <span>考勤项目管理</span>
                     </div>
 
-                    <div class="button" @click="$router.push('/ApplyPermission')">
-                        <el-icon :size="30">
-                            <MessageBox />
-                        </el-icon>
-                        <span>补卡申请</span>
-                    </div>
-
                     <div class="button" @click="$router.push('/Admin')" v-if="permissions.includes('admin')">
                         <el-icon :size="30">
                             <SetUp />
@@ -67,7 +60,7 @@
                         <span>网站管理</span>
                     </div>
 
-                    <div class="button" @click="$router.push('/UpdateInfoStage1')">
+                    <div class="button" @click="$router.push('/UpdateInfo')">
                         <el-icon :size="30">
                             <Setting />
                         </el-icon>
@@ -80,6 +73,21 @@
                         </el-icon>
                         <span>退出登录</span>
                     </div>
+
+                    <div class="button"
+                        @click="push('https://git.vthc.cn/Pchen0/Double_X_Attendance/src/master/README.md')">
+                        <el-icon :size="30">
+                            <Memo />
+                        </el-icon>
+                        <span>操作手册</span>
+                    </div>
+
+                    <div class="button" @click="push('https://git.vthc.cn/Pchen0/Double_X_Attendance')">
+                        <el-icon :size="30">
+                            <FolderOpened />
+                        </el-icon>
+                        <span>代码仓库</span>
+                    </div>
                 </div>
 
             </div>
@@ -135,6 +143,10 @@ let getPermission = () => {
 }
 
 getPermission();
+
+const push = (url) => {
+    window.open(url);
+}
 </script>
 
 <style scoped>

+ 6 - 0
src/pages/Setup/UpdateInfoStage1.vue

@@ -27,10 +27,12 @@
 
         <router-view></router-view>
     </div>
+    <Footer />
 </template>
 
 <script setup>
 import Header from '../../components/Header.vue';
+import Footer from '../../components/Footer.vue';
 import { App } from '../../app/app';
 import { useRouter } from 'vue-router';
 import { ServerAPI } from '../../app/lib/ServerAPI';
@@ -62,6 +64,10 @@ let onGetUrl = function () {
 </script>
 
 <style scoped>
+.root {
+    min-height: 70vh;
+}
+
 .avatar {
     margin-top: -20px;
     margin-bottom: 20px;

+ 1 - 0
src/router/index.js

@@ -50,6 +50,7 @@ const routes = [
         component: () => import('../pages/Admin/ClockIn/components/EditItem.vue'),
         meta: { title: '编辑考勤项目' }
     },
+    
     {
         name: "UpdateInfo",
         path: "/UpdateInfo",