Compare commits

..

No commits in common. 'e30939afa44679cc8d0fa224440d87f853024a7f' and '44e961658b57378cdb3dfc6d1dc993cb19e900f3' have entirely different histories.

@ -16,7 +16,7 @@
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="backend" options="-parameters" />
<module name="backend" options="" />
<module name="backendtest (1) (org.example)" options="-parameters" />
</option>
</component>

@ -1,103 +0,0 @@
package com.backend.controller;
import com.backend.pojo.Express;
import com.backend.pojo.Result;
import com.backend.service.ExpressService;
import jakarta.validation.constraints.Pattern;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@RestController
@RequestMapping("/express")
@Validated
public class ExpressController {
@Autowired
private ExpressService expressService;
@Autowired
private StringRedisTemplate stringRedisTemplate;
@PostMapping("/addexpress")
public Result<Express> addexpress(
@Pattern(regexp = "^[A-Za-z0-9]{10,20}$") final String expressid, // 快递ID长度10-20字符字母或数字
@Pattern(regexp = "^\\S{2,30}$") final String sename, // 发件人姓名长度2-30字符不能有空白
@Pattern(regexp = "^[0-9]{11}$") final String sephone, // 发件人电话11位数字
@Pattern(regexp = "^\\S{5,100}$") final String seaddress, // 发件人地址长度5-100字符
@Pattern(regexp = "^\\S{2,30}$") final String rename, // 收件人姓名长度2-30字符不能有空白
@Pattern(regexp = "^[0-9]{11}$") final String rephone, // 收件人电话11位数字
@Pattern(regexp = "^\\S{5,100}$") final String readdress, // 收件人地址长度5-100字符
@Pattern(regexp = "^[0-1]$") final Integer issign, // 是否签收0或1
@Pattern(regexp = "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$") final Date signtime // 签收时间格式yyyy-MM-dd HH:mm:ss
) {
final Express existexpress = expressService.findExpressById(expressid);
if (existexpress== null) {
expressService.insert(expressid, sename, sephone, seaddress, rename, rephone, readdress, issign, signtime);
return Result.success();
} else {
return Result.error("该快递单号已存在");
}
}
@PostMapping("/updateexpress")
public Result<Express> updateExpress(
@Pattern(regexp = "^[A-Za-z0-9]{10,20}$") final String expressid, // 快递ID长度10-20字符字母或数字
@Pattern(regexp = "^\\S{2,30}$") final String sename, // 发件人姓名长度2-30字符不能有空白
@Pattern(regexp = "^[0-9]{11}$") final String sephone, // 发件人电话11位数字
@Pattern(regexp = "^\\S{5,100}$") final String seaddress, // 发件人地址长度5-100字符
@Pattern(regexp = "^\\S{2,30}$") final String rename, // 收件人姓名长度2-30字符不能有空白
@Pattern(regexp = "^[0-9]{11}$") final String rephone, // 收件人电话10位数字
@Pattern(regexp = "^\\S{5,100}$") final String readdress, // 收件人地址长度5-100字符
@Pattern(regexp = "^[0-1]$") final Integer issign, // 是否签收0或1
@Pattern(regexp = "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$") final Date signtime // 签收时间格式yyyy-MM-dd HH:mm:ss
) {
Express express = new Express();
express.setExpressid(expressid);
express.setSename(sename);
express.setSephone(sephone);
express.setSeaddress(seaddress);
express.setRename(rename);
express.setRephone(rephone);
express.setReaddress(readdress);
express.setIssigned(issign);
express.setSigntime(signtime);
expressService.update(express);
return Result.success(express);
}
@PostMapping("/deleteexpress")
public Result<Express> deleteExpress(
@Pattern(regexp = "^[A-Za-z0-9]{10,20}$") final String expressid
) {
final Express express = expressService.findExpressById(expressid);
if(express!= null){
expressService.delete(express);
return Result.success();
} else {
return Result.error("快递单号为空或者不存在");
}
}
@PostMapping("/getexpress")
public Result<Express> getExpress(
@Pattern(regexp = "^[A-Za-z0-9]{10,20}$") final String expressid
) {
final Express express = expressService.findExpressById(expressid);
if(express != null){
return Result.success(express);
} else {
return Result.error("快递单号为空或者不存在");
}
}
}

