File: /var/www/html/public/static/js/hookList-8b517489.js
import{getSubjectTree as g,addPaper as E}from"./po-dd1813b7.js";import{b7 as u}from"./message-2472a54a.js";import{A as l,r as s,o as A}from"./runtime-core.esm-bundler-6128546f.js";import"./index-474bf855.js";import"./preload-helper-78dc9057.js";import"./vue-i18n.runtime.esm-bundler-6949bcab.js";import"./index-b7f916e1.js";import"./_commonjsHelpers-87174ba5.js";import"./vue-router-a383d220.js";import"./utils-2ab4f76a.js";function O(){const p=l({}),b=l({}),n=s(1),d=s(!1),f=s(""),i=s([]),m=s([]),e=l({score:"",answer:"",shareValue:"",year:"",title:"",subjectId:""}),h=s([{id:1,name:"Y",name_k:"6"},{id:2,name:"N",name_k:"1"}]);function j(t,a,r){n.value=2,i.value=t.data.data.datas,d.value=!0}function w(t,a){}function v(t,a,r){t?r.answer=1:r.answer=0;let o="";a.options.forEach((c,D)=>{c.answer==1&&(o==""?o=c.answerCode:o=o+" , "+c.answerCode)}),a.answer=o}async function y(){const{data:t}=await g(Object.assign(p,{}));t.code==0&&(m.value=t.data[0].children)}function I(t){i.value.forEach((a,r)=>{a.subjectId=t})}async function S(){if(e.title==""){u.error("Please fill in the name of the test question");return}if(e.subjectId==""){u.error("Please select a classification");return}const{data:t}=await E(Object.assign(b,{title:e.title,year:e.year,subjectId:e.subjectId,isShare:e.shareValue,choiceQuestions:i}));if(t.code==0){i.value=[],n.value=1,u.success("success"),f.value.clearFiles(),e.title="",e.shareValue="",e.subjectId="",e.year="";return}}return A(()=>{y()}),{uploadSlotFile:j,tip:n,topicData:i,share:h,detailNum:e,saveT:v,subjectData:m,onSubmit:S,onSelect:I,remove:w,upload:f,importDialog:d}}export{O as useEqu};