first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
// function getData (res) {
// console.log(res)
// }
var http = new XMLHttpRequest()
http.open("GET","http://127.0.0.1/index.php")
http.send()
http.onreadystatechange = function () {
if(http.readyState == 4){
console.log(JSON.parse(http.responseText))
}
}
// 跨域 Access-Control-Allow-Origin
// 谁导致的? 浏览器
// 原因:浏览器有个同源策略
// 作用保护后端的api数据安全
// 当前页面的访问地址和你ajax需要访问的地址是否完全一致
// 1: 端口是否一致
// 2: 协议是否完全一致
// 3: 域名是否一致
// a https://www.a.com b http://www.a.com
// 跨域解决方案
// 1: 后端设置cros允许前端跨域
// 2: jsonp
// 它不是ajax请求只是一个普通的js文件资源请求浏览器不会拦截文件请求然后用过 callback 方式回调数据
// 3: 后端代理(nginx)
// A 前端 --> C 后端(别人)
// A 前端 ---> B 后端(自己) cors
// B 后端 ---> C 后端(别人)
// C ---> B ---> A
</script>
<!-- <script src="http://127.0.0.1/index.php?cb=getData"></script> -->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>tabs</title>
<style>
.on {
color: red;
}
</style>
</head>
<body>
<ul>
<li class="on">苏世博会</li>
<li>呜呜呜呜</li>
<li>www</li>
</ul>
<script>
document.querySelectorAll("ul li").forEach(val => {
val.onclick = function() {
document.querySelectorAll("ul li").forEach(vals => vals.className = "" )
val.className = "on"
}
})
</script>
</body>
</html>

View File

@@ -0,0 +1,143 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Vue.js</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
<style>
.on {
color: red;
}
</style>
</head>
<body>
<div class="zhansa">
<img :src="imgURL" alt="">
<a :href="href"> {{ title }} </a>
<p v-if="is">v-if</p>
<p v-else>v-else</p>
<p v-show="is">v-show</p>
<p v-if="status == 1">1</p>
<p v-else-if="status == 2">2</p>
<p v-else-if="status == 3">3</p>
<p v-else-if="status == 4">4</p>
<p v-else>没有</p>
<ul>
<li v-for="(item,index) in list" :key="index">
{{ item.title }} {{ index }}
</li>
</ul>
<button @click="test">点我</button>
<input type="text" v-model="username" placeholder="请输入账户">
<p>{{ username }}</p>
<p v-html="text"></p>
<lb-button @senddata="getChildenData"></lb-button>
<hr>
<v-lb :usertest="title"></v-lb>
<h2 :class="{ on : active }">2222</h2>
</div>
<script>
/**
* v-on 简写 @
* v-bind 简写 :
*
* 组件注册:全局组件
* 局部组件
*/
// 父 --> 子 props
// 子 --> 父 $emit
// 全局注册
Vue.component('lb-button', {
data() {
return {
count: '子组件数据'
}
},
methods: {
add() {
this.$emit("senddata", this.count)
}
},
template: '<button @click="add">点我,把子组件数据传递给父组件</button>'
});
let ComponentA = {
props: {
usertest: String
},
data() {
return {
count: 0
}
},
methods: {
add() {
this.count++
}
},
template: `<div><button @click="add">子组件 {{ count }} times.</button> <h2>{{ usertest }}</h2></div> `
}
new Vue({
el: '.zhansa',
data: {
title: '测试',
is: false,
href: 'https://www.juhe.cn/myData',
imgURL: 'https://cn.vuejs.org/images/logo.png',
list: [
{id: 1,title: "hahah "},
{id: 2,title: "www "},
{id: 3,title: "失误失误 "}
],
username: null,
text: '<h2>我是H2</h2>',
status: 10,
active: false
},
watch: {
username(val, oldVal) {
console.log("新数值: "+ val + ",旧数值:" + oldVal)
}
},
beforeCreate() {
console.log(this.title)
},
created() {
console.log("created: ",this.title)
},
mounted() {
console.log("mounted: ",this.title)
},
methods: {
test() {
alert(1)
},
getChildenData(val) {
console.log("父组件接收到的数据:",val)
}
},
components: {
'v-lb': ComponentA
}
})
</script>
</body>
</html>

View File

@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router@3.0.6/dist/vue-router.js"></script>
<style>
.router-link-exact-active {
color: red;
}
</style>
</head>
<body>
<div id="app">
<ul>
<li>
<router-link to="/index?name=bmy">首页</router-link>
</li>
<li>
<router-link to="/about/2">关于我</router-link>
</li>
</ul>
<div class="content">
<router-view></router-view>
</div>
</div>
</body>
<script>
const Index = {
data() {
return {
title: '我是首页组件'
}
},
template: '<div class="Index">{{ title }} {{ $route.query.name }}</div>'
}
const About = {
data() {
return {
title: '我是关于我组件'
}
},
template: '<div class="About">{{ title }} {{ $route.params.ids }}</div>'
};
// query params
const routes = [
{
path: '/index',
name: 'index',
component: Index
},
{
path: '/about/:ids',
name: 'about',
component: About
}
];
const router = new VueRouter({
routes // (缩写) 相当于 routes: routes
});
// 全局守卫 一般在这里面做项目的登录校验
router.beforeEach((to, from, next) => {
console.log("你要去的页面:", to)
console.log("你来的页面:",from)
next()
})
const app = new Vue({
el: '#app',
router
})
</script>
</html>

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"]
}

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

