From 74612d64c6bd2d28dcf80450f2cb94ffbee9970d Mon Sep 17 00:00:00 2001
From: yubo <autumnal_wind@yeah.net>
Date: 星期四, 12 三月 2026 11:13:27 +0800
Subject: [PATCH] feat(user): 添加员工档案拍照上传功能

---
 src/views/user/archivesChange.vue   |  243 +++++++++++++++++
 src/views/dashboard/index.vue       |    1 
 src/views/user/inemployees.vue      |  243 +++++++++++++++++
 src/settings.js                     |   14 
 src/views/user/Informationinput.vue |  222 +++++++++++++++-
 5 files changed, 677 insertions(+), 46 deletions(-)

diff --git a/src/settings.js b/src/settings.js
index 477da2d..d90d265 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -21,18 +21,18 @@
     // tx-manager控制台
     txUrl: 'http://localhost:8501/admin/index.html#/login',
     // 文件上传地址
-    filesUploadUrl: 'http://120.24.23.155:8301/hr/filesUpload',
+    filesUploadUrl: 'http://localhost:8301/hr/filesUpload',
     // 个人文件上传地址
-    uploadSinglePath: 'http://120.24.23.155:8301/hr/empAccessory',
+    uploadSinglePath: 'http://localhost:8301/hr/empAccessory',
     // 个人文件上传地址
-    getEmpBaseInfoImage: 'http://120.24.23.155:8301/hr/empBaseInfo/image/',
+    getEmpBaseInfoImage: 'http://localhost:8301/hr/empBaseInfo/image/',
     // 下载员工导入模版
-    downloadEmpExcel: 'http://120.24.23.155:8000/员工信息.xls',
+    downloadEmpExcel: 'http://localhost:8000/员工信息.xls',
     // 导入员工
-    uploadEmpExcel: 'http://120.24.23.155:8301/hr/empBaseInfo/importEmp',
+    uploadEmpExcel: 'http://localhost:8301/hr/empBaseInfo/importEmp',
     // 获取图片
-    getFilesUploadImage: 'http://120.24.23.155:8301/hr/filesUpload/image/',
+    getFilesUploadImage: 'http://localhost:8301/hr/filesUpload/image/',
     // 获取图片
-    getAccessoryImage: 'http://120.24.23.155:8301/hr/empAccessory/image/'
+    getAccessoryImage: 'http://localhost:8301/hr/empAccessory/image/'
   }
 }
diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue
index edc1802..4ea87eb 100644
--- a/src/views/dashboard/index.vue
+++ b/src/views/dashboard/index.vue
@@ -335,7 +335,6 @@
         sfz: 0,
         ygtg: 0,
         bljl: 0,
-        zzyg: 0,
         sxyg: 0,
         probation: 0,
         insurance: 0
diff --git a/src/views/user/Informationinput.vue b/src/views/user/Informationinput.vue
index e5f74dd..0059122 100644
--- a/src/views/user/Informationinput.vue
+++ b/src/views/user/Informationinput.vue
@@ -442,8 +442,8 @@
           <el-table-column show-overflow-tooltip prop="injuredPart" label="受伤部位" width="80" />
           <el-table-column show-overflow-tooltip prop="injuredDescribe" label="受伤经过描述" width="120" />
           <el-table-column show-overflow-tooltip prop="injuredDiacrisis" label="意外险诊断" width="120" />
-<!--          <el-table-column show-overflow-tooltip prop="hospitalName" label="就诊医院" width="80" />-->
-<!--          <el-table-column show-overflow-tooltip prop="treatmentName" label="就诊科室" width="80" />-->
+          <!--          <el-table-column show-overflow-tooltip prop="hospitalName" label="就诊医院" width="80" />-->
+          <!--          <el-table-column show-overflow-tooltip prop="treatmentName" label="就诊科室" width="80" />-->
           <el-table-column
             show-overflow-tooltip
             prop="hospitalizatioFlag"
@@ -451,10 +451,10 @@
             width="80"
             :formatter="hospitalizatioFlagFormat"
           />
-<!--          <el-table-column show-overflow-tooltip prop="bedNumb" label="床号" width="60" />-->
+          <!--          <el-table-column show-overflow-tooltip prop="bedNumb" label="床号" width="60" />-->
           <el-table-column show-overflow-tooltip prop="reprotTime" label="报案时间" width="80" />
