diff --git a/src/app.config.ts b/src/app.config.ts index 65f0f17..8dac34c 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -11,6 +11,7 @@ export default defineAppConfig({ 'pages/TicketDetail/TicketDetail', 'pages/TicketList/TicketList', 'pages/AskLeave/AskLeave', + 'pages/Conclusion/Conclusion', 'pages/404/404', ], window: { diff --git a/src/pages/Conclusion/Conclusion.config.ts b/src/pages/Conclusion/Conclusion.config.ts new file mode 100644 index 0000000..a9ca517 --- /dev/null +++ b/src/pages/Conclusion/Conclusion.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + usingComponents: {}, +}); diff --git a/src/pages/Conclusion/Conclusion.scss b/src/pages/Conclusion/Conclusion.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/Conclusion/Conclusion.tsx b/src/pages/Conclusion/Conclusion.tsx new file mode 100644 index 0000000..498d8fc --- /dev/null +++ b/src/pages/Conclusion/Conclusion.tsx @@ -0,0 +1,190 @@ +import { + AtTextarea, + AtButton, + AtForm, + AtMessage, + AtInput, + AtList, + AtListItem, + AtModal, +} from 'taro-ui'; +import { Component, ReactNode } from 'react'; +import Taro from '@tarojs/taro'; +import pt from '@/plain-text'; +import { Picker, View } from '@tarojs/components'; +import { askLeave } from '@/service/askleave'; +import './Conclusion.scss'; + +const submitInterval = 5000; + +export default class ConclusionPage extends Component { + state = { + isLoading: false, + isDisable: false, + showModal: false, + range: [ + ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], + ['第一班', '第二班', '第三班'], + ], + shift: [0, 0], + reason: '', + substitute: '', + }; + + componentDidMount(): void { + Taro.setNavigationBarTitle({ + title: pt.get().navBar.askLeave, + }); + } + + onShiftSelect(event) { + this.setState({ + shift: event.detail.value, + }); + console.log(event); + } + + onModalClose() { + this.setState({ + showModal: false, + }); + setTimeout(() => { + this.setState({ + isDisable: false, + }); + }, submitInterval); + } + + onModalCancel() { + this.setState({ + showModal: false, + }); + setTimeout(() => { + this.setState({ + isDisable: false, + }); + }, submitInterval); + } + + onModalConfirm() { + this.setState({ + showModal: false, + }); + askLeave(this); + setTimeout(() => { + this.setState({ + isDisable: false, + }); + }, submitInterval); + } + + handleReasonChange(reason: string) { + this.setState({ + reason, + }); + } + + handleSubstituteChange(substitute: string) { + this.setState({ + substitute, + }); + } + + onSubmit() { + this.setState({ + isDisable: true, + }); + if (this.state.reason == '') { + Taro.atMessage({ + message: pt.get().button.submitText.blank, + type: 'error', + }); + setTimeout(() => { + this.setState({ + isDisable: false, + }); + }, submitInterval); + return; + } + if (this.state.substitute == '') { + this.setState({ + showModal: true, + }); + return; + } + askLeave(this); + setTimeout(() => { + this.setState({ + isDisable: false, + }); + }, submitInterval); + } + render(): ReactNode { + return ( + + + + + + + + + + + + + {pt.get().askLeave.reason.title} + + + + + + + {pt.get().button.buttonText.submit} + + + + + ); + } +} diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 68c870d..e93da39 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -153,6 +153,12 @@ export default class MainPage extends Component<{}, MainPageState> { }); } + conclusionPage() { + Taro.navigateTo({ + url: '/pages/Conclusion/Conclusion', + }); + } + render(): ReactNode { const mainPage = pt.get().mainPage; const memberPage = pt.get().memberPage; @@ -185,44 +191,51 @@ export default class MainPage extends Component<{}, MainPageState> { - - {pt.get().memberPage.dutyCount.text} - + - - - - - {pt.get().memberPage.dutyCount.button} + {pt.get().memberPage.dutyCount.text} + + + + + + + {pt.get().memberPage.dutyCount.button} + + + + + + {pt.get().button.indexText.conclusion} diff --git a/src/plain-text/Button.ts b/src/plain-text/Button.ts index 37d3fe0..ff6ef02 100644 --- a/src/plain-text/Button.ts +++ b/src/plain-text/Button.ts @@ -13,6 +13,10 @@ export interface ButtonText { memberText: { auth: string; }; + indexText: { + conclusion: string; + askLeave: string; + }; loginText: { success: string; error: string; @@ -39,6 +43,10 @@ export const buttonZhCn: ButtonText = { memberText: { auth: '协会统一身份认证登录', }, + indexText: { + conclusion: '提交值班总结', + askLeave: '我要请假', + }, loginText: { success: '登录成功', error: '登录失败', @@ -65,6 +73,10 @@ export const buttonEnUs: ButtonText = { memberText: { auth: 'EVA Auth Login Entry', }, + indexText: { + conclusion: 'Submit Duty Conclusion', + askLeave: 'Ask for Leave', + }, loginText: { success: 'Login Success', error: 'Login Failed', diff --git a/src/plain-text/MainPage.ts b/src/plain-text/MainPage.ts index f2f864f..e04d8fd 100644 --- a/src/plain-text/MainPage.ts +++ b/src/plain-text/MainPage.ts @@ -4,6 +4,7 @@ export interface MainPageText { reason: string; }; askLeave: string; + conclusion: string; titleLine: { main: string; sub: string; @@ -50,6 +51,7 @@ export const mainPageZhCn: MainPageText = { reason: '正常下班', }, askLeave: '我要请假', + conclusion: '提交值班总结', titleLine: { main: '您好,这里是E志者协会', sub: '维修请至【东三-204】实验室', @@ -120,6 +122,7 @@ export const mainPageEnUs: MainPageText = { reason: 'Normal shift', }, askLeave: 'Ask for leave', + conclusion: 'Submit Duty Conclusion', titleLine: { main: 'Hi! This is EVA.', sub: 'For maintenance, please go to [204 Lab, E3 building]', diff --git a/src/plain-text/NavBarTitle.ts b/src/plain-text/NavBarTitle.ts index 02acb47..044b905 100644 --- a/src/plain-text/NavBarTitle.ts +++ b/src/plain-text/NavBarTitle.ts @@ -3,6 +3,7 @@ export interface NavBarTitle { ticketDetail: string; ticketList: string; askLeave: string; + conclusion: string; user: { myTicket: string; report: string; @@ -18,6 +19,7 @@ export const navBarTitleZhCn: NavBarTitle = { ticketDetail: '工单详情', ticketList: '所有工单', askLeave: '请假单填写', + conclusion: '值班总结', user: { myTicket: '我的工单', report: '意见反馈', @@ -33,6 +35,7 @@ export const navBarTitleEnUs: NavBarTitle = { ticketDetail: 'Ticket Detail', ticketList: 'All Tickets', askLeave: 'Ask for leave', + conclusion: 'Duty Conclusion', user: { myTicket: 'My Tickets', report: 'Report',