Commit a17289f7 authored by SYRain's avatar SYRain
Browse files

看题初步实现

parent 15101c9f
......@@ -3480,7 +3480,8 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
"bundled": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
......@@ -3498,11 +3499,13 @@
},
"balanced-match": {
"version": "1.0.0",
"bundled": true
"bundled": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -3515,15 +3518,18 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -3626,7 +3632,8 @@
},
"inherits": {
"version": "2.0.3",
"bundled": true
"bundled": true,
"optional": true
},
"ini": {
"version": "1.3.5",
......@@ -3636,6 +3643,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -3648,17 +3656,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true
"bundled": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -3675,6 +3686,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -3747,7 +3759,8 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
......@@ -3757,6 +3770,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -3832,7 +3846,8 @@
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true
"bundled": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -3862,6 +3877,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -3879,6 +3895,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -3917,11 +3934,13 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true
"bundled": true,
"optional": true
}
}
},
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -26,4 +26,4 @@ global.storage = new Storage({
global.token = null;
global.url = 'https://eoj.i64d.com';
global.url = 'https://acm.ecnu.edu.cn';
import React from 'react';
import { Container, Content, Text } from 'native-base';
import HTML from 'react-native-render-html';
import { ScrollView } from 'react-native-gesture-handler';
import { Problem } from '../utils/api';
const ProblemScene = () => (
<Container>
<Content>
<Text>1234566</Text>
</Content>
</Container>
);
export default class ProblemScene extends React.Component {
constructor() {
super();
this.state = {
statement: '',
tagsStyles: { p: { color: 'red' } }
};
}
export default ProblemScene;
async componentDidMount() {
const data = await Problem(2997);
data.statement = `<head><script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML">
</script></head><body>${data.statement}</body>`;
this.setState({ statement: data.statement });
}
render() {
const { statement, tagsStyles } = this.state;
return (
<ScrollView style={{ flex: 1 }}>
<HTML html={statement} tagsStyles={tagsStyles} />
</ScrollView>
);
}
}
......@@ -51,3 +51,22 @@ export function TokenRefresh(token, callback) {
console.warn(error.message);
});
}
export async function Problem(problemId) {
let ret = null;
await axios({
method: 'post',
url: `${global.url}/api/problem/${problemId}`
})
.then(response => {
if (response.status === 200) {
ret = response.data;
} else {
ret = null;
}
})
.catch(error => {
console.warn(error.message);
});
return ret;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment