first commit

This commit is contained in:
编码猿
2024-09-27 01:16:36 +08:00
commit f7fc9bbea0
301 changed files with 33825 additions and 0 deletions

12
shop_Frontend/.babelrc Executable file
View File

@@ -0,0 +1,12 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"]
}

9
shop_Frontend/.editorconfig Executable file
View File

@@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

4
shop_Frontend/.eslintignore Executable file
View File

@@ -0,0 +1,4 @@
/build/
/config/
/dist/
/*.js

27
shop_Frontend/.eslintrc.js Executable file
View File

@@ -0,0 +1,27 @@
// https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
],
// required to lint *.vue files
plugins: [ 'vue'],
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}

14
shop_Frontend/.gitignore vendored Executable file
View File

@@ -0,0 +1,14 @@
.DS_Store
node_modules/
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln

10
shop_Frontend/.postcssrc.js Executable file
View File

@@ -0,0 +1,10 @@
// 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
shop_Frontend/.pydio Normal file
View File

@@ -0,0 +1 @@
c7005a0b-60c7-4701-b624-aeff2b66323f

7
shop_Frontend/README.md Executable file
View File

@@ -0,0 +1,7 @@
# shop-fend
> A Vue.js project
- 1将用户的收货地址信息存到 shop_user (完成)
- 2将用户的订单信息存到 shop_order
- 3减少用户表的用户余额

View File

@@ -0,0 +1 @@
2f551b00-a467-44a8-82e0-cba18ff016fd

41
shop_Frontend/build/build.js Executable file
View File

@@ -0,0 +1,41 @@
'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'
))
})
})

View File

@@ -0,0 +1,54 @@
'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)
}
}

BIN
shop_Frontend/build/logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

101
shop_Frontend/build/utils.js Executable file
View File

@@ -0,0 +1,101 @@
'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')
})
}
}

View File

@@ -0,0 +1,22 @@
'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'
}
}

View File

@@ -0,0 +1,92 @@
'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)
}
const createLintingRule = () => ({
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
options: {
formatter: require('eslint-friendly-formatter'),
emitWarning: !config.dev.showEslintErrorsInOverlay
}
})
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','.less'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
}
},
module: {
rules: [
...(config.dev.useEslint ? [createLintingRule()] : []),
{
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'
}
}

View File

@@ -0,0 +1,95 @@
'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)
}
})
})

View File

@@ -0,0 +1,145 @@
'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({
filename: '[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

View File

@@ -0,0 +1 @@
0780e25e-d1eb-42d6-8186-e78f7b131261

View File

@@ -0,0 +1,7 @@
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})

75
shop_Frontend/config/index.js Executable file
View File

@@ -0,0 +1,75 @@
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
// Use Eslint Loader?
// If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console.
useEslint: false,
// If true, eslint errors and warnings will also be shown in the error overlay
// in the browser.
showEslintErrorsInOverlay: false,
/**
* Source Maps
*/
// https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map',
// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true,
cssSourceMap: true
},
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
/**
* Source Maps
*/
productionSourceMap: false,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css', 'html'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
}

View File

@@ -0,0 +1,4 @@
'use strict'
module.exports = {
NODE_ENV: '"production"'
}

26
shop_Frontend/gulpfile.js Executable file
View File

@@ -0,0 +1,26 @@
const gulp = require('gulp');
const zip = require('gulp-zip');
const ftp = require('gulp-ftp');
const gutil = require('gulp-util');
gulp.task('copy', function () {
return gulp.src('run/*')
.pipe(gulp.dest('dist/'))
});
gulp.task('zip', () =>
gulp.src('dist/**/*')
.pipe(zip('code.zip'))
.pipe(gulp.dest('./'))
);
gulp.task('ftp', function () {
return gulp.src('code.zip')
.pipe(ftp({
host: '103.95.207.27',
user: 'shops',
pass: 'AWWyWBXww8'
}))
.pipe(gutil.noop());
});

18
shop_Frontend/index.html Executable file
View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<title>shop-fend</title>
<script src="./static/js/ydui.flexible.js"></script>
</head>
<body>
<div id="app"></div>
</body>
</html>

11761
shop_Frontend/package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

84
shop_Frontend/package.json Executable file
View File

@@ -0,0 +1,84 @@
{
"name": "shop-fend",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "bmy",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"lint": "eslint --ext .js,.vue src",
"build": "node build/build.js",
"copy": "gulp copy",
"zip": "gulp zip",
"ftp": "gulp ftp"
},
"dependencies": {
"vue": "^2.5.2",
"vue-router": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"axios": "^0.18.0",
"babel-core": "^6.22.1",
"babel-eslint": "^8.2.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",
"compression-webpack-plugin": "^2.0.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"gulp": "^3.9.1",
"gulp-ftp": "^1.1.0",
"gulp-util": "^3.0.8",
"gulp-zip": "^4.2.0",
"html-webpack-plugin": "^2.30.1",
"node-notifier": "^5.1.2",
"node-rsa": "^1.0.1",
"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",
"vue-ydui": "^1.2.6",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0",
"ydui-district": "^1.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}

1
shop_Frontend/run/.pydio Normal file
View File

@@ -0,0 +1 @@
1ae8b58f-7c67-478a-bd0a-6fe860c2ea02

20
shop_Frontend/run/package.json Executable file
View File

@@ -0,0 +1,20 @@
{
"name": "run",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "pm2 start server.js --watch -i max --name fend",
"restart": "pm2 restart server.js",
"stop": "pm2 stop fend",
"list": "pm2 list",
"log": "pm2 logs"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "~4.16.0"
}
}

8
shop_Frontend/run/server.js Executable file
View File

@@ -0,0 +1,8 @@
const express = require('express')
const app = express()
app.use(express.static('./'))
app.listen(8848, () => {
console.log('Example app listening on port 8848!')
})

1
shop_Frontend/src/.pydio Normal file
View File

@@ -0,0 +1 @@
ad7a6d79-fef5-4deb-a046-0cf1269eb6d7

103
shop_Frontend/src/App.vue Executable file
View File

@@ -0,0 +1,103 @@
<template>
<div id="app">
<!-- 顶部导航 -->
<menus :headerTitle="navbarTitle" v-if="showNavBar" ref="menus" @change="ChangeHeader"></menus>
<div class="content">
<!-- 需要被缓存的组件 -->
<keep-alive>
<router-view v-if="$route.meta.keepAlive"/>
</keep-alive>
<router-view v-if="!$route.meta.keepAlive"></router-view>
</div>
<!-- 底部导航 -->
<footers @change="ChangeHeader" ref="footer" v-if="showFooter"></footers>
</div>
</template>
<script>
// 头部导航
import NavBarComponent from "./components/public/navbar";
// 底部导航
import TabBarComponent from "./components/public/tabbar";
export default {
data() {
return {
// 标签卡标题
navbarTitle: "我的",
// 是否展示底部导航
showFooter: true,
// 是否展示顶部导航
showNavBar: true
};
},
watch: {
// 监听路由切换,进入对应页面执行对应隐藏操作
$route(e) {
switch (e.name) {
case "info":
this.showFooter = false;
this.showNavBar = false;
break;
case "cart":
this.showNavBar = false;
break;
case "me":
this.showNavBar = false;
break;
case "login":
localStorage.getItem("u") != null ? this.$router.back() : "";
this.showNavBar = false;
break;
case "register":
localStorage.getItem("u") != null ? this.$router.back() : "";
this.showNavBar = false;
break;
default:
this.showFooter = true;
this.showNavBar = true;
break;
}
}
},
methods: {
ChangeHeader(title) {
this.navbarTitle = title;
}
},
components: {
menus: NavBarComponent,
footers: TabBarComponent
}
};
</script>
<style>
.yd-scrolltab {
margin: 1rem 0 1.3rem 0;
}
.router-link-active {
color: #ef4f4f !important;
}
.yd-checklist-item-icon {
display: none !important;
}
.content,
#app {
width: 100%;
height: 100%;
}
.g-fix-ios-prevent-scroll {
overflow: auto !important;
position: inherit !important;
}
.yd-preview-header > * {
flex: none !important;
}
</style>

View File

@@ -0,0 +1 @@
c68ffd63-be51-4b45-a48c-702e68bab92f

94
shop_Frontend/src/api/index.js Executable file
View File