-<!--          <el-table-column show-overflow-tooltip prop="submitTime" label="递交资料时间" width="120" />-->
-<!--          <el-table-column show-overflow-tooltip prop="sbumitBy" label="递交人" width="80" />-->
+          <!--          <el-table-column show-overflow-tooltip prop="submitTime" label="递交资料时间" width="120" />-->
+          <!--          <el-table-column show-overflow-tooltip prop="sbumitBy" label="递交人" width="80" />-->
           <el-table-column show-overflow-tooltip prop="expensesFee" label="医疗总费用" width="100" />
           <el-table-column show-overflow-tooltip prop="innsureFee" label="保险赔付费用" width="120" />
         </el-table>
@@ -666,17 +666,19 @@
     <el-dialog title="基本信息" top="8vh" :visible.sync="dialogshowArr[0].show" width="60%" class="baseinfo">
       <el-container style="height: 70vh;">
         <el-aside width="200px">
-          <el-upload
-            class="avatar-uploader"
-            action="#"
-            :show-file-list="false"
-            :on-change="handlePictureCardPreview"
-            :auto-upload="false"
-          >
-            <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过4MB</div>
-            <img v-if="empBaseInfoImageUrl" :src="empBaseInfoImageUrl" class="avatar">
-            <i v-else class="el-icon-plus avatar-uploader-icon" />
-          </el-upload>
+          <!-- 头像显示区域 -->
+          <div class="avatar-wrapper">
+            <img
+              v-if="empBaseInfoImageUrl"
+              :src="empBaseInfoImageUrl"
+              class="avatar"
+              @click="openCamera"
+            >
+            <div v-else class="avatar-uploader-placeholder" @click="openCamera">
+              <i class="el-icon-plus avatar-uploader-icon" />
+              <div class="upload-tip">点击拍照上传</div>
+            </div>
+          </div>
         </el-aside>
         <el-main>
           <el-form
@@ -2173,6 +2175,33 @@
     <el-dialog title="选择员工" :visible.sync="dialogShowXzyg" width="60%">
       <Selectuser @selectedUser="selectedUser" @cancleChooseUser="cancleChooseUser" />
     </el-dialog>
+
+    <!-- 摄像头拍照弹窗 -->
+    <el-dialog
+      title="拍照上传"
+      :visible.sync="cameraDialogVisible"
+      width="640px"
+      :close-on-click-modal="false"
+      @close="closeCamera"
+    >
+      <div class="camera-container">
+        <video
+          v-show="!capturedImage"
+          ref="video"
+          class="camera-video"
+          autoplay
+          playsinline
+        />
+        <canvas ref="canvas" style="display: none;" />
+        <img v-if="capturedImage" :src="capturedImage" class="captured-image">
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="closeCamera">取消</el-button>
+        <el-button v-if="!capturedImage" type="primary" @click="takePhoto">拍照</el-button>
+        <el-button v-if="capturedImage" @click="retakePhoto">重拍</el-button>
+        <el-button v-if="capturedImage" type="primary" @click="confirmPhoto">确认使用</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -2193,6 +2222,10 @@
       baseicInformationForm: {},
       dialogShowDryg: false,
       empBaseInfoImageUrl: '',
+      // 摄像头相关
+      cameraDialogVisible: false,
+      capturedImage: '',
+      stream: null,
       total: 0, // 总数量
       queryParams: {}, // 查询参数
       sort: {}, // 排序
