(原创)基于springboot,vue网上书城定制版v4.0
本人原创作品,用户前台、系统管理员后台项目完整,无任何bug。
每行代码都是本人自己写,我在代码上面都写有详细注释
开发工具:IDEA
服务器:Tomcat9.0, jdk1.8
项目构建:maven
数据库:mysql5.7
系统分前后台,采用前后端分离
前端技术:vue (vue cli,vue-router,vuex全家桶),elementUI等框架实现
服务端技术:springboot,mybatis-plus


前台截图:
















后台截图:















<template>
<div style="background-color: #f7f9f9;">
<el-row>
<el-col :span="7" style="text-align: left;">
<el-link :underline="false" @click="$router.push({path:'/mallHome'}).catch(err => {err})"><img :src="logoUrl" class="image" style="width: 274px;height: 60px;"></el-link>
</el-col>
<el-col :span="8">
<el-autocomplete
v-model="state"
:fetch-suggestions="querySearchAsync"
placeholder="请输入内容"
></el-autocomplete>
<el-button type="primary" icon="el-icon-search" @click="search()">搜索</el-button>
</el-col>
<el-col :span="9">
<template v-if="$store.state.account">
<el-row>
<el-col :span="7">
<el-link :underline="false" href="#">
欢迎您,
<el-avatar :size="size" :src="$store.state.account.avatar" style="vertical-align: middle;"></el-avatar>
<span style="color:red;">{{ $store.state.account.name }}</span>
</el-link>
</el-col>
<el-col :span="5">
<el-link :underline="false" style="color:#23527c;" @click="logout()">退出登录</el-link>
</el-col>
<el-col :span="4">
<el-dropdown>
<span class="el-dropdown-link">
<el-link :underline="false" type="primary">个人中心</el-link><i
class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<el-link :underline="false" @click="toChangePassword">修改密码</el-link>
</el-dropdown-item>
<el-dropdown-item>
<el-link :underline="false" @click="toDeliveryAddress">地址管理</el-link>
</el-dropdown-item>
<el-dropdown-item>
<el-link :underline="false" @click="toUserInfo">资料修改</el-link>
</el-dropdown-item>
<el-dropdown-item>
<el-link :underline="false" @click="toLeaveMessage">留言反馈</el-link>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-col>
<el-col :span="4">
<el-link :underline="false" icon="el-icon-shopping-cart-2" type="primary" @click="toCart">我的购物车</el-link>
</el-col>
<el-col :span="4">
<el-link :underline="false" icon="el-icon-s-order" type="primary" @click="toOrder">我的订单</el-link>
</el-col>
</el-row>
</template>
<template v-else>
<el-row>
<el-col :span="6">
<el-link :disabled="isLoginDisabled" :underline="false" @click="toLogin()">你好,请登录</el-link>
</el-col>
<el-col :span="6">
<el-link :disabled="isRegisterDisabled" :underline="false" @click="toRegister()">免费注册</el-link>
</el-col>
<el-col :span="6"></el-col>
<el-col :span="6"></el-col>
</el-row>
</template>
</el-col>
</el-row>
</div>
</template>
<script>
export default {
name: "MyHead",
data() {
return {
categoryListV:[],
logoUrl:"logo.png",
state: "",
restaurants: [],//搜索标题
size:"small",
isLoginDisabled:false,
isRegisterDisabled:false,
}
},
mounted:function () {
let _this = this;
this.restaurants = this.loadAll();
},
methods: {
loadAll() {
let _this = this;
_this.getRequest("/public/getProductNameList").then(resp=>{
if(resp){
_this.restaurants=resp.obj;
}
})
},
querySearchAsync(queryString, cb) {
let _this = this;
var restaurants = _this.restaurants;
var results = queryString ? restaurants.filter(_this.createStateFilter(queryString)) : restaurants;
clearTimeout(_this.timeout);
this.timeout = setTimeout(() => {
cb(results);
}, 3000 * Math.random());
},
createStateFilter(queryString) {
return (state) => {
return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
};
},
toLogin(){
let _this=this;
_this.$router.push({path:'/loginForm'})
//设置登录不可点,可以注册
_this.isLoginDisabled=!_this.isLoginDisabled;
_this.isRegisterDisabled=false;
},
toRegister(){
let _this=this;
_this.$router.push({path:'/registerForm'})
//设置注册不可点,可以登录
_this.isRegisterDisabled=!_this.isRegisterDisabled;
_this.isLoginDisabled=false;
},
logout(){
let _this=this;
_this.$confirm('确定退出登录?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//注销登录
_this.getRequest('/user/logout');
//清空用户信息
_this.$store.commit('logout');
//跳转到登录页面
this.$router.push({ path: '/' }).catch(data => { })
}).catch(() => {
_this.$message({
type: 'info',
message: '已取消操作'
});
});
},
search(){
if(this.state){
this.$router.push({
path:'/searchProduct',
query: { pname:this.state}
});
}
},
toLeaveMessage(){
this.$router.push({
path:'/leaveMessage',
});
},
toChangePassword(){
this.$router.push({
path:'/changePassword',
});
},
toDeliveryAddress(){
this.$router.push({
path:'/deliveryAddress',
});
},
toUserInfo(){
this.$router.push({
path:'/updateUserInfo',
});
},
toCart(){
this.$router.push({
path:'/shoppingCart',
});
},
toOrder(){
this.$router.push({
path:'/orderList',
});
}
}
}
</script>
<style scoped>
</style>
package lyp.itjiaochen.club.controller;
import io.swagger.annotations.ApiOperation;
import lyp.itjiaochen.club.pojo.LeaveMessage;
import lyp.itjiaochen.club.pojo.dto.RespBean;
import lyp.itjiaochen.club.pojo.dto.RespPageBean;
import lyp.itjiaochen.club.pojo.dto.query.LeaveMessageQueryDto;
import lyp.itjiaochen.club.service.ILeaveMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 前端控制器
* </p>
*
* @author IT教程资源
* @since 2023-04-03
*/
@RestController
@RequestMapping("/admin/leaveMessage")
public class LeaveMessageController {
@Autowired
private ILeaveMessageService iLeaveMessageService;
@ApiOperation("分页查询留言信息")
@PostMapping("/getLeaveMessagePage")
public RespPageBean getLeaveMessagePage(@RequestBody LeaveMessageQueryDto queryDto){
return iLeaveMessageService.getLeaveMessagePage(queryDto);
}
@ApiOperation("删除留言")
@DeleteMapping("/deleteLeaveMessage")
public RespBean deleteLeaveMessage(@RequestBody LeaveMessage leaveMessage){
if(leaveMessage!=null && iLeaveMessageService.removeById(leaveMessage.getId())){
return RespBean.success("删除成功!");
}
return RespBean.error("删除失败!");
}
}
package lyp.itjiaochen.club.controller;
import io.swagger.annotations.ApiOperation;
import lyp.itjiaochen.club.pojo.ProductCategory;
import lyp.itjiaochen.club.pojo.dto.RespBean;
import lyp.itjiaochen.club.pojo.dto.RespPageBean;
import lyp.itjiaochen.club.pojo.dto.query.ProductCategoryQueryDto;
import lyp.itjiaochen.club.service.IProductCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 前端控制器
* </p>
*
* @author IT教程资源
* @since 2023-03-14
*/
@RestController
@RequestMapping("/admin/category")
public class ProductCategoryController {
@Autowired
private IProductCategoryService iProductCategoryService;
@ApiOperation("分页查询商品分类")
@PostMapping("/getCategoryPage")
public RespPageBean getCategoryPage(@RequestBody ProductCategoryQueryDto queryDto){
return iProductCategoryService.getProductCategoryPage(queryDto);
}
@ApiOperation("添加商品分类")
@PostMapping("/addCategory")
public RespBean addCategory(@RequestBody ProductCategory productCategory){
if(iProductCategoryService.save(productCategory)){
return RespBean.success("添加成功!");
}
return RespBean.error("添加失败!");
}
@ApiOperation("更新商品分类")
@PutMapping("/updateCategory")
public RespBean updateCategory(@RequestBody ProductCategory productCategory){
if(iProductCategoryService.updateById(productCategory)){
return RespBean.success("更新成功!");
}
return RespBean.error("更新失败!");
}
@ApiOperation("删除商品分类")
@DeleteMapping("/deleteCategory")
public RespBean deleteCategory(@RequestBody ProductCategory productCategory){
if(productCategory!=null && iProductCategoryService.deleteCategory(productCategory)){
return RespBean.success("删除成功!");
}
return RespBean.error("删除失败!");
}
}



