@@ -0,0 +1,94 @@

import Vue from 'vue'
import axios from 'axios'
import utils from '../lib';
import { Toast, Loading } from 'vue-ydui/dist/lib.rem/dialog';
// axios.defaults.baseURL = 'http://103.95.207.27:9090'
axios.defaults.baseURL = 'http://127.0.0.1:9090'
axios.defaults.timeout = 3000;
// 在前端发生给后端ajax中间进行一次拦截
axios.interceptors.request.use(config => {
Loading.open('数据正在路上...')
return config;
}, error => {
return Promise.reject(error);
});
// 在后端返回数据给前端之前拦截一下,主要做错误码的判断
axios.interceptors.response.use(response => {
switch (response.data.status) {
case 200:
Loading.close()
return response;
break;
case 404:
Loading.close()
return response;
break;
default:
Toast({
mes: '请求失败,请联系管理员',
timeout: 2500,
icon: 'error',
})
Loading.close()
return response;
break;
}
}, error => {
// 对响应错误做点什么
return Promise.reject(error);
});
export default {
/**
* Get请求
* @param {*object} params 请求参数
* {
* url: "/index", // url地址
* par : { // 请求参数
* }
* }
*/
get(params) {
return new Promise((resole, reject) => {
axios.get(params.url, {
params: params.data
})
.then(success => {
resole(success.data)
})
.catch(error => {
Loading.close()
Toast({
mes: 'GET: 您的网络不好',
timeout: 1500,
icon: 'error',
})
});
})
},
post(params) {
return new Promise((resole, reject) => {
axios.post(params.url, params.data)
.then(response => {
resole(response.data);
})
.catch(error => {
Loading.close()
Toast({
mes: 'POST: 您的网络不好',
timeout: 1500,
icon: 'error',
})
});
})
}
}

View File

@@ -0,0 +1 @@
6d1f1361-1da8-4856-b9d8-7f5698e418f1

View File

@@ -0,0 +1 @@
33880a0e-e8ed-4741-988c-8e7ffe960635

View File

@@ -0,0 +1,106 @@
.cart-play {
width: 100%;
height: 45px;
background: #fff;
position: fixed;
left: 0;
bottom: 48px;
z-index: 99;
}
.play-left {
width: 60%;
height: 100%;
float: left;
line-height: 45px;
padding-left: 10px;
}
.play-right {
width: 40%;
background: #e43130;
height: 100%;
float: left;
line-height: 45px;
text-align: center;
color: #fff;
font-weight: 500;
letter-spacing: 2px;
font-size: 18px;
}
.demo-checklist-img {
width: 80px;
height: 80px;
border: 1px solid #ececec;
}
.yd-flexbox-item {
padding-left: 20px;
}
.yd-flexbox-item .item-name {
font-size: 16px;
font-weight: bold;
color: #000;
}
.yd-flexbox-item .item-change {
text-align: right;
}
.yd-flexbox-item .item-change .yd-spinner {
width: 100px;
height: 30px;
}
.yd-flexbox-item .item-price {
font-size: 16px;
color: #f00;
}
.total {
width: 2rem;
height: .6rem;
float: left;
margin: .1rem 0;
}
.numbers {
width: 1rem;
height: .6rem;
line-height: .6rem;
text-align: center;
background: #fff;
float: left;
}
.reduce,.plus{
width: .5rem;
height: .5rem;
line-height: .5rem;
text-align: center;
float: left;
border-radius: 100px;
background: #fafafa;
color: #666;
}
.delete {
float: right;
color: #8d8d8d;
line-height: .5rem;
}
.action .price {
color: red;
float: left;
margin-right: .1rem
}
.noCart {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
text-align: center;
width: 100%;
height: 100%;
}
.noCart img {
width: 1.8rem;
}
.noCart p {
font-size: .24rem;
line-height: .38rem;
color: #8d8d8d;
margin-top: .24rem;
}

View File

@@ -0,0 +1,110 @@
.main-info {
background: #fff;
}
.info-three {
padding: 16.667px;
}
.info-header h3{
font-size: 20.8333px;
color: rgb(60, 60, 60);
font-weight: 500;
line-height: 31.25px;
}
.header-top{
color: rgba(0,0,0,.54)
}
.header-top span {
color: rgb(255, 74, 0);
}
.price {
padding-top: 10.4167px;
font-size: 12.5px;
color: rgba(0, 0, 0, 0.54);
}
.price em {
margin-right: 8.33333px;
font-size: 25px;
line-height: 25px;
color: rgb(255, 103, 0);
text-decoration: none;
}
.price span {
text-decoration: line-through;
}
.info-configure {
margin-top: 23px;
height: auto;
}
.configure-server {
display: flex;
width: 100%;
height: 42px;
align-items: center;
justify-content: space-between;
font-size: 13px;
color: rgb(153, 153, 153);
}
.configure-server div:first-child{
flex-grow: 1;
}
.configure-server div:last-child{
flex-grow: 7;
}
.info-introduce img {
width: 100%;
}
.cart-list {
margin: 0 8.3333px 8.3333px;
background: rgba(255, 255, 255, 0.93);
height: 57.2px;
-webkit-box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px rgba(0,0,0,.14), 0 1px 10px rgba(0,0,0,.12);
box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px rgba(0,0,0,.14), 0 1px 10px rgba(0,0,0,.12);
border: 1px solid #e5e5e5;
position: fixed;
left: 0;
width: 96%;
bottom: 0;
border-radius: 8.333px;
display: flex;
align-items:center;
justify-content: space-around;
z-index: 999;
}
.items-icons {
flex-grow: 1;
color: rgba(0,0,0,.54);
}
.items-big {
flex-grow: 2;
}
.items-big .add-cart {
float: right;
margin-right: 16.667px;
width: 2.3rem;
}
.header-action {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: .88rem;
display: flex;
align-items: center;
justify-content: space-between;
z-index: 99;
padding: 0 .2rem;
transition: all 2s
}
.header-action .action-left,
.header-action .action-right{
width: .62rem;
height: .6rem;
background: rgba(0, 0, 0, 0.12);
border-radius: 100%;
text-align: center;
line-height: .63rem;
}
.white {
background: #fff !important;
}

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,55 @@
.flex-layout {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 .26rem;
margin-bottom: .2rem;
margin-top: .2rem;
height: .9rem;
width: 100%;
background: #fff;
}
.order-address {
margin-top: 60px;
background: #fff url("http://s1.mi.com/m/images/m/bd1.png") 0 0 repeat-x;
background-size: .52rem .08rem;
}
.pay-list img{
width: 23px;
flex-grow: 1;
margin-right: .2rem;
}
.pay-list p{
flex-grow: 17;
}
.alipay,
.wxpay {
width: 12px !important;
margin-left: .16rem;
}
.order-footer {
width: 100%;
height: 1rem;
position: fixed;
left: 0;
bottom: 0;
z-index: 99;
}
.footer-left,
.footer-right {
float: left;
width: 50%;
height: 1rem;
line-height: 1rem;
}
.footer-left {
background: #fff;
text-align: center;
}
.footer-right {
background: red;
text-align: center;
color: #fff;
font-size: 16px;
letter-spacing: 2px;
}

View File