@@ -3255,6 +3288,97 @@
         }
       } else {
         this.$message.error('图片大小超过4M,请重新上传')
+      }
+    },
+    // 打开摄像头
+    openCamera() {
+      this.cameraDialogVisible = true
+      this.$nextTick(() => {
+        this.initCamera()
+      })
+    },
+    // 初始化摄像头
+    async initCamera() {
+      try {
+        // 请求摄像头权限
+        this.stream = await navigator.mediaDevices.getUserMedia({
+          video: {
+            width: { ideal: 640 },
+            height: { ideal: 480 },
+            facingMode: 'user' // 前置摄像头
+          },
+          audio: false
+        })
+
+        // 将视频流绑定到 video 元素
+        const video = this.$refs.video
+        if (video) {
+          video.srcObject = this.stream
+        }
+      } catch (error) {
+        this.$message.error('无法访问摄像头,请检查摄像头权限设置')
+        console.error('摄像头初始化失败:', error)
+      }
+    },
+    // 拍照
+    takePhoto() {
+      const video = this.$refs.video
+      const canvas = this.$refs.canvas
+
+      if (!video || !canvas) return
+
+      // 设置画布尺寸
+      canvas.width = video.videoWidth || 640
+      canvas.height = video.videoHeight || 480
+
+      // 绘制视频帧到画布
+      const ctx = canvas.getContext('2d')
+      ctx.drawImage(video, 0, 0, canvas.width, canvas.height)
+
+      // 转换为图片数据
+      this.capturedImage = canvas.toDataURL('image/jpeg', 0.9)
+
+      // 停止摄像头
+      this.stopCamera()
+    },
+    // 重拍
+    retakePhoto() {
+      this.capturedImage = ''
+      this.initCamera()
+    },
+    // 确认使用照片
+    confirmPhoto() {
+      if (this.capturedImage) {
+        // 设置图片预览
+        this.empBaseInfoImageUrl = this.capturedImage
+
+        // 设置表单数据(Base64格式)
+        this.empBaseInfoForm.imagePath = this.capturedImage
+
+        // 关闭弹窗
+        this.closeCamera()
+
+        this.$message.success('照片已保存')
+      }
+    },
+    // 关闭摄像头
+    closeCamera() {
+      this.stopCamera()
+      this.cameraDialogVisible = false
+      this.capturedImage = ''
+    },
+    // 停止摄像头流
+    stopCamera() {
+      if (this.stream) {
+        this.stream.getTracks().forEach(track => {
+          track.stop()
+        })
+        this.stream = null
+      }
+
+      const video = this.$refs.video
+      if (video) {
+        video.srcObject = null
       }
     },
     // 翻页插件翻页方法
@@ -6087,6 +6211,72 @@
 .el-date-editor.el-input__inner {
   width: 100%;
 }
+
+/* 头像上传相关样式 */
+.avatar-wrapper {
+  width: 178px;
+  height: 178px;
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.avatar-wrapper:hover {
+  border-color: #409EFF;
+}
+
+.avatar {
+  width: 100%;
+  height: 100%;
+  display: block;
+  object-fit: cover;
+}
+
+.avatar-uploader-placeholder {
+  width: 100%;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  color: #8c939d;
+}
+
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  margin-bottom: 8px;
+}
+
+.upload-tip {
+  font-size: 12px;
+  color: #8c939d;
+}
+
+/* 摄像头弹窗样式 */
+.camera-container {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  background-color: #000;
+  min-height: 360px;
+}
+
+.camera-video {
+  width: 100%;
+  max-width: 640px;
+  height: auto;
+}
+
+.captured-image {
+  max-width: 100%;
+  max-height: 480px;
+}
 </style>
 
 <style lang="scss">
diff --git a/src/views/user/archivesChange.vue b/src/views/user/archivesChange.vue
index 3fbf3d9..4aa540b 100644
--- a/src/views/user/archivesChange.vue
+++ b/src/views/user/archivesChange.vue
@@ -14,17 +14,19 @@
         <div class="menu dadetails">
           <div style="height: 22vh;">
 
-            <el-upload
-              class="avatar-uploader"
-              action="#"
-              :show-file-list="false"
-              :on-change="handlePictureCardPreview"
-              :auto-upload="false"
-            >
-              <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过4MB</div>
-              <img v-if="empBaseInfoImageUrl" :src="empBaseInfoImageUrl" class="avatar">
-              <i v-else class="el-icon-plus avatar-uploader-icon" />
-            </el-upload>
+            <!-- 头像显示区域 -->
+            <div class="avatar-wrapper">
+              <img
+                v-if="empBaseInfoImageUrl"
+                :src="empBaseInfoImageUrl"
+                class="avatar"
+                @click="openCamera"
+              >
+              <div v-else class="avatar-uploader-placeholder" @click="openCamera">
+                <i class="el-icon-plus avatar-uploader-icon" />
+                <div class="upload-tip">点击拍照上传</div>
+              </div>
+            </div>
             <!-- <img src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1333074204,3035391839&fm=26&gp=0.jpg" class="jbxxImg">-->
             <div class="title-da">
               档案号:{{ empBaseInfoForm.archivesNumb }}
@@ -2594,6 +2596,59 @@
         </div>
       </el-dialog>
     </el-dialog>