@ -1,28 +0,0 @@
package com.backend.mapper;
import com.backend.pojo.Express;
import org.apache.ibatis.annotations.*;
import java.util.Date;
@Mapper
public interface ExpressMapper {
@Select("SELECT * FROM express_info WHERE expressid = #{expressid}")
Express findExpressById(String expressid);
@Insert("INSERT INTO express_info(expressid, sename, sephone, seaddress, rename, rephone, readdress, issign, signtime) " +
"VALUES(#{expressid}, #{sename}, #{sephone}, #{seaddress}, #{rename}, #{rephone}, #{readdress}, #{issign} , #{signtime})")
void add(final String expressid, final String sename, final String sephone,
final String seaddress, final String rename, final String rephone,
final String readdress, final Integer isSign, final Date signtime);
@Update("UPDATE express_info SET expressid = #{expressid}, sename = #{sename}," +
" seaddress = #{seaddress}, rename = #{rename}, readdress = #{readdress}, isSign = #{isSign} WHERE expressid = #{expressid}")
void update(Express express);
@Delete("DELETE FROM express_info WHERE expressid = #{expressid}")
void delete(Express express);
}

@ -1,21 +0,0 @@
package com.backend.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class Express {
private String expressid;
private String sename;
private String sephone;
private String seaddress;
private String rename;
private String rephone;
private String readdress;
private Integer issigned;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy年MM月dd日")
private Date signtime;
}

@ -1,18 +0,0 @@
package com.backend.service;
import com.backend.pojo.Express;
import java.util.Date;
public interface ExpressService {
Express findExpressById(final String expressId);
void insert(final String expressId,
final String sename, final String sephone, final String seaddress,
final String rename, final String rephone, final String readdress,
final Integer issign, final Date signtime);
void update(final Express express);
void delete(final Express express);
}

@ -1,44 +0,0 @@
package com.backend.service.impl;
import com.backend.mapper.ExpressMapper;
import com.backend.pojo.Express;
import com.backend.service.ExpressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class ExpressServiceImpl implements ExpressService {
@Autowired
private ExpressMapper expressMapper;
@Override
public Express findExpressById(String expressid) {
return expressMapper.findExpressById(expressid);
}
@Override
public void insert(final String expressId,
final String sename, final String sephone, final String seaddress,
final String rename, final String rephone, final String readdress,
final Integer issign, final Date signtime) {
expressMapper.add(expressId, sename, sephone, seaddress, rename, rephone, readdress, issign, signtime);
}
@Override
public void update(Express express) {
expressMapper.update(express);
}
@Override
public void delete(final Express express) {
expressMapper.delete(express);
}
}