@@ -0,0 +1,139 @@
.weixinPay {
width: 100%;
height: 100%;
position: fixed;
z-index: 991;
left: 0;
top: 0;
}
.zhez {
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 992;
background: #000;
opacity: .4;
}
.pay-windows {
position: absolute;
width: 88%;
height: 4.8rem;
background: #f8f8f8;
top: .5rem;
z-index: 993;
left: 50%;
margin-left: -3.3rem;
}
.windows-title {
width: 100%;
height: 1.08rem;
border-bottom: 1px solid #c9daca;
}
.windows-title img {
width: .66rem;
}
.windows-title span {
padding-left: .1rem;
font-size: .32rem;
}
.flex-layout {
display: flex;
align-items: center;
}
.windows-money {
height: 1.42rem;
width: 100%;
justify-content: center;
flex-direction: column;
}
.windows-money span {
font-size: .28rem;
}
.windows-money p {
font-size: .5rem;
}
.windows-card{
width: 89%;
margin: 0 auto;
line-height: .8rem;
color: #636363;
font-size: .32rem;
padding: .1rem 0;
overflow: hidden;
border-bottom: .02rem solid #e6e6e6;
border-top: .02rem solid #e6e6e6;
display: flex;
align-items: center;
justify-content: space-between;
}
.windows-card img{
width: .6rem;
flex-grow: 1;
}
.windows-card p{
flex-grow: 18;
margin-left: .1rem;
}
.input ul {
width: 89%;
margin: .2rem auto;
height: .8rem;
overflow: hidden;
border: .02rem solid #bebebe;
display: flex;
}
.input ul li {
border-right: .02rem solid #efefef;
height: .8rem;
width: .972rem;
background: #fff;
}
.numb_box{
position: absolute;
z-index: 10;
background: #f5f5f5;
width: 100%;
height: 4.66rem;
bottom: 0;
z-index: 993
}
.xiaq_tb {
padding: 5px 0;
text-align: center;
border-top: 1px solid #dadada;
}
.xiaq_tb img{
height: .2rem;
}
.nub_ggg {
border: 1px solid #dadada;
overflow: hidden;
border-bottom: 0;
}
.nub_ggg li {
width: 33.3333%;
border-bottom: 1px solid #dadada;
float: left;
text-align: center;
font-size: 22px;
height: 1.03rem;
line-height: 1.03rem;
}
.nub_ggg .zj_x {
border-left: 1px solid #dadada;
border-right: 1px solid #dadada;
}
.nub_ggg .no {
background: #e0e0e0
}
.no img{
width: 37.3px;
height: 22.44px;
}
.pwd{
background: rgb(255, 255, 255) url("../../../static/img/dd_03.jpg") center no-repeat !important;
background-size: 25% !important;
}

View File

@@ -0,0 +1 @@
1ed07cf6-a5a1-4892-91a8-7edb0c3fa459

View File

@@ -0,0 +1 @@
3f411338-6d07-46c7-9339-98601852e709

View File

@@ -0,0 +1 @@
7590ee77-6c1d-4eae-9a66-7a84c0dc41ba

View File

@@ -0,0 +1,91 @@
<template>
<div class="v-navbar">
<yd-search
class="search"
:result="result"
fullpage
v-model="searchKey"
placeholder="搜索商品名称"
:item-click="itemClickHandler"
:on-submit="submitHandler"
:on-cancel="cancelHandler">
</yd-search>
<yd-icon name="ucenter-outline" @click.native="$router.push({ name: 'me'})" color="#8d8d8d" class="me-icon"></yd-icon>
</div>
</template>
<script>
export default {
props: ["headerTitle"],
data() {
return {
searchKey: "",
result: []
};
},
methods: {
changeTitle(ti) {
this.$emit("change", ti);
this.$router.go(-1);
},
getResult(val) {
if (!val) return [];
return [
"Apple",
"Banana",
"Orange",
"Durian",
"Lemon",
"Peach",
"Cherry",
"Berry",
"Core",
"Fig",
"Haw",
"Melon",
"Plum",
"Pear",
"Peanut",
"Other"
].filter(value => new RegExp(val, "i").test(value));
},
// 匹配结果点击事件
itemClickHandler(item) {
this.$dialog.toast({ mes: `搜索1${item}` });
},
// 提交时触发方法
submitHandler(value) {
this.$dialog.toast({ mes: `搜索2${value}` });
},
cancelHandler() {
this.searchKey = "";
}
},
watch: {
searchKey(val) {
this.result = this.getResult(val);
}
}
};
</script>
<style scoped>
.v-navbar {
position: fixed;
width: 100%;
left: 0;
top: 0;
z-index: 999;
background: #efeff4;
display: flex;
align-items: center;
justify-content: space-between;
}
.search {
flex-grow: 1;
}
.me-icon {
padding-right: 8px;
}
</style>

View File