View File

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

View File

@@ -0,0 +1,29 @@
// 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
历届学生/苏琪/2019-06-25/vue/.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

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": {}
}
}

View File

@@ -0,0 +1,21 @@
# vue
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

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)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

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'],
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({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240,
minRatio: 0.8
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig

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"'
})

View File

@@ -0,0 +1,76 @@
'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: true,
// 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'],
// 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"'
}

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>vue</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@@ -0,0 +1,75 @@
{
"name": "vue",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "bmy <2271608011@qq.com>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"lint": "eslint --ext .js,.vue src",
"build": "node build/build.js"
},
"dependencies": {
"axios": "^0.19.0",
"vant": "^2.0.2",
"vue": "^2.5.2",
"vue-router": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"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",
"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",
"html-webpack-plugin": "^2.30.1",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}

View File

@@ -0,0 +1,25 @@
<template>
<div id="app">
<!-- <ul>
<li>
<router-link to="/">首页</router-link>
</li>
<li>
<router-link to="/about">关于我</router-link>
</li>
</ul> -->
<router-view/>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style>
.router-link-exact-active {
color: red;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,91 @@
<template>
<div class="about">
<van-nav-bar
title="标题"
left-text="返回"
right-text="按钮"
left-arrow
@click-left="onClickLeft"
@click-right="onClickRight"
/>
<div class="content">
<form action="/">
<van-search
v-model="Search"
placeholder="请输入搜索分类名"
show-action
@search="onSearch"
@cancel="onCancel"
/>
</form>
<van-card
v-for="(item,index) in listData"
:key="index"
:price="item.category"
:desc="item.title"
currency=""
:title="item.title"
:thumb="item.thumbnail_pic_s"
/>
</div>
<van-tabbar v-model="active">
<van-tabbar-item replace to="/" icon="home-o">首页</van-tabbar-item>
<van-tabbar-item replace to="/about" icon="search">我的</van-tabbar-item>
<van-tabbar-item icon="friends-o">标签</van-tabbar-item>
<van-tabbar-item icon="setting-o">标签</van-tabbar-item>
</van-tabbar>
</div>
</template>
<script>
export default {
data () {
return {
Search: null,
active: 0,
about: '关于我页面',
listData: []
}
},
created() {
},
methods: {
onClickLeft () {
this.$toast('返回')
},
onCancel () {
this.Search = null
this.$toast('取消')
},
onSearch () {
this.getData()
},
onClickRight () {
this.$toast('按钮')
},
async getData () {
let data = await this.http.get({
url: '/class',
data: {
type: this.Search
}
})
this.listData = data
console.log(this.listData)
},
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,48 @@
<template>
<div class="hello">
<input type="text" placeholder="请输入备忘内容" v-model="UserInput">
<button @click="Submit">提交</button>
<ul v-if="ListArr.length != 0">
<li v-for="(item,index) in ListArr" :key="index">
{{ index + 1 }}: {{ item }}
<span @click="deleteItem(index)"> x</span>
</li>
</ul>
<div v-else>
没有数据...
</div>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data () {
return {
UserInput: null,
ListArr: []
}
},
created () {
if (localStorage.getItem('note') != null) {
this.ListArr = JSON.parse(localStorage.getItem('note'))
}
},
methods: {
Submit () {
this.ListArr.push(this.UserInput)
this.UserInput = null
localStorage.setItem('note', JSON.stringify(this.ListArr))
},
deleteItem (index) {
this.ListArr.splice(index, 1)
localStorage.setItem('note', JSON.stringify(this.ListArr))
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

View File

@@ -0,0 +1,52 @@
import axios from "axios"
import { Toast } from 'vant'
import Vue from 'vue'
Vue.use(Toast);
axios.defaults.baseURL = 'http://127.0.0.1:3000';
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
Toast.loading({
mask: true,
message: '请求数据...'
});
return config;
}, function (error) {
// 对请求错误做些什么
return Promise.reject(error);
});
// 添加响应拦截器
axios.interceptors.response.use(function (response) {
// 对响应数据做点什么
Toast.clear();
switch (response.data.error_code) {
case 0 :
return response.data.result.data;
break;
default:
Toast.fail('网络请求失败');
break;
}
}, function (error) {
// 对响应错误做点什么
return Promise.reject(error);
});
export default {
get (params) {
return new Promise(function(resolve,reject){
axios.get(params.url, {
params: params.data
})
.then(function (response) {
resolve(response);
})
.catch(function (error) {
reject(error);
});
})
}
}

View File

@@ -0,0 +1,25 @@
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Vant from 'vant'
import 'vant/lib/index.css'
import http from "./http"
Vue.prototype.http = http
Vue.use(Vant)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})

View File

@@ -0,0 +1,21 @@
import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/components/index'
import About from '@/components/about'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'index',
component: Index
},
{
path: '/about',
name: 'about',
component: About
}
]
})

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"]
}

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

