123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <template src='./cncTestLists.html'>
- </template>
- <script>
- import HeaderMain from "../../components/HeaderMain";
- import api from "../../api/editor";
- export default {
- components: {
- HeaderMain
- },
- data() {
- return {
- cncTestDetailSingle: null,
- houseList: [],
- value: "",
- isShowDialog: false,
- pageModel: null,
- loading: true,
- currentProject: "所属项目",
- currentProjectHouseId: "",
- fullscreenLoading: false
- };
- },
- created() {
- this.houseList = [];
- this.fullscreenLoading = true;
- api.houseList().then(res => {
- if (res.success) {
- this.houseList = res.list;
- }
- });
- this.getCncTestcaseList();
- },
- filters: {
- transtion(val) {
- return String.fromCharCode(64 + parseInt(val));
- },
- currentOptionNum(section) {
- var chnNumChar = [
- "零",
- "一",
- "二",
- "三",
- "四",
- "五",
- "六",
- "七",
- "八",
- "九"
- ];
- var chnUnitChar = ["", "十", "百", "千", "万", "亿", "万亿", "亿亿"];
- var strIns = "",
- chnStr = "";
- var unitPos = 0;
- var zero = true;
- while (section > 0) {
- var v = section % 10;
- if (v === 0) {
- if (!zero) {
- zero = true;
- chnStr = chnNumChar[v] + chnStr;
- }
- } else {
- zero = false;
- strIns = chnNumChar[v];
- strIns += chnUnitChar[unitPos];
- chnStr = strIns + chnStr;
- }
- unitPos++;
- section = Math.floor(section / 10);
- }
- if (chnStr.indexOf("一十") == 0) {
- chnStr = chnStr.substr(1);
- }
- return "题目" + chnStr;
- }
- },
- methods: {
- getCncTestcaseList() {
- let data = {
- houseId: this.currentProjectHouseId,
- pageNo: 1,
- pageSize: 20,
- uid: ""
- };
- api.cncTestcaseList(data).then(res => {
- if (res.success) {
- this.pageModel = res.pageModel;
- }
- this.fullscreenLoading = false;
- });
- },
- cncTestDetail(testcaseId) {
- let that = this;
- let data = {
- testcaseId
- };
- api.cncTestDetail(data).then(res => {
- if (res.success) {
- that.cncTestDetailSingle = res.single;
- }
- that.loading = false;
- });
- },
- showQRDialog(testcaseId) {
- this.isShowDialog = true;
- this.loading = true;
- this.cncTestDetail(testcaseId);
- },
- close() {
- this.isShowDialog = false;
- this.cncTestDetailSingle = null;
- },
- handleCommand(command) {
- this.houseList.forEach(element => {
- if (element.houseId === command) {
- this.currentProject = element.houseName;
- this.currentProjectHouseId = element.houseId;
- this.fullscreenLoading = true;
- this.getCncTestcaseList();
- return true;
- } else {
- this.currentProjectHouseId = "";
- return false;
- }
- });
- },
- useCurrentTest(item) {
- let data = {
- creator: "admin",
- ownHouseName: item.houseName,
- questionCount: item.questionCount,
- title: item.title,
- testcaseId: item.testcaseId,
- jsonString:
- '{"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}'
- };
- let that = this;
- api.createTest(data).then(res => {
- if (res.success) {
- that.$router.push({ path: "/h5editor", query: { itemId: res.id ,testcaseId:item.testcaseId} });
- }
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- @import "./cncTestLists.scss";
- </style>
|