@@ -0,0 +1,21 @@
<template>
<div class="swiper">
<yd-slider autoplay="3000">
<yd-slider-item v-for="(item,index) in imglist" :key="index">
<a :href="item.href">
<img :src="item.url">
</a>
</yd-slider-item>
</yd-slider>
</div>
</template>
<script>
export default {
props: ["imglist"]
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,34 @@
<template>
<div class="tabbar">
<yd-tabbar slot="tabbar" fixed>
<yd-tabbar-item title="首页" link="/" @click.native="changeTitle('首页')">
<yd-icon name="home" size=".4rem" slot="icon"></yd-icon>
</yd-tabbar-item>
<!-- <yd-tabbar-item title="分类" link="/class" @click.native="changeTitle('分类')">
<yd-icon name="type" size=".4rem" slot="icon"></yd-icon>
</yd-tabbar-item> -->
<yd-tabbar-item title="购物车" link="/cart" @click.native="changeTitle('购物车')">
<yd-icon name="shopcart-outline" size=".4rem" slot="icon"></yd-icon>
</yd-tabbar-item>
<yd-tabbar-item title="我的" link="/me" @click.native="changeTitle('我的')">
<yd-icon name="ucenter-outline" size=".4rem" slot="icon"></yd-icon>
</yd-tabbar-item>
</yd-tabbar>
</div>
</template>
<script>
export default {
methods: {
changeTitle(ti) {
this.$emit("change", ti);
//console.log(this.$root.$children[0].$data.navbarTitle =ti)
}
}
};
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,42 @@
<template>
<div class="me-header">
<img class="user-logo" src="https://m.mi.com/static/img/avatar.76a75b8f17.png" alt="">
<p>{{title}}</p>
<span v-if="yue">{{yue}}</span>
</div>
</template>
<script>
export default {
props: {
title: String,
yue: String
}
};
</script>
<style scoped>
.me-header {
width: 100%;
height: 4.6rem;
background: url("https://m.mi.com/static/img/bg.63c8e19851.png") center 0
#f37d0f;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.me-header img {
width: 1.6rem;
}
.me-header p {
color: #fff;
margin-top: 0.4rem;
font-size: 0.3rem;
letter-spacing: 3px;
}
.me-header span {
color: #ffd000;
margin-top: 5px;
}
</style>

View File

@@ -0,0 +1,166 @@
<template>
<div class="weixinPay" v-if="wxxxpay">
<p hidden :name="NowMoney = MoneyTotals"></p>
<div class="pay-windows">
<div class="windows-title flex-layout">
<img src="../../../static/img/xx_03.jpg" @click="changFatherStatus">
<img src="../../../static/img/jftc_03.jpg" alt="">
<span>请输入支付密码</span>
</div>
<div class="windows-money flex-layout">
<span>心机购官方直营店</span>
<p> {{MoneyTotals}}</p>
</div>
<div class="windows-card">
<img src="../../../static/img/ye.png" alt="">
<p>余额</p>
<img src="../../../static/img/jftc_09.jpg" alt="">
</div>
<div class="input">
<ul>
<li v-for="(pwds,index) in passwordList"
:key="index"
:class="pwds.hasClass ? 'pwd' : '' "
@click="hidden = true"></li>
</ul>
</div>
</div>
<div class="numb_box" v-if="hidden">
<div class="xiaq_tb" @click="hidden = false">
<img src="../../../static/img/jftc_14.jpg" alt="">
</div>
<ul class="nub_ggg">
<li v-for="(item,index) in keyNumber"
:key="index"
:class="item.haveClass == 0 ? '' : item.haveClass == 1 ? 'zj_x' : 'no' "
@click="item.haveClass == 2 ? '': item.haveClass == 3 ? deletePay() : submitPay() ">
{{item.num == 'space' ? '' : item.num == 'delete' ? '' : item.num }}
<img v-if="index == 11" :src="item.imgUrl" alt="">
</li>
</ul>
</div>
<div class="zhez">
</div>
</div>
</template>
<script>
export default {
props: {
wxxxpay: false,
MoneyTotals: Number
},
data() {
return {
keyNumber: [
{
num: 1,
haveClass: 0
},
{
num: 2,
haveClass: 1
},
{
num: 3,
haveClass: 0
},
{
num: 4,
haveClass: 0
},
{
num: 5,
haveClass: 1
},
{
num: 6,
haveClass: 0
},
{
num: 7,
haveClass: 0
},
{
num: 8,
haveClass: 1
},
{
num: 9,
haveClass: 0
},
{
num: "space",
haveClass: 2
},
{
num: 0,
haveClass: 1
},
{
num: "delete",
haveClass: 3,
imgUrl: "../../../static/img/jftc_18.jpg"
}
],
passwordList: [
{
setClass: "pwd",
hasClass: false
},
{
setClass: "pwd",
hasClass: false
},
{
setClass: "pwd",
hasClass: false
},
{
setClass: "pwd",
hasClass: false
},
{
setClass: "pwd",
hasClass: false
},
{
setClass: "pwd",
hasClass: false
}
],
i: 0,
hidden: true
};
},
methods: {
changFatherStatus() {
this.$emit("change", false);
},
submitPay() {
this.i++;
if (this.i < 6) {
this.passwordList[this.i - 1].hasClass = true;
} else {
this.passwordList[this.i - 1].hasClass = true;
setTimeout(() => {
this.$router.push({ name: "result" });
}, 500);
}
},
deletePay() {
if (this.i > 0) {
this.i--;
this.passwordList[this.i].hasClass = false;
this.i == 0;
}
}
}
};
</script>
<style scoped>
@import url("../../assets/css/wxpay.css");
</style>

View File

@@ -0,0 +1 @@
9b4cbbeb-f416-4f86-bd63-56607d9b5950

View File

@@ -0,0 +1,107 @@
<template>
<div class="adduser">
<v-header :title="'注册'"></v-header>
<yd-cell-group>
<yd-cell-item>
<yd-input slot="right" required type="number" ref="phone" v-model="userPhone" regex="mobile" placeholder="手机号"></yd-input>
</yd-cell-item>
<yd-cell-item>
<yd-input slot="right" required type="text" ref="nicname" min="3" max="10" v-model="userNicName" placeholder="昵称3-10"></yd-input>
</yd-cell-item>
<yd-cell-item>
<yd-input slot="right" required type="password" ref="surepwd" min="6" max="20" v-model="userPwd" placeholder="密码6-20"></yd-input>
</yd-cell-item>
<yd-cell-item>
<yd-input slot="right" required type="password" ref="surepwds" min="6" max="20" v-model="userSurePwd" placeholder="确认密码6-20"></yd-input>
</yd-cell-item>
</yd-cell-group>
<yd-button-group>
<yd-button size="large" type="primary" bgcolor="#f37d0f" color="#fff" shape="circle" @click.native="clickHander">注册</yd-button>
</yd-button-group>
<div class="reg-tips">
<a class="index" href="#/">首页</a>
<a class="action" href="#/login">登录</a>
</div>
</div>
</template>
<script>
import UserHeader from "./../public/user-header";
export default {
data() {
return {
userPhone: null,
userNicName: null,
userPwd: null,
userSurePwd: null
};
},
beforeRouteEnter(to, from, next) {
next(vm => {
vm.$parent.$data.showFooter = false;
vm.$parent.$data.showNavBar = false;
});
},
methods: {
async clickHander() {
if (
this.$refs.phone.valid &&
this.$refs.nicname.valid &&
this.$refs.surepwd.valid &&
this.$refs.surepwds.valid
) {
if (this.userPwd == this.userSurePwd) {
let list = await this.$http.post({
url: "/user/addUser",
data: {
phone: this.userPhone,
nickname: this.userNicName,
pwd: this.userSurePwd
}
});
console.log(list)
if (list.status == 200) {
this.$dialog.toast({
mes: "注册成功",
timeout: 1500,
icon: "success",
callback: () => {
this.$router.push({ name: "login" });
}
});
}
} else {
this.$dialog.toast({
mes: "密码不一致",
timeout: 1500
});
}
}
}
},
components: {
"v-header": UserHeader
}
};
</script>
<style scoped>
.reg-tips {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 21px;
color: #919191;
letter-spacing: 2px;
padding: 0 12px;
font-size: 12px;
}
.action {
float: right;
}
.index {
float: left;
}
</style>

View File

@@ -0,0 +1,132 @@
<template>
<div class="cart">
<div v-if="cartList.length == 0" class="noCart">
<img src="../../../static/img/nocart.png" alt="没有数据">
<p>再忙 <br> 也要买点东西犒劳自己</p>
</div>
<div class="cart-listshop" v-else>
<yd-checklist v-model="checklist4" :label="false">
<yd-checklist-item v-for="(item,index) in cartList" :key="index" :val="item.cid">
<yd-flexbox style="padding: 15px 0;">
<img :src="item.commodity_thumbnail" class="demo-checklist-img">
<yd-flexbox-item align="top">
{{item.commodity_name}}<br/>
{{item.commodity_content | SpliceString}}<br/>
<div class="total">
<div class="reduce" @click="reduce(index)">-</div>
<div class="numbers">{{item.cart_nums}}</div>
<div class="plus" @click="plus(index)">+</div>
</div>
<br><br><br>
<div class="action">
<p class="price">单价: {{item.commodity_nowprice}}</p>
<span> 小计: {{item.commodity_nowprice * item.cart_nums}}</span>
<span class="delete" @click="deleteShop(index,item.cid)">删除</span>
</div>
</yd-flexbox-item>
</yd-flexbox>
</yd-checklist-item>
</yd-checklist>
<div class="cart-play">
<div class="play-left">
总计{{totalPrice}}
</div>
<div class="play-right" @click="submitOrder()">
下单买({{cartList.length}})
</div>
</div>
</div>
</div>
</template>
<script>
// vuex
export default {
created() {
this.getCartList();
},
data() {
return {
checklist4: [],
spinner1: 0,
cartList: []
};
},
beforeRouteEnter(to, from, next) {
next(vm => {
vm.$parent.$data.showFooter = true;
vm.$parent.$data.showNavBar = false;
});
},
methods: {
submitOrder() {
this.$utils.SetLocalstorage("data", this.cartList);
this.$router.push({ name: "order" });
},
// 删除商品的操作
async deleteShop(index, cid) {
this.cartList.splice(index, 1);
let deletes = await this.$http.post({
url: "/cart/deleteCart",
data: {
cid: cid
}
});
},
// 减商品数量的操作
reduce(index) {
this.cartList[index].cart_nums <= 1
? ""
: this.cartList[index].cart_nums--;
},
// 加商品数量操作
plus(index) {
this.cartList[index].cart_nums >= this.cartList[index].commodity_stock
? ""
: this.cartList[index].cart_nums++;
},
/**
* 获取购物车列表的数据
*/
async getCartList() {
let shoplist = await this.$http.post({
url: "/cart/selectCart",
data: {
userid: this.$utils.getUserInfo().id
}
});
console.log(shoplist)
shoplist.status == 200 ? (this.cartList = shoplist.data) : [];
}
},
// 计算属性,计算商品的总价
computed: {
totalPrice() {
let total = 0;
for (const key in this.cartList) {
total +=
this.cartList[key].cart_nums * this.cartList[key].commodity_nowprice;
}
return total;
}
},
// 过滤器,裁剪手机的介绍文字
filters: {
SpliceString(val) {
return val.substring(0, 30) + "...";
}
}
};
</script>
<style scoped>
@import url("../../assets/css/cart.css");
.cart {
height: 100%;
}
.cart-listshop {
padding: 0 0 1.95rem 0;
}
</style>

View File

@@ -0,0 +1,39 @@
<template>
<div class="class">
<yd-scrolltab :callback="getKey">
<yd-scrolltab-panel label="小米" icon="demo-icons-category1">
<div style="height: 350px;background-color: gray;"></div>
</yd-scrolltab-panel>
<yd-scrolltab-panel label="华为" icon="demo-icons-category2" active>
<div style="height: 350px;background-color: blue;"></div>
</yd-scrolltab-panel>
<yd-scrolltab-panel label="一加" icon="demo-icons-category3">
<div style="height: 350px;background-color: yellow;"></div>
</yd-scrolltab-panel>
<yd-scrolltab-panel label="三星" icon="demo-icons-category3">
<div style="height: 350px;background-color: yellow;"></div>
</yd-scrolltab-panel>
<yd-scrolltab-panel label="锤子" icon="demo-icons-category3">
<div style="height: 350px;background-color: yellow;"></div>
</yd-scrolltab-panel>
</yd-scrolltab>
</div>
</template>
<script>
export default {
methods: {
getKey(index) {
console.log(index);
}
}
};
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,158 @@
<template>
<div class="index">
<!-- 轮播图 -->
<swiper :imglist="swiperList"></swiper>
<!-- 分类 -->
<yd-grids-group :rows="3" >
<yd-grids-item v-for="n in classList" :key="n.id" @click.native="enterInfo(n.title)">
<img slot="icon" :src="n.url">
<span slot="text">{{n.title}}</span>
</yd-grids-item>
</yd-grids-group>
<!-- 广告 -->
<div class="row_shop">
<img src="https://i8.mifile.cn/v1/a1/77c5c6e7-9303-afca-b551-b6b7b042a958!720x280.webp" alt="guanggao.jpg"/>
</div>
<!-- 商品列表 -->
<yd-list theme="3">
<yd-list-item v-for="item in shopList" :key="item.id" @click.native="EnterInfo(item.id)">
<img slot="img" :src="item.commodity_thumbnail">
<span slot="title">{{item.commodity_name}}</span>
<yd-list-other slot="other">
<div>
<span class="demo-list-price"><em>¥</em>{{item.commodity_nowprice}}</span>
<!-- <span class="demo-list-del-price">¥{{item.commodity_oldprice}}</span> -->
</div>
<div>销量{{item.commodity_sales}}</div>
</yd-list-other>
</yd-list-item>
</yd-list>
<!-- 分类的弹窗 -->
<yd-popup v-model="showClass" position="left" width="100%">
<yd-navbar :title="'分类 '+NavBarClassTitle" fixed>
<router-link to="" @click.native="showClass = false" slot="left">
<yd-navbar-back-icon></yd-navbar-back-icon>
</router-link>
</yd-navbar>
<br><br><br>
<yd-list theme="1">
<yd-list-item v-for="n in classShopList" :key="n.id" @click.native="EnterInfo(n.id)">
<img slot="img" :src="n.commodity_thumbnail">
<span slot="title">{{n.commodity_name}}</span>
<yd-list-other slot="other">
<div>
<span class="demo-list-price"><em>¥</em>{{n.commodity_nowprice}}</span>
<span class="demo-list-del-price">¥{{n.commodity_oldprice}}</span>
</div>
<div>销量:{{n.commodity_sales}}</div>
</yd-list-other>
</yd-list-item>
</yd-list>
</yd-popup>
<!-- 回到顶部 -->
<yd-backtop></yd-backtop>
</div>
</template>
<script>
import SwiperComponent from "../public/swiper";
export default {
created() {
this.getHomeData();
},
data() {
return {
showClass: false,
swiperList: [
{
id: "1",
href: "",
url: "../../../static/img/banner_1.webp"
},
{
id: "2",
href: "",
url: "../../../static/img/banner_2.webp"
},
{
id: "3",
href: "",
url: "../../../static/img/banner_3.webp"
},
{
id: "4",
href: "",
url: "../../../static/img/banner_4.webp"
}
],
classList: this.$config.pageConfig.index.classList,
shopList: [],
classShopList: [],
NavBarClassTitle: null,
page: 0
};
},
methods: {
// 进入详情
EnterInfo(ids) {
this.$router.push({ name: "info", params: { id: ids } });
},
// 获取首页数据
async getHomeData() {
let list = await this.$http.get({
url: "/shop/index",
data: {
page: this.page
}
});
this.shopList = list.data;
// if(list.message == "没有数据") {
// console.log("没有数据");
// this.$refs.infinitescrollDemo.$emit('ydui.infinitescroll.loadedDone');
// return;
// } else {
// console.log("有数据");
// this.shopList = [...list.data, this.shopList];
// /* 单次请求数据完毕 */
// this.$refs.infinitescrollDemo.$emit('ydui.infinitescroll.finishLoad');
// this.page++;
// }
},
// 获取分类数据
async enterInfo(type) {
let Class = await this.$http.get({
url: "/shop/class",
data: {
brand: type
}
});
console.log(Class)
this.classShopList = Class.data;
this.NavBarClassTitle = type;
this.showClass = true;
}
},
components: {
swiper: SwiperComponent
}
};
</script>
<style scoped>
.index {
padding: 1rem 0 1.3rem 0;
}
.row_shop img {
width: 100%;
height: 3rem;
}
</style>

View File

@@ -0,0 +1,194 @@
<template>
<div class="info">
<!-- 顶部商品主图轮播 -->
<swiper :imglist="infoMain"></swiper>
<!-- 主要商品信息 -->
<div class="main-info">
<div class="info-three">
<div class="info-header">
<h3>{{ infoList.commodity_name }}</h3>
<div class="header-top">
{{infoList.commodity_content}}
</div>
<div class="price">
<em>
¥ {{ infoList.commodity_nowprice }}
</em>
<span>
¥ {{ infoList.commodity_oldprice }}
</span>
</div>
</div>
<div class="info-configure">
<div class="configure-server">
<div>
服务
</div>
<div>
15天退货 · 运费险 · 公益宝贝
</div>
</div>
<div class="configure-server">
<div>
参数
</div>
<div>
品牌 Apple型号...
</div>
</div>
</div>
<div class="info-address"></div>
</div>
<div class="info-introduce">
<img v-for="(item,index) in attachimg" :key="index" :src="item.url" alt="">
</div>
</div>
<!-- 底部商品统计购买 -->
<div class="cart-list">
<yd-tabbar-item title="首页" link="/" class="items-icons">
<yd-icon name="home-outline" color="rgba(0,0,0,.54)" slot="icon" size="0.54rem"></yd-icon>
</yd-tabbar-item>
<yd-tabbar-item title="购物车" link="/cart" class="items-icons">
<yd-icon name="shopcart-outline" color="rgba(0,0,0,.54)" slot="icon" size="0.54rem"></yd-icon>
</yd-tabbar-item>
<div class="items-big">
<yd-button
@click.native="isShowAddCartAction ? addCart() : '' "
:class="[ isShowAddCartAction ? 'cartActive' : 'noActive' ,'add-cart']"
size="small" shape="circle">
{{ isShowAddCartAction ? '加入购物车': '购物车已存在' }}
</yd-button>
</div>
</div>
<!-- 返回顶部 -->
<yd-backtop></yd-backtop>
<div :class="actionWhite ? 'white header-action' : 'header-action' ">
<div class="action-left" @click="$router.back()">
<yd-navbar-back-icon size=".4rem"></yd-navbar-back-icon>
</div>
<div class="action-right" @click="$router.push({ name: 'cart' })">
<yd-icon name="shopcart-outline" size=".4rem"></yd-icon>
</div>
</div>
</div>
</template>
<script>
import SwiperComponent from "../public/swiper";
export default {
created() {
this.getShopInfo();
this.checkCart();
window.addEventListener("scroll", this.handleScroll);
},
data() {
return {
shopid: this.$route.params.id,
infoList: {},
infoMain: [],
userInfo: this.$utils.getUserInfo(),
isShowAddCartAction: true,
actionWhite: false,
attachimg: []
};
},
beforeRouteEnter(to, from, next) {
next(vm => {
vm.$parent.$data.showFooter = false;
vm.$parent.$data.showNavBar = false;
});
},
methods: {
handleScroll() {
var scrollTop =
window.pageYOffset ||
document.documentElement.scrollTop ||
document.body.scrollTop;
if (scrollTop > 80) {
this.actionWhite = true;
} else {
this.actionWhite = false;
}
},
// 检车商品是否被已经收藏过了
async checkCart() {
let check = await this.$http.post({
url: "/cart/checkCart",
data:{
userid: this.userInfo.id,
shopid: this.shopid
}
});
check.status == 200 ? (this.isShowAddCartAction = false) : ""
},
// 添加商品到购物车
async addCart() {
if (localStorage.getItem("u") == null) {
this.$dialog.toast({
mes: "请先登录",
timeout: 1500,
icon: "error",
callback: () => {
this.$router.push({ name: "login" });
}
});
} else {
let list = await this.$http.post({
url: "/user/addCart",
data: {
userid: this.userInfo.id,
shopid: this.shopid
}
});
if (list.status == 200) {
this.$dialog.toast({
mes: "加入购物车成功",
timeout: 1500
});
this.isShowAddCartAction = false;
}
}
},
// 请求商品详情数据
async getShopInfo() {
let list = await this.$http.get({
url: "/shop/info",
data: {
id: this.shopid
}
});
this.attachimg = JSON.parse(list.data[0].commodity_attachimg)
this.infoList = list.data[0];
this.infoMain = JSON.parse(this.infoList.commodity_main);
}
},
components: {
swiper: SwiperComponent
}
};
</script>
<style scoped>
@import url("../../assets/css/info.css");
.cartActive {
background: #ff6700 !important;
color: #fff !important;
}
.noActive {
background: #8d8d8d !important;
color: #616060 !important;
}
.content {
padding: 0 !important;
}
</style>

View File

@@ -0,0 +1,98 @@
<template>
<div class="login">
<v-header :title="'登录'"></v-header>
<yd-cell-group>
<yd-cell-item>
<yd-input slot="right" required type="number" ref="userPhone" v-model="userName" regex="mobile" placeholder="手机号"></yd-input>
</yd-cell-item>
<yd-cell-item>
<yd-input slot="right" required type="password" ref="userPwd" min="6" max="20" v-model="userPwd" placeholder="密码"></yd-input>
</yd-cell-item>
</yd-cell-group>
<yd-button-group>
<yd-button size="large" type="primary" bgcolor="#f37d0f" color="#fff" shape="circle" @click.native="clickHander">登录</yd-button>
</yd-button-group>
<div class="reg-tips">
<a class="index" href="#/">首页</a>
<a class="action" href="#/reg">注册</a>
</div>
</div>
</template>
<script>
import UserHeader from "./../public/user-header";
export default {
data() {
return {
userName: null,
userPwd: null
};
},
beforeRouteEnter(to, from, next) {
next(vm => {
vm.$parent.$data.showFooter = false;
vm.$parent.$data.showNavBar = false;
});
},
methods: {
async clickHander() {
//console.log(this.$refs.userPhone.valid);
if (this.$refs.userPwd.valid && this.$refs.userPhone.valid) {
let list = await this.$http.post({
url: "/user/login",
data: {
phone: `${this.userName}`,
pwd: `${this.userPwd}`
}
});
console.log("账号信息:", list)
if (list.status == 404) {
this.$dialog.toast({
mes: "账户密码有误",
timeout: 1500
});
} else {
this.$dialog.toast({
mes: "登录成功",
timeout: 1500,
icon: "success",
callback: () => {
localStorage.setItem("u", JSON.stringify(list.data[0]));
this.$router.replace({ name: "index" });
}
});
}
}
}
},
components: {
"v-header": UserHeader
}
};
</script>
<style scoped>
.reg-tips {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 21px;
color: #919191;
letter-spacing: 2px;
padding: 0 12px;
font-size: 12px;
cursor: default;
}
.action {
float: right;
}
.index {
float: left;
}
</style>

View File

@@ -0,0 +1,127 @@
<template>
<div class="me">
<v-header :title="userInfo.user_nicname" :yue="userInfo.user_money"></v-header>
<yd-grids-group :rows="2">
<yd-grids-item v-for="(item,index) in OrserAction" :key="index" @click.native="checkOrderStatus(index)">
<img slot="icon" :src="item.img">
<span slot="text">{{item.title}}</span>
</yd-grids-item>
</yd-grids-group>
<br>
<yd-accordion>
<yd-accordion-item title="我的客服">
<div style="padding: .24rem;">
<p>
在使用过程中有任何问题可以联系我们为您提供7x24x365的专项服务<br/>
电话: <a href="tel:15155145354">15155145354</a>
</p>
</div>
</yd-accordion-item>
<yd-accordion-item title="帮助中心">
<div style="padding: .24rem;">
<h3>1: 下单后如何查找订单记录</h3>
<p>在我的页面待付款已完成中查看</p>
<h3>2: 商品有降价活动吗</h3>
<p>抱歉官方直营店没有降价哦如果有会短信通知您</p>
</div>
</yd-accordion-item>
<yd-accordion-item title="关于我们">
<div style="padding: .24rem;">
<p><em>心机购</em>是一款提供各大品牌手机直营的线上app售后有保障质量可靠</p>
</div>
</yd-accordion-item>
</yd-accordion>
<yd-button-group>
<yd-button @click.native="logout" size="large" type="primary" bgcolor="#f37d0f" color="#fff" shape="circle">退出登录</yd-button>
</yd-button-group>
<yd-popup v-model="showProp" position="left" width="100%">
<yd-navbar title="查看订单">
<router-link to="" slot="left" @click.native="showProp = false">
<yd-navbar-back-icon></yd-navbar-back-icon>
</router-link>
</yd-navbar>
<yd-list theme="4">
<yd-list-item v-for="(item, index) in list" :key="index">
<img slot="img" :src="item.commodity_thumbnail">
<span slot="title">{{item.commodity_name}}</span>
<yd-list-other slot="other">
<div>
<span class="demo-list-price"><em>总价: </em>{{item.order_total}}</span>
<br>
<span class="demo-list-del-price">购买数量: {{item.order_size}}</span>
<br>
<span class="demo-list-del-price">订单编号: {{item.order_number}}</span>
</div>
</yd-list-other>
</yd-list-item>
</yd-list>
</yd-popup>
</div>
</template>
<script>
import UserHeader from "./../public/user-header";
export default {
mounted() {},
data() {
return {
userInfo: JSON.parse(localStorage.getItem("u")),
showProp: false,
list: [],
OrserAction: [
{
title: "待付款",
img: "../../../static/img/pay.png"
},
{
title: "已完成",
img: "../../../static/img/setting.png"
}
]
};
},
methods: {
logout() {
localStorage.removeItem("u");
this.$router.push({ name: "index" });
},
async checkOrderStatus(status) {
let OrderStatus = await this.$http.post({
url: "/order/checkOrder",
token: this.$utils.encrypt({
userid: this.$utils.GetLocalstorage("u").id,
status: status
})
});
this.list = OrderStatus.data;
this.showProp = true;
}
},
beforeRouteEnter(to, from, next) {
next(vm => {
vm.$parent.$data.showNavBar = false;
});
},
components: {
"v-header": UserHeader
}
};
</script>
<style scoped>
@import url("../../assets/css/me.css");
.index {
padding: 0 0 1.3rem 0;
}
</style>

View File

@@ -0,0 +1,217 @@
<template>
<div class="order">
<yd-navbar title="确认订单" fixed>
<router-link to="" slot="left" @click.native="$router.back()">
<yd-navbar-back-icon></yd-navbar-back-icon>
</router-link>
</yd-navbar>
<div class="order-address flex-layout" @click="OpenAddress">
<p>添加收货地址</p>
<yd-navbar-next-icon></yd-navbar-next-icon>
</div>
<yd-list theme="4">
<yd-list-item v-for="(item,index) in orderList" :key="index">
<img slot="img" :src="item.commodity_thumbnail">
<span slot="title">{{item.commodity_name}}</span>
<yd-list-other slot="other">
<div>
<span class="demo-list-price"><em>¥</em>{{item.commodity_nowprice}}</span>
</div>
</yd-list-other>
</yd-list-item>
</yd-list>
<div class="pay-list flex-layout" @click="isShowProp = true">
<img src="../../../static/img/yue.png" alt="余额">
<p>账户余额</p>
<yd-switch v-model="defaults" disabled></yd-switch>
</div>
<div class="pay-list flex-layout" @click="isShowProp = true">
<img class="alipay" src="../../../static/img/alipay.png" alt="支付宝">
<p>支付宝</p>
<span>维护</span>
</div>
<div class="pay-list flex-layout" @click="isShowProp = true">
<img class="wxpay" src="../../../static/img/wxpay.png" alt="支付宝">
<p>微信支付</p>
<span>维护</span>
</div>
<div class="order-footer">
<div class="footer-left">
{{orderList.length}} 合计: {{totalPrice}}
</div>
<div class="footer-right" @click="total ? showWxPay = !showWxPay : '' ">
去付款
</div>
</div>
<yd-popup v-model="isShowProp" position="left" width="100%">
<yd-navbar title="添加收货地址">
<router-link to="" slot="left" @click.native="isShowProp = false">
<yd-navbar-back-icon></yd-navbar-back-icon>
</router-link>
</yd-navbar>
<yd-cell-group v-if="ShowEdit">
<yd-cell-item>
<span slot="left">收货人</span>
<yd-input slot="right" required v-model="username" min="2" max="10" placeholder="真实姓名"></yd-input>
</yd-cell-item>
<yd-cell-item>
<span slot="left">手机号</span>
<yd-input slot="right" required v-model="userphone" regex="mobile" placeholder="手机号"></yd-input>
</yd-cell-item>
<yd-cell-item arrow>
<span slot="left">所在地区</span>
<input slot="right" type="text" @click.stop="show1 = true" v-model="model1" readonly placeholder="请选择收货地址">
</yd-cell-item>
<yd-cityselect v-model="show1" :callback="result1" :items="district"></yd-cityselect>
<yd-cell-item>
<yd-textarea ref="address" slot="right" placeholder="详细地址" maxlength="100"></yd-textarea>
</yd-cell-item>
<yd-button-group>
<yd-button size="large" type="danger" shape="circle" @click.native="SubmitAddress()">提交信息</yd-button>
</yd-button-group>
</yd-cell-group>
<yd-cell-group v-else>
<yd-cell-item v-for="(item,index) in carAdd" :key="index">
<span slot="left">{{item.username}}</span>
<span slot="right">{{item.userphone}}</span>
</yd-cell-item>
</yd-cell-group>
</yd-popup>
<v-wxpay :wxxxpay="showWxPay" :MoneyTotals="totalPrice" @change="changShowWxPay"></v-wxpay>
</div>
</template>
<script>
import District from "ydui-district/dist/jd_province_city_area_id";
import wxpay from "../public/wxpay";
export default {
mounted() {
if (localStorage.getItem("data") == null) {
this.$router.push({ name: "index" });
}
},
data() {
return {
isShowProp: false,
ShowEdit: true,
defaults: true,
username: null,
userphone: null,
show1: false,
model1: "",
district: District,
orderList: this.$utils.GetLocalstorage("data"),
showWxPay: false,
carAdd:
this.$utils.GetLocalstorage("add") == false
? ""
: this.$utils.GetLocalstorage("add")
};
},
methods: {
// 改变状态
changShowWxPay(val) {
this.showWxPay = val;
},
// 打开收货地址弹窗
OpenAddress() {
this.isShowProp = true;
localStorage.getItem("add") == null
? (this.ShowEdit = true)
: (this.ShowEdit = false);
},
// 提交本地保存地址
async SubmitAddress() {
let UserArray = [];
UserArray.push({
username: this.username,
userphone: this.userphone,
address: this.model1,
infoAddress: this.$refs.address.mlstr
});
this.$utils.SetLocalstorage("add", UserArray);
this.carAdd = UserArray;
this.ShowEdit = false;
let addressSave = await this.$http.post({
url: "/user/setAddress",
token: this.$utils.encrypt({
truename: this.username,
address: this.model1 + this.$refs.address.mlstr,
uid: this.$utils.GetLocalstorage("u").id
})
});
console.log(addressSave);
},
// 获取城市地址
result1(ret) {
this.model1 = ret.itemName1 + " " + ret.itemName2 + " " + ret.itemName3;
}
},
beforeRouteEnter(to, from, next) {
next(vm => {
vm.$parent.$data.showFooter = false;
vm.$parent.$data.showNavBar = false;
});
},
computed: {
// 计算总价
totalPrice() {
let total = 0;
for (const key in this.orderList) {
total +=
this.orderList[key].cart_nums *
this.orderList[key].commodity_nowprice;
}
return total;
},
total() {
let info = this.$utils.GetLocalstorage("u");
if (this.totalPrice > info.user_money) {
this.$dialog.toast({
mes: "余额不足",
timeout: 1500
});
return false;
} else {
return true;
}
}
},
components: {
"v-wxpay": wxpay
}
};
</script>
<style scoped>
@import url("../../assets/css/order.css");
.order {
width: 100%;
height: 100%;
}
</style>

View File

@@ -0,0 +1,123 @@
<template>
<div class="payResult">
<yd-navbar title="支付结果">
<router-link to="" slot="left" @click.native="$router.back()">
<yd-navbar-back-icon></yd-navbar-back-icon>
</router-link>
</yd-navbar>
<yd-flexbox direction="vertical" align="center">
<yd-flexbox-item>
<img class="res-logo" src="../../../static/img/success.svg" alt="">
</yd-flexbox-item>
<yd-flexbox-item>
<yd-preview :buttons="btns">
<yd-preview-header>
<div slot="left">付款金额</div>
<div slot="right">¥{{moneyTotal}}</div>
</yd-preview-header>
<yd-preview-item>
<div slot="left">订单编号</div>
<div slot="right">{{orderNumbers}}</div>
</yd-preview-item>
</yd-preview>
</yd-flexbox-item>
</yd-flexbox>
</div>
</template>
<script>
export default {
created() {
if (localStorage.getItem("data") == null) {
this.$router.push({ name: "index" });
} else {
this.setOrder();
}
},
beforeRouteEnter(to, from, next) {
next(vm => {
vm.$parent.$data.showFooter = false;
vm.$parent.$data.showNavBar = false;
});
},
data() {
return {
moneyTotal: null,
orderNumbers: null,
btns: [
{
text: "查看订单",
click: () => {
this.$router.push({ name: "me" });
}
},
{
color: "#F00",
text: "跳转首页",
click: () => {
this.$router.push({ name: "index" });
}
}
]
};
},
methods: {
async setOrder() {
let datas = this.$utils.GetLocalstorage("data"),
Orderlist = [],
totals = 0;
for (const key in datas) {
totals +=
parseInt(datas[key].cart_nums) *
parseInt(datas[key].commodity_nowprice);
Orderlist.push({
uid: this.$utils.GetLocalstorage("u").id,
sid: datas[key].id,
total: datas[key].cart_nums * datas[key].commodity_nowprice,
size: datas[key].cart_nums
});
}
console.log({
order: Orderlist,
orderTotal: totals,
money: this.$utils.GetLocalstorage("u").user_money
})
let order = await this.$http.post({
url: "/order/addOrder",
data: {
order: Orderlist,
orderTotal: totals,
money: this.$utils.GetLocalstorage("u").user_money
}
});
this.moneyTotal = totals;
this.orderNumbers = order.data;
localStorage.removeItem("data");
this.UpdateMoney(totals);
},
UpdateMoney(totals) {
let info = this.$utils.GetLocalstorage("u");
info.user_money -= totals;
this.$utils.SetLocalstorage("u", info);
}
}
};
</script>
<style scoped>
.res-logo {
width: 100px;
margin-top: 1rem;
margin-bottom: 1rem;
}
</style>

View File

@@ -0,0 +1 @@
61875941-2ba9-44f0-98d8-d581a5f58be8

View File

@@ -0,0 +1,55 @@
export default {
// 私钥
rsa_private_key: `-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCzkEs/kJgaFGIAM/TQRjzUtJ9ve9enk6heGj/JbcvHVOwFYw2q
CNUhuaFE9rYDL+CzX3+cf7inRIJCvSnC0bdGCZ+i943uSudTkqT+guv03jTzvLy2
TD+Bp41/ToNiPWG56p1keHE0Gwsr7o0waIcWrLpFJnzyW/fOYQjboRz7nwIDAQAB
AoGADgMCfDFSTSauBwoG3oG8mXSGxHJLf74b80vlEljJAAL2b+0s0cnip8EOfo0p
4tHHnPekw5eL1zGXYJHWQmeO/3ymZS/nnVq1K5YRM+AtYyUMAiChIt/zWOGXPN6k
yUARaTK/cRZNY2XPPDK0H44eLF2RDE/SObPD0BZ0u9m92aECQQDYSIrYw0klyGJe
ePaV0+2ZtVVhDYN+eYmWHu9/T+aOIPFS5ePUonBftSfcp7pTeJZ3O/eI/4W6pdzz
13MRseUZAkEA1ImPvtbL39A8OtciY16LgDX5O5Vkm5p5+TKRhG5B38bgnOQQHu2d
oJKvxjEJcWDfiJ6/ThHsFHqyvViJ+cIFdwJBAIWlpe62FdA8F9UK6EzDLXIq5DxZ
rmSL06IpMZM5G12+K4EvP26YhdoORjiKiI+l10yMiLRmOQuSDIu9GYTYqZkCQEQ5
/Ij4ju3D/PGuif14JjP8H4u/A1LoHeufDhODCWZ6gzQaCgrDoGwhaoemyi85N8i1
nRfErRJN6P7bYz9nxzUCQDC8yEIcgKczxFIo20k4R+CINyJTB5S6dsVW6gmpiHZK
6+MWkDut4o/Fibwp4jm5Fh9zau597aP5Xnt8mA2LRc8=
-----END RSA PRIVATE KEY-----`,
// 页面的一些配置
pageConfig: {
index: {
classList: [
{
id: "1",
title: "小米",
url: "./../../static/img/xiaomi.png"
},
{
id: "2",
title: "华为",
url: "./../../static/img/huaiwei.png"
},
{
id: "3",
title: "苹果",
url: "./../../static/img/apple.png"
},
{
id: "4",
title: "一加",
url: "./../../static/img/yijia.png"
},
{
id: "5",
title: "三星",
url: "./../../static/img/sanxin.png"
},
{
id: "6",
title: "锤子",
url: "./../../static/img/chuizi.png"
}
]
}
}
}

View File

@@ -0,0 +1 @@
b83c28bb-bec4-4a85-9f16-bb54e546e1f4

46
shop_Frontend/src/lib/index.js Executable file
View File

@@ -0,0 +1,46 @@
import config from '../config'
import NodeRSA from 'node-rsa'
class Lib {
constructor() {
this.rsa_private_key = config.rsa_private_key
}
/**
* 前端: 使用RSA的私钥进行加密 rsa_private_key
* @param {*string} text 需要加密的字符串
*/
encrypt(text) {
return (new NodeRSA(this.rsa_private_key)).encryptPrivate(text, 'base64')
}
/**
* 前端: 使用私钥解密json数据给前端
* @param {*string} text 需要解密的字符串
*/
privateDecrypted(text) {
return (new NodeRSA(this.rsa_private_key)).decrypt(text, 'utf8')
}
/**
* 获取用户信息
*/
getUserInfo() {
return this.GetLocalstorage("u")
}
/**
* 获取本地数据
* @param {*string} name 名称
*/
GetLocalstorage(name) {
return localStorage.getItem(name) != null ? JSON.parse(localStorage.getItem(name)) : false
}
/**
* 写入本地数据
* @param {*string} name 名称
*/
SetLocalstorage(name, key) {
localStorage.setItem(name, JSON.stringify(key))
}
}
export default new Lib()

22
shop_Frontend/src/main.js Executable file
View File

@@ -0,0 +1,22 @@
import Vue from 'vue'
import App from './App'
import router from './router'
import YDUI from 'vue-ydui'
import 'vue-ydui/dist/ydui.rem.css'
import utlis from './lib'
import axios from './api'
import config from './config'
Vue.config.productionTip = false
Vue.use(YDUI)
Vue.prototype.$utils = utlis
Vue.prototype.$http = axios
Vue.prototype.$config = config
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})