14
历届学生/苏琪/2019-08-12/.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

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": {}
}
}

View File

@@ -0,0 +1,21 @@
# vuex-study
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

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)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

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,82 @@
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}

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({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240,
minRatio: 0.8
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig

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"'
})

View File

@@ -0,0 +1,69 @@
'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-
/**
* 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: true,
// 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'],
// 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"'
}

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>vuex-study</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@@ -0,0 +1,63 @@
{
"name": "vuex-study",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "bmy <2271608011@qq.com>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"build": "node build/build.js"
},
"dependencies": {
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"vuex": "^3.1.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"chalk": "^2.0.1",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}

View File

@@ -0,0 +1,32 @@
<template>
<div id="app">
<img src="./assets/logo.png">
<router-view/>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
name: 'App',
created() {
console.log(this.getHotList)
},
computed: {
...mapGetters([
'getHotList'
])
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,113 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<h2>Essential Links</h2>
<ul>
<li>
<a
href="https://vuejs.org"
target="_blank"
>
Core Docs
</a>
</li>
<li>
<a
href="https://forum.vuejs.org"
target="_blank"
>
Forum
</a>
</li>
<li>
<a
href="https://chat.vuejs.org"
target="_blank"
>
Community Chat
</a>
</li>
<li>
<a
href="https://twitter.com/vuejs"
target="_blank"
>
Twitter
</a>
</li>
<br>
<li>
<a
href="http://vuejs-templates.github.io/webpack/"
target="_blank"
>
Docs for This Template
</a>
</li>
</ul>
<h2>Ecosystem</h2>
<ul>
<li>
<a
href="http://router.vuejs.org/"
target="_blank"
>
vue-router
</a>
</li>
<li>
<a
href="http://vuex.vuejs.org/"
target="_blank"
>
vuex
</a>
</li>
<li>
<a
href="http://vue-loader.vuejs.org/"
target="_blank"
>
vue-loader
</a>
</li>
<li>
<a
href="https://github.com/vuejs/awesome-vue"
target="_blank"
>
awesome-vue
</a>
</li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@@ -0,0 +1,15 @@
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store/index';
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
store,
router,
components: { App },
template: '<App/>'
})

View File

@@ -0,0 +1,15 @@
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'HelloWorld',
component: HelloWorld
}
]
})

View File

@@ -0,0 +1,3 @@
export default {
getHotList: state => state.city.HotList,
}

View File

@@ -0,0 +1,13 @@
import Vue from "vue";
import Vuex from "vuex";
import city from "./modules/city";
import getters from "./getters";
Vue.use(Vuex);
const store = new Vuex.Store({
modules: { city },
getters
})
export default store;

View File

@@ -0,0 +1,20 @@
export default {
state: {
HotList: {
id: 1,
name: 'zhangsan'
}
},
// 帮我们写 state 里面的数据
mutations: {
SET_HOTLIST(state, list) {
state.HotList = list;
},
},
actions: {
getData({commit}) {
let list = [1,2,3,4,5,6,7];
commit("set_List",list)
}
}
}

View File

View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var createError = require("http-errors");
var express = require("express");
var path = require("path");
var cookieParser = require("cookie-parser");
var logger = require("morgan");
var App = (function () {
function App() {
this.port = 3000;
this.AppMain = express();
this.setPlugins();
}
App.prototype.setPlugins = function () {
this.AppMain.set('port', this.port);
this.AppMain.set('views', path.join(__dirname, '../views'));
this.AppMain.set('view engine', 'pug');
this.AppMain.use(logger('dev'));
this.AppMain.use(express.json());
this.AppMain.use(express.urlencoded({ extended: false }));
this.AppMain.use(cookieParser());
this.AppMain.use(express.static(path.join(__dirname, '../public')));
this.setRouter();
};
App.prototype.setRouter = function () {
this.setError();
};
App.prototype.setError = function () {
this.AppMain.use(function (req, res, next) {
next(createError(404));
});
this.AppMain.use(function (err, req, res, next) {
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
res.status(err.status || 500);
res.render('error');
});
};
return App;
}());
exports.App = App;

View File

@@ -0,0 +1,56 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var App_1 = require("./App");
var http = require("http");
var start = (function (_super) {
__extends(start, _super);
function start() {
var _this = _super.call(this) || this;
_this.server = http.createServer(_this.AppMain);
_this.run();
return _this;
}
start.prototype.run = function () {
this.server.listen(this.port);
this.server.on('error', this.onError);
this.server.on('listening', this.onListening);
};
start.prototype.onError = function (error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof this.port === 'string'
? 'Pipe ' + this.port
: 'Port ' + this.port;
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
};
start.prototype.onListening = function () {
console.log('App is run: http://127.0.0.1:3000');
};
return start;
}(App_1.App));
new start();

View File

@@ -0,0 +1,25 @@
{
"name": "2019-08-13",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"w": "tsc -watch",
"dev": "node-dev dist/index.js",
"ts": "ts-node src/index.ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/cookie-parser": "^1.4.1",
"@types/express": "^4.17.0",
"@types/http-errors": "^1.6.1",
"@types/morgan": "^1.7.36",
"@types/node": "^12.7.1",
"cookie-parser": "^1.4.4",
"express": "^4.17.1",
"http-errors": "^1.7.3",
"morgan": "^1.9.1"
}
}

View File

@@ -0,0 +1,2 @@
import { start } from "./run/start"
new start()

View File

@@ -0,0 +1,50 @@
import * as createError from "http-errors";
import * as express from "express";
import * as path from "path";
import * as cookieParser from "cookie-parser";
import * as logger from "morgan";
export class App {
protected AppMain: any;
public port:number = 3000;
constructor () {
this.AppMain = express();
this.setPlugins()
}
private setPlugins (): void {
this.AppMain.set('port', this.port)
this.AppMain.set('views', path.join(__dirname, '../views'));
this.AppMain.set('view engine', 'pug');
this.AppMain.use(logger('dev'));
this.AppMain.use(express.json());
this.AppMain.use(express.urlencoded({ extended: false }));
this.AppMain.use(cookieParser());
this.AppMain.use(express.static(path.join(__dirname, '../public')));
this.setRouter()
}
private setRouter (): void {
this.setError()
}
private setError (): void {
this.AppMain.use(function(req: any, res: any, next: (arg0: createError.HttpError) => void) {
next(createError(404));
});
// error handler
this.AppMain.use(function(err: { message: any; status: any; }, req: { app: { get: (arg0: string) => string; }; }, res: { locals: { message: any; error: any; }; status: (arg0: any) => void; render: (arg0: string) => void; }, next: any) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page
res.status(err.status || 500);
res.render('error');
});
}
}

View File

@@ -0,0 +1,45 @@
import { App } from "./App";
import * as http from "http";
export class start extends App {
private server:any;
constructor () {
super()
this.server = http.createServer(this.AppMain);
this.run()
}
run () {
this.server.listen(this.port);
this.server.on('error', this.onError);
this.server.on('listening', this.onListening);
}
onError (error:any) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof this.port === 'string'
? 'Pipe ' + this.port
: 'Port ' + this.port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
onListening() {
console.log('App is run: http://127.0.0.1:3000');
}
}

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"removeComments": true,
"esModuleInterop": true,
"preserveConstEnums": true,
"sourceMap": false,
"target": "es5",
"outDir": "dist/"
},
"exclude": [
"node_modules"
],
"include": [
"src/**/*"
],
}

