Skip to content

Commit

Permalink
Merge pull request #9 from xixiIBN5100/main
Browse files Browse the repository at this point in the history
pref(ban): ban choosing campus
  • Loading branch information
xixiIBN5100 authored Nov 4, 2024
2 parents c235fd2 + 68cce20 commit e4225bc
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/components/team/UpdateTeam.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ function goBack() {

<n-form-item label="路线选择" path="route">
<n-select
disabled
v-model:value="formValue.route"
placeholder="请选择路线"
:options="routeOptions"
Expand Down
64 changes: 60 additions & 4 deletions src/components/team/show/MemberCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<script setup lang="ts">
import { computed } from '@vue/reactivity';
import { NTable, NTag, NSpace, NCard } from 'naive-ui';
import { NTable, NTag, NSpace, NCard, NButton, useMessage, useDialog } from 'naive-ui'
import Config from '../../../config/server'
import axios, { AxiosResponse } from 'axios'
import { useRouter } from 'vue-router'
const message = useMessage()
const router = useRouter()
const dialog = useDialog()
const userData = JSON.parse(<string>localStorage.getItem("user_data"))
console.log(userData["status"])
const props = defineProps({
name: String,
isLeader: Boolean,
Expand All @@ -9,10 +17,52 @@ const props = defineProps({
walkStatus: Number,
campus: Number,
wechat: String,
type: Number
type: Number,
openid: String
});
function refresh() {
if (localStorage.getItem('canLoadInfo') == null || localStorage.getItem('canLoadInfo') == 'yes') {
localStorage.setItem('canLoadInfo', 'no')
router.push('/loading')
setTimeout(() => {
localStorage.setItem('canLoadInfo', 'yes')
}, 1000)
} else {
message.warning('让生产队的驴休息一下吧')
}
}
const handleClick = () => {
dialog.warning({
title: '警告',
content: '你确定要转移队长?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: () => {
transferCaptain()
},
onNegativeClick: () => {},
})
}
const transferCaptain = () => {
const transferCaptainUrl = Config.urlPrefix + Config.apiMap['team']['transferCaptain']
axios.post(transferCaptainUrl, { open_id: props.openid }, {
headers: {
Authorization: 'Bearer ' + localStorage.getItem('jwt'),
},
timeout: 3000,
}).then(function (response: AxiosResponse) {
const respData: any = response.data
if (respData['code'] == 200) {
message.success('移交成功')
refresh()
} else {
message.error(respData['msg'])
}
})
.catch(function (error) {
message.error('请检查你的网络连接')
})
}
const qqStr = computed(() => {
const qqStr = props.qq;
if (qqStr == '') return '';
Expand Down Expand Up @@ -107,5 +157,11 @@ const campusName = computed(() => {
</tr>
</tbody>
</n-table>
<n-button
style="width: 100%; margin: 10px auto auto;"
type="warning"
v-if='!props.isLeader && userData["status"] === 2'
@click='handleClick'
>移交队长</n-button>
</n-card>
</template>
3 changes: 2 additions & 1 deletion src/components/team/show/MemberInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const router = useRouter()
// 展示用的数据
const teamData = ref(getTeamData())
console.log(teamData)
// 是否是队长
const isLeader = computed(() => {
Expand Down Expand Up @@ -77,6 +77,7 @@ const teamName = computed(() => {
:walk-status="member['walk_status']"
:is-leader="false"
:type="member['type']"
:openid = "member['open_id']"
></member-card>
</n-card>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/team/show/TeamInfoButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function submitTeam() {
disabled.value = true
setTimeout(() => {
disabled.value = false
}, 3000)
}, 1000)
const submitTeamUrl = ServerConfig.urlPrefix + ServerConfig.apiMap['team']['submit']
axios
Expand Down
7 changes: 5 additions & 2 deletions src/components/user/register/RegisterAlumniInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const rules = ref({
validator(rule: any, value: any) {
if (!value) {
return new Error('请输入电话号码');
} else if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(value)) {
} else if (!/^1([3456789])\d{9}$/.test(value)) {
return new Error('手机号格式不正确');
}
return true;
Expand Down Expand Up @@ -113,6 +113,9 @@ function submit() {
ref="formRef"
style="margin: 10px auto 0"
>
<n-form-item style='margin-top: -30px'>
<n-text style='color: gray'>以报名时所提交信息为准,可能由于报名时信息填写有误导致无法登录,如有问题联系吴同学,微信号:hrw654789</n-text>
</n-form-item>
<n-form-item label="姓名" path="name">
<n-input placeholder="请输入姓名" v-model:value="formValue.name" />
</n-form-item>
Expand All @@ -123,7 +126,7 @@ function submit() {
v-model:value="formValue.id"
/>
</n-form-item>
<n-form-item label="电话号码" path="contact.tel">
<n-form-item label="电话号码" path="tel">
<n-input
placeholder="请输入电话号码"
v-model:value="formValue.tel"
Expand Down
2 changes: 1 addition & 1 deletion src/components/user/register/RegisterStudentInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function submit() {
.then(function (response: AxiosResponse) {
const responseData: any = response.data;
if (responseData['code'] == 200) {
message.success('注册成功,中午12点队长开始抢名额');
message.success('注册成功!');
setTimeout(() => router.push('/loading'), 1000); // 跳转到加载信息页面
} else {
message.error(responseData['msg']); // 报错信息
Expand Down
11 changes: 5 additions & 6 deletions src/pages/Register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,15 @@ function onPositiveClick() {

<n-card title="报名信息 &nbsp; 💻" style="margin: 4% auto; width: 93%">
<n-tabs default-value="student">
<n-tab-pane name="student" tab="学生报名">
<n-tab-pane name="student" tab="学生注册">
<register-student-info></register-student-info>
</n-tab-pane>
<n-tab-pane name="teacher" tab="教职工报名">
<n-tab-pane name="teacher" tab="教职工注册">
<register-teacher-info></register-teacher-info>
</n-tab-pane>
<!-- <n-tab-pane name="alumni" tab="校友登录" >-->
<!-- <register-alumni-info></register-alumni-info>-->
<!-- </n-tab-pane>-->

<n-tab-pane name="alumni" tab="登录" >
<register-alumni-info></register-alumni-info>
</n-tab-pane>
</n-tabs>
</n-card>
</n-message-provider>
Expand Down

0 comments on commit e4225bc

Please sign in to comment.