From 40cd6c820e6641ee6eb4ce97ca5fb4719de7874d Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 03 十一月 2026 10:42:35 +0800
Subject: [PATCH] fix(app): 对齐同仁堂普通打卡流程

---
 src/pages/hrm/attendance-clock/index.vue |  398 +-------------------------------------------------------
 1 files changed, 9 insertions(+), 389 deletions(-)

diff --git a/src/pages/hrm/attendance-clock/index.vue b/src/pages/hrm/attendance-clock/index.vue
index 0909a2e..8e4f4b7 100644
--- a/src/pages/hrm/attendance-clock/index.vue
+++ b/src/pages/hrm/attendance-clock/index.vue
@@ -1,392 +1,12 @@
 <script setup lang="ts">
-import { computed, onBeforeUnmount, ref } from "vue";
-import { onPullDownRefresh, onShow } from "@dcloudio/uni-app";
-import {
-  clockIn,
-  clockOut,
-  getAttendanceMyStatus,
-  type AttendanceClockRequest,
-  type AttendanceClockResponse,
-  type AttendanceMyStatus,
-  type AttendanceRecord,
-} from "../../../api/hrm";
+import { computed, ref } from "vue";
+import { onShow } from "@dcloudio/uni-app";
+import { clockIn, clockOut, type AttendanceRecord } from "../../../api/hrm";
 import { useAuth } from "../../../stores/auth";
