Commit 29f798ef authored by 王造's avatar 王造

Initial commit

parents
Pipeline #65 failed with stages
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')
module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.tsbuildinfo
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
\ No newline at end of file
{
"recommendations": [
"Vue.volar",
"Vue.vscode-typescript-vue-plugin",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
# raytracing-front
This template should help get you started developing with Vue 3 in Vite.
## Recommended IDE Setup
[VSCode](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).
## Customize configuration
See [Vite Configuration Reference](https://vitejs.dev/config/).
## Project Setup
```sh
npm install
```
### Compile and Hot-Reload for Development
```sh
npm run dev
```
### Compile and Minify for Production
```sh
npm run build
```
### Lint with [ESLint](https://eslint.org/)
```sh
npm run lint
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
},
"exclude": ["node_modules", "dist"]
}
{
"name": "raytracing-front",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore",
"format": "prettier --write src/"
},
"dependencies": {
"axios": "^1.6.7",
"element-plus": "^2.5.5",
"element-ui": "^2.15.14",
"three": "^0.161.0",
"three-obj-mtl-loader": "^1.0.3",
"vue": "^3.4.15",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.3.3",
"@vitejs/plugin-vue": "^5.0.3",
"@vue/eslint-config-prettier": "^8.0.0",
"eslint": "^8.49.0",
"eslint-plugin-vue": "^9.17.0",
"prettier": "^3.0.3",
"vite": "^5.0.11"
}
}
# Cuboid OBJ File
v -30.00000000 0.00000000 0.00000000
v -15.00000000 0.00000000 0.00000000
v -15.00000000 15.00000000 0.00000000
v -30.00000000 15.00000000 0.00000000
v -30.00000000 0.00000000 10.00000000
v -15.00000000 0.00000000 10.00000000
v -15.00000000 15.00000000 10.00000000
v -30.00000000 15.00000000 10.00000000
f 4 3 2 1
f 5 6 7 8
f 1 2 6 5
f 2 3 7 6
f 3 4 8 7
f 4 1 5 8
v -40.00000000 -60.00000000 0.00000000
v 40.00000000 -60.00000000 0.00000000
v 40.00000000 -40.00000000 0.00000000
v -40.00000000 -40.00000000 0.00000000
v -40.00000000 -60.00000000 15.00000000
v 40.00000000 -60.00000000 15.00000000
v 40.00000000 -40.00000000 15.00000000
v -40.00000000 -40.00000000 15.00000000
f 12 11 10 9
f 13 14 15 16
f 9 10 14 13
f 10 11 15 14
f 11 12 16 15
f 12 9 13 16
v -28.00000000 32.00000000 0.00000000
v 21.00000000 32.00000000 0.00000000
v 21.00000000 80.00000000 0.00000000
v -28.00000000 80.00000000 0.00000000
v -28.00000000 32.00000000 13.00000000
v 21.00000000 32.00000000 13.00000000
v 21.00000000 80.00000000 13.00000000
v -28.00000000 80.00000000 13.00000000
f 20 19 18 17
f 21 22 23 24
f 17 18 22 21
f 18 19 23 22
f 19 20 24 23
f 20 17 21 24
v 40.00000000 40.00000000 0.00000000
v 120.00000000 40.00000000 0.00000000
v 120.00000000 60.00000000 0.00000000
v 40.00000000 60.00000000 0.00000000
v 40.00000000 40.00000000 18.00000000
v 120.00000000 40.00000000 18.00000000
v 120.00000000 60.00000000 18.00000000
v 40.00000000 60.00000000 18.00000000
f 28 27 26 25
f 29 30 31 32
f 25 26 30 29
f 26 27 31 30
f 27 28 32 31
f 28 25 29 32
v 10.00000000 0.00000000 0.00000000
v 50.00000000 0.00000000 0.00000000
v 50.00000000 20.00000000 0.00000000
v 10.00000000 20.00000000 0.00000000
v 10.00000000 0.00000000 10.00000000
v 50.00000000 0.00000000 10.00000000
v 50.00000000 20.00000000 10.00000000
v 10.00000000 20.00000000 10.00000000
f 36 35 34 33
f 37 38 39 40
f 33 34 38 37
f 34 35 39 38
f 35 36 40 39
f 36 33 37 40
v 140.00000000 0.00000000 0.00000000
v 160.00000000 0.00000000 0.00000000
v 160.00000000 80.00000000 0.00000000
v 140.00000000 80.00000000 0.00000000
v 140.00000000 0.00000000 15.00000000
v 160.00000000 0.00000000 15.00000000
v 160.00000000 80.00000000 15.00000000
v 140.00000000 80.00000000 15.00000000
f 44 43 42 41
f 45 46 47 48
f 41 42 46 45
f 42 43 47 46
f 43 44 48 47
f 44 41 45 48
v 60.00000000 -60.00000000 0.00000000
v 120.00000000 -60.00000000 0.00000000
v 120.00000000 -20.00000000 0.00000000
v 60.00000000 -20.00000000 0.00000000
v 60.00000000 -60.00000000 20.00000000
v 120.00000000 -60.00000000 20.00000000
v 120.00000000 -20.00000000 20.00000000
v 60.00000000 -20.00000000 20.00000000
f 52 51 50 49
f 53 54 55 56
f 49 50 54 53
f 50 51 55 54
f 51 52 56 55
f 52 49 53 56
<template>
<router-view></router-view>
</template>
<script>
import Main from './views/3DModelView.vue'
export default {
name: 'App',
components: [Main]
}
</script>
<style>
body{
display: flex;
width: 100%;
height: 100vh;
margin: 0;
}
#app {
max-width: none;
padding: 0;
margin: 0;
-webkit-flex: 1;
flex: 1;
display: block;
}
</style>
import request from '../axios/index'
export let targetUrl = 'http://127.0.0.1:8080'
// 文件上传地址
export var uploadUrl = targetUrl + '/obj/upload'
export function getAllRays(form) {
console.log(JSON.stringify(form))
return request({
url: '/obj/getAllSBRRays',
method: 'post',
data: form
})
}
export function getAllEmitRays(form) {
console.log(JSON.stringify(form))
return request({
url: '/obj/getAllEmitRays',
method: 'post',
data: form
})
}
\ No newline at end of file
//先导入axios
import axios from 'axios'
//创建一个axios对象,将基础配置配好
var request = axios.create({
baseURL: '/api', // 请求根路径
timeout: 2000000000, // 请求超时时间
headers: {} // 请求头
})
//请求拦截器 前端给后端参数
request.interceptors.request.use(
(config) => {
//在请求之前做些什么
// 添加loading加载
const token = localStorage.getItem('token')
if (token) {
config.headers['token'] = token //请求头添加token
}
return config // 拦截成功后最后一定要返回
//可通过return 向请求中添加数据
// return {
// ...config,
// token: token //添加token
// }
},
(err) => {
//请求错误做些什么
return Promise.reject(err)
}
)
// 响应拦截器 后端给前端参数
request.interceptors.response.use(
(response) => {
//对响应数据做些什么
//取消加载
return response.data
},
(err) => {
//请求失败也要取消加载
alert(err)
return Promise.reject(err) //抛出错误,把错误抛给谁? 谁调用它发请求就给谁
}
)
//导出请求对象
export default request
import {createApp } from 'vue'
import ElementUI from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router'
const app = createApp(App)
app.use(router)
app.use(ElementUI)
app.mount('#app')
import { createRouter, createWebHashHistory } from 'vue-router'
import Main from '../views/3DModelView.vue'
const router = createRouter({
history: createWebHashHistory(),
routes: [
{
path: '/',
redirect: '/index'
},
{
//信息导入界面
path:'/index',
component: Main,
},
]
})
export default router
This diff is collapsed.
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import {targetUrl} from './src/apis/index'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
proxy: {
'/api': {
target: targetUrl, //目标url
changeOrigin: true, //支持跨域
rewrite: (path) => path.replace(/^\/api/, ""),
//重写路径,替换/api
}
}
}
})
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