chartWrapper = new QueryWrapper<>();
282 | chartWrapper.eq("type_id", typeId).eq("book_id", id);
283 | cnt = chartMapper.selectCount(chartWrapper);
284 | if (cnt == 0) {
285 | chartMapper.insert(new Chart(typeId, id, rank));
286 | }
287 |
288 | ++rank;
289 | }
290 | }
291 |
292 | }
293 |
--------------------------------------------------------------------------------
/Back-end/tsconfig.json:
--------------------------------------------------------------------------------
1 | // This TypeScript configuration file is generated by vaadin-maven-plugin.
2 | // This is needed for TypeScript compiler to compile your TypeScript code in the project.
3 | // It is recommended to commit this file to the VCS.
4 | // You might want to change the configurations to fit your preferences
5 | // For more information about the configurations, please refer to http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
6 | {
7 | "compilerOptions": {
8 | "sourceMap": true,
9 | "inlineSources": true,
10 | "module": "esNext",
11 | "target": "es2019",
12 | "moduleResolution": "node",
13 | "strict": true,
14 | "noFallthroughCasesInSwitch": true,
15 | "noImplicitReturns": true,
16 | "noImplicitAny": true,
17 | "noImplicitThis": true,
18 | "noUnusedLocals": false,
19 | "noUnusedParameters": false,
20 | "experimentalDecorators": true,
21 | "baseUrl": "frontend",
22 | "paths": {
23 | "Frontend/*": [
24 | "*"
25 | ]
26 | }
27 | },
28 | "include": [
29 | "frontend/**/*.ts",
30 | "frontend/index.js",
31 | "types.d.ts"
32 | ],
33 | "exclude": []
34 | }
35 |
--------------------------------------------------------------------------------
/Back-end/types.d.ts:
--------------------------------------------------------------------------------
1 | // This TypeScript modules definition file is generated by vaadin-maven-plugin.
2 | // You can not directly import your different static files into TypeScript,
3 | // This is needed for TypeScript compiler to declare and export as a TypeScript module.
4 | // It is recommended to commit this file to the VCS.
5 | // You might want to change the configurations to fit your preferences
6 | declare module '*.css' {
7 | import { CSSResultGroup } from 'lit';
8 | const content: CSSResultGroup;
9 | export default content;
10 | }
11 |
--------------------------------------------------------------------------------
/Back-end/webpack.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * This file contains project specific customizations for the webpack build.
3 | * It is autogenerated if it didn't exist or if it was made for an older
4 | * incompatible version.
5 | *
6 | * Defaults are provided in an autogenerated webpack.generated.js file and used by this file.
7 | * The webpack.generated.js file is overwritten on each build and no customization can be done there.
8 | */
9 | const merge = require('webpack-merge');
10 | const flowDefaults = require('./webpack.generated.js');
11 |
12 | /**
13 | * To change the webpack config, add a new configuration object in
14 | * the merge arguments below:
15 | */
16 | module.exports = merge(flowDefaults,
17 | // Override default configuration
18 | // {
19 | // mode: 'development',
20 | // devtool: 'inline-source-map',
21 | // },
22 |
23 | // Add a custom plugin
24 | // (install the plugin with `npm install --save-dev webpack-bundle-analyzer`)
25 | // {
26 | // plugins: [
27 | // new require('webpack-bundle-analyzer').BundleAnalyzerPlugin({
28 | // analyzerMode: 'static'
29 | // })
30 | // ]
31 | // },
32 | );
33 |
--------------------------------------------------------------------------------
/Back-end/webpack.generated.js:
--------------------------------------------------------------------------------
1 | /**
2 | * NOTICE: this is an auto-generated file
3 | *
4 | * This file has been generated by the `flow:prepare-frontend` maven goal.
5 | * This file will be overwritten on every run. Any custom changes should be made to webpack.config.js
6 | */
7 | const fs = require('fs');
8 | const HtmlWebpackPlugin = require('html-webpack-plugin');
9 | const CompressionPlugin = require('compression-webpack-plugin');
10 | const { InjectManifest } = require('workbox-webpack-plugin');
11 | const { DefinePlugin } = require('webpack');
12 | const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
13 | const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
14 |
15 | // Flow plugins
16 | const BuildStatusPlugin = require('@vaadin/build-status-plugin');
17 | const ThemeLiveReloadPlugin = require('@vaadin/theme-live-reload-plugin');
18 | const {
19 | ApplicationThemePlugin,
20 | processThemeResources,
21 | extractThemeName,
22 | findParentThemes
23 | } = require('@vaadin/application-theme-plugin');
24 |
25 | const path = require('path');
26 |
27 | // this matches /themes/my-theme/ and is used to check css url handling and file path build.
28 | const themePartRegex = /(\\|\/)themes\1[\s\S]*?\1/;
29 |
30 | // the folder of app resources:
31 | // - flow templates for classic Flow
32 | // - client code with index.html and index.[ts/js] for CCDM
33 | const frontendFolder = path.resolve(__dirname, 'frontend');
34 | const frontendGeneratedFolder = path.resolve(__dirname, 'frontend/generated');
35 | const fileNameOfTheFlowGeneratedMainEntryPoint = path.resolve(__dirname, 'target/frontend/generated-flow-imports.js');
36 | const mavenOutputFolderForFlowBundledFiles = path.resolve(__dirname, 'target/classes/META-INF/VAADIN/webapp');
37 | const mavenOutputFolderForResourceFiles = path.resolve(__dirname, 'target/classes/META-INF/VAADIN');
38 | const useClientSideIndexFileForBootstrapping = true;
39 | const clientSideIndexHTML = './index.html';
40 | const clientSideIndexEntryPoint = path.resolve(__dirname, 'frontend', 'generated/', 'vaadin.ts');;
41 | const pwaEnabled = false;
42 | const offlinePath = 'offline.html';
43 | const clientServiceWorkerEntryPoint = path.resolve(__dirname, 'target/sw');
44 | // public path for resources, must match Flow VAADIN_BUILD
45 | const VAADIN = 'VAADIN';
46 | const build = 'build';
47 | // public path for resources, must match the request used in flow to get the /build/stats.json file
48 | const config = 'config';
49 | const outputFolder = mavenOutputFolderForFlowBundledFiles;
50 | const indexHtmlPath = 'index.html';
51 | // folder for outputting vaadin-bundle and other fragments
52 | const buildFolder = path.resolve(outputFolder, VAADIN, build);
53 | // folder for outputting stats.json
54 | const confFolder = path.resolve(mavenOutputFolderForResourceFiles, config);
55 | const serviceWorkerPath = 'sw.js';
56 | // file which is used by flow to read templates for server `@Id` binding
57 | const statsFile = `${confFolder}/stats.json`;
58 |
59 | // Folders in the project which can contain static assets.
60 | const projectStaticAssetsFolders = [
61 | path.resolve(__dirname, 'src', 'main', 'resources', 'META-INF', 'resources'),
62 | path.resolve(__dirname, 'src', 'main', 'resources', 'static'),
63 | frontendFolder
64 | ];
65 |
66 | const projectStaticAssetsOutputFolder = path.resolve(__dirname, 'target/classes/META-INF/VAADIN/webapp/VAADIN/static');
67 |
68 | // Folders in the project which can contain application themes
69 | const themeProjectFolders = projectStaticAssetsFolders.map((folder) => path.resolve(folder, 'themes'));
70 |
71 | const tsconfigJsonFile = path.resolve(__dirname, 'tsconfig.json');
72 | const enableTypeScript = fs.existsSync(tsconfigJsonFile);
73 |
74 | // Target flow-fronted auto generated to be the actual target folder
75 | const flowFrontendFolder = path.resolve(__dirname, 'target/flow-frontend');
76 |
77 | const statsSetViaCLI = process.argv.find((v) => v.indexOf('--stats') >= 0);
78 | const devMode = process.argv.find((v) => v.indexOf('webpack-dev-server') >= 0);
79 | if (!devMode) {
80 | // make sure that build folder exists before outputting anything
81 | const mkdirp = require('mkdirp');
82 | mkdirp(buildFolder);
83 | mkdirp(confFolder);
84 | }
85 |
86 | let stats;
87 |
88 | // Open a connection with the Java dev-mode handler in order to finish
89 | // webpack-dev-mode when it exits or crashes.
90 | const watchDogPort = devMode && process.env.watchDogPort;
91 | if (watchDogPort) {
92 | const runWatchDog = () => {
93 | const client = new require('net').Socket();
94 | client.setEncoding('utf8');
95 | client.on('error', function () {
96 | console.log('Watchdog connection error. Terminating webpack process...');
97 | client.destroy();
98 | process.exit(0);
99 | });
100 | client.on('close', function () {
101 | client.destroy();
102 | runWatchDog();
103 | });
104 |
105 | client.connect(watchDogPort, 'localhost');
106 | };
107 | runWatchDog();
108 | }
109 |
110 | // Compute the entries that webpack have to visit
111 | const webPackEntries = {};
112 | if (useClientSideIndexFileForBootstrapping) {
113 | webPackEntries.bundle = clientSideIndexEntryPoint;
114 | const dirName = path.dirname(fileNameOfTheFlowGeneratedMainEntryPoint);
115 | const baseName = path.basename(fileNameOfTheFlowGeneratedMainEntryPoint, '.js');
116 | if (
117 | fs
118 | .readdirSync(dirName)
119 | .filter((fileName) => !fileName.startsWith(baseName) && fileName.endsWith('.js') && fileName.includes('-')).length
120 | ) {
121 | // if there are vaadin exported views, add a second entry
122 | webPackEntries.export = fileNameOfTheFlowGeneratedMainEntryPoint;
123 | }
124 | } else {
125 | webPackEntries.bundle = fileNameOfTheFlowGeneratedMainEntryPoint;
126 | }
127 |
128 | const appShellUrl = '.';
129 | let appShellManifestEntry = undefined;
130 |
131 | const swManifestTransform = (manifestEntries) => {
132 | const warnings = [];
133 | const manifest = manifestEntries;
134 | if (useClientSideIndexFileForBootstrapping) {
135 | // `index.html` is a special case: in contrast with the JS bundles produced by webpack
136 | // it's not served as-is directly from the webpack output at `/index.html`.
137 | // It goes through IndexHtmlRequestHandler and is served at `/`.
138 | //
139 | // TODO: calculate the revision based on the IndexHtmlRequestHandler-processed content
140 | // of the index.html file
141 | const indexEntryIdx = manifest.findIndex((entry) => entry.url === 'index.html');
142 | if (indexEntryIdx !== -1) {
143 | manifest[indexEntryIdx].url = appShellUrl;
144 | appShellManifestEntry = manifest[indexEntryIdx];
145 | } else {
146 | // Index entry is only emitted on first compilation. Make sure it is cached also for incremental builds
147 | manifest.push(appShellManifestEntry);
148 | }
149 | }
150 | return { manifest, warnings };
151 | };
152 |
153 | const createServiceWorkerPlugin = function () {
154 | return new InjectManifest({
155 | swSrc: clientServiceWorkerEntryPoint,
156 | swDest: serviceWorkerPath,
157 | manifestTransforms: [swManifestTransform],
158 | maximumFileSizeToCacheInBytes: 100 * 1024 * 1024,
159 | dontCacheBustURLsMatching: /.*-[a-z0-9]{20}\.cache\.js/,
160 | include: [
161 | (chunk) => {
162 | return true;
163 | }
164 | ],
165 | webpackCompilationPlugins: [
166 | new DefinePlugin({
167 | OFFLINE_PATH: JSON.stringify(offlinePath)
168 | })
169 | ]
170 | });
171 | };
172 |
173 | const flowFrontendThemesFolder = path.resolve(flowFrontendFolder, 'themes');
174 | const themeOptions = {
175 | devMode: devMode,
176 | // The following matches folder 'target/flow-frontend/themes/'
177 | // (not 'frontend/themes') for theme in JAR that is copied there
178 | themeResourceFolder: flowFrontendThemesFolder,
179 | themeProjectFolders: themeProjectFolders,
180 | projectStaticAssetsOutputFolder: projectStaticAssetsOutputFolder,
181 | frontendGeneratedFolder: frontendGeneratedFolder
182 | };
183 | let themeName = undefined;
184 | let themeWatchFolders = undefined;
185 | if (devMode) {
186 | // Current theme name is being extracted from theme.js located in frontend
187 | // generated folder
188 | themeName = extractThemeName(frontendGeneratedFolder);
189 | const parentThemePaths = findParentThemes(themeName, themeOptions);
190 | const currentThemeFolders = [
191 | ...projectStaticAssetsFolders.map((folder) => path.resolve(folder, 'themes', themeName)),
192 | path.resolve(flowFrontendThemesFolder, themeName)
193 | ];
194 | // Watch the components folders for component styles update in both
195 | // current theme and parent themes. Other folders or CSS files except
196 | // 'styles.css' should be referenced from `styles.css` anyway, so no need
197 | // to watch them.
198 | themeWatchFolders = [...currentThemeFolders, ...parentThemePaths].map((themeFolder) =>
199 | path.resolve(themeFolder, 'components')
200 | );
201 | }
202 |
203 | const processThemeResourcesCallback = (logger) => processThemeResources(themeOptions, logger);
204 |
205 | exports = {
206 | frontendFolder: `${frontendFolder}`,
207 | buildFolder: `${buildFolder}`,
208 | confFolder: `${confFolder}`
209 | };
210 |
211 | module.exports = {
212 | mode: 'production',
213 | context: frontendFolder,
214 | entry: webPackEntries,
215 |
216 | output: {
217 | filename: `${VAADIN}/${build}/vaadin-[name]-[contenthash].cache.js`,
218 | path: outputFolder
219 | },
220 |
221 | resolve: {
222 | // Search for import 'x/y' inside these folders, used at least for importing an application theme
223 | modules: ['node_modules', flowFrontendFolder, ...projectStaticAssetsFolders],
224 | extensions: [enableTypeScript && '.ts', '.js'].filter(Boolean),
225 | alias: {
226 | Frontend: frontendFolder
227 | }
228 | },
229 |
230 | stats: devMode && !statsSetViaCLI ? 'errors-warnings' : 'normal', // Unclutter output in dev mode
231 |
232 | devServer: {
233 | hot: false, // disable HMR
234 | client: false, // disable wds client as we handle reloads and errors better
235 | // webpack-dev-server serves ./, webpack-generated, and java webapp
236 | static: [outputFolder, path.resolve(__dirname, 'src', 'main', 'webapp')],
237 | setupMiddlewares: function (middlewares, devServer) {
238 | devServer.app.get(`/assetsByChunkName`, function (req, res) {
239 | res.json(stats.assetsByChunkName);
240 | });
241 | devServer.app.get(`/stop`, function (req, res) {
242 | // eslint-disable-next-line no-console
243 | console.log("Stopped 'webpack-dev-server'");
244 | process.exit(0);
245 | });
246 | return middlewares;
247 | }
248 | },
249 |
250 | module: {
251 | rules: [
252 | enableTypeScript && {
253 | test: /\.ts$/,
254 | loader: 'esbuild-loader',
255 | options: {
256 | loader: 'ts',
257 | target: 'es2019'
258 | }
259 | },
260 | {
261 | test: /\.css$/i,
262 | use: [
263 | {
264 | loader: 'lit-css-loader',
265 | options: {
266 | import: 'lit'
267 | }
268 | },
269 | {
270 | loader: 'extract-loader'
271 | },
272 | {
273 | loader: 'css-loader',
274 | options: {
275 | url: (url, resourcePath) => {
276 | // Only translate files from node_modules
277 | const resolve = resourcePath.match(/(\\|\/)node_modules\1/);
278 | const themeResource = resourcePath.match(themePartRegex) && url.match(/^themes\/[\s\S]*?\//);
279 | return resolve || themeResource;
280 | },
281 | // use theme-loader to also handle any imports in css files
282 | importLoaders: 1
283 | }
284 | },
285 | {
286 | // theme-loader will change any url starting with './' to start with 'VAADIN/static' instead
287 | // NOTE! this loader should be here so it's run before css-loader as loaders are applied Right-To-Left
288 | loader: '@vaadin/theme-loader',
289 | options: {
290 | devMode: devMode
291 | }
292 | }
293 | ]
294 | },
295 | {
296 | // File-loader only copies files used as imports in .js files or handled by css-loader
297 | test: /\.(png|gif|jpg|jpeg|svg|eot|woff|woff2|otf|ttf)$/,
298 | use: [
299 | {
300 | loader: 'file-loader',
301 | options: {
302 | outputPath: 'VAADIN/static/',
303 | name(resourcePath, resourceQuery) {
304 | if (resourcePath.match(/(\\|\/)node_modules\1/)) {
305 | return /(\\|\/)node_modules\1(?!.*node_modules)([\S]+)/.exec(resourcePath)[2].replace(/\\/g, '/');
306 | }
307 | if (resourcePath.match(/(\\|\/)flow-frontend\1/)) {
308 | return /(\\|\/)flow-frontend\1(?!.*flow-frontend)([\S]+)/.exec(resourcePath)[2].replace(/\\/g, '/');
309 | }
310 | return '[path][name].[ext]';
311 | }
312 | }
313 | }
314 | ]
315 | }
316 | ].filter(Boolean)
317 | },
318 | performance: {
319 | maxEntrypointSize: 2097152, // 2MB
320 | maxAssetSize: 2097152 // 2MB
321 | },
322 | plugins: [
323 | new ApplicationThemePlugin(themeOptions),
324 |
325 | ...(devMode && themeName
326 | ? [
327 | new ExtraWatchWebpackPlugin({
328 | files: [],
329 | dirs: themeWatchFolders
330 | }),
331 | new ThemeLiveReloadPlugin(processThemeResourcesCallback)
332 | ]
333 | : []),
334 |
335 | function (compiler) {
336 | // V14 bootstrapping needs the bundle names
337 | compiler.hooks.afterEmit.tapAsync("FlowStatsHelper", (compilation, done) => {
338 | let miniStats = {
339 | assetsByChunkName: compilation.getStats().toJson().assetsByChunkName
340 | };
341 | if (!devMode) {
342 | fs.writeFile(statsFile, JSON.stringify(miniStats, null, 1),
343 | () => done());
344 | } else {
345 | stats = miniStats;
346 | done();
347 | }
348 | });
349 | },
350 |
351 | // Includes JS output bundles into "index.html"
352 | useClientSideIndexFileForBootstrapping &&
353 | new HtmlWebpackPlugin({
354 | template: clientSideIndexHTML,
355 | filename: indexHtmlPath,
356 | inject: 'head',
357 | scriptLoading: 'defer',
358 | chunks: ['bundle']
359 | }),
360 |
361 | // Service worker for offline
362 | pwaEnabled && createServiceWorkerPlugin(),
363 |
364 | // Generate compressed bundles when not devMode
365 | !devMode && new CompressionPlugin(),
366 |
367 | enableTypeScript &&
368 | new ForkTsCheckerWebpackPlugin({
369 | typescript: {
370 | configFile: tsconfigJsonFile
371 | }
372 | }),
373 |
374 | new BuildStatusPlugin()
375 | ].filter(Boolean)
376 | };
377 |
--------------------------------------------------------------------------------
/Database/bookshop_system.sql:
--------------------------------------------------------------------------------
1 | /*
2 | Navicat Premium Data Transfer
3 |
4 | Source Server : admin
5 | Source Server Type : MySQL
6 | Source Server Version : 80026
7 | Source Host : localhost:3306
8 | Source Schema : bookshop_system
9 |
10 | Target Server Type : MySQL
11 | Target Server Version : 80026
12 | File Encoding : 65001
13 |
14 | Date: 22/03/2022 11:00:26
15 | */
16 |
17 | SET NAMES utf8mb4;
18 | SET FOREIGN_KEY_CHECKS = 0;
19 |
20 | -- ----------------------------
21 | -- Table structure for book
22 | -- ----------------------------
23 | DROP TABLE IF EXISTS `book`;
24 | CREATE TABLE `book` (
25 | `id` int NOT NULL,
26 | `author` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
27 | `date` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
28 | `publisher` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
29 | `price` decimal(8, 2) NULL DEFAULT NULL,
30 | `has_e_book` tinyint(1) NOT NULL,
31 | `has_secondhand_book` tinyint(1) NOT NULL,
32 | `book_introduction` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
33 | `author_introduction` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
34 | `directory` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
35 | `pic` blob NULL,
36 | `isbn` char(13) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
37 | `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
38 | PRIMARY KEY (`id`) USING BTREE,
39 | UNIQUE INDEX `book_id_uindex`(`id` ASC) USING BTREE
40 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
41 |
42 | -- ----------------------------
43 | -- Table structure for cart
44 | -- ----------------------------
45 | DROP TABLE IF EXISTS `cart`;
46 | CREATE TABLE `cart` (
47 | `user_id` int NOT NULL,
48 | `book_id` int NOT NULL,
49 | `quantity` int NOT NULL
50 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
51 |
52 | -- ----------------------------
53 | -- Table structure for chart
54 | -- ----------------------------
55 | DROP TABLE IF EXISTS `chart`;
56 | CREATE TABLE `chart` (
57 | `type_id` int NOT NULL,
58 | `book_id` int NOT NULL,
59 | `rank_num` int NOT NULL,
60 | INDEX `chart_book_fk`(`book_id` ASC) USING BTREE,
61 | INDEX `chart_type_fk`(`type_id` ASC) USING BTREE,
62 | CONSTRAINT `chart_book_fk` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
63 | CONSTRAINT `chart_type_fk` FOREIGN KEY (`type_id`) REFERENCES `chart_type` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
64 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
65 |
66 | -- ----------------------------
67 | -- Table structure for chart_type
68 | -- ----------------------------
69 | DROP TABLE IF EXISTS `chart_type`;
70 | CREATE TABLE `chart_type` (
71 | `id` int NOT NULL,
72 | `name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
73 | PRIMARY KEY (`id`) USING BTREE,
74 | UNIQUE INDEX `chart_type_id_uindex`(`id` ASC) USING BTREE,
75 | UNIQUE INDEX `chart_type_name_uindex`(`name` ASC) USING BTREE
76 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
77 |
78 | -- ----------------------------
79 | -- Table structure for news
80 | -- ----------------------------
81 | DROP TABLE IF EXISTS `news`;
82 | CREATE TABLE `news` (
83 | `id` int NOT NULL,
84 | `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
85 | `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
86 | PRIMARY KEY (`id`) USING BTREE,
87 | UNIQUE INDEX `news_id_uindex`(`id` ASC) USING BTREE
88 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
89 |
90 | -- ----------------------------
91 | -- Table structure for review
92 | -- ----------------------------
93 | DROP TABLE IF EXISTS `review`;
94 | CREATE TABLE `review` (
95 | `id` int NOT NULL,
96 | `book_id` int NOT NULL,
97 | `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
98 | `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
99 | `author` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
100 | `date` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
101 | `intro` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
102 | PRIMARY KEY (`id`) USING BTREE,
103 | UNIQUE INDEX `review_book_id_uindex`(`book_id` ASC) USING BTREE,
104 | UNIQUE INDEX `review_id_uindex`(`id` ASC) USING BTREE,
105 | CONSTRAINT `review_book_fk` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
106 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
107 |
108 | -- ----------------------------
109 | -- Table structure for review_chart
110 | -- ----------------------------
111 | DROP TABLE IF EXISTS `review_chart`;
112 | CREATE TABLE `review_chart` (
113 | `review_id` int NOT NULL,
114 | `rank_num` int NOT NULL,
115 | UNIQUE INDEX `review_chart_review_id_uindex`(`review_id` ASC) USING BTREE,
116 | CONSTRAINT `review_chart_review_id_fk` FOREIGN KEY (`review_id`) REFERENCES `review` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
117 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
118 |
119 | -- ----------------------------
120 | -- Table structure for spring_session
121 | -- ----------------------------
122 | DROP TABLE IF EXISTS `spring_session`;
123 | CREATE TABLE `spring_session` (
124 | `PRIMARY_ID` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
125 | `SESSION_ID` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
126 | `CREATION_TIME` bigint NOT NULL,
127 | `LAST_ACCESS_TIME` bigint NOT NULL,
128 | `MAX_INACTIVE_INTERVAL` int NOT NULL,
129 | `EXPIRY_TIME` bigint NOT NULL,
130 | `PRINCIPAL_NAME` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
131 | PRIMARY KEY (`PRIMARY_ID`) USING BTREE,
132 | UNIQUE INDEX `SPRING_SESSION_IX1`(`SESSION_ID` ASC) USING BTREE,
133 | INDEX `SPRING_SESSION_IX2`(`EXPIRY_TIME` ASC) USING BTREE,
134 | INDEX `SPRING_SESSION_IX3`(`PRINCIPAL_NAME` ASC) USING BTREE
135 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
136 |
137 | -- ----------------------------
138 | -- Table structure for spring_session_attributes
139 | -- ----------------------------
140 | DROP TABLE IF EXISTS `spring_session_attributes`;
141 | CREATE TABLE `spring_session_attributes` (
142 | `SESSION_PRIMARY_ID` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
143 | `ATTRIBUTE_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
144 | `ATTRIBUTE_BYTES` blob NOT NULL,
145 | PRIMARY KEY (`SESSION_PRIMARY_ID`, `ATTRIBUTE_NAME`) USING BTREE,
146 | CONSTRAINT `SPRING_SESSION_ATTRIBUTES_FK` FOREIGN KEY (`SESSION_PRIMARY_ID`) REFERENCES `spring_session` (`PRIMARY_ID`) ON DELETE CASCADE ON UPDATE RESTRICT
147 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;
148 |
149 | -- ----------------------------
150 | -- Table structure for user
151 | -- ----------------------------
152 | DROP TABLE IF EXISTS `user`;
153 | CREATE TABLE `user` (
154 | `id` int NOT NULL AUTO_INCREMENT,
155 | `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
156 | `pic` longblob NULL,
157 | `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
158 | `mail` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
159 | `gender` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
160 | `password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
161 | PRIMARY KEY (`id`) USING BTREE,
162 | UNIQUE INDEX `user_name_uindex`(`name` ASC) USING BTREE,
163 | UNIQUE INDEX `user_id_uindex`(`id` ASC) USING BTREE
164 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
165 |
166 | SET FOREIGN_KEY_CHECKS = 1;
167 |
--------------------------------------------------------------------------------
/Front-end/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 | pnpm-debug.log*
14 |
15 | # Editor directories and files
16 | .idea
17 | .vscode
18 | *.suo
19 | *.ntvs*
20 | *.njsproj
21 | *.sln
22 | *.sw?
23 |
24 | /src/assets/testFile/
25 |
--------------------------------------------------------------------------------
/Front-end/README.md:
--------------------------------------------------------------------------------
1 | # untitled1
2 |
3 | ## Project setup
4 | ```
5 | npm install
6 | ```
7 |
8 | ### Compiles and hot-reloads for development
9 | ```
10 | npm run serve
11 | ```
12 |
13 | ### Compiles and minifies for production
14 | ```
15 | npm run build
16 | ```
17 |
18 | ### Lints and fixes files
19 | ```
20 | npm run lint
21 | ```
22 |
23 | ### Customize configuration
24 | See [Configuration Reference](https://cli.vuejs.org/config/).
25 |
--------------------------------------------------------------------------------
/Front-end/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/Front-end/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "esnext",
5 | "baseUrl": "./",
6 | "moduleResolution": "node",
7 | "paths": {
8 | "@/*": [
9 | "src/*"
10 | ]
11 | },
12 | "lib": [
13 | "esnext",
14 | "dom",
15 | "dom.iterable",
16 | "scripthost"
17 | ]
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Front-end/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bookshop-system",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build",
8 | "lint": "vue-cli-service lint"
9 | },
10 | "dependencies": {
11 | "@element-plus/icons-vue": "^0.2.7",
12 | "axios": "^0.26.1",
13 | "core-js": "^3.8.3",
14 | "element-plus": "^2.0.2",
15 | "less": "^4.1.2",
16 | "less-loader": "^10.2.0",
17 | "vue": "^3.2.13",
18 | "vue-router": "^4.0.13",
19 | "vuex": "^4.0.2"
20 | },
21 | "devDependencies": {
22 | "@babel/core": "^7.12.16",
23 | "@babel/eslint-parser": "^7.12.16",
24 | "@vue/cli-plugin-babel": "~5.0.0",
25 | "@vue/cli-plugin-eslint": "~5.0.0",
26 | "@vue/cli-service": "~5.0.0",
27 | "babel-plugin-import": "^1.13.3",
28 | "eslint": "^7.32.0",
29 | "eslint-plugin-vue": "^8.0.3"
30 | },
31 | "eslintConfig": {
32 | "root": true,
33 | "env": {
34 | "node": true
35 | },
36 | "extends": [
37 | "plugin:vue/vue3-essential",
38 | "eslint:recommended"
39 | ],
40 | "parserOptions": {
41 | "parser": "@babel/eslint-parser"
42 | },
43 | "rules": {}
44 | },
45 | "browserslist": [
46 | "> 1%",
47 | "last 2 versions",
48 | "not dead",
49 | "not ie 11"
50 | ]
51 | }
52 |
--------------------------------------------------------------------------------
/Front-end/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JackieCooo/BookshopSystem/60fe2a5a835a845beecf6429c9a94f82fff97df2/Front-end/public/favicon.ico
--------------------------------------------------------------------------------
/Front-end/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Front-end/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
15 |
16 |
24 |
--------------------------------------------------------------------------------
/Front-end/src/assets/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JackieCooo/BookshopSystem/60fe2a5a835a845beecf6429c9a94f82fff97df2/Front-end/src/assets/Logo.png
--------------------------------------------------------------------------------
/Front-end/src/components/AccountCenterPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | 基本信息
19 | 设置
20 |
21 |
22 |
23 | 1
24 | 1
25 | 1
26 | 1
27 | 1
28 |
29 |
30 |
31 |
32 |
33 |
34 |
56 |
57 |
--------------------------------------------------------------------------------
/Front-end/src/components/AccountInfoPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 修改个人账户资料
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 男
23 | 女
24 |
25 |
26 |
27 | 保存
28 |
29 |
30 |
31 |
32 |
33 |
51 |
52 |
--------------------------------------------------------------------------------
/Front-end/src/components/AccountPanel.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
欢迎回来 {{getName}}
6 |
7 |
8 | 登出
9 |
10 |
11 |
12 |
13 |
14 | 我的订单
15 |
16 |
17 |
18 |
19 |
20 | 我的收藏
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | 会员中心
29 |
30 |
31 |
32 |
33 |
34 | 我的足迹
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
48 | 登录
49 |
50 |
51 | 欢迎登录
52 |
53 |
54 |
55 |
56 |
57 |
58 | 登录
59 |
60 |
61 |
62 | 注册
63 |
64 |
65 | 用户注册
66 |
67 |
68 |
69 | 注册
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
84 |
85 |
204 |
205 |
--------------------------------------------------------------------------------
/Front-end/src/components/AddressPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 收货地址
7 |
8 |
9 | 新增
10 |
11 |
12 |
13 |
14 |
15 | 修改/增加收件地址
16 |
17 | 收件人:
18 |
19 |
20 |
21 | 地址:
22 |
23 |
24 |
25 | 电话:
26 |
27 |
28 | 保存
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | 修改
39 | 删除
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
67 |
68 |
--------------------------------------------------------------------------------
/Front-end/src/components/BriefCard.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | {{info[i-1].name}}
16 | {{contentFormatting(i-1)}}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | {{info[i-1].title}}
36 | {{contentFormatting(i-1)}}
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
49 |
50 |
51 |
52 |
53 | {{info[i-1].title}}
54 | {{contentFormatting(i-1)}}
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
65 |
66 |
162 |
163 |
--------------------------------------------------------------------------------
/Front-end/src/components/BriefChartBoard.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
{{title}}
5 |
6 |
7 |
8 |
9 |
37 |
38 |
--------------------------------------------------------------------------------
/Front-end/src/components/ChartBoard.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{i}}
6 |
7 |
8 |
9 | 《{{info[i-1].name}}》
10 |
11 | {{info[i-1].author}}
12 | {{info[i-1].date}}
13 | {{info[i-1].publisher}}
14 | {{info[i-1].price}}元
15 |
16 |
17 | 电子书
18 | 二手书
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
33 |
34 |
82 |
83 |
--------------------------------------------------------------------------------
/Front-end/src/components/ChartPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
--------------------------------------------------------------------------------
/Front-end/src/components/CollectionPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 我的收藏
7 |
8 |
9 |
10 |
11 | 《{{i.name}}》/{{i.author}}/{{i.publisher}}/{{i.date}}
12 |
13 | 取消收藏
14 | 加入购物车
15 |
16 |
17 |
18 |
19 |
20 |
21 |
36 |
37 |
--------------------------------------------------------------------------------
/Front-end/src/components/DetailedChartBoard.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
{{title}}
8 |
9 |
10 |
11 |
12 |
13 |
14 | 1
15 |
16 | 《{{firstBook[0].name}}》
17 |
18 |
19 | {{firstBook[0].author}}
20 | {{firstBook[0].date}}
21 | {{firstBook[0].publisher}}
22 | {{firstBook[0].price}}元
23 |
24 |
25 | 电子书
26 | 二手书
27 |
28 |
29 |
30 |
31 |
32 |
33 | {{i+1}}
34 |
35 | 《{{info[i].name}}》
36 | {{info[i].author}}
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
95 |
96 |
--------------------------------------------------------------------------------
/Front-end/src/components/FrontPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
48 |
49 |
59 |
60 |
--------------------------------------------------------------------------------
/Front-end/src/components/HottestSellersPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
18 |
19 |
70 |
71 |
--------------------------------------------------------------------------------
/Front-end/src/components/InfoCard.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{title}}
10 | {{data}}
11 |
12 |
13 |
14 |
15 |
36 |
37 |
--------------------------------------------------------------------------------
/Front-end/src/components/LatestBookPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
27 |
28 |
--------------------------------------------------------------------------------
/Front-end/src/components/LoginDialog.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 欢迎登录
5 |
6 |
7 |
8 |
9 |
10 |
11 | 登录
12 |
13 |
14 |
15 |
16 |
20 |
21 |
71 |
72 |
--------------------------------------------------------------------------------
/Front-end/src/components/MainFrame.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
31 |
32 |
49 |
--------------------------------------------------------------------------------
/Front-end/src/components/MemberPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 会员中心
6 |
7 |
8 | 账户中心
9 |
10 | 账户信息
11 | 修改密码
12 |
13 |
14 |
15 | 交易管理
16 |
17 | 我的收藏
18 | 收货地址
19 | 订单信息
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
40 |
41 |
--------------------------------------------------------------------------------
/Front-end/src/components/MenuBar.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{i.name}}
6 |
7 |
8 |
9 |
10 |
11 |
16 |
17 |
44 |
45 |
--------------------------------------------------------------------------------
/Front-end/src/components/OrderPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 订单管理
7 |
8 |
9 |
10 |
11 |
12 | 《{{props.row.name}}》/{{props.row.author}}/{{props.row.publisher}}/{{props.row.date}}
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
35 |
36 |
--------------------------------------------------------------------------------
/Front-end/src/components/PageHeader.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
17 |
18 |
--------------------------------------------------------------------------------
/Front-end/src/components/PasswordChangingPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 修改密码
7 |
8 |
9 |
10 |
11 | 原密码:
12 |
13 |
14 |
15 | 新密码:
16 |
17 |
18 |
19 | 确认新密码:
20 |
21 |
22 | 确认修改
23 |
24 |
25 |
26 |
27 |
28 |
45 |
46 |
--------------------------------------------------------------------------------
/Front-end/src/components/ProductPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{info.name}}
5 |
6 |
7 |
8 | 作者: {{info.author}}
9 | 出版社: {{info.publisher}}
10 | 出版时间: {{info.date}}
11 | 价格: {{info.price}}
12 | ISBN: {{info.isbn}}
13 |
14 |
15 |
16 | 选择类型:
17 |
18 |
19 |
20 |
21 |
22 | 选择数量:
23 |
24 |
25 |
26 | ¥ {{getPrice}}
27 | 加入购物车
28 | 立即购买
29 |
30 |
31 |
32 |
33 | 内容简介
34 |
35 | {{info.bookIntroduction}}
36 |
37 |
38 |
39 | 作者简介
40 |
41 | {{info.authorIntroduction}}
42 |
43 |
44 |
45 | 目录
46 |
47 | {{info.directory}}
48 |
49 |
50 |
51 |
52 |
53 |
54 |
59 |
60 |
120 |
121 |
--------------------------------------------------------------------------------
/Front-end/src/components/RankChangeIcon.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
18 |
19 |
20 |
43 |
44 |
--------------------------------------------------------------------------------
/Front-end/src/components/RegisterDialog.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 用户注册
5 |
6 |
7 |
8 | 注册
9 |
10 |
11 |
12 |
13 |
28 |
29 |
--------------------------------------------------------------------------------
/Front-end/src/components/ReviewChartPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
{{i.title}}
9 |
10 |
11 |
12 | {{i.date}}
13 | 评论者:{{i.author}}
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
29 |
30 |
64 |
65 |
--------------------------------------------------------------------------------
/Front-end/src/components/ReviewPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{reviewInfo.title}}
6 |
7 | {{reviewInfo.author}}
8 | 评论
9 | 《{{bookInfo.name}}》
10 | {{reviewInfo.date}}
11 |
12 | {{reviewInfo.content}}
13 |
14 |
15 | > {{bookInfo.name}}
16 |
17 |
18 |
19 | 作者:
20 | {{bookInfo.author}}
21 |
22 |
23 | 出版社:
24 | {{bookInfo.publisher}}
25 |
26 |
27 | 价格:
28 | {{bookInfo.price}}
29 |
30 |
31 | 出版时间:
32 | {{bookInfo.date}}
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
72 |
73 |
--------------------------------------------------------------------------------
/Front-end/src/components/RightSideBoard.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
{{title}}
5 |
6 |
7 |
8 |
9 | {{textFormatting(i.title)}}
10 |
11 |
12 |
13 |
14 |
15 |
47 |
48 |
--------------------------------------------------------------------------------
/Front-end/src/components/SearchPanel.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | 购物车
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | {{i.name}}
26 | {{i.author}} / {{i.publisher}} / {{i.date}}
27 | ¥ {{i.price}} x{{i.quantity}}
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
84 |
85 |
--------------------------------------------------------------------------------
/Front-end/src/components/SearchResultPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{i.name}}
8 | {{i.author}} / {{i.publisher}} / {{i.date}} / {{i.price}}元
9 |
10 |
11 |
12 |
13 |
14 |
15 |
43 |
44 |
--------------------------------------------------------------------------------
/Front-end/src/components/SideBoard.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 热销TOP榜
5 |
6 |
7 |
8 | {{i}}
9 | {{titleFormatting(info[i-1].name)}}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
44 |
45 |
--------------------------------------------------------------------------------
/Front-end/src/components/TabPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 首页
5 | 热门书评
6 | 排行榜
7 | 畅销推荐
8 | 新品上市
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
54 |
55 |
--------------------------------------------------------------------------------
/Front-end/src/components/TopBar.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
20 |
21 |
--------------------------------------------------------------------------------
/Front-end/src/components/WindowHeader.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 | 精选书评
7 | 排行榜
8 | 新品上架
9 | 畅销推荐
10 |
11 |
12 | 您好,{{getName}}
13 |
14 |
15 |
16 |
17 | 我的订单
18 | 我的收藏
19 | 收货地址
20 |
21 |
22 |
23 | 消息
24 | 登出
25 |
26 |
27 | 登录
28 | 注册
29 |
30 |
31 |
32 |
33 |
34 | 欢迎登录
35 |
36 |
37 |
38 |
39 |
40 |
41 | 登录
42 |
43 |
44 |
45 |
46 |
47 | 用户注册
48 |
49 |
50 |
51 | 注册
52 |
53 |
54 |
55 |
56 |
57 |
58 |
61 |
62 |
130 |
131 |
--------------------------------------------------------------------------------
/Front-end/src/main.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import App from './App.vue'
3 | import ElementPlus from 'element-plus'
4 | import router from './router';
5 | import 'element-plus/dist/index.css'
6 | import axios from 'axios';
7 | import store from './store'
8 |
9 | const app = createApp(App)
10 | axios.defaults.baseURL = 'http://localhost:8001'
11 | app.config.globalProperties.$http = axios;
12 |
13 | app.use(ElementPlus)
14 | app.use(router)
15 | app.use(store)
16 | app.mount('#app')
17 |
--------------------------------------------------------------------------------
/Front-end/src/router.js:
--------------------------------------------------------------------------------
1 | import {createRouter, createWebHashHistory} from "vue-router";
2 |
3 | import FrontPage from "@/components/FrontPage";
4 | import ChartPage from "@/components/ChartPage";
5 | import ReviewChartPage from "@/components/ReviewChartPage";
6 | import LatestBookPage from "@/components/LatestBookPage";
7 | import HottestSellersPage from "@/components/HottestSellersPage";
8 | import ChartBoard from "@/components/ChartBoard";
9 | import ProductPage from "@/components/ProductPage";
10 | import MemberPage from "@/components/MemberPage";
11 | import AccountCenterPage from "@/components/AccountCenterPage";
12 | import AccountInfoPage from "@/components/AccountInfoPage";
13 | import PasswordChangingPage from "@/components/PasswordChangingPage";
14 | import AddressPage from "@/components/AddressPage";
15 | import CollectionPage from "@/components/CollectionPage";
16 | import OrderPage from "@/components/OrderPage";
17 | import ReviewPage from "@/components/ReviewPage";
18 | import SearchResultPage from "@/components/SearchResultPage";
19 |
20 | const StyleChartBoard = {
21 | template: '',
22 | components: {
23 | ChartBoard,
24 | }
25 | }
26 |
27 | const routes = [
28 | {
29 | path: '/',
30 | redirect: '/home'
31 | },
32 | {
33 | path: '/home',
34 | component: FrontPage,
35 | },
36 | {
37 | path: '/chart',
38 | component: ChartPage,
39 | },
40 | {
41 | path: '/review',
42 | component: ReviewChartPage,
43 | },
44 | {
45 | path: '/review/:id',
46 | component: ReviewPage,
47 | },
48 | {
49 | path: '/latest',
50 | component: LatestBookPage
51 | },
52 | {
53 | path: '/hottest',
54 | redirect: '/hottest/all',
55 | component: HottestSellersPage,
56 | children: [
57 | {path: ':type', component: StyleChartBoard},
58 | ],
59 | },
60 | {
61 | path: '/book/:id',
62 | component: ProductPage,
63 | },
64 | {
65 | path: '/member',
66 | redirect: '/member/home',
67 | component: MemberPage,
68 | children: [
69 | {path: 'home', component: AccountCenterPage},
70 | {path: 'account', component: AccountInfoPage},
71 | {path: 'password', component: PasswordChangingPage},
72 | {path: 'address', component: AddressPage},
73 | {path: 'collection', component: CollectionPage},
74 | {path: 'order', component: OrderPage},
75 | ]
76 | },
77 | {
78 | path: '/search/:content',
79 | component: SearchResultPage,
80 | },
81 | ]
82 |
83 | const router = createRouter({
84 | history: createWebHashHistory(),
85 | routes,
86 | })
87 |
88 | export default router
89 |
--------------------------------------------------------------------------------
/Front-end/src/store.js:
--------------------------------------------------------------------------------
1 | import {createStore} from 'vuex';
2 |
3 | const store = createStore({
4 | state: {
5 | isLogin: false,
6 | baseUrl: 'http://localhost:8001/',
7 | user: {
8 | id: null,
9 | name: null,
10 | phone: null,
11 | mail: null,
12 | gender: null,
13 | password: null,
14 | },
15 | },
16 | mutations: {
17 | login(state, user) {
18 | state.user.id = user.id
19 | state.user.name = user.name
20 | state.user.phone = user.phone
21 | state.user.gender = user.gender
22 | state.user.mail = user.mail
23 | state.user.password = user.password
24 | state.isLogin = true
25 | },
26 | logout(state) {
27 | state.user.id = null
28 | state.user.name = null
29 | state.user.phone = null
30 | state.user.gender = null
31 | state.user.mail = null
32 | state.user.password = null
33 | state.isLogin = false
34 | }
35 | },
36 | })
37 |
38 | export default store
39 |
--------------------------------------------------------------------------------
/Front-end/vue.config.js:
--------------------------------------------------------------------------------
1 | const { defineConfig } = require('@vue/cli-service')
2 | module.exports = defineConfig({
3 | transpileDependencies: true,
4 | runtimeCompiler: true, // 运行时编译
5 | publicPath: './',
6 | productionSourceMap: false,
7 | })
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 四、本站软件环境要求
2 | 4.1 基本环境要求
3 | 1.开发工具:
4 | ① 前端IDE:WebStorm 2021.3
5 | ② 后端IDE:IntelliJ IDEA 2021.3
6 | 2.前端环境:
7 | ① 主框架:Vue3 全家桶
8 | ② GUI:Element-plus 2.1.x
9 | ③ 包管理:Node.js 6.14.8
10 | ④ 项目打包:Webpack
11 | 3.后端环境:
12 | ① 主框架:Springboot 2.6.4
13 | ② 数据库:MySQL 8.0.x
14 | ③ 数据库框架:Mybatis-plus 3.5.1
15 | ④ 项目管理:Maven 4.0.x
16 | ⑤ 服务器:Tomcat 9.0.x
17 | ⑥ 项目打包:Webpack
18 | ⑦ JDK:jdk 17
19 | 4.2 使用注意事项
20 | 本设计是一个前后端分离的项目,基本结构包括前端、后端与数据库。在源代码文件夹下包含Front-end、Back-end及Database文件夹,分别对应上述3个结构。
21 | 其中网页的index.html文件在Front-end文件夹的dist文件夹内,打开该html文件将只会渲染网页的离线部分;若要成功渲染网页的全部部分,必须同时启动运行后端服务器与数据库。
22 | 后端的项目管理使用Maven进行管理,因此在运行后端服务器前,确认本机上已配置对应的Maven服务,否则将无法加载对应的第三方包。
23 | 若开启后端服务器后,网页仍不能成功渲染到全部数据,请检查“Front-end”-“src”-“main.js”文件内的“axios.defaults.baseURL = 'http://localhost:8001'”代码是否对应自己电脑的IP地址。
--------------------------------------------------------------------------------