+
+    <!-- 摄像头拍照弹窗 -->
+    <el-dialog
+      title="拍照上传"
+      :visible.sync="cameraDialogVisible"
+      width="640px"
+      :close-on-click-modal="false"
+      @close="closeCamera"
+    >
+      <div class="camera-container">
+        <!-- 视频预览 -->
+        <video
+          v-show="!capturedImage"
+          ref="video"
+          class="camera-video"
+          autoplay
+          playsinline
+        />
+        <!-- 画布(用于拍照) -->
+        <canvas ref="canvas" style="display: none;" />
+
+        <!-- 拍照结果预览 -->
+        <img
+          v-if="capturedImage"
+          :src="capturedImage"
+          class="captured-image"
+        >
+      </div>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="closeCamera">取消</el-button>
+        <el-button
+          v-if="!capturedImage"
+          type="primary"
+          @click="takePhoto"
+        >
+          拍照
+        </el-button>
+        <el-button
+          v-if="capturedImage"
+          @click="retakePhoto"
+        >
+          重拍
+        </el-button>
+        <el-button
+          v-if="capturedImage"
+          type="primary"
+          @click="confirmPhoto"
+        >
+          确认使用
+        </el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -2702,6 +2757,10 @@
         }
       ],
       empBaseInfoImageUrl: '',
