Compare commits
No commits in common. 'main' and 'master' have entirely different histories.
@ -0,0 +1,37 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target
|
||||||
|
/.mvn/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.log
|
||||||
|
*.jar
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
Navicat Premium Data Transfer
|
||||||
|
|
||||||
|
Source Server : local
|
||||||
|
Source Server Type : MySQL
|
||||||
|
Source Server Version : 80029
|
||||||
|
Source Host : localhost:3306
|
||||||
|
Source Schema : DB_flower
|
||||||
|
|
||||||
|
Target Server Type : MySQL
|
||||||
|
Target Server Version : 80029
|
||||||
|
File Encoding : 65001
|
||||||
|
|
||||||
|
Date: 26/01/2024 15:29:41
|
||||||
|
*/
|
||||||
|
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for carts
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `carts`;
|
||||||
|
CREATE TABLE `carts` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`fid` int DEFAULT NULL,
|
||||||
|
`flower` varchar(255) DEFAULT NULL,
|
||||||
|
`amount` int DEFAULT NULL,
|
||||||
|
`price` float DEFAULT NULL,
|
||||||
|
`uid` int DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `flower` (`flower`),
|
||||||
|
KEY `uid` (`uid`),
|
||||||
|
KEY `fk2` (`fid`),
|
||||||
|
CONSTRAINT `carts_ibfk_2` FOREIGN KEY (`uid`) REFERENCES `users` (`id`),
|
||||||
|
CONSTRAINT `fk2` FOREIGN KEY (`fid`) REFERENCES `flowers` (`id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb3;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of carts
|
||||||
|
-- ----------------------------
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO `carts` VALUES (32, 2, '粉色玫瑰花', 1, NULL, 10);
|
||||||
|
INSERT INTO `carts` VALUES (33, 4, '金枝玉叶玫瑰', 3, NULL, 10);
|
||||||
|
INSERT INTO `carts` VALUES (34, 1, '杭州水果捞', 1, NULL, 10);
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for flowers
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `flowers`;
|
||||||
|
CREATE TABLE `flowers` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) DEFAULT NULL,
|
||||||
|
`species_name` varchar(255) DEFAULT NULL,
|
||||||
|
`price` float DEFAULT NULL,
|
||||||
|
`detail` varchar(255) DEFAULT NULL,
|
||||||
|
`img_guid` varchar(255) DEFAULT NULL,
|
||||||
|
`state` int DEFAULT '1' COMMENT '商品状态',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `name` (`name`),
|
||||||
|
KEY `species_name` (`species_name`),
|
||||||
|
CONSTRAINT `flowers_ibfk_1` FOREIGN KEY (`species_name`) REFERENCES `species` (`species_name`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb3;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of flowers
|
||||||
|
-- ----------------------------
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO `flowers` VALUES (1, '杭州水果捞', '春日', 10, '杭州水果捞', 'fe71ee4538644b4da67b046d3a6825a8.jpg', 1);
|
||||||
|
INSERT INTO `flowers` VALUES (2, '粉色玫瑰花', '夏日', 199, '粉色玫瑰花,送爱人~', '67975badf69646c0a70e8154208c7acd.jpg', 1);
|
||||||
|
INSERT INTO `flowers` VALUES (3, '牡丹', '夏日', 299, '国花,价格优惠', 'hehua.jpg', 1);
|
||||||
|
INSERT INTO `flowers` VALUES (4, '金枝玉叶玫瑰', '秋日', 999.99, '金枝玉叶玫瑰', '8d59b8723ad6409ab3b10847f86ef196.jpg', 1);
|
||||||
|
INSERT INTO `flowers` VALUES (5, '紫色小雏菊', '夏日', 188, '紫色小雏菊~', 'eff301d8ca194fb99639ebe4f1d328b9.jpg', 1);
|
||||||
|
INSERT INTO `flowers` VALUES (6, NULL, NULL, NULL, NULL, '', 1);
|
||||||
|
INSERT INTO `flowers` VALUES (7, '粉百合', '冬日', 10000, '粉百合', '6d901436d6e84160b04de4cafa79a611.jpg', 1);
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for orders
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `orders`;
|
||||||
|
CREATE TABLE `orders` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`order_guid` varchar(255) DEFAULT NULL,
|
||||||
|
`flower` varchar(255) DEFAULT NULL,
|
||||||
|
`amount` int DEFAULT NULL,
|
||||||
|
`price` float DEFAULT NULL,
|
||||||
|
`state` int DEFAULT NULL,
|
||||||
|
`uid` int DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `flower` (`flower`),
|
||||||
|
KEY `uid` (`uid`),
|
||||||
|
CONSTRAINT `orders_ibfk_2` FOREIGN KEY (`uid`) REFERENCES `users` (`id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb3;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of orders
|
||||||
|
-- ----------------------------
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO `orders` VALUES (27, NULL, '杭州水果捞', 3, 30, 0, 10);
|
||||||
|
INSERT INTO `orders` VALUES (28, NULL, '金枝玉叶玫瑰', 1, 999.99, 0, 10);
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for species
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `species`;
|
||||||
|
CREATE TABLE `species` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`species_name` varchar(255) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `species` (`species_name`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb3;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of species
|
||||||
|
-- ----------------------------
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO `species` VALUES (8, NULL);
|
||||||
|
INSERT INTO `species` VALUES (7, '冬日');
|
||||||
|
INSERT INTO `species` VALUES (11, '友情花');
|
||||||
|
INSERT INTO `species` VALUES (2, '夏日');
|
||||||
|
INSERT INTO `species` VALUES (9, '情人花');
|
||||||
|
INSERT INTO `species` VALUES (1, '春日');
|
||||||
|
INSERT INTO `species` VALUES (3, '秋日');
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for users
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `users`;
|
||||||
|
CREATE TABLE `users` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`account` varchar(255) DEFAULT NULL,
|
||||||
|
`name` varchar(255) DEFAULT NULL,
|
||||||
|
`password` varchar(255) DEFAULT NULL,
|
||||||
|
`phone` varchar(255) DEFAULT NULL,
|
||||||
|
`address` varchar(255) DEFAULT NULL,
|
||||||
|
`role` varchar(255) DEFAULT NULL COMMENT '角色',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `account` (`account`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of users
|
||||||
|
-- ----------------------------
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO `users` VALUES (1, 'user2', 'user2', '123456', '13566662222', '北京市昌平区2号', 'user');
|
||||||
|
INSERT INTO `users` VALUES (2, 'admin', '系统管理员', '123456', '123456', '上海市黄浦区南京西路8号', 'admin');
|
||||||
|
INSERT INTO `users` VALUES (10, 'user', '杭州水果捞', '123456', '18679121111', '杭州余杭区', 'user');
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"presets": [
|
|
||||||
["env", {
|
|
||||||
"modules": false,
|
|
||||||
"targets": {
|
|
||||||
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
"stage-2"
|
|
||||||
],
|
|
||||||
"plugins": ["transform-vue-jsx", "transform-runtime"]
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
.DS_Store
|
|
||||||
node_modules
|
|
||||||
/dist
|
|
||||||
|
|
||||||
|
|
||||||
# local env files
|
|
||||||
.env.local
|
|
||||||
.env.*.local
|
|
||||||
|
|
||||||
# Log files
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
pnpm-debug.log*
|
|
||||||
|
|
||||||
# Editor directories and files`
|
|
||||||
`
|
|
||||||
|
|
||||||
.idea
|
|
||||||
.vscode
|
|
||||||
*.suo
|
|
||||||
*.ntvs*
|
|
||||||
*.njsproj
|
|
||||||
*.sln
|
|
||||||
*.sw?
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
// https://github.com/michael-ciniawsky/postcss-load-config
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
"plugins": {
|
|
||||||
"postcss-import": {},
|
|
||||||
"postcss-url": {},
|
|
||||||
// to edit target browsers: use "browserslist" field in package.json
|
|
||||||
"autoprefixer": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
require('./check-versions')()
|
|
||||||
|
|
||||||
process.env.NODE_ENV = 'production'
|
|
||||||
|
|
||||||
const ora = require('ora')
|
|
||||||
const rm = require('rimraf')
|
|
||||||
const path = require('path')
|
|
||||||
const chalk = require('chalk')
|
|
||||||
const webpack = require('webpack')
|
|
||||||
const config = require('../config')
|
|
||||||
const webpackConfig = require('./webpack.prod.conf')
|
|
||||||
|
|
||||||
const spinner = ora('building for production...')
|
|
||||||
spinner.start()
|
|
||||||
|
|
||||||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
|
||||||
if (err) throw err
|
|
||||||
webpack(webpackConfig, (err, stats) => {
|
|
||||||
spinner.stop()
|
|
||||||
if (err) throw err
|
|
||||||
process.stdout.write(stats.toString({
|
|
||||||
colors: true,
|
|
||||||
modules: false,
|
|
||||||
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
|
|
||||||
chunks: false,
|
|
||||||
chunkModules: false
|
|
||||||
}) + '\n\n')
|
|
||||||
|
|
||||||
if (stats.hasErrors()) {
|
|
||||||
console.log(chalk.red(' Build failed with errors.\n'))
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(chalk.cyan(' Build complete.\n'))
|
|
||||||
console.log(chalk.yellow(
|
|
||||||
' Tip: built files are meant to be served over an HTTP server.\n' +
|
|
||||||
' Opening index.html over file:// won\'t work.\n'
|
|
||||||
))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
const chalk = require('chalk')
|
|
||||||
const semver = require('semver')
|
|
||||||
const packageConfig = require('../package.json')
|
|
||||||
const shell = require('shelljs')
|
|
||||||
|
|
||||||
function exec (cmd) {
|
|
||||||
return require('child_process').execSync(cmd).toString().trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
const versionRequirements = [
|
|
||||||
{
|
|
||||||
name: 'node',
|
|
||||||
currentVersion: semver.clean(process.version),
|
|
||||||
versionRequirement: packageConfig.engines.node
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
if (shell.which('npm')) {
|
|
||||||
versionRequirements.push({
|
|
||||||
name: 'npm',
|
|
||||||
currentVersion: exec('npm --version'),
|
|
||||||
versionRequirement: packageConfig.engines.npm
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function () {
|
|
||||||
const warnings = []
|
|
||||||
|
|
||||||
for (let i = 0; i < versionRequirements.length; i++) {
|
|
||||||
const mod = versionRequirements[i]
|
|
||||||
|
|
||||||
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
|
|
||||||
warnings.push(mod.name + ': ' +
|
|
||||||
chalk.red(mod.currentVersion) + ' should be ' +
|
|
||||||
chalk.green(mod.versionRequirement)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (warnings.length) {
|
|
||||||
console.log('')
|
|
||||||
console.log(chalk.yellow('To use this template, you must update following to modules:'))
|
|
||||||
console.log()
|
|
||||||
|
|
||||||
for (let i = 0; i < warnings.length; i++) {
|
|
||||||
const warning = warnings[i]
|
|
||||||
console.log(' ' + warning)
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log()
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 6.7 KiB |
@ -1,101 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
const path = require('path')
|
|
||||||
const config = require('../config')
|
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
|
||||||
const packageConfig = require('../package.json')
|
|
||||||
|
|
||||||
exports.assetsPath = function (_path) {
|
|
||||||
const assetsSubDirectory = process.env.NODE_ENV === 'production'
|
|
||||||
? config.build.assetsSubDirectory
|
|
||||||
: config.dev.assetsSubDirectory
|
|
||||||
|
|
||||||
return path.posix.join(assetsSubDirectory, _path)
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.cssLoaders = function (options) {
|
|
||||||
options = options || {}
|
|
||||||
|
|
||||||
const cssLoader = {
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: options.sourceMap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const postcssLoader = {
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: options.sourceMap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// generate loader string to be used with extract text plugin
|
|
||||||
function generateLoaders (loader, loaderOptions) {
|
|
||||||
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
|
|
||||||
|
|
||||||
if (loader) {
|
|
||||||
loaders.push({
|
|
||||||
loader: loader + '-loader',
|
|
||||||
options: Object.assign({}, loaderOptions, {
|
|
||||||
sourceMap: options.sourceMap
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract CSS when that option is specified
|
|
||||||
// (which is the case during production build)
|
|
||||||
if (options.extract) {
|
|
||||||
return ExtractTextPlugin.extract({
|
|
||||||
use: loaders,
|
|
||||||
fallback: 'vue-style-loader'
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
return ['vue-style-loader'].concat(loaders)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
|
|
||||||
return {
|
|
||||||
css: generateLoaders(),
|
|
||||||
postcss: generateLoaders(),
|
|
||||||
less: generateLoaders('less'),
|
|
||||||
sass: generateLoaders('sass', { indentedSyntax: true }),
|
|
||||||
scss: generateLoaders('sass'),
|
|
||||||
stylus: generateLoaders('stylus'),
|
|
||||||
styl: generateLoaders('stylus')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate loaders for standalone style files (outside of .vue)
|
|
||||||
exports.styleLoaders = function (options) {
|
|
||||||
const output = []
|
|
||||||
const loaders = exports.cssLoaders(options)
|
|
||||||
|
|
||||||
for (const extension in loaders) {
|
|
||||||
const loader = loaders[extension]
|
|
||||||
output.push({
|
|
||||||
test: new RegExp('\\.' + extension + '$'),
|
|
||||||
use: loader
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return output
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.createNotifierCallback = () => {
|
|
||||||
const notifier = require('node-notifier')
|
|
||||||
|
|
||||||
return (severity, errors) => {
|
|
||||||
if (severity !== 'error') return
|
|
||||||
|
|
||||||
const error = errors[0]
|
|
||||||
const filename = error.file && error.file.split('!').pop()
|
|
||||||
|
|
||||||
notifier.notify({
|
|
||||||
title: packageConfig.name,
|
|
||||||
message: severity + ': ' + error.name,
|
|
||||||
subtitle: filename || '',
|
|
||||||
icon: path.join(__dirname, 'logo.png')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
const utils = require('./utils')
|
|
||||||
const config = require('../config')
|
|
||||||
const isProduction = process.env.NODE_ENV === 'production'
|
|
||||||
const sourceMapEnabled = isProduction
|
|
||||||
? config.build.productionSourceMap
|
|
||||||
: config.dev.cssSourceMap
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
loaders: utils.cssLoaders({
|
|
||||||
sourceMap: sourceMapEnabled,
|
|
||||||
extract: isProduction
|
|
||||||
}),
|
|
||||||
cssSourceMap: sourceMapEnabled,
|
|
||||||
cacheBusting: config.dev.cacheBusting,
|
|
||||||
transformToRequire: {
|
|
||||||
video: ['src', 'poster'],
|
|
||||||
source: 'src',
|
|
||||||
img: 'src',
|
|
||||||
image: 'xlink:href'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
const path = require('path')
|
|
||||||
const utils = require('./utils')
|
|
||||||
const config = require('../config')
|
|
||||||
const vueLoaderConfig = require('./vue-loader.conf')
|
|
||||||
|
|
||||||
function resolve (dir) {
|
|
||||||
return path.join(__dirname, '..', dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
context: path.resolve(__dirname, '../'),
|
|
||||||
entry: {
|
|
||||||
app: './src/main.js'
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
path: config.build.assetsRoot,
|
|
||||||
filename: '[name].js',
|
|
||||||
publicPath: process.env.NODE_ENV === 'production'
|
|
||||||
? config.build.assetsPublicPath
|
|
||||||
: config.dev.assetsPublicPath
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
extensions: ['.js', '.vue', '.json'],
|
|
||||||
alias: {
|
|
||||||
'vue$': 'vue/dist/vue.esm.js',
|
|
||||||
'@': resolve('src'),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.vue$/,
|
|
||||||
loader: 'vue-loader',
|
|
||||||
options: vueLoaderConfig
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.js$/,
|
|
||||||
loader: 'babel-loader',
|
|
||||||
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
|
||||||
loader: 'url-loader',
|
|
||||||
options: {
|
|
||||||
limit: 10000,
|
|
||||||
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
|
||||||
loader: 'url-loader',
|
|
||||||
options: {
|
|
||||||
limit: 10000,
|
|
||||||
name: utils.assetsPath('media/[name].[hash:7].[ext]')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
||||||
loader: 'url-loader',
|
|
||||||
options: {
|
|
||||||
limit: 10000,
|
|
||||||
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
node: {
|
|
||||||
// prevent webpack from injecting useless setImmediate polyfill because Vue
|
|
||||||
// source contains it (although only uses it if it's native).
|
|
||||||
setImmediate: false,
|
|
||||||
// prevent webpack from injecting mocks to Node native modules
|
|
||||||
// that does not make sense for the client
|
|
||||||
dgram: 'empty',
|
|
||||||
fs: 'empty',
|
|
||||||
net: 'empty',
|
|
||||||
tls: 'empty',
|
|
||||||
child_process: 'empty'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,95 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
const utils = require('./utils')
|
|
||||||
const webpack = require('webpack')
|
|
||||||
const config = require('../config')
|
|
||||||
const merge = require('webpack-merge')
|
|
||||||
const path = require('path')
|
|
||||||
const baseWebpackConfig = require('./webpack.base.conf')
|
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
||||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
|
||||||
const portfinder = require('portfinder')
|
|
||||||
|
|
||||||
const HOST = process.env.HOST
|
|
||||||
const PORT = process.env.PORT && Number(process.env.PORT)
|
|
||||||
|
|
||||||
const devWebpackConfig = merge(baseWebpackConfig, {
|
|
||||||
module: {
|
|
||||||
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
|
|
||||||
},
|
|
||||||
// cheap-module-eval-source-map is faster for development
|
|
||||||
devtool: config.dev.devtool,
|
|
||||||
|
|
||||||
// these devServer options should be customized in /config/index.js
|
|
||||||
devServer: {
|
|
||||||
clientLogLevel: 'warning',
|
|
||||||
historyApiFallback: {
|
|
||||||
rewrites: [
|
|
||||||
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
hot: true,
|
|
||||||
contentBase: false, // since we use CopyWebpackPlugin.
|
|
||||||
compress: true,
|
|
||||||
host: HOST || config.dev.host,
|
|
||||||
port: PORT || config.dev.port,
|
|
||||||
open: config.dev.autoOpenBrowser,
|
|
||||||
overlay: config.dev.errorOverlay
|
|
||||||
? { warnings: false, errors: true }
|
|
||||||
: false,
|
|
||||||
publicPath: config.dev.assetsPublicPath,
|
|
||||||
proxy: config.dev.proxyTable,
|
|
||||||
quiet: true, // necessary for FriendlyErrorsPlugin
|
|
||||||
watchOptions: {
|
|
||||||
poll: config.dev.poll,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env': require('../config/dev.env')
|
|
||||||
}),
|
|
||||||
new webpack.HotModuleReplacementPlugin(),
|
|
||||||
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
|
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
|
||||||
// https://github.com/ampedandwired/html-webpack-plugin
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
filename: 'index.html',
|
|
||||||
template: 'index.html',
|
|
||||||
inject: true
|
|
||||||
}),
|
|
||||||
// copy custom static assets
|
|
||||||
new CopyWebpackPlugin([
|
|
||||||
{
|
|
||||||
from: path.resolve(__dirname, '../static'),
|
|
||||||
to: config.dev.assetsSubDirectory,
|
|
||||||
ignore: ['.*']
|
|
||||||
}
|
|
||||||
])
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
module.exports = new Promise((resolve, reject) => {
|
|
||||||
portfinder.basePort = process.env.PORT || config.dev.port
|
|
||||||
portfinder.getPort((err, port) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err)
|
|
||||||
} else {
|
|
||||||
// publish the new Port, necessary for e2e tests
|
|
||||||
process.env.PORT = port
|
|
||||||
// add port to devServer config
|
|
||||||
devWebpackConfig.devServer.port = port
|
|
||||||
|
|
||||||
// Add FriendlyErrorsPlugin
|
|
||||||
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
|
|
||||||
compilationSuccessInfo: {
|
|
||||||
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
|
|
||||||
},
|
|
||||||
onErrors: config.dev.notifyOnErrors
|
|
||||||
? utils.createNotifierCallback()
|
|
||||||
: undefined
|
|
||||||
}))
|
|
||||||
|
|
||||||
resolve(devWebpackConfig)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@ -1,145 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
const path = require('path')
|
|
||||||
const utils = require('./utils')
|
|
||||||
const webpack = require('webpack')
|
|
||||||
const config = require('../config')
|
|
||||||
const merge = require('webpack-merge')
|
|
||||||
const baseWebpackConfig = require('./webpack.base.conf')
|
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
|
||||||
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
|
||||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
|
||||||
|
|
||||||
const env = require('../config/prod.env')
|
|
||||||
|
|
||||||
const webpackConfig = merge(baseWebpackConfig, {
|
|
||||||
module: {
|
|
||||||
rules: utils.styleLoaders({
|
|
||||||
sourceMap: config.build.productionSourceMap,
|
|
||||||
extract: true,
|
|
||||||
usePostCSS: true
|
|
||||||
})
|
|
||||||
},
|
|
||||||
devtool: config.build.productionSourceMap ? config.build.devtool : false,
|
|
||||||
output: {
|
|
||||||
path: config.build.assetsRoot,
|
|
||||||
filename: utils.assetsPath('js/[name].[chunkhash].js'),
|
|
||||||
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env': env
|
|
||||||
}),
|
|
||||||
new UglifyJsPlugin({
|
|
||||||
uglifyOptions: {
|
|
||||||
compress: {
|
|
||||||
warnings: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sourceMap: config.build.productionSourceMap,
|
|
||||||
parallel: true
|
|
||||||
}),
|
|
||||||
// extract css into its own file
|
|
||||||
new ExtractTextPlugin({
|
|
||||||
filename: utils.assetsPath('css/[name].[contenthash].css'),
|
|
||||||
// Setting the following option to `false` will not extract CSS from codesplit chunks.
|
|
||||||
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
|
||||||
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
|
||||||
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
|
||||||
allChunks: true,
|
|
||||||
}),
|
|
||||||
// Compress extracted CSS. We are using this plugin so that possible
|
|
||||||
// duplicated CSS from different components can be deduped.
|
|
||||||
new OptimizeCSSPlugin({
|
|
||||||
cssProcessorOptions: config.build.productionSourceMap
|
|
||||||
? { safe: true, map: { inline: false } }
|
|
||||||
: { safe: true }
|
|
||||||
}),
|
|
||||||
// generate dist index.html with correct asset hash for caching.
|
|
||||||
// you can customize output by editing /index.html
|
|
||||||
// see https://github.com/ampedandwired/html-webpack-plugin
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
filename: config.build.index,
|
|
||||||
template: 'index.html',
|
|
||||||
inject: true,
|
|
||||||
minify: {
|
|
||||||
removeComments: true,
|
|
||||||
collapseWhitespace: true,
|
|
||||||
removeAttributeQuotes: true
|
|
||||||
// more options:
|
|
||||||
// https://github.com/kangax/html-minifier#options-quick-reference
|
|
||||||
},
|
|
||||||
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
|
||||||
chunksSortMode: 'dependency'
|
|
||||||
}),
|
|
||||||
// keep module.id stable when vendor modules does not change
|
|
||||||
new webpack.HashedModuleIdsPlugin(),
|
|
||||||
// enable scope hoisting
|
|
||||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
|
||||||
// split vendor js into its own file
|
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
|
||||||
name: 'vendor',
|
|
||||||
minChunks (module) {
|
|
||||||
// any required modules inside node_modules are extracted to vendor
|
|
||||||
return (
|
|
||||||
module.resource &&
|
|
||||||
/\.js$/.test(module.resource) &&
|
|
||||||
module.resource.indexOf(
|
|
||||||
path.join(__dirname, '../node_modules')
|
|
||||||
) === 0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
// extract webpack runtime and module manifest to its own file in order to
|
|
||||||
// prevent vendor hash from being updated whenever app bundle is updated
|
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
|
||||||
name: 'manifest',
|
|
||||||
minChunks: Infinity
|
|
||||||
}),
|
|
||||||
// This instance extracts shared chunks from code splitted chunks and bundles them
|
|
||||||
// in a separate chunk, similar to the vendor chunk
|
|
||||||
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
|
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
|
||||||
name: 'app',
|
|
||||||
async: 'vendor-async',
|
|
||||||
children: true,
|
|
||||||
minChunks: 3
|
|
||||||
}),
|
|
||||||
|
|
||||||
// copy custom static assets
|
|
||||||
new CopyWebpackPlugin([
|
|
||||||
{
|
|
||||||
from: path.resolve(__dirname, '../static'),
|
|
||||||
to: config.build.assetsSubDirectory,
|
|
||||||
ignore: ['.*']
|
|
||||||
}
|
|
||||||
])
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
if (config.build.productionGzip) {
|
|
||||||
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
|
||||||
|
|
||||||
webpackConfig.plugins.push(
|
|
||||||
new CompressionWebpackPlugin({
|
|
||||||
asset: '[path].gz[query]',
|
|
||||||
algorithm: 'gzip',
|
|
||||||
test: new RegExp(
|
|
||||||
'\\.(' +
|
|
||||||
config.build.productionGzipExtensions.join('|') +
|
|
||||||
')$'
|
|
||||||
),
|
|
||||||
threshold: 10240,
|
|
||||||
minRatio: 0.8
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.build.bundleAnalyzerReport) {
|
|
||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
|
||||||
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = webpackConfig
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
const merge = require('webpack-merge')
|
|
||||||
const prodEnv = require('./prod.env')
|
|
||||||
|
|
||||||
module.exports = merge(prodEnv, {
|
|
||||||
NODE_ENV: '"development"'
|
|
||||||
})
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
module.exports = {
|
|
||||||
NODE_ENV: '"production"'
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
||||||
<title>花卉市场</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
<!-- built files will be auto injected -->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "flower-mall",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "a project for nursing home ",
|
|
||||||
"author": "hide",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
|
|
||||||
"start": "npm run dev",
|
|
||||||
"build": "node build/build.js"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"axios": "^0.21.1",
|
|
||||||
"element-ui": "^2.15.2",
|
|
||||||
"vue": "^2.5.2",
|
|
||||||
"vue-router": "^3.0.1",
|
|
||||||
"vue-wechat-title": "^2.0.7",
|
|
||||||
"vuex": "^3.6.2"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"autoprefixer": "^7.1.2",
|
|
||||||
"babel-core": "^6.22.1",
|
|
||||||
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
|
||||||
"babel-loader": "^7.1.1",
|
|
||||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
|
||||||
"babel-plugin-transform-runtime": "^6.22.0",
|
|
||||||
"babel-plugin-transform-vue-jsx": "^3.5.0",
|
|
||||||
"babel-preset-env": "^1.3.2",
|
|
||||||
"babel-preset-stage-2": "^6.22.0",
|
|
||||||
"chalk": "^2.0.1",
|
|
||||||
"copy-webpack-plugin": "^4.0.1",
|
|
||||||
"css-loader": "^0.28.0",
|
|
||||||
"extract-text-webpack-plugin": "^3.0.0",
|
|
||||||
"file-loader": "^1.1.4",
|
|
||||||
"friendly-errors-webpack-plugin": "^1.6.1",
|
|
||||||
"html-webpack-plugin": "^2.30.1",
|
|
||||||
"node-notifier": "^5.1.2",
|
|
||||||
"optimize-css-assets-webpack-plugin": "^3.2.0",
|
|
||||||
"ora": "^1.2.0",
|
|
||||||
"portfinder": "^1.0.13",
|
|
||||||
"postcss-import": "^11.0.0",
|
|
||||||
"postcss-loader": "^2.0.8",
|
|
||||||
"postcss-url": "^7.2.1",
|
|
||||||
"rimraf": "^2.6.0",
|
|
||||||
"semver": "^5.3.0",
|
|
||||||
"shelljs": "^0.7.6",
|
|
||||||
"uglifyjs-webpack-plugin": "^1.1.1",
|
|
||||||
"url-loader": "^0.5.8",
|
|
||||||
"vue-loader": "^13.3.0",
|
|
||||||
"vue-style-loader": "^3.0.1",
|
|
||||||
"vue-template-compiler": "^2.5.2",
|
|
||||||
"webpack": "^3.6.0",
|
|
||||||
"webpack-bundle-analyzer": "^2.9.0",
|
|
||||||
"webpack-dev-server": "^2.9.1",
|
|
||||||
"webpack-merge": "^4.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 6.0.0",
|
|
||||||
"npm": ">= 3.0.0"
|
|
||||||
},
|
|
||||||
"browserslist": [
|
|
||||||
"> 1%",
|
|
||||||
"last 2 versions",
|
|
||||||
"not ie <= 8"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div id="app">
|
|
||||||
<router-view></router-view>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'App',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.el-input {
|
|
||||||
width: 180px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,108 +0,0 @@
|
|||||||
html, body, #app {
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-card {
|
|
||||||
margin-top: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-pagination {
|
|
||||||
margin-top: 45px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-table {
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-left {
|
|
||||||
float: left;
|
|
||||||
padding: 20px;
|
|
||||||
margin-top: -10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 标签 */
|
|
||||||
.el-tag {
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-title {
|
|
||||||
color: cornflowerblue;
|
|
||||||
float: left;
|
|
||||||
margin: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.create-btn {
|
|
||||||
float: right;
|
|
||||||
margin-top: -5px;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small-input {
|
|
||||||
width: 150px;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search {
|
|
||||||
float: left;
|
|
||||||
margin-top: 80px;
|
|
||||||
margin-left: -100px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.create {
|
|
||||||
float: right;
|
|
||||||
margin-right: 20px;
|
|
||||||
margin-top: 80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mid-input {
|
|
||||||
width: 240px;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-mid-input {
|
|
||||||
width: 240px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logout {
|
|
||||||
float: right;
|
|
||||||
margin-right: 30px;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-first-card {
|
|
||||||
margin: 20px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-form-item {
|
|
||||||
margin-left: 30%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.create-dialog-btn {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.long-text {
|
|
||||||
margin-left: 20%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.long-text-input {
|
|
||||||
float: left;
|
|
||||||
width: 400px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-time-select {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.detail {
|
|
||||||
margin-top: 40px;
|
|
||||||
text-align: center;
|
|
||||||
color: cornflowerblue;
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 3.3 MiB |
|
Before Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 48 KiB |
@ -1,204 +0,0 @@
|
|||||||
<!--
|
|
||||||
* 登录页面
|
|
||||||
*
|
|
||||||
* @Author: ShanZhu
|
|
||||||
* @Date: 2024-01-24
|
|
||||||
-->
|
|
||||||
<template>
|
|
||||||
<div class="whole">
|
|
||||||
<div class="login">
|
|
||||||
<div class="title" style="color: #ff6a00">
|
|
||||||
<img src="../assets/imgs/logo.png" style="width: 40px;position: relative; top: 13px;right: 0px"/>
|
|
||||||
<span style="font-size: 20px">鲜花管理系统</span>
|
|
||||||
</div>
|
|
||||||
<div class="my-form">
|
|
||||||
<el-form :model="loginForm" status-icon size="small">
|
|
||||||
<el-form-item prop="account">
|
|
||||||
<el-input type="text" prefix-icon="el-icon-user-solid" v-model="loginForm.account"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item prop="password">
|
|
||||||
<el-input type="password" prefix-icon="el-icon-s-cooperation" v-model="loginForm.password"
|
|
||||||
autocomplete="off"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item class="btns">
|
|
||||||
<el-radio v-model="loginForm.role" label="user">用户</el-radio>
|
|
||||||
<el-radio v-model="loginForm.role" label="admin">管理员</el-radio>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item class="btns">
|
|
||||||
<el-button type="primary" @click="login()">登录</el-button>
|
|
||||||
<el-button type="warning" @click="reset()">重置</el-button>
|
|
||||||
<el-button type="success" @click="create">注册</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 注册 -->
|
|
||||||
<div >
|
|
||||||
<el-dialog
|
|
||||||
title="注册用户"
|
|
||||||
:visible.sync="createDialogVisible"
|
|
||||||
width="30%"
|
|
||||||
center
|
|
||||||
>
|
|
||||||
<div >
|
|
||||||
<el-form :model="addUser" label-width="80px" size="small">
|
|
||||||
|
|
||||||
<el-form-item label="账号">
|
|
||||||
<el-input class="mid-input" v-model="addUser.account"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="姓名">
|
|
||||||
<el-input class="mid-input" v-model="addUser.name"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="密码">
|
|
||||||
<el-input class="mid-input" v-model="addUser.password"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="手机号">
|
|
||||||
<el-input class="mid-input" type="number" v-model="addUser.phone"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="地址">
|
|
||||||
<el-input class="mid-input" v-model="addUser.address"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<div class="create-dialog-btn">
|
|
||||||
<el-button type="primary" @click="doCreate">注册</el-button>
|
|
||||||
<el-button type="warning" @click="cancel">取消</el-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// import backImg from '../assets/imgs/1.jpg'
|
|
||||||
export default {
|
|
||||||
name: 'Login',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
createDialogVisible: false,
|
|
||||||
addUser: {
|
|
||||||
account: '',
|
|
||||||
name: '',
|
|
||||||
password: '',
|
|
||||||
phone: '',
|
|
||||||
address: ''
|
|
||||||
},
|
|
||||||
loginForm: {
|
|
||||||
account: '',
|
|
||||||
password: '',
|
|
||||||
role: 'user',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
changePage(path) {
|
|
||||||
this.$router.push(path)
|
|
||||||
},
|
|
||||||
create() {
|
|
||||||
this.reset();
|
|
||||||
this.createDialogVisible = true;
|
|
||||||
},
|
|
||||||
verify(user) {
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
doCreate() {
|
|
||||||
let flag = this.verify(this.addUser);
|
|
||||||
if (flag) {
|
|
||||||
this.$http.post("/user/create", this.addUser).then(result => {
|
|
||||||
let R = result.data; // R
|
|
||||||
if (R.code === 2000) {
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.refresh(1);
|
|
||||||
} else {
|
|
||||||
this.$message.error(R.msg);
|
|
||||||
}
|
|
||||||
this.createDialogVisible = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cancel() {
|
|
||||||
this.createDialogVisible = false;
|
|
||||||
},
|
|
||||||
login() {
|
|
||||||
this.$http.post("/login/doLogin", this.loginForm).then(result => {
|
|
||||||
// 返回的 result.data = 后端的 R
|
|
||||||
let R = result.data;
|
|
||||||
let user = R.data;
|
|
||||||
if (R.code === 2000) {
|
|
||||||
window.sessionStorage.setItem('token', user.account);// 存了 account
|
|
||||||
window.sessionStorage.setItem('role', user.role);// 存了 account
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
if (user.role === 'admin') {
|
|
||||||
this.$router.push('/home');
|
|
||||||
} else if (user.role === 'user') {
|
|
||||||
this.$router.push('/user');
|
|
||||||
} else {
|
|
||||||
this.$router.push('/404');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.$message.error(R.msg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
reset() {
|
|
||||||
this.loginForm = {
|
|
||||||
account: '',
|
|
||||||
password: '',
|
|
||||||
role: 'user',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
body{
|
|
||||||
|
|
||||||
}
|
|
||||||
.whole {
|
|
||||||
background-image: url("~@/assets/imgs/bghalf-2.jpg") ;
|
|
||||||
background-size:100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login {
|
|
||||||
width: 450px;
|
|
||||||
height: 300px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 3px;
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
top: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
opacity: 0.95;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-form {
|
|
||||||
margin-top: 75px;
|
|
||||||
width: 300px;
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
top: 36%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btns {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
margin-top: 20px;
|
|
||||||
text-align: center;
|
|
||||||
color: dodgerblue;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-form-item {
|
|
||||||
margin-left: 5%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,161 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="whole">
|
|
||||||
<el-container>
|
|
||||||
<el-header><div><b style="float: left;margin-top: -20px"><h2 style="color: #c09494">鲜花后台管理系统</h2></b>
|
|
||||||
|
|
||||||
<el-button class="logout" type="warning" @click="logout">退出</el-button>
|
|
||||||
</div></el-header>
|
|
||||||
<el-container>
|
|
||||||
<el-aside width="200px">
|
|
||||||
<!-- #575757 -->
|
|
||||||
<el-menu
|
|
||||||
router
|
|
||||||
default-active="index"
|
|
||||||
class="el-menu-vertical-demo"
|
|
||||||
background-color="#545c64"
|
|
||||||
text-color="#fff"
|
|
||||||
active-text-color="#c09494">
|
|
||||||
|
|
||||||
<el-menu-item index="index">
|
|
||||||
<i class="el-icon-menu"></i>
|
|
||||||
网站首页
|
|
||||||
</el-menu-item>
|
|
||||||
|
|
||||||
<el-menu-item index="users">
|
|
||||||
<i class="el-icon-document"></i>
|
|
||||||
<span>用户管理</span>
|
|
||||||
</el-menu-item>
|
|
||||||
|
|
||||||
<el-menu-item index="flowers">
|
|
||||||
<i class="el-icon-document"></i>
|
|
||||||
<span>商品管理</span>
|
|
||||||
</el-menu-item>
|
|
||||||
|
|
||||||
<el-menu-item index="flower_type">
|
|
||||||
<i class="el-icon-document"></i>
|
|
||||||
<span>种类管理</span>
|
|
||||||
</el-menu-item>
|
|
||||||
|
|
||||||
<el-menu-item index="orders">
|
|
||||||
<i class="el-icon-document"></i>
|
|
||||||
<span>订单管理</span>
|
|
||||||
</el-menu-item>
|
|
||||||
|
|
||||||
</el-menu>
|
|
||||||
</el-aside>
|
|
||||||
<el-container>
|
|
||||||
<!-- 主体区域 -->
|
|
||||||
<el-main>
|
|
||||||
<router-view></router-view>
|
|
||||||
</el-main>
|
|
||||||
</el-container>
|
|
||||||
</el-container>
|
|
||||||
|
|
||||||
</el-container>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'App',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
activeIndex: 1,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
changePage(path) {
|
|
||||||
this.$router.push(path)
|
|
||||||
},
|
|
||||||
logout(){
|
|
||||||
this.$router.push('/login');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.whole {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.el-header, .el-footer {
|
|
||||||
background-color: #B3C0D1;
|
|
||||||
color: #333;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-aside {
|
|
||||||
background-color: #D3DCE6;
|
|
||||||
color: #333;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-menu {
|
|
||||||
border-right: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-main {
|
|
||||||
background-color: #E9EEF3;
|
|
||||||
color: #333;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body > .el-container {
|
|
||||||
margin-bottom: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-container:nth-child(5) .el-aside,
|
|
||||||
.el-container:nth-child(6) .el-aside {
|
|
||||||
line-height: 260px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-container .el-aside {
|
|
||||||
line-height: 320px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-menu {
|
|
||||||
position: absolute;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main {
|
|
||||||
height: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-container {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-header {
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-aside {
|
|
||||||
height: 100%;
|
|
||||||
background-color: #545c64;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-main {
|
|
||||||
background-color: #efe8e8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-child-item {
|
|
||||||
margin-left: 20px;
|
|
||||||
}
|
|
||||||
.el-footer {
|
|
||||||
background-color: cornflowerblue;
|
|
||||||
}
|
|
||||||
.welcome {
|
|
||||||
float: left;
|
|
||||||
|
|
||||||
color: cornflowerblue;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,194 +0,0 @@
|
|||||||
<!--
|
|
||||||
* 订单管理页面
|
|
||||||
*
|
|
||||||
* @Author: ShanZhu
|
|
||||||
* @Date: 2024-01-24
|
|
||||||
-->
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!-- 操作面板 -->
|
|
||||||
<el-card>
|
|
||||||
<div>
|
|
||||||
<h2 class="my-title">订单管理</h2>
|
|
||||||
</div>
|
|
||||||
<div class="search">
|
|
||||||
<el-input v-model="searchKey" style="width: 240px" @keyup.enter.native="refresh(1)"
|
|
||||||
placeholder="商品名称"></el-input>
|
|
||||||
<el-button type="primary" icon="el-icon-search" @click="refresh(1)">搜索</el-button>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
<!-- 表格面板 -->
|
|
||||||
<el-card>
|
|
||||||
<el-table
|
|
||||||
:data="list"
|
|
||||||
class="my-el-table"
|
|
||||||
>
|
|
||||||
<el-table-column
|
|
||||||
label="#"
|
|
||||||
type="index"
|
|
||||||
width="150">
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="username"
|
|
||||||
label="买家"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="flower"
|
|
||||||
label="商品"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="amount"
|
|
||||||
label="数量"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="price"
|
|
||||||
label="价格(元)"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="phone"
|
|
||||||
label="联系电话"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="address"
|
|
||||||
label="地址"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
label="状态"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-switch
|
|
||||||
v-model="scope.row.state === 1"
|
|
||||||
@change="changeState(scope.row)"
|
|
||||||
>
|
|
||||||
</el-switch>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
label="操作"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-popconfirm
|
|
||||||
title="确定删除吗?"
|
|
||||||
@confirm="doDelete"
|
|
||||||
>
|
|
||||||
<el-button type="danger" slot="reference" @click="del(scope.row.id)">删除</el-button>
|
|
||||||
</el-popconfirm>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<div>
|
|
||||||
<el-pagination
|
|
||||||
background
|
|
||||||
layout="prev, pager, next"
|
|
||||||
:total="pagination.total"
|
|
||||||
:page-size="pagination.pageSize"
|
|
||||||
:current-page="pagination.currentPage"
|
|
||||||
@current-change="pageChange">
|
|
||||||
</el-pagination>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
searchKey: '',
|
|
||||||
accounts: [],
|
|
||||||
list: [],
|
|
||||||
delId: 0,
|
|
||||||
pagination: {
|
|
||||||
total: 1,
|
|
||||||
pageSize: 5,
|
|
||||||
currentPage: 1,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
pageChange(page) {
|
|
||||||
this.refresh(page);
|
|
||||||
},
|
|
||||||
|
|
||||||
changeState(order) {
|
|
||||||
let obj = {
|
|
||||||
id: order.id,
|
|
||||||
state: order.state===0?1:0
|
|
||||||
};
|
|
||||||
this.$http.put("/order/changeState", obj).then(result => {
|
|
||||||
let R = result.data; // R
|
|
||||||
if (R.code === 2000) {
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.refresh(this.pagination.currentPage);
|
|
||||||
} else {
|
|
||||||
this.$message.error(R.msg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
refresh(page) {
|
|
||||||
if (page === undefined) {
|
|
||||||
page = 1;
|
|
||||||
}
|
|
||||||
this.$http.get("/order/findAll?page=" + page + "&searchKey=" + this.searchKey ).then(result => {
|
|
||||||
let R = result.data;
|
|
||||||
this.list = R.data.items;
|
|
||||||
this.pagination.total = R.data.len;
|
|
||||||
this.pagination.currentPage = page;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
del(id) {
|
|
||||||
this.delId = id;
|
|
||||||
},
|
|
||||||
doDelete() {
|
|
||||||
this.$http.delete("/order/delete?id=" + this.delId).then(result => {
|
|
||||||
let R = result.data;
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.refresh(1);
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.search-input {
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.updateForm {
|
|
||||||
width: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-release {
|
|
||||||
float: right;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-right: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-releaseTask {
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-content-task {
|
|
||||||
width: 500px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,274 +0,0 @@
|
|||||||
<!--
|
|
||||||
* 鲜花类型管理
|
|
||||||
*
|
|
||||||
* @Author: ShanZhu
|
|
||||||
* @Date: 2024-01-24
|
|
||||||
-->
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!-- 操作面板 -->
|
|
||||||
<el-card>
|
|
||||||
<div>
|
|
||||||
<h2 class="my-title">类型管理</h2>
|
|
||||||
</div>
|
|
||||||
<div class="search">
|
|
||||||
<el-input v-model="param" style="width: 240px" @keyup.enter.native="refresh(1)"
|
|
||||||
placeholder="名称"></el-input>
|
|
||||||
<el-button type="primary" icon="el-icon-search" @click="refresh(1)">搜索</el-button>
|
|
||||||
</div>
|
|
||||||
<div class="create">
|
|
||||||
<el-button type="success" @click="create">新建类型</el-button>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
<!-- 表格面板 -->
|
|
||||||
<el-card>
|
|
||||||
<el-table
|
|
||||||
:data="list"
|
|
||||||
>
|
|
||||||
<el-table-column
|
|
||||||
label="#"
|
|
||||||
type="index"
|
|
||||||
align="center"
|
|
||||||
width="50">
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="species_name"
|
|
||||||
label="名称"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
label="操作"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button type="primary" @click="update(scope.row)">修改</el-button>
|
|
||||||
<el-popconfirm
|
|
||||||
title="确定删除吗?"
|
|
||||||
@confirm="doDelete"
|
|
||||||
>
|
|
||||||
<el-button type="danger" slot="reference" @click="del(scope.row.id)">删除</el-button>
|
|
||||||
</el-popconfirm>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<!-- 分页 -->
|
|
||||||
<div>
|
|
||||||
<el-pagination
|
|
||||||
background
|
|
||||||
layout="prev, pager, next"
|
|
||||||
:total="pagination.total"
|
|
||||||
:page-size="pagination.pageSize"
|
|
||||||
:current-page="pagination.currentPage"
|
|
||||||
@current-change="pageChange">
|
|
||||||
</el-pagination>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
<!-- 修改 -->
|
|
||||||
<div>
|
|
||||||
<el-dialog
|
|
||||||
title="修改类型信息"
|
|
||||||
:visible.sync="updateDialogVisible"
|
|
||||||
width="50%"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<el-form :model="updateSpecies" label-width="80px" size="small">
|
|
||||||
|
|
||||||
<el-form-item label="">
|
|
||||||
<el-input class="small-input" type="hidden" v-model="updateSpecies.id"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="类型">
|
|
||||||
<el-input class="small-input" v-model="updateSpecies.species_name"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<div class="create-dialog-btn">
|
|
||||||
<el-button type="primary" @click="doUpdate">保存</el-button>
|
|
||||||
<el-button type="warning" @click="cancel">取消</el-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
<!-- 新增 -->
|
|
||||||
<div>
|
|
||||||
<el-dialog
|
|
||||||
title="新建类型"
|
|
||||||
:visible.sync="createDialogVisible"
|
|
||||||
width="50%"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<el-form :model="addSpecies" label-width="80px" size="small">
|
|
||||||
|
|
||||||
<el-form-item label="类型">
|
|
||||||
<el-input class="small-input" v-model="addSpecies.species_name"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<div class="create-dialog-btn">
|
|
||||||
<el-button type="primary" @click="doCreate">保存</el-button>
|
|
||||||
<el-button type="warning" @click="cancel">取消</el-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
param: '',
|
|
||||||
updateDialogVisible: false,
|
|
||||||
createDialogVisible: false,
|
|
||||||
updateSpecies: {
|
|
||||||
id: '',
|
|
||||||
species_name: '',
|
|
||||||
},
|
|
||||||
addSpecies: {
|
|
||||||
id: 0,
|
|
||||||
species_name: '',
|
|
||||||
},
|
|
||||||
leader_accounts: [],
|
|
||||||
list: [],
|
|
||||||
delId: 0,
|
|
||||||
pagination: {
|
|
||||||
total: 1,
|
|
||||||
pageSize: 5,
|
|
||||||
currentPage: 1,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
cancel() {
|
|
||||||
this.updateDialogVisible = false;
|
|
||||||
this.createDialogVisible = false;
|
|
||||||
},
|
|
||||||
update(row) {
|
|
||||||
this.updateDialogVisible = true;
|
|
||||||
this.updateSpecies.id = row.id;
|
|
||||||
this.updateSpecies.species_name = row.species_name;
|
|
||||||
},
|
|
||||||
|
|
||||||
doUpdate() {
|
|
||||||
this.$http.put("/species/update", this.updateSpecies).then(result => {
|
|
||||||
let R = result.data; // R
|
|
||||||
if (R.code === 2000) {
|
|
||||||
this.updateDialogVisible = false;
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.refresh(this.pagination.currentPage);
|
|
||||||
} else {
|
|
||||||
this.$message.error(R.msg);
|
|
||||||
}
|
|
||||||
this.updateDialogVisible = false;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
del(id) {
|
|
||||||
this.delId = id;
|
|
||||||
},
|
|
||||||
doDelete() {
|
|
||||||
this.$http.delete("/species/delete?id=" + this.delId).then(result => {
|
|
||||||
let R = result.data; // R
|
|
||||||
if (R.code === 2000) {
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.refresh(1);
|
|
||||||
} else {
|
|
||||||
this.$message.error(R.msg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
create() {
|
|
||||||
this.reset();
|
|
||||||
this.createDialogVisible = true;
|
|
||||||
},
|
|
||||||
|
|
||||||
verify() {
|
|
||||||
if (this.addSpecies.species_name === undefined || this.addSpecies.species_name.length < 2) {
|
|
||||||
this.$message.warning('类型名称至少为 2 个字符,请修改');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
|
|
||||||
reset() {
|
|
||||||
this.addSpecies = {
|
|
||||||
account: '',
|
|
||||||
password: '',
|
|
||||||
name: '',
|
|
||||||
phone: '',
|
|
||||||
address: ''
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
doCreate() {
|
|
||||||
let flag = this.verify();
|
|
||||||
if (flag) {
|
|
||||||
this.$http.post("/species/create", this.addSpecies).then(result => {
|
|
||||||
let R = result.data; // R
|
|
||||||
if (R.code === 2000) {
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.createDialogVisible = false;
|
|
||||||
this.refresh(1);
|
|
||||||
} else {
|
|
||||||
this.$message.error(R.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
pageChange(page) {
|
|
||||||
this.refresh(page);
|
|
||||||
},
|
|
||||||
|
|
||||||
refresh(page) {
|
|
||||||
if (page === undefined) {
|
|
||||||
page = 1;
|
|
||||||
}
|
|
||||||
//window.sessionStorage.getItem('token')
|
|
||||||
this.$http.get("/species/find?page=" + page + "&searchKey=" + this.param).then(result => {
|
|
||||||
let R = result.data;
|
|
||||||
this.list = R.data.items;
|
|
||||||
this.pagination.total = R.data.len * this.pagination.pageSize;
|
|
||||||
this.pagination.currentPage = page;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.search-input {
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.updateForm {
|
|
||||||
width: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-release {
|
|
||||||
float: right;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-right: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-releaseTask {
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-content-task {
|
|
||||||
width: 500px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-el-table {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,336 +0,0 @@
|
|||||||
<!--
|
|
||||||
* 用户管理
|
|
||||||
*
|
|
||||||
* @Author: ShanZhu
|
|
||||||
* @Date: 2024-01-24
|
|
||||||
-->
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!-- 操作面板 -->
|
|
||||||
<el-card>
|
|
||||||
<div>
|
|
||||||
<h2 class="my-title">用户管理</h2>
|
|
||||||
</div>
|
|
||||||
<div class="search">
|
|
||||||
<el-input v-model="param" style="width: 240px" @keyup.enter.native="refresh(1)"
|
|
||||||
placeholder="账号 / 姓名"></el-input>
|
|
||||||
<el-button type="primary" icon="el-icon-search" @click="refresh(1)">搜索</el-button>
|
|
||||||
</div>
|
|
||||||
<div class="create">
|
|
||||||
<el-button type="success" @click="create">新建用户</el-button>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
<!-- 表格面板 -->
|
|
||||||
<el-card>
|
|
||||||
<el-table
|
|
||||||
:data="list"
|
|
||||||
>
|
|
||||||
<el-table-column
|
|
||||||
label="#"
|
|
||||||
type="index"
|
|
||||||
align="center"
|
|
||||||
width="50">
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="account"
|
|
||||||
label="账号"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="name"
|
|
||||||
label="姓名"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="password"
|
|
||||||
label="密码"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="phone"
|
|
||||||
label="电话"
|
|
||||||
width="150"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="address"
|
|
||||||
label="地址"
|
|
||||||
width="300"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
label="操作"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button type="primary" @click="update(scope.row)">修改</el-button>
|
|
||||||
<el-popconfirm
|
|
||||||
title="确定删除吗?"
|
|
||||||
@confirm="doDelete"
|
|
||||||
>
|
|
||||||
<el-button type="danger" slot="reference" @click="del(scope.row.id)">删除</el-button>
|
|
||||||
</el-popconfirm>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<!-- 分页 -->
|
|
||||||
<div>
|
|
||||||
<el-pagination
|
|
||||||
background
|
|
||||||
layout="prev, pager, next"
|
|
||||||
:total="pagination.total"
|
|
||||||
:page-size="pagination.pageSize"
|
|
||||||
:current-page="pagination.currentPage"
|
|
||||||
@current-change="pageChange">
|
|
||||||
</el-pagination>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
<!-- 修改 -->
|
|
||||||
<div>
|
|
||||||
<el-dialog
|
|
||||||
title="修改用户信息"
|
|
||||||
:visible.sync="updateDialogVisible"
|
|
||||||
width="50%"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<el-form :model="updateUser" label-width="80px" size="small">
|
|
||||||
|
|
||||||
<el-form-item label="">
|
|
||||||
<el-input class="small-input" type="hidden" v-model="updateUser.id"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="账号">
|
|
||||||
<el-input class="small-input" readonly="readonly" v-model="updateUser.account"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="姓名">
|
|
||||||
<el-input class="small-input" v-model="updateUser.name"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="密码">
|
|
||||||
<el-input class="small-input" v-model="updateUser.password"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="手机号">
|
|
||||||
<el-input class="small-input" type="number" v-model="updateUser.phone"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="地址">
|
|
||||||
<el-input class="small-input" v-model="updateUser.address"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<div class="create-dialog-btn">
|
|
||||||
<el-button type="primary" @click="doUpdate">保存</el-button>
|
|
||||||
<el-button type="warning" @click="cancel">取消</el-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
<!-- 新增 -->
|
|
||||||
<div>
|
|
||||||
<el-dialog
|
|
||||||
title="新建用户"
|
|
||||||
:visible.sync="createDialogVisible"
|
|
||||||
width="50%"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<el-form :model="addUser" label-width="80px" size="small">
|
|
||||||
|
|
||||||
<el-form-item label="账号">
|
|
||||||
<el-input class="small-input" v-model="addUser.account"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="姓名">
|
|
||||||
<el-input class="small-input" v-model="addUser.name"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="密码">
|
|
||||||
<el-input class="small-input" v-model="addUser.password"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="手机号">
|
|
||||||
<el-input class="small-input" type="number" v-model="addUser.phone"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="地址">
|
|
||||||
<el-input class="small-input" v-model="addUser.address"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<div class="create-dialog-btn">
|
|
||||||
<el-button type="primary" @click="doCreate">保存</el-button>
|
|
||||||
<el-button type="warning" @click="cancel">取消</el-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
param: '',
|
|
||||||
createDialogVisible: false,
|
|
||||||
updateDialogVisible: false,
|
|
||||||
updateUser: {
|
|
||||||
id: '',
|
|
||||||
account: '',
|
|
||||||
name: '',
|
|
||||||
password: '',
|
|
||||||
phone: '',
|
|
||||||
address: ''
|
|
||||||
},
|
|
||||||
addUser: {
|
|
||||||
account: '',
|
|
||||||
name: '',
|
|
||||||
password: '',
|
|
||||||
phone: '',
|
|
||||||
address: ''
|
|
||||||
},
|
|
||||||
list: [],
|
|
||||||
delId: 0,
|
|
||||||
pagination: {
|
|
||||||
total: 1,
|
|
||||||
pageSize: 5,
|
|
||||||
currentPage: 1,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
cancel() {
|
|
||||||
this.updateDialogVisible = false;
|
|
||||||
this.createDialogVisible = false;
|
|
||||||
},
|
|
||||||
update(row) {
|
|
||||||
this.updateDialogVisible = true;
|
|
||||||
this.updateUser = row;
|
|
||||||
},
|
|
||||||
|
|
||||||
doUpdate() {
|
|
||||||
this.$http.put("/user/update", this.updateUser).then(result => {
|
|
||||||
let R = result.data; // R
|
|
||||||
if (R.code === 2000) {
|
|
||||||
this.updateDialogVisible = false;
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.refresh(this.pagination.currentPage);
|
|
||||||
} else {
|
|
||||||
this.$message.error(R.msg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
del(id) {
|
|
||||||
this.delId = id;
|
|
||||||
},
|
|
||||||
doDelete() {
|
|
||||||
this.$http.delete("/user/delete?id=" + this.delId).then(result => {
|
|
||||||
let R = result.data; // R
|
|
||||||
if (R.code === 2000) {
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.refresh(1);
|
|
||||||
} else {
|
|
||||||
this.$message.error(R.msg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
create() {
|
|
||||||
this.reset();
|
|
||||||
this.createDialogVisible = true;
|
|
||||||
},
|
|
||||||
|
|
||||||
verify(user) {
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
|
|
||||||
reset() {
|
|
||||||
this.addUser = {
|
|
||||||
account: '',
|
|
||||||
password: '',
|
|
||||||
name: '',
|
|
||||||
phone: '',
|
|
||||||
address: ''
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
doCreate() {
|
|
||||||
let flag = this.verify(this.addUser);
|
|
||||||
if (flag) {
|
|
||||||
this.$http.post("/user/create", this.addUser).then(result => {
|
|
||||||
let R = result.data; // R
|
|
||||||
if (R.code === 2000) {
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.createDialogVisible = false;
|
|
||||||
this.refresh(1);
|
|
||||||
} else {
|
|
||||||
this.$message.error(R.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
pageChange(page) {
|
|
||||||
this.refresh(page);
|
|
||||||
},
|
|
||||||
|
|
||||||
refresh(page) {
|
|
||||||
if (page === undefined) {
|
|
||||||
page = 1;
|
|
||||||
}
|
|
||||||
//window.sessionStorage.getItem('token')
|
|
||||||
this.$http.get("/user/find?page=" + page + "&searchKey=" + this.param).then(result => {
|
|
||||||
let R = result.data;
|
|
||||||
this.list = R.data.items;
|
|
||||||
this.pagination.total = R.data.len * this.pagination.pageSize;
|
|
||||||
this.pagination.currentPage = page;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.search-input {
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.updateForm {
|
|
||||||
width: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-release {
|
|
||||||
float: right;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-right: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-releaseTask {
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-content-task {
|
|
||||||
width: 500px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-el-table {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,168 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="whole">
|
|
||||||
<el-container>
|
|
||||||
<el-header>
|
|
||||||
<div><b style="float: left;margin-top: -20px"><h2 style="color: #d79797">鲜花管理系统</h2></b>
|
|
||||||
<el-button class="logout" type="warning" @click="logout">退出</el-button>
|
|
||||||
</div>
|
|
||||||
</el-header>
|
|
||||||
<el-container>
|
|
||||||
<el-aside width="200px">
|
|
||||||
<el-menu
|
|
||||||
router
|
|
||||||
:default-active="defaultUrl"
|
|
||||||
class="el-menu-vertical-demo"
|
|
||||||
background-color="#545c64"
|
|
||||||
text-color="#fff"
|
|
||||||
active-text-color="#d79797"
|
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
<el-menu-item index="goods">
|
|
||||||
<i class="el-icon-menu"></i>
|
|
||||||
商品列表
|
|
||||||
</el-menu-item>
|
|
||||||
|
|
||||||
<el-menu-item index="cart">
|
|
||||||
<i class="el-icon-document"></i>
|
|
||||||
<span>购物车</span>
|
|
||||||
</el-menu-item>
|
|
||||||
|
|
||||||
<el-menu-item index="order">
|
|
||||||
<i class="el-icon-document"></i>
|
|
||||||
<span>我的订单</span>
|
|
||||||
</el-menu-item>
|
|
||||||
|
|
||||||
<el-menu-item index="updateInfo">
|
|
||||||
<i class="el-icon-document"></i>
|
|
||||||
<span>个人信息</span>
|
|
||||||
</el-menu-item>
|
|
||||||
|
|
||||||
</el-menu>
|
|
||||||
</el-aside>
|
|
||||||
<el-container>
|
|
||||||
<!-- 主体区域 -->
|
|
||||||
<el-main>
|
|
||||||
<router-view></router-view>
|
|
||||||
</el-main>
|
|
||||||
</el-container>
|
|
||||||
</el-container>
|
|
||||||
|
|
||||||
</el-container>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
activeIndex: 1,
|
|
||||||
defaultUrl: 'goods',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 监听路由变化
|
|
||||||
watch: {
|
|
||||||
'$route': 'getPath'
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getPath() {
|
|
||||||
this.defaultUrl = this.$route.path.replace('/', '');
|
|
||||||
console.log(this.defaultUrl)
|
|
||||||
},
|
|
||||||
changePage(path) {
|
|
||||||
this.$router.push(path)
|
|
||||||
},
|
|
||||||
logout() {
|
|
||||||
this.$router.push('/login');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.whole {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.el-header, .el-footer {
|
|
||||||
background-color: #B3C0D1;
|
|
||||||
color: #333;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-aside {
|
|
||||||
background-color: #D3DCE6;
|
|
||||||
color: #333;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-menu {
|
|
||||||
border-right: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-main {
|
|
||||||
background-color: #E9EEF3;
|
|
||||||
color: #333;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body > .el-container {
|
|
||||||
margin-bottom: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-container:nth-child(5) .el-aside,
|
|
||||||
.el-container:nth-child(6) .el-aside {
|
|
||||||
line-height: 260px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-container .el-aside {
|
|
||||||
line-height: 320px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-menu {
|
|
||||||
position: absolute;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main {
|
|
||||||
height: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-container {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-header {
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-aside {
|
|
||||||
height: 100%;
|
|
||||||
background-color: #545c64;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-main {
|
|
||||||
background-color: #efe8e8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-child-item {
|
|
||||||
margin-left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-footer {
|
|
||||||
background-color: cornflowerblue;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome {
|
|
||||||
float: left;
|
|
||||||
|
|
||||||
color: cornflowerblue;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,156 +0,0 @@
|
|||||||
<!--
|
|
||||||
* 购物车挂历页面
|
|
||||||
*
|
|
||||||
* @Author: ShanZhu
|
|
||||||
* @Date: 2024-01-24
|
|
||||||
-->
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!-- 操作面板 -->
|
|
||||||
<el-card>
|
|
||||||
<div>
|
|
||||||
<h2 class="my-title" style="margin-bottom: 20px">我的购物车</h2>
|
|
||||||
<el-popconfirm
|
|
||||||
:title="orderMsg"
|
|
||||||
@confirm="doBuy"
|
|
||||||
>
|
|
||||||
<el-button class="buy" type="primary" slot="reference" @click="buy()">下单</el-button>
|
|
||||||
</el-popconfirm>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</el-card>
|
|
||||||
<!-- 表格面板 -->
|
|
||||||
<el-card>
|
|
||||||
<el-table
|
|
||||||
:data="list"
|
|
||||||
class="my-el-table"
|
|
||||||
>
|
|
||||||
<el-table-column
|
|
||||||
label="#"
|
|
||||||
type="index"
|
|
||||||
width="150">
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="flower"
|
|
||||||
label="商品"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="amount"
|
|
||||||
label="数量"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="price"
|
|
||||||
label="价格(元)"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
label="操作"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-popconfirm
|
|
||||||
title="确定删除吗?"
|
|
||||||
@confirm="doDelete"
|
|
||||||
>
|
|
||||||
<el-button type="danger" slot="reference" @click="del(scope.row.id)">删除</el-button>
|
|
||||||
</el-popconfirm>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
list: [],
|
|
||||||
orderMsg: '',
|
|
||||||
delId: 0,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
pageChange(page) {
|
|
||||||
this.refresh(page);
|
|
||||||
},
|
|
||||||
|
|
||||||
refresh(page) {
|
|
||||||
if (page === undefined) {
|
|
||||||
page = 1;
|
|
||||||
}
|
|
||||||
//window.sessionStorage.getItem('token')
|
|
||||||
this.$http.get("/cart/queryByAccount?account=" + window.sessionStorage.getItem('token')).then(result => {
|
|
||||||
let R = result.data;
|
|
||||||
this.list = R.data;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
del(id){
|
|
||||||
this.delId = id;
|
|
||||||
},
|
|
||||||
buy(){
|
|
||||||
let amount = 0;
|
|
||||||
for (let i = 0; i < this.list.length; i++) {
|
|
||||||
amount = amount + this.list[i].price;
|
|
||||||
}
|
|
||||||
this.orderMsg = '总计 ' + amount +' 元,确认购买?';
|
|
||||||
},
|
|
||||||
doDelete(){
|
|
||||||
this.$http.delete("/cart/delete?id=" + this.delId).then(result => {
|
|
||||||
let R = result.data;
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.refresh(1);
|
|
||||||
})
|
|
||||||
},
|
|
||||||
doBuy(){
|
|
||||||
this.$http.get("/cart/buy?account=" + window.sessionStorage.getItem("token")).then(result => {
|
|
||||||
let R = result.data;
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.refresh(1);
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.buy{
|
|
||||||
float: right;
|
|
||||||
margin-right: 20px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
.search-input {
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.updateForm {
|
|
||||||
width: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-release {
|
|
||||||
float: right;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-right: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-releaseTask {
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-content-task {
|
|
||||||
width: 500px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,148 +0,0 @@
|
|||||||
<!--
|
|
||||||
* 我的订单
|
|
||||||
*
|
|
||||||
* @Author: ShanZhu
|
|
||||||
* @Date: 2024-01-24
|
|
||||||
-->
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!-- 操作面板 -->
|
|
||||||
<el-card>
|
|
||||||
<div>
|
|
||||||
<h2 class="my-title">我的订单</h2>
|
|
||||||
</div>
|
|
||||||
<div class="search">
|
|
||||||
<el-input v-model="searchKey" style="width: 240px" @keyup.enter.native="refresh(1)"
|
|
||||||
placeholder="账号 / 姓名"></el-input>
|
|
||||||
<el-button type="primary" icon="el-icon-search" @click="refresh(1)">搜索</el-button>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
<!-- 表格面板 -->
|
|
||||||
<el-card>
|
|
||||||
<el-table
|
|
||||||
:data="list"
|
|
||||||
class="my-el-table"
|
|
||||||
>
|
|
||||||
<el-table-column
|
|
||||||
label="#"
|
|
||||||
type="index"
|
|
||||||
width="150">
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="flower"
|
|
||||||
label="商品"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="amount"
|
|
||||||
label="数量"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
prop="price"
|
|
||||||
label="价格(元)"
|
|
||||||
>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
label="状态"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag v-if="scope.row.state === 1" type="success">已发货</el-tag>
|
|
||||||
<el-tag v-if="scope.row.state === 0" type="warning">未发货</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
label="操作"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-popconfirm
|
|
||||||
title="确定删除吗?"
|
|
||||||
@confirm="doDelete"
|
|
||||||
>
|
|
||||||
<el-button type="danger" slot="reference" @click="del(scope.row.id)">删除</el-button>
|
|
||||||
</el-popconfirm>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
</el-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
searchKey: '',
|
|
||||||
accounts: [],
|
|
||||||
list: [],
|
|
||||||
delId: 0,
|
|
||||||
pagination: {
|
|
||||||
total: 1,
|
|
||||||
pageSize: 5,
|
|
||||||
currentPage: 1,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
pageChange(page) {
|
|
||||||
this.refresh(page);
|
|
||||||
},
|
|
||||||
|
|
||||||
refresh(page) {
|
|
||||||
if (page === undefined) {
|
|
||||||
page = 1;
|
|
||||||
}
|
|
||||||
this.$http.get("/order/find?page=" + page + "&searchKey=" + this.searchKey + "&account=" + window.sessionStorage.getItem('token')).then(result => {
|
|
||||||
let res = result.data;
|
|
||||||
this.list = res.data.items;
|
|
||||||
this.pagination.total = res.data.len;
|
|
||||||
this.pagination.currentPage = page;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
del(id) {
|
|
||||||
this.delId = id;
|
|
||||||
},
|
|
||||||
doDelete() {
|
|
||||||
this.$http.delete("/order/delete?id=" + this.delId).then(result => {
|
|
||||||
let R = result.data;
|
|
||||||
this.$message.success(R.msg);
|
|
||||||
this.refresh(1);
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.search-input {
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.updateForm {
|
|
||||||
width: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-release {
|
|
||||||
float: right;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-right: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-releaseTask {
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-content-task {
|
|
||||||
width: 500px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,182 +0,0 @@
|
|||||||
<!--
|
|
||||||
* 个人信息修改页面
|
|
||||||
*
|
|
||||||
* @Author: ShanZhu
|
|
||||||
* @Date: 2024-01-24
|
|
||||||
-->
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<el-card>
|
|
||||||
<div class="info-first-card">
|
|
||||||
<h2 class="user-info-title">我的个人信息</h2>
|
|
||||||
<el-button class="save" @click="update" type="primary" style="margin-bottom: 20px">修改</el-button>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
<el-card class="box-card user-info-card">
|
|
||||||
<div>
|
|
||||||
<div class="user-info-data">
|
|
||||||
<el-form :model="user" label-width="120px">
|
|
||||||
<el-form-item label="姓名:">
|
|
||||||
{{user.name}}
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="账号:">
|
|
||||||
{{user.account}}
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="密码:">
|
|
||||||
{{user.password}}
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="手机:">
|
|
||||||
{{user.phone}}
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="地址:">
|
|
||||||
{{user.address}}
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<el-dialog
|
|
||||||
title="修改用户信息"
|
|
||||||
:visible.sync="updateDialogVisible"
|
|
||||||
width="50%"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<el-form :model="updateUser" label-width="80px" size="small">
|
|
||||||
|
|
||||||
<el-form-item label="">
|
|
||||||
<el-input class="small-input" type="hidden" v-model="updateUser.id"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="账号">
|
|
||||||
<el-input class="small-input" readonly="readonly" v-model="updateUser.account"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="姓名">
|
|
||||||
<el-input class="small-input" v-model="updateUser.name"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="密码">
|
|
||||||
<el-input class="small-input" v-model="updateUser.password"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="手机号">
|
|
||||||
<el-input class="small-input" type="number" v-model="updateUser.phone"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="地址">
|
|
||||||
<el-input class="small-input" v-model="updateUser.address"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<div class="create-dialog-btn">
|
|
||||||
<el-button type="primary" @click="doUpdate">保存</el-button>
|
|
||||||
<el-button type="warning" @click="cancel">取消</el-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
user: {
|
|
||||||
id: "",
|
|
||||||
account: window.sessionStorage.getItem('token'),
|
|
||||||
name: '',
|
|
||||||
password: '',
|
|
||||||
phone: '',
|
|
||||||
address: '',
|
|
||||||
},
|
|
||||||
updateDialogVisible: false,
|
|
||||||
updateUser: {
|
|
||||||
id: '',
|
|
||||||
account: '',
|
|
||||||
name: '',
|
|
||||||
password: '',
|
|
||||||
phone: '',
|
|
||||||
address: ''
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
cancel() {
|
|
||||||
this.updateDialogVisible = false;
|
|
||||||
this.createDialogVisible = false;
|
|
||||||
},
|
|
||||||
update() {
|
|
||||||
this.updateDialogVisible = true;
|
|
||||||
this.updateUser.id = this.user.id;
|
|
||||||
this.updateUser.name = this.user.name;
|
|
||||||
this.updateUser.account = this.user.account;
|
|
||||||
this.updateUser.password = this.user.password;
|
|
||||||
this.updateUser.phone = this.user.phone;
|
|
||||||
this.updateUser.address = this.user.address;
|
|
||||||
},
|
|
||||||
doUpdate() {
|
|
||||||
this.$http.put("/user/update", this.updateUser).then(res => {
|
|
||||||
let ans = res.data;
|
|
||||||
if (ans.code === 2000) {
|
|
||||||
this.freshPage();
|
|
||||||
this.updateDialogVisible = false;
|
|
||||||
this.$message.success(ans.msg);
|
|
||||||
} else {
|
|
||||||
this.$message.error(ans.msg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
freshPage() {
|
|
||||||
this.$http.get("/user/queryInfoByAccount?account=" + window.sessionStorage.getItem('token')).then(res => {
|
|
||||||
let R = res.data; // R
|
|
||||||
this.user = R.data;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.freshPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.user-info-card {
|
|
||||||
margin-top: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-info-title {
|
|
||||||
color: cornflowerblue;
|
|
||||||
float: left;
|
|
||||||
margin-top: -5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-info-data {
|
|
||||||
margin-top: 15px;
|
|
||||||
margin-left: 45%;
|
|
||||||
}
|
|
||||||
|
|
||||||
br {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
b {
|
|
||||||
margin-left: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-form-item {
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.save {
|
|
||||||
float: right;
|
|
||||||
margin-right: 10px;
|
|
||||||
margin-top: -10px;
|
|
||||||
}
|
|
||||||
.el-form-item{
|
|
||||||
margin-left: -5%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<el-card>
|
|
||||||
<h1>403</h1>
|
|
||||||
</el-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
refresh() {
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<el-card>
|
|
||||||
<h1>404</h1>
|
|
||||||
</el-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
refresh() {
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@ -1,105 +0,0 @@
|
|||||||
import Vue from 'vue'
|
|
||||||
import Router from 'vue-router'
|
|
||||||
import Login from '@/components/Login'
|
|
||||||
import Index from '@/components/Index'
|
|
||||||
import Error from '@/components/utils/404'
|
|
||||||
import Forbidden from '@/components/utils/403'
|
|
||||||
import Goods from '@/components/Goods'
|
|
||||||
// admin/menu
|
|
||||||
import Home from '@/components/admin/Home'
|
|
||||||
import UserList from '@/components/admin/menu/UserList'
|
|
||||||
import TypeList from '@/components/admin/menu/TypeList'
|
|
||||||
import FlowerList from '@/components/admin/menu/FlowerList'
|
|
||||||
import OrderList from '@/components/admin/menu/OrderList'
|
|
||||||
// user
|
|
||||||
import UserHome from '@/components/user/UserHome'
|
|
||||||
import UpdateInfo from '@/components/user/menu/UpdateInfo'
|
|
||||||
import Cart from '@/components/user/menu/Cart'
|
|
||||||
import Order from '@/components/user/menu/Order'
|
|
||||||
|
|
||||||
Vue.use(Router);
|
|
||||||
|
|
||||||
export default new Router({
|
|
||||||
routes: [
|
|
||||||
{
|
|
||||||
path: '/',
|
|
||||||
redirect: 'login',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/404',
|
|
||||||
meta: {title: "页面走丢了"},
|
|
||||||
component: Error
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/403',
|
|
||||||
meta: {title: "没有权限"},
|
|
||||||
component: Forbidden
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/login',
|
|
||||||
meta: {title: "登录"},
|
|
||||||
component: Login
|
|
||||||
},
|
|
||||||
// 用户页面
|
|
||||||
{
|
|
||||||
path: '/user',
|
|
||||||
component: UserHome,
|
|
||||||
redirect: '/goods',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '/goods',
|
|
||||||
meta: {title: "商品列表"},
|
|
||||||
component: Goods
|
|
||||||
}, {
|
|
||||||
path: '/updateInfo',
|
|
||||||
meta: {title: "个人信息"},
|
|
||||||
component: UpdateInfo
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/order',
|
|
||||||
meta: {title: "我的订单"},
|
|
||||||
component: Order
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/cart',
|
|
||||||
meta: {title: "购物车"},
|
|
||||||
component: Cart
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
// 管理员页面
|
|
||||||
{
|
|
||||||
path: '/home',
|
|
||||||
component: Home,
|
|
||||||
// 为 Home 页创建子路由,并默认跳转。
|
|
||||||
redirect: '/index',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '/index',
|
|
||||||
meta: {title: "网站首页"},
|
|
||||||
component: Index
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/users',
|
|
||||||
meta: {title: "用户管理"},
|
|
||||||
component: UserList
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/flowers',
|
|
||||||
meta: {title: "商品管理"},
|
|
||||||
component: FlowerList
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/flower_type',
|
|
||||||
meta: {title: "种类管理"},
|
|
||||||
component: TypeList
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/orders',
|
|
||||||
meta: {title: "订单管理"},
|
|
||||||
component: OrderList
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 433 KiB |
|
Before Width: | Height: | Size: 816 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 190 KiB |
|
Before Width: | Height: | Size: 428 KiB |
|
Before Width: | Height: | Size: 270 KiB |
|
Before Width: | Height: | Size: 180 KiB |
|
Before Width: | Height: | Size: 181 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 208 KiB |
|
Before Width: | Height: | Size: 312 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 40 KiB |
@ -0,0 +1,131 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.4.5</version>
|
||||||
|
<relativePath/>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>com.shanzhu</groupId>
|
||||||
|
<artifactId>flower-backend</artifactId>
|
||||||
|
<version>1.0.0-RELEASE</version>
|
||||||
|
|
||||||
|
<name>flower-backend</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<description>花店商城后台</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.10</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.1.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>tk.mybatis</groupId>
|
||||||
|
<artifactId>mapper-spring-boot-starter</artifactId>
|
||||||
|
<version>2.0.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter</artifactId>
|
||||||
|
<version>5.4.2</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sourceforge.nekohtml</groupId>
|
||||||
|
<artifactId>nekohtml</artifactId>
|
||||||
|
<version>1.9.22</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-pool2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>3.17</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
<version>2.9.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
<version>2.9.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -0,0 +1,259 @@
|
|||||||
|
package com.shanzhu.flower.controller;
|
||||||
|
|
||||||
|
import com.shanzhu.flower.config.Constant;
|
||||||
|
import com.shanzhu.flower.config.HttpMsg;
|
||||||
|
import com.shanzhu.flower.dao.FlowersDao;
|
||||||
|
import com.shanzhu.flower.entity.Flower;
|
||||||
|
import com.shanzhu.flower.entity.R;
|
||||||
|
import com.shanzhu.flower.service.FlowersService;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 鲜花 控制层
|
||||||
|
*
|
||||||
|
* @author: ShanZhu
|
||||||
|
* @date: 2024-01-24
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("flower")
|
||||||
|
public class FlowerController {
|
||||||
|
|
||||||
|
@Value("${uploadPath}")
|
||||||
|
private String uploadPath; // 注入文件上传路径配置
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FlowersService flowerService; // 注入鲜花业务逻辑服务
|
||||||
|
@Resource
|
||||||
|
private FlowersDao flowersDao; // 注入鲜花数据访问对象
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询鲜花商品
|
||||||
|
*
|
||||||
|
* @param page 页数
|
||||||
|
* @param searchKey 查询条件
|
||||||
|
* @param searchType 查询类型
|
||||||
|
* @return 商品分页数据
|
||||||
|
*/
|
||||||
|
@RequestMapping("/find")
|
||||||
|
R find(
|
||||||
|
@RequestParam("page") int page,
|
||||||
|
@RequestParam("searchKey") String searchKey,
|
||||||
|
@RequestParam("searchType") String searchType
|
||||||
|
) {
|
||||||
|
R r = new R();
|
||||||
|
List<Flower> flowers = flowerService.find(searchKey, searchType); // 调用服务层查询鲜花列表
|
||||||
|
|
||||||
|
if (flowers == null) {
|
||||||
|
return r.setCode(2000); // 返回查询失败状态码
|
||||||
|
}
|
||||||
|
|
||||||
|
return getResponse(flowers, page, Constant.SHOW_PAGE_SIZE, r); // 构建分页响应数据
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员查询所有
|
||||||
|
*
|
||||||
|
* @param page 分页页数
|
||||||
|
* @param searchKey 查询条件
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@RequestMapping("/findAll")
|
||||||
|
R findAll(@RequestParam("page") int page, @RequestParam("searchKey") String searchKey) {
|
||||||
|
R r = new R();
|
||||||
|
List<Flower> flowers = flowerService.findAll(searchKey); // 调用服务层查询所有鲜花
|
||||||
|
|
||||||
|
if (flowers == null) {
|
||||||
|
return r.setCode(2000); // 返回查询失败状态码
|
||||||
|
}
|
||||||
|
|
||||||
|
return getResponse(flowers, page, Constant.PAGE_SIZE, r); // 构建分页响应数据
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建鲜花商品
|
||||||
|
*
|
||||||
|
* @param flower 商品信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@RequestMapping("/create")
|
||||||
|
R create(@RequestBody Flower flower) {
|
||||||
|
R r = new R();
|
||||||
|
|
||||||
|
int ans = flowerService.add(flower); // 调用服务层添加鲜花
|
||||||
|
if (ans == 1) {
|
||||||
|
return r.setCode(2000).setMsg(HttpMsg.ADD_FLOWER_OK); // 返回添加成功信息
|
||||||
|
}
|
||||||
|
|
||||||
|
return r.setCode(4000).setMsg(HttpMsg.ADD_FLOWER_FAILED); // 返回添加失败信息
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新鲜花商品
|
||||||
|
*
|
||||||
|
* @param flower 商品信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@RequestMapping("/update")
|
||||||
|
R update(@RequestBody Flower flower) {
|
||||||
|
R r = new R();
|
||||||
|
|
||||||
|
int ans = flowerService.update(flower); // 调用服务层更新鲜花信息
|
||||||
|
if (ans >= 0) {
|
||||||
|
return r.setCode(2000).setMsg(HttpMsg.UPDATE_FLOWER_OK); // 返回更新成功信息
|
||||||
|
}
|
||||||
|
|
||||||
|
return r.setCode(4000).setMsg(HttpMsg.UPDATE_FLOWER_FAILED); // 返回更新失败信息
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 改版商品状态
|
||||||
|
*
|
||||||
|
* @param flower 商品信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@RequestMapping("/changeState")
|
||||||
|
R changeState(@RequestBody Flower flower) {
|
||||||
|
R r = new R();
|
||||||
|
|
||||||
|
flowersDao.changeState(flower); // 直接调用DAO层修改商品状态
|
||||||
|
String msg = flower.getState() == 1 ? HttpMsg.GOODS_UP_OK : HttpMsg.GOODS_DOWN_OK; // 判断上下架状态
|
||||||
|
|
||||||
|
return r.setCode(2000).setMsg(msg); // 返回操作成功信息
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传图片
|
||||||
|
*
|
||||||
|
* @param file 文件信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@RequestMapping("/updateImg")
|
||||||
|
R updateImg(@RequestParam("file") MultipartFile file) {
|
||||||
|
R r = new R();
|
||||||
|
|
||||||
|
// 只接收 jpg/png 图片
|
||||||
|
String filename = file.getOriginalFilename();
|
||||||
|
if (!filename.endsWith(".jpg") && !filename.endsWith(".png")) {
|
||||||
|
return r.setCode(4000).setMsg(HttpMsg.ERROR_FILE_TYPE); // 返回文件类型错误信息
|
||||||
|
}
|
||||||
|
|
||||||
|
String img_guid = UUID.randomUUID().toString().replaceAll("-", "") + ".jpg"; // 生成唯一图片文件名
|
||||||
|
|
||||||
|
try {
|
||||||
|
savePic(file.getInputStream(), img_guid); // 保存图片文件
|
||||||
|
return r.setCode(2000).setMsg(HttpMsg.UPDATE_PIC_OK).setData(img_guid); // 返回上传成功信息
|
||||||
|
} catch (IOException e) {
|
||||||
|
return r.setCode(4000).setMsg(HttpMsg.UPDATE_PIC_FAILED); // 返回上传失败信息
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新图片guid
|
||||||
|
*
|
||||||
|
* @param guid guid
|
||||||
|
* @param id id
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PutMapping("/updateImgGuid")
|
||||||
|
R updateImgGuid(@RequestParam("guid") String guid, @RequestParam("id") int id) {
|
||||||
|
R r = new R();
|
||||||
|
|
||||||
|
int ans = flowerService.updateImg(guid, id); // 调用服务层更新图片GUID
|
||||||
|
if (ans == 1) {
|
||||||
|
return r.setCode(2000).setMsg(HttpMsg.UPDATE_PIC_OK); // 返回更新成功信息
|
||||||
|
}
|
||||||
|
|
||||||
|
return r.setCode(4000).setMsg(HttpMsg.UPDATE_PIC_FAILED); // 返回更新失败信息
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除图片
|
||||||
|
*
|
||||||
|
* @param id 图片id
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
R delete(@RequestParam("id") int id) {
|
||||||
|
R r = new R();
|
||||||
|
|
||||||
|
int ans = flowerService.delete(id); // 调用服务层删除鲜花
|
||||||
|
if (ans == 1) {
|
||||||
|
return r.setCode(2000).setMsg(HttpMsg.DELETE_FLOWER_OK); // 返回删除成功信息
|
||||||
|
}
|
||||||
|
|
||||||
|
return r.setCode(4000).setMsg(HttpMsg.DELETE_FLOWER_FAILED); // 返回删除失败信息
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存图片文件到指定路径
|
||||||
|
* @param inputStream 输入流
|
||||||
|
* @param fileName 文件名
|
||||||
|
*/
|
||||||
|
private void savePic(InputStream inputStream, String fileName) {
|
||||||
|
OutputStream os = null;
|
||||||
|
try {
|
||||||
|
String path = uploadPath;
|
||||||
|
// 1K的数据缓冲
|
||||||
|
byte[] bs = new byte[1024];
|
||||||
|
// 读取到的数据长度
|
||||||
|
int len;
|
||||||
|
// 输出的文件流保存到本地文件
|
||||||
|
os = new FileOutputStream(new File(path + fileName));
|
||||||
|
// 开始读取
|
||||||
|
while ((len = inputStream.read(bs)) != -1) {
|
||||||
|
os.write(bs, 0, len); // 将数据写入文件
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace(); // 打印异常堆栈信息
|
||||||
|
} finally {
|
||||||
|
// 完毕,关闭所有链接
|
||||||
|
try {
|
||||||
|
os.close();
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace(); // 打印关闭流异常信息
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建分页响应数据
|
||||||
|
* @param flowers 鲜花列表
|
||||||
|
* @param page 当前页码
|
||||||
|
* @param pageSize 每页大小
|
||||||
|
* @param r 响应对象
|
||||||
|
* @return 分页数据
|
||||||
|
*/
|
||||||
|
private R getResponse(List<Flower> flowers, int page, int pageSize, R r) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
// 计算当前页数据
|
||||||
|
List<Flower> items = flowers.size() >= page * pageSize ?
|
||||||
|
flowers.subList((page - 1) * pageSize, page * pageSize)
|
||||||
|
: flowers.subList((page - 1) * pageSize, flowers.size());
|
||||||
|
// 计算总页数
|
||||||
|
int len = flowers.size() % pageSize == 0 ? flowers.size() / pageSize
|
||||||
|
: (flowers.size() / pageSize + 1);
|
||||||
|
// 处理图片路径
|
||||||
|
for (Flower item : items) {
|
||||||
|
if (item.getImg_guid() == null) {
|
||||||
|
item.setImg_guid(Constant.DEFAULT_IMG); // 设置默认图片
|
||||||
|
}
|
||||||
|
item.setImg_guid(Constant.IMG_USE_PATH + item.getImg_guid()); // 添加图片访问路径前缀
|
||||||
|
}
|
||||||
|
map.put("items", items); // 分页数据
|
||||||
|
map.put("len", len); // 总页数
|
||||||
|
return r.setCode(2000).setData(map); // 返回分页响应
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,117 @@
|
|||||||
|
package com.shanzhu.flower.controller;
|
||||||
|
|
||||||
|
import com.shanzhu.flower.config.Constant;
|
||||||
|
import com.shanzhu.flower.config.HttpMsg;
|
||||||
|
import com.shanzhu.flower.entity.R;
|
||||||
|
import com.shanzhu.flower.entity.Species;
|
||||||
|
import com.shanzhu.flower.service.SpeciesService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 鲜花种类 控制层
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("species")
|
||||||
|
public class FlowerTypeController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SpeciesService speciesService; // 注入鲜花种类业务逻辑服务
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有鲜花种类
|
||||||
|
* @return 鲜花种类列表
|
||||||
|
*/
|
||||||
|
@RequestMapping("/findAll")
|
||||||
|
R findAll() {
|
||||||
|
R r = new R();
|
||||||
|
List<Species> all = speciesService.findAll(); // 调用服务层查询所有鲜花种类
|
||||||
|
if (all.size() <= 0) {
|
||||||
|
return r.setCode(4000).setMsg(HttpMsg.NO_TYPE_NOW); // 返回无种类信息
|
||||||
|
}
|
||||||
|
return r.setCode(2000).setData(all); // 返回成功及种类列表
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询鲜花种类
|
||||||
|
* @param page 页码
|
||||||
|
* @param searchKey 查询关键词
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
|
@RequestMapping("/find")
|
||||||
|
R find(@RequestParam("page") int page, @RequestParam("searchKey") String searchKey) {
|
||||||
|
R r = new R();
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
List<Species> list = speciesService.find(searchKey); // 调用服务层查询符合条件的种类
|
||||||
|
if (list == null) {
|
||||||
|
return r.setCode(2000); // 返回查询失败状态
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分页逻辑 - 获取当前页数据
|
||||||
|
List<Species> items = list.size() >= page * Constant.PAGE_SIZE ?
|
||||||
|
list.subList((page - 1) * Constant.PAGE_SIZE, page * Constant.PAGE_SIZE)
|
||||||
|
: list.subList((page - 1) * Constant.PAGE_SIZE, list.size());
|
||||||
|
|
||||||
|
// 计算总页数
|
||||||
|
int len = list.size() % Constant.PAGE_SIZE == 0 ? list.size() / Constant.PAGE_SIZE
|
||||||
|
: (list.size() / Constant.PAGE_SIZE + 1);
|
||||||
|
|
||||||
|
map.put("items", items); // 当前页数据
|
||||||
|
map.put("len", len); // 总页数
|
||||||
|
return r.setCode(2000).setData(map); // 返回分页结果
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建鲜花种类
|
||||||
|
* @param species 种类信息
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@RequestMapping("/create")
|
||||||
|
R create(@RequestBody Species species) {
|
||||||
|
R r = new R();
|
||||||
|
try {
|
||||||
|
speciesService.add(species); // 调用服务层添加种类
|
||||||
|
return r.setCode(2000).setMsg(HttpMsg.ADD_TYPE_OK); // 返回添加成功信息
|
||||||
|
} catch (Exception e) {
|
||||||
|
return r.setCode(4000).setMsg(HttpMsg.ADD_TYPE_FAILED); // 返回添加失败信息
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新鲜花种类信息
|
||||||
|
* @param species 种类信息
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@RequestMapping("/update")
|
||||||
|
R update(@RequestBody Species species) {
|
||||||
|
R r = new R();
|
||||||
|
try {
|
||||||
|
speciesService.update(species); // 调用服务层更新种类信息
|
||||||
|
return r.setCode(2000).setMsg(HttpMsg.UPDATE_TYPE_OK); // 返回更新成功信息
|
||||||
|
} catch (Exception e) {
|
||||||
|
return r.setCode(4000).setMsg(HttpMsg.UPDATE_TYPE_FAILED); // 返回更新失败信息
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除鲜花种类
|
||||||
|
* @param id 种类ID
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
R delete(@RequestParam("id") int id) {
|
||||||
|
R r = new R();
|
||||||
|
try {
|
||||||
|
speciesService.delete(id); // 调用服务层删除种类
|
||||||
|
return r.setCode(2000).setMsg(HttpMsg.DELETE_TYPE_OK); // 返回删除成功信息
|
||||||
|
} catch (Exception e) {
|
||||||
|
return r.setCode(4000).setMsg(HttpMsg.DELETE_TYPE_FAILED); // 返回删除失败信息
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
package com.shanzhu.flower.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class Cart {
|
||||||
|
|
||||||
|
//
|
||||||
|
// 购物车记录的唯一标识符。
|
||||||
|
// 用于在数据库中唯一标识每条购物车记录。
|
||||||
|
//
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 商品的唯一标识符。
|
||||||
|
// 用于标识购物车中的具体商品。
|
||||||
|
//
|
||||||
|
private int fid;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 商品名称。
|
||||||
|
// 用于存储购物车中商品的名称。
|
||||||
|
//
|
||||||
|
private String flower;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 商品数量。
|
||||||
|
// 用于存储购物车中商品的数量。
|
||||||
|
//
|
||||||
|
private int amount;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 商品总价。
|
||||||
|
// 用于存储购物车中商品的总价,计算方式为单价乘以数量。
|
||||||
|
//
|
||||||
|
private float price;
|
||||||
|
// 用户的唯一标识符。
|
||||||
|
// 用于标识购物车记录所属的用户。
|
||||||
|
private int uid;
|
||||||
|
// 用户账号。
|
||||||
|
// 用于存储购物车记录所属用户的账号信息。
|
||||||
|
private String account;
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.shanzhu.flower.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class LoginForm {
|
||||||
|
// 计数
|
||||||
|
private String account;
|
||||||
|
// 密码
|
||||||
|
private String password;
|
||||||
|
// 角色
|
||||||
|
private String role;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.shanzhu.flower.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class OrderVo extends Order{
|
||||||
|
//姓名
|
||||||
|
private String username;
|
||||||
|
// 电话
|
||||||
|
private String phone;
|
||||||
|
// 地址
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.shanzhu.flower.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class Param {
|
||||||
|
// 秘钥
|
||||||
|
private String searchKey;
|
||||||
|
// 张数
|
||||||
|
private int page;
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.shanzhu.flower.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class R {
|
||||||
|
private int code;
|
||||||
|
private String msg;
|
||||||
|
private Object data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.shanzhu.flower.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class Species {
|
||||||
|
// ID
|
||||||
|
private int id;
|
||||||
|
// 重命名
|
||||||
|
private String species_name;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.shanzhu.flower.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class User {
|
||||||
|
//
|
||||||
|
// 用户的唯一标识符。
|
||||||
|
// 用于在数据库中唯一标识每个用户。
|
||||||
|
//
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 用户账号。
|
||||||
|
// 用于用户登录和身份验证。
|
||||||
|
//
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 用户姓名。
|
||||||
|
// 用于存储用户的真实姓名或昵称。
|
||||||
|
//
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 用户密码。
|
||||||
|
// 用于用户登录验证,存储时应加密处理以保证安全。
|
||||||
|
//
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 用户电话号码。
|
||||||
|
// 用于联系用户或验证用户身份。
|
||||||
|
//
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 用户地址。
|
||||||
|
// 用于存储用户的配送地址或其他联系地址。
|
||||||
|
//
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 用户角色。
|
||||||
|
// 用于标识用户在系统中的权限级别,例如:"admin" 表示管理员,"user" 表示普通用户。
|
||||||
|
//
|
||||||
|
private String role;
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
package com.shanzhu.flower.service.impl;
|
||||||
|
|
||||||
|
import com.shanzhu.flower.dao.CartDao;
|
||||||
|
import com.shanzhu.flower.dao.UserDao;
|
||||||
|
import com.shanzhu.flower.entity.Cart;
|
||||||
|
import com.shanzhu.flower.service.CartService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CartServiceImpl implements CartService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CartDao cartDao; // 注入购物车数据访问对象
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserDao userDao; // 注入用户数据访问对象
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int add(Cart cart) {
|
||||||
|
// 根据用户账号查询用户ID
|
||||||
|
int uid = userDao.queryIdByAccount(cart.getAccount());
|
||||||
|
cart.setUid(uid); // 设置购物车记录的用户ID
|
||||||
|
|
||||||
|
// 检查该用户是否已将该商品添加到购物车
|
||||||
|
Cart cart1 = cartDao.checkIsAdded(cart);
|
||||||
|
if (cart1 == null) {
|
||||||
|
// 如果未添加,直接插入新的购物车记录
|
||||||
|
return cartDao.add(cart);
|
||||||
|
} else {
|
||||||
|
// 如果已添加,增加该商品的数量
|
||||||
|
return cartDao.addAmount(cart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delete(int uid) {
|
||||||
|
// 根据用户ID删除购物车记录
|
||||||
|
return cartDao.delete(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int update(Cart cart) {
|
||||||
|
// 更新购物车记录
|
||||||
|
return cartDao.update(cart);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Cart> find(String searchKey, String account) {
|
||||||
|
// 根据搜索关键词和用户账号查询购物车记录
|
||||||
|
return cartDao.find(searchKey, account);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Cart> queryByAccount(String account) {
|
||||||
|
// 根据用户账号查询用户ID
|
||||||
|
Integer uid = userDao.queryIdByAccount(account);
|
||||||
|
// 根据用户ID查询购物车记录
|
||||||
|
return cartDao.queryByUid(uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
package com.shanzhu.flower.service.impl;
|
||||||
|
|
||||||
|
import com.shanzhu.flower.dao.FlowersDao;
|
||||||
|
import com.shanzhu.flower.entity.Flower;
|
||||||
|
import com.shanzhu.flower.service.FlowersService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//
|
||||||
|
// * 鲜花业务逻辑实现类,处理鲜花相关的业务操作
|
||||||
|
//
|
||||||
|
@Service
|
||||||
|
public class FlowersServiceImpl implements FlowersService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FlowersDao flowersDao; // 注入鲜花数据访问对象
|
||||||
|
|
||||||
|
//
|
||||||
|
// * 添加鲜花信息
|
||||||
|
// * @param flower 鲜花实体对象
|
||||||
|
// * @return 数据库操作影响的行数
|
||||||
|
//
|
||||||
|
@Override
|
||||||
|
public int add(Flower flower) {
|
||||||
|
return flowersDao.add(flower); // 调用DAO层添加鲜花
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// * 根据ID删除鲜花
|
||||||
|
// * @param id 鲜花ID
|
||||||
|
// * @return 数据库操作影响的行数
|
||||||
|
//
|
||||||
|
@Override
|
||||||
|
public int delete(int id) {
|
||||||
|
return flowersDao.delete(id); // 调用DAO层删除鲜花
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// * 更新鲜花信息
|
||||||
|
// * @param flower 包含更新信息的鲜花实体对象
|
||||||
|
// * @return 数据库操作影响的行数
|
||||||
|
//
|
||||||
|
@Override
|
||||||
|
public int update(Flower flower) {
|
||||||
|
return flowersDao.update(flower); // 调用DAO层更新鲜花信息
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// * 根据搜索条件查询鲜花列表(用户视角,仅包含上架商品)
|
||||||
|
// * @param searchKey 搜索关键词(名称)
|
||||||
|
// * @param searchType 搜索类型(种类)
|
||||||
|
// * @return 符合条件的鲜花列表
|
||||||
|
//
|
||||||
|
@Override
|
||||||
|
public List<Flower> find(String searchKey, String searchType) {
|
||||||
|
return flowersDao.find(searchKey, searchType); // 调用DAO层查询鲜花列表
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// * 管理员查询所有鲜花(包含下架商品)
|
||||||
|
// * @param searchKey 搜索关键词(名称)
|
||||||
|
// * @return 符合条件的鲜花列表
|
||||||
|
//
|
||||||
|
@Override
|
||||||
|
public List<Flower> findAll(String searchKey) {
|
||||||
|
return flowersDao.findAll(searchKey); // 调用DAO层查询所有鲜花
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// * 更新鲜花图片
|
||||||
|
// * @param img_guid 图片唯一标识
|
||||||
|
// * @param id 鲜花ID
|
||||||
|
// * @return 数据库操作影响的行数
|
||||||
|
//
|
||||||
|
@Override
|
||||||
|
public int updateImg(String img_guid, Integer id) {
|
||||||
|
return flowersDao.updateImg(img_guid, id); // 调用DAO层更新鲜花图片
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
#后端服务端口
|
||||||
|
server:
|
||||||
|
port: 8081
|
||||||
|
|
||||||
|
spring:
|
||||||
|
#数据库配置
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/DB_flower?characterEncoding=UTF-8&serverTimezone=UTC
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
|
||||||
|
resources:
|
||||||
|
chain:
|
||||||
|
strategy:
|
||||||
|
content:
|
||||||
|
enabled: true
|
||||||
|
paths: /**
|
||||||
|
mybatis:
|
||||||
|
type-aliases-package: com.shanzhu.flower.entity
|
||||||
|
|
||||||
|
#图片上传路径 图片所在的路径位置
|
||||||
|
uploadPath: /Users/jiawang/saleProject/花店商城/flower-frontend/static/imgs/
|
||||||