This commit is contained in:
xinyu 2025-04-25 21:33:45 +08:00
parent 48df66d4a0
commit cf46ad0868
9 changed files with 88 additions and 94 deletions

View File

@ -1,2 +1,2 @@
VITE_BASE_URL='' VITE_BASE_URL=''
VITE_BASE_PATH=/api VITE_BASE_PATH=/apis

View File

@ -1,2 +1,2 @@
VITE_BASE_URL='https://api.wodeschool.com' VITE_BASE_URL='http://w3.myschools.me'
VITE_BASE_PATH='' VITE_BASE_PATH=''

View File

@ -1,3 +1,14 @@
<template> <template>
<router-view /> <el-container>
<el-main>
<router-view />
</el-main>
<el-footer>
copyright:2019~2025
</el-footer>
</el-container>
</template> </template>
<style lang="css" scoped>
</style>

View File

@ -25,13 +25,11 @@ service.interceptors.request.use(
// 响应拦截器 // 响应拦截器
service.interceptors.response.use( service.interceptors.response.use(
response => { response => {
const res = response.data; // 检查 HTTP 状态码
// 假设统一应答数据结构中有一个 code 字段表示请求状态 if (response.status === 200) {
if (res.code !== 2) { return response.data;
console.log('请求失败:', res);
return Promise.reject(new Error(res.msg || 'Error'));
} else { } else {
return res.data; return Promise.reject(new Error(response.message || 'Error'));
} }
}, },
error => { error => {

View File

@ -1,5 +1,4 @@
import { createApp } from 'vue' import { createApp } from 'vue'
import './style.css'
import App from './App.vue' import App from './App.vue'
import axios from 'axios' import axios from 'axios'
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
@ -12,7 +11,7 @@ const app=createApp(App)
app.use(pinia) app.use(pinia)
app.use(router) app.use(router)
app.use(ElementPlus) app.use(ElementPlus, { size: 'large', zIndex: 2000 })
app.config.globalProperties.$axios=axios app.config.globalProperties.$axios=axios
app.mount('#app') app.mount('#app')

View File

@ -1,79 +0,0 @@
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
.card {
padding: 2em;
}
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}

View File

@ -1,4 +1,69 @@
<template> <template>
<template>
<el-form :model="form" label-width="auto" style="max-width: 600px">
<el-form-item label="Activity name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="Activity zone">
<el-select v-model="form.region" placeholder="please select your zone">
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item>
<el-form-item label="Activity time">
<el-col :span="11">
<el-date-picker
v-model="form.date1"
type="date"
placeholder="Pick a date"
style="width: 100%"
/>
</el-col>
<el-col :span="2" class="text-center">
<span class="text-gray-500">-</span>
</el-col>
<el-col :span="11">
<el-time-picker
v-model="form.date2"
placeholder="Pick a time"
style="width: 100%"
/>
</el-col>
</el-form-item>
<el-form-item label="Instant delivery">
<el-switch v-model="form.delivery" />
</el-form-item>
<el-form-item label="Activity type">
<el-checkbox-group v-model="form.type">
<el-checkbox value="Online activities" name="type">
Online activities
</el-checkbox>
<el-checkbox value="Promotion activities" name="type">
Promotion activities
</el-checkbox>
<el-checkbox value="Offline activities" name="type">
Offline activities
</el-checkbox>
<el-checkbox value="Simple brand exposure" name="type">
Simple brand exposure
</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="Resources">
<el-radio-group v-model="form.resource">
<el-radio value="Sponsor">Sponsor</el-radio>
<el-radio value="Venue">Venue</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="Activity form">
<el-input v-model="form.desc" type="textarea" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">Create</el-button>
<el-button>Cancel</el-button>
</el-form-item>
</el-form>
</template>
<div> <div>
<p>hello about</p> <p>hello about</p>
<p>Count: {{ tokenStore.count }}</p> <p>Count: {{ tokenStore.count }}</p>

View File

@ -33,7 +33,7 @@ const alertDescription = ref('');
const fetchData = async()=>{ const fetchData = async()=>{
try { try {
const response=await request.get('/wechat/token') const response=await request.get('/api/product')
console.log(response) console.log(response)
} catch (error) { } catch (error) {
alertTitle.value = 'Error'; alertTitle.value = 'Error';

View File

@ -14,10 +14,10 @@ export default defineConfig({
plugins: [vue()], plugins: [vue()],
server:{ server:{
proxy:{ proxy:{
'/api':{ '/apis':{
target: 'https://api.wodeschool.com', target: 'http://w3.myschools.me',
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/,'') rewrite: (path) => path.replace(/^\/apis/,'')
} }
} }
} }