interview.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. <template>
  2. <view class="container">
  3. <!-- <view class="header">
  4. <text class="title">手部照片采集</text>
  5. </view> -->
  6. <view class="photo-container">
  7. <view class="instruction">
  8. <text>{{ instructions[currentStep] }}</text>
  9. </view>
  10. <view class="preview-container">
  11. <image v-if="photos[currentStep]" :src="photos[currentStep]" mode="aspectFit" class="preview-image"></image>
  12. <view v-else class="empty-preview">
  13. <text>{{ previewTexts[currentStep] }}</text>
  14. </view>
  15. </view>
  16. <view class="thumbnails">
  17. <view v-for="(photo, index) in photos" :key="index"
  18. class="thumbnail-item"
  19. :class="{ active: currentStep === index, completed: photo }">
  20. <image v-if="photo" :src="photo" mode="aspectFill" class="thumbnail-image" @click="previewPhoto(index)"></image>
  21. <view v-else class="thumbnail-placeholder">{{ index + 1 }}</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="controls">
  26. <button class="camera-btn" @click="takePhoto">{{ photos[currentStep] ? '重新拍摄' : '拍摄照片' }}</button>
  27. <view class="navigation-btns">
  28. <button class="nav-btn prev" :disabled="currentStep === 0" @click="prevStep">上一步</button>
  29. <button class="nav-btn next" :disabled="!canGoNext" @click="nextStep">
  30. {{ currentStep === 5 && photos[5] ? '完成' : '下一步' }}
  31. </button>
  32. </view>
  33. </view>
  34. <!-- 为小程序环境添加camera组件 -->
  35. <view v-if="!isH5 && showCamera" class="camera-container">
  36. <camera
  37. device-position="back"
  38. flash="auto"
  39. @error="handleCameraError"
  40. class="camera-component"
  41. :mode="cameraMode"
  42. frame-size="medium"
  43. ></camera>
  44. <!-- 添加手势引导蒙层 -->
  45. <cover-view class="gesture-overlay">
  46. <cover-image
  47. :src="gestureOverlays[currentStep]"
  48. class="gesture-image"
  49. ></cover-image>
  50. <cover-view class="gesture-hint">
  51. <cover-view class="gesture-hint-text">{{ gestureHints[currentStep] }}</cover-view>
  52. </cover-view>
  53. </cover-view>
  54. <cover-view class="camera-controls">
  55. <cover-view class="capture-btn" @tap="capturePhotoMP"></cover-view>
  56. <cover-view class="cancel-btn" @tap="cancelCamera">取消</cover-view>
  57. </cover-view>
  58. </view>
  59. <!-- 为浏览器环境添加视频元素 -->
  60. <view v-if="isH5" class="camera-container" v-show="showCamera">
  61. <video ref="videoElement" class="camera-video" autoplay></video>
  62. <canvas ref="canvasElement" class="camera-canvas" style="display: none;"></canvas>
  63. <!-- 添加H5环境的手势引导蒙层 -->
  64. <view class="gesture-overlay">
  65. <image
  66. :src="gestureOverlays[currentStep]"
  67. class="gesture-image"
  68. ></image>
  69. <view class="gesture-hint">
  70. <text class="gesture-hint-text">{{ gestureHints[currentStep] }}</text>
  71. </view>
  72. </view>
  73. <button class="capture-btn" @click="capturePhoto">拍照</button>
  74. <button class="cancel-btn" @click="cancelCamera">取消</button>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import { apiBaseUrl } from '@/common/config.js'; // Import the base URL from a config file
  80. export default {
  81. data() {
  82. return {
  83. currentStep: 0,
  84. photos: [null, null, null, null, null, null], // 存储6张照片:左手正面、左手反面、左手握拳、右手正面、右手反面、右手握拳
  85. instructions: [
  86. '请将左手掌正面朝上,保持手指自然伸展,确保整个手掌清晰可见',
  87. '请将左手掌反面朝上,保持手指自然伸展,确保整个手背清晰可见',
  88. '请握紧左手拳头,使拳面朝向相机,确保整个拳头清晰可见',
  89. '请将右手掌正面朝上,保持手指自然伸展,确保整个手掌清晰可见',
  90. '请将右手掌反面朝上,保持手指自然伸展,确保整个手背清晰可见',
  91. '请握紧右手拳头,使拳面朝向相机,确保整个拳头清晰可见'
  92. ],
  93. previewTexts: [
  94. '左手掌正面照片预览区',
  95. '左手掌反面照片预览区',
  96. '左手握拳照片预览区',
  97. '右手掌正面照片预览区',
  98. '右手掌反面照片预览区',
  99. '右手握拳照片预览区'
  100. ],
  101. photoTypes: ['left_palm', 'left_back', 'left_fist', 'right_palm', 'right_back', 'right_fist'], // 照片类型标识
  102. isH5: false,
  103. showCamera: false,
  104. mediaStream: null,
  105. cameraContext: null,
  106. cameraMode: 'normal', // 添加相机模式
  107. cameraInitRetries: 0, // 添加重试计数器
  108. gestureOverlays: [
  109. /* '/static/images/palm_overlay.png', // 手掌正面引导图
  110. '/static/images/back_overlay.png', // 手掌反面引导图
  111. '/static/images/fist_overlay.png' // 握拳引导图 */
  112. ],
  113. gestureHints: [
  114. '请将左手掌对准轮廓线',
  115. '请将左手背对准轮廓线',
  116. '请将左手拳头对准轮廓线',
  117. '请将右手掌对准轮廓线',
  118. '请将右手背对准轮廓线',
  119. '请将右手拳头对准轮廓线'
  120. ],
  121. photoLinks: [null, null, null, null, null, null], // 存储上传后的图片链接
  122. }
  123. },
  124. computed: {
  125. canGoNext() {
  126. // 只有当前步骤的照片已拍摄才能进入下一步
  127. return this.photos[this.currentStep] !== null;
  128. }
  129. },
  130. onLoad() {
  131. // 判断当前平台
  132. // #ifdef H5
  133. this.isH5 = true;
  134. // #endif
  135. // 检查相机权限
  136. // #ifdef MP-WEIXIN
  137. uni.authorize({
  138. scope: 'scope.camera',
  139. success: () => {
  140. console.log('相机权限已授权');
  141. },
  142. fail: () => {
  143. uni.showModal({
  144. title: '提示',
  145. content: '请授权相机权限以完成手部照片采集',
  146. success: (res) => {
  147. if (res.confirm) {
  148. uni.openSetting();
  149. }
  150. }
  151. });
  152. }
  153. });
  154. // #endif
  155. },
  156. beforeDestroy() {
  157. // 在组件销毁前停止摄像头流
  158. this.stopMediaStream();
  159. },
  160. methods: {
  161. takePhoto() {
  162. // 根据平台选择不同的拍照方法
  163. if (this.isH5) {
  164. this.startCamera();
  165. } else {
  166. // 小程序环境使用camera组件
  167. this.showCamera = true;
  168. this.cameraInitRetries = 0; // 重置重试计数器
  169. this.$nextTick(() => {
  170. // 创建相机上下文
  171. // #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-TOUTIAO
  172. try {
  173. this.cameraContext = uni.createCameraContext();
  174. console.log('相机上下文创建成功');
  175. } catch (err) {
  176. console.error('创建相机上下文失败:', err);
  177. this.handleCameraInitError();
  178. }
  179. // #endif
  180. });
  181. }
  182. },
  183. uploadPhoto(filePathOrData, type) {
  184. console.log(`准备上传${type}类型的手部照片`);
  185. uni.showLoading({
  186. title: '上传中...'
  187. });
  188. // 获取用户openid
  189. const userInfo = uni.getStorageSync('userInfo');
  190. const openid = userInfo ? JSON.parse(userInfo).openid || '' : '';
  191. const tenant_id = uni.getStorageSync('tenant_id') || '1';
  192. // 检查用户信息是否完整
  193. if (!tenant_id) {
  194. uni.hideLoading();
  195. uni.showToast({
  196. title: '用户信息不完整,请重新登录',
  197. icon: 'none'
  198. });
  199. return;
  200. }
  201. // 如果是H5环境且是base64数据
  202. if (this.isH5 && filePathOrData.startsWith('data:image')) {
  203. // 将base64转为blob对象
  204. const base64Data = filePathOrData.split(',')[1];
  205. const blob = this.base64ToBlob(base64Data, 'image/jpeg');
  206. const formData = new FormData();
  207. // 确保文件参数名称正确
  208. formData.append('photo_file', blob, `${type}.jpg`);
  209. formData.append('application_id', '1');
  210. formData.append('tenant_id', tenant_id);
  211. formData.append('description', `手部照片-${type}`);
  212. console.log('H5上传参数:', {
  213. application_id: '1',
  214. tenant_id: tenant_id,
  215. description: `手部照片-${type}`
  216. });
  217. // 使用fetch直接上传到 job/upload_posture_photo 接口
  218. fetch(`${apiBaseUrl}/job/upload_posture_photo`, {
  219. method: 'POST',
  220. body: formData
  221. })
  222. .then(response => response.json())
  223. .then(result => {
  224. console.log('照片上传成功:', result);
  225. // 保存图片链接到对应类型的索引位置
  226. const index = this.photoTypes.indexOf(type);
  227. if (index !== -1 && result.data && result.data.url) {
  228. this.$set(this.photoLinks, index, result.data.url);
  229. console.log(`已保存${type}类型照片链接:`, result.data.url);
  230. }
  231. uni.hideLoading();
  232. uni.showToast({
  233. title: '照片上传成功',
  234. icon: 'success'
  235. });
  236. })
  237. .catch(error => {
  238. console.error('照片上传失败:', error);
  239. uni.hideLoading();
  240. uni.showToast({
  241. title: '照片上传失败,请重试',
  242. icon: 'none'
  243. });
  244. });
  245. } else {
  246. // 小程序环境的上传逻辑
  247. console.log(`小程序环境上传文件路径:`, filePathOrData);
  248. console.log('小程序上传参数:', {
  249. application_id: '1',
  250. tenant_id: tenant_id,
  251. description: `手部照片-${type}`
  252. });
  253. uni.uploadFile({
  254. url: `${apiBaseUrl}/job/upload_posture_photo`,
  255. filePath: filePathOrData,
  256. name: 'photo_file', // 确保文件参数名称正确
  257. formData: { // 使用formData替代data以确保参数正确传递
  258. 'application_id': '1',
  259. 'tenant_id': tenant_id,
  260. 'description': `手部照片-${type}`
  261. },
  262. success: (uploadRes) => {
  263. console.log('照片上传成功:', uploadRes);
  264. // 解析返回的JSON字符串
  265. let result;
  266. try {
  267. if (typeof uploadRes.data === 'string') {
  268. result = JSON.parse(uploadRes.data);
  269. } else {
  270. result = uploadRes.data;
  271. }
  272. console.log('解析后的上传结果:', result);
  273. // 保存图片链接到对应类型的索引位置
  274. const index = this.photoTypes.indexOf(type);
  275. if (index !== -1 && result.data && result.data.url) {
  276. this.$set(this.photoLinks, index, result.data.url);
  277. console.log(`已保存${type}类型照片链接:`, result.data.url);
  278. }
  279. } catch (e) {
  280. console.error('解析上传结果失败:', e);
  281. }
  282. uni.hideLoading();
  283. uni.showToast({
  284. title: '照片上传成功',
  285. icon: 'success'
  286. });
  287. },
  288. fail: (err) => {
  289. console.error('照片上传失败:', err);
  290. uni.hideLoading();
  291. uni.showToast({
  292. title: '照片上传失败,请重试',
  293. icon: 'none'
  294. });
  295. },
  296. complete: () => {
  297. uni.hideLoading();
  298. }
  299. });
  300. }
  301. },
  302. prevStep() {
  303. if (this.currentStep > 0) {
  304. this.currentStep--;
  305. }
  306. },
  307. nextStep() {
  308. if (this.currentStep < 5) {
  309. this.currentStep++;
  310. } else if (this.currentStep === 5 && this.photos[5]) {
  311. // 所有照片都已拍摄完成,可以进行提交或跳转
  312. this.submitAllPhotos();
  313. }
  314. },
  315. previewPhoto(index) {
  316. // 如果照片存在,则预览
  317. if (this.photos[index]) {
  318. uni.previewImage({
  319. urls: [this.photos[index]],
  320. current: this.photos[index]
  321. });
  322. }
  323. },
  324. submitAllPhotos() {
  325. // 检查是否所有照片都已拍摄
  326. if (this.photos.every(photo => photo !== null)) {
  327. uni.showLoading({
  328. title: '处理中...'
  329. });
  330. // 所有照片已经单独上传,这里只需要处理跳转
  331. setTimeout(() => {
  332. uni.hideLoading();
  333. uni.showToast({
  334. title: '手部照片采集完成',
  335. icon: 'success',
  336. duration: 2000,
  337. success: () => {
  338. // 延迟跳转,让用户看到成功提示
  339. setTimeout(() => {
  340. //uni.navigateBack();
  341. // 或者跳转到下一个页面
  342. uni.navigateTo({
  343. url: '/pages/ResumeEvaluation/ResumeEvaluation'
  344. });
  345. }, 2000);
  346. }
  347. });
  348. }, 500);
  349. } else {
  350. uni.showToast({
  351. title: '请完成所有照片拍摄',
  352. icon: 'none'
  353. });
  354. }
  355. },
  356. // H5环境下启动摄像头
  357. startCamera() {
  358. this.showCamera = true;
  359. // 确保浏览器支持getUserMedia
  360. if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
  361. navigator.mediaDevices.getUserMedia({ video: { facingMode: 'environment' } })
  362. .then(stream => {
  363. this.mediaStream = stream;
  364. // 等待DOM更新后再设置视频源
  365. this.$nextTick(() => {
  366. const videoElement = this.$refs.videoElement;
  367. if (videoElement) {
  368. videoElement.srcObject = stream;
  369. }
  370. });
  371. })
  372. .catch(error => {
  373. console.error('获取摄像头失败:', error);
  374. uni.showToast({
  375. title: '无法访问摄像头,请检查权限设置',
  376. icon: 'none'
  377. });
  378. this.showCamera = false;
  379. });
  380. } else {
  381. uni.showToast({
  382. title: '您的浏览器不支持摄像头功能',
  383. icon: 'none'
  384. });
  385. this.showCamera = false;
  386. }
  387. },
  388. // H5环境下拍照
  389. capturePhoto() {
  390. const videoElement = this.$refs.videoElement;
  391. const canvasElement = this.$refs.canvasElement;
  392. if (videoElement && canvasElement) {
  393. const context = canvasElement.getContext('2d');
  394. // 设置canvas尺寸与视频一致
  395. canvasElement.width = videoElement.videoWidth;
  396. canvasElement.height = videoElement.videoHeight;
  397. // 在canvas上绘制当前视频帧
  398. context.drawImage(videoElement, 0, 0, canvasElement.width, canvasElement.height);
  399. // 将canvas内容转为base64图片
  400. const photoData = canvasElement.toDataURL('image/jpeg');
  401. // 更新照片数据
  402. this.$set(this.photos, this.currentStep, photoData);
  403. // 上传照片
  404. this.uploadPhoto(photoData, this.photoTypes[this.currentStep]);
  405. // 关闭摄像头
  406. this.stopMediaStream();
  407. this.showCamera = false;
  408. }
  409. },
  410. // 小程序环境下拍照
  411. capturePhotoMP() {
  412. if (!this.cameraContext) {
  413. console.error('相机上下文不存在');
  414. this.handleCameraInitError();
  415. return;
  416. }
  417. try {
  418. this.cameraContext.takePhoto({
  419. quality: 'high',
  420. success: (res) => {
  421. console.log('拍照成功:', res);
  422. // 更新当前步骤的照片
  423. this.$set(this.photos, this.currentStep, res.tempImagePath);
  424. // 上传照片
  425. this.uploadPhoto(res.tempImagePath, this.photoTypes[this.currentStep]);
  426. // 关闭相机
  427. this.showCamera = false;
  428. },
  429. fail: (err) => {
  430. console.error('拍照失败:', err);
  431. uni.showToast({
  432. title: '拍照失败,请重试',
  433. icon: 'none'
  434. });
  435. // 尝试使用替代方法
  436. this.fallbackToChooseImage();
  437. }
  438. });
  439. } catch (err) {
  440. console.error('takePhoto方法执行失败:', err);
  441. this.fallbackToChooseImage();
  442. }
  443. },
  444. // 添加相机初始化错误处理
  445. handleCameraInitError() {
  446. if (this.cameraInitRetries < 3) {
  447. this.cameraInitRetries++;
  448. uni.showToast({
  449. title: `相机初始化失败,正在重试(${this.cameraInitRetries}/3)`,
  450. icon: 'none'
  451. });
  452. setTimeout(() => {
  453. this.showCamera = false;
  454. setTimeout(() => {
  455. this.takePhoto();
  456. }, 500);
  457. }, 1000);
  458. } else {
  459. uni.showToast({
  460. title: '相机初始化失败,将使用系统相机',
  461. icon: 'none'
  462. });
  463. this.fallbackToChooseImage();
  464. }
  465. },
  466. // 添加备用的系统相机方法
  467. fallbackToChooseImage() {
  468. this.showCamera = false;
  469. // 使用系统相机作为备选方案
  470. uni.chooseImage({
  471. count: 1,
  472. sourceType: ['camera'],
  473. success: (res) => {
  474. // 更新当前步骤的照片
  475. this.$set(this.photos, this.currentStep, res.tempFilePaths[0]);
  476. // 上传照片
  477. this.uploadPhoto(res.tempFilePaths[0], this.photoTypes[this.currentStep]);
  478. },
  479. fail: (err) => {
  480. console.error('选择图片失败:', err);
  481. uni.showToast({
  482. title: '拍照失败,请重试',
  483. icon: 'none'
  484. });
  485. }
  486. });
  487. },
  488. // 修改相机错误处理方法
  489. handleCameraError(e) {
  490. console.error('相机错误:', e.detail);
  491. // 记录更详细的错误信息
  492. const errorInfo = JSON.stringify(e.detail);
  493. console.log('详细错误信息:', errorInfo);
  494. uni.showToast({
  495. title: '相机启动失败,将使用系统相机',
  496. icon: 'none'
  497. });
  498. // 使用备用方法
  499. this.fallbackToChooseImage();
  500. },
  501. // 取消拍照 - 更新为同时支持H5和小程序
  502. cancelCamera() {
  503. if (this.isH5) {
  504. this.stopMediaStream();
  505. }
  506. this.showCamera = false;
  507. },
  508. // 停止摄像头流
  509. stopMediaStream() {
  510. if (this.mediaStream) {
  511. this.mediaStream.getTracks().forEach(track => {
  512. track.stop();
  513. });
  514. this.mediaStream = null;
  515. }
  516. },
  517. // base64转blob工具方法
  518. base64ToBlob(base64, mimeType) {
  519. const byteCharacters = atob(base64);
  520. const byteArrays = [];
  521. for (let offset = 0; offset < byteCharacters.length; offset += 512) {
  522. const slice = byteCharacters.slice(offset, offset + 512);
  523. const byteNumbers = new Array(slice.length);
  524. for (let i = 0; i < slice.length; i++) {
  525. byteNumbers[i] = slice.charCodeAt(i);
  526. }
  527. const byteArray = new Uint8Array(byteNumbers);
  528. byteArrays.push(byteArray);
  529. }
  530. return new Blob(byteArrays, { type: mimeType });
  531. },
  532. retryCamera() {
  533. this.showCamera = false;
  534. setTimeout(() => {
  535. this.takePhoto();
  536. }, 500);
  537. },
  538. // 可以添加一个方法来切换蒙层显示
  539. toggleGestureOverlay() {
  540. // 实现蒙层显示/隐藏的逻辑
  541. // 如果需要的话
  542. }
  543. }
  544. }
  545. </script>
  546. <style>
  547. .container {
  548. display: flex;
  549. flex-direction: column;
  550. height: 94vh;
  551. background-color: #f5f5f5;
  552. }
  553. .header {
  554. padding: 20rpx;
  555. background-color: #007AFF;
  556. text-align: center;
  557. }
  558. .title {
  559. color: #ffffff;
  560. font-size: 36rpx;
  561. font-weight: bold;
  562. }
  563. .photo-container {
  564. flex: 1;
  565. padding: 20rpx;
  566. display: flex;
  567. flex-direction: column;
  568. }
  569. .instruction {
  570. padding: 20rpx;
  571. background-color: #E5E5EA;
  572. border-radius: 10rpx;
  573. margin-bottom: 20rpx;
  574. }
  575. .preview-container {
  576. flex: 1;
  577. display: flex;
  578. justify-content: center;
  579. align-items: center;
  580. background-color: #E5E5EA;
  581. border-radius: 10rpx;
  582. margin-bottom: 20rpx;
  583. overflow: hidden;
  584. }
  585. .preview-image {
  586. width: 100%;
  587. height: 100%;
  588. }
  589. .empty-preview {
  590. display: flex;
  591. justify-content: center;
  592. align-items: center;
  593. width: 100%;
  594. height: 100%;
  595. color: #999;
  596. }
  597. .thumbnails {
  598. display: flex;
  599. justify-content: space-around;
  600. margin-bottom: 20rpx;
  601. }
  602. .thumbnail-item {
  603. width: 150rpx;
  604. height: 150rpx;
  605. border-radius: 10rpx;
  606. overflow: hidden;
  607. background-color: #E5E5EA;
  608. display: flex;
  609. justify-content: center;
  610. align-items: center;
  611. border: 4rpx solid transparent;
  612. }
  613. .thumbnail-item.active {
  614. border-color: #007AFF;
  615. }
  616. .thumbnail-item.completed {
  617. background-color: #ffffff;
  618. }
  619. .thumbnail-image {
  620. width: 100%;
  621. height: 100%;
  622. }
  623. .thumbnail-placeholder {
  624. font-size: 40rpx;
  625. color: #999;
  626. }
  627. .controls {
  628. padding: 20rpx;
  629. background-color: #ffffff;
  630. border-top: 1px solid #6c5ce7;
  631. }
  632. .camera-btn {
  633. width: 100%;
  634. height: 80rpx;
  635. line-height: 80rpx;
  636. text-align: center;
  637. background-color: #6c5ce7;
  638. color: white;
  639. border-radius: 40rpx;
  640. margin-bottom: 20rpx;
  641. }
  642. .navigation-btns {
  643. display: flex;
  644. justify-content: space-between;
  645. }
  646. .nav-btn {
  647. width: 48%;
  648. height: 80rpx;
  649. line-height: 80rpx;
  650. text-align: center;
  651. border-radius: 40rpx;
  652. }
  653. .nav-btn.prev {
  654. background-color: #E5E5EA;
  655. color: #333;
  656. }
  657. .nav-btn.next {
  658. background-color: #34C759;
  659. color: white;
  660. }
  661. .nav-btn[disabled] {
  662. opacity: 0.5;
  663. }
  664. /* 浏览器摄像头相关样式 */
  665. .camera-container {
  666. position: fixed;
  667. top: 0;
  668. left: 0;
  669. width: 100%;
  670. height: 100%;
  671. background-color: #000;
  672. z-index: 999;
  673. display: flex;
  674. flex-direction: column;
  675. justify-content: center;
  676. align-items: center;
  677. }
  678. .camera-video {
  679. width: 100%;
  680. height: 70%;
  681. object-fit: cover;
  682. }
  683. .camera-canvas {
  684. display: none;
  685. }
  686. .capture-btn {
  687. width: 200rpx;
  688. height: 200rpx;
  689. border-radius: 50%;
  690. background-color: #ffffff;
  691. border: 10rpx solid #6c5ce7;
  692. margin: 30rpx 0;
  693. }
  694. .cancel-btn {
  695. width: 200rpx;
  696. height: 80rpx;
  697. line-height: 80rpx;
  698. background-color: rgba(255, 255, 255, 0.3);
  699. color: #ffffff;
  700. text-align: center;
  701. border-radius: 40rpx;
  702. }
  703. /* 小程序相机组件样式 */
  704. .camera-component {
  705. width: 100%;
  706. height: 80%;
  707. display: block;
  708. }
  709. .camera-controls {
  710. width: 100%;
  711. display: flex;
  712. flex-direction: column;
  713. align-items: center;
  714. position: absolute;
  715. bottom: 50rpx;
  716. }
  717. /* 添加手势引导蒙层样式 */
  718. .gesture-overlay {
  719. position: absolute;
  720. top: 0;
  721. left: 0;
  722. width: 100%;
  723. height: 80%;
  724. display: flex;
  725. flex-direction: column;
  726. justify-content: center;
  727. align-items: center;
  728. pointer-events: none; /* 允许点击穿透 */
  729. z-index: 10;
  730. }
  731. .gesture-image {
  732. width: 70%;
  733. height: 70%;
  734. opacity: 0.6;
  735. }
  736. .gesture-hint {
  737. background-color: rgba(0, 0, 0, 0.5);
  738. padding: 10rpx 20rpx;
  739. border-radius: 10rpx;
  740. margin-top: 20rpx;
  741. }
  742. .gesture-hint-text {
  743. color: white;
  744. font-size: 28rpx;
  745. text-align: center;
  746. }
  747. </style>