cncTestLists.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template src='./cncTestLists.html'>
  2. </template>
  3. <script>
  4. import HeaderMain from "../../components/HeaderMain";
  5. import api from "../../api/editor";
  6. export default {
  7. components: {
  8. HeaderMain
  9. },
  10. data() {
  11. return {
  12. cncTestDetailSingle: null,
  13. houseList: [],
  14. value: "",
  15. isShowDialog: false,
  16. pageModel: null,
  17. loading: true,
  18. currentProject: "所属项目",
  19. currentProjectHouseId: "",
  20. fullscreenLoading: false
  21. };
  22. },
  23. created() {
  24. this.houseList = [];
  25. this.fullscreenLoading = true;
  26. api.houseList().then(res => {
  27. if (res.success) {
  28. this.houseList = res.list;
  29. }
  30. });
  31. this.getCncTestcaseList();
  32. },
  33. filters: {
  34. transtion(val) {
  35. return String.fromCharCode(64 + parseInt(val));
  36. },
  37. currentOptionNum(section) {
  38. var chnNumChar = [
  39. "零",
  40. "一",
  41. "二",
  42. "三",
  43. "四",
  44. "五",
  45. "六",
  46. "七",
  47. "八",
  48. "九"
  49. ];
  50. var chnUnitChar = ["", "十", "百", "千", "万", "亿", "万亿", "亿亿"];
  51. var strIns = "",
  52. chnStr = "";
  53. var unitPos = 0;
  54. var zero = true;
  55. while (section > 0) {
  56. var v = section % 10;
  57. if (v === 0) {
  58. if (!zero) {
  59. zero = true;
  60. chnStr = chnNumChar[v] + chnStr;
  61. }
  62. } else {
  63. zero = false;
  64. strIns = chnNumChar[v];
  65. strIns += chnUnitChar[unitPos];
  66. chnStr = strIns + chnStr;
  67. }
  68. unitPos++;
  69. section = Math.floor(section / 10);
  70. }
  71. if (chnStr.indexOf("一十") == 0) {
  72. chnStr = chnStr.substr(1);
  73. }
  74. return "题目" + chnStr;
  75. }
  76. },
  77. methods: {
  78. getCncTestcaseList() {
  79. let data = {
  80. houseId: this.currentProjectHouseId,
  81. pageNo: 1,
  82. pageSize: 20,
  83. uid: ""
  84. };
  85. api.cncTestcaseList(data).then(res => {
  86. if (res.success) {
  87. this.pageModel = res.pageModel;
  88. }
  89. this.fullscreenLoading = false;
  90. });
  91. },
  92. cncTestDetail(testcaseId) {
  93. let that = this;
  94. let data = {
  95. testcaseId
  96. };
  97. api.cncTestDetail(data).then(res => {
  98. if (res.success) {
  99. that.cncTestDetailSingle = res.single;
  100. }
  101. that.loading = false;
  102. });
  103. },
  104. showQRDialog(testcaseId) {
  105. this.isShowDialog = true;
  106. this.loading = true;
  107. this.cncTestDetail(testcaseId);
  108. },
  109. close() {
  110. this.isShowDialog = false;
  111. this.cncTestDetailSingle = null;
  112. },
  113. handleCommand(command) {
  114. this.houseList.forEach(element => {
  115. if (element.houseId === command) {
  116. this.currentProject = element.houseName;
  117. this.currentProjectHouseId = element.houseId;
  118. this.fullscreenLoading = true;
  119. this.getCncTestcaseList();
  120. return true;
  121. } else {
  122. this.currentProjectHouseId = "";
  123. return false;
  124. }
  125. });
  126. },
  127. useCurrentTest(item) {
  128. let data = {
  129. creator: "admin",
  130. ownHouseName: item.houseName,
  131. questionCount: item.questionCount,
  132. title: item.title,
  133. testcaseId: item.testcaseId,
  134. jsonString:
  135. '{"pages":[{"elements":[]}],"createDate":1566357290066,"type":"h5","_id":"5d5cb72addd4fa1c047df1d5","title":"标题","description":"描述","canvasHeight":1334,"canvasWidth":750,"bgc":"#B1C096","btnColor":"#5f8a61","cover":"","animatedNameGlobal":"","bodyBackgroundColor":"rgba(255,255,255,0)","animatedNameBackgroundGlobal":"","backgroundAudio":"","loginId":"caodd@elab-plus.com","__v":0}'
  136. };
  137. let that = this;
  138. api.createTest(data).then(res => {
  139. if (res.success) {
  140. that.$router.push({ path: "/h5editor", query: { itemId: res.id ,testcaseId:item.testcaseId} });
  141. }
  142. });
  143. }
  144. }
  145. };
  146. </script>
  147. <style lang="scss" scoped>
  148. @import "./cncTestLists.scss";
  149. </style>