@ -1,69 +1,3 @@
<template>
<el-row class="login-page">
<el-col :span="12" class="bg"></el-col>
<el-col :span="6" :offset="3" class="form">
<!-- 注册表单 -->
<el-form ref="form" size="large" autocomplete="on" v-if="isRegister" :model="registerData" :rules="rules">
<el-form-item>
<h1>注册</h1>
</el-form-item>
<el-form-item prop="username">
<el-input :prefix-icon="User" placeholder="请输入用户名" v-model="registerData.username"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input :prefix-icon="Lock" type="password" placeholder="请输入密码"
v-model="registerData.password"></el-input>
</el-form-item>
<el-form-item prop="rePassword">
<el-input :prefix-icon="Lock" type="password" placeholder="请输入再次密码"
v-model="registerData.rePassword"></el-input>
</el-form-item>
<!-- 注册按钮 -->
<el-form-item>
<el-button class="button" type="primary" auto-insert-space @click="register">
注册
</el-button>
</el-form-item>
<el-form-item class="flex">
<el-link type="info" :underline="false" @click="isRegister = false;clearRegisterData()">
返回
</el-link>
</el-form-item>
</el-form>
<!-- 登录表单 -->
<el-form ref="form" size="large" autocomplete="off" v-else :model="registerData" :rules="rules">
<el-form-item>
<h1>登录</h1>
</el-form-item>
<el-form-item prop="username">
<el-input :prefix-icon="User" placeholder="请输入用户名" v-model="registerData.username"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input name="password" :prefix-icon="Lock" type="password" placeholder="请输入密码"
v-model="registerData.password"></el-input>
</el-form-item>
<el-form-item class="flex">
<div class="flex">
<el-checkbox>记住我</el-checkbox>
<el-link type="primary" :underline="false">忘记密码</el-link>
</div>
</el-form-item>
<!-- 登录按钮 -->
<el-form-item>
<el-button class="button" type="primary" auto-insert-space @click="login">
登录
</el-button>
</el-form-item>
<el-form-item class="flex">
<el-link type="info" :underline="false" @click="isRegister = true;clearRegisterData()">
注册
</el-link>
</el-form-item>
</el-form>
</el-col>
</el-row>
</template>
<script setup>
import {Lock, User} from "@element-plus/icons-vue"
@ -125,7 +59,7 @@ const login = async () => {
ElMessage.success(result.message ? result.message : '登录成功')
tokenStore.setToken(result.data)
router.push('index')
router.push('/')
}
}
@ -140,7 +74,72 @@ const clearRegisterData = () => {
</script>
<template>
<el-row class="login-page">
<el-col :span="12" class="bg"></el-col>
<el-col :span="6" :offset="3" class="form">
<!-- 注册表单 -->
<el-form ref="form" size="large" autocomplete="on" v-if="isRegister" :model="registerData" :rules="rules">
<el-form-item>
<h1>注册</h1>
</el-form-item>
<el-form-item prop="username">
<el-input :prefix-icon="User" placeholder="请输入用户名" v-model="registerData.username"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input :prefix-icon="Lock" type="password" placeholder="请输入密码"
v-model="registerData.password"></el-input>
</el-form-item>
<el-form-item prop="rePassword">
<el-input :prefix-icon="Lock" type="password" placeholder="请输入再次密码"
v-model="registerData.rePassword"></el-input>
</el-form-item>
<!-- 注册按钮 -->
<el-form-item>
<el-button class="button" type="primary" auto-insert-space @click="register">
注册
</el-button>
</el-form-item>
<el-form-item class="flex">
<el-link type="info" :underline="false" @click="isRegister = false;clearRegisterData()">
返回
</el-link>
</el-form-item>
</el-form>
<!-- 登录表单 -->
<el-form ref="form" size="large" autocomplete="off" v-else :model="registerData" :rules="rules">
<el-form-item>
<h1>登录</h1>
</el-form-item>
<el-form-item prop="username">
<el-input :prefix-icon="User" placeholder="请输入用户名" v-model="registerData.username"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input name="password" :prefix-icon="Lock" type="password" placeholder="请输入密码"
v-model="registerData.password"></el-input>
</el-form-item>
<el-form-item class="flex">
<div class="flex">
<el-checkbox>记住我</el-checkbox>
<el-link type="primary" :underline="false">忘记密码</el-link>
</div>
</el-form-item>
<!-- 登录按钮 -->
<el-form-item>
<el-button class="button" type="primary" auto-insert-space @click="login">
登录
</el-button>
</el-form-item>
<el-form-item class="flex">
<el-link type="info" :underline="false" @click="isRegister = true;clearRegisterData()">
注册
</el-link>
</el-form-item>
</el-form>
</el-col>
</el-row>
</template>
<style lang="scss" scoped>
/* 样式 */

@ -14,29 +14,29 @@
<template #label>
<span style="color: red;">*</span> 姓名
</template>
<el-input placeholder="请填写真实姓名" v-model="express.sename"></el-input>
<el-input placeholder="请填写真实姓名" v-model="sendFormData.name"></el-input>
</el-form-item>
<el-form-item>
<template #label>
<span style="color: red;">*</span> 联系电话
</template>
<el-input placeholder="请填写手机号码或者固话号码" v-model="express.sephone"></el-input>
<el-input placeholder="请填写手机号码或者固话号码" v-model="sendFormData.phone"></el-input>
</el-form-item>
<el-form-item>
<template #label>
<span style="color: red;">*</span> 省市区
</template>
<el-input placeholder="请选择省市区" v-model="sendFormData.region"></el-input>
</el-form-item>
<!-- <el-form-item>-->
<!-- <template #label>-->
<!-- <span style="color: red;">*</span> 省市区-->
<!-- </template>-->
<!-- <el-input placeholder="请选择省市区" v-model="express.region"></el-input>-->
<!-- </el-form-item>-->
<el-form-item>
<template #label>
<span style="color: red;">*</span> 详细地址
</template>
<el-input placeholder="请填写详细地址" v-model="express.seaddress"></el-input>
<el-input placeholder="请填写详细地址" v-model="sendFormData.address"></el-input>
</el-form-item>
<el-form-item label="公司名称">
<el-input placeholder="请填写公司名称" v-model="sendFormData.company"></el-input>
</el-form-item>
<!-- <el-form-item label="公司名称">-->
<!-- <el-input placeholder="请填写公司名称" v-model="express.company"></el-input>-->
<!-- </el-form-item>-->
</el-form>
</el-row>
<el-image class="arrow" src="/arrow.png"></el-image>
@ -53,29 +53,29 @@
<template #label>
<span style="color: red;">*</span> 姓名
</template>
<el-input placeholder="请填写真实姓名" v-model="express.rename"></el-input>
<el-input placeholder="请填写真实姓名" v-model="receiveFormData.name"></el-input>
</el-form-item>
<el-form-item>
<template #label>
<span style="color: red;">*</span> 联系电话
</template>
<el-input placeholder="请填写手机号码或者固话号码" v-model="express.rephone"></el-input>
<el-input placeholder="请填写手机号码或者固话号码" v-model="receiveFormData.phone"></el-input>
</el-form-item>
<el-form-item>
<template #label>
<span style="color: red;">*</span> 省市区
</template>
<el-input placeholder="请选择省市区" v-model="receiveFormData.region"></el-input>
</el-form-item>
<!-- <el-form-item>-->
<!-- <template #label>-->
<!-- <span style="color: red;">*</span> 省市区-->
<!-- </template>-->
<!-- <el-input placeholder="请选择省市区" v-model="express.region"></el-input>-->
<!-- </el-form-item>-->
<el-form-item>
<template #label>
<span style="color: red;">*</span> 详细地址
</template>
<el-input placeholder="请填写详细地址" v-model="express.readdress"></el-input>
<el-input placeholder="请填写详细地址" v-model="receiveFormData.address"></el-input>
</el-form-item>
<el-form-item label="公司名称">
<el-input placeholder="请填写公司名称" v-model="receiveFormData.company"></el-input>
</el-form-item>
<!-- <el-form-item label="公司名称">-->
<!-- <el-input placeholder="请填写公司名称" v-model="express.company"></el-input>-->
<!-- </el-form-item>-->
</el-form>
</el-row>
</el-row>
@ -100,17 +100,22 @@ import { ref } from 'vue';
const sendFormRef = ref(null); //
const receiveFormRef = ref(null); //
const express = ref({
sename: '',
sephone: '',
seaddress: '',
rename: '',
rephone: '',
readdress: '',
const sendFormData = ref({
name: '',
phone: '',
// region: '',
// company: ''
});
region: '',
address: '',
company: ''
}); //
const receiveFormData = ref({
name: '',
phone: '',
region: '',
address: '',
company: ''
}); //
//
const submitForm = async () => {
try {

@ -26,9 +26,10 @@ const routes = [
component: Login,
},
{
path: '/index',
name: 'Index',
path: '/user',
name: 'User',
component: Index,
redirect: "myInfo",
children: [
{
path: '/myInfo',

Loading…
Cancel
Save