View File

@@ -0,0 +1,15 @@
body {
background: #fff;
}
.top-title {
width: 100%;
height: 4rem;
display: flex;
justify-content: space-around;
align-items: center;
padding: 0 .5rem;
}
.top-title h2{
font-size: .54rem;
padding-left: .4rem;
}

View File

@@ -0,0 +1,67 @@
body {
background: #fff !important;
}
.class-title{
margin-bottom: .42rem;
}
.class-title h2{
font-size: .64rem;
margin-bottom: .2rem;
}
.class-title p{
color: #8d8d8d;
}
.g-view {
padding: 0 .3rem;
}
.cell-item {
box-shadow: 0 0 .12rem #e8e8e8;
}
.class-caipu ul {
display: flex;
flex-wrap: wrap;
}
.class-caipu ul li{
width: 30%;
margin-right: .3rem;
position: relative;
margin-bottom: .3rem;
}
.class-caipu ul li:nth-child(3n){
margin-right: 0;
}
.class-caipu ul li img{
width: 100%;
}
.class-caipu ul li div{
position: absolute;
width: 100%;
height: 2.07rem;
left: 0;
top: 0;
background: rgba(0, 0, 0, 0.28);
}
.class-caipu ul li p{
position: absolute;
z-index: 3;
color: #fff;
left: 50%;
top: 50%;
margin-left: -0.24rem;
margin-top: -0.18rem;
}
.caipu-title {
display: flex;
justify-content: space-between;
height: .68rem;
align-items: center;
}
.caipu-title h3{
font-size: .3rem;
}
.caipu-title span{
font-size: .24rem;
color: #8d8d8d
}

View File

@@ -0,0 +1,3 @@
.m-tabbar.tabbar-fixed {
bottom: -1px;
}

View File

@@ -0,0 +1,52 @@
.m-slider {
width: 95% !important;
margin: .1rem auto;
}
.slider-item {
width: 100% !important;
}
.m-grids-4 .grids-item:not(:nth-child(4n)):before,
.m-grids-2:before, .m-grids-3:before, .m-grids-4:before, .m-grids-5:before {
border: none !important;
}
.grids-icon {
height: auto;
}
.grids-icon img{
width: .9rem;
height: .9rem;
}
.grids-txt {
margin-top: .2rem;
}
.list-theme3 .list-item:nth-child(odd):after,
.list-theme3 .list-item:before {
border: none;
}
.list-cp {
margin-top: .4rem;
}
.list-title {
display: flex;
width: 100%;
justify-content: center;
height: 1rem;
align-items: center;
}
.list-title img{
width: .6rem;
height: .6rem;
}
.list-info {
margin-left: .2rem;
}
.list-info span{
font-size: .36rem;
color: #333;
}
.list-info p{
font-size: .2rem;
color: #999;
line-height: .24rem;
}

