This commit is contained in:
Firesieht 2021-04-24 14:52:07 +03:00
parent 854baf27a2
commit 0dd50d7299
3 changed files with 15 additions and 5 deletions

View File

@ -6,6 +6,10 @@ import { Route, useRouteMatch, Switch } from "react-router";
import {useUpdateDocMutation} from "../../generated/graphql" import {useUpdateDocMutation} from "../../generated/graphql"
import {Document} from "../../uiKit/Documents/Document/Document" import {Document} from "../../uiKit/Documents/Document/Document"
function createDoc(){
}
export const BaseScreen:react.FC = () => { export const BaseScreen:react.FC = () => {
let {url} = useRouteMatch(); let {url} = useRouteMatch();
const {loading, data} = useGetMaterialsQuery({variables:{token:localStorage.getItem("token")}}); const {loading, data} = useGetMaterialsQuery({variables:{token:localStorage.getItem("token")}});
@ -35,6 +39,7 @@ export const BaseScreen:react.FC = () => {
<Document></Document> <Document></Document>
</Route> </Route>
<Route path={url}> <Route path={url}>
<button onClick={}></button>
<div> <div>
{data && data?.materialsByUser?.map( materials => {data && data?.materialsByUser?.map( materials =>
<DocumentCard <DocumentCard

View File

@ -28,6 +28,8 @@ export const Document:React.FC = () =>{
function onChange(state:any){ function onChange(state:any){
updateDoc({variables:{id:docID, content:JSON.stringify(convertToRaw(state))}}) updateDoc({variables:{id:docID, content:JSON.stringify(convertToRaw(state))}})
} }
// let a = {"entityMap":{},"blocks":[{"key":"637gr","text":"Initialized from content state.","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}]};
// updateDoc({variables:{id:docID, content:JSON.stringify(a)}})
let state = convertFromRaw(JSON.parse(data.material.content)) let state = convertFromRaw(JSON.parse(data.material.content))

View File

@ -40,6 +40,7 @@ export class MyUserComponentEditor extends React.Component {
test = (e) =>{ test = (e) =>{
console.log(e)
this.Type_task = e.target.innerText this.Type_task = e.target.innerText
this.confirmMedia() this.confirmMedia()
}; };
@ -50,10 +51,10 @@ export class MyUserComponentEditor extends React.Component {
return ( return (
<div onClick={this.stopPropagation}> <div onClick={this.stopPropagation}>
<div className="wrapper"> <div className="wrapper">
<DefaultButton handleClick={(e)=>this.test(e)} id={1} class="taskButton">Прочитать текст</DefaultButton> <button onClick={(e)=>this.test(e)} id={1} class="taskButton">Прочитать текст</button>
<DefaultButton handleClick={(e)=>this.test(e)} id={2} class="taskButton">выбрать правильный вариант ответа</DefaultButton> <button handleClick={(e)=>this.test(e)} id={2} class="taskButton">выбрать правильный вариант ответа</button>
<DefaultButton handleClick={(e)=>this.test(e)} id={3} class="taskButton">правда/ложь</DefaultButton> <button handleClick={(e)=>this.test(e)} id={3} class="taskButton">правда/ложь</button>
<DefaultButton handleClick={(e)=>this.test(e)} id={4} class="taskButton">расставить заголвки</DefaultButton> <button handleClick={(e)=>this.test(e)} id={4} class="taskButton">расставить заголвки</button>
</div> </div>
</div> </div>
); );
@ -155,6 +156,8 @@ const Media = (props) => {
const type = entity.getType(); const type = entity.getType();
let media; let media;
media = <div>audio</div>;
if (type === 'audio') { if (type === 'audio') {
media = <div>audio</div>; media = <div>audio</div>;
} else if (type === "Прочитать текст") { } else if (type === "Прочитать текст") {