View File

@@ -0,0 +1 @@
f5e3bee6-c84f-486f-bce3-eaf1adece5f8

151
shop_Frontend/src/router/index.js Executable file
View File

@@ -0,0 +1,151 @@
import Vue from 'vue'
import Router from 'vue-router'
import IndexComponents from '@/components/view/index'
import InfoComponents from '@/components/view/info'
import ClassComponents from '@/components/view/class'
import CartComponents from '@/components/view/cart'
import MeComponents from "@/components/view/me";
import LoginComponents from "@/components/view/login";
import addUserComponents from "@/components/view/adduser";
import OrderComponents from "@/components/view/order";
import ResultComponents from "@/components/view/payresult";
import { Confirm, Alert, Toast, Notify, Loading } from 'vue-ydui/dist/lib.rem/dialog';
Vue.use(Router)
const router = new Router({
//解决拖动时多个页面互相影响的问题,当切换到新路由时,想要页面滚到顶部
scrollBehavior(to, from, savedPosition) {
return { x: 0, y: 0 }
},
routes: [
{
path: '/',
name: 'index',
component: IndexComponents,
meta: {
// 是否需要登录
isLogin: false,
// 是否需要被缓存
keepAlive: true,
// 页面标签卡标题
title: "主页"
}
},
{
path: '/info/:id',
name: 'info',
component: InfoComponents,
meta: {
isLogin: false,
keepAlive: false,
title: "详情"
}
},
{
path: '/class',
name: 'class',
component: ClassComponents,
meta: {
isLogin: false,
keepAlive: false,
title: "分类"
}
},
{
path: '/reg',
name: 'register',
component: addUserComponents,
meta: {
isLogin: false,
keepAlive: true,
title: "注册"
}
},
{
path: '/login',
name: 'login',
component: LoginComponents,
meta: {
isLogin: false,
keepAlive: true,
title: "登录"
}
},
{
path: '/cart',
name: 'cart',
component: CartComponents,
meta: {
isLogin: true,
keepAlive: false,
title: "购物车"
}
},
{
path: '/me',
name: 'me',
component: MeComponents,
meta: {
isLogin: true,
keepAlive: false,
title: "我的"
}
},
{
path: '/order',
name: "order",
component: OrderComponents,
meta: {
isLogin: true,
keepAlive: false,
title: "确认订单"
}
},
{
path: '/result',
name: "result",
component: ResultComponents,
meta: {
isLogin: true,
keepAlive: false,
title: "支付成功"
}
}
]
})
router.beforeEach((to, from, next) => {
// 设置浏览器标题
document.title = to.meta.title
// 检查页面是否需要登录
if (to.meta.isLogin) {
// 检查是否已经登录
if (localStorage.getItem("u") == null) {
Toast({
mes: '请先登录',
timeout: 1700,
icon: 'error',
callback: () => {
next({
path: '/login',
query: { redirect: to.fullPath }
})
}
})
} else {
next()
}
} else {
next()
}
})
export default router

