Skip to content

Commit

Permalink
更新了acm报名入口
Browse files Browse the repository at this point in the history
  • Loading branch information
FinleyGe committed Jul 28, 2022
1 parent 73a41ed commit dadcd49
Show file tree
Hide file tree
Showing 13 changed files with 241 additions and 48 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"changwu",
"echarts",
"haibao",
"IACM",
"jishu",
"jiyu",
"mishuchu",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "join-us-vue",
"private": true,
"version": "2.5.0",
"version": "2.5.1",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
Expand Down
33 changes: 33 additions & 0 deletions src/apis/acm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { IACMUser } from "../types/acm";
import { request_acm } from "../utils/request";

export const registerUser = async (data: IACMUser) => {
const res = await request_acm({
url: '/I_LOVE_ZJUT_I_LOVE_JH/',
method: 'GET',
params: {
data: {
type: 'upload',
data: [data.name, data.phone, data.stu_id, data.email],
code: data.code,
},
}
})
return res;
}

export const getCaptcha = async (data: IACMUser) => {

const res = await request_acm({
url: '/I_LOVE_ZJUT_I_LOVE_JH/',
method: 'GET',
params: {
data: {
type: 'ask',
data: [data.name, data.phone, data.stu_id, data.email]
}
}
})
console.log(res)
return res;
}
4 changes: 2 additions & 2 deletions src/components/JHButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const prop = defineProps<{
.button-small {
width: fit-content;
padding-inline: 24px;
height: 60px;
height: 30px;
margin: auto;
border-radius: 20px;
background-color: #d20001;
Expand Down Expand Up @@ -56,7 +56,7 @@ const prop = defineProps<{
margin: auto;
background-color: #999999;
border-radius: 30px;
font-size: x-large;
font-size: large;
color: white;
display: flex;
justify-content: center;
Expand Down
20 changes: 9 additions & 11 deletions src/components/JHInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,21 @@ const props = withDefaults(defineProps<Props>(), {
.base.normal {
display: grid;
grid-template-columns: 20% 80%;
grid-template-rows: 70% 30%;
grid-column-gap: 10%;
height: 55px;
}
.label.normal {
background-color: #d20001;
height: 30px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 1vw;
/* width: 8vw; */
font-size: 20px;
margin: auto;
width: 80%;
}
.input.normal {
Expand Down Expand Up @@ -80,9 +79,8 @@ const props = withDefaults(defineProps<Props>(), {
.notice.mob,
.notice.normal {
color: red;
font-size: 0.5vw;
font-size: 12px;
text-align: start;
padding: 5px;
}
.notice.mob.valid,
.notice.normal.valid {
Expand All @@ -91,13 +89,13 @@ const props = withDefaults(defineProps<Props>(), {
.base.mob {
display: grid;
height: 50px;
grid-template-columns: 40% 60%;
grid-template-rows: 70% 30%;
grid-column-gap: 3%;
grid-column-gap: 20px;
}
.label.mob {
background-color: #d20001;
height: 100%;
height: 24px;
border-radius: 5px;
display: flex;
align-items: center;
Expand All @@ -109,7 +107,7 @@ const props = withDefaults(defineProps<Props>(), {
}
.input.mob {
width: 90%;
height: 100%;
height: 24px;
border-radius: 5px;
text-align: left;
box-sizing: border-box;
Expand Down
64 changes: 36 additions & 28 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,38 +86,46 @@ const routes = [
navbar: () => import('../components/NavBar.vue'),
}
},
{
path: '/join/recruit',
name: 'join/recruit',
components: {
default: () => import('../views/join/recruit.vue'),
navbar: () => import('../components/NavBar.vue'),
}
},
{
path: '/join/long',
name: 'join/long',
// {
// path: '/join/recruit',
// name: 'join/recruit',
// components: {
// default: () => import('../views/join/recruit.vue'),
// navbar: () => import('../components/NavBar.vue'),
// }
// },
// {
// path: '/join/long',
// name: 'join/long',
// components: {
// default: () => import('../views/join/recruitLong.vue'),
// navbar: () => import('../components/NavBar.vue'),
// },
// },
// {
// path: '/join/develop',
// name: 'join/develop',
// components: {
// default: () => import('../views/join/recruitDevelop.vue'),
// navbar: () => import('../components/NavBar.vue'),
// },
// },
// {
// path: '/admin',
// name: 'admin',
// components: {
// default: () => import('../views/admin.vue'),
// navbar: () => import('../components/NavBarAdmin.vue'),
// },
// },
{
path: '/join/acm',
name: 'join/acm',
components: {
default: () => import('../views/join/recruitLong.vue'),
default: () => import('../views/join/acm.vue'),
navbar: () => import('../components/NavBar.vue'),
},
},
{
path: '/join/develop',
name: 'join/develop',
components: {
default: () => import('../views/join/recruitDevelop.vue'),
navbar: () => import('../components/NavBar.vue'),
},
},
{
path: '/admin',
name: 'admin',
components: {
default: () => import('../views/admin.vue'),
navbar: () => import('../components/NavBarAdmin.vue'),
},
},
{
path: '/:pathMatch(.*)*',
redirect: '/index'
Expand Down
7 changes: 7 additions & 0 deletions src/types/acm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface IACMUser {
name: string;
phone: string;
stu_id: string;
email: string;
code: string;
}
5 changes: 3 additions & 2 deletions src/utils/const.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export var ENV = 'dev';
// dev 开发模式
// pro 生产模式
export const BASE_URL = 'http://localhost:8888/'
// export const BASE_URL = 'http://101.34.27.200:8888/'
// export const BASE_URL = 'http://localhost:8888/'
export const BASE_URL = 'http://101.34.27.200:8888/'
export const ACM_BASE_URL = 'http://zhangjinhong.top:8081'
export const regions = ["朝晖", "屏峰", "莫干山"];
export const choices = [
["办公室", "活动部",
Expand Down
23 changes: 19 additions & 4 deletions src/utils/request.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import axios, { AxiosRequestConfig } from 'axios';
import { ResponseType } from '../types/apis'
import { BASE_URL, ENV } from './const';
import { ACM_BASE_URL, BASE_URL, ENV } from './const';
const instance = axios.create({
// baseURL: (ENV == 'dev' ? 'http://127.0.0.1:8888/' : 'http://101.34.27.200:8888')
// baseURL: 'http://101.34.27.200:8888/'
baseURL: BASE_URL
})

const request = async <T = any>(config: AxiosRequestConfig): Promise<ResponseType<T>> => {
try {
const { data } = await instance.request<ResponseType<T>>(config)
console.log(data)
// console.log(data)
return data
} catch (err: any) {
const message = err.message || '请求失败'
Expand All @@ -23,4 +21,21 @@ const request = async <T = any>(config: AxiosRequestConfig): Promise<ResponseTyp
}
}

const instance_acm = axios.create({
baseURL: ACM_BASE_URL
});

export const request_acm = async (config: AxiosRequestConfig): Promise<string | undefined> => {
try {
const data = await instance_acm.request<string>(config)
console.log(data)
return data.data
} catch (err: any) {
const message = err.message || '请求失败'
console.error(message)
// alert(message)
return message
}

}
export default request
5 changes: 5 additions & 0 deletions src/utils/valid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ export function isPhone(phone: string): boolean {
export function isStuId(id: string): boolean {
var reg = /[0-9]{12}/;
return reg.test(id);
}

export function isID(id: string): boolean {
var reg = /[0-9]{17}[0-9|x|X]{1}/;
return reg.test(id);
}
4 changes: 4 additions & 0 deletions src/views/join.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ function toLong() {
/>
<div class="detail-base" :class="pageStore.pageType">
<div class="btn">
<JHButton type="middle" @click="router.push('/join/acm')">
ACM新生赛
</JHButton>
(点击报名)
<JHButton type="middle-disabled" @click="toRecruit"
>招新季报名</JHButton
>
Expand Down
Loading

0 comments on commit dadcd49

Please sign in to comment.