+      // 摄像头相关
+      cameraDialogVisible: false,
+      capturedImage: '',
+      stream: null,
       rules: {
         archivesNumb: [{ required: true, message: '请输入档案号', trigger: 'blur' }, {
           max: 20,
@@ -4702,6 +4761,97 @@
     getIndex($index) {
       return (this.pagination.num - 1) * this.pagination.size + $index + 1
     },
+    // 打开摄像头
+    openCamera() {
+      this.cameraDialogVisible = true
+      this.$nextTick(() => {
+        this.initCamera()
+      })
+    },
+    // 初始化摄像头
+    async initCamera() {
+      try {
+        // 请求摄像头权限
+        this.stream = await navigator.mediaDevices.getUserMedia({
+          video: {
+            width: { ideal: 640 },
+            height: { ideal: 480 },
+            facingMode: 'user' // 前置摄像头
+          },
+          audio: false
+        })
+
+        // 将视频流绑定到 video 元素
+        const video = this.$refs.video
+        if (video) {
+          video.srcObject = this.stream
+        }
+      } catch (error) {
+        this.$message.error('无法访问摄像头,请检查摄像头权限设置')
+        console.error('摄像头初始化失败:', error)
+      }
+    },
+    // 拍照
+    takePhoto() {
+      const video = this.$refs.video
+      const canvas = this.$refs.canvas
+
+      if (!video || !canvas) return
+
+      // 设置画布尺寸
+      canvas.width = video.videoWidth || 640
+      canvas.height = video.videoHeight || 480
+
+      // 绘制视频帧到画布
+      const ctx = canvas.getContext('2d')
+      ctx.drawImage(video, 0, 0, canvas.width, canvas.height)
+
+      // 转换为图片数据
+      this.capturedImage = canvas.toDataURL('image/jpeg', 0.9)
+
+      // 停止摄像头
+      this.stopCamera()
+    },
+    // 重拍
+    retakePhoto() {
+      this.capturedImage = ''
+      this.initCamera()
+    },
+    // 确认使用照片
+    confirmPhoto() {
+      if (this.capturedImage) {
+        // 设置图片预览
+        this.empBaseInfoImageUrl = this.capturedImage
+
+        // 设置表单数据(Base64格式)
+        this.empBaseInfoForm.imagePath = this.capturedImage
+
+        // 关闭弹窗
+        this.closeCamera()
+
+        this.$message.success('照片已保存')
+      }
+    },
+    // 关闭摄像头
+    closeCamera() {
+      this.stopCamera()
+      this.cameraDialogVisible = false
+      this.capturedImage = ''
+    },
+    // 停止摄像头流
+    stopCamera() {
+      if (this.stream) {
+        this.stream.getTracks().forEach(track => {
+          track.stop()
+        })
+        this.stream = null
+      }
+
+      const video = this.$refs.video
+      if (video) {
+        video.srcObject = null
+      }
+    },
     cleanOccupational() {
       this.occupationalForm.occupationalId = ''
       this.occupationalForm.injuredTime = ''
@@ -5931,6 +6081,77 @@
     height: 100px;
   }
 
+  // 头像包装器
+  .avatar-wrapper {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    margin-bottom: 10px;
+
+    .avatar {
+      width: 150px;
+      height: 150px;
+      border-radius: 4px;
+      cursor: pointer;
+      object-fit: cover;
+      border: 1px dashed #d9d9d9;
+
+      &:hover {
+        border-color: #409eff;
+      }
+    }
+
+    .avatar-uploader-placeholder {
+      width: 150px;
+      height: 150px;
+      border: 1px dashed #d9d9d9;
+      border-radius: 4px;
+      display: flex;
+      flex-direction: column;
+      justify-content: center;
+      align-items: center;
+      cursor: pointer;
+      background-color: #fafafa;
+
+      &:hover {
+        border-color: #409eff;
+        background-color: #f0f9ff;
+      }
+
+      .avatar-uploader-icon {
+        font-size: 28px;
+        color: #8c939d;
+        line-height: 1;
+        margin-bottom: 8px;
+      }
+
+      .upload-tip {
+        font-size: 12px;
+        color: #8c939d;
+      }
+    }
+  }
+
+  // 摄像头容器
+  .camera-container {
+    text-align: center;
+
+    .camera-video {
+      width: 100%;
+      max-width: 600px;
+      height: auto;
+      border-radius: 4px;
+      background: #000;
+    }
+
+    .captured-image {
+      width: 100%;
+      max-width: 600px;
+      height: auto;
+      border-radius: 4px;
+    }
+  }
+
   .table-button {
     color: #a00515;
     display: inline-block;
diff --git a/src/views/user/inemployees.vue b/src/views/user/inemployees.vue
index 406a068..49d7fe0 100644
--- a/src/views/user/inemployees.vue
+++ b/src/views/user/inemployees.vue
@@ -347,17 +347,19 @@
     <el-dialog title="基本信息" :visible.sync="dialogShowXzyg" width="50%" class="baseinfo">
       <el-container>
         <el-aside width="200px">
-          <el-upload
-            class="avatar-uploader"
-            action="#"
-            :show-file-list="false"
-            :on-change="handlePictureCardPreview"
-            :auto-upload="false"
-          >
-            <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过4MB</div>
-            <img v-if="empBaseInfoImageUrl" :src="empBaseInfoImageUrl" class="avatar">
-            <i v-else class="el-icon-plus avatar-uploader-icon" />
-          </el-upload>
+          <!-- 头像显示区域 -->
+          <div class="avatar-wrapper">
+            <img
+              v-if="empBaseInfoImageUrl"
+              :src="empBaseInfoImageUrl"
+              class="avatar"
+              @click="openCamera"
+            >
+            <div v-else class="avatar-uploader-placeholder" @click="openCamera">
+              <i class="el-icon-plus avatar-uploader-icon" />
+              <div class="upload-tip">点击拍照上传</div>
+            </div>
+          </div>
         </el-aside>
         <el-main>
           <el-form
@@ -1000,6 +1002,59 @@
         <el-button type="primary" @click="showDkda(2, 'openArchivesForm')">确 定</el-button>
       </div>
     </el-dialog>
+
+    <!-- 摄像头拍照弹窗 -->
+    <el-dialog
+      title="拍照上传"
+      :visible.sync="cameraDialogVisible"
+      width="640px"
+      :close-on-click-modal="false"
+      @close="closeCamera"
+    >
+      <div class="camera-container">
+        <!-- 视频预览 -->
+        <video
+          v-show="!capturedImage"
+          ref="video"
+          class="camera-video"
+          autoplay
+          playsinline
+        />
+        <!-- 画布(用于拍照) -->
+        <canvas ref="canvas" style="display: none;" />
+
+        <!-- 拍照结果预览 -->
+        <img
+          v-if="capturedImage"
+          :src="capturedImage"
+          class="captured-image"
+        >
+      </div>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="closeCamera">取消</el-button>
+        <el-button
+          v-if="!capturedImage"
+          type="primary"
+          @click="takePhoto"
+        >
+          拍照
+        </el-button>
+        <el-button
+          v-if="capturedImage"
+          @click="retakePhoto"
+        >
+          重拍
+        </el-button>
+        <el-button
+          v-if="capturedImage"
+          type="primary"
+          @click="confirmPhoto"
+        >
+          确认使用
+        </el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -1049,6 +1104,10 @@
       },
       baseicInformationForm: {},
       empBaseInfoImageUrl: '',
+      // 摄像头相关
+      cameraDialogVisible: false,
+      capturedImage: '',
+      stream: null,
       empBaseInfoForm: {
         imagePath: '',
         empId: '',
@@ -1586,6 +1645,97 @@
         }
       } else {
         this.$message.error('图片大小超过4M,请重新上传')
+      }
+    },
+    // 打开摄像头
+    openCamera() {
+      this.cameraDialogVisible = true
+      this.$nextTick(() => {
+        this.initCamera()
+      })
+    },
+    // 初始化摄像头
+    async initCamera() {
+      try {
+        // 请求摄像头权限
+        this.stream = await navigator.mediaDevices.getUserMedia({
+          video: {
+            width: { ideal: 640 },
+            height: { ideal: 480 },
+            facingMode: 'user' // 前置摄像头
+          },
+          audio: false
+        })
+
+        // 将视频流绑定到 video 元素
+        const video = this.$refs.video
+        if (video) {
+          video.srcObject = this.stream
+        }
+      } catch (error) {
+        this.$message.error('无法访问摄像头,请检查摄像头权限设置')
+        console.error('摄像头初始化失败:', error)
+      }
+    },
+    // 拍照
+    takePhoto() {
+      const video = this.$refs.video
+      const canvas = this.$refs.canvas
+
+      if (!video || !canvas) return
+
+      // 设置画布尺寸
+      canvas.width = video.videoWidth || 640
+      canvas.height = video.videoHeight || 480
+
+      // 绘制视频帧到画布
+      const ctx = canvas.getContext('2d')
+      ctx.drawImage(video, 0, 0, canvas.width, canvas.height)
+
+      // 转换为图片数据
+      this.capturedImage = canvas.toDataURL('image/jpeg', 0.9)
+
+      // 停止摄像头
+      this.stopCamera()
+    },
+    // 重拍
+    retakePhoto() {
+      this.capturedImage = ''
+      this.initCamera()
+    },
+    // 确认使用照片
+    confirmPhoto() {
+      if (this.capturedImage) {
+        // 设置图片预览
+        this.empBaseInfoImageUrl = this.capturedImage
+
+        // 设置表单数据(Base64格式)
+        this.empBaseInfoForm.imagePath = this.capturedImage
+
+        // 关闭弹窗
+        this.closeCamera()
+
+        this.$message.success('照片已保存')
+      }
+    },
+    // 关闭摄像头
+    closeCamera() {
+      this.stopCamera()
+      this.cameraDialogVisible = false
+      this.capturedImage = ''
+    },
+    // 停止摄像头流
+    stopCamera() {
+      if (this.stream) {
+        this.stream.getTracks().forEach(track => {
+          track.stop()
+        })
+        this.stream = null
+      }
+
+      const video = this.$refs.video
+      if (video) {
+        video.srcObject = null
       }
     },
     cleanEmpBase() {
@@ -2444,4 +2594,75 @@
   cursor: pointer;
   vertical-align: middle;
 }
+
+// 头像包装器
+.avatar-wrapper {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  margin-bottom: 10px;
+
+  .avatar {
+    width: 150px;
+    height: 150px;
+    border-radius: 4px;
+    cursor: pointer;
+    object-fit: cover;
+    border: 1px dashed #d9d9d9;
+
+    &:hover {
+      border-color: #409eff;
+    }
+  }
+
+  .avatar-uploader-placeholder {
+    width: 150px;
+    height: 150px;
+    border: 1px dashed #d9d9d9;
+    border-radius: 4px;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    cursor: pointer;
+    background-color: #fafafa;
+
+    &:hover {
+      border-color: #409eff;
+      background-color: #f0f9ff;
+    }
+
+    .avatar-uploader-icon {
+      font-size: 28px;
+      color: #8c939d;
+      line-height: 1;
+      margin-bottom: 8px;
+    }
+
+    .upload-tip {
+      font-size: 12px;
+      color: #8c939d;
+    }
+  }
+}
+
+// 摄像头容器
+.camera-container {
+  text-align: center;
+
+  .camera-video {
+    width: 100%;
+    max-width: 600px;
+    height: auto;
+    border-radius: 4px;
+    background: #000;
+  }
+
+  .captured-image {
+    width: 100%;
+    max-width: 600px;
+    height: auto;
+    border-radius: 4px;
+  }
+}
 </style>

--
Gitblit v1.8.0