0
shop_Frontend/static/.gitkeep Executable file
View File

View File

@@ -0,0 +1 @@
97363a98-41b9-4d51-b91d-9676ffc31fd4

View File

@@ -0,0 +1 @@
1294be02-0fbe-4b37-9c79-859131f799e0

Binary file not shown.

After

Width:  |  Height:  |  Size: 983 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
shop_Frontend/static/img/pay.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1539852377641" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1399" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M511.888971 131.844817c-201.839984 0-365.489158 163.626661-365.489158 365.489158 0 201.862497 163.649174 365.490182 365.489158 365.490182s365.489158-163.626661 365.489158-365.490182C877.37813 295.471478 713.729979 131.844817 511.888971 131.844817L511.888971 131.844817zM690.072163 395.900795 462.656687 624.699782c-0.814552 1.225921-1.763157 2.397606-2.843768 3.479241-8.934486 8.911974-23.400966 8.911974-32.31294 0L314.432831 515.112897c-8.911974-8.911974-8.911974-23.378453 0-32.301683 8.911974-8.934486 23.378453-8.934486 32.311917 0l96.570429 96.570429 214.444047-215.782531c8.92323-8.92323 23.379477-8.92323 32.31294 0C698.984137 372.511085 698.984137 386.977565 690.072163 395.900795L690.072163 395.900795zM690.072163 395.900795" p-id="1400" fill="#67e011"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

