myHistoryTest.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import HeaderMain from "../../components/HeaderMain";
  2. import ShareSetting from "../../components/ShareSetting";
  3. export default {
  4. components: {
  5. HeaderMain, ShareSetting
  6. },
  7. data() {
  8. return {
  9. isCopy: false,
  10. isShareSetting: false,
  11. cities: [{
  12. value: 'Beijing',
  13. label: '北京'
  14. }, {
  15. value: 'Shanghai',
  16. label: '上海'
  17. }, {
  18. value: 'Nanjing',
  19. label: '南京'
  20. }, {
  21. value: 'Chengdu',
  22. label: '成都'
  23. }, {
  24. value: 'Shenzhen',
  25. label: '深圳'
  26. }, {
  27. value: 'Guangzhou',
  28. label: '广州'
  29. }],
  30. value: '',
  31. lists: [{ index: 0 }, { index: 1 }, { index: 2 }, { index: 3 }, { index: 4 }, { index: 5 }, { index: 6 }, { index: 7 }, { index: 8 }, { index: 9 }, { index: 10 }, { index: 11 }, { index: 12 }, { index: 13 }, { index: 14 }, { index: 15 }, { index: 16 }, { index: 17 }, { index: 18 }, { index: 19 }]
  32. }
  33. },
  34. watch: {
  35. isShareSetting: function (val) {
  36. var mo = function (e) { e.preventDefault(); };
  37. document.body.style.overflow = val ? 'hidden' : '';
  38. if (val) {
  39. document.addEventListener("touchmove", mo, false);
  40. } else {
  41. document.removeEventListener("touchmove", mo, false);
  42. }
  43. }
  44. },
  45. methods: {
  46. createTest() {
  47. this.$router.push({ path: '/cncTestLists' });
  48. },
  49. deleteTest(index) {
  50. const h = this.$createElement;
  51. this.$msgbox({
  52. title: '删除',
  53. message: '删除后不可撤回,确定删除此套测题?',
  54. showCancelButton: true,
  55. confirmButtonText: '确定',
  56. cancelButtonText: '取消',
  57. beforeClose: (action, instance, done) => {
  58. if (action === 'confirm') {
  59. instance.confirmButtonLoading = true;
  60. instance.confirmButtonText = '执行中...';
  61. setTimeout(() => {
  62. done();
  63. setTimeout(() => {
  64. instance.confirmButtonLoading = false;
  65. }, 300);
  66. }, 3000);
  67. } else {
  68. done();
  69. }
  70. }
  71. }).then(() => {
  72. this.lists.splice(index, 1);
  73. this.$message({
  74. type: 'success',
  75. message: '删除成功'
  76. });
  77. }).catch(() => { });
  78. },
  79. copyTest() {
  80. this.$message({
  81. message: '复制成功',
  82. type: 'success'
  83. });
  84. this.lists.unshift({ index: 100 });
  85. this.isCopy = true;
  86. setTimeout(() => {
  87. this.isCopy = false;
  88. }, 2000);
  89. },
  90. editTest() {
  91. this.$router.replace({ path: '/h5editor', query: { itemId: 0 } })
  92. },
  93. shareTest() {
  94. this.isShareSetting = true;
  95. },
  96. closeShare() {
  97. this.isShareSetting = false;
  98. }
  99. },
  100. }