View File

@@ -0,0 +1,95 @@
body {
background: #fff;
}
.m-navbar {
background: rgba(255, 255, 255, 0);
position: fixed;
width: 100%;
top: 0;
z-index: 99;
transition: all 1s;
}
.active {
background: rgba(0, 0, 0, 0.41);
}
.g-view:before {
height: 0 !important;
}
.m-navbar:after{
border: none !important;
}
.navbar-center .navbar-title {
color: #fff;
}
.cell-icon:before {
color: #fff !important;
}
.info-top {
width: 100%;
height: 4.5rem;
background: url("../img/info_1.jpg") center /cover no-repeat;
background-size: cover;
}
.top-zhezhao {
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.42);
}
.info-title,
.info-list-item{
padding: .24rem;
}
.info-title{
margin-bottom: .4rem;
}
.info-title h2{
font-size: .48rem;
color: #000;
margin-bottom: .2rem;
}
.info-title p{
font-weight: 300;
color: #666;
text-align: justify;
font-size: .34rem;
color: #333;
line-height: .5rem;
}
.info-list-item {
margin-bottom: .2rem;
}
.info-list-item h2{
height: .72rem;
line-height: .72rem;
font-size: .32rem;
color: #333;
font-weight: 900;
}
.info-list-item p{
color: #333;
font-size: .32rem;
font-weight: 300;
line-height: .48rem;
padding-bottom: .2rem;
}
.step-item h2{
height: .88rem;
line-height: .88rem;
color: #333;
font-size: .38rem;
margin: .6rem 0 .2rem;
text-align: center;
display: block;
font-weight: 500;
}
.step-item p {
font-size: .34rem;
line-height: .5rem;
color: #333;
font-weight: 300;
text-align: justify;
padding: .32rem .4rem;
}
.step-item img {
width: 100%;
}

View File

@@ -0,0 +1,3 @@
.g-view:before {
height: 0;
}

View File

@@ -0,0 +1,44 @@
body {
background: #fff;
}
.view-main,.g-view {
height: 100%;
}
.view-main .view-left {
width: 25%;
height: 100%;
float: left;
border-right: .02rem solid #e8e8e8;
position: fixed;
top: .9rem;
left: 0;
overflow-y: scroll;
}
.view-main .view-right {
width: 75%;
height: 100%;
float: left;
position: fixed;
left: 1.875rem;
top: .9rem;
overflow-y: scroll;
}
.view-main .view-right li{
float: left;
padding: .2rem;
}
.view-right ul{
padding-left: .2rem;
}
.view-main .view-left ul li{
height: .8rem;
line-height: .8rem;
text-align: center;
}
.view-main .view-left ul li:last-child{
margin-bottom: 42px;
}
.active {
color: red;
}

View File

@@ -0,0 +1,14 @@
.g-view:before {
height: 0 !important;
}
.m-navbar:after,
.m-cell:after {
border-bottom: none !important;
}
body {
background: #fff;
}
.cell-input {
background: #f7f7f7;
padding-left: 10px;
}

View File

