interview-question.js 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const common_config = require("../../common/config.js");
  4. const _sfc_main = {
  5. name: "IdentityVerify",
  6. data() {
  7. return {
  8. loading: false,
  9. responses: [],
  10. processedResponses: [],
  11. assistantResponse: "",
  12. audioTranscript: "",
  13. videoPlaying: false,
  14. showDebugInfo: false,
  15. // 设置为true可以显示调试信息
  16. videoUrl: "http://121.36.251.245:9000/minlong/tenant_1/general_uploads/abdaa6fda8494e3a8613304743ed0433.mp4",
  17. // 用于存储AI数字人视频URL
  18. showReplayButton: false,
  19. cameraStream: null,
  20. // 存储摄像头流
  21. cameraError: null,
  22. // 存储摄像头错误信息
  23. useMiniProgramCameraComponent: false,
  24. // 添加小程序相机组件标志
  25. cameraContext: null,
  26. // 添加相机上下文
  27. currentSubtitle: "",
  28. subtitles: [
  29. {
  30. startTime: 0,
  31. // 开始时间(秒)
  32. endTime: 6,
  33. // 结束时间(秒)
  34. text: "您已完成本次面试全部题目,请问您对于这个岗位还有什么想要了解的吗?"
  35. }
  36. ],
  37. // secondVideoSubtitles: [
  38. // {
  39. // startTime: 0,
  40. // endTime: 10,
  41. // text: '请结合您的基本信息与过往履历进行简单的自我介绍,并讲一讲您有哪些优势胜任本岗位:'
  42. // }
  43. // ],
  44. // thirdVideoSubtitles: [
  45. // {
  46. // startTime: 0,
  47. // endTime: 4,
  48. // text: '在工作中,你如何确保个人防护装备的正确使用?'
  49. // }
  50. // ],
  51. // fourthVideoSubtitles: [
  52. // {
  53. // startTime: 0,
  54. // endTime: 4,
  55. // text: '描述一次你与团队合作改善生产流程的经历。'
  56. // }
  57. // ],
  58. // fifthVideoSubtitles: [
  59. // {
  60. // startTime: 0,
  61. // endTime: 6,
  62. // text: '你在团队合作中曾遇到过哪些挑战?如何解决团队内部的分歧?'
  63. // }
  64. // ],
  65. // sixthVideoSubtitles: [
  66. // {
  67. // startTime: 0,
  68. // endTime: 5,
  69. // text: '您已完成本次面试全部题目,请问您对于这个岗位还有什么想要了解的吗?'
  70. // }
  71. // ],
  72. showAnswerButton: false,
  73. // 控制答题按钮显示
  74. currentVideoIndex: 0,
  75. // 当前播放的视频索引
  76. videoList: [
  77. "http://121.36.251.245:9000/minlong/tenant_1/general_uploads/abdaa6fda8494e3a8613304743ed0433.mp4"
  78. //结束
  79. ],
  80. isRecording: false,
  81. recordingTimer: null,
  82. showStopRecordingButton: false,
  83. mediaRecorder: null,
  84. recordedChunks: [],
  85. recorder: null,
  86. lastUploadedVideoUrl: "",
  87. showStartRecordingButton: false,
  88. showRetryButton: false,
  89. // 控制重试按钮显示
  90. lastVideoToRetry: null,
  91. // 存储上次失败的视频URL,用于重试
  92. recordingStartTime: null,
  93. // 录制开始时间
  94. recordingTimerCount: 0,
  95. // 录制计时器计数
  96. recordingTimeDisplay: "00:00",
  97. // 格式化的录制时间显示
  98. // 添加上传队列相关数据
  99. uploadQueue: [],
  100. // 存储待上传的视频
  101. isUploading: false,
  102. // 标记是否正在上传
  103. uploadProgress: {},
  104. // 存储每个视频的上传进度
  105. uploadStatus: {},
  106. // 存储每个视频的上传状态
  107. showUploadStatus: false,
  108. // 是否显示上传状态指示器
  109. uploadStatusText: "",
  110. // 上传状态文本
  111. mediaRecorderTimeout: null,
  112. // 用于存储MediaRecorder的超时机制
  113. maxRecordingTime: 300,
  114. // 最大录制时间(秒)- 从60秒改为300秒(5分钟)
  115. remainingTime: 300,
  116. // 剩余录制时间(秒)- 从60秒改为300秒
  117. // 修改初始视频索引,添加参数控制
  118. startFromLastVideo: false
  119. // 是否从最后一个视频开始播放
  120. };
  121. },
  122. onLoad(options) {
  123. if (options && options.startFromLast === "true") {
  124. this.startFromLastVideo = true;
  125. this.currentVideoIndex = this.videoList.length - 1;
  126. }
  127. },
  128. mounted() {
  129. if (this.startFromLastVideo) {
  130. console.log("从最后一个视频开始播放");
  131. this.currentVideoIndex = this.videoList.length - 1;
  132. this.videoUrl = this.videoList[this.currentVideoIndex];
  133. }
  134. this.playDigitalHumanVideo();
  135. this.checkAudioPermission();
  136. this.initCamera();
  137. this.checkIOSCameraRecordPermission();
  138. this.checkAndFixRenderingIssues();
  139. setTimeout(() => {
  140. if (this.cameraStream && !this.useMiniProgramCameraComponent) {
  141. this.testAudioInput();
  142. }
  143. }, 3e3);
  144. common_vendor.index.setKeepScreenOn({
  145. keepScreenOn: true
  146. });
  147. },
  148. beforeDestroy() {
  149. this.stopUserCamera();
  150. },
  151. methods: {
  152. // 初始化相机
  153. async initCamera() {
  154. const systemInfo = common_vendor.index.getSystemInfoSync();
  155. const isMiniProgram = systemInfo.uniPlatform === "mp-weixin" || systemInfo.uniPlatform === "mp-alipay" || systemInfo.uniPlatform === "mp-baidu";
  156. if (isMiniProgram) {
  157. this.useMiniProgramCameraComponent = true;
  158. this.cameraContext = common_vendor.index.createCameraContext();
  159. common_vendor.index.getSetting({
  160. success: (res) => {
  161. if (!res.authSetting["scope.record"]) {
  162. common_vendor.index.authorize({
  163. scope: "scope.record",
  164. success: () => {
  165. console.log("录音权限已获取");
  166. },
  167. fail: (err) => {
  168. console.error("录音权限获取失败:", err);
  169. this.showPermissionDialog("录音");
  170. }
  171. });
  172. }
  173. if (!res.authSetting["scope.camera"]) {
  174. common_vendor.index.authorize({
  175. scope: "scope.camera",
  176. success: () => {
  177. console.log("相机权限已获取");
  178. },
  179. fail: (err) => {
  180. console.error("相机权限获取失败:", err);
  181. this.showPermissionDialog("相机");
  182. }
  183. });
  184. }
  185. const systemInfo2 = common_vendor.index.getSystemInfoSync();
  186. if (systemInfo2.platform === "ios") {
  187. if (!res.authSetting["scope.camera"] || !res.authSetting["scope.record"]) {
  188. console.log("iOS需要同时获取相机和录音权限");
  189. }
  190. }
  191. }
  192. });
  193. } else {
  194. try {
  195. const constraints = {
  196. audio: {
  197. echoCancellation: true,
  198. noiseSuppression: true,
  199. autoGainControl: true
  200. },
  201. video: {
  202. width: { ideal: 640, max: 1280 },
  203. // 控制视频宽度
  204. height: { ideal: 480, max: 720 },
  205. // 控制视频高度
  206. frameRate: { ideal: 15, max: 24 },
  207. // 控制帧率
  208. facingMode: "user"
  209. }
  210. };
  211. const stream = await navigator.mediaDevices.getUserMedia(constraints);
  212. this.cameraStream = stream;
  213. const audioTracks = stream.getAudioTracks();
  214. console.log("音频轨道数量:", audioTracks.length);
  215. if (audioTracks.length > 0) {
  216. console.log("音频轨道已获取:", audioTracks[0].label);
  217. audioTracks[0].enabled = true;
  218. } else {
  219. console.warn("未检测到音频轨道,尝试单独获取音频");
  220. this.tryGetAudioOnly();
  221. }
  222. const videoElement = this.$refs.userCameraVideo;
  223. if (videoElement) {
  224. videoElement.srcObject = stream;
  225. videoElement.muted = true;
  226. }
  227. } catch (error) {
  228. console.error("获取摄像头失败:", error);
  229. this.cameraError = error.message || "无法访问摄像头";
  230. common_vendor.index.showToast({
  231. title: "无法访问摄像头,请检查权限设置",
  232. icon: "none"
  233. });
  234. }
  235. }
  236. },
  237. // 停止用户摄像头
  238. stopUserCamera() {
  239. if (this.cameraStream) {
  240. this.cameraStream.getTracks().forEach((track) => {
  241. track.stop();
  242. });
  243. this.cameraStream = null;
  244. }
  245. },
  246. async fetchData() {
  247. this.loading = true;
  248. this.assistantResponse = "";
  249. this.audioTranscript = "";
  250. this.processedResponses = [];
  251. try {
  252. const requestTask = common_vendor.index.request({
  253. url: "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
  254. method: "POST",
  255. header: {
  256. "Content-Type": "application/json",
  257. "Authorization": "Bearer sk-9e1ec73a7d97493b8613c63f06b6110c"
  258. },
  259. data: {
  260. "model": "qwen-omni-turbo",
  261. "messages": [
  262. {
  263. "role": "user",
  264. "content": [
  265. {
  266. "type": "input_audio",
  267. "input_audio": {
  268. "data": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250211/tixcef/cherry.wav",
  269. "format": "wav"
  270. }
  271. },
  272. {
  273. "type": "text",
  274. "text": "这段音频在说什么"
  275. }
  276. ]
  277. }
  278. ],
  279. "stream": true,
  280. "stream_options": {
  281. "include_usage": true
  282. },
  283. "modalities": ["text", "audio"],
  284. "audio": { "voice": "Cherry", "format": "wav" }
  285. },
  286. success: (res) => {
  287. console.log("请求成功,响应数据:", res.data);
  288. if (typeof res.data === "string" && res.data.includes("data: {")) {
  289. const chunks = res.data.split("data: ").filter((chunk) => chunk.trim() !== "");
  290. chunks.forEach((chunk) => {
  291. this.handleStreamResponse(chunk);
  292. });
  293. } else {
  294. this.handleStreamResponse(res.data);
  295. }
  296. this.playDigitalHumanVideo();
  297. },
  298. fail: (err) => {
  299. console.error("请求失败:", err);
  300. },
  301. complete: () => {
  302. this.loading = false;
  303. }
  304. });
  305. } catch (error) {
  306. console.error("获取数据失败:", error);
  307. this.loading = false;
  308. }
  309. },
  310. handleStreamResponse(data) {
  311. if (typeof data === "string") {
  312. if (data === "[DONE]")
  313. return;
  314. try {
  315. const cleanData = data.trim();
  316. if (cleanData.startsWith("{") && cleanData.endsWith("}")) {
  317. const jsonData = JSON.parse(cleanData);
  318. this.processStreamChunk(jsonData);
  319. }
  320. } catch (e) {
  321. console.error("解析JSON失败:", e, "原始数据:", data);
  322. }
  323. } else {
  324. this.processStreamChunk(data);
  325. }
  326. },
  327. processStreamChunk(chunk) {
  328. if (chunk.choices && chunk.choices.length > 0) {
  329. const choice = chunk.choices[0];
  330. if (choice.delta && choice.delta.content) {
  331. this.assistantResponse += choice.delta.content;
  332. }
  333. if (choice.delta && choice.delta.audio && choice.delta.audio.transcript) {
  334. this.audioTranscript += choice.delta.audio.transcript;
  335. }
  336. if (choice.delta) {
  337. const result = {};
  338. if (choice.delta.role) {
  339. result.role = choice.delta.role;
  340. }
  341. if (choice.delta.audio && choice.delta.audio.transcript) {
  342. result.transcript = choice.delta.audio.transcript;
  343. }
  344. if (Object.keys(result).length > 0) {
  345. this.processedResponses.push(result);
  346. }
  347. }
  348. }
  349. },
  350. processResponseData() {
  351. this.processedResponses = this.responses.map((item) => {
  352. const result = {};
  353. if (item.delta && item.delta.role) {
  354. result.role = item.delta.role;
  355. }
  356. if (item.delta && item.delta.audio && item.delta.audio.transcript) {
  357. result.transcript = item.delta.audio.transcript;
  358. }
  359. return result;
  360. }).filter((item) => Object.keys(item).length > 0);
  361. },
  362. // 播放数字人视频
  363. playDigitalHumanVideo() {
  364. this.videoUrl = this.videoList[this.currentVideoIndex];
  365. this.videoPlaying = true;
  366. console.log(`播放视频 ${this.currentVideoIndex + 1}/${this.videoList.length}: ${this.videoUrl}`);
  367. this.$nextTick(() => {
  368. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  369. if (videoContext) {
  370. videoContext.play();
  371. setTimeout(() => {
  372. if (this.videoPlaying && this.$refs.videoPlayer) {
  373. console.log("视频应该正在播放");
  374. } else {
  375. console.log("视频可能未成功播放,尝试替代方案");
  376. this.tryAlternativeVideoPath();
  377. }
  378. }, 1e3);
  379. } else {
  380. console.error("无法创建视频上下文");
  381. this.tryAlternativeVideoPath();
  382. }
  383. });
  384. },
  385. // 修改 tryAlternativeVideoPath 方法
  386. tryAlternativeVideoPath() {
  387. console.log("尝试使用替代路径");
  388. const alternativePaths = [
  389. "./static/demo.mp4",
  390. "../static/demo.mp4",
  391. "static/demo.mp4",
  392. "/static/demo.mp4",
  393. // 添加绝对路径
  394. `${window.location.origin}/static/demo.mp4`
  395. ];
  396. const currentPathIndex = alternativePaths.indexOf(this.videoUrl);
  397. const nextPathIndex = (currentPathIndex + 1) % alternativePaths.length;
  398. this.videoUrl = alternativePaths[nextPathIndex];
  399. console.log("尝试新路径:", this.videoUrl);
  400. this.$nextTick(() => {
  401. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  402. if (videoContext) {
  403. videoContext.stop();
  404. videoContext.play();
  405. setTimeout(() => {
  406. if (nextPathIndex === alternativePaths.length - 1 && !this.videoPlaying) {
  407. console.log("所有路径均失败,尝试使用uni.getVideoInfo检查视频");
  408. this.checkVideoWithAPI();
  409. }
  410. }, 1e3);
  411. }
  412. });
  413. },
  414. // 添加新方法:使用uni API检查视频
  415. checkVideoWithAPI() {
  416. common_vendor.index.getVideoInfo({
  417. src: "/static/demo.mp4",
  418. success: (res) => {
  419. console.log("视频信息获取成功:", res);
  420. this.videoUrl = "/static/demo.mp4";
  421. this.$nextTick(() => {
  422. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  423. if (videoContext) {
  424. videoContext.play();
  425. }
  426. });
  427. },
  428. fail: (err) => {
  429. console.error("视频信息获取失败:", err);
  430. this.fallbackToLocalVideo();
  431. }
  432. });
  433. },
  434. // 添加新方法:回退到本地视频
  435. fallbackToLocalVideo() {
  436. console.log("尝试使用本地视频资源");
  437. const platform = common_vendor.index.getSystemInfoSync().platform;
  438. if (platform === "android" || platform === "ios") {
  439. this.videoUrl = platform === "android" ? "android.resource://package_name/raw/demo" : "file:///assets/demo.mp4";
  440. this.$nextTick(() => {
  441. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  442. if (videoContext) {
  443. videoContext.play();
  444. }
  445. });
  446. } else {
  447. this.videoPlaying = false;
  448. common_vendor.index.showToast({
  449. title: "视频加载失败,显示静态图片",
  450. icon: "none"
  451. });
  452. }
  453. },
  454. // 修改 handleVideoError 方法
  455. handleVideoError(e) {
  456. console.error("视频加载错误:", e);
  457. if (e && e.detail) {
  458. console.error("详细错误信息:", e.detail);
  459. }
  460. common_vendor.index.getFileInfo({
  461. filePath: this.videoUrl.startsWith("/") ? this.videoUrl.substring(1) : this.videoUrl,
  462. success: (res) => {
  463. console.log("文件存在,大小:", res.size);
  464. this.tryDifferentFormat();
  465. },
  466. fail: (err) => {
  467. console.error("文件不存在或无法访问:", err);
  468. this.tryAlternativeVideoPath();
  469. }
  470. });
  471. common_vendor.index.showToast({
  472. title: "视频加载失败,请检查文件是否存在",
  473. icon: "none",
  474. duration: 2e3
  475. });
  476. },
  477. // 添加新方法:尝试不同格式
  478. tryDifferentFormat() {
  479. console.log("尝试不同的视频格式");
  480. const formats = [
  481. { ext: "mp4", mime: "video/mp4" },
  482. { ext: "webm", mime: "video/webm" },
  483. { ext: "ogg", mime: "video/ogg" },
  484. { ext: "mov", mime: "video/quicktime" }
  485. ];
  486. const currentPath = this.videoUrl;
  487. const basePath = currentPath.substring(0, currentPath.lastIndexOf(".")) || "/static/demo";
  488. let nextFormat = formats.find((f) => !currentPath.endsWith(f.ext));
  489. if (nextFormat) {
  490. this.videoUrl = `${basePath}.${nextFormat.ext}`;
  491. console.log("尝试新格式:", this.videoUrl);
  492. this.$nextTick(() => {
  493. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  494. if (videoContext) {
  495. videoContext.stop();
  496. videoContext.play();
  497. }
  498. });
  499. } else {
  500. this.useBuiltInResource();
  501. }
  502. },
  503. // 添加新方法:使用内置资源
  504. useBuiltInResource() {
  505. console.log("尝试使用内置资源");
  506. const platform = common_vendor.index.getSystemInfoSync().platform;
  507. if (platform === "windows") {
  508. process.env.UNI_INPUT_DIR || "";
  509. this.videoUrl = `./static/demo.mp4`;
  510. console.log("Windows平台尝试路径:", this.videoUrl);
  511. } else if (platform === "android" || platform === "ios") {
  512. this.useNativeVideo();
  513. } else {
  514. const baseUrl = window.location.origin;
  515. this.videoUrl = `${baseUrl}/static/demo.mp4`;
  516. console.log("Web平台尝试URL:", this.videoUrl);
  517. }
  518. this.$nextTick(() => {
  519. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  520. if (videoContext) {
  521. videoContext.play();
  522. }
  523. });
  524. },
  525. // 添加新方法:使用原生视频能力
  526. useNativeVideo() {
  527. console.log("尝试使用原生视频能力");
  528. common_vendor.index.chooseVideo({
  529. sourceType: ["album"],
  530. success: (res) => {
  531. this.videoUrl = res.tempFilePath;
  532. this.$nextTick(() => {
  533. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  534. if (videoContext) {
  535. videoContext.play();
  536. }
  537. });
  538. },
  539. fail: () => {
  540. this.videoPlaying = false;
  541. common_vendor.index.showToast({
  542. title: "无法加载视频,显示静态图片",
  543. icon: "none"
  544. });
  545. }
  546. });
  547. },
  548. // 处理视频结束事件
  549. handleVideoEnded() {
  550. console.log("视频播放结束,当前视频索引:", this.currentVideoIndex);
  551. this.videoPlaying = false;
  552. this.showStartRecordingButton = true;
  553. this.showAnswerButton = false;
  554. },
  555. // 添加新方法:开始录制用户回答
  556. startRecordingAnswer() {
  557. console.log("开始录制用户回答");
  558. this.isRecording = true;
  559. this.recordingStartTime = Date.now();
  560. this.recordingTimerCount = 0;
  561. this.remainingTime = this.maxRecordingTime;
  562. this.recordingTimer = setInterval(() => {
  563. this.recordingTimerCount++;
  564. this.remainingTime = Math.max(0, this.maxRecordingTime - this.recordingTimerCount);
  565. this.recordingTimeDisplay = this.formatTime(this.recordingTimerCount) + " / " + this.formatTime(this.maxRecordingTime);
  566. if (this.recordingTimerCount >= this.maxRecordingTime) {
  567. console.log("已达到最大录制时间(60秒),自动停止录制");
  568. this.stopRecordingAnswer();
  569. }
  570. }, 1e3);
  571. const systemInfo = common_vendor.index.getSystemInfoSync();
  572. const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
  573. if (isMiniProgram) {
  574. this.startMiniProgramRecording();
  575. } else {
  576. this.startBrowserRecording();
  577. }
  578. this.showStopRecordingButton = true;
  579. },
  580. // 添加一个新方法:重置相机组件
  581. resetCamera() {
  582. console.log("重置相机组件");
  583. this.useMiniProgramCameraComponent = false;
  584. if (this.cameraContext) {
  585. this.cameraContext = null;
  586. }
  587. setTimeout(() => {
  588. this.useMiniProgramCameraComponent = true;
  589. setTimeout(() => {
  590. this.cameraContext = common_vendor.index.createCameraContext();
  591. console.log("相机组件已重置");
  592. }, 500);
  593. }, 500);
  594. },
  595. // 修改 startMiniProgramRecording 方法
  596. startMiniProgramRecording() {
  597. console.log("开始小程序录制方法");
  598. const systemInfo = common_vendor.index.getSystemInfoSync();
  599. const isIOS = systemInfo.platform === "ios";
  600. if (isIOS) {
  601. this.resetCamera();
  602. setTimeout(() => {
  603. this.actualStartRecording(isIOS);
  604. }, 1e3);
  605. } else {
  606. this.actualStartRecording(isIOS);
  607. }
  608. },
  609. // 添加新方法:实际开始录制
  610. actualStartRecording(isIOS) {
  611. if (!this.cameraContext) {
  612. this.cameraContext = common_vendor.index.createCameraContext();
  613. console.log("创建新的相机上下文");
  614. }
  615. common_vendor.index.getSetting({
  616. success: (res) => {
  617. const hasRecordAuth = res.authSetting["scope.record"];
  618. const hasCameraAuth = res.authSetting["scope.camera"];
  619. if (!hasRecordAuth || !hasCameraAuth) {
  620. console.warn("缺少必要权限,请求权限");
  621. this.requestMiniProgramPermissions();
  622. return;
  623. }
  624. if (isIOS) {
  625. console.log("iOS: 检查相机状态");
  626. const options = {
  627. timeout: 3e5,
  628. // 300秒超时 (5分钟)
  629. quality: "low",
  630. // 降低质量
  631. compressed: true,
  632. success: () => {
  633. console.log("iOS录制开始成功");
  634. },
  635. fail: (err) => {
  636. console.error("iOS录制失败:", err);
  637. this.useAlternativeRecordingMethod();
  638. }
  639. };
  640. try {
  641. console.log("尝试开始录制");
  642. this.recorder = this.cameraContext.startRecord(options);
  643. } catch (e) {
  644. console.error("开始录制异常:", e);
  645. this.useAlternativeRecordingMethod();
  646. }
  647. } else {
  648. const options = {
  649. timeout: 3e5,
  650. // 300秒超时 (5分钟)
  651. quality: "medium",
  652. compressed: true,
  653. success: () => {
  654. console.log("Android录制开始成功");
  655. },
  656. fail: (err) => {
  657. console.error("Android录制失败:", err);
  658. common_vendor.index.showToast({
  659. title: "录制失败,请检查相机权限",
  660. icon: "none"
  661. });
  662. this.proceedToNextQuestion();
  663. }
  664. };
  665. this.recorder = this.cameraContext.startRecord(options);
  666. }
  667. }
  668. });
  669. },
  670. // 添加新方法:使用替代录制方法
  671. useAlternativeRecordingMethod() {
  672. console.log("使用替代录制方法");
  673. common_vendor.index.showActionSheet({
  674. itemList: ["使用相册中的视频", "跳过此问题"],
  675. success: (res) => {
  676. if (res.tapIndex === 0) {
  677. common_vendor.index.chooseVideo({
  678. sourceType: ["album"],
  679. maxDuration: 300,
  680. // 从60秒改为300秒
  681. camera: "front",
  682. success: (res2) => {
  683. console.log("选择视频成功:", res2.tempFilePath);
  684. this.isRecording = false;
  685. this.showStopRecordingButton = false;
  686. this.uploadRecordedVideo(res2.tempFilePath);
  687. },
  688. fail: () => {
  689. console.log("用户取消选择视频");
  690. this.proceedToNextQuestion();
  691. }
  692. });
  693. } else {
  694. console.log("用户选择跳过问题");
  695. this.proceedToNextQuestion();
  696. }
  697. },
  698. fail: () => {
  699. console.log("操作取消");
  700. this.proceedToNextQuestion();
  701. }
  702. });
  703. },
  704. // 添加新方法:请求小程序权限
  705. requestMiniProgramPermissions() {
  706. common_vendor.index.authorize({
  707. scope: "scope.record",
  708. success: () => {
  709. console.log("录音权限已获取");
  710. common_vendor.index.authorize({
  711. scope: "scope.camera",
  712. success: () => {
  713. console.log("相机权限已获取");
  714. this.startMiniProgramRecording();
  715. },
  716. fail: (err) => {
  717. console.error("相机权限获取失败:", err);
  718. this.showPermissionDialog("相机");
  719. }
  720. });
  721. },
  722. fail: (err) => {
  723. console.error("录音权限获取失败:", err);
  724. this.showPermissionDialog("录音");
  725. }
  726. });
  727. },
  728. // 修改浏览器环境下的录制方法
  729. startBrowserRecording() {
  730. if (!this.cameraStream) {
  731. console.error("没有可用的摄像头流");
  732. common_vendor.index.showToast({
  733. title: "录制失败,摄像头未就绪",
  734. icon: "none"
  735. });
  736. this.proceedToNextQuestion();
  737. return;
  738. }
  739. try {
  740. const hasAudio = this.cameraStream.getAudioTracks().length > 0;
  741. if (!hasAudio) {
  742. console.warn("警告:媒体流中没有音频轨道,尝试重新获取带音频的媒体流");
  743. navigator.mediaDevices.getUserMedia({
  744. audio: {
  745. echoCancellation: true,
  746. noiseSuppression: true,
  747. autoGainControl: true
  748. },
  749. video: true
  750. }).then((newStream) => {
  751. const audioTracks = newStream.getAudioTracks();
  752. if (audioTracks.length > 0) {
  753. console.log("成功获取音频轨道:", audioTracks[0].label);
  754. const videoTrack = this.cameraStream.getVideoTracks()[0];
  755. const audioTrack = newStream.getAudioTracks()[0];
  756. const combinedStream = new MediaStream();
  757. if (videoTrack)
  758. combinedStream.addTrack(videoTrack);
  759. if (audioTrack)
  760. combinedStream.addTrack(audioTrack);
  761. this.cameraStream = combinedStream;
  762. const videoElement = this.$refs.userCameraVideo;
  763. if (videoElement) {
  764. videoElement.srcObject = combinedStream;
  765. videoElement.muted = true;
  766. }
  767. this.setupMediaRecorder(combinedStream);
  768. } else {
  769. console.warn("仍然无法获取音频轨道");
  770. this.setupMediaRecorder(this.cameraStream);
  771. }
  772. }).catch((err) => {
  773. console.error("获取音频失败:", err);
  774. this.setupMediaRecorder(this.cameraStream);
  775. });
  776. } else {
  777. console.log("检测到音频轨道,直接使用");
  778. this.setupMediaRecorder(this.cameraStream);
  779. }
  780. } catch (error) {
  781. console.error("浏览器录制失败:", error);
  782. common_vendor.index.showToast({
  783. title: "录制失败,浏览器可能不支持此功能",
  784. icon: "none"
  785. });
  786. this.proceedToNextQuestion();
  787. }
  788. },
  789. // 修改 setupMediaRecorder 方法
  790. setupMediaRecorder(stream) {
  791. const videoTracks = stream.getVideoTracks();
  792. const audioTracks = stream.getAudioTracks();
  793. console.log("设置MediaRecorder - 视频轨道:", videoTracks.length, "音频轨道:", audioTracks.length);
  794. let mimeType = "";
  795. const supportedTypes = [
  796. "video/webm;codecs=vp9,opus",
  797. "video/webm;codecs=vp8,opus",
  798. "video/webm;codecs=h264,opus",
  799. "video/mp4;codecs=h264,aac",
  800. "video/webm",
  801. "video/mp4"
  802. ];
  803. for (const type of supportedTypes) {
  804. if (MediaRecorder.isTypeSupported(type)) {
  805. mimeType = type;
  806. console.log("使用支持的MIME类型:", mimeType);
  807. break;
  808. }
  809. }
  810. const options = {
  811. mimeType: mimeType || "",
  812. audioBitsPerSecond: 64e3,
  813. // 降低音频比特率
  814. videoBitsPerSecond: 1e6
  815. // 降低视频比特率到1Mbps
  816. };
  817. try {
  818. this.mediaRecorder = new MediaRecorder(stream, options);
  819. console.log("MediaRecorder创建成功,使用选项:", options);
  820. } catch (e) {
  821. console.warn("使用指定选项创建MediaRecorder失败,尝试使用默认选项");
  822. this.mediaRecorder = new MediaRecorder(stream);
  823. }
  824. this.recordedChunks = [];
  825. this.mediaRecorder.ondataavailable = (event) => {
  826. if (event.data && event.data.size > 0) {
  827. this.recordedChunks.push(event.data);
  828. console.log(`收到数据块: ${event.data.size} 字节`);
  829. }
  830. };
  831. this.mediaRecorder.onstop = async () => {
  832. console.log("MediaRecorder停止,数据块数量:", this.recordedChunks.length);
  833. if (this.recordedChunks.length === 0) {
  834. console.error("没有录制到数据");
  835. common_vendor.index.showToast({
  836. title: "录制失败,未捕获到数据",
  837. icon: "none"
  838. });
  839. this.proceedToNextQuestion();
  840. return;
  841. }
  842. const mimeType2 = this.mediaRecorder.mimeType || "video/webm";
  843. const blob = new Blob(this.recordedChunks, { type: mimeType2 });
  844. console.log("创建Blob,原始大小:", blob.size, "类型:", mimeType2);
  845. common_vendor.index.showLoading({
  846. title: "正在处理视频...",
  847. mask: true
  848. });
  849. try {
  850. const compressedBlob = await this.compressVideo(blob);
  851. const fileName = `answer_${this.currentVideoIndex}_${Date.now()}.webm`;
  852. const file = new File([compressedBlob], fileName, { type: mimeType2 });
  853. common_vendor.index.hideLoading();
  854. this.uploadRecordedVideo(file);
  855. } catch (error) {
  856. console.error("视频处理失败:", error);
  857. common_vendor.index.hideLoading();
  858. const fileName = `answer_${this.currentVideoIndex}_${Date.now()}.webm`;
  859. const file = new File([blob], fileName, { type: mimeType2 });
  860. this.uploadRecordedVideo(file);
  861. }
  862. };
  863. this.mediaRecorder.onerror = (event) => {
  864. console.error("MediaRecorder错误:", event.error);
  865. };
  866. try {
  867. this.mediaRecorder.start(1e3);
  868. console.log("MediaRecorder开始录制");
  869. this.mediaRecorderTimeout = setTimeout(() => {
  870. if (this.mediaRecorder && this.mediaRecorder.state === "recording") {
  871. console.log("MediaRecorder备份超时机制触发,停止录制");
  872. this.mediaRecorder.stop();
  873. }
  874. }, 3e5);
  875. } catch (e) {
  876. console.error("开始录制失败:", e);
  877. }
  878. },
  879. // 添加新方法:停止录制用户回答
  880. stopRecordingAnswer() {
  881. console.log("停止录制用户回答");
  882. const recordingDuration = this.getRecordingDuration();
  883. const minimumDuration = 5;
  884. if (recordingDuration < minimumDuration) {
  885. common_vendor.index.showToast({
  886. title: "录制时间过短,请至少录制5秒",
  887. icon: "none",
  888. duration: 2e3
  889. });
  890. return;
  891. }
  892. this.completeRecordingStop();
  893. },
  894. // 添加新方法:获取录制时长
  895. getRecordingDuration() {
  896. if (this.recordingStartTime) {
  897. return (Date.now() - this.recordingStartTime) / 1e3;
  898. }
  899. if (this.mediaRecorder && this.$refs.userCameraVideo) {
  900. return this.$refs.userCameraVideo.currentTime || 0;
  901. }
  902. if (this.recordingTimerCount) {
  903. return this.recordingTimerCount;
  904. }
  905. return 0;
  906. },
  907. // 添加新方法:重置录制
  908. resetRecording() {
  909. if (this.recordingTimer) {
  910. clearTimeout(this.recordingTimer);
  911. }
  912. this.recordingStartTime = Date.now();
  913. this.recordingTimerCount = 0;
  914. if (this.mediaRecorder && this.mediaRecorder.state !== "inactive") {
  915. this.mediaRecorder.stop();
  916. this.recordedChunks = [];
  917. setTimeout(() => {
  918. this.startBrowserRecording();
  919. }, 500);
  920. } else if (this.cameraContext) {
  921. this.cameraContext.stopRecord({
  922. success: () => {
  923. console.log("重置录制:停止当前录制成功");
  924. setTimeout(() => {
  925. this.startMiniProgramRecording();
  926. }, 500);
  927. },
  928. fail: (err) => {
  929. console.error("重置录制:停止当前录制失败", err);
  930. this.startMiniProgramRecording();
  931. }
  932. });
  933. }
  934. common_vendor.index.showToast({
  935. title: "请重新开始回答",
  936. icon: "none",
  937. duration: 2e3
  938. });
  939. },
  940. // 添加新方法:完成录制停止流程
  941. completeRecordingStop() {
  942. this.isRecording = false;
  943. if (this.recordingTimer) {
  944. clearInterval(this.recordingTimer);
  945. this.recordingTimer = null;
  946. }
  947. if (this.mediaRecorderTimeout) {
  948. clearTimeout(this.mediaRecorderTimeout);
  949. this.mediaRecorderTimeout = null;
  950. }
  951. common_vendor.index.hideLoading();
  952. this.showStopRecordingButton = false;
  953. const systemInfo = common_vendor.index.getSystemInfoSync();
  954. const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
  955. if (isMiniProgram) {
  956. this.stopMiniProgramRecording();
  957. } else {
  958. this.stopBrowserRecording();
  959. }
  960. },
  961. // 修改 stopMiniProgramRecording 方法
  962. stopMiniProgramRecording() {
  963. if (!this.cameraContext) {
  964. console.error("相机上下文不存在");
  965. this.proceedToNextQuestion();
  966. return;
  967. }
  968. const systemInfo = common_vendor.index.getSystemInfoSync();
  969. const isIOS = systemInfo.platform === "ios";
  970. const stopOptions = {
  971. success: (res) => {
  972. console.log("小程序录像停止成功:", res);
  973. const tempFilePath = res.tempVideoPath;
  974. if (!tempFilePath) {
  975. console.error("未获取到视频文件路径");
  976. common_vendor.index.showToast({
  977. title: "录制失败,未获取到视频文件",
  978. icon: "none"
  979. });
  980. this.proceedToNextQuestion();
  981. return;
  982. }
  983. if (isIOS) {
  984. common_vendor.index.getFileInfo({
  985. filePath: tempFilePath,
  986. success: () => {
  987. this.uploadRecordedVideo(tempFilePath);
  988. },
  989. fail: (err) => {
  990. console.error("视频文件不存在:", err);
  991. common_vendor.index.showToast({
  992. title: "录制失败,视频文件不存在",
  993. icon: "none"
  994. });
  995. this.proceedToNextQuestion();
  996. }
  997. });
  998. } else {
  999. this.uploadRecordedVideo(tempFilePath);
  1000. }
  1001. },
  1002. fail: (err) => {
  1003. console.error("小程序录像停止失败:", err);
  1004. common_vendor.index.showToast({
  1005. title: "录制失败",
  1006. icon: "none"
  1007. });
  1008. this.proceedToNextQuestion();
  1009. }
  1010. };
  1011. this.cameraContext.stopRecord(stopOptions);
  1012. },
  1013. // 添加新方法:停止浏览器录制
  1014. stopBrowserRecording() {
  1015. if (this.mediaRecorder && this.mediaRecorder.state !== "inactive") {
  1016. this.mediaRecorder.stop();
  1017. console.log("浏览器录制停止成功");
  1018. } else {
  1019. console.error("MediaRecorder不存在或已经停止");
  1020. this.proceedToNextQuestion();
  1021. }
  1022. },
  1023. // 修改上传录制的视频方法
  1024. uploadRecordedVideo(fileOrPath) {
  1025. console.log("准备上传视频:", typeof fileOrPath === "string" ? fileOrPath : fileOrPath.name);
  1026. let questionId = 10;
  1027. const uploadTask = {
  1028. id: Date.now().toString(),
  1029. // 生成唯一ID
  1030. file: fileOrPath,
  1031. questionId,
  1032. attempts: 0,
  1033. // 上传尝试次数
  1034. maxAttempts: 3
  1035. // 最大尝试次数
  1036. };
  1037. this.uploadQueue.push(uploadTask);
  1038. this.uploadProgress[uploadTask.id] = 0;
  1039. this.uploadStatus[uploadTask.id] = "pending";
  1040. common_vendor.index.showToast({
  1041. title: "已完成回答",
  1042. icon: "none",
  1043. duration: 1500
  1044. });
  1045. this.updateUploadStatusText();
  1046. if (!this.isUploading) {
  1047. this.processUploadQueue();
  1048. }
  1049. this.proceedToNextQuestion();
  1050. },
  1051. // 修改 processUploadQueue 方法,添加后台上传支持
  1052. processUploadQueue() {
  1053. if (this.uploadQueue.length === 0) {
  1054. this.isUploading = false;
  1055. this.showUploadStatus = false;
  1056. try {
  1057. common_vendor.index.removeStorageSync("videoUploadStatus");
  1058. } catch (e) {
  1059. console.error("清除上传状态失败:", e);
  1060. }
  1061. this.notifyUploadComplete();
  1062. return;
  1063. }
  1064. this.isUploading = true;
  1065. this.showUploadStatus = true;
  1066. const task = this.uploadQueue[0];
  1067. this.uploadStatus[task.id] = "uploading";
  1068. this.updateUploadStatusText();
  1069. task.attempts++;
  1070. if (typeof task.file !== "string") {
  1071. this.uploadFileWithXHR(task);
  1072. } else {
  1073. this.uploadFileWithUni(task);
  1074. }
  1075. this.saveUploadStatus();
  1076. },
  1077. // 添加新方法:发送上传完成通知
  1078. notifyUploadComplete() {
  1079. try {
  1080. common_vendor.index.$emit("videoUploadComplete", {
  1081. timestamp: Date.now()
  1082. });
  1083. console.log("发送上传完成通知");
  1084. } catch (e) {
  1085. console.error("发送上传完成通知失败:", e);
  1086. }
  1087. const systemInfo = common_vendor.index.getSystemInfoSync();
  1088. if (systemInfo.platform === "android" || systemInfo.platform === "ios") {
  1089. if (plus && plus.push) {
  1090. plus.push.createMessage("视频上传完成", "您的面试视频已成功上传", {});
  1091. }
  1092. }
  1093. },
  1094. // 添加新方法:使用XMLHttpRequest上传文件
  1095. uploadFileWithXHR(task) {
  1096. const userInfo = common_vendor.index.getStorageSync("userInfo");
  1097. const openid = userInfo ? JSON.parse(userInfo).openid || "" : "";
  1098. const tenant_id = common_vendor.index.getStorageSync("tenant_id") || "1";
  1099. const formData = new FormData();
  1100. formData.append("file", task.file);
  1101. formData.append("openid", openid);
  1102. formData.append("tenant_id", tenant_id);
  1103. formData.append("application_id", common_vendor.index.getStorageSync("appId"));
  1104. formData.append("question_id", task.questionId);
  1105. formData.append("video_duration", 0);
  1106. formData.append("has_audio", "true");
  1107. const xhr = new XMLHttpRequest();
  1108. xhr.open("POST", `${common_config.apiBaseUrl}/api/upload/`, true);
  1109. xhr.timeout = 12e4;
  1110. xhr.upload.onprogress = (event) => {
  1111. if (event.lengthComputable) {
  1112. const percentComplete = Math.round(event.loaded / event.total * 100);
  1113. this.uploadProgress[task.id] = percentComplete;
  1114. this.updateUploadStatusText();
  1115. }
  1116. };
  1117. xhr.onload = () => {
  1118. if (xhr.status === 200) {
  1119. try {
  1120. const res = JSON.parse(xhr.responseText);
  1121. console.log("上传响应:", res);
  1122. if (res.code === 2e3) {
  1123. const videoUrl = res.data.url || res.data.photoUrl || "";
  1124. if (videoUrl) {
  1125. this.uploadStatus[task.id] = "success";
  1126. this.updateUploadStatusText();
  1127. this.submitVideoToInterview(videoUrl, task);
  1128. } else {
  1129. this.handleUploadFailure(task, "视频URL获取失败");
  1130. }
  1131. } else {
  1132. this.handleUploadFailure(task, res.msg || "上传失败");
  1133. }
  1134. } catch (e) {
  1135. this.handleUploadFailure(task, "解析响应失败");
  1136. }
  1137. } else {
  1138. this.handleUploadFailure(task, "HTTP状态: " + xhr.status);
  1139. }
  1140. };
  1141. xhr.onerror = () => {
  1142. this.handleUploadFailure(task, "网络错误");
  1143. };
  1144. xhr.ontimeout = () => {
  1145. this.handleUploadFailure(task, "上传超时");
  1146. };
  1147. xhr.send(formData);
  1148. },
  1149. // 添加新方法:使用uni.uploadFile上传文件
  1150. uploadFileWithUni(task) {
  1151. const userInfo = common_vendor.index.getStorageSync("userInfo");
  1152. const openid = userInfo ? JSON.parse(userInfo).openid || "" : "";
  1153. const tenant_id = common_vendor.index.getStorageSync("tenant_id") || "1";
  1154. const uploadTask = common_vendor.index.uploadFile({
  1155. url: `${common_config.apiBaseUrl}/api/upload/`,
  1156. filePath: task.file,
  1157. name: "file",
  1158. formData: {
  1159. openid,
  1160. tenant_id,
  1161. application_id: common_vendor.index.getStorageSync("appId"),
  1162. question_id: task.questionId,
  1163. video_duration: 0,
  1164. has_audio: "true"
  1165. },
  1166. success: (uploadRes) => {
  1167. try {
  1168. const res = JSON.parse(uploadRes.data);
  1169. console.log("上传响应:", res);
  1170. if (res.code === 2e3) {
  1171. const videoUrl = res.data.permanent_link || res.data.url || "";
  1172. if (videoUrl) {
  1173. this.uploadStatus[task.id] = "success";
  1174. this.updateUploadStatusText();
  1175. this.submitVideoToInterview(videoUrl, task);
  1176. } else {
  1177. this.handleUploadFailure(task, "视频URL获取失败");
  1178. }
  1179. } else {
  1180. this.handleUploadFailure(task, res.msg || "上传失败");
  1181. }
  1182. } catch (e) {
  1183. this.handleUploadFailure(task, "解析响应失败");
  1184. }
  1185. },
  1186. fail: (err) => {
  1187. this.handleUploadFailure(task, err.errMsg || "上传失败");
  1188. }
  1189. });
  1190. uploadTask.onProgressUpdate((res) => {
  1191. this.uploadProgress[task.id] = res.progress;
  1192. this.updateUploadStatusText();
  1193. });
  1194. },
  1195. // 添加新方法:处理上传失败
  1196. handleUploadFailure(task, errorMsg) {
  1197. console.error("上传失败:", errorMsg);
  1198. this.uploadStatus[task.id] = "failed";
  1199. this.updateUploadStatusText();
  1200. if (task.attempts < task.maxAttempts) {
  1201. console.log(`将在5秒后重试上传,当前尝试次数: ${task.attempts}/${task.maxAttempts}`);
  1202. setTimeout(() => {
  1203. this.uploadProgress[task.id] = 0;
  1204. if (typeof task.file !== "string") {
  1205. this.uploadFileWithXHR(task);
  1206. } else {
  1207. this.uploadFileWithUni(task);
  1208. }
  1209. }, 5e3);
  1210. } else {
  1211. console.log("超过最大重试次数,放弃上传");
  1212. common_vendor.index.showToast({
  1213. title: "视频上传失败,请稍后重试",
  1214. icon: "none",
  1215. duration: 2e3
  1216. });
  1217. this.uploadQueue.shift();
  1218. this.processUploadQueue();
  1219. }
  1220. },
  1221. // 修改 submitVideoToInterview 方法
  1222. submitVideoToInterview(videoUrl, task = null) {
  1223. console.log("提交视频URL到面试接口:", videoUrl);
  1224. let questionId;
  1225. if (task) {
  1226. questionId = task.questionId;
  1227. } else {
  1228. switch (this.currentVideoIndex) {
  1229. case 1:
  1230. questionId = 36;
  1231. break;
  1232. case 2:
  1233. questionId = 11;
  1234. break;
  1235. case 3:
  1236. questionId = 12;
  1237. break;
  1238. case 4:
  1239. questionId = 13;
  1240. break;
  1241. default:
  1242. questionId = 10;
  1243. }
  1244. }
  1245. const requestData = {
  1246. application_id: common_vendor.index.getStorageSync("appId"),
  1247. question_id: questionId,
  1248. video_url: videoUrl,
  1249. tenant_id: common_vendor.index.getStorageSync("tenant_id") || "1"
  1250. };
  1251. common_vendor.index.request({
  1252. url: `${common_config.apiBaseUrl}/api/job/upload_video`,
  1253. method: "POST",
  1254. data: requestData,
  1255. header: {
  1256. "content-type": "application/x-www-form-urlencoded"
  1257. },
  1258. success: (res) => {
  1259. console.log("面试接口提交成功:", res);
  1260. if (res.data.code === 0 || res.data.code === 2e3) {
  1261. if (task) {
  1262. this.uploadQueue.shift();
  1263. this.processUploadQueue();
  1264. } else {
  1265. common_vendor.index.showToast({
  1266. title: "回答已提交",
  1267. icon: "success"
  1268. });
  1269. this.lastUploadedVideoUrl = videoUrl;
  1270. this.showRetryButton = false;
  1271. this.lastVideoToRetry = null;
  1272. }
  1273. } else {
  1274. if (task) {
  1275. this.handleSubmitFailure(task, res.data.msg || "提交失败");
  1276. } else {
  1277. common_vendor.index.showToast({
  1278. title: res.data.msg || "提交失败,请重试",
  1279. icon: "none"
  1280. });
  1281. this.lastVideoToRetry = videoUrl;
  1282. this.showRetryButton = true;
  1283. }
  1284. }
  1285. },
  1286. fail: (err) => {
  1287. console.error("面试接口提交失败:", err);
  1288. if (task) {
  1289. this.handleSubmitFailure(task, err.errMsg || "网络错误");
  1290. } else {
  1291. common_vendor.index.hideLoading();
  1292. common_vendor.index.showToast({
  1293. title: "网络错误,请重试",
  1294. icon: "none"
  1295. });
  1296. this.lastVideoToRetry = videoUrl;
  1297. this.showRetryButton = true;
  1298. }
  1299. }
  1300. });
  1301. },
  1302. // 添加新方法:处理提交失败
  1303. handleSubmitFailure(task, errorMsg) {
  1304. console.error("提交失败:", errorMsg);
  1305. this.uploadStatus[task.id] = "failed";
  1306. this.updateUploadStatusText();
  1307. if (task.attempts < task.maxAttempts) {
  1308. console.log(`将在5秒后重试提交,当前尝试次数: ${task.attempts}/${task.maxAttempts}`);
  1309. setTimeout(() => {
  1310. this.submitVideoToInterview(task.videoUrl, task);
  1311. }, 5e3);
  1312. } else {
  1313. console.log("超过最大重试次数,放弃提交");
  1314. common_vendor.index.showToast({
  1315. title: "视频提交失败,请稍后重试",
  1316. icon: "none",
  1317. duration: 2e3
  1318. });
  1319. this.uploadQueue.shift();
  1320. this.processUploadQueue();
  1321. }
  1322. },
  1323. // 添加新方法:更新上传状态文本
  1324. updateUploadStatusText() {
  1325. if (this.uploadQueue.length === 0) {
  1326. this.uploadStatusText = "";
  1327. return;
  1328. }
  1329. const currentTask = this.uploadQueue[0];
  1330. const progress = this.uploadProgress[currentTask.id] || 0;
  1331. const status = this.uploadStatus[currentTask.id] || "pending";
  1332. let statusText = "";
  1333. switch (status) {
  1334. case "pending":
  1335. statusText = "等待上传";
  1336. break;
  1337. case "uploading":
  1338. statusText = `上传中 ${progress}%`;
  1339. break;
  1340. case "success":
  1341. statusText = "上传成功,提交中...";
  1342. break;
  1343. case "failed":
  1344. statusText = `上传失败,${currentTask.attempts < currentTask.maxAttempts ? "即将重试" : "已放弃"}`;
  1345. break;
  1346. }
  1347. this.uploadStatusText = `问题${currentTask.questionId - 9}:${statusText}`;
  1348. if (this.uploadQueue.length > 1) {
  1349. this.uploadStatusText += ` (${this.uploadQueue.length}个视频待处理)`;
  1350. }
  1351. },
  1352. // 修改 proceedToNextQuestion 方法
  1353. proceedToNextQuestion() {
  1354. console.log("准备跳转到下一页面");
  1355. this.navigateToNextPage();
  1356. if (this.uploadQueue.length > 0) {
  1357. console.log("上传队列将在后台继续处理...");
  1358. this.saveUploadStatus();
  1359. }
  1360. },
  1361. // 修改 navigateToNextPage 方法
  1362. navigateToNextPage() {
  1363. console.log("导航到下一个页面");
  1364. setTimeout(() => {
  1365. common_vendor.index.navigateTo({
  1366. url: "/pages/interview-result/interview-result?uploading=" + (this.uploadQueue.length > 0 ? "true" : "false"),
  1367. success: () => {
  1368. console.log("成功跳转到结果页面");
  1369. },
  1370. fail: (err) => {
  1371. console.error("跳转失败:", err);
  1372. common_vendor.index.navigateTo({
  1373. url: "/pages/interview/interview",
  1374. fail: (err2) => {
  1375. console.error("备用跳转也失败:", err2);
  1376. common_vendor.index.navigateBack({
  1377. delta: 1
  1378. });
  1379. }
  1380. });
  1381. }
  1382. });
  1383. }, 2e3);
  1384. },
  1385. // 修改 handleAnswerButtonClick 方法
  1386. handleAnswerButtonClick() {
  1387. this.showAnswerButton = false;
  1388. this.proceedToNextQuestion();
  1389. },
  1390. // 处理相机错误
  1391. handleCameraError(e) {
  1392. console.error("相机错误:", e);
  1393. const systemInfo = common_vendor.index.getSystemInfoSync();
  1394. const isIOS = systemInfo.platform === "ios";
  1395. if (isIOS) {
  1396. console.log("iOS相机错误,尝试重新初始化");
  1397. common_vendor.index.showToast({
  1398. title: "相机初始化中...",
  1399. icon: "loading",
  1400. duration: 2e3
  1401. });
  1402. this.resetCamera();
  1403. if (this.isRecording) {
  1404. this.isRecording = false;
  1405. this.showStopRecordingButton = false;
  1406. setTimeout(() => {
  1407. this.useAlternativeRecordingMethod();
  1408. }, 1e3);
  1409. }
  1410. } else {
  1411. common_vendor.index.showToast({
  1412. title: "相机初始化失败,请检查权限设置",
  1413. icon: "none"
  1414. });
  1415. this.tryFallbackOptions();
  1416. }
  1417. },
  1418. // 添加新方法:尝试备用选项
  1419. tryFallbackOptions() {
  1420. const systemInfo = common_vendor.index.getSystemInfoSync();
  1421. if (systemInfo.uniPlatform === "mp-weixin" || systemInfo.uniPlatform === "mp-alipay") {
  1422. this.useMiniProgramCamera();
  1423. } else {
  1424. this.showStaticCameraPlaceholder();
  1425. }
  1426. },
  1427. // 添加新方法:使用小程序相机API
  1428. useMiniProgramCamera() {
  1429. console.log("尝试使用小程序相机组件");
  1430. this.useMiniProgramCameraComponent = true;
  1431. },
  1432. // 添加新方法:显示静态图像
  1433. showStaticCameraPlaceholder() {
  1434. console.log("显示静态摄像头占位图");
  1435. const img = document.createElement("img");
  1436. img.src = "/static/images/camera-placeholder.png";
  1437. img.className = "static-camera-image";
  1438. img.style.width = "100%";
  1439. img.style.height = "100%";
  1440. img.style.objectFit = "cover";
  1441. const container = this.$refs.userCameraVideo.parentNode;
  1442. container.appendChild(img);
  1443. },
  1444. // 处理视频时间更新事件
  1445. handleTimeUpdate(e) {
  1446. const currentTime = e.target.currentTime;
  1447. if (this.isRecording && this.recordingTimerCount) {
  1448. this.recordingTimeDisplay = this.formatTime(this.recordingTimerCount);
  1449. }
  1450. let currentSubtitles;
  1451. if (this.currentVideoIndex === 0) {
  1452. currentSubtitles = this.subtitles;
  1453. } else if (this.currentVideoIndex === 1) {
  1454. currentSubtitles = this.secondVideoSubtitles;
  1455. } else if (this.currentVideoIndex === 2) {
  1456. currentSubtitles = this.thirdVideoSubtitles;
  1457. } else if (this.currentVideoIndex === 3) {
  1458. currentSubtitles = this.fourthVideoSubtitles;
  1459. } else if (this.currentVideoIndex === 4) {
  1460. currentSubtitles = this.fifthVideoSubtitles;
  1461. } else if (this.currentVideoIndex === 5) {
  1462. currentSubtitles = this.sixthVideoSubtitles;
  1463. } else {
  1464. currentSubtitles = [];
  1465. }
  1466. const subtitle = currentSubtitles.find(
  1467. (sub) => currentTime >= sub.startTime && currentTime < sub.endTime
  1468. );
  1469. this.currentSubtitle = subtitle ? subtitle.text : "";
  1470. },
  1471. // Add a new method to handle the "Start Recording" button click
  1472. handleStartRecordingClick() {
  1473. this.showStartRecordingButton = false;
  1474. this.startRecordingAnswer();
  1475. },
  1476. // 修改 checkAudioPermission 方法,确保在录制前获取音频权限
  1477. checkAudioPermission() {
  1478. const systemInfo = common_vendor.index.getSystemInfoSync();
  1479. const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
  1480. if (isMiniProgram) {
  1481. common_vendor.index.getSetting({
  1482. success: (res) => {
  1483. if (!res.authSetting["scope.record"]) {
  1484. common_vendor.index.authorize({
  1485. scope: "scope.record",
  1486. success: () => {
  1487. console.log("录音权限已获取");
  1488. },
  1489. fail: (err) => {
  1490. console.error("录音权限获取失败:", err);
  1491. this.showPermissionDialog("录音");
  1492. }
  1493. });
  1494. }
  1495. if (!res.authSetting["scope.camera"]) {
  1496. common_vendor.index.authorize({
  1497. scope: "scope.camera",
  1498. success: () => {
  1499. console.log("相机权限已获取");
  1500. },
  1501. fail: (err) => {
  1502. console.error("相机权限获取失败:", err);
  1503. this.showPermissionDialog("相机");
  1504. }
  1505. });
  1506. }
  1507. }
  1508. });
  1509. }
  1510. },
  1511. // 添加新方法:测试音频输入
  1512. testAudioInput() {
  1513. if (!this.cameraStream) {
  1514. console.warn("没有可用的媒体流,无法测试音频");
  1515. return;
  1516. }
  1517. const audioTracks = this.cameraStream.getAudioTracks();
  1518. if (audioTracks.length === 0) {
  1519. console.warn("没有检测到音频轨道,尝试重新获取");
  1520. this.tryGetAudioOnly();
  1521. return;
  1522. }
  1523. console.log("音频轨道信息:", audioTracks[0].getSettings());
  1524. try {
  1525. const AudioContext = window.AudioContext || window.webkitAudioContext;
  1526. if (!AudioContext) {
  1527. console.warn("浏览器不支持AudioContext");
  1528. return;
  1529. }
  1530. const audioContext = new AudioContext();
  1531. const analyser = audioContext.createAnalyser();
  1532. const microphone = audioContext.createMediaStreamSource(this.cameraStream);
  1533. microphone.connect(analyser);
  1534. analyser.fftSize = 256;
  1535. const bufferLength = analyser.frequencyBinCount;
  1536. const dataArray = new Uint8Array(bufferLength);
  1537. let silenceCounter = 0;
  1538. const checkAudio = () => {
  1539. if (this.isRecording)
  1540. return;
  1541. analyser.getByteFrequencyData(dataArray);
  1542. let sum = 0;
  1543. for (let i = 0; i < bufferLength; i++) {
  1544. sum += dataArray[i];
  1545. }
  1546. const average = sum / bufferLength;
  1547. if (average > 10) {
  1548. console.log("检测到音频输入,音量:", average);
  1549. silenceCounter = 0;
  1550. } else {
  1551. silenceCounter++;
  1552. if (silenceCounter > 10) {
  1553. console.warn("持续检测不到音频输入,可能麦克风未正常工作");
  1554. silenceCounter = 0;
  1555. }
  1556. }
  1557. requestAnimationFrame(checkAudio);
  1558. };
  1559. checkAudio();
  1560. } catch (e) {
  1561. console.error("音频测试失败:", e);
  1562. }
  1563. },
  1564. // 添加新方法:尝试单独获取音频
  1565. tryGetAudioOnly() {
  1566. navigator.mediaDevices.getUserMedia({ audio: true }).then((audioStream) => {
  1567. if (this.cameraStream) {
  1568. const videoTrack = this.cameraStream.getVideoTracks()[0];
  1569. const audioTrack = audioStream.getAudioTracks()[0];
  1570. const combinedStream = new MediaStream();
  1571. if (videoTrack)
  1572. combinedStream.addTrack(videoTrack);
  1573. if (audioTrack)
  1574. combinedStream.addTrack(audioTrack);
  1575. this.cameraStream = combinedStream;
  1576. const videoElement = this.$refs.userCameraVideo;
  1577. if (videoElement) {
  1578. videoElement.srcObject = combinedStream;
  1579. videoElement.muted = true;
  1580. }
  1581. console.log("成功合并音频和视频轨道");
  1582. } else {
  1583. console.warn("没有视频流可合并");
  1584. }
  1585. }).catch((err) => {
  1586. console.error("单独获取音频失败:", err);
  1587. });
  1588. },
  1589. // 添加新方法:显示权限对话框
  1590. showPermissionDialog(permissionType) {
  1591. common_vendor.index.showModal({
  1592. title: "需要权限",
  1593. content: `请允许使用${permissionType}权限,否则可能影响面试功能`,
  1594. confirmText: "去设置",
  1595. success: (res) => {
  1596. if (res.confirm) {
  1597. common_vendor.index.openSetting({
  1598. success: (settingRes) => {
  1599. console.log("设置页面打开成功", settingRes);
  1600. }
  1601. });
  1602. }
  1603. }
  1604. });
  1605. },
  1606. // 添加重试上传方法
  1607. retryVideoUpload() {
  1608. if (this.lastVideoToRetry) {
  1609. this.showRetryButton = false;
  1610. common_vendor.index.showLoading({
  1611. title: "正在重新提交...",
  1612. mask: true
  1613. });
  1614. this.submitVideoToInterview(this.lastVideoToRetry);
  1615. } else {
  1616. common_vendor.index.showToast({
  1617. title: "没有可重试的视频",
  1618. icon: "none"
  1619. });
  1620. }
  1621. },
  1622. // 添加一个新方法用于压缩视频
  1623. async compressVideo(videoBlob) {
  1624. if (videoBlob.size < 5 * 1024 * 1024) {
  1625. return videoBlob;
  1626. }
  1627. console.log("开始压缩视频,原始大小:", videoBlob.size);
  1628. const videoElement = document.createElement("video");
  1629. videoElement.muted = true;
  1630. videoElement.autoplay = false;
  1631. const canvas = document.createElement("canvas");
  1632. const ctx = canvas.getContext("2d");
  1633. videoElement.src = URL.createObjectURL(videoBlob);
  1634. return new Promise((resolve) => {
  1635. videoElement.onloadedmetadata = () => {
  1636. const width = Math.floor(videoElement.videoWidth / 2);
  1637. const height = Math.floor(videoElement.videoHeight / 2);
  1638. canvas.width = width;
  1639. canvas.height = height;
  1640. const stream = canvas.captureStream(15);
  1641. if (videoElement.captureStream) {
  1642. const originalStream = videoElement.captureStream();
  1643. const audioTracks = originalStream.getAudioTracks();
  1644. if (audioTracks.length > 0) {
  1645. stream.addTrack(audioTracks[0]);
  1646. }
  1647. }
  1648. const options = {
  1649. mimeType: "video/webm;codecs=vp8,opus",
  1650. audioBitsPerSecond: 64e3,
  1651. videoBitsPerSecond: 8e5
  1652. // 800kbps
  1653. };
  1654. const mediaRecorder = new MediaRecorder(stream, options);
  1655. const chunks = [];
  1656. mediaRecorder.ondataavailable = (e) => {
  1657. if (e.data.size > 0) {
  1658. chunks.push(e.data);
  1659. }
  1660. };
  1661. mediaRecorder.onstop = () => {
  1662. const compressedBlob = new Blob(chunks, { type: "video/webm" });
  1663. console.log("视频压缩完成,压缩后大小:", compressedBlob.size);
  1664. resolve(compressedBlob);
  1665. };
  1666. videoElement.onplay = () => {
  1667. mediaRecorder.start(100);
  1668. const drawFrame = () => {
  1669. if (videoElement.paused || videoElement.ended) {
  1670. mediaRecorder.stop();
  1671. return;
  1672. }
  1673. ctx.drawImage(videoElement, 0, 0, width, height);
  1674. requestAnimationFrame(drawFrame);
  1675. };
  1676. drawFrame();
  1677. };
  1678. videoElement.play();
  1679. };
  1680. });
  1681. },
  1682. // 修改 checkIOSCameraRecordPermission 方法
  1683. checkIOSCameraRecordPermission() {
  1684. const systemInfo = common_vendor.index.getSystemInfoSync();
  1685. if (systemInfo.platform !== "ios")
  1686. return;
  1687. common_vendor.index.getSetting({
  1688. success: (res) => {
  1689. if (!res.authSetting["scope.camera"]) {
  1690. common_vendor.index.authorize({
  1691. scope: "scope.camera",
  1692. success: () => {
  1693. console.log("iOS相机权限已获取");
  1694. },
  1695. fail: (err) => {
  1696. console.error("iOS相机权限获取失败:", err);
  1697. this.showPermissionDialog("相机");
  1698. }
  1699. });
  1700. }
  1701. if (!res.authSetting["scope.record"]) {
  1702. common_vendor.index.authorize({
  1703. scope: "scope.record",
  1704. success: () => {
  1705. console.log("iOS录音权限已获取");
  1706. },
  1707. fail: (err) => {
  1708. console.error("iOS录音权限获取失败:", err);
  1709. this.showPermissionDialog("录音");
  1710. }
  1711. });
  1712. }
  1713. }
  1714. });
  1715. },
  1716. // 添加新方法:检查并修复渲染问题
  1717. checkAndFixRenderingIssues() {
  1718. try {
  1719. if (typeof u !== "undefined" && u) {
  1720. if (!u.currentQuestion) {
  1721. console.log("修复: 创建缺失的currentQuestion对象");
  1722. u.currentQuestion = {};
  1723. }
  1724. if (u.currentQuestion && typeof u.currentQuestion.isImportant === "undefined") {
  1725. console.log("修复: 设置缺失的isImportant属性");
  1726. u.currentQuestion.isImportant = false;
  1727. }
  1728. }
  1729. } catch (e) {
  1730. console.log("防御性检查异常:", e);
  1731. }
  1732. },
  1733. // 添加格式化时间的辅助方法
  1734. formatTime(seconds) {
  1735. if (!seconds && seconds !== 0)
  1736. return "03:30";
  1737. const minutes = Math.floor(seconds / 60);
  1738. const remainingSeconds = seconds % 60;
  1739. return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
  1740. },
  1741. // 添加新方法:保存上传状态到本地存储
  1742. saveUploadStatus() {
  1743. const uploadStatus = {
  1744. isUploading: this.isUploading,
  1745. uploadQueue: this.uploadQueue.length,
  1746. timestamp: Date.now()
  1747. };
  1748. try {
  1749. common_vendor.index.setStorageSync("videoUploadStatus", JSON.stringify(uploadStatus));
  1750. } catch (e) {
  1751. console.error("保存上传状态失败:", e);
  1752. }
  1753. }
  1754. }
  1755. };
  1756. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  1757. return common_vendor.e({
  1758. a: $data.videoUrl,
  1759. b: common_vendor.o((...args) => $options.handleVideoError && $options.handleVideoError(...args)),
  1760. c: common_vendor.o((...args) => $options.handleVideoEnded && $options.handleVideoEnded(...args)),
  1761. d: common_vendor.o((...args) => $options.handleTimeUpdate && $options.handleTimeUpdate(...args)),
  1762. e: $data.showAnswerButton
  1763. }, $data.showAnswerButton ? {
  1764. f: common_vendor.o((...args) => $options.handleAnswerButtonClick && $options.handleAnswerButtonClick(...args))
  1765. } : {}, {
  1766. g: $data.currentSubtitle
  1767. }, $data.currentSubtitle ? {
  1768. h: common_vendor.t($data.currentSubtitle)
  1769. } : {}, {
  1770. i: $data.useMiniProgramCameraComponent
  1771. }, $data.useMiniProgramCameraComponent ? {
  1772. j: common_vendor.o((...args) => $options.handleCameraError && $options.handleCameraError(...args))
  1773. } : {}, {
  1774. k: $data.loading
  1775. }, $data.loading ? {} : {}, {
  1776. l: $data.showDebugInfo
  1777. }, $data.showDebugInfo ? common_vendor.e({
  1778. m: $data.assistantResponse
  1779. }, $data.assistantResponse ? {
  1780. n: common_vendor.t($data.assistantResponse)
  1781. } : {}, {
  1782. o: $data.audioTranscript
  1783. }, $data.audioTranscript ? {
  1784. p: common_vendor.t($data.audioTranscript)
  1785. } : {}, {
  1786. q: common_vendor.f($data.processedResponses, (item, index, i0) => {
  1787. return common_vendor.e({
  1788. a: item.role
  1789. }, item.role ? {
  1790. b: common_vendor.t(item.role)
  1791. } : {}, {
  1792. c: item.transcript
  1793. }, item.transcript ? {
  1794. d: common_vendor.t(item.transcript)
  1795. } : {}, {
  1796. e: index
  1797. });
  1798. })
  1799. }) : {}, {
  1800. r: $data.showStopRecordingButton
  1801. }, $data.showStopRecordingButton ? {
  1802. s: common_vendor.o((...args) => $options.stopRecordingAnswer && $options.stopRecordingAnswer(...args))
  1803. } : {}, {
  1804. t: $data.isRecording
  1805. }, $data.isRecording ? {
  1806. v: common_vendor.t($data.recordingTimeDisplay || "00:00 / 05:00")
  1807. } : {}, {
  1808. w: $data.showStartRecordingButton
  1809. }, $data.showStartRecordingButton ? {
  1810. x: common_vendor.o((...args) => $options.handleStartRecordingClick && $options.handleStartRecordingClick(...args))
  1811. } : {}, {
  1812. y: $data.showRetryButton
  1813. }, $data.showRetryButton ? {
  1814. z: common_vendor.o((...args) => $options.retryVideoUpload && $options.retryVideoUpload(...args))
  1815. } : {});
  1816. }
  1817. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2a02c54e"]]);
  1818. wx.createPage(MiniProgramPage);