interview.vue 21 KB

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