BIN
shop_Frontend/static/img/ye.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
shop_Frontend/static/img/yue.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

28
shop_Frontend/static/index.html Executable file
View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.bootcss.com/jquery/2.1.3/jquery.js"></script>
</head>
<body>
<script>
$.ajax({
url: 'http://127.0.0.1:9090/shop/index',
type: 'get',
data: {
page: 1
},
success: function (res) {
console.log(res)
},
error: function (err) {
console.log(err)
}
})
</script>
</body>
</html>

View File

@@ -0,0 +1 @@
ba12673c-52b9-4504-a9ad-799d7d95fae6

View File

@@ -0,0 +1 @@
!function(e){var t=e.document,n=t.documentElement,i="orientationchange"in e?"orientationchange":"resize",a=function e(){var t=n.getBoundingClientRect().width;return n.style.fontSize=5*Math.max(Math.min(t/750*20,11.2),8.55)+"px",e}();n.setAttribute("data-dpr",e.navigator.appVersion.match(/iphone/gi)?e.devicePixelRatio:1),/iP(hone|od|ad)/.test(e.navigator.userAgent)&&(t.documentElement.classList.add("ios"),parseInt(e.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/)[1],10)>=8&&t.documentElement.classList.add("hairline")),t.addEventListener&&(e.addEventListener(i,a,!1),t.addEventListener("DOMContentLoaded",a,!1))}(window);