曹睿
4 天以前 c056874186f0e2520f575d3363c5497df089e984
feat: 首页支持扫码工时
已修改3个文件
已添加2个文件
105 ■■■■ 文件已修改
src/api/work/report.ts 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/index/components/ReportWorkTime.vue 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/index/index.vue 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/mine/index.vue 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/twist/receive/monofil.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/work/report.ts
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
import request from "@/utils/request";
import { BaseResult } from "@/models/base";
const reportApi = {
  sendWorkTime(params: any) {
    return request<BaseResult<any>>({
      url: "/app/updateTeamStartTime",
      method: "GET",
      data: params,
    });
  },
};
export default reportApi;
src/pages/index/components/ReportWorkTime.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,48 @@
<template>
  <view>
    <wd-icon name="scan" color="#999" size="18px" @click="openScan" />
    <Scan ref="scanRef" />
    <!-- å¼¹çª— -->
    <wd-toast />
  </view>
</template>
<script setup lang="ts">
import Scan from "@/components/scan/index.vue";
import { useUserStore } from "@/store/modules/user";
import reportApi from "@/api/work/report";
import { useToast } from "wot-design-uni";
defineOptions({
  name: "工时发送",
});
const scanRef = ref();
const userStore = useUserStore();
const userInfo: any = computed(() => userStore.userInfo);
const toast = useToast();
const openScan = () => {
  scanRef.value.triggerScan();
};
const getScanCode = async () => {
  const { code } = await reportApi.sendWorkTime({
    userName: userInfo.value.userName,
  });
  if (code == 200) {
    toast.success("扫码成功");
  }
};
onLoad(() => {
  // å¼€å¯å¹¿æ’­ç›‘听事件
  uni.$on("scan", getScanCode);
});
onUnload(() => {
  // å¼€å¯å¹¿æ’­ç›‘听事件
  uni.$off("scan", getScanCode);
});
</script>
<style lang="scss" scoped></style>
src/pages/index/index.vue
@@ -2,14 +2,18 @@
  <view style="width: 100%; height: var(--status-bar-height)" />
  <view class="home">
    <!-- å½“前用户 -->
    <view class="text-[#0D867F] font-medium py-2 text-lg">亨旺特导线缆上报系统</view>
    <view class="flex items-center justify-between">
      <view class="text-[#0D867F] font-medium py-2 text-lg">
        <text>亨旺特导线缆上报系统</text>
      </view>
      <view>
        <ReportWorkTime />
      </view>
    </view>
    <WorkerCallingCard />
    <!-- é€šçŸ¥å…¬å‘Š -->
    <wd-notice-bar
      text="vue-uniapp-template æ˜¯ä¸€ä¸ªåŸºäºŽ Vue3 + UniApp çš„前端模板项目,提供了一套完整的前端解决方案,包括登录、权限、字典、接口请求、状态管理、页面布局、组件封装等功能。"
      custom-class="space"
    >
    <wd-notice-bar text="这是一条测试通知的数据" custom-class="space">
      <template #prefix>
        <wd-icon class="prefix" name="warn-bold" size="14px"></wd-icon>
        <text class="text-xs">通知</text>
@@ -57,7 +61,7 @@
      </wd-grid-item>
    </wd-grid> -->
    <wd-card>
    <!-- <wd-card>
      <template #title>
        <view class="flex-between">
          <view>访问趋势</view>
@@ -78,7 +82,7 @@
      <view class="charts-box">
        <qiun-data-charts type="area" :chartData="chartData" :opts="chartOpts" />
      </view>
    </wd-card>
    </wd-card> -->
  </view>
</template>
@@ -86,6 +90,7 @@
import { dayjs } from "wot-design-uni";
import LogAPI, { VisitStatsVO } from "@/api/system/log";
import WorkerCallingCard from "@/components/worker-calling-card/index.vue";
import ReportWorkTime from "./components/ReportWorkTime.vue";
const visitStatsData = ref<VisitStatsVO>({
  todayUvCount: 0,
src/pages/mine/index.vue
@@ -268,14 +268,14 @@
};
// å¸¸è§é—®é¢˜
const navigateToFAQ = () => {
  uni.navigateTo({ url: "/pages/mine/faq/index" });
};
// const navigateToFAQ = () => {
//   uni.navigateTo({ url: "/pages/mine/faq/index" });
// };
// å…³äºŽæˆ‘们
const navigateToAbout = () => {
  uni.navigateTo({ url: "/pages/mine/about/index" });
};
// const navigateToAbout = () => {
//   uni.navigateTo({ url: "/pages/mine/about/index" });
// };
// è®¾ç½®
const navigateToSettings = () => {
@@ -283,9 +283,9 @@
};
// é—®é¢˜åé¦ˆ
const handleQuestionFeedback = () => {
  uni.navigateTo({ url: "/pages/mine/feedback/index" });
};
// const handleQuestionFeedback = () => {
//   uni.navigateTo({ url: "/pages/mine/feedback/index" });
// };
// å¯¼èˆªåˆ°å„个板块
const navigateToSection = (section: string, subSection?: string) => {
src/pages/production/twist/receive/monofil.vue
@@ -32,7 +32,7 @@
import CardTitle from "@/components/card-title/index.vue";
import MonofilCard from "../components/MonofilCard.vue";
import { useToast } from "wot-design-uni";
import { onLoad, onUnload, onShow, onHide } from "@dcloudio/uni-app";
import { onLoad, onUnload } from "@dcloudio/uni-app";
import Scan from "@/components/scan/index.vue";
import ManageApi from "@/api/product/manage";
import TwistApi from "@/api/product/twist";
@@ -110,10 +110,6 @@
  // å¼€å¯å¹¿æ’­ç›‘听事件
  uni.$off("scan", getScanCode);
});
onShow(() => {});
onHide(() => {});
</script>
<style lang="scss" scoped>