DebugButton.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <Touchable direction="column" center :padding="40" :gap="10" @click="showBuildInfo">
  3. <Text
  4. color="text.second"
  5. :fontSize="22"
  6. :text="`软件版本 ${AppCofig.version}`"
  7. />
  8. </Touchable>
  9. </template>
  10. <script setup lang="ts">
  11. import { DateUtils } from '@imengyu/imengyu-utils';
  12. import { alert } from '@/components/dialog/CommonRoot';
  13. import Text from '@/components/basic/Text.vue';
  14. import Touchable from '@/components/feedback/Touchable.vue';
  15. import BugReporter from '@/common/BugReporter';
  16. import AppCofig, { isDev, isTestEnv } from '@/common/config/AppCofig';
  17. import { navTo } from '@/components/utils/PageAction';
  18. const showAct = isDev || isTestEnv;
  19. function showBuildInfo() {
  20. alert({
  21. title: '关于程序',
  22. content: '版本: ' + AppCofig.version + (showAct ?
  23. ('\n构建时间:' + DateUtils.formatDate(new Date(parseInt(AppCofig.buildTime)), 'yyyy-MM-dd HH:mm:ss') +
  24. ' (' + AppCofig.buildTime + ')' +
  25. '\n构建GUID:' + AppCofig.buildInfo) : ''),
  26. icon: 'prompt-filling',
  27. iconColor: 'primary',
  28. customButtons: showAct ? [
  29. {
  30. text: '测试话题页',
  31. name: 'testTopic',
  32. },
  33. {
  34. text: '测试提交BUG(1)',
  35. name: 'testBug',
  36. },
  37. {
  38. text: '测试异常BUG(2)',
  39. name: 'testBug2',
  40. },
  41. ] : [],
  42. bottomVertical: true,
  43. width: 560,
  44. }).then((res) => {
  45. if (res == 'testTopic') {
  46. navTo('/pages/test/topic');
  47. } else if (res == 'testBug') {
  48. uni.showToast({
  49. title: '测试提交BUG(1)',
  50. icon: 'none',
  51. });
  52. BugReporter.reportError(new Error('测试提交BUG(1)'));
  53. } else if (res == 'testBug2') {
  54. uni.showToast({
  55. title: '测试异常BUG(2)',
  56. icon: 'none',
  57. });
  58. throw new Error('测试异常BUG(2)');
  59. }
  60. });
  61. }
  62. </script>