@@ -0,0 +1,268 @@
@font-face {
font-family:"socialshare";src:url("https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/fonts/iconfont.eot");src:url("https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/fonts/iconfont.eot?#iefix") format("embedded-opentype"),url("https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/fonts/iconfont.woff") format("woff"),url("https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/fonts/iconfont.ttf") format("truetype"),url("https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/fonts/iconfont.svg#iconfont") format("svg")
}
.social-share {
font-family: "socialshare" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale
}
.social-share * {
font-family: "socialshare" !important
}
.social-share .icons-tencent:before {
content: "\f07a"
}
.social-share .icons-qq:before {
content: "\f11a"
}
.social-share .icons-weibo:before {
content: "\f12a"
}
.social-share .icons-wechat:before {
content: "\f09a"
}
.social-share .icons-douban:before {
content: "\f10a"
}
.social-share .icons-heart:before {
content: "\f20a"
}
.social-share .icons-like:before {
content: "\f00a"
}
.social-share .icons-qzone:before {
content: "\f08a"
}
.social-share .icons-linkedin:before {
content: "\f01a"
}
.social-share .icons-diandian:before {
content: "\f05a"
}
.social-share .icons-facebook:before {
content: "\f03a"
}
.social-share .icons-google:before {
content: "\f04a"
}
.social-share .icons-twitter:before {
content: "\f06a"
}
.social-share a {
position: relative;
text-decoration: none;
margin: 4px;
display: inline-block;
outline: none
}
.social-share .social-share-icon {
position: relative;
display: inline-block;
width: 32px;
height: 32px;
font-size: 20px;
border-radius: 50%;
line-height: 32px;
border: 1px solid #666;
color: #666;
text-align: center;
vertical-align: middle;
transition: background 0.6s ease-out 0s
}
.social-share .social-share-icon:hover {
background: #666;
color: #fff
}
.social-share .icons-weibo {
color: #ff763b;
border-color: #ff763b
}
.social-share .icons-weibo:hover {
background: #ff763b
}
.social-share .icons-tencent {
color: #56b6e7;
border-color: #56b6e7
}
.social-share .icons-tencent:hover {
background: #56b6e7
}
.social-share .icons-qq {
color: #56b6e7;
border-color: #56b6e7
}
.social-share .icons-qq:hover {
background: #56b6e7
}
.social-share .icons-qzone {
color: #FDBE3D;
border-color: #FDBE3D
}
.social-share .icons-qzone:hover {
background: #FDBE3D
}
.social-share .icons-douban {
color: #33b045;
border-color: #33b045
}
.social-share .icons-douban:hover {
background: #33b045
}
.social-share .icons-linkedin {
color: #0077B5;
border-color: #0077B5
}
.social-share .icons-linkedin:hover {
background: #0077B5
}
.social-share .icons-facebook {
color: #44619D;
border-color: #44619D
}
.social-share .icons-facebook:hover {
background: #44619D
}
.social-share .icons-google {
color: #db4437;
border-color: #db4437
}
.social-share .icons-google:hover {
background: #db4437
}
.social-share .icons-twitter {
color: #55acee;
border-color: #55acee
}
.social-share .icons-twitter:hover {
background: #55acee
}
.social-share .icons-diandian {
color: #307DCA;
border-color: #307DCA
}
.social-share .icons-diandian:hover {
background: #307DCA
}
.social-share .icons-wechat {
position: relative;
color: #7bc549;
border-color: #7bc549
}
.social-share .icons-wechat:hover {
background: #7bc549
}
.social-share .icons-wechat .wechat-qrcode {
display: none;
border: 1px solid #eee;
position: absolute;
z-index: 9;
top: -205px;
left: -84px;
width: 200px;
height: 192px;
color: #666;
font-size: 12px;
text-align: center;
background-color: #fff;
box-shadow: 0 2px 10px #aaa;
transition: all 200ms;
-webkit-tansition: all 350ms;
-moz-transition: all 350ms
}
.social-share .icons-wechat .wechat-qrcode.bottom {
top: 40px;
left: -84px
}
.social-share .icons-wechat .wechat-qrcode.bottom:after {
display: none
}
.social-share .icons-wechat .wechat-qrcode h4 {
font-weight: normal;
height: 26px;
line-height: 26px;
font-size: 12px;
background-color: #f3f3f3;
margin: 0;
padding: 0;
color: #777
}
.social-share .icons-wechat .wechat-qrcode .qrcode {
width: 105px;
margin: 10px auto
}
.social-share .icons-wechat .wechat-qrcode .qrcode table {
margin: 0 !important
}
.social-share .icons-wechat .wechat-qrcode .help p {
font-weight: normal;
line-height: 16px;
padding: 0;
margin: 0
}
.social-share .icons-wechat .wechat-qrcode:after {
content: '';
position: absolute;
left: 50%;
margin-left: -6px;
bottom: -13px;
width: 0;
height: 0;
border-width: 8px 6px 6px 6px;
border-style: solid;
border-color: #fff transparent transparent transparent
}
.social-share .icons-wechat:hover .wechat-qrcode {
display: block
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

View File

@@ -0,0 +1,48 @@
// 好处!!
// 1: 使用自执行函数,让函数自己运行
// 2: 使用局部作用域避免变量和方法的污染
(function (){
let lists = classDaras.result;
console.log(lists)
/**
* 1只为了渲染页面
*/
function RenderLeftMenu() {
lists.forEach(function(val,index) {
$(".view-left ul").append(`<li class="${ index == 0 ? 'active':'' }">${val.name}</li>`)
})
}
/**
* 绑定点击事件
*/
function BindClick() {
$(".view-left ul li").on('click',function(){
$(this).addClass('active').siblings().removeClass('active')
RenderRightMenu( $(".view-left ul li").index($(this)) )
})
}
/**
* 渲染右边对应的子分类
* @param {*} id
*/
function RenderRightMenu(id) {
$(".view-right ul").empty();
lists[id].list.forEach(val =>{
$(".view-right ul").append(`<li>
<a href="./list.html?id=${val.id}&status=true">${val.name}</a>
</li>`)
})
}
RenderLeftMenu()
BindClick()
RenderRightMenu(0)
})()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
(function() {
var keyWord = "西红柿"
http({
url: '/query',
type: 'GET',
data: {
keyword: keyWord
}
}, function(res) {
console.log(res)
let result = res.data;
result.forEach(val => {
$('.m-list').append(`<a class="list-item">
<div class="list-img">
<img src="${val.albums[0]}">
</div>
<div class="list-mes">
<h3 class="list-title">${val.title}</h3>
<div class="list-mes-item">
<div>
<span class="list-del-price">${val.tags.substring(0,10)}...</span>
</div>
</div>
</div>
</a>`)
});
})
})()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
(function() {
// getClassInfo
let id = GetQueryString("id")
let status = GetQueryString("status"), url = ""
if(status == "true") {
url = "/getClassInfo"
} else {
url = "/query"
}
http({
url: url,
type: "GET",
data: {
cid: id,
pn: 0
}
}, function(res){
let result = res.data;
result.forEach(val => {
$('.m-list').append(`<a class="list-item">
<div class="list-img">
<img src="${val.albums[0]}">
</div>
<div class="list-mes">
<h3 class="list-title">${val.title}</h3>
<div class="list-mes-item">
<div>
<p>${val.imtro.substring(0,20)}</p>
<span >${val.ingredients}</span>
</div>
</div>
</div>
</a>`)
});
})
})()

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,22 @@
function http(params,cb) {
//return new Promise(function(resolve,reject){
$.ajax({
url: "http://127.0.0.1:3300"+params.url,
type: params.type,
data: params.data,
success: function(res) {
cb(res.result)
}
})
//})
}
function GetQueryString(name) {
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null) return unescape(r[2]); return null;
}

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/about.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title>我的</title>
</head>
<body>
<div class="g-view">
<div class="top-title">
<h2>我的美食之旅</h2>
<i class="icon-ucenter-outline" style="font-size: 56px;"></i>
</div>
<div class="m-cell">
<a class="cell-item" href="./like.html">
<div class="cell-left">
我的收藏
</div>
<div class="cell-right">
<i class="cell-icon icon-like-outline"></i>
</div>
</a>
<a class="cell-item" href="javascript:; ">
<div class="cell-left">
意见反馈
</div>
<div class="cell-right">
<i class="cell-icon icon-feedback"></i>
</div>
</a>
</div>
</div>
<footer class="m-tabbar tabbar-fixed">
<a href="./index.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-home"></i>
</span>
<span class="tabbar-txt">首页</span>
</a>
<a href="./class.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-type"></i>
</span>
<span class="tabbar-txt">分类</span>
</a>
<a href="./about.html" class="tabbar-item tabbar-active">
<span class="tabbar-icon">
<i class="icon-ucenter-outline"></i>
</span>
<span class="tabbar-txt">我的</span>
</a>
</footer>
</body>

