video-briefing.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const common_config = require("../../common/config.js");
  4. const _sfc_main = {
  5. data() {
  6. return {
  7. videoSrc: "https://data.qicai321.com/minlong/latentsync/9791ad45-dd30-4f84-a1c6-0c07c4d08707_result.mp4",
  8. nextPath: "/pages/index/index",
  9. statusBarHeight: 0,
  10. navBarHeight: 44,
  11. videoHeight: 0,
  12. tenant_id: ""
  13. // 租户ID
  14. };
  15. },
  16. onLoad(options) {
  17. this.videoSrc = options && options.src ? decodeURIComponent(options.src) : "";
  18. this.nextPath = options && options.next ? decodeURIComponent(options.next) : "/pages/index/index";
  19. const sysInfo = common_vendor.index.getSystemInfoSync();
  20. this.statusBarHeight = sysInfo.statusBarHeight || 0;
  21. this.videoHeight = (sysInfo.windowHeight || 0) - this.statusBarHeight;
  22. this.getTenantId();
  23. },
  24. methods: {
  25. // 获取本地存储的tenant_id
  26. getTenantId() {
  27. const tenantId = common_vendor.index.getStorageSync("tenant_id");
  28. if (tenantId) {
  29. this.tenant_id = tenantId;
  30. return tenantId;
  31. }
  32. return null;
  33. },
  34. handleSkip() {
  35. this.navigateToNext();
  36. },
  37. handleEnded() {
  38. this.navigateToNext();
  39. },
  40. handleError(e) {
  41. common_vendor.index.showToast({ title: "视频加载失败", icon: "none" });
  42. },
  43. /* navigateToNext() {
  44. console.log(uni.getStorageSync('configData'));
  45. // 若 nextPath 是 tabBar 页面,需要使用 switchTab;否则使用 navigateTo
  46. try {
  47. const tabBarPages = [
  48. '/pages/index/index',
  49. '/pages/my/my'
  50. ];
  51. if (tabBarPages.includes(this.nextPath)) {
  52. uni.switchTab({ url: this.nextPath });
  53. } else {
  54. uni.navigateTo({ url: this.nextPath });
  55. }
  56. } catch (err) {
  57. // 兜底跳首页
  58. uni.switchTab({ url: '/pages/index/index' });
  59. }
  60. }, */
  61. navigateToNext() {
  62. try {
  63. const configStr = common_vendor.index.getStorageSync("configData");
  64. let configData = null;
  65. if (configStr) {
  66. try {
  67. configData = JSON.parse(configStr);
  68. console.log("解析到的配置数据:", configData);
  69. } catch (parseError) {
  70. console.error("解析configData失败:", parseError);
  71. }
  72. }
  73. this.handleUserInfoAndNavigation(configData.require_resume_upload);
  74. } catch (error) {
  75. console.error("跳转处理失败:", error);
  76. }
  77. },
  78. // 处理用户信息获取和页面跳转逻辑
  79. handleUserInfoAndNavigation(require_resume_upload) {
  80. const openid = JSON.parse(common_vendor.index.getStorageSync("userInfo")).openid;
  81. common_vendor.index.request({
  82. url: `${common_config.apiBaseUrl}/api/wechat/user/get_full_info?tenant_id=${this.tenant_id || JSON.parse(common_vendor.index.getStorageSync("userInfo")).tenant_id || 1}&openid=${openid}`,
  83. method: "GET",
  84. success: (infoRes) => {
  85. if (infoRes.statusCode === 200 && infoRes.data && infoRes.data.data && infoRes.data.data.profile) {
  86. const resumeUrl = infoRes.data.data.profile.resume_url || "";
  87. if (!resumeUrl && require_resume_upload) {
  88. common_vendor.index.navigateTo({
  89. url: "/pages/uploadResume/uploadResume",
  90. // 假设跳转到上传简历页面
  91. fail: (err) => {
  92. console.error("页面跳转失败:", err);
  93. common_vendor.index.showToast({
  94. title: "页面跳转失败",
  95. icon: "none"
  96. });
  97. }
  98. });
  99. } else {
  100. common_vendor.index.navigateTo({
  101. url: "/pages/Personal/Personal",
  102. fail: (err) => {
  103. console.error("页面跳转失败:", err);
  104. common_vendor.index.showToast({
  105. title: "页面跳转失败",
  106. icon: "none"
  107. });
  108. }
  109. });
  110. }
  111. } else {
  112. common_vendor.index.navigateTo({
  113. url: "/pages/Personal/Personal",
  114. fail: (err) => {
  115. console.error("页面跳转失败:", err);
  116. common_vendor.index.showToast({
  117. title: "页面跳转失败",
  118. icon: "none"
  119. });
  120. }
  121. });
  122. }
  123. },
  124. fail: (err) => {
  125. console.error("获取用户信息失败:", err);
  126. common_vendor.index.navigateTo({
  127. url: "/pages/Personal/Personal",
  128. fail: (err2) => {
  129. console.error("页面跳转失败:", err2);
  130. common_vendor.index.showToast({
  131. title: "页面跳转失败",
  132. icon: "none"
  133. });
  134. }
  135. });
  136. }
  137. });
  138. }
  139. }
  140. };
  141. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  142. return {
  143. a: "20px",
  144. b: common_vendor.o((...args) => $options.handleSkip && $options.handleSkip(...args)),
  145. c: $data.videoSrc,
  146. d: common_vendor.o((...args) => $options.handleEnded && $options.handleEnded(...args)),
  147. e: common_vendor.o((...args) => $options.handleError && $options.handleError(...args)),
  148. f: $data.videoHeight + "px"
  149. };
  150. }
  151. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  152. wx.createPage(MiniProgramPage);