4лаб
This commit is contained in:
parent
e9c6b563e4
commit
f1975493d3
@ -1,68 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>LabWork04</title>
|
||||
<script src="/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="/node_modules/bootstrap/dist/css/bootstrap.min.css">
|
||||
</head>
|
||||
<body class="bg-light">
|
||||
<div id="like_button_container"></div>
|
||||
<!-- <div class="container">-->
|
||||
<!-- <div class="py-5 text-center"><h2>Лабораторная работа 2</h2></div>-->
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div>-->
|
||||
<!-- <form>-->
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div class="col-md-6 mb-3">-->
|
||||
<!-- <label for="input1">Значение 1 (string или double)</label>-->
|
||||
<!-- <input class="form-control" id="input1" placeholder="Введите значение 1">-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="col-md-6 mb-3">-->
|
||||
<!-- <label for="input1">Значение 2 (string или double)</label>-->
|
||||
<!-- <input class="form-control" id="input2" placeholder="Введите значение 2">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label for="operator">Выберите функцию</label>-->
|
||||
<!-- <select class="form-control" id="operator">-->
|
||||
<!-- <option value>Выбрать...</option>-->
|
||||
<!-- <option value="Func1">(string, double)Сумма</option>-->
|
||||
<!-- <option value="Func2">(double)Минимум, (string)Сумма в верхний регистр</option>-->
|
||||
<!-- <option value="Func3">(double)Mаксимум, (string)Разделить</option>-->
|
||||
<!-- <option value="Func4">(double)Число 1 в степени числа 2, (string)Сумма в нижний регистр</option>-->
|
||||
<!-- </select>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label for="operator">Выберите тип данных</label>-->
|
||||
<!-- <select class="form-control" id="Type">-->
|
||||
<!-- <option value>Выбрать...</option>-->
|
||||
<!-- <option value="str">String</option>-->
|
||||
<!-- <option value="double">Double</option>-->
|
||||
<!-- </select>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label for="result">Результат</label>-->
|
||||
<!-- <input type="text" class="form-control result" id="result" readonly>-->
|
||||
<!-- <hr class="mb-4">-->
|
||||
<!-- <button type="button" class="btn btn-primary btn-block" onclick="calculate()">Посчитать</button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </form>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<script src = "script.js"></script>
|
||||
<!-- Загрузим React. -->
|
||||
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
|
||||
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
|
||||
|
||||
<!-- Загрузим наш React-компонент. -->
|
||||
<script src="react.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,15 +1,48 @@
|
||||
{
|
||||
"name": "IP",
|
||||
"version": "1.0.0",
|
||||
"main": "index.html",
|
||||
"scripts": {
|
||||
"start": "http-server -p 3001 ./",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"name": "pages_react",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"bootstrap": "5.2.1"
|
||||
"@fortawesome/fontawesome-free": "^6.2.1",
|
||||
"axios": "^1.1.3",
|
||||
"bootstrap": "^5.2.3",
|
||||
"react": "^18.2.0",
|
||||
"react-bootstrap": "^2.7.2",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.6.1",
|
||||
"react-scripts": "5.0.1",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"http-server": "^14.1.1"
|
||||
"@types/react": "^18.0.24",
|
||||
"@types/react-dom": "^18.0.8",
|
||||
"@vitejs/plugin-react": "^2.2.0",
|
||||
"json-server": "^0.17.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"vite": "^3.2.3"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
14
front/public/index.html
Normal file
14
front/public/index.html
Normal file
@ -0,0 +1,14 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<script src="/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="/node_modules/bootstrap/dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/node_modules/@fortawesome/fontawesome-free/css/all.min.css">
|
||||
<title>Песни, исполнители и альбомыы</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
25
front/react.js
vendored
25
front/react.js
vendored
@ -1,25 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const e = React.createElement;
|
||||
|
||||
class LikeButton extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { liked: false };
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.liked) {
|
||||
return 'You liked this.';
|
||||
}
|
||||
|
||||
return e(
|
||||
'button',
|
||||
{ onClick: () => this.setState({ liked: true }) },
|
||||
'Like'
|
||||
);
|
||||
}
|
||||
}
|
||||
const domContainer = document.querySelector('#like_button_container');
|
||||
const root = ReactDOM.createRoot(domContainer);
|
||||
root.render(e(LikeButton));
|
@ -1,13 +0,0 @@
|
||||
'use strict'
|
||||
async function calculate(){
|
||||
let num1 = document.getElementById("input1").value
|
||||
let num2 = document.getElementById("input2").value
|
||||
let operator = document.getElementById("operator").value
|
||||
let result = document.getElementById("result")
|
||||
let type = document.getElementById("Type").value
|
||||
|
||||
|
||||
let response = await fetch(`http://localhost:8080/${operator}?Type=${type}&value1=${num1}&value2=${num2}`)
|
||||
let res = await response.text()
|
||||
result.value = res
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user