Compare commits
4 Commits
master
...
LabWork_01
Author | SHA1 | Date | |
---|---|---|---|
|
04f358067f | ||
|
4fb650e3d1 | ||
|
673233ea88 | ||
|
02eae37b14 |
@ -0,0 +1,37 @@
|
||||
package ru.ip.labworks.labworks.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@RestController
|
||||
public class UserController {
|
||||
|
||||
@GetMapping("/sub")
|
||||
public String workSub(HttpServletResponse response, @RequestParam String str1, @RequestParam String str2){
|
||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
return str1.substring(Integer.parseInt(str2));
|
||||
}
|
||||
|
||||
@GetMapping("/split")
|
||||
public String workSplit(HttpServletResponse response, @RequestParam String str1, @RequestParam String str2){
|
||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
String[] array = str1.split(str2);
|
||||
return String.format(String.join(" ", array));
|
||||
}
|
||||
|
||||
@GetMapping("/uplow")
|
||||
public String workUpper(HttpServletResponse response, @RequestParam String str1, @RequestParam String str2){
|
||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
return String.format(str1.toUpperCase() + str2.toLowerCase());
|
||||
}
|
||||
|
||||
@GetMapping("/concat")
|
||||
public String workCompare(HttpServletResponse response, @RequestParam String str1, @RequestParam String str2){
|
||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
return String.format(str1.concat(str2));
|
||||
}
|
||||
}
|
24
src/main/resources/frontend/spa-vue/.gitignore
vendored
Normal file
24
src/main/resources/frontend/spa-vue/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
7
src/main/resources/frontend/spa-vue/README.md
Normal file
7
src/main/resources/frontend/spa-vue/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Vue 3 + Vite
|
||||
|
||||
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||
|
||||
## Recommended IDE Setup
|
||||
|
||||
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
|
19
src/main/resources/frontend/spa-vue/data.json
Normal file
19
src/main/resources/frontend/spa-vue/data.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"posts": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "json-server",
|
||||
"author": "typicode"
|
||||
}
|
||||
],
|
||||
"comments": [
|
||||
{
|
||||
"id": 1,
|
||||
"body": "some comment",
|
||||
"postId": 1
|
||||
}
|
||||
],
|
||||
"profile": {
|
||||
"name": "typicode"
|
||||
}
|
||||
}
|
14
src/main/resources/frontend/spa-vue/index.html
Normal file
14
src/main/resources/frontend/spa-vue/index.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
|
||||
<title>String Compiler</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
5212
src/main/resources/frontend/spa-vue/package-lock.json
generated
Normal file
5212
src/main/resources/frontend/spa-vue/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
src/main/resources/frontend/spa-vue/package.json
Normal file
26
src/main/resources/frontend/spa-vue/package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "spa-vue",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"fake-server": "json-server --watch data.json -p 8079",
|
||||
"start": "npm-run-all --parallel dev fake-server",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.2.41",
|
||||
"vue-router": "^4.1.6",
|
||||
"axios": "^1.1.3",
|
||||
"bootstrap": "^5.2.2",
|
||||
"@fortawesome/fontawesome-free": "^6.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vite": "^3.2.3",
|
||||
"@vitejs/plugin-vue": "^3.2.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"json-server": "^0.17.1"
|
||||
}
|
||||
}
|
9
src/main/resources/frontend/spa-vue/src/App.vue
Normal file
9
src/main/resources/frontend/spa-vue/src/App.vue
Normal file
@ -0,0 +1,9 @@
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<router-view>
|
||||
|
||||
</router-view>
|
||||
</template>
|
@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<footer class="container pt-4 my-md-5 pt-md-5 text-center fixed-bottom border-top">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md">
|
||||
<h5 class=""><strong>End</strong></h5>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<header class="fixed-top">
|
||||
<nav class="navbar navbar-expand-lg bg-primary" data-bs-theme="dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="#">
|
||||
<strong>{ S } Strings Compiler</strong>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
</template>
|
7
src/main/resources/frontend/spa-vue/src/main.js
Normal file
7
src/main/resources/frontend/spa-vue/src/main.js
Normal file
@ -0,0 +1,7 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from "./router/router.js"
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(router).mount("#app");
|
61
src/main/resources/frontend/spa-vue/src/pages/Index.vue
Normal file
61
src/main/resources/frontend/spa-vue/src/pages/Index.vue
Normal file
@ -0,0 +1,61 @@
|
||||
<script>
|
||||
import Header from '../components/Header.vue'
|
||||
import Footer from '../components/Footer.vue'
|
||||
export default{
|
||||
components:{
|
||||
Header,
|
||||
Footer
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
action: "",
|
||||
str_1: "",
|
||||
str_2: "",
|
||||
result: ""
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
GetRepuest(){
|
||||
if (this.action.length == 0 || this.str_1.length == 0 || this.str_2.length == 0){
|
||||
console.warn("Invalid input to fetch!");
|
||||
}
|
||||
console.log("http://localhost:8080/" + this.action + "?str1=" + this.str_1 + "&str2=" + this.str_2)
|
||||
fetch("http://localhost:8080/" + this.action + "?str1=" + this.str_1 + "&str2=" + this.str_2)
|
||||
.then(res => res.text())
|
||||
.then(res => {
|
||||
this.result = res;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Header></Header>
|
||||
<main class="container" style="margin-top: 50pt;">
|
||||
<div class="input-group mb-2 my-5">
|
||||
<span class="input-group-text bg-primary text-white" id="basic-addon1"><strong>Действие:</strong></span>
|
||||
<input type="text" class="form-control" placeholder="Выберите действие" v-model="action">
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text bg-primary text-white" id="basic-addon1"><strong>Строка№1:</strong></span>
|
||||
<input type="text" class="form-control" placeholder="Введите превую строку" v-model="str_1">
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text bg-primary text-white" id="basic-addon1"><strong>Строка№2:</strong></span>
|
||||
<input type="text" class="form-control" placeholder="Введите вторую строку" v-model="str_2">
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text bg-success text-white" id="basic-addon1"><strong>Вывод:</strong></span>
|
||||
<input type="text" class="form-control" placeholder="Выводит рузультат здесь" v-model="result" readonly>
|
||||
</div>
|
||||
<div class="mb-2 d-flex justify-content-center">
|
||||
<button type="submit" class="btn btn-success" @click.prevent="GetRepuest"><strong>GET</strong></button>
|
||||
</div>
|
||||
</main>
|
||||
<Footer></Footer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
14
src/main/resources/frontend/spa-vue/src/router/router.js
Normal file
14
src/main/resources/frontend/spa-vue/src/router/router.js
Normal file
@ -0,0 +1,14 @@
|
||||
import {createRouter, createWebHistory} from "vue-router"
|
||||
import Index from '../pages/Index.vue'
|
||||
|
||||
const routes = [
|
||||
{path: '/', component: Index},
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
linkActiveClass: 'active',
|
||||
routes
|
||||
})
|
||||
|
||||
export default router;
|
7
src/main/resources/frontend/spa-vue/vite.config.js
Normal file
7
src/main/resources/frontend/spa-vue/vite.config.js
Normal file
@ -0,0 +1,7 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user