View File

@@ -0,0 +1,123 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/class.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title>分类</title>
</head>
<body>
<div class="g-view">
<div class="class-title">
<h2>分类</h2>
<p>要吃什么,这里都有!</p>
</div>
<div class="m-cell">
<div class="cell-item">
<div class="cell-left">
<i class="cell-icon icon-search"></i>
</div>
<div class="cell-right">
<input type="text" class="cell-input" placeholder="点这里,做不一样的菜">
</div>
</div>
</div>
<div class="class-caipu">
<div class="caipu-title">
<h3>菜谱分类</h3>
<span>
<a href="./moreclass.html">更多分类</a>
</span>
</div>
<ul>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=6">菜肴</a>
</p>
</li>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=8">西点</a>
</p>
</li>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=5">工艺口味</a>
</p>
</li>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=7">主食</a>
</p>
</li>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=10">其他菜品</a>
</p>
</li>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=11">人群</a>
</p>
</li>
</ul>
</div>
</div>
<footer class="m-tabbar tabbar-fixed">
<a href="./index.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-home"></i>
</span>
<span class="tabbar-txt">首页</span>
</a>
<a href="./class.html" class="tabbar-item tabbar-active">
<span class="tabbar-icon">
<i class="icon-type"></i>
</span>
<span class="tabbar-txt">分类</span>
</a>
<a href="./about.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-ucenter-outline"></i>
</span>
<span class="tabbar-txt">我的</span>
</a>
</footer>
<!-- 引入jQuery 2.0+ -->
<script src="../js/jquery.js"></script>
<!-- 引入YDUI脚本 -->
<script src="../js/ydui.js"></script>
<script src="../js/utils.js"></script>
<script>
Search('.cell-input')
</script>
</body>

View File