-
-const { state } = useAuth();
-const COOLDOWN_SECONDS = 15;
-const status = ref<AttendanceMyStatus>();
-const loading = ref(false);
-const punching = ref<"" | "in" | "out">("");
-const positioning = ref(false);
-const locationStatus = ref<"idle" | "locating" | "inside" | "outside" | "denied" | "error" | "poor">("idle");
-const currentAccuracy = ref<number>();
-const estimatedDistance = ref<number>();
-const lastClockResult = ref<AttendanceClockResponse>();
-const error = ref("");
-const now = ref(new Date());
-let clockOffset = 0;
-let timer: ReturnType<typeof setInterval> | undefined;
-
-function pad(value: number) { return String(value).padStart(2, "0"); }
-function localDate(value = new Date()) { return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}`; }
-function parseDateTime(value?: string) {
-  if (!value) return undefined;
-  const parsed = new Date(String(value).replace(" ", "T"));
-  return Number.isNaN(parsed.getTime()) ? undefined : parsed;
-}
-function clockTime(value?: string) {
-  const parsed = parseDateTime(value);
-  return parsed ? `${pad(parsed.getHours())}:${pad(parsed.getMinutes())}` : "--:--";
-}
-function fullClockTime(value?: string) {
-  const parsed = parseDateTime(value);
-  return parsed ? `${localDate(parsed)} ${pad(parsed.getHours())}:${pad(parsed.getMinutes())}` : "灏氭湭鎵撳崱";
-}
-function syncNow() { now.value = new Date(Date.now() + clockOffset); }
-
-const rule = computed(() => status.value?.rule || undefined);
-const record = computed(() => status.value?.record || undefined);
-const locationRequired = computed(() => rule.value?.locationRequired === true);
-const targetLocationName = computed(() => rule.value?.locationName || "鑰冨嫟鍦扮偣");
-const locationStatusText = computed(() => {
-  if (!locationRequired.value) return "褰撳墠瑙勫垯鏈惎鐢ㄤ綅缃檺鍒�";
-  if (locationStatus.value === "locating") return "姝e湪鑾峰彇楂樼簿搴﹀畾浣�...";
-  if (locationStatus.value === "denied") return "鏈幏寰楀畾浣嶆潈闄愶紝璇峰湪绯荤粺璁剧疆涓厑璁稿畾浣�";
-  if (locationStatus.value === "poor") return `瀹氫綅绮惧害 ${Math.round(currentAccuracy.value || 0)} 绫筹紝璇风Щ鍔ㄥ埌寮�闃斿閲嶈瘯`;
-  if (locationStatus.value === "error") return "瀹氫綅澶辫触锛岃妫�鏌ョ郴缁熷畾浣嶅紑鍏冲悗閲嶈瘯";
-  if (locationStatus.value === "inside") return `棰勮鍦ㄨ寖鍥村唴 路 璺濇墦鍗$偣绾� ${Math.round(estimatedDistance.value || 0)} 绫砢;
-  if (locationStatus.value === "outside") return `棰勮鍦ㄨ寖鍥村 路 璺濇墦鍗$偣绾� ${Math.round(estimatedDistance.value || 0)} 绫砢;
-  return "鐐瑰嚮鎵撳崱鍚庡皢鑾峰彇褰撳墠浣嶇疆";
-});
-
-function calculateDistance(longitude: number, latitude: number) {
-  const targetLongitude = rule.value?.longitude;
-  const targetLatitude = rule.value?.latitude;
-  if (targetLongitude === undefined || targetLatitude === undefined) return undefined;
-  const radians = (value: number) => value * Math.PI / 180;
-  const latDelta = radians(latitude - targetLatitude);
-  const lonDelta = radians(longitude - targetLongitude);
-  const value = Math.sin(latDelta / 2) ** 2
-    + Math.cos(radians(targetLatitude)) * Math.cos(radians(latitude)) * Math.sin(lonDelta / 2) ** 2;
-  const bounded = Math.min(1, Math.max(0, value));
-  return 6371000 * 2 * Math.atan2(Math.sqrt(bounded), Math.sqrt(1 - bounded));
-}
-
-function getCurrentLocation(): Promise<AttendanceClockRequest> {
-  if (!locationRequired.value) return Promise.resolve({});
-  if (positioning.value) return Promise.reject(new Error("姝e湪瀹氫綅锛岃绋嶅��"));
-  positioning.value = true;
-  locationStatus.value = "locating";
-  return new Promise((resolve, reject) => {
-    uni.getLocation({
-      type: "wgs84",
-      isHighAccuracy: true,
-      highAccuracyExpireTime: 8000,
-      success: result => {
-        const accuracy = Number(result.accuracy || result.horizontalAccuracy || 0);
-        currentAccuracy.value = accuracy;
-        if (!Number.isFinite(accuracy) || accuracy <= 0) {
-          locationStatus.value = "error";
-          reject(new Error("鏈幏鍙栧埌鏈夋晥鐨勫畾浣嶇簿搴︼紝璇烽噸鏂板畾浣�"));
-          return;
-        }
-        if (accuracy > 100) {
-          locationStatus.value = "poor";
-          reject(new Error(`褰撳墠瀹氫綅绮惧害涓� ${Math.round(accuracy)} 绫筹紝璇风Щ鍔ㄥ埌寮�闃斿閲嶆柊瀹氫綅`));
-          return;
-        }
-        estimatedDistance.value = calculateDistance(result.longitude, result.latitude);
-        locationStatus.value = estimatedDistance.value !== undefined
-          && estimatedDistance.value > (rule.value?.radiusMeters || 200) ? "outside" : "inside";
-        resolve({
-          longitude: result.longitude,
-          latitude: result.latitude,
-          accuracy,
-          coordinateSystem: "WGS84",
-        });
-      },
-      fail: cause => {
-        const message = String(cause.errMsg || "");
-        locationStatus.value = /auth|authorize|permission|deny/i.test(message) ? "denied" : "error";
-        reject(new Error(locationStatus.value === "denied" ? "鏈幏寰楀畾浣嶆潈闄愶紝鏃犳硶鎵撳崱" : "瀹氫綅澶辫触锛岃妫�鏌ュ畾浣嶅紑鍏冲悗閲嶈瘯"));
-      },
-      complete: () => { positioning.value = false; },
-    });
-  });
-}
-
-const dateText = computed(() => {
-  const weekdays = ["鏄熸湡鏃�", "鏄熸湡涓�", "鏄熸湡浜�", "鏄熸湡涓�", "鏄熸湡鍥�", "鏄熸湡浜�", "鏄熸湡鍏�"];
-  return `${now.value.getMonth() + 1}鏈�${now.value.getDate()}鏃� ${weekdays[now.value.getDay()]}`;
-});
-const timeText = computed(() => `${pad(now.value.getHours())}:${pad(now.value.getMinutes())}:${pad(now.value.getSeconds())}`);
-const userName = computed(() => status.value?.employeeName || state.user?.nickname || state.user?.username || "褰撳墠鐢ㄦ埛");
-const department = computed(() => status.value?.deptName || "鏈垎閰嶉儴闂�");
-const dateLabel = computed(() => {
-  const rest = status.value && status.value.workDay === false ? `锛�${status.value.restDayReason || "浼戞伅鏃�"}锛塦 : "";
-  return `${dateText.value}${rest} 路 ${rule.value?.name || "鏃犻�傜敤鐝"}`;
-});
-const clockInLabel = computed(() => record.value?.clockInTypeName || (record.value?.clockInTime ? "宸叉墦鍗�" : "鏈墦鍗�"));
-const clockOutLabel = computed(() => record.value?.clockOutTypeName || (record.value?.clockOutTime ? "宸叉墦鍗�" : "鏈墦鍗�"));
-const workHourText = computed(() => {
-  const value = record.value?.workHours;
-  if (value === undefined || value === null) return "";
-  const overtime = record.value?.overtimeHours;
-  const overtimeText = overtime ? ` 路 鍔犵彮 ${overtime} 灏忔椂` : "";
-  return `宸ヤ綔鏃堕暱 ${value} 灏忔椂${overtimeText}`;
-});
-const cooldownLeft = computed(() => {
-  const clockInAt = parseDateTime(record.value?.clockInTime);
-  if (!clockInAt) return 0;
-  const left = COOLDOWN_SECONDS - Math.floor((now.value.getTime() - clockInAt.getTime()) / 1000);
-  return left > 0 ? left : 0;
-});
-
-type PunchState = { action: "in" | "out" | undefined; title: string; status: string; hint: string; tone: string };
-const punch = computed<PunchState>(() => {
-  if (!status.value && error.value) {
-    return { action: undefined, title: "鏃犳硶鎵撳崱", status: "鑰冨嫟淇℃伅鍔犺浇澶辫触", hint: "鐐瑰嚮绾㈣壊鎻愮ず鏉¢噸璇�", tone: "danger" };
-  }
-  if (!status.value) {
-    return { action: undefined, title: "鍔犺浇涓�", status: "姝e湪璇诲彇鑰冨嫟鐘舵��", hint: "璇风◢鍊�", tone: "idle" };
-  }
-  const info = status.value.clockable;
-  if (!info) {
-    return { action: undefined, title: "鏃犳硶鎵撳崱", status: "鏈幏鍙栧埌鎵撳崱鐘舵��", hint: "涓嬫媺鍒锋柊閲嶈瘯", tone: "idle" };
-  }
-  const message = info.message || "";
-  const action = info.nextAction === "in" || info.nextAction === "out" ? info.nextAction : undefined;
-  if (!action) {
-    const rest = status.value.workDay === false;
-    return {
-      action: undefined,
-      title: rest ? "浠婃棩浼戞伅" : "浠婃棩宸叉墦鍗�",
-      status: message || (rest ? "浠婃棩浼戞伅锛屾棤闇�鎵撳崱" : "浠婃棩宸插畬鎴愭墦鍗�"),
-      hint: message || "浠婃棩鏃犻渶鎵撳崱",
-      tone: rest ? "idle" : "done",
-    };
-  }
-  if (action === "out" && cooldownLeft.value > 0) {
-    return { action: undefined, title: "涓婄彮宸叉墦鍗�", status: "鎵撳崱闂撮殧", hint: `${cooldownLeft.value} 绉掑悗鍙笅鐝墦鍗, tone: "cooldown" };
-  }
-  return {
-    action,
-    title: action === "in" ? "涓婄彮鎵撳崱" : "涓嬬彮鎵撳崱",
-    status: message,
-    hint: action === "in" ? "璇风偣鍑诲畬鎴愬埌宀楁墦鍗�" : "璇风偣鍑诲畬鎴愮宀楁墦鍗�",
-    tone: message.includes("瓒呰繃") || message.includes("杩熷埌") ? "warning" : "ready",
-  };
-});
-
-async function load() {
-  if (!state.accessToken || loading.value) return;
-  loading.value = true;
-  error.value = "";
-  try {
-    const data = await getAttendanceMyStatus(state.accessToken);
-    status.value = data;
-    const serverAt = parseDateTime(data.serverTime);
-    if (serverAt) {
-      const offset = serverAt.getTime() - Date.now();
-      // 璁惧鏃堕棿涓庢湇鍔″櫒鍋忓樊瓒呰繃 12 灏忔椂瑙嗕负鏃跺尯閰嶇疆寮傚父锛屼笉浣跨敤
-      if (Math.abs(offset) < 12 * 3600 * 1000) clockOffset = offset;
-    }
-    syncNow();
-  } catch (cause) {
-    error.value = cause instanceof Error ? cause.message : "浠婃棩鑰冨嫟淇℃伅鍔犺浇澶辫触";
-  } finally {
-    loading.value = false;
-  }
-}
-
-async function confirmSmartPunch() {
-  const kind = punch.value.action;
-  if (!kind) return;
-  let position: AttendanceClockRequest;
-  try {
-    position = await getCurrentLocation();
-  } catch (cause) {
-    uni.showToast({ title: cause instanceof Error ? cause.message : "瀹氫綅澶辫触", icon: "none", duration: 3000 });
-    return;
-  }
-  const action = kind === "in" ? "涓婄彮" : "涓嬬彮";
-  const locationText = locationRequired.value
-    ? `褰撳墠浣嶇疆璺濃��${targetLocationName.value}鈥濈害 ${Math.round(estimatedDistance.value || 0)} 绫炽�俙
-    : "褰撳墠瑙勫垯鏈惎鐢ㄤ綅缃檺鍒躲��";
-  uni.showModal({
-    title: `${action}鎵撳崱`,
-    content: `${locationText}纭杩涜${action}鎵撳崱鍚楋紵`,
-    success: result => { if (result.confirm) submitPunch(kind, position); },
-  });
-}
-
-function applyPunch(kind: "in" | "out", next: AttendanceRecord) {
-  const current = status.value;
-  if (!current) return;
-  current.record = next;
-  current.clockable = kind === "in"
-    ? { clockIn: false, clockOut: true, nextAction: "out", message: "宸蹭笂鐝墦鍗★紝鍙笅鐝墦鍗�" }
-    : { clockIn: false, clockOut: false, nextAction: "none", message: "浠婃棩宸插畬鎴愭墦鍗�" };
-}
-
-async function submitPunch(kind: "in" | "out", position: AttendanceClockRequest) {
-  if (!state.accessToken || punching.value) return;
-  punching.value = kind;
-  try {
-    const result = kind === "in"
-      ? await clockIn(state.accessToken, position)
-      : await clockOut(state.accessToken, position);
-    lastClockResult.value = result;
-    applyPunch(kind, result.record);
-    const distanceText = result.distanceMeters === undefined ? "" : `锛岃窛鎵撳崱鐐� ${Math.round(result.distanceMeters)} 绫砢;
-    uni.showToast({ title: `${kind === "in" ? "涓婄彮" : "涓嬬彮"}鎵撳崱鎴愬姛${distanceText}`, icon: "success", duration: 2600 });
-  } catch (cause) {
-    uni.showToast({ title: cause instanceof Error ? cause.message : "鎵撳崱澶辫触", icon: "none", duration: 2600 });
-    await load();
-  } finally {
-    punching.value = "";
-  }
-}
-
-onShow(() => {
-  syncNow();
-  if (!timer) timer = setInterval(syncNow, 1000);
-  load();
-});
-onPullDownRefresh(async () => { await load(); uni.stopPullDownRefresh(); });
-onBeforeUnmount(() => { if (timer) { clearInterval(timer); timer = undefined; } });
+const { state } = useAuth(); const location = ref("鍏徃鍓嶅彴"), loading = ref<"" | "in" | "out">(""), result = ref<AttendanceRecord>();
+const userName = computed(() => state.user?.nickname || state.user?.username || "褰撳墠鐢ㄦ埛");
+async function punch(type: "in" | "out") { const value = location.value.trim(); if (!value) return uni.showToast({ title: "璇疯緭鍏ユ墦鍗″湴鐐�", icon: "none" }); if (!state.accessToken || loading.value) return; const label = type === "in" ? "涓婄彮" : "涓嬬彮"; loading.value = type; try { result.value = type === "in" ? await clockIn(state.accessToken, value) : await clockOut(state.accessToken, value); uni.showToast({ title: `${label}鎵撳崱鎴愬姛`, icon: "success" }); } catch (error) { uni.showToast({ title: error instanceof Error ? error.message : "鎵撳崱澶辫触", icon: "none" }); } finally { loading.value = ""; } }
+onShow(() => { location.value = "鍏徃鍓嶅彴"; });
 </script>
-
-<template>
-  <view class="page">
-    <view class="clock-head">
-      <view class="identity">
-        <view><text class="welcome">浠婃棩鑰冨嫟</text><text class="user">{{ userName }}</text></view>
-        <text class="dept">{{ department }}</text>
-      </view>
-      <text class="date">{{ dateLabel }}</text>
-    </view>
-
-    <view class="punch-stage">
-      <text class="time">{{ timeText }}</text>
-      <text :class="['smart-status', `status-${punch.tone}`]">{{ punch.status }}</text>
-      <button :class="['punch-circle', `circle-${punch.tone}`]" :disabled="!punch.action || Boolean(punching) || positioning" @click="confirmSmartPunch">
-        <text class="circle-title">{{ positioning ? "瀹氫綅涓�..." : punching ? "鎵撳崱涓�..." : punch.title }}</text>
-        <text class="circle-time">{{ pad(now.getHours()) }}:{{ pad(now.getMinutes()) }}</text>
-      </button>
-      <text class="smart-hint">{{ punch.hint }}</text>
-      <text class="rule-time">鐝 {{ rule?.workStartTime || "--:--" }} - {{ rule?.workEndTime || "--:--" }}</text>
-    </view>
-
-    <view class="location-row">
-      <view class="pin"><view /></view>
-      <view class="location-copy">
-        <text>{{ locationRequired ? "瑙勫畾鎵撳崱鍦扮偣" : "浣嶇疆闄愬埗" }}</text>
-        <strong>{{ locationRequired ? targetLocationName : "鏈惎鐢�" }}</strong>
-        <text v-if="locationRequired && rule?.locationAddress" class="location-address">{{ rule.locationAddress }}</text>
-        <text :class="['location-state', `location-${locationStatus}`]">{{ locationStatusText }}</text>
-        <text v-if="locationRequired" class="location-range">鍏佽鑼冨洿 {{ rule?.radiusMeters || 200 }} 绫� 路 WGS84</text>
-        <text v-if="lastClockResult?.distanceMeters !== undefined" class="location-success">鏈�杩戞墦鍗¤窛绂� {{ Math.round(lastClockResult.distanceMeters) }} 绫�</text>
-      </view>
-    </view>
-
-    <view v-if="error" class="error" @click="load">{{ error }}锛岀偣鍑婚噸璇�</view>
-
-    <view class="section-title"><text>浠婃棩鑰冨嫟</text><text>{{ loading ? "鏇存柊涓�" : localDate() }}</text></view>
-    <view class="timeline">
-      <view class="timeline-row">
-        <view :class="['dot', { done: record?.clockInTime }]" />
-        <view class="event">
-          <view><text class="event-name">涓婄彮鎵撳崱</text><text :class="['state', { done: record?.clockInTime }]">{{ clockInLabel }}</text></view>
-          <text class="event-time">{{ fullClockTime(record?.clockInTime) }}</text>
-        </view>
-      </view>
-      <view class="line" />
-      <view class="timeline-row">
-        <view :class="['dot', { done: record?.clockOutTime }]" />
-        <view class="event">
-          <view><text class="event-name">涓嬬彮鎵撳崱</text><text :class="['state', { done: record?.clockOutTime }]">{{ clockOutLabel }}</text></view>
-          <text class="event-time">{{ fullClockTime(record?.clockOutTime) }}</text>
-        </view>
-      </view>
-    </view>
-    <text v-if="workHourText" class="work-hours">{{ workHourText }}</text>
-
-    <view class="section-title"><text>鑰冨嫟瑙勫垯</text><text>{{ rule?.name || "--" }}</text></view>
-    <view class="rule-panel">
-      <view><text>涓婄彮鏃堕棿</text><strong>{{ rule?.workStartTime || "--:--" }}</strong></view>
-      <view><text>涓嬬彮鏃堕棿</text><strong>{{ rule?.workEndTime || "--:--" }}</strong></view>
-      <view><text>杩熷埌瀹介檺</text><strong>{{ rule?.lateAllowMinutes ?? "--" }} 鍒嗛挓</strong></view>
-      <view><text>鏃╅��瀹介檺</text><strong>{{ rule?.earlyAllowMinutes ?? "--" }} 鍒嗛挓</strong></view>
-      <view class="rule-wide"><text>閫傜敤閮ㄩ棬</text><strong>{{ rule?.deptName || "鍏ㄥ眬瑙勫垯" }}</strong></view>
-      <view class="rule-wide"><text>鍔犵彮璧风畻</text><strong>涓嬬彮鍚� {{ rule?.overtimeThreshold ?? "--" }} 灏忔椂</strong></view>
-    </view>
-  </view>
-</template>
-
-<style lang="scss" scoped>
-.page { min-height: 100vh; box-sizing: border-box; padding: 24rpx; background: linear-gradient(155deg, #dcecff 0, #ebf7f3 34%, #f4f7fb 62%, #f4f7fb 100%); color: #10233f; }
-.clock-head { padding: 12rpx 4rpx 0; }
-.identity { display: flex; align-items: center; justify-content: space-between; }
-.identity > view { display: flex; align-items: baseline; gap: 14rpx; }
-.welcome { color: #61758f; font-size: 24rpx; }
-.user { font-size: 34rpx; font-weight: 700; }
-.dept { padding: 8rpx 14rpx; border-radius: 8rpx; background: #fff; color: #49617e; font-size: 23rpx; box-shadow: 0 4rpx 14rpx rgba(35, 75, 126, .08); }
-.date { display: block; margin-top: 10rpx; color: #6f8198; font-size: 23rpx; }
-.punch-stage { display: flex; flex-direction: column; align-items: center; padding: 38rpx 0 30rpx; }
-.time { display: block; font-size: 66rpx; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0; }
-.smart-status { margin-top: 8rpx; padding: 7rpx 18rpx; border-radius: 999rpx; font-size: 23rpx; }
-.status-ready,.status-done { color: #08784c; background: #dcf6eb; }
-.status-warning { color: #a65b00; background: #fff0d5; }
-.status-danger { color: #c44040; background: #ffebeb; }
-.status-overtime { color: #5e4ab5; background: #eeeaff; }
-.status-cooldown { color: #3f668d; background: #e4edf6; }
-.status-idle { color: #687789; background: #e7ebf0; }
-.punch-circle { width: 286rpx; height: 286rpx; margin: 28rpx 0 20rpx; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 14rpx solid rgba(255,255,255,.86); border-radius: 50%; color: #fff; line-height: 1.4; box-shadow: 0 18rpx 40rpx rgba(21, 105, 215, .26), 0 0 0 12rpx rgba(74, 145, 235, .11); }
-.punch-circle::after { border: 0; }
-.circle-ready { background: linear-gradient(150deg, #2d8af0, #1261cf); }
-.circle-warning { background: linear-gradient(150deg, #f2a82d, #dc7815); box-shadow: 0 18rpx 40rpx rgba(211, 125, 21, .24), 0 0 0 12rpx rgba(242, 168, 45, .12); }
-.circle-danger { background: linear-gradient(150deg, #ef7169, #cf3f45); box-shadow: 0 18rpx 40rpx rgba(199, 61, 66, .22), 0 0 0 12rpx rgba(239, 113, 105, .12); }
-.circle-overtime { background: linear-gradient(150deg, #8774e7, #5944bd); box-shadow: 0 18rpx 40rpx rgba(89, 68, 189, .23), 0 0 0 12rpx rgba(135, 116, 231, .12); }
-.circle-cooldown { background: linear-gradient(150deg, #8ca2b8, #607c98); box-shadow: 0 14rpx 34rpx rgba(76, 104, 132, .18), 0 0 0 12rpx rgba(140, 162, 184, .12); }
-.circle-done,.circle-idle { background: #aab5c2; box-shadow: 0 12rpx 30rpx rgba(79, 95, 113, .16), 0 0 0 12rpx rgba(170, 181, 194, .12); }
-.punch-circle[disabled] { opacity: 1; }
-.circle-title { font-size: 36rpx; font-weight: 700; }
-.circle-time { margin-top: 8rpx; font-size: 26rpx; opacity: .82; }
-.smart-hint { color: #425a76; font-size: 25rpx; }
-.rule-time { margin-top: 10rpx; color: #8492a5; font-size: 23rpx; }
-.location-row { display: flex; align-items: center; gap: 20rpx; margin: 0 0 22rpx; padding: 20rpx 24rpx; border: 1rpx solid #dbe4ef; border-radius: 14rpx; background: #fff; }
-.pin { width: 58rpx; height: 58rpx; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 50%; background: #e8f2ff; }
-.pin view { width: 16rpx; height: 16rpx; border: 5rpx solid #1672e8; border-radius: 50%; }
-.location-copy { min-width: 0; flex: 1; }
-.location-copy > text { display: block; color: #73839a; font-size: 22rpx; }
-.location-copy strong { display: block; margin-top: 4rpx; font-size: 28rpx; color: #10233f; }
-.location-copy .location-address { margin-top: 5rpx; color: #667991; }
-.location-copy .location-state { margin-top: 10rpx; color: #1672e8; }
-.location-copy .location-outside,.location-copy .location-poor,.location-copy .location-denied,.location-copy .location-error { color: #c74a42; }
-.location-copy .location-inside,.location-copy .location-success { color: #11865b; }
-.location-copy .location-range { margin-top: 5rpx; color: #8a98aa; }
-.error { margin-bottom: 20rpx; padding: 18rpx 22rpx; border-left: 6rpx solid #ef6a62; border-radius: 8rpx; background: #fff2f1; color: #bd3732; font-size: 24rpx; }
-.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 34rpx 2rpx 16rpx; }
-.section-title text:first-child { font-size: 30rpx; font-weight: 700; }
-.section-title text:last-child { color: #7a899e; font-size: 23rpx; }
-.timeline { position: relative; padding: 10rpx 24rpx; border: 1rpx solid #dbe4ef; border-radius: 14rpx; background: #fff; }
-.timeline-row { position: relative; z-index: 1; display: flex; align-items: center; gap: 22rpx; padding: 24rpx 0; }
-.dot { width: 22rpx; height: 22rpx; box-sizing: border-box; flex: 0 0 auto; border: 5rpx solid #c4ceda; border-radius: 50%; background: #fff; }
-.dot.done { border-color: #17a56b; background: #17a56b; box-shadow: 0 0 0 8rpx #e2f6ee; }
-.line { position: absolute; top: 64rpx; bottom: 64rpx; left: 34rpx; width: 2rpx; background: #dfe6ef; }
-.event { min-width: 0; flex: 1; }
-.event > view { display: flex; align-items: center; justify-content: space-between; }
-.event-name { font-size: 27rpx; font-weight: 600; }
-.state { color: #8795a7; font-size: 23rpx; }
-.state.done { color: #159765; }
-.event-time { display: block; margin-top: 8rpx; color: #708198; font-size: 23rpx; }
-.work-hours { display: block; margin-top: 14rpx; padding: 0 6rpx; color: #5b7697; font-size: 23rpx; }
-.rule-panel { display: grid; grid-template-columns: 1fr 1fr; border: 1rpx solid #dbe4ef; border-radius: 14rpx; background: #fff; overflow: hidden; }
-.rule-panel view { padding: 24rpx; border-right: 1rpx solid #edf1f6; border-bottom: 1rpx solid #edf1f6; }
-.rule-panel view:nth-child(2n) { border-right: 0; }
-.rule-panel .rule-wide { grid-column: 1 / -1; border-right: 0; }
-.rule-panel view:last-child { border-bottom: 0; }
-.rule-panel text { display: block; color: #7b899d; font-size: 22rpx; }
-.rule-panel strong { display: block; margin-top: 8rpx; font-size: 27rpx; font-weight: 650; }
-</style>
+<template><view class="page"><view class="card"><text class="title">鑰冨嫟鎵撳崱</text><text class="sub">{{ userName }}</text><view class="field"><text>鎵撳崱鍦扮偣</text><input v-model="location" maxlength="100" placeholder="璇疯緭鍏ユ墦鍗″湴鐐�" /></view><view class="actions"><button :loading="loading === 'in'" :disabled="Boolean(loading)" @click="punch('in')">涓婄彮鎵撳崱</button><button class="outline" :loading="loading === 'out'" :disabled="Boolean(loading)" @click="punch('out')">涓嬬彮鎵撳崱</button></view></view><view v-if="result" class="result"><text>鏈�杩戞墦鍗″湴鐐癸細{{ result.location || location }}</text><text>涓婄彮鏃堕棿锛歿{ result.clockInTime || '鈥�' }}</text><text>涓嬬彮鏃堕棿锛歿{ result.clockOutTime || '鈥�' }}</text></view></view></template>
+<style scoped lang="scss">.page{min-height:100vh;padding:32rpx 30rpx;background:#f4f7fb}.card,.result{background:#fff;border-radius:18rpx;box-shadow:0 10rpx 28rpx rgba(36,59,91,.08)}.card{padding:34rpx 28rpx}.title{display:block;color:#1c304a;font-size:36rpx;font-weight:600}.sub{display:block;margin-top:10rpx;color:#77879b;font-size:25rpx}.field{margin-top:38rpx;padding:20rpx 0;border-bottom:1rpx solid #edf1f6}.field text{display:block;margin-bottom:14rpx;color:#40546e;font-size:27rpx}.field input{height:68rpx;padding:0 18rpx;color:#20364f;font-size:28rpx;background:#f7f9fc;border-radius:10rpx}.actions{display:flex;gap:20rpx;margin-top:34rpx}.actions button{flex:1;margin:0;color:#fff;font-size:28rpx;background:var(--color-primary,#1769d8);border-radius:12rpx}.actions button::after{border:0}.actions .outline{color:var(--color-primary,#1769d8);background:#f3f7ff;border:1rpx solid #9bbce9}.result{display:flex;flex-direction:column;gap:16rpx;padding:26rpx 28rpx;margin-top:24rpx;color:#52677f;font-size:25rpx}</style>
\ No newline at end of file

--
Gitblit v1.9.3