修改文件结构

曾晨曦_branch
zcx 1 year ago
parent dece352494
commit 420c9925aa

@ -8,6 +8,7 @@
export default {
name: 'App'
}
</script>
<style>

@ -1,6 +1,6 @@
import axios from 'axios'
const baseURL = '192.168.254.35:8080'
const baseURL = 'https:106.52.218.118:12607'
export const login = (data) => {
return axios.post(`${baseURL}/Login/login`, data)

@ -1,44 +0,0 @@
<script setup>
defineProps({
msg: {
type: String,
required: true
}
})
</script>
<template>
<div class="greetings">
<h1 class="green">{{ msg }}</h1>
<h3>
Youve successfully created a project with
<a href="https://vitejs.dev/" target="_blank" rel="noopener">Vite</a> +
<a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>.
</h3>
</div>
</template>
<style scoped>
h1 {
font-weight: 500;
font-size: 2.6rem;
position: relative;
top: -10px;
}
h3 {
font-size: 1.2rem;
}
.greetings h1,
.greetings h3 {
text-align: center;
}
@media (min-width: 1024px) {
.greetings h1,
.greetings h3 {
text-align: left;
}
}
</style>

@ -0,0 +1,16 @@
<template>
<div>
<label for="user-input"></label>
<input type="text" id="user-input" v-model="userInput" placeholder="请输入">
</div>
</template>
<script>
export default {
data() {
return {
userInput: '', //
};
},
};
</script>

@ -1,88 +0,0 @@
<script setup>
import WelcomeItem from './WelcomeItem.vue'
import DocumentationIcon from './icons/IconDocumentation.vue'
import ToolingIcon from './icons/IconTooling.vue'
import EcosystemIcon from './icons/IconEcosystem.vue'
import CommunityIcon from './icons/IconCommunity.vue'
import SupportIcon from './icons/IconSupport.vue'
</script>
<template>
<WelcomeItem>
<template #icon>
<DocumentationIcon />
</template>
<template #heading>Documentation</template>
Vues
<a href="https://vuejs.org/" target="_blank" rel="noopener">official documentation</a>
provides you with all information you need to get started.
</WelcomeItem>
<WelcomeItem>
<template #icon>
<ToolingIcon />
</template>
<template #heading>Tooling</template>
This project is served and bundled with
<a href="https://vitejs.dev/guide/features.html" target="_blank" rel="noopener">Vite</a>. The
recommended IDE setup is
<a href="https://code.visualstudio.com/" target="_blank" rel="noopener">VSCode</a> +
<a href="https://github.com/johnsoncodehk/volar" target="_blank" rel="noopener">Volar</a>. If
you need to test your components and web pages, check out
<a href="https://www.cypress.io/" target="_blank" rel="noopener">Cypress</a> and
<a href="https://on.cypress.io/component" target="_blank" rel="noopener"
>Cypress Component Testing</a
>.
<br />
More instructions are available in <code>README.md</code>.
</WelcomeItem>
<WelcomeItem>
<template #icon>
<EcosystemIcon />
</template>
<template #heading>Ecosystem</template>
Get official tools and libraries for your project:
<a href="https://pinia.vuejs.org/" target="_blank" rel="noopener">Pinia</a>,
<a href="https://router.vuejs.org/" target="_blank" rel="noopener">Vue Router</a>,
<a href="https://test-utils.vuejs.org/" target="_blank" rel="noopener">Vue Test Utils</a>, and
<a href="https://github.com/vuejs/devtools" target="_blank" rel="noopener">Vue Dev Tools</a>. If
you need more resources, we suggest paying
<a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">Awesome Vue</a>
a visit.
</WelcomeItem>
<WelcomeItem>
<template #icon>
<CommunityIcon />
</template>
<template #heading>Community</template>
Got stuck? Ask your question on
<a href="https://chat.vuejs.org" target="_blank" rel="noopener">Vue Land</a>, our official
Discord server, or
<a href="https://stackoverflow.com/questions/tagged/vue.js" target="_blank" rel="noopener"
>StackOverflow</a
>. You should also subscribe to
<a href="https://news.vuejs.org" target="_blank" rel="noopener">our mailing list</a> and follow
the official
<a href="https://twitter.com/vuejs" target="_blank" rel="noopener">@vuejs</a>
twitter account for latest news in the Vue world.
</WelcomeItem>
<WelcomeItem>
<template #icon>
<SupportIcon />
</template>
<template #heading>Support Vue</template>
As an independent project, Vue relies on community backing for its sustainability. You can help
us by
<a href="https://vuejs.org/sponsor/" target="_blank" rel="noopener">becoming a sponsor</a>.
</WelcomeItem>
</template>

@ -1,87 +0,0 @@
<template>
<div class="item">
<i>
<slot name="icon"></slot>
</i>
<div class="details">
<h3>
<slot name="heading"></slot>
</h3>
<slot></slot>
</div>
</div>
</template>
<style scoped>
.item {
margin-top: 2rem;
display: flex;
position: relative;
}
.details {
flex: 1;
margin-left: 1rem;
}
i {
display: flex;
place-items: center;
place-content: center;
width: 32px;
height: 32px;
color: var(--color-text);
}
h3 {
font-size: 1.2rem;
font-weight: 500;
margin-bottom: 0.4rem;
color: var(--color-heading);
}
@media (min-width: 1024px) {
.item {
margin-top: 0;
padding: 0.4rem 0 1rem calc(var(--section-gap) / 2);
}
i {
top: calc(50% - 25px);
left: -26px;
position: absolute;
border: 1px solid var(--color-border);
background: var(--color-background);
border-radius: 8px;
width: 50px;
height: 50px;
}
.item:before {
content: ' ';
border-left: 1px solid var(--color-border);
position: absolute;
left: 0;
bottom: calc(50% + 25px);
height: calc(50% - 25px);
}
.item:after {
content: ' ';
border-left: 1px solid var(--color-border);
position: absolute;
left: 0;
top: calc(50% + 25px);
height: calc(50% - 25px);
}
.item:first-of-type:before {
display: none;
}
.item:last-of-type:after {
display: none;
}
}
</style>

@ -1,67 +0,0 @@
<template>
<div class="home-container">
<h1>消息页面</h1>
<!-- 在这里添加你的主页内容 -->
<div class="footer-nav">
<button @click="gotohome()"></button>
<button @click="gotomessage()"></button>
<button @click="gotomine()"></button>
</div>
</div>
</template>
<style scoped>
.home-container {
/* 添加你的样式 */
text-align: center;
padding: 20px;
/* 可能需要为内容添加一些底部空间以容纳底部导航 */
padding-bottom: 50px;
}
.footer-nav {
/* 定义底部导航的样式 */
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
justify-content: space-around;
padding: 10px;
background-color: #f5f5f5; /* 示例背景色 */
}
.footer-nav button {
/* 定义按钮的样式 */
flex: 1;
border: none;
padding: 10px;
background-color: #ccc;
color: #333;
cursor: pointer;
}
.footer-nav button:hover {
/* 按钮点击时的样式 */
background-color: #bbb;
}
</style>
<script>
export default {
name: 'Message',
methods: {
gotohome() {
this.$router.push('/home');
},
gotomessage() {
this.$router.push('/message');
},
gotomine() {
this.$router.push('/mine');
},
}
}
</script>

@ -1,339 +1,45 @@
<template>
<div class="mine">
<h2>个人主页</h2>
<h1>{{ user.name }}</h1>
<!-- <h1>用户姓名</h1>-->
<p>创建时间{{user.createtime}}</p>
<p>账号: {{ username }}</p>
<p>身份证号{{user.IDCard}}</p>
<div v-if="showEmailInput">
<label for="email">邮箱</label>
<input type="email" id="email" v-model="email" class="input-field">
<button @click="updateEmail"></button>
</div>
<div v-else>
<p>邮箱{{ user.email }}</p>
<button @click="toggleEmailInput"></button>
</div>
<div v-if="showPhoneInput">
<label for="PhoneNumber">手机号</label>
<input type="phone" id="phone" v-model="phone" class="input-field">
<button @click="updatePhone"></button>
</div>
<div v-else>
<p>手机号{{ user.phone }}</p>
<button @click="togglePhoneInput"></button>
</div>
<div class="footer-nav">
<button @click="gotohome()"></button>
<button @click="gotomessage()"></button>
<button>我的</button>
</div>
</div>
</template>
<style scoped>
.profile {
max-width: 400px;
margin: 0 auto;
padding: 20px;
}
.input-field {
margin-bottom: 10px;
}
button {
margin-top: 10px;
}
.home-container {
/* 添加你的样式 */
text-align: center;
padding: 20px;
/* 可能需要为内容添加一些底部空间以容纳底部导航 */
padding-bottom: 50px;
}
.footer-nav {
/* 定义底部导航的样式 */
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
justify-content: space-around;
padding: 10px;
background-color: #f5f5f5; /* 示例背景色 */
}
.footer-nav button {
/* 定义按钮的样式 */
flex: 1;
border: none;
padding: 10px;
background-color: #ccc;
color: #333;
cursor: pointer;
}
.footer-nav button:hover {
/* 按钮点击时的样式 */
background-color: #bbb;
}
</style>
<script>
import { ref, onMounted } from 'vue';
// 使AxiosHTTP
import axios from 'axios';
export default {
name: 'Mine',
props: ['username'],
setup(props) {
const user = ref({}); // 使refdata
const email = ref('');
const showEmailInput = ref(false);
const phone = ref('');
const showPhoneInput = ref(false);
// 使onMountedcreated
onMounted(() => {
fetchUser(props.username);
});
// fetchUser使Axios
async function fetchUser(username) {
try {
const response = await axios.get(`/api/users/${username}`);
user.value = response.data; // user
} catch (error) {
console.error('Error fetching user:', error);
}
}
//
function gotohome() {
router.push('/home');
}
function gotomessage() {
router.push('/message');
}
fetchUser(username) {
// API
axios.post(`http://192.168.254.35:8080/user/${username}`)
.then(response => {
this.user = response.data;
})
.catch(error => {
console.error('Error fetching user:', error);
});
},
toggleEmailInput() {
this.showEmailInput = !this.showEmailInput;
this.email = this.user.email;//
},
updateEmail() {
//
axios.put(`http://192.168.254.35:8080/user/${this.username}/email`, { email: this.email })
.then(response => {
alert(this.email);
this.user.email = this.email;
this.toggleEmailInput(); //
})
.catch(error => {
console.error('Error updating email:', error);
});
},
togglePhoneInput(){
this.showPhoneInput = !this.showPhoneInput;
this.phone = this.user.phone;
},
updatePhone(){
axios.put(`http://192.168.254.35:8080/user/${this.username}/phone`, { phone: this.phone })
.then(response => {
this.user.phone = this.phone;
this.togglePhoneInput(); //
})
.catch(error => {
console.error('Error updating phone:', error);
});
}
return {
user,
email,
showEmailInput,
phone,
showPhoneInput,
gotohome,
gotomessage,
};
},
};
</script>
<script setup lang="ts">
import { ref, watchEffect } from 'vue'
import { format } from 'date-fns'
const startDateValue = ref(format(new Date(), 'yyyy-MM-dd'))
const endDateValue = ref(format(new Date(), 'yyyy-MM-dd'))
watchEffect(() => {
console.log('startDateValue:', startDateValue.value)
console.log('endDateValue:', endDateValue.value)
})
</script>
<template>
<div class="mine">
<h2>个人主页</h2>
<h1>{{ user.name }}</h1>
<!-- <h1>用户姓名</h1>-->
<p>创建时间{{user.createtime}}</p>
<p>账号: {{ username }}</p>
<p>身份证号{{user.IDCard}}</p>
<div v-if="showEmailInput">
<label for="email">邮箱</label>
<input type="email" id="email" v-model="email" class="input-field">
<button @click="updateEmail"></button>
</div>
<div v-else>
<p>邮箱{{ user.email }}</p>
<button @click="toggleEmailInput"></button>
</div>
<div v-if="showPhoneInput">
<label for="PhoneNumber">手机号</label>
<input type="phone" id="phone" v-model="phone" class="input-field">
<button @click="updatePhone"></button>
</div>
<div v-else>
<p>手机号{{ user.phone }}</p>
<button @click="togglePhoneInput"></button>
</div>
<div class="footer-nav">
<button @click="gotohome()"></button>
<button @click="gotomessage()"></button>
<button>我的</button>
</div>
</div>
<VueDatePicker
placeholder="请选择预计出发日期"
:min-date="new Date()"
format="yyyy-MM-dd"
v-model="startDateValue" />
<VueDatePicker
placeholder="请选择预计返回日期"
:min-date="new Date()"
format="yyyy-MM-dd"
v-model="endDateValue" />
</template>
<style scoped>
.profile {
max-width: 400px;
margin: 0 auto;
padding: 20px;
}
.input-field {
margin-bottom: 10px;
}
button {
margin-top: 10px;
}
.home-container {
/* 添加你的样式 */
text-align: center;
padding: 20px;
/* 可能需要为内容添加一些底部空间以容纳底部导航 */
padding-bottom: 50px;
}
.footer-nav {
/* 定义底部导航的样式 */
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
justify-content: space-around;
padding: 10px;
background-color: #f5f5f5; /* 示例背景色 */
}
.footer-nav button {
/* 定义按钮的样式 */
flex: 1;
border: none;
padding: 10px;
background-color: #ccc;
color: #333;
cursor: pointer;
}
.footer-nav button:hover {
/* 按钮点击时的样式 */
background-color: #bbb;
}
</style>
<script>
export default {
name: 'Mine',
props: ['username'],
data() {
return {
user: {}, //
email: '',
showEmailInput: false,
phone: '',
showPhoneInput: false,
};
},
created() {
this.fetchUser(this.username);
},
methods: {
gotohome() {
this.$router.push('/home');
},
gotomessage() {
this.$router.push('/message');
},
fetchUser(username) {
// API
axios.post(`http://192.168.254.35:8080/user/${username}`)
.then(response => {
this.user = response.data;
})
.catch(error => {
console.error('Error fetching user:', error);
});
},
toggleEmailInput() {
this.showEmailInput = !this.showEmailInput;
this.email = this.user.email;//
},
updateEmail() {
//
axios.put(`http://192.168.254.35:8080/user/${this.username}/email`, { email: this.email })
.then(response => {
this.user.email = this.email;
this.toggleEmailInput(); //
})
.catch(error => {
console.error('Error updating email:', error);
});
},
togglePhoneInput(){
this.showPhoneInput = !this.showPhoneInput;
this.phone = this.user.phone;
},
updatePhone(){
axios.put(`http://192.168.254.35:8080/user/${this.username}/phone`, { phone: this.phone })
.then(response => {
this.user.phone = this.phone;
this.togglePhoneInput(); //
})
.catch(error => {
console.error('Error updating phone:', error);
});
}
}
}
</script>
<script setup lang="ts">
import { ref, watchEffect } from 'vue'
import { format } from 'date-fns'
const startDateValue = ref(format(new Date(), 'yyyy-MM-dd'))
const endDateValue = ref(format(new Date(), 'yyyy-MM-dd'))
watchEffect(() => {
console.log('startDateValue:', startDateValue.value)
console.log('endDateValue:', endDateValue.value)
})
</script>
<template>
<VueDatePicker
placeholder="请选择预计出发日期"
:min-date="new Date()"
format="yyyy-MM-dd"
v-model="startDateValue" />
<VueDatePicker
placeholder="请选择预计返回日期"
:min-date="new Date()"
format="yyyy-MM-dd"
v-model="endDateValue" />
</template>

@ -0,0 +1,28 @@
<script>
export default {
name: 'return',
methods: {
gotohome() {
this.$router.push('/home');
},
}
}
</script>
<template>
<div class="return">
<button class="return-button" @click="gotohome()"></button>
</div>
</template>
<style>.return-button {
/* 定义返回按钮的样式 */
position: fixed; /* 使按钮位置固定 */
top: 10px;
left: 10px;
margin: 0;
padding: 10px 20px;
border: none;
border-radius: 5px;
background-color: #ccc;
color: #333;
cursor: pointer;
} </style>

@ -0,0 +1,6 @@
export type AreaList = {
code: string;
level: number;
name: string;
areaList: AreaList[];
};

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 KiB

@ -1,9 +1,13 @@
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import ElementPlus from 'element-plus';
import 'element-plus/theme-chalk/index.css';
import VueDatePicker from '@vuepic/vue-datepicker';
import '@vuepic/vue-datepicker/dist/main.css'
const app = createApp(App);
app.use(ElementPlus);
app.use(router);
app.component('VueDatePicker', VueDatePicker);
app.mount('#app');

@ -39,15 +39,15 @@ export default {
try {
await axios.post('http://example.com/messages', {
content: this.newMessage,
sender: 'Me', // Me
sender: 'Me', // You can replace 'Me' with the sender's name
});
this.newMessage = ''; //
// 使 UI
this.newMessage = ''; // Clear the input field after sending
// You might want to fetch messages again here to update the UI with the latest messages
} catch (error) {
console.error('Error sending message:', error);
}
},
// WebSocket
// WebSocket logic to receive messages
setupWebSocket() {
const ws = new WebSocket('ws://example.com/socket');
ws.onmessage = (event) => {
@ -57,8 +57,8 @@ export default {
},
},
created() {
this.fetchMessages(); //
this.setupWebSocket(); // WebSocket
this.fetchMessages(); // Fetch messages when the component is created
this.setupWebSocket(); // Setup WebSocket connection
},
};
</script>
@ -70,7 +70,7 @@ export default {
}
.chat {
border: 2px solid #28a7a3;
border: 2px solid #ccc;
border-radius: 10px;
padding: 20px;
display: flex;
@ -100,7 +100,7 @@ export default {
.input input {
flex: 1;
padding: 8px;
border: 1px solid #003f3f;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
@ -110,7 +110,7 @@ export default {
border: none;
border-radius: 5px;
background-color: #007bff;
color: #a6cfee;
color: #fff;
font-size: 16px;
cursor: pointer;
margin-left: 10px;

@ -4,8 +4,6 @@
<div v-for="task in tasks" :key="task.id" class="task-item">
<div>{{ task.title }}</div>
<div>{{ task.description }}</div>
<div>{{ task.deadline }}</div>
<div>发布者: {{ task.publisher }}</div>
</div>
</div>
</template>
@ -36,7 +34,7 @@ export default {
<style>
.task-item {
border: 1px solid #003f3f;
border: 1px solid #ccc;
padding: 10px;
margin: 10px 0;
}

@ -1,40 +0,0 @@
<template>
<div class="home-container">
<h1>欢迎来到主页</h1>
<!-- 在这里添加你的主页内容 -->
</div>
</template>
<style scoped>
.home-container {
/* 添加你的样式 */
text-align: center;
padding: 20px;
}
</style>
<script>
export default {
name: 'Home'
}
</script>

@ -1,14 +1,17 @@
<template>
<div class="home-container">
<h1>首页</h1>
<div class="return">
<button class="addDemand-button" @click="gotoAddDemandPage()">+</button>
</div>
<h1>首页</h1>
<div class="search-container">
<input type="text" class="search-input" placeholder="世界这么大出去看看吧">
<button class="search-button" @click="gotoSearchPage()"></button>
</div>
<div class="image-container">
<img src="../../photos/background.png" alt="图片描述" class="search-image">
<img src="../data/picture/background.png" alt="图片描述" class="search-image">
</div>
<div class="footer-nav">
@ -67,7 +70,21 @@
/* 搜索按钮点击时的样式 */
background-color: #bbb;
}
.addDemand-button {
/* 定义返回按钮的样式 */
position: fixed; /* 使按钮位置固定 */
top: 10px;
left: 10px;
margin: 0;
padding: 10px 20px;
border: none;
border-radius: 5px;
background-color: #ccc;
color: #333;
cursor: pointer;
}
.footer-nav {
/* 定义底部导航的样式 */
position: fixed;
@ -100,11 +117,8 @@
export default {
name: 'Home',
methods: {
gotohome() {
this.$router.push('/home');
},
gotomessage() {
this.$router.push('/Communication');
this.$router.push('/message');
},
gotomine() {
this.$router.push('/mine');
@ -112,6 +126,9 @@ export default {
gotoSearchPage() {
this.$router.push('/searchPage');
},
gotoAddDemandPage() {
this.$router.push('/addDemandPage');
},
}
}
</script>

@ -1,9 +1,9 @@
<template>
<div class="login-container">
<h1>登录页面</h1>
<h1>登录</h1>
<form @submit.prevent="login" class="login-form">
<label for="username">用户名</label>
<input type="text" id="username" v-model="username" class="input-field">
<label for="phone">手机号</label>
<input type="text" id="phone" v-model="phone" class="input-field">
<br>
<label for="password">密码</label>
<input type="password" id="password" v-model="password" class="input-field">
@ -53,21 +53,21 @@
import { login } from '../api/auth'
import axios from "axios";
export default {
export default {
data() {
return {
username: '',
phone: '',
password: ''
}
},
methods: {
login() {
console.log("用户名:", this.username);
console.log("手机号:", this.phone);
console.log("密码:", this.password);
axios.post('http://192.168.254.35:8080/Login/login', {
axios.post('http://106.52.218.118:12607/Login/login', {
//
username: this.username,
phone: this.phone,
password: this.password
}, {
// cookie
@ -77,9 +77,9 @@ export default {
'Content-Type': 'application/json'
}
})
.then(response => {
// status
.then(response => {
if (response.data == 1) {
sessionStorage.setItem('phone', this.phone);
//
this.$router.push('/home');
}

@ -1,14 +1,26 @@
<template>
<div class="register-container">
<h1>注册页面</h1>
<h1>注册</h1>
<form @submit.prevent="register" class="register-form">
<label for="username">用户名</label>
<input type="text" id="username" v-model="username" class="input-field">
<label for="phone">手机号</label>
<input type="phone" id="phone" v-model="phone" class="input-field">
<br>
<label for="password">密码</label>
<input type="password" id="password" v-model="password" class="input-field">
<br>
<br>
<label for="name">姓名</label>
<input type="name" id="name" v-model="name" class="input-field">
<br>
<label for="IDcard">身份证号</label>
<input type="IDcard" id="IDcard" v-model="IDcard" class="input-field">
<br>
<label for="nickname">昵称</label>
<input type="nickname" id="nickname" v-model="nickname" class="input-field">
<br>
<button type="submit" class="submit-button">注册</button>
<button class="return-button" @click="gotoLogin()"></button>
</form>
@ -57,19 +69,28 @@ import axios from "axios";
export default {
data() {
return {
username: '',
password: ''
phone: '',
password: '',
name:'',
nickname:'',
IDcard:''
}
},
methods: {
register() {
console.log("用户名:", this.username);
console.log("", this.phone);
console.log("密码:", this.password);
axios.post('http://192.168.254.35:8080/Login/register', {
console.log("姓名:",this.name);
console.log("身份证号:",this.IDcard);
console.log("昵称:",this.nickname);
axios.post('http://106.52.218.118:12607/Login/register', {
//
username: this.username,
password: this.password
phone: this.phone,
password: this.password,
name:this.name,
IDCard:this.IDcard,
nickname:this.nickname
}, {
// cookie
withCredentials: true,
@ -81,12 +102,12 @@ export default {
.then(response => {
console.log(response.data)
//
alert(response.data);
alert("注册成功");
})
.catch(error => {
console.error(error)
//
alert(response.data);
alert("已注册");
})
},
gotoLogin(){

@ -0,0 +1,114 @@
<script lang="ts" setup>
import { ref, onBeforeMount, watch, watchEffect } from 'vue'
import axios from 'axios'
import { ElSelect, ElOption } from 'element-plus'
import { AreaList } from '../components/types'
import { format, addDays } from 'date-fns'
import Return from '../components/return.vue'
const province = ref('')
const city = ref('')
const area = ref('')
const remark = ref('')
const provinceList = ref<AreaList[]>([])
const cityList = ref<AreaList[]>([])
const areaList = ref<AreaList[]>([])
const rangeValue = ref<string[]>([format(new Date(), 'yyyy-MM-dd'), format(addDays(new Date(), 1), 'yyyy-MM-dd')])
// JSON
const getProvinceList = async () => {
const res = await axios.get<AreaList[]>('https://yjy-oss-files.oss-cn-zhangjiakou.aliyuncs.com/tuxian/area.json')
provinceList.value = res.data
console.log(provinceList.value)
}
const publish = () => {
//
if(city.value!=''){
axios.post(`http://106.52.218.118:12607/users/pupdate`,{city:city.value,time:rangeValue.value,remark:remark.value})
.then(response => {
alert("发布成功")
})
.catch(error => {
console.error('发布失败', error);
});}
else{
alert("请输入目的地")
}
};
onBeforeMount(async()=>{
getProvinceList()
})
watchEffect(() => {
console.log('rangeValue:', rangeValue.value)
})
//
watch(province, (newValue, oldValue) => {
const matchedProvince = provinceList.value.find(item => item.name === newValue)
if (matchedProvince) {
cityList.value = matchedProvince.areaList
city.value = '' //
areaList.value = [] //
console.log(cityList.value)
}
})
//
watch(city, (newValue, oldValue) => {
const matchedCity = cityList.value.find(item => item.name === newValue)
if (matchedCity) {
areaList.value = matchedCity.areaList
area.value = '' //
console.log(areaList.value)
}
})
</script>
<template>
<div>
<Return></Return>
</div>
<div><h2>发布需求</h2></div>
<div class="addDemand-container">
<div style="display: flex;">
<p style="color: red;">*</p>
<el-select v-model="province" clearable placeholder="省份">
<el-option v-for="item in provinceList" :key="item.code" :label="item.name" :value="item.name" />
</el-select>
<el-select v-model="city" clearable placeholder="城市">
<el-option v-for="item in cityList" :key="item.code" :label="item.name" :value="item.name" />
</el-select>
<!--<el-select v-model="area" clearable placeholder="Select">
<el-option v-for="item in areaList" :key="item.code" :label="item.name" :value="item.name" />
</el-select>-->
</div>
<div>
<VueDatePicker
placeholder="请选择出行时间"
range
:min-date="new Date()"
format="yyyy-MM-dd"
:width="280"
v-model="rangeValue" />
</div>
<div>
<label for="user-input">备注信息:</label>
<input type="text" id="remark" v-model="remark" placeholder="">
</div>
<el-button type="primary" @click="publish"></el-button>
</div>
</template>
<style>
.addDemand-container {
max-width: 400px;
margin: 0 auto;
padding: 30px;
border: 1px solid #00ff00;
border-radius: 5px;
text-align: center;
}
</style>

@ -12,9 +12,6 @@
<button @click="toggleNicknameInput"></button>
</div>
<h1>{{ user.name }}</h1>
<p>身份证号{{user.IDCard}}</p>
<div v-if="showEmailInput">
<label for="email">邮箱</label>
@ -100,8 +97,8 @@ button {
<script>
import axios from 'axios';
export default {
props: ['phone'],
data() {
return {
user: {},
@ -109,23 +106,24 @@ export default {
showNicknameInput: false,
email: '',
showEmailInput: false,
phone: '',
phone:sessionStorage.getItem('phone') || '',
showPhoneInput: false,
IDCard: '',
createtime: '',
status: 0,
};
},
/*computed: {
...mapGetters(['getPhone'])
},*/
created() {
//
this.fetchUser(this.phone);
},
methods: {
fetchUser(phone) {
// API
axios.get(`http://192.168.254.35:8080/users/getByPhone?phone=15616168609`)
axios.get(`http://106.52.218.118:12607/users/getByPhone?phone=${phone}`)
.then(response => {
alert(response.data);
this.user = response.data;
})
.catch(error => {
@ -138,7 +136,8 @@ export default {
this.nickname = this.user.nickname;
},
updateNickname(){
axios.get(`http://192.168.254.35:8080/users/getByPhone?phone=15616168609`, { nickname: this.nickname })
this.user.nickname = this.nickname;
axios.post(`http://106.52.218.118:12607/users/pupdate`,{user:this.user})
.then(response => {
this.user.nickname = this.nickname;
this.toggleNicknameInput(); //
@ -153,7 +152,8 @@ export default {
},
updateEmail() {
//
axios.get(`http://192.168.254.35:8080/users/getByPhone?phone=15616168609`, { email: this.email })
this.user.email = this.email;
axios.post(`http://106.52.218.118:12607/users/pupdate`,{user:this.user})
.then(response => {
this.user.email = this.email;
this.toggleEmailInput(); //
@ -167,9 +167,10 @@ export default {
this.phone = this.user.phone;
},
updatePhone(){
axios.get(`http://192.168.254.35:8080/users/getByPhone?phone=15616168609`, { phone: this.phone })
this.user.phone = this.phone;
axios.post(`http://106.52.218.118:12607/users/pupdate`,{user:this.user})
.then(response => {
alert(this.phone);
sessionStorage.setItem('phone', this.phone);
this.user.phone = this.phone;
this.togglePhoneInput(); //
})

@ -1,16 +1,23 @@
<script>
import Return from '../components/return.vue'
export default {
name: 'SearchPage',
components: {
Return
},
}
</script>
<template>
<div class="home-container">
<div class="return">
<button class="return-button" @click="gotohome()"></button>
</div>
<div>
<Return></Return>
</div>
<div class="search-container">
<input type="text" class="search-input" placeholder="世界这么大出去看看吧">
<button class="search-button" @click="search"></button>
</div>
</div>
</div>
</template>
<style scoped>
@ -49,20 +56,6 @@
background-color: #bbb;
}
.return-button {
/* 定义返回按钮的样式 */
position: fixed; /* 使按钮位置固定 */
top: 10px;
left: 10px;
margin: 0;
padding: 10px 20px;
border: none;
border-radius: 5px;
background-color: #ccc;
color: #333;
cursor: pointer;
}
.footer-nav button {
/* 定义按钮的样式 */
flex: 1;
@ -79,16 +72,3 @@
}
</style>
<script>
export default {
name: 'SearchPage',
methods: {
gotohome() {
this.$router.push('/home');
},
search() {
this.$router.push('/DemandList');
}
}
}
</script>

@ -1,30 +1,23 @@
import { createWebHistory, createRouter } from 'vue-router';
import Login from '../components/Login.vue';
import Register from '../components/Register.vue';
import Home from '../components/HomePage.vue';
import Message from '../components/message.vue';
import Mine from '../components/mine.vue';
import SearchPage from '../components/searchPage.vue';
import Communication from "@/components/Communication.vue";
import DemandList from "@/components/DemandList.vue";
import Evaluation from "@/components/Evaluation.vue";
import Pay from "@/components/Pay.vue";
import SecurityVerification from "@/components/SecurityVerification.vue";
import Login from '../pages/Login.vue';
import Register from '../pages/Register.vue';
import Home from '../pages/HomePage.vue';
import Mine from '../pages/mine.vue';
import SearchPage from '../pages/searchPage.vue';
import AddDemand from '../pages/addDemand.vue';
import Test from '../pages/test.vue'
import Communication from '../pages/Communication.vue'
const routes = [
{ path: '/', redirect: '/login' }, // 重定向到/login路径
{ path: '/login', component: Login },
{ path: '/register', component: Register },
{ path: '/home', component: Home },
{ path: '/message', component: Message },
{ path: '/mine', component: Mine },
{ path: '/searchPage', component: SearchPage },
{ path: '/Communication', component: Communication },
{ path: '/searchPage', component: SearchPage},
{ path: '/DemandList', component:DemandList},
{ path: '/Evaluation', component:Evaluation},
{ path: '/Pay', component:Pay},
{ path: '/SecurityVerification', component:SecurityVerification}
{ path: '/addDemandPage', component: AddDemand },
{ path: '/test', component: Test },
{ path: '/message', component: Communication },
];
const router = createRouter({

Loading…
Cancel
Save