@@ -0,0 +1,135 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/index.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title>首页</title>
</head>
<body>
<header class="m-navbar navbar-fixed">
<a href="./about.html" class="navbar-item">
<i class="cell-icon icon-ucenter-outline"></i>
</a>
<div class="navbar-center">
<span class="navbar-title">
舌尖秘籍
</span>
</div>
<a onclick="javascript:location.href='./search.html' " class="navbar-item">
<i class="cell-icon icon-search"></i>
</a>
</header>
<div class="g-view">
<div class="m-slider" id="J_Slider">
<div class="slider-wrapper">
<div class="slider-item">
<a href="#">
<img src="../img/banner_1.jpg">
</a>
</div>
<div class="slider-item">
<a href="#">
<img src="../img/banner_2.jpg">
</a>
</div>
<div class="slider-item">
<a href="#">
<img src="../img/banner_3.png">
</a>
</div>
</div>
<div class="slider-pagination"></div><!-- 分页标识 -->
</div>
<div class="m-grids-4">
<a href="./moreclass.html?id=1" class="grids-item">
<div class="grids-icon">
<img src="../img/class_1.png">
</div>
<div class="grids-txt">
<span>菜系</span>
</div>
</a>
<a href="./moreclass.html?id=9" class="grids-item">
<div class="grids-icon">
<img src="../img/class_2.png">
</div>
<div class="grids-txt">
<span>汤羹饮品</span>
</div>
</a>
<a href="./moreclass.html?id=4" class="grids-item">
<div class="grids-icon">
<img src="../img/class_3.png">
</div>
<div class="grids-txt">
<span>场景</span>
</div>
</a>
<a href="./moreclass.html?id=7" class="grids-item">
<div class="grids-icon">
<img src="../img/class_4.png">
</div>
<div class="grids-txt">
<span>主食</span>
</div>
</a>
</div>
<div class="list-cp">
<div class="list-title">
<img src="../img/home_title_love.png" alt="">
<div class="list-info">
<span>猜你喜欢</span>
<p>21:16为您更新</p>
</div>
</div>
<article class="m-list list-theme3">
</article>
</div>
</div>
<footer class="m-tabbar tabbar-fixed">
<a href="./index.html" class="tabbar-item tabbar-active">
<span class="tabbar-icon">
<i class="icon-home"></i>
</span>
<span class="tabbar-txt">首页</span>
</a>
<a href="./class.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-type"></i>
</span>
<span class="tabbar-txt">分类</span>
</a>
<a href="./about.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-ucenter-outline"></i>
</span>
<span class="tabbar-txt">我的</span>
</a>
</footer>
<!-- 引入jQuery 2.0+ -->
<script src="../js/jquery.js"></script>
<!-- 引入YDUI脚本 -->
<script src="../js/ydui.js"></script>
<script src="../js/utils.js"></script>
<script src="../js/index.js"></script>
<script>
</script>
</body>
</html>

View File

@@ -0,0 +1,98 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/share.min.css">
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/info.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title></title>
<style>
.share {
position: fixed;
width: 100%;
height: 60px;
left: 0;
bottom: -60px;
z-index: 999;
background: #fff;
padding-top: 10px;
text-align: center;
}
</style>
</head>
<body>
<header class="m-navbar">
<a href="#" class="navbar-item">
<i class="cell-icon back-ico" onclick="javascript:history.back()"></i>
<i class="cell-icon icon-share2"></i>
</a>
<div class="navbar-center">
<span class="navbar-title">菜品详情</span>
</div>
<div class="navbar-item">
<a href="#">
<i class="like cell-icon icon-star-outline"></i>
</a>
</div>
</header>
<div class="g-view">
<div class="info-top">
<div class="top-zhezhao"></div>
</div>
<div class="info-action">
<div class="info-title">
<h2>香辣豆豉鲫鱼</h2>
<p>以前我们介绍过【午餐肉】、【清蒸猪肉】等常见的罐头口味菜品的烹饪方法,今天我们再介绍一道常见的罐头食品【豆豉鲫鱼】的做法...</p>
</div>
<div class="info-list-item zhu">
<h2>主料</h2>
<p>荷叶饼,6张;韭菜,200g;绿豆芽,200g;肉馅,200g</p>
</div>
<div class="info-list-item fu">
<h2>辅料</h2>
<p>盐,适量;水淀粉,适量</p>
</div>
<div class="info-step">
</div>
</div>
</div>
<div class="share">
<div class="social-share" data-disabled="google,twitter,facebook"></div>
</div>
<!-- 引入jQuery 2.0+ -->
<script src="../js/jquery.js"></script>
<!-- 引入YDUI脚本 -->
<script src="../js/ydui.js"></script>
<script src="../js/utils.js"></script>
<script src="../js/info.js"></script>
<script src="../js/social-share.min.js"></script>
<script>
// jq 监听页面滚动
$(window).scroll(function(){
//获取当前滑动的位置
var scrollTop = $(window).scrollTop();
// 如果大于导航条 45px 时候添加 改变背景色的类名
if(scrollTop > 45){
$(".m-navbar").addClass("active");
}else{ // 否则移除
$(".m-navbar").removeClass("active");
}
})
</script>
</body>
</html>

View File

@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/share.min.css">
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/like.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title></title>
</head>
<header class="m-navbar">
<a onclick="javascript:history.back()" class="navbar-item">
<i class="back-ico"></i>
</a>
<div class="navbar-center">
<span class="navbar-title">收藏列表</span>
</div>
</header>
<div class="g-view">
<div class="m-actionsheet" id="J_ActionSheet">
<a href="#" class="actionsheet-item delete">删除该分类</a>
<a href="javascript:;" class="actionsheet-action" id="J_Cancel">取消</a>
</div>
<article class="m-list list-theme4">
</article>
</div>
<!-- 引入jQuery 2.0+ -->
<script src="../js/jquery.js"></script>
<!-- 引入YDUI脚本 -->
<script src="../js/ydui.js"></script>
<script src="../js/utils.js"></script>
<script src="../js/like.js"></script>
<script>
// jq 监听页面滚动
$(window).scroll(function(){
//获取当前滑动的位置
var scrollTop = $(window).scrollTop();
// 如果大于导航条 45px 时候添加 改变背景色的类名
if(scrollTop > 45){
$(".m-navbar").addClass("active");
}else{ // 否则移除
$(".m-navbar").removeClass("active");
}
})
</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More