├── .gitignore ├── README.md ├── build ├── http.push.js ├── http.push.tar.gz.js ├── vue-loader.config.js ├── webpack.base.config.js ├── webpack.dev.config.js ├── webpack.dll.config.js ├── webpack.product.config.js └── webpack.test.config.js ├── favicon.ico ├── imgs └── 01.png ├── package-lock.json ├── package.json └── src ├── app.vue ├── assets ├── common │ ├── css │ │ ├── OpenSans-Regular.ttf │ │ ├── base.scss │ │ ├── common.scss │ │ └── vars.scss │ ├── images │ │ ├── 404 │ │ │ ├── 404.png │ │ │ ├── 404_msg.png │ │ │ ├── 404_to_index.png │ │ │ ├── error_bg.jpg │ │ │ ├── error_cloud.png │ │ │ └── screenshot.jpg │ │ ├── PopLayer-close.png │ │ ├── backtop.png │ │ ├── call_kefu.png │ │ ├── default_big_img.png │ │ ├── empty.png │ │ ├── gods-default-icon.png │ │ ├── icon-1.png │ │ ├── icon-2.png │ │ ├── icon-3.png │ │ ├── icon-left-jt.png │ │ ├── icon-right-jt.png │ │ ├── loading.gif │ │ ├── loading_1.gif │ │ ├── logo.png │ │ ├── qq.png │ │ └── upload.png │ ├── js │ │ ├── common.js │ │ ├── config.js │ │ ├── echo.min.js │ │ ├── format.js │ │ ├── jquery-2.1.4.min.js │ │ ├── jquery.cookie.js │ │ ├── jquery.qrcode.min.js │ │ ├── jquery.scrollTo.min.js │ │ ├── util.js │ │ └── validform.js │ └── lib │ │ ├── bootstrap │ │ ├── css │ │ │ ├── bootstrap-theme.css │ │ │ ├── bootstrap-theme.css.map │ │ │ ├── bootstrap-theme.min.css │ │ │ ├── bootstrap-theme.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ └── js │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.min.js │ │ │ └── npm.js │ │ ├── jiami │ │ ├── hmac-md5.js │ │ ├── hmac-sha224.js │ │ ├── hmac-sha256.js │ │ ├── hmac-sha3.js │ │ ├── hmac-sha384.js │ │ ├── hmac-sha512.js │ │ └── md5.js │ │ ├── mixin │ │ └── propsync.js │ │ ├── page │ │ ├── page.css │ │ └── page.js │ │ ├── popup │ │ ├── popup.css │ │ └── popup.js │ │ └── swiper │ │ ├── maps │ │ └── swiper.jquery.min.js.map │ │ ├── swiper.min.css │ │ └── swiper.min.js └── html │ ├── abother.html │ └── about.html ├── commonvue ├── side.vue ├── top.vue └── zane-calendar.vue ├── components ├── drop.vue ├── modal.vue ├── navBar.vue ├── page.vue ├── pageList.vue ├── totop.vue └── utils │ ├── NodeList.js │ └── utils.js ├── filter.js ├── index.html ├── main.js ├── pages └── index │ ├── filter.js │ ├── index.vue │ ├── indexui.vue │ └── router.js ├── router.js └── vuex ├── modules └── goods.js ├── mutation-types.js └── store.js /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /dist 3 | .idea/ 4 | .DS_Store 5 | src/.DS_Store 6 | src/assets/.DS_Store 7 | */.DS_Store 8 | */*/.DS_Store 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue组件化开发-示例 vue2.5+webpack3.8 2 | 3 | > * 使用知识点: 4 | > * vue.js 轻量级mvvm框架 5 | > * webpack 前端自动话打包工具 6 | > * vue-router vue路由 7 | > * vue-loader vue组件化开发插件 8 | > * vuex 前端状态管理 类式于flux 和 radux 9 | > * babel es6转译工具,用最前言的javascript做前端开发 10 | 11 | 12 | ## 优化说明 13 | > * DllPlugin和DllReferencePlugin 项目中不更改js不需要重复构建 例如:vue,vuex,vue-router 等等 14 | 参考配置: webpack.dll.config.js 15 | > * happypack 优化 针对于.vue、.js、.scss 文件进行多线程编译 16 | > * webpack-parallel-uglify-plugin 插件替换 webpack 自带的UglifyJS 插件 支持打包es6语法 17 | > * Webpack 3 的新功能:Scope Hoisting 新增配置插件 new webpack.optimize.ModuleConcatenationPlugin() 18 | 19 | ### 优化之后构建速度明显提高 20 | 21 | ### webpack优化构建说明:http://blog.seosiwei.com/detail/9 22 | 23 | ## 项目步骤 24 | 25 | 1.安装node.js 26 | 27 | 2.安装项目依赖包 28 | 29 | ``` 30 | npm install 31 | ``` 32 | 33 | 3.运行开发环境 34 | 35 | ``` 36 | npm run dev 37 | ``` 38 | 39 | ``` 40 | 浏览器中访问:localhost:8000 41 | ``` 42 | 43 | 44 | 4.打包生产文件 打生产报需要构建一次 dll 命令:即经常不会改动的文件 45 | 46 | ``` 47 | npm run build:dll //此命令一般只运行一次 若后期依赖项目有改动才运行 48 | 49 | npm run build //每次生产包运行 50 | 51 | ``` 52 | 53 | ##大致说明 54 | 55 | ``` 56 | webpack : 前端模块化打包工具 57 | vue.js : vue.js 清量级的mvvm的框架 58 | babel : 项目使用babel编译 可用最新的es6编写我们的javascript (当然用es5写也是一样的) 59 | vue-loader :模块化的开发vue插件 60 | vue-router :vue的路由插件 61 | vuex : 一个专门为 Vue.js 应用设计的状态管理架构 62 | ``` 63 | 64 | ### DEMO图片 65 | ![](https://github.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/blob/master/imgs/01.png "") 66 | -------------------------------------------------------------------------------- /build/http.push.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author wangwei 3 | * @since 17/4/1 4 | */ 5 | var fs = require('fs'); 6 | var path = require('path'); 7 | var u = require('underscore'); 8 | var request = require('request'); 9 | var log = require('log-util'); 10 | var chalk = require('chalk'); 11 | var Promise = require('bluebird') 12 | var targz = require('tar.gz'); 13 | var exec = require('child_process').exec; 14 | 15 | /** 16 | * http上传插件 17 | * 18 | * @param options 19 | * @param options.receiver 20 | * @param options.to 21 | * @param options.token 22 | * 23 | * @constructor 24 | */ 25 | class HttpPush { 26 | //初始化对象 27 | constructor(option){ 28 | this.option=option 29 | this.uploadFiles(); 30 | }; 31 | 32 | //上传文件 33 | uploadFiles(){ 34 | this.walkDir(this.option.buildDir+'/',src=>{ 35 | let arr=this.option.buildDir.split('/') 36 | let arr1=[] 37 | arr.forEach((item,index)=>{ 38 | if( item != '.' ){ 39 | arr1.push(item) 40 | } 41 | }) 42 | let base=arr1.join('/') 43 | let file=src.replace(base+'/','') 44 | let json={ 45 | receiver: this.option.receiver, 46 | data:this.option.data, 47 | src:src, 48 | file:file, 49 | } 50 | json.data.basesrc=this.option.to 51 | if(this.option.tarGzName){ 52 | json.data.to=this.option.to+'/'+this.option.tarGzName 53 | }else{ 54 | json.data.to=this.option.to+'/'+file 55 | } 56 | 57 | this.upload(json.receiver,json.data,json.src,json.file,function(err, res){ 58 | if (err) { 59 | log.error(json.file + ' - ' + chalk.red('[error] [' + err + ']')); 60 | } 61 | else { 62 | log.info(json.file + chalk.green(' [DONE]')); 63 | } 64 | }); 65 | }); 66 | }; 67 | 68 | //遍历文件 69 | walkDir (dirPath,fn) { 70 | let _this=this; 71 | fs.readdir(dirPath, function (err, entires) { 72 | for (var idx in entires) { 73 | var fullPath = path.join(dirPath, entires[idx]); 74 | (function (fullPath) { 75 | fs.stat(fullPath, function (err, stats) { 76 | if (stats && stats.isFile()) { 77 | fn&&fn(fullPath) 78 | } else if(stats && stats.isDirectory()) { 79 | _this.walkDir(fullPath,fn); 80 | } 81 | }) 82 | })(fullPath); 83 | } 84 | }); 85 | }; 86 | 87 | //http上传函数 88 | upload(url, data, filepath, subpath, callback) { 89 | let formData = u.extend(data, { 90 | file: { 91 | value: fs.createReadStream(filepath), 92 | options: { 93 | filename: subpath 94 | } 95 | } 96 | }); 97 | request.post({ 98 | url: url, 99 | formData: formData 100 | },(err, res, body)=>{ 101 | if (err) { 102 | callback(err); 103 | return; 104 | } 105 | callback(); 106 | }) 107 | }; 108 | }; 109 | 110 | 111 | /*-------------发布代码的类--------------------*/ 112 | class httpPushTarGz { 113 | 114 | //初始化对象 115 | constructor(option){ 116 | //default 设置 117 | this.option={ 118 | receiver : 'http://127.0.0.1:1234/receiver', 119 | distDir : path.resolve(__dirname, '../dist/targz'), //生成tar.gz包的文件夹 120 | proDir : path.resolve(__dirname, '../dist/test'), //上传的目标文件夹 121 | copyDir : path.resolve(__dirname, '../dist/html'), //复制的目标文件夹 122 | tarGzName : 'build.tar.gz', //压缩后的名字 123 | to : '../html', //服务器 放置目录 124 | data:{ 125 | isDelDir : 'yse', //是否删除服务端文件 no || yes 126 | exclude : '', //服务器不需要删除的文件夹 127 | } 128 | 129 | } 130 | this.option=this.extend(this.option,option); 131 | 132 | this.init(); 133 | }; 134 | 135 | init(){ 136 | let isHave=fs.existsSync(this.option.distDir) 137 | if(isHave){ 138 | this.httpPushForTar(); 139 | }else{ 140 | fs.mkdirSync(this.option.distDir) 141 | this.httpPushForTar(); 142 | } 143 | }; 144 | 145 | //压缩并上传 146 | httpPushForTar(){ 147 | this.copyDirFn(()=>{ 148 | targz().compress(this.option.copyDir, `${this.option.distDir}/${this.option.tarGzName}`) 149 | .then(()=>{ 150 | console.log('Job done!'); 151 | new HttpPush({ 152 | receiver: this.option.receiver, 153 | buildDir: this.option.distDir, 154 | to: this.option.to, 155 | data:this.option.data, 156 | tarGzName:this.option.tarGzName, 157 | }) 158 | }) 159 | .catch((err)=>{ 160 | console.log('Something is wrong ', err.stack); 161 | }); 162 | }); 163 | }; 164 | 165 | // 复制文件 166 | copyDirFn(fn){ 167 | let isProDirHave=fs.existsSync(this.option.proDir) 168 | let isCopyDirHave=fs.existsSync(this.option.copyDir) 169 | 170 | if(!isProDirHave) return false; 171 | 172 | // 没有目标文件创建 173 | if(isProDirHave&&!isCopyDirHave){ 174 | exec(`cp -a ${this.option.proDir} ${this.option.copyDir}` , (err,out)=>{ 175 | if(err){console.log(err); }; 176 | fn&&fn() 177 | }); 178 | //有目标文件先删除再创建 179 | }else if(isProDirHave&&isCopyDirHave){ 180 | exec(`rm -rf ${this.option.copyDir}` ,(err,out)=>{ 181 | if(err){console.log(err); }; 182 | exec(`cp -a ${this.option.proDir} ${this.option.copyDir}` ,(err,out)=>{ 183 | if(err){console.log(err); }; 184 | fn&&fn() 185 | }); 186 | }); 187 | } 188 | }; 189 | 190 | // extend 191 | extend(json1,json2){ 192 | for(let key in json2){ 193 | if(typeof(json2[key])=='object'){ 194 | for(let k in json2[key]){ 195 | json1[key][k] = json2[key][k] 196 | } 197 | }else{ 198 | json1[key] = json2[key] 199 | } 200 | } 201 | return json1; 202 | }; 203 | } 204 | 205 | module.exports = httpPushTarGz; -------------------------------------------------------------------------------- /build/http.push.tar.gz.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author wangwei 3 | * @since 17/4/1 4 | */ 5 | 6 | var httpPushTarGz=require('./http.push.js') 7 | var path = require('path'); 8 | 9 | /*--------------发布代码配置-------------------*/ 10 | new httpPushTarGz({ 11 | receiver : 'http://www.xxx.cn/http-push-test/receiver', 12 | distDir : path.resolve(__dirname, '../dist/targz'), //生成tar.gz包的文件夹 13 | proDir : path.resolve(__dirname, '../dist/production'), //上传的目标文件夹 14 | copyDir : path.resolve(__dirname, '../dist/html'), //复制的目标文件夹 15 | tarGzName : 'build.tar.gz', //压缩后的名字 16 | to : '/data/app/pt/html/html', //服务器 放置目录 17 | data:{ 18 | isDelDir : 'yes', //是否删除服务端文件 no || yes 19 | exclude : '', //服务器不需要删除的文件夹 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /build/vue-loader.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | loaders:{ 3 | js:[{ 4 | loader:'babel-loader', 5 | options:{ 6 | presets: [ 'env' ], 7 | } 8 | }], 9 | css:'vue-style-loader!css-loader', 10 | sass:'vue-style-loader!css-loader!sass-loader', 11 | }, 12 | extractCSS: true, 13 | } 14 | -------------------------------------------------------------------------------- /build/webpack.base.config.js: -------------------------------------------------------------------------------- 1 | //webpack.base config 2 | const webpack = require('webpack'); 3 | const path = require("path"); 4 | const fs = require("fs"); 5 | const glob = require('glob'); 6 | const htmlWebpackPlugin = require('html-webpack-plugin'); 7 | const ExtractTextPlugin = require("extract-text-webpack-plugin"); 8 | const vueLoaderConfig = require("./vue-loader.config"); 9 | const PROT = process.env.PROT || 8000 10 | 11 | // 多线程 12 | const HappyPack = require('happypack'); 13 | const os = require('os'); 14 | const happyThreadPool = HappyPack.ThreadPool({ size: os.cpus().length }); 15 | 16 | //提取公共文件 17 | const CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin; 18 | //项目名字 19 | const projectName = "/"; 20 | 21 | //配置开始 22 | const config = { 23 | entry: { 24 | //assets:path.resolve(__dirname, '../src' + projectName + 'assets/html/js/assets.js'), 25 | main:[ 26 | path.resolve(__dirname, '../src' + projectName + 'main.js') 27 | ] 28 | }, 29 | output: { 30 | path: path.resolve(__dirname, '../dist'), 31 | publicPath: '/', 32 | filename: '[name].js', 33 | chunkFilename: "[name].js" 34 | }, 35 | module: { 36 | rules: [{ 37 | test: /\.vue$/, 38 | exclude: "/node_modules/", 39 | loader: [ 'happypack/loader?id=vue' ] 40 | }, 41 | { 42 | test: /\.js$/, 43 | exclude: /node_modules|vue\/dist/, 44 | loader: [ 'happypack/loader?id=js' ] 45 | }, 46 | { 47 | test: /\.scss$/, 48 | loader: [ 'happypack/loader?id=sass' ] 49 | }, 50 | { 51 | test:/\.css$/, 52 | use: ExtractTextPlugin.extract({ 53 | fallback: 'vue-style-loader', 54 | use: "css-loader" 55 | }) 56 | }, 57 | //图片文件使用 url-loader 来处理,小于8kb的直接转为base64 58 | { 59 | test: /\.(png|jpg|gif)$/, 60 | loader: 'url-loader?limit=8192&name=img/[name].[ext]?[hash]' 61 | }, 62 | { 63 |   test: /\.(woff|woff2|eot|ttf|svg)(\?.*$|$)/, 64 |   loader: 'url-loader?importLoaders=1&limit=1000&name=fonts/[name].[ext]' 65 |    }, 66 | { 67 |   test: /\.(xlsx|xls)(\?.*$|$)/, 68 |   loader: 'url-loader?importLoaders=1&limit=8192&name=files/[name].[ext]' 69 |   }, 70 | ]}, 71 | //自动补全识别后缀 72 | resolve: { 73 | extensions: ['.js', '.vue', '.json'], 74 | alias: { 75 | vue$:'vue/dist/vue.runtime.common.js', 76 | components: path.resolve(__dirname, '../src' + projectName + 'components'), 77 | commonvue: path.resolve(__dirname, '../src' + projectName + 'commonvue'), 78 | pages: path.resolve(__dirname, '../src' + projectName + 'pages'), 79 | common: path.resolve(__dirname, '../src' + projectName + 'assets/common'), 80 | assets:path.resolve(__dirname, '../src' + projectName + 'assets'), 81 | popup: path.resolve(__dirname, '../src' + projectName + 'assets/common/lib/popup/popup.js'), 82 | page: path.resolve(__dirname, '../src' + projectName + 'assets/common/lib/page/page.js'), 83 | }, 84 | }, 85 | externals: { 86 | jquery: 'jQuery' 87 | }, 88 | //插件 89 | plugins: [ 90 | //js 编译多线程 91 | new HappyPack({ 92 | id: 'js', 93 | threadPool: happyThreadPool, 94 | loaders: [{ 95 | loader: 'babel-loader', 96 | options: { 97 | presets: [ 'env' ], 98 | } 99 | }], 100 | }), 101 | // sass 编译多线程 102 | new HappyPack({ 103 | id: 'sass', 104 | threadPool: happyThreadPool, 105 | loaders: [ 'style-loader', 'css-loader', 'sass-loader' ] 106 | }), 107 | // vue 编译多线程 108 | new HappyPack({ 109 | id: 'vue', 110 | threadPool: happyThreadPool, 111 | loaders:[{ 112 | loader: 'vue-loader', 113 | options: vueLoaderConfig 114 | }] 115 | }), 116 | //提取css 117 | new ExtractTextPlugin("styles.css"), 118 | new CommonsChunkPlugin({ 119 | name: 'vendors', // 将公共模块提取,生成名为`vendors`的chunk 120 | chunks: ['main'], 121 | minChunks: 1 // 提取所有entry共同依赖的模块 122 | }), 123 | //自动生成html文件 124 | new htmlWebpackPlugin({ 125 | title:"首页", 126 | template:path.resolve(__dirname, '../src'+projectName+'index.html'), 127 | inject: true, 128 | hash: true, 129 | cache: true, 130 | chunks: ['main','vendors'], 131 | favicon:path.resolve(__dirname, '../favicon.ico'), 132 | }), 133 | ], 134 | } 135 | 136 | //处理所有静态html 137 | //获得所有pages 138 | var htmls = Object.keys(getEntry( 139 | path.resolve(__dirname, '../src' + projectName + 'assets/html/*.html'), 140 | path.resolve(__dirname, '../src' + projectName+'assets/') 141 | )); 142 | //循环pages 自动生成html文件 143 | htmls.forEach(function(pathname) { 144 | console.log(pathname) 145 | var pageName = pathname; 146 | pageName=pageName.replace('\\','/'); 147 | var conf = { 148 | filename: pageName + '.html', //生成的html存放路径,相对于path 149 | template: path.resolve(__dirname, '../src' + projectName+ '/assets/' + pathname + '.html'), 150 | inject: true, //js插入的位置,true/'head'/'body'/false 151 | hash: true, 152 | cache: true, 153 | }; 154 | conf.chunks = ['assets'] 155 | console.log(conf) 156 | config.plugins.push(new htmlWebpackPlugin(conf)); 157 | }); 158 | 159 | //入口函数 160 | function getEntry(globPath, pathDir) { 161 | var files = glob.sync(globPath); 162 | var entries = {}, 163 | entry, dirname, basename, pathname, extname; 164 | 165 | for (var i = 0; i < files.length; i++) { 166 | entry = files[i]; 167 | dirname = path.dirname(entry); 168 | extname = path.extname(entry); 169 | basename = path.basename(entry, extname); 170 | pathname = path.join(dirname, basename); 171 | pathname = pathDir ? pathname.split(pathDir)[1].substring(1) : pathname; 172 | entries[pathname] = [entry]; 173 | } 174 | return entries; 175 | } 176 | 177 | module.exports = config; 178 | -------------------------------------------------------------------------------- /build/webpack.dev.config.js: -------------------------------------------------------------------------------- 1 | // //开发环境 2 | const webpack = require('webpack') 3 | const config = require('./webpack.base.config') 4 | const WebpackDevServer = require('webpack-dev-server') 5 | const OpenBrowserPlugin = require('open-browser-webpack-plugin'); 6 | const PROT = process.env.PROT || 8000 7 | 8 | config.entry.main = (config.entry.main || []).concat([ 9 | `webpack-dev-server/client?http://localhost:${PROT}/`, 10 | "webpack/hot/dev-server", 11 | ]) 12 | config.plugins = (config.plugins || []).concat([ 13 | new webpack.HotModuleReplacementPlugin(), 14 | new OpenBrowserPlugin({ url: `http://127.0.0.1:${PROT}` }) 15 | ]) 16 | 17 | const compiler = webpack(config); 18 | const server = new WebpackDevServer(compiler, { 19 | hot: true, 20 | inline: true, 21 | watchOptions: { 22 | aggregateTimeout: 300, 23 | poll: 1000 24 | }, 25 | historyApiFallback:{ 26 | index:'/index.html' 27 | }, 28 | stats: { 29 | colors: true 30 | }, 31 | proxy: { 32 | '/api/': { 33 | target: 'https://other-server.example.com', 34 | secure: false, 35 | pathRewrite: {'^/api' : ''} 36 | } 37 | } 38 | }); 39 | 40 | server.listen(PROT); 41 | 42 | console.log(`服务端启动的链接地址为:http://127.0.0.1:${PROT}`); 43 | -------------------------------------------------------------------------------- /build/webpack.dll.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | const CleanWebpackPlugin = require('clean-webpack-plugin'); 4 | 5 | const basePath = process.env.DLL == 'build'?'production':'test'; 6 | const hashush = process.env.DLL == 'build'?'[name]_[hash]':'[name]'; 7 | const distpath = `../dist/${basePath}/libs`; 8 | 9 | module.exports = { 10 | // 你想要打包的模块的数组 11 | entry: { 12 | libs: [ 13 | 'vue', 14 | 'vuex', 15 | 'vue-router', 16 | 'jquery', 17 | 'zane-calendar', 18 | 'common/js/format', 19 | 'popup', 20 | 'page', 21 | 'common/lib/mixin/propsync', 22 | 'common/js/jquery.cookie.js', 23 | 'common/lib/bootstrap/css/bootstrap.css', 24 | 'common/lib/bootstrap/js/bootstrap.js', 25 | 'accounting', 26 | ] 27 | }, 28 | output: { 29 | path: path.join(__dirname, distpath), // 打包后文件输出的位置 30 | filename: `${hashush}.js`, 31 | library: hashush 32 | }, 33 | module: { 34 | rules: [ 35 | { 36 | test:/\.css$/, 37 | loader: 'css-loader' 38 | }, 39 | { 40 | test: /\.(png|jpg|gif)$/, 41 | loader: 'url-loader?limit=8192&name=img/[name].[ext]?[hash]' 42 | }, 43 | { 44 |   test: /\.(woff|woff2|eot|ttf|svg)(\?.*$|$)/, 45 |   loader: 'url-loader?importLoaders=1&limit=1000&name=fonts/[name].[ext]' 46 |    }, 47 | { 48 | test: /\.js$/, 49 | exclude: /node_modules|vue\/dist/, 50 | loader: 'babel-loader', 51 | options: { 52 | presets: [ 'env' ], 53 | } 54 | }, 55 | ] 56 | }, 57 | //自动补全识别后缀 58 | resolve: { 59 | extensions: ['.js', '.vue', '.json'], 60 | alias: { 61 | vue$:'vue/dist/vue.runtime.common.js', 62 | components: path.resolve(__dirname, '../src/components'), 63 | commonvue: path.resolve(__dirname, '../src/commonvue'), 64 | pages: path.resolve(__dirname, '../src/pages'), 65 | common: path.resolve(__dirname, '../src/assets/common'), 66 | assets:path.resolve(__dirname, '../src/assets'), 67 | popup: path.resolve(__dirname, '../src/assets/common/lib/popup/popup.js'), 68 | page: path.resolve(__dirname, '../src/assets/common/lib/page/page.js'), 69 | }, 70 | }, 71 | plugins: [ 72 | // 清除上一次生成的文件 73 | new CleanWebpackPlugin([`${basePath}/libs`], { 74 | root: path.resolve(__dirname, '../dist'), 75 | verbose: true, 76 | dry: false, 77 | }), 78 | new webpack.DllPlugin({ 79 | path: path.join(__dirname, distpath, '[name]-manifest.json'), 80 | name: hashush, 81 | context:path.join(__dirname, distpath), 82 | }), 83 | // 压缩打包的文件,与该文章主线无关 84 | new webpack.optimize.UglifyJsPlugin({ 85 | compress: { 86 | warnings: false 87 | } 88 | }), 89 | new webpack.DefinePlugin({ 90 | 'process.env': { 91 | NODE_ENV: '"production"' 92 | } 93 | }), 94 | new webpack.optimize.OccurrenceOrderPlugin(), 95 | new webpack.optimize.ModuleConcatenationPlugin(), 96 | ] 97 | }; 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /build/webpack.product.config.js: -------------------------------------------------------------------------------- 1 | //生产环境 2 | const webpack = require('webpack') 3 | const config = require('./webpack.base.config') 4 | const path = require("path"); 5 | const CleanWebpackPlugin = require('clean-webpack-plugin'); 6 | const HttpPushWebpackPlugin = require('http-push-webpack-plugin'); //http-push 7 | const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin'); 8 | 9 | //生成生产环境目录 10 | config.output.path=path.resolve(__dirname, '../dist/production'); 11 | config.output.filename ='js/[name].[hash].js', 12 | config.output.chunkFilename ="js/[name].[hash].js" 13 | 14 | // loaders 15 | config.module.rules = (config.module.rules || []).concat([{ 16 | // index.html script脚本引入 17 | test: path.resolve(__dirname, '../src/index.html'), 18 | loader: 'webpack-dll-loader', 19 | exclude: "/node_modules/", 20 | options:{ 21 | publicPath:'/libs/', 22 | manifest:path.resolve(__dirname, '../dist/production/libs/libs-manifest.json') 23 | } 24 | },{ 25 | //打包字符串替换 26 | test: path.resolve(__dirname, '../src/assets/common/js/config.js'), 27 | loader: 'string-replace-loader', 28 | exclude: "/node_modules/", 29 | query: { 30 | multiple: [ 31 | { search: /123456/, replace: '987654321' }, 32 | ] 33 | } 34 | }]) 35 | 36 | // 插件 37 | config.plugins = (config.plugins || []).concat([ 38 | // 增加DllReferencePlugin配置 39 | new webpack.DllReferencePlugin({ 40 | context:path.join(__dirname, '../dist/production/libs'), 41 | manifest: require("../dist/production/libs/libs-manifest.json") 42 | }), 43 | // 清除上一次生成的文件 44 | new CleanWebpackPlugin(['production/js'], { 45 | root: path.resolve(__dirname, '../dist'), 46 | verbose: true, 47 | dry: false, 48 | }), 49 | // 多线程压缩 50 | new ParallelUglifyPlugin({ 51 | // 支持es6打包 52 | uglifyES: { 53 | output: { 54 | comments: false 55 | }, 56 | compress: { 57 | warnings: false 58 | } 59 | } 60 | }), 61 | new webpack.DefinePlugin({ 62 | 'process.env': { 63 | NODE_ENV: '"production"' 64 | } 65 | }), 66 | new webpack.optimize.OccurrenceOrderPlugin(), 67 | new webpack.optimize.ModuleConcatenationPlugin(), 68 | ]) 69 | config.devtool = false; 70 | 71 | // webpack http-push 上传 72 | if(process.env.HTTP_PUSH === 'http-push' ){ 73 | config.plugins = (config.plugins || []).concat([ 74 | new HttpPushWebpackPlugin({ 75 | receiver: 'http://127.0.0.1:1234/receiver', // 服务端文件上传接口 76 | token: '../html/wangwei', // 验证token 77 | to: '../html/wangwei', // 注意这个是指的是测试机器的路径,而非本地机器 78 | }), 79 | ]) 80 | }; 81 | 82 | module.exports = config 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /build/webpack.test.config.js: -------------------------------------------------------------------------------- 1 | //生产环境 2 | var webpack = require('webpack') 3 | var config = require('./webpack.base.config') 4 | var path = require("path"); 5 | const CleanWebpackPlugin = require('clean-webpack-plugin'); 6 | const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin'); 7 | 8 | //生成测试环境目录 9 | config.output.path=path.resolve(__dirname, '../dist/test'); 10 | config.output.filename ='js/[name].js', 11 | config.output.chunkFilename ="js/[name].js" 12 | 13 | // loaders 14 | config.module.rules = (config.module.rules || []).concat([{ 15 | // index.html script脚本引入 16 | test: path.resolve(__dirname, '../src/index.html'), 17 | loader: 'webpack-dll-loader', 18 | exclude: "/node_modules/", 19 | options:{ 20 | publicPath:'/libs/', 21 | manifest:path.resolve(__dirname, '../dist/test/libs/libs-manifest.json') 22 | } 23 | },{ 24 | //打包字符串替换 25 | test: path.resolve(__dirname, '../src/assets/common/js/config.js'), 26 | loader: 'string-replace-loader', 27 | exclude: "/node_modules/", 28 | query: { 29 | multiple: [ 30 | { search: /123456/, replace: '987654321' }, 31 | ] 32 | } 33 | }]) 34 | 35 | config.devtool = '#source-map'; 36 | // 插件 37 | config.plugins = (config.plugins || []).concat([ 38 | // 增加DllReferencePlugin配置 39 | new webpack.DllReferencePlugin({ 40 | context:path.join(__dirname, '../dist/test/libs'), 41 | manifest: require("../dist/test/libs/libs-manifest.json") 42 | }), 43 | // 清除上一次生成的文件 44 | new CleanWebpackPlugin(['test/js'], { 45 | root: path.resolve(__dirname, '../dist'), 46 | verbose: true, 47 | dry: false, 48 | }), 49 | // 多线程压缩 50 | new ParallelUglifyPlugin({ 51 | // 支持es6打包 52 | uglifyES: { 53 | output: { 54 | comments: false 55 | }, 56 | compress: { 57 | warnings: false 58 | } 59 | } 60 | }), 61 | new webpack.optimize.OccurrenceOrderPlugin(), 62 | new webpack.optimize.ModuleConcatenationPlugin(), 63 | ]) 64 | 65 | 66 | module.exports = config 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/favicon.ico -------------------------------------------------------------------------------- /imgs/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/imgs/01.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-loader", 3 | "version": "0.0.1", 4 | "description": "demo", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "cross-env PROT=8001 node build/webpack.dev.config.js", 8 | "test": "webpack -d --progress --hide-modules --colors --config build/webpack.test.config.js", 9 | "test:dll": "cross-env DLL=test webpack --progress --config build/webpack.dll.config.js", 10 | "build": "webpack --progress --colors --config build/webpack.product.config.js", 11 | "build:dll": "cross-env DLL=build webpack --progress --config build/webpack.dll.config.js", 12 | "test-build": "npm run test && node ./build/http.push.tar.gz.js", 13 | "dist-build": "cross-env HTTP_PUSH=dist-build && npm run build", 14 | "online-build": "cross-env HTTP_PUSH=online-build npm run build" 15 | }, 16 | "author": "wanwei", 17 | "license": "MIT", 18 | "engines": { 19 | "node": ">=7.0", 20 | "npm": ">=3.0" 21 | }, 22 | "devDependencies": { 23 | "babel-core": "^6.26.0", 24 | "babel-loader": "^7.1.2", 25 | "babel-preset-env": "^1.6.1", 26 | "clean-webpack-plugin": "^0.1.13", 27 | "cross-env": "^3.2.4", 28 | "css-loader": "^0.28.7", 29 | "extract-text-webpack-plugin": "^3.0.1", 30 | "file-loader": "^0.9.0", 31 | "happypack": "^4.0.0", 32 | "html-webpack-plugin": "^2.22.0", 33 | "http-push-webpack-plugin": "^1.0.2", 34 | "imports-loader": "^0.7.1", 35 | "jquery": "^3.1.0", 36 | "log-util": "^1.1.2", 37 | "node-sass": "^4.5.3", 38 | "open-browser-webpack-plugin": "^0.0.5", 39 | "request": "^2.81.0", 40 | "sass-loader": "^6.0.6", 41 | "string-replace-loader": "^1.3.0", 42 | "style-loader": "^0.19.0", 43 | "tar.gz": "^1.0.5", 44 | "underscore": "^1.8.3", 45 | "url-loader": "^0.6.2", 46 | "vue": "^2.5.2", 47 | "vue-hot-reload-api": "^2.2.0", 48 | "vue-html-loader": "^1.2.4", 49 | "vue-loader": "^13.3.0", 50 | "vue-router": "^3.0.1", 51 | "vue-style-loader": "^3.0.3", 52 | "vue-template-compiler": "^2.5.2", 53 | "vuex": "^3.0.0", 54 | "vuex-router-sync": "^5.0.0", 55 | "webpack": "^3.8.1", 56 | "webpack-dev-server": "^2.9.2", 57 | "webpack-dll-loader": "0.0.1", 58 | "webpack-parallel-uglify-plugin": "^1.0.0", 59 | "zane-calendar": "^2.1.8" 60 | }, 61 | "dependencies": { 62 | "accounting": "^0.4.1", 63 | "moment": "^2.17.1" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/app.vue: -------------------------------------------------------------------------------- 1 | 46 | 47 | 61 | 62 | 87 | 88 | -------------------------------------------------------------------------------- /src/assets/common/css/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/css/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /src/assets/common/css/base.scss: -------------------------------------------------------------------------------- 1 | @import "./vars.scss"; 2 | 3 | /*CSS Reset*/ 4 | *, *:before, *:after { -webkit-box-sizing: border-box; box-sizing: border-box; } 5 | /*设置字体*/ 6 | @font-face{font-family: OpenSans;src: url('OpenSans-Regular.ttf'),} 7 | body{background: #FFFFFF;} 8 | /*字体结束*/ 9 | body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td, header, hgroup, nav, section, article, aside, footer, figure, figcaption, menu, button { 10 | margin: 0; padding: 0; font-family: 'OpenSans', sans-serif!important; 11 | }; 12 | body { font-family: Helvetica, STHeiTi, Sans-serif; line-height: 1.5; font-size: 14px; color: #333; -webkit-text-size-adjust: none; -webkit-tap-highlight-color: rgba(255, 255, 255, 0); outline: 0; } 13 | h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: normal; } 14 | table { border-collapse: collapse; border-spacing: 0; } 15 | fieldset, img { border: 0; } 16 | li { list-style: none; } 17 | input, textarea, select { font-family: inherit; font-size: inherit; font-weight: inherit; outline: none; -webkit-appearence: none; -ms-appearence: none; } 18 | button, html input[type="button"], input[type="reset"], input[type="submit"] { border: none; background: none; -webkit-appearance: none; outline: none; } 19 | a { -webkit-touch-callout: none; text-decoration: none; outline: 0; color:#6f8fb7;text-decoration:none;} 20 | em, i { font-style: normal; } 21 | iframe { display: none; } 22 | ::-webkit-input-placeholder { 23 | color: #999; 24 | } 25 | 26 | input.form-control,textarea.form-control,.btn,select.form-control{ 27 | border-radius: 0px; 28 | } 29 | input[type=checkbox]{ 30 | transform:scale(1.05,1.05);-webkit-transform:scale(1.05,1.05); 31 | background: #fff; 32 | } 33 | .btn, .btn:focus {outline: none !important;} 34 | table.table{ 35 | background: #fff; 36 | border:solid 1px $bordercolor!important; 37 | tr{ 38 | border:solid 1px $bordercolor!important; 39 | th{ 40 | font-size:13px; 41 | font-weight:bold; 42 | } 43 | td{ 44 | font-size:13px; 45 | border:solid 1px $bordercolor!important; 46 | } 47 | } 48 | }; 49 | .btn-primary{ 50 | background-color: #5974d9; 51 | border-color: #4f6bd7; 52 | } 53 | .btn-success{ 54 | background-color: #19c395; 55 | border-color: #18b88c; 56 | } 57 | .btn-info { 58 | background-color: #38b4ee; 59 | border-color: #2cb0ed; 60 | } 61 | .btn-warning{ 62 | background-color: #efcd2f; 63 | border-color: #edc819; 64 | } 65 | .btn-danger{ 66 | background-color: #fc3644; 67 | border-color: #fc2938; 68 | } 69 | 70 | // 增加相关样式 youwei 2016/8/13 10:58:17 71 | .input-inline{ 72 | display: inline-block; 73 | width: auto; 74 | vertical-align: middle; 75 | } 76 | 77 | //一些列的边距样式 78 | .m5{margin: 5px;} 79 | .m10{margin: 10px;} 80 | .m15{margin: 15px;} 81 | .m20{margin: 20px;} 82 | .mt5{margin-top: 5px;} 83 | .mt10{margin-top: 10px;} 84 | .mt15{margin-top: 15px;} 85 | .mt20{margin-top: 20px;} 86 | .ml5{margin-left: 5px;} 87 | .ml10{margin-left: 10px;} 88 | .ml15{margin-left: 15px;} 89 | .ml20{margin-left: 20px;} 90 | .ml30{margin-left: 30px;} 91 | .mr5{margin-right: 5px;} 92 | .mr10{margin-right: 10px;} 93 | .mr15{margin-right: 15px;} 94 | .mr20{margin-right: 20px;} 95 | .mb5{margin-bottom: 5px;} 96 | .mb10{margin-bottom: 10px;} 97 | .mb15{margin-bottom: 15px;} 98 | .mb20{margin-bottom: 20px;} 99 | .mb30{margin-bottom: 30px;} 100 | .pd5{padding:5px;} 101 | .pd15{padding:15px;} 102 | .no_pd_b{padding-bottom:0;} 103 | .pdl15{padding-left: 15px;} 104 | .pdr15{padding-right: 15px;} 105 | .pdtb15{padding:15px 0;} 106 | //-----一些列的边距样式结束----- 107 | 108 | //等待加载样式 109 | #loading{display:none;background: url(../images/loading_1.gif) rgba(12,12,12,.2) no-repeat center center;position: fixed;width: 100%;height: 100%;top:0;left:0;} 110 | //--------等待加载样式结束--------- 111 | 112 | //字体相关样式 113 | html,body {color: $htmlcolor !important;} 114 | .fontCorlor {color: $fontCorlor !important;} 115 | a:hover{text-decoration:none;} 116 | 117 | .fs-12{font-size:12px !important;} 118 | .fs-14{font-size:14px !important;} 119 | .fs-16{font-size:16px !important;} 120 | .fs-18{font-size:18px !important;} 121 | .fs-20{font-size:20px !important;} 122 | .fs-25{font-size:25px !important;} 123 | 124 | .clear{clear:both} 125 | .blod{font-weight:blod!important;} 126 | .normal{font-weight:normal!important;} 127 | .cursor{cursor: pointer;} 128 | 129 | .maincolor{color:$mainColor!important;} 130 | .red{color:$red!important;} 131 | .green{color:$green!important;} 132 | .acolor{color:$acolor!important;} 133 | .errorClass{background:#fdf4f4;border:solid 1px #fba7a7 !important;} 134 | 135 | .tl{text-align:left;} 136 | .tc{text-align:center;} 137 | .tr{text-align:right;} 138 | 139 | .fl{float:left;} 140 | .fr{float:right;} 141 | 142 | .inline-block{display:inline-block!important;} 143 | 144 | .w-50{width:50px!important;} 145 | .w-80{width:80px!important;} 146 | .w-100{width:100px!important;} 147 | .w-150{width:150px!important;} 148 | .w-200{width:200px!important;} 149 | .w-250{width:250px!important;} 150 | .w-300{width:300px!important;} 151 | .w-400{width:400px!important;} 152 | .w-500{width:500px!important;} 153 | 154 | //--------字体相关样式结束------ 155 | 156 | 157 | //----禁止选中样式结束----- 158 | 159 | //阿里icon样式 160 | @font-face { 161 | font-family: 'iconfont'; /* project id:"133474" */ 162 | src: url('//at.alicdn.com/t/font_6gg3y6tm884wvcxr.eot'); 163 | src: url('//at.alicdn.com/t/font_6gg3y6tm884wvcxr.eot?#iefix') format('embedded-opentype'), 164 | url('//at.alicdn.com/t/font_6gg3y6tm884wvcxr.woff') format('woff'), 165 | url('//at.alicdn.com/t/font_6gg3y6tm884wvcxr.ttf') format('truetype'), 166 | url('//at.alicdn.com/t/font_6gg3y6tm884wvcxr.svg#iconfont') format('svg'); 167 | } 168 | 169 | @mixin icon-font ($sizing) { 170 | font-family:"iconfont"; 171 | font-size:$sizing; 172 | font-style:normal; 173 | vertical-align: middle; 174 | } 175 | .iconfont{@include icon-font(16px)} 176 | //------阿里icon样式结束-------- 177 | 178 | @import 'common.scss'; 179 | 180 | 181 | -------------------------------------------------------------------------------- /src/assets/common/css/common.scss: -------------------------------------------------------------------------------- 1 | //数据为空时的提示样式 2 | .data_list_empty{display:inline-block;width:64px;height:64px;background:url('../images/empty.png') no-repeat center center;} 3 | //-----数据为空时的提示样式结束----- 4 | 5 | //禁止选中样式 6 | .user_select{ 7 | -moz-user-select: none; 8 | -o-user-select:none; 9 | -khtml-user-select:none; 10 | -webkit-user-select:none; 11 | -ms-user-select:none; 12 | user-select:none; 13 | } 14 | 15 | //公共块 16 | .common_block{ 17 | overflow:hidden; 18 | padding:0; 19 | border:solid 1px #ddd; 20 | box-shadow: 0 0 10px #ccc; 21 | background:#fff; 22 | .head{ 23 | height:40px;line-height:40px;padding:0 10px; 24 | font-size:14px; 25 | i{ 26 | font-size:22px; 27 | margin-right:6px; 28 | } 29 | } 30 | .head-default{ 31 | background:#f9f9f9; 32 | border-bottom: 1px solid #ddd; 33 | } 34 | .head-primary{ 35 | background:#5974d9; 36 | color:#fff; 37 | } 38 | .head-success{ 39 | background:#19c395; 40 | color:#fff; 41 | } 42 | .head-info{ 43 | background:#38b4ee; 44 | color:#fff; 45 | } 46 | .head-warning{ 47 | background:#f1d44b; 48 | color:#fff; 49 | } 50 | .head-danger{ 51 | background:#fc3644; 52 | color:#fff; 53 | } 54 | .contener{ 55 | padding:15px; 56 | } 57 | } 58 | 59 | .table_color{ 60 | .tr_default{ 61 | font-size:12px; 62 | background: #f4f4f4; 63 | border:solid 1px #f4f4f4; 64 | th{ 65 | border-bottom:none; 66 | } 67 | } 68 | .tr_primary{ 69 | font-size:12px; 70 | background: #5974d9; 71 | border:solid 1px #5974d9; 72 | color:#fff; 73 | th{ 74 | border-bottom:none; 75 | } 76 | th,td{ 77 | border:solid 1px #f2dede; 78 | } 79 | } 80 | .tr_danger{ 81 | font-size:12px; 82 | background: #fc3644; 83 | border:solid 1px #fc3644; 84 | color:#fff; 85 | th{ 86 | border-bottom:none; 87 | } 88 | th,td{ 89 | border:solid 1px #f2dede; 90 | } 91 | } 92 | .tr_warning{ 93 | font-size:12px; 94 | background: #f1d44b; 95 | border:solid 1px #f1d44b; 96 | color:#fff; 97 | th{ 98 | border-bottom:none; 99 | } 100 | th,td{ 101 | border:solid 1px #f2dede; 102 | } 103 | } 104 | .tr_success{ 105 | font-size:12px; 106 | background: #19c395; 107 | border:solid 1px #19c395; 108 | color:#fff; 109 | th{ 110 | border-bottom:none; 111 | } 112 | th,td{ 113 | border:solid 1px #dff0d8; 114 | } 115 | } 116 | .tr_info{ 117 | font-size:12px; 118 | background: #38b4ee; 119 | border:solid 1px #38b4ee; 120 | color:#fff; 121 | th{ 122 | border-bottom:none; 123 | } 124 | th,td{ 125 | border:solid 1px #d9edf7; 126 | } 127 | } 128 | } 129 | .table_even tr:nth-child(even){background:#f5f5f5;} 130 | .table_odd tr:nth-child(odd){background:#f5f5f5;} 131 | 132 | //统一弹出层样式 133 | .block_alert_cheng{ 134 | position:fixed; 135 | left:0; 136 | top:0; 137 | z-index:10000; 138 | width:100%; 139 | height:100%; 140 | display:none; 141 | .maskhide{ 142 | position:absolute; 143 | width:100%; 144 | height:100%; 145 | background: rgba(0,0,0,.5); 146 | z-index:-1; 147 | } 148 | .conmain{ 149 | min-width:650px; 150 | max-width: 90%!important; 151 | position:absolute; 152 | left: 50%; 153 | top: 50%; 154 | transform: translate(-50%,-50%); 155 | background:#fff; 156 | border:solid 1px #ccc; 157 | box-shadow:0 0 5px #888; 158 | .title{ 159 | height:40px; 160 | line-height:40px; 161 | border-bottom:solid 1px #ddd; 162 | padding:0 15px; 163 | position:relative; 164 | i{ 165 | position:absolute; 166 | right:15px; 167 | top:2px; 168 | cursor:pointer; 169 | } 170 | } 171 | .content{ 172 | padding:15px; 173 | } 174 | } 175 | } 176 | 177 | table .center{ 178 | text-align: center; 179 | vertical-align: middle!important; 180 | } 181 | 182 | //公共line 块 183 | .common_line{ 184 | overflow:hidden; 185 | .contener{ 186 | border:solid 1px #ddd; 187 | border-top:solid 2px #ccc; 188 | padding:15px; 189 | } 190 | .line-default{ 191 | border-top:solid 2px #ccc; 192 | } 193 | .line-primary{ 194 | border-top:solid 2px #337ab7; 195 | } 196 | .line-success{ 197 | border-top:solid 2px #449d44; 198 | } 199 | .line-info{ 200 | border-top:solid 2px #31b0d5; 201 | } 202 | .line-warning{ 203 | border-top:solid 2px #f0ad4e; 204 | } 205 | .line-danger{ 206 | border-top:solid 2px #c9302c; 207 | } 208 | } 209 | 210 | //搜索组件 211 | .search_commsearch { 212 | display: block; 213 | overflow: hidden; 214 | line-height: 34px; 215 | margin:10px 0; 216 | padding: 0 0 0 100px; 217 | position: relative; 218 | .search_left { 219 | font-size:12px; 220 | width: 100px; 221 | text-align: left; 222 | line-height: 34px; 223 | vertical-align: top; 224 | position: absolute; 225 | left: 0; 226 | top: 0; 227 | } 228 | .search_right { 229 | display: inline-block; 230 | max-width:80%; 231 | line-height: 34px; 232 | vertical-align: middle; 233 | .search_lab { 234 | font-weight: normal; 235 | margin:0; 236 | span { 237 | float: left; 238 | } 239 | select { 240 | width: auto; 241 | } 242 | } 243 | .input-prepend { 244 | width: 300px; 245 | } 246 | } 247 | } 248 | 249 | //面包屑 250 | .comm_content_top { 251 | border-bottom:1px solid $bordercolor; 252 | padding:10px 0 10px; 253 | .brank_nav { 254 | display:block; 255 | overflow:hidden; 256 | list-style:normal; 257 | padding:15px 0 0 0; 258 | li { 259 | color:$lightcolor; 260 | display: inline-block; 261 | &:not(:last-child):after{ 262 | content: '/'; 263 | padding:0 5px; 264 | } 265 | } 266 | } 267 | } 268 | 269 | //上传图片 270 | .upload_img{ 271 | font-size:45px; 272 | cursor:pointer; 273 | color:$activecolor; 274 | } 275 | 276 | .con_menu_top{ 277 | overflow:hidden; 278 | padding:0 15px; 279 | } 280 | .concat_no_r_bor{ 281 | border-radius:5px 0 0 5px; 282 | border-right:none; 283 | background: #f5f5f5; 284 | } 285 | .concat_no_l_bor{ 286 | border-radius:0 5px 5px 0; 287 | } 288 | 289 | .laydate_box, .laydate_box * { 290 | box-sizing:content-box !important; 291 | } -------------------------------------------------------------------------------- /src/assets/common/css/vars.scss: -------------------------------------------------------------------------------- 1 | 2 | // sass相关备注 3 | $htmlcolor:#333;//全局字体颜色 4 | $fontCorlor:#333;//字体全局颜色 5 | $lightcolor:#88898c;//文字淡色 6 | $activecolor:#c6cad0;//active背景颜色 7 | $acolor:#5974d9;//全局a颜色 8 | $ahovercolor:#e47054;// 全局a:hover颜色 9 | $bordercolor:#eceaea;//边框颜色值 10 | $red:#c9302c; //红色 11 | $green:#449d44; //绿色 12 | $mainColor:#337ab7;//buton主要色调 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/assets/common/images/404/404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/404/404.png -------------------------------------------------------------------------------- /src/assets/common/images/404/404_msg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/404/404_msg.png -------------------------------------------------------------------------------- /src/assets/common/images/404/404_to_index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/404/404_to_index.png -------------------------------------------------------------------------------- /src/assets/common/images/404/error_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/404/error_bg.jpg -------------------------------------------------------------------------------- /src/assets/common/images/404/error_cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/404/error_cloud.png -------------------------------------------------------------------------------- /src/assets/common/images/404/screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/404/screenshot.jpg -------------------------------------------------------------------------------- /src/assets/common/images/PopLayer-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/PopLayer-close.png -------------------------------------------------------------------------------- /src/assets/common/images/backtop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/backtop.png -------------------------------------------------------------------------------- /src/assets/common/images/call_kefu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/call_kefu.png -------------------------------------------------------------------------------- /src/assets/common/images/default_big_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/default_big_img.png -------------------------------------------------------------------------------- /src/assets/common/images/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/empty.png -------------------------------------------------------------------------------- /src/assets/common/images/gods-default-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/gods-default-icon.png -------------------------------------------------------------------------------- /src/assets/common/images/icon-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/icon-1.png -------------------------------------------------------------------------------- /src/assets/common/images/icon-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/icon-2.png -------------------------------------------------------------------------------- /src/assets/common/images/icon-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/icon-3.png -------------------------------------------------------------------------------- /src/assets/common/images/icon-left-jt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/icon-left-jt.png -------------------------------------------------------------------------------- /src/assets/common/images/icon-right-jt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/icon-right-jt.png -------------------------------------------------------------------------------- /src/assets/common/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/loading.gif -------------------------------------------------------------------------------- /src/assets/common/images/loading_1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/loading_1.gif -------------------------------------------------------------------------------- /src/assets/common/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/logo.png -------------------------------------------------------------------------------- /src/assets/common/images/qq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/qq.png -------------------------------------------------------------------------------- /src/assets/common/images/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweianger/vue2.5-webpack3.8-spa-base-cms/9785f386e526ad93c0ca17c856dee24bbecbe05b/src/assets/common/images/upload.png -------------------------------------------------------------------------------- /src/assets/common/js/common.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | //common 公共 AJAX 函数 4 | class common{ 5 | //初始化对象 6 | constructor(){ 7 | 8 | }; 9 | 10 | // get ajax 11 | commonAjax(){ 12 | util.ajax({ 13 | url:config.baseApi+'', 14 | success:(data=>{ 15 | console.log(data) 16 | }) 17 | }) 18 | }; 19 | } 20 | 21 | //初始化common对象 22 | module.exports=new common(); 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/assets/common/js/config.js: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------后台配置------------------------------------------------*/ 2 | module.exports={ 3 | //登陆页面 4 | loginUrl:"/login.html", 5 | 6 | //登陆成功后需要跳转到的页面 7 | homeUrl: "/index.html", 8 | 9 | //根接口 10 | baseApi:'/api/', 11 | 12 | //ajax 请求超时时间 13 | ajaxtimeout:12000, 14 | 15 | //发送验证码时间间隔 16 | msgTime:60, 17 | 18 | //隐藏显示时间 19 | containerShowTime:10, 20 | 21 | //pagesize 分页数量 22 | pageSize:20, 23 | 24 | wangwei:'123456' 25 | 26 | }; 27 | -------------------------------------------------------------------------------- /src/assets/common/js/echo.min.js: -------------------------------------------------------------------------------- 1 | window.Echo=(function(window,document,undefined){'use strict';var store=[],offset,throttle,poll;var _inView=function(el){var coords=el.getBoundingClientRect();return((coords.top>=0&&coords.left>=0&&coords.top)<=(window.innerHeight||document.documentElement.clientHeight)+parseInt(offset));};var _pollImages=function(){for(var i=store.length;i--;){var self=store[i];if(_inView(self)){self.src=self.getAttribute('data-echo');store.splice(i,1);}}};var _throttle=function(){clearTimeout(poll);poll=setTimeout(_pollImages,throttle);};var init=function(obj){var nodes=document.querySelectorAll('[data-echo]');var opts=obj||{};offset=opts.offset||0;throttle=opts.throttle||250;for(var i=0;i12?this.getHours()-12:this.getHours(), 9 | "m+": this.getMinutes(), //分 10 | "s+": this.getSeconds(), //秒 11 | "q+": Math.floor((this.getMonth() + 3) / 3), //季度 12 | "S": this.getMilliseconds() //毫秒 13 | }; 14 | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); 15 | for (var k in o) 16 | if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); 17 | return fmt; 18 | } 19 | }; -------------------------------------------------------------------------------- /src/assets/common/js/jquery.cookie.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Cookie Plugin v1.4.1 3 | * https://github.com/carhartl/jquery-cookie 4 | * 5 | * Copyright 2006, 2014 Klaus Hartl 6 | * Released under the MIT license 7 | */ 8 | (function (factory) { 9 | if (typeof define === 'function' && define.amd) { 10 | // AMD (Register as an anonymous module) 11 | define(['jquery'], factory); 12 | } else if (typeof exports === 'object') { 13 | // Node/CommonJS 14 | module.exports = factory(require('jquery')); 15 | } else { 16 | // Browser globals 17 | factory(jQuery); 18 | } 19 | }(function ($) { 20 | 21 | var pluses = /\+/g; 22 | 23 | function encode(s) { 24 | return config.raw ? s : s; //encodeURIComponent(s); 25 | } 26 | 27 | function decode(s) { 28 | return config.raw ? s : decodeURIComponent(s); 29 | } 30 | 31 | function stringifyCookieValue(value) { 32 | return encode(config.json ? JSON.stringify(value) : String(value)); 33 | } 34 | 35 | function parseCookieValue(s) { 36 | if (s.indexOf('"') === 0) { 37 | // This is a quoted cookie as according to RFC2068, unescape... 38 | s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 39 | } 40 | 41 | try { 42 | // Replace server-side written pluses with spaces. 43 | // If we can't decode the cookie, ignore it, it's unusable. 44 | // If we can't parse the cookie, ignore it, it's unusable. 45 | s = decodeURIComponent(s.replace(pluses, ' ')); 46 | return config.json ? JSON.parse(s) : s; 47 | } catch(e) {} 48 | } 49 | 50 | function read(s, converter) { 51 | var value = config.raw ? s : parseCookieValue(s); 52 | return $.isFunction(converter) ? converter(value) : value; 53 | } 54 | 55 | var config = $.cookie = function (key, value, options) { 56 | 57 | // Write 58 | 59 | if (arguments.length > 1 && !$.isFunction(value)) { 60 | options = $.extend({}, config.defaults, options); 61 | 62 | if (typeof options.expires === 'number') { 63 | var days = options.expires, t = options.expires = new Date(); 64 | t.setMilliseconds(t.getMilliseconds() + days * 864e+5); 65 | } 66 | 67 | return (document.cookie = [ 68 | encode(key), '=', stringifyCookieValue(value), 69 | options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 70 | options.path ? '; path=' + options.path : '', 71 | options.domain ? '; domain=' + options.domain : '', 72 | options.secure ? '; secure' : '' 73 | ].join('')); 74 | } 75 | 76 | // Read 77 | 78 | var result = key ? undefined : {}, 79 | // To prevent the for loop in the first place assign an empty array 80 | // in case there are no cookies at all. Also prevents odd result when 81 | // calling $.cookie(). 82 | cookies = document.cookie ? document.cookie.split('; ') : [], 83 | i = 0, 84 | l = cookies.length; 85 | 86 | for (; i < l; i++) { 87 | var parts = cookies[i].split('='), 88 | name = decode(parts.shift()), 89 | cookie = parts.join('='); 90 | 91 | if (key === name) { 92 | // If second argument (value) is a function it's a converter... 93 | result = read(cookie, value); 94 | break; 95 | } 96 | 97 | // Prevent storing a cookie that we couldn't decode. 98 | if (!key && (cookie = read(cookie)) !== undefined) { 99 | result[name] = cookie; 100 | } 101 | } 102 | 103 | return result; 104 | }; 105 | 106 | config.defaults = {}; 107 | 108 | $.removeCookie = function (key, options) { 109 | // Must not alter options, thus extending a fresh object... 110 | $.cookie(key, '', $.extend({}, options, { expires: -1 })); 111 | return !$.cookie(key); 112 | }; 113 | 114 | })); 115 | -------------------------------------------------------------------------------- /src/assets/common/js/jquery.qrcode.min.js: -------------------------------------------------------------------------------- 1 | (function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;da||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]= 5 | 0<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c= 7 | j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount- 8 | b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0g;g++)if(null==this.modules[b][i-g]){var n=!1;f>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a, 9 | c),b=new t,e=0;e8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d= 10 | 0,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+ 14 | a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;dc)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+ 15 | a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256), 17 | LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d 18 | this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b>>7-a%8&1)},put:function(a,c){for(var d=0;d>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1, 26 | correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e").css("height",b+"px").appendTo(c);for(i=0;i").css("width", 28 | d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;jQuery(a).appendTo(this)})}})(jQuery); 29 | -------------------------------------------------------------------------------- /src/assets/common/js/jquery.scrollTo.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2015 Ariel Flesler - aflesler ○ gmail • com | http://flesler.blogspot.com 3 | * Licensed under MIT 4 | * @author Ariel Flesler 5 | * @version 2.1.3 6 | */ 7 | ;(function(f){"use strict";"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function($){"use strict";function n(a){return!a.nodeName||-1!==$.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])}function h(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}var p=$.scrollTo=function(a,d,b){return $(window).scrollTo(a,d,b)};p.defaults={axis:"xy",duration:0,limit:!0};$.fn.scrollTo=function(a,d,b){"object"=== typeof d&&(b=d,d=0);"function"===typeof b&&(b={onAfter:b});"max"===a&&(a=9E9);b=$.extend({},p.defaults,b);d=d||b.duration;var u=b.queue&&1=f[g]?0:Math.min(f[g],n));!a&&1=This.hobbyLenght?getHobbyVal(obj.attr("name")):""; 79 | } 80 | //recheck 条件的检查 用于确定密码跟原密码是否相同的检查 81 | if(obj.attr("recheck")){ 82 | if(value !=($("[name="+obj.attr("recheck")+"]").val())){ 83 | if(nodeName=="input" || nodeName=="select"){ 84 | obj.parent().find("span").remove(); 85 | if(obj.attr("errormsg")){ 86 | obj.parent().append(""+obj.attr("errormsg")+""); 87 | }; 88 | } 89 | obj.addClass("errorClass"); 90 | This.now=false; 91 | return false; 92 | } 93 | } 94 | //验证通过在页面上显示的样式 95 | if(reg.test(value)){ 96 | if(nodeName=="input" || nodeName=="select"){ 97 | obj.parent().find("span").remove(); 98 | if(obj.attr("sucmsg")){ 99 | obj.parent().append(""+obj.attr("sucmsg")+""); 100 | }; 101 | } 102 | obj.removeClass("errorClass"); 103 | This.now=true; 104 | }else { //验证通过在页面上显示的样式 并返回false值以供判断 105 | if(nodeName=="input" || nodeName=="select"){ 106 | obj.parent().find("span").remove(); 107 | if(obj.attr("errormsg")){ 108 | obj.parent().append(""+obj.attr("errormsg")+""); 109 | }; 110 | } 111 | obj.addClass("errorClass"); 112 | This.now=false; 113 | return "false"; 114 | } 115 | } 116 | } 117 | 118 | //radio框内容选择 119 | function getBoxVal(name){ 120 | var groupId=document.getElementsByName(name); 121 | for(var i=0;i>>2]|=(a[h>>>2]>>>24-8*(h%4)&255)<<24-8*((l+h)%4);else if(65535>>2]=a[h>>>2];else j.push.apply(j,a);this.sigBytes+=b;return this},clamp:function(){var b=this.words,j=this.sigBytes;b[j>>>2]&=4294967295<< 9 | 32-8*(j%4);b.length=q.ceil(j/4)},clone:function(){var b=t.clone.call(this);b.words=this.words.slice(0);return b},random:function(b){for(var j=[],a=0;a>>2]>>>24-8*(l%4)&255;h.push((m>>>4).toString(16));h.push((m&15).toString(16))}return h.join("")},parse:function(b){for(var a=b.length,h=[],l=0;l>>3]|=parseInt(b.substr(l, 10 | 2),16)<<24-4*(l%8);return new n.init(h,a/2)}},a=v.Latin1={stringify:function(b){var a=b.words;b=b.sigBytes;for(var h=[],l=0;l>>2]>>>24-8*(l%4)&255));return h.join("")},parse:function(b){for(var a=b.length,h=[],l=0;l>>2]|=(b.charCodeAt(l)&255)<<24-8*(l%4);return new n.init(h,a)}},s=v.Utf8={stringify:function(b){try{return decodeURIComponent(escape(a.stringify(b)))}catch(h){throw Error("Malformed UTF-8 data");}},parse:function(b){return a.parse(unescape(encodeURIComponent(b)))}}, 11 | h=g.BufferedBlockAlgorithm=t.extend({reset:function(){this._data=new n.init;this._nDataBytes=0},_append:function(b){"string"==typeof b&&(b=s.parse(b));this._data.concat(b);this._nDataBytes+=b.sigBytes},_process:function(b){var a=this._data,h=a.words,l=a.sigBytes,m=this.blockSize,k=l/(4*m),k=b?q.ceil(k):q.max((k|0)-this._minBufferSize,0);b=k*m;l=q.min(4*b,l);if(b){for(var g=0;g>>32-l)+m}function k(a,m,b,j,g,l,k){a=a+(m&j|b&~j)+g+k;return(a<>>32-l)+m}function g(a,m,b,j,g,l,k){a=a+(m^b^j)+g+k;return(a<>>32-l)+m}function p(a,g,b,j,k,l,p){a=a+(b^(g|~j))+k+p;return(a<>>32-l)+g}for(var t=CryptoJS,n=t.lib,v=n.WordArray,u=n.Hasher,n=t.algo,a=[],s=0;64>s;s++)a[s]=4294967296*q.abs(q.sin(s+1))|0;n=n.MD5=u.extend({_doReset:function(){this._hash=new v.init([1732584193,4023233417,2562383102,271733878])}, 15 | _doProcessBlock:function(h,m){for(var b=0;16>b;b++){var j=m+b,n=h[j];h[j]=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360}var b=this._hash.words,j=h[m+0],n=h[m+1],l=h[m+2],q=h[m+3],t=h[m+4],s=h[m+5],u=h[m+6],v=h[m+7],w=h[m+8],x=h[m+9],y=h[m+10],z=h[m+11],A=h[m+12],B=h[m+13],C=h[m+14],D=h[m+15],c=b[0],d=b[1],e=b[2],f=b[3],c=r(c,d,e,f,j,7,a[0]),f=r(f,c,d,e,n,12,a[1]),e=r(e,f,c,d,l,17,a[2]),d=r(d,e,f,c,q,22,a[3]),c=r(c,d,e,f,t,7,a[4]),f=r(f,c,d,e,s,12,a[5]),e=r(e,f,c,d,u,17,a[6]),d=r(d,e,f,c,v,22,a[7]), 16 | c=r(c,d,e,f,w,7,a[8]),f=r(f,c,d,e,x,12,a[9]),e=r(e,f,c,d,y,17,a[10]),d=r(d,e,f,c,z,22,a[11]),c=r(c,d,e,f,A,7,a[12]),f=r(f,c,d,e,B,12,a[13]),e=r(e,f,c,d,C,17,a[14]),d=r(d,e,f,c,D,22,a[15]),c=k(c,d,e,f,n,5,a[16]),f=k(f,c,d,e,u,9,a[17]),e=k(e,f,c,d,z,14,a[18]),d=k(d,e,f,c,j,20,a[19]),c=k(c,d,e,f,s,5,a[20]),f=k(f,c,d,e,y,9,a[21]),e=k(e,f,c,d,D,14,a[22]),d=k(d,e,f,c,t,20,a[23]),c=k(c,d,e,f,x,5,a[24]),f=k(f,c,d,e,C,9,a[25]),e=k(e,f,c,d,q,14,a[26]),d=k(d,e,f,c,w,20,a[27]),c=k(c,d,e,f,B,5,a[28]),f=k(f,c, 17 | d,e,l,9,a[29]),e=k(e,f,c,d,v,14,a[30]),d=k(d,e,f,c,A,20,a[31]),c=g(c,d,e,f,s,4,a[32]),f=g(f,c,d,e,w,11,a[33]),e=g(e,f,c,d,z,16,a[34]),d=g(d,e,f,c,C,23,a[35]),c=g(c,d,e,f,n,4,a[36]),f=g(f,c,d,e,t,11,a[37]),e=g(e,f,c,d,v,16,a[38]),d=g(d,e,f,c,y,23,a[39]),c=g(c,d,e,f,B,4,a[40]),f=g(f,c,d,e,j,11,a[41]),e=g(e,f,c,d,q,16,a[42]),d=g(d,e,f,c,u,23,a[43]),c=g(c,d,e,f,x,4,a[44]),f=g(f,c,d,e,A,11,a[45]),e=g(e,f,c,d,D,16,a[46]),d=g(d,e,f,c,l,23,a[47]),c=p(c,d,e,f,j,6,a[48]),f=p(f,c,d,e,v,10,a[49]),e=p(e,f,c,d, 18 | C,15,a[50]),d=p(d,e,f,c,s,21,a[51]),c=p(c,d,e,f,A,6,a[52]),f=p(f,c,d,e,q,10,a[53]),e=p(e,f,c,d,y,15,a[54]),d=p(d,e,f,c,n,21,a[55]),c=p(c,d,e,f,w,6,a[56]),f=p(f,c,d,e,D,10,a[57]),e=p(e,f,c,d,u,15,a[58]),d=p(d,e,f,c,B,21,a[59]),c=p(c,d,e,f,t,6,a[60]),f=p(f,c,d,e,z,10,a[61]),e=p(e,f,c,d,l,15,a[62]),d=p(d,e,f,c,x,21,a[63]);b[0]=b[0]+c|0;b[1]=b[1]+d|0;b[2]=b[2]+e|0;b[3]=b[3]+f|0},_doFinalize:function(){var a=this._data,g=a.words,b=8*this._nDataBytes,j=8*a.sigBytes;g[j>>>5]|=128<<24-j%32;var k=q.floor(b/ 19 | 4294967296);g[(j+64>>>9<<4)+15]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360;g[(j+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;a.sigBytes=4*(g.length+1);this._process();a=this._hash;g=a.words;for(b=0;4>b;b++)j=g[b],g[b]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360;return a},clone:function(){var a=u.clone.call(this);a._hash=this._hash.clone();return a}});t.MD5=u._createHelper(n);t.HmacMD5=u._createHmacHelper(n)})(Math); 20 | (function(){var q=CryptoJS,r=q.enc.Utf8;q.algo.HMAC=q.lib.Base.extend({init:function(k,g){k=this._hasher=new k.init;"string"==typeof g&&(g=r.parse(g));var p=k.blockSize,q=4*p;g.sigBytes>q&&(g=k.finalize(g));g.clamp();for(var n=this._oKey=g.clone(),v=this._iKey=g.clone(),u=n.words,a=v.words,s=0;s>>2]|=(f[g>>>2]>>>24-8*(g%4)&255)<<24-8*((b+g)%4);else if(65535>>2]=f[g>>>2];else d.push.apply(d,f);this.sigBytes+=a;return this},clamp:function(){var a=this.words,d=this.sigBytes;a[d>>>2]&=4294967295<< 9 | 32-8*(d%4);a.length=j.ceil(d/4)},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var d=[],f=0;f>>2]>>>24-8*(b%4)&255;f.push((g>>>4).toString(16));f.push((g&15).toString(16))}return f.join("")},parse:function(a){for(var d=a.length,f=[],b=0;b>>3]|=parseInt(a.substr(b, 10 | 2),16)<<24-4*(b%8);return new r.init(f,d/2)}},n=s.Latin1={stringify:function(a){var d=a.words;a=a.sigBytes;for(var f=[],b=0;b>>2]>>>24-8*(b%4)&255));return f.join("")},parse:function(a){for(var d=a.length,f=[],b=0;b>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new r.init(f,d)}},h=s.Utf8={stringify:function(a){try{return decodeURIComponent(escape(n.stringify(a)))}catch(d){throw Error("Malformed UTF-8 data");}},parse:function(a){return n.parse(unescape(encodeURIComponent(a)))}}, 11 | u=e.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=h.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var d=this._data,f=d.words,b=d.sigBytes,g=this.blockSize,c=b/(4*g),c=a?j.ceil(c):j.max((c|0)-this._minBufferSize,0);a=c*g;b=j.min(4*a,b);if(a){for(var e=0;en;){var h;a:{h=l;for(var u=j.sqrt(h),t=2;t<=u;t++)if(!(h%t)){h=!1;break a}h=!0}h&&(8>n&&(m[n]=s(j.pow(l,0.5))),r[n]=s(j.pow(l,1/3)),n++);l++}var a=[],c=c.SHA256=p.extend({_doReset:function(){this._hash=new e.init(m.slice(0))},_doProcessBlock:function(d,f){for(var b=this._hash.words,g=b[0],c=b[1],e=b[2],j=b[3],h=b[4],p=b[5],m=b[6],n=b[7],q=0;64>q;q++){if(16>q)a[q]= 15 | d[f+q]|0;else{var k=a[q-15],l=a[q-2];a[q]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+a[q-7]+((l<<15|l>>>17)^(l<<13|l>>>19)^l>>>10)+a[q-16]}k=n+((h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25))+(h&p^~h&m)+r[q]+a[q];l=((g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22))+(g&c^g&e^c&e);n=m;m=p;p=h;h=j+k|0;j=e;e=c;c=g;g=k+l|0}b[0]=b[0]+g|0;b[1]=b[1]+c|0;b[2]=b[2]+e|0;b[3]=b[3]+j|0;b[4]=b[4]+h|0;b[5]=b[5]+p|0;b[6]=b[6]+m|0;b[7]=b[7]+n|0},_doFinalize:function(){var a=this._data,c=a.words,b=8*this._nDataBytes,e=8*a.sigBytes; 16 | c[e>>>5]|=128<<24-e%32;c[(e+64>>>9<<4)+14]=j.floor(b/4294967296);c[(e+64>>>9<<4)+15]=b;a.sigBytes=4*c.length;this._process();return this._hash},clone:function(){var a=p.clone.call(this);a._hash=this._hash.clone();return a}});k.SHA256=p._createHelper(c);k.HmacSHA256=p._createHmacHelper(c)})(Math); 17 | (function(){var j=CryptoJS,k=j.lib.WordArray,c=j.algo,e=c.SHA256,c=c.SHA224=e.extend({_doReset:function(){this._hash=new k.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=e._doFinalize.call(this);c.sigBytes-=4;return c}});j.SHA224=e._createHelper(c);j.HmacSHA224=e._createHmacHelper(c)})(); 18 | (function(){var j=CryptoJS,k=j.enc.Utf8;j.algo.HMAC=j.lib.Base.extend({init:function(c,e){c=this._hasher=new c.init;"string"==typeof e&&(e=k.parse(e));var j=c.blockSize,m=4*j;e.sigBytes>m&&(e=c.finalize(e));e.clamp();for(var r=this._oKey=e.clone(),s=this._iKey=e.clone(),l=r.words,n=s.words,h=0;h>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< 9 | 32-8*(c%4);a.length=h.ceil(c/4)},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b>>3]|=parseInt(a.substr(b, 10 | 2),16)<<24-4*(b%8);return new r.init(d,c/2)}},n=l.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b>>2]>>>24-8*(b%4)&255));return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new r.init(d,c)}},j=l.Utf8={stringify:function(a){try{return decodeURIComponent(escape(n.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return n.parse(unescape(encodeURIComponent(a)))}}, 11 | u=g.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;b=h.min(4*a,b);if(a){for(var g=0;gn;){var j;a:{j=k;for(var u=h.sqrt(j),t=2;t<=u;t++)if(!(j%t)){j=!1;break a}j=!0}j&&(8>n&&(m[n]=l(h.pow(k,0.5))),r[n]=l(h.pow(k,1/3)),n++);k++}var a=[],f=f.SHA256=q.extend({_doReset:function(){this._hash=new g.init(m.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],g=b[2],j=b[3],h=b[4],m=b[5],n=b[6],q=b[7],p=0;64>p;p++){if(16>p)a[p]= 15 | c[d+p]|0;else{var k=a[p-15],l=a[p-2];a[p]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+a[p-7]+((l<<15|l>>>17)^(l<<13|l>>>19)^l>>>10)+a[p-16]}k=q+((h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25))+(h&m^~h&n)+r[p]+a[p];l=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&g^f&g);q=n;n=m;m=h;h=j+k|0;j=g;g=f;f=e;e=k+l|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+g|0;b[3]=b[3]+j|0;b[4]=b[4]+h|0;b[5]=b[5]+m|0;b[6]=b[6]+n|0;b[7]=b[7]+q|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes; 16 | d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=h.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=q.clone.call(this);a._hash=this._hash.clone();return a}});s.SHA256=q._createHelper(f);s.HmacSHA256=q._createHmacHelper(f)})(Math); 17 | (function(){var h=CryptoJS,s=h.enc.Utf8;h.algo.HMAC=h.lib.Base.extend({init:function(f,g){f=this._hasher=new f.init;"string"==typeof g&&(g=s.parse(g));var h=f.blockSize,m=4*h;g.sigBytes>m&&(g=f.finalize(g));g.clamp();for(var r=this._oKey=g.clone(),l=this._iKey=g.clone(),k=r.words,n=l.words,j=0;j>>2]|=(e[p>>>2]>>>24-8*(p%4)&255)<<24-8*((j+p)%4);else if(65535>>2]=e[p>>>2];else b.push.apply(b,e);this.sigBytes+=a;return this},clamp:function(){var a=this.words,b=this.sigBytes;a[b>>>2]&=4294967295<< 9 | 32-8*(b%4);a.length=q.ceil(b/4)},clone:function(){var a=s.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],e=0;e>>2]>>>24-8*(j%4)&255;e.push((p>>>4).toString(16));e.push((p&15).toString(16))}return e.join("")},parse:function(a){for(var b=a.length,e=[],j=0;j>>3]|=parseInt(a.substr(j, 10 | 2),16)<<24-4*(j%8);return new t.init(e,b/2)}},g=w.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var e=[],j=0;j>>2]>>>24-8*(j%4)&255));return e.join("")},parse:function(a){for(var b=a.length,e=[],j=0;j>>2]|=(a.charCodeAt(j)&255)<<24-8*(j%4);return new t.init(e,b)}},n=w.Utf8={stringify:function(a){try{return decodeURIComponent(escape(g.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return g.parse(unescape(encodeURIComponent(a)))}}, 11 | u=d.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new t.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=n.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,e=b.words,j=b.sigBytes,p=this.blockSize,c=j/(4*p),c=a?q.ceil(c):q.max((c|0)-this._minBufferSize,0);a=c*p;j=q.min(4*a,j);if(a){for(var g=0;gu;u++){t[g+5*n]=(u+1)*(u+2)/2%64;var x=(2*g+3*n)%5,g=n%5,n=x}for(g=0;5>g;g++)for(n=0;5>n;n++)w[g+5*n]=n+5*((2*g+3*n)%5);g=1;for(n=0;24>n;n++){for(var a=x=u=0;7>a;a++){if(g&1){var b=(1<b?x^=1<g;g++)e[g]=s.create();c=c.SHA3=v.extend({cfg:v.cfg.extend({outputLength:512}),_doReset:function(){for(var a=this._state= 16 | [],b=0;25>b;b++)a[b]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(a,b){for(var c=this._state,g=this.blockSize/2,k=0;k>>24)&16711935|(d<<24|d>>>8)&4278255360,l=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360,h=c[k];h.high^=l;h.low^=d}for(g=0;24>g;g++){for(k=0;5>k;k++){for(var f=d=0,m=0;5>m;m++)h=c[k+5*m],d^=h.high,f^=h.low;h=e[k];h.high=d;h.low=f}for(k=0;5>k;k++){h=e[(k+4)%5];d=e[(k+1)%5];l=d.high;m=d.low;d=h.high^ 17 | (l<<1|m>>>31);f=h.low^(m<<1|l>>>31);for(m=0;5>m;m++)h=c[k+5*m],h.high^=d,h.low^=f}for(l=1;25>l;l++)h=c[l],k=h.high,h=h.low,m=t[l],32>m?(d=k<>>32-m,f=h<>>32-m):(d=h<>>64-m,f=k<>>64-m),h=e[w[l]],h.high=d,h.low=f;h=e[0];k=c[0];h.high=k.high;h.low=k.low;for(k=0;5>k;k++)for(m=0;5>m;m++)l=k+5*m,h=c[l],d=e[l],l=e[(k+1)%5+5*m],f=e[(k+2)%5+5*m],h.high=d.high^~l.high&f.high,h.low=d.low^~l.low&f.low;h=c[0];k=r[g];h.high^=k.high;h.low^=k.low}},_doFinalize:function(){var a=this._data, 18 | b=a.words,c=8*a.sigBytes,e=32*this.blockSize;b[c>>>5]|=1<<24-c%32;b[(q.ceil((c+1)/e)*e>>>5)-1]|=128;a.sigBytes=4*b.length;this._process();for(var a=this._state,b=this.cfg.outputLength/8,c=b/8,e=[],g=0;g>>24)&16711935|(l<<24|l>>>8)&4278255360,f=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360;e.push(f);e.push(l)}return new d.init(e,b)},clone:function(){for(var a=v.clone.call(this),b=a._state=this._state.slice(0),c=0;25>c;c++)b[c]=b[c].clone();return a}}); 19 | f.SHA3=v._createHelper(c);f.HmacSHA3=v._createHmacHelper(c)})(Math); 20 | (function(){var q=CryptoJS,f=q.enc.Utf8;q.algo.HMAC=q.lib.Base.extend({init:function(c,d){c=this._hasher=new c.init;"string"==typeof d&&(d=f.parse(d));var q=c.blockSize,s=4*q;d.sigBytes>s&&(d=c.finalize(d));d.clamp();for(var t=this._oKey=d.clone(),w=this._iKey=d.clone(),r=t.words,g=w.words,n=0;n>>2]|=(c[b>>>2]>>>24-8*(b%4)&255)<<24-8*((e+b)%4);else if(65535>>2]=c[b>>>2];else g.push.apply(g,c);this.sigBytes+=a;return this},clamp:function(){var C=this.words,g=this.sigBytes;C[g>>>2]&=4294967295<< 9 | 32-8*(g%4);C.length=a.ceil(g/4)},clone:function(){var a=l.clone.call(this);a.words=this.words.slice(0);return a},random:function(C){for(var g=[],b=0;b>>2]>>>24-8*(e%4)&255;b.push((c>>>4).toString(16));b.push((c&15).toString(16))}return b.join("")},parse:function(a){for(var b=a.length,c=[],e=0;e>>3]|=parseInt(a.substr(e, 10 | 2),16)<<24-4*(e%8);return new u.init(c,b/2)}},x=k.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],e=0;e>>2]>>>24-8*(e%4)&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],e=0;e>>2]|=(a.charCodeAt(e)&255)<<24-8*(e%4);return new u.init(c,b)}},y=k.Utf8={stringify:function(a){try{return decodeURIComponent(escape(x.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return x.parse(unescape(encodeURIComponent(a)))}}, 11 | $=b.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new u.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=y.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,l=c.words,e=c.sigBytes,d=this.blockSize,f=e/(4*d),f=b?a.ceil(f):a.max((f|0)-this._minBufferSize,0);b=f*d;e=a.min(4*b,e);if(b){for(var k=0;km;m++)k[m]=a();b=b.SHA512=c.extend({_doReset:function(){this._hash=new l.init([new f.init(1779033703,4089235720),new f.init(3144134277,2227873595),new f.init(1013904242,4271175723),new f.init(2773480762,1595750129),new f.init(1359893119,2917565137),new f.init(2600822924,725511199),new f.init(528734635,4215389547),new f.init(1541459225,327033209)])},_doProcessBlock:function(a,b){for(var c=this._hash.words, 20 | d=c[0],f=c[1],g=c[2],l=c[3],e=c[4],m=c[5],L=c[6],c=c[7],Z=d.high,M=d.low,aa=f.high,N=f.low,ba=g.high,O=g.low,ca=l.high,P=l.low,da=e.high,Q=e.low,ea=m.high,R=m.low,fa=L.high,S=L.low,ga=c.high,T=c.low,r=Z,n=M,F=aa,D=N,G=ba,E=O,W=ca,H=P,s=da,p=Q,U=ea,I=R,V=fa,J=S,X=ga,K=T,t=0;80>t;t++){var z=k[t];if(16>t)var q=z.high=a[b+2*t]|0,h=z.low=a[b+2*t+1]|0;else{var q=k[t-15],h=q.high,v=q.low,q=(h>>>1|v<<31)^(h>>>8|v<<24)^h>>>7,v=(v>>>1|h<<31)^(v>>>8|h<<24)^(v>>>7|h<<25),B=k[t-2],h=B.high,j=B.low,B=(h>>>19|j<< 21 | 13)^(h<<3|j>>>29)^h>>>6,j=(j>>>19|h<<13)^(j<<3|h>>>29)^(j>>>6|h<<26),h=k[t-7],Y=h.high,A=k[t-16],w=A.high,A=A.low,h=v+h.low,q=q+Y+(h>>>0>>0?1:0),h=h+j,q=q+B+(h>>>0>>0?1:0),h=h+A,q=q+w+(h>>>0>>0?1:0);z.high=q;z.low=h}var Y=s&U^~s&V,A=p&I^~p&J,z=r&F^r&G^F&G,ja=n&D^n&E^D&E,v=(r>>>28|n<<4)^(r<<30|n>>>2)^(r<<25|n>>>7),B=(n>>>28|r<<4)^(n<<30|r>>>2)^(n<<25|r>>>7),j=u[t],ka=j.high,ha=j.low,j=K+((p>>>14|s<<18)^(p>>>18|s<<14)^(p<<23|s>>>9)),w=X+((s>>>14|p<<18)^(s>>>18|p<<14)^(s<<23|p>>>9))+(j>>>0< 22 | K>>>0?1:0),j=j+A,w=w+Y+(j>>>0>>0?1:0),j=j+ha,w=w+ka+(j>>>0>>0?1:0),j=j+h,w=w+q+(j>>>0>>0?1:0),h=B+ja,z=v+z+(h>>>0>>0?1:0),X=V,K=J,V=U,J=I,U=s,I=p,p=H+j|0,s=W+w+(p>>>0>>0?1:0)|0,W=G,H=E,G=F,E=D,F=r,D=n,n=j+h|0,r=w+z+(n>>>0>>0?1:0)|0}M=d.low=M+n;d.high=Z+r+(M>>>0>>0?1:0);N=f.low=N+D;f.high=aa+F+(N>>>0>>0?1:0);O=g.low=O+E;g.high=ba+G+(O>>>0>>0?1:0);P=l.low=P+H;l.high=ca+W+(P>>>0>>0?1:0);Q=e.low=Q+p;e.high=da+s+(Q>>>0

>>0?1:0);R=m.low=R+I;m.high=ea+U+(R>>>0>>0?1:0); 23 | S=L.low=S+J;L.high=fa+V+(S>>>0>>0?1:0);T=c.low=T+K;c.high=ga+X+(T>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,c=a.words,b=8*this._nDataBytes,d=8*a.sigBytes;c[d>>>5]|=128<<24-d%32;c[(d+128>>>10<<5)+30]=Math.floor(b/4294967296);c[(d+128>>>10<<5)+31]=b;a.sigBytes=4*c.length;this._process();return this._hash.toX32()},clone:function(){var a=c.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});d.SHA512=c._createHelper(b);d.HmacSHA512=c._createHmacHelper(b)})(); 24 | (function(){var a=CryptoJS,d=a.x64,c=d.Word,b=d.WordArray,d=a.algo,f=d.SHA512,d=d.SHA384=f.extend({_doReset:function(){this._hash=new b.init([new c.init(3418070365,3238371032),new c.init(1654270250,914150663),new c.init(2438529370,812702999),new c.init(355462360,4144912697),new c.init(1731405415,4290775857),new c.init(2394180231,1750603025),new c.init(3675008525,1694076839),new c.init(1203062813,3204075428)])},_doFinalize:function(){var a=f._doFinalize.call(this);a.sigBytes-=16;return a}});a.SHA384= 25 | f._createHelper(d);a.HmacSHA384=f._createHmacHelper(d)})(); 26 | (function(){var a=CryptoJS,d=a.enc.Utf8;a.algo.HMAC=a.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=d.parse(b));var f=a.blockSize,l=4*f;b.sigBytes>l&&(b=a.finalize(b));b.clamp();for(var u=this._oKey=b.clone(),k=this._iKey=b.clone(),m=u.words,x=k.words,y=0;y>>2]|=(M[b>>>2]>>>24-8*(b%4)&255)<<24-8*((e+b)%4);else if(65535>>2]=M[b>>>2];else d.push.apply(d,M);this.sigBytes+=a;return this},clamp:function(){var D=this.words,d=this.sigBytes;D[d>>>2]&=4294967295<< 9 | 32-8*(d%4);D.length=a.ceil(d/4)},clone:function(){var a=l.clone.call(this);a.words=this.words.slice(0);return a},random:function(D){for(var d=[],b=0;b>>2]>>>24-8*(e%4)&255;b.push((c>>>4).toString(16));b.push((c&15).toString(16))}return b.join("")},parse:function(a){for(var d=a.length,b=[],e=0;e>>3]|=parseInt(a.substr(e, 10 | 2),16)<<24-4*(e%8);return new u.init(b,d/2)}},y=k.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],e=0;e>>2]>>>24-8*(e%4)&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],e=0;e>>2]|=(a.charCodeAt(e)&255)<<24-8*(e%4);return new u.init(c,b)}},z=k.Utf8={stringify:function(a){try{return decodeURIComponent(escape(y.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return y.parse(unescape(encodeURIComponent(a)))}}, 11 | x=b.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new u.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=z.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(b){var d=this._data,c=d.words,e=d.sigBytes,l=this.blockSize,k=e/(4*l),k=b?a.ceil(k):a.max((k|0)-this._minBufferSize,0);b=k*l;e=a.min(4*b,e);if(b){for(var x=0;xm;m++)k[m]=a();b=b.SHA512=c.extend({_doReset:function(){this._hash=new l.init([new f.init(1779033703,4089235720),new f.init(3144134277,2227873595),new f.init(1013904242,4271175723),new f.init(2773480762,1595750129),new f.init(1359893119,2917565137),new f.init(2600822924,725511199),new f.init(528734635,4215389547),new f.init(1541459225,327033209)])},_doProcessBlock:function(a,b){for(var c=this._hash.words, 20 | f=c[0],j=c[1],d=c[2],l=c[3],e=c[4],m=c[5],N=c[6],c=c[7],aa=f.high,O=f.low,ba=j.high,P=j.low,ca=d.high,Q=d.low,da=l.high,R=l.low,ea=e.high,S=e.low,fa=m.high,T=m.low,ga=N.high,U=N.low,ha=c.high,V=c.low,r=aa,n=O,G=ba,E=P,H=ca,F=Q,Y=da,I=R,s=ea,p=S,W=fa,J=T,X=ga,K=U,Z=ha,L=V,t=0;80>t;t++){var A=k[t];if(16>t)var q=A.high=a[b+2*t]|0,g=A.low=a[b+2*t+1]|0;else{var q=k[t-15],g=q.high,v=q.low,q=(g>>>1|v<<31)^(g>>>8|v<<24)^g>>>7,v=(v>>>1|g<<31)^(v>>>8|g<<24)^(v>>>7|g<<25),C=k[t-2],g=C.high,h=C.low,C=(g>>>19| 21 | h<<13)^(g<<3|h>>>29)^g>>>6,h=(h>>>19|g<<13)^(h<<3|g>>>29)^(h>>>6|g<<26),g=k[t-7],$=g.high,B=k[t-16],w=B.high,B=B.low,g=v+g.low,q=q+$+(g>>>0>>0?1:0),g=g+h,q=q+C+(g>>>0>>0?1:0),g=g+B,q=q+w+(g>>>0>>0?1:0);A.high=q;A.low=g}var $=s&W^~s&X,B=p&J^~p&K,A=r&G^r&H^G&H,ka=n&E^n&F^E&F,v=(r>>>28|n<<4)^(r<<30|n>>>2)^(r<<25|n>>>7),C=(n>>>28|r<<4)^(n<<30|r>>>2)^(n<<25|r>>>7),h=u[t],la=h.high,ia=h.low,h=L+((p>>>14|s<<18)^(p>>>18|s<<14)^(p<<23|s>>>9)),w=Z+((s>>>14|p<<18)^(s>>>18|p<<14)^(s<<23|p>>>9))+(h>>> 22 | 0>>0?1:0),h=h+B,w=w+$+(h>>>0>>0?1:0),h=h+ia,w=w+la+(h>>>0>>0?1:0),h=h+g,w=w+q+(h>>>0>>0?1:0),g=C+ka,A=v+A+(g>>>0>>0?1:0),Z=X,L=K,X=W,K=J,W=s,J=p,p=I+h|0,s=Y+w+(p>>>0>>0?1:0)|0,Y=H,I=F,H=G,F=E,G=r,E=n,n=h+g|0,r=w+A+(n>>>0>>0?1:0)|0}O=f.low=O+n;f.high=aa+r+(O>>>0>>0?1:0);P=j.low=P+E;j.high=ba+G+(P>>>0>>0?1:0);Q=d.low=Q+F;d.high=ca+H+(Q>>>0>>0?1:0);R=l.low=R+I;l.high=da+Y+(R>>>0>>0?1:0);S=e.low=S+p;e.high=ea+s+(S>>>0

'; 53 | 54 | addendHtml(str); 55 | middle(); //居中 56 | this.setting.callback(); 57 | 58 | } 59 | /*iframe层*/ 60 | PopLayer.prototype.iframe=function(json){ 61 | win.showLoading(); 62 | this.varLiang(json); 63 | var str='

>>0?1:0);T=m.low=T+J;m.high=fa+W+(T>>>0>>0?1: 23 | 0);U=N.low=U+K;N.high=ga+X+(U>>>0>>0?1:0);V=c.low=V+L;c.high=ha+Z+(V>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,f=8*a.sigBytes;b[f>>>5]|=128<<24-f%32;b[(f+128>>>10<<5)+30]=Math.floor(c/4294967296);b[(f+128>>>10<<5)+31]=c;a.sigBytes=4*b.length;this._process();return this._hash.toX32()},clone:function(){var a=c.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});j.SHA512=c._createHelper(b);j.HmacSHA512=c._createHmacHelper(b)})(); 24 | (function(){var a=CryptoJS,j=a.enc.Utf8;a.algo.HMAC=a.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=j.parse(b));var f=a.blockSize,l=4*f;b.sigBytes>l&&(b=a.finalize(b));b.clamp();for(var u=this._oKey=b.clone(),k=this._iKey=b.clone(),m=u.words,y=k.words,z=0;z>5]|=128<>>9<<4)+14]=b,c=1732584193,d=-271733879,e=-1732584194,f=271733878,g=0;g16&&(c=core_md5(c,a.length*chrsz)),d=Array(16),e=Array(16),f=0;16>f;f++)d[f]=909522486^c[f],e[f]=1549556828^c[f];return g=core_md5(d.concat(str2binl(b)),512+b.length*chrsz),core_md5(e.concat(g),640)}function safe_add(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function bit_rol(a,b){return a<>>32-b}function str2binl(a){var d,b=Array(),c=(1<>5]|=(a.charCodeAt(d/chrsz)&c)<>5]>>>d%32&c);return b}function binl2hex(a){var d,b=hexcase?"0123456789ABCDEF":"0123456789abcdef",c="";for(d=0;d<4*a.length;d++)c+=b.charAt(15&a[d>>2]>>8*(d%4)+4)+b.charAt(15&a[d>>2]>>8*(d%4));return c}function binl2b64(a){var d,e,f,b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c="";for(d=0;d<4*a.length;d+=3)for(e=(255&a[d>>2]>>8*(d%4))<<16|(255&a[d+1>>2]>>8*((d+1)%4))<<8|255&a[d+2>>2]>>8*((d+2)%4),f=0;4>f;f++)c+=8*d+6*f>32*a.length?b64pad:b.charAt(63&e>>6*(3-f));return c}var hexcase=0,b64pad="",chrsz=8; -------------------------------------------------------------------------------- /src/assets/common/lib/mixin/propsync.js: -------------------------------------------------------------------------------- 1 | /** 2 | * =================说明================== 3 | * propsync:vue组件的混合对象,主要用于组件编写时混入调用。 4 | * 5 | * 【主要功能】 6 | * 1、实现了在组件内自动创建所有prop对应的data属性,方便组件内修改prop使用。解决了vue2.0中不允许组件内直接修改prop的设计。 7 | * 2、实现了组件外修改组件prop,组件内自动同步修改到data属性。 8 | * 3、实现了组件内修改了data属性(由prop创建的),自动向组件外发出事件通知有内部prop修改。由组件外决定是否要将修改同步到组件外 9 | * 10 | * 【使用方法】 11 | * 1、编写组件:在选项对象中增加 mixins:[propsync]即可,无需其他修改 12 | * 2、调用组件:在调用组件的templat处,增加一个事件监听 onPropsChange(可修改),当组件内修改了props时会调用此函数,返回 修改prop名称,修改后值,修改前值 13 | * 14 | * 调用组件例: 15 | * 16 | * 17 | * { 18 | * methods:{ 19 | * change:function(propName,newVal,oldVal){ 20 | * this[propName]=newVal; 21 | * console.log("组件mycomponent的" +propName+ "属性由" +oldVal+ "修改为了" +newVal); 22 | * } 23 | * } 24 | * } 25 | * 26 | * 【可配置忽略】 27 | * 默认情况下,调用了本mixin的组件,会实现组件定义的所有的props,创建对应data变量,绑定双向watch。 28 | * 若希望某个props不进行绑定(如仅纯展示型props),则可在那个props中增加propsync:false(可配置)来忽略,默认所有props均为true 29 | * 例: 30 | * props:{ 31 | * xxx:{ 32 | * type: String, 33 | * default: "xxx", 34 | * propsync: false//增加此props的属性,则本mixin会忽略xxx 35 | * } 36 | * } 37 | */ 38 | /** 39 | * 【配置】 40 | * 当在组件内部修改了prop属性,对外emit发出的事件名称 41 | */ 42 | const emitPropsChangeName = "onPropsChange"; 43 | /** 44 | * 【配置】 45 | * 可在组件属性中定义当前props是否参加本mixin实现双向绑定。 46 | */ 47 | const isEnableName = "propsync"; 48 | /** 49 | * 【配置】 50 | * 根据prop的名称生成对应的data属性名,可自行修改生成后的名称。 51 | * 默认为在prop属性名前面增加"p_",即若prop中有字段名为"active",则自动生成名为"p_active"的data字段 52 | * 53 | * @param {string} propName 组件prop字段名称 54 | * @returns {string} 返回生成的data字段名 55 | */ 56 | function getDataName(propName) { 57 | //注意:映射后名称不能以 $ 或 _ 开头,会被vue认定为内部属性!! 58 | return "p_" + propName; 59 | } 60 | export default { 61 | //修改data,自动生成props对应的data字段 62 | data: function () { 63 | var data = {}; 64 | var that = this; 65 | /** 所有组件定义的props名称数组 */ 66 | var propsKeys = Object.keys((that.$options.props) || {}); 67 | propsKeys.forEach(function (prop, i) { 68 | var dataName = getDataName(prop); 69 | var isEnable = that.$options.props[prop][isEnableName]; 70 | isEnable = (typeof isEnable === "boolean") ? isEnable : true; 71 | if (!isEnable) 72 | return; 73 | //若使用mixins方法导入本代码,则本函数会 先于 组件内data函数执行! 74 | data[dataName] = that[prop]; 75 | }); 76 | return data; 77 | }, 78 | created: function () { 79 | var that = this; 80 | /** 所有 取消props的watch监听函数 的数组 */ 81 | var unwatchPropsFnArr = []; 82 | /** 所有 取消data的watch监听函数 的数组 */ 83 | var unwatchDataFnArr = []; 84 | /** 所有组件定义的props名称数组 */ 85 | var propsKeys = Object.keys((that.$options.props) || {}); 86 | propsKeys.forEach(function (prop, i) { 87 | var dataName = getDataName(prop); 88 | var isEnable = that.$options.props[prop][isEnableName]; 89 | isEnable = (typeof isEnable === "boolean") ? isEnable : true; 90 | if (!isEnable) 91 | return; 92 | //监听所有props属性 93 | var propsFn = that.$watch(prop, function (newVal, oldVal) { 94 | that[dataName] = newVal; //将组件外变更的prop同步到组件内的p_prop变量中 95 | }, {}); 96 | unwatchPropsFnArr.push(propsFn); 97 | //[监听所有属性映射到组件内的变量] 98 | var dataFn = that.$watch(dataName, function (newVal, oldVal) { 99 | that.$emit(emitPropsChangeName, prop, newVal, oldVal); //将组件内p_prop通知给组件外(调用方) 100 | }, {}); 101 | unwatchDataFnArr.push(dataFn); 102 | }); 103 | }, 104 | destroyed: function () { 105 | 106 | } 107 | }; 108 | 109 | //博客园 @xxcanghai @小小沧海 -------------------------------------------------------------------------------- /src/assets/common/lib/page/page.css: -------------------------------------------------------------------------------- 1 | /*分页插件样式*/ 2 | /**width: 1180px; margin: 0 auto; text-align: center; */ 3 | .copot-page{width: 100%;} 4 | #copot-page{padding: 10px 0; color: #a9a9a9;} 5 | .copot-page a{display:inline-block;padding:5px 10px;border:solid 1px #E7E7E7;margin-right:5px;text-decoration:none;font-size:12px;background:#fff; color: #a9a9a9;} 6 | .copot-page a:hover{background:#4990e2;color:#fff;} 7 | .copot-page a.nowPage{background:#5974d9;border:solid 1px #5974d9;color:#fff;} 8 | .copot-page .Page-search-span{margin:0 5px 0 15px;} 9 | .copot-page #Page-search{width:40px;height:28px;padding-left:10px;margin:0 3px;border:solid 1px #E7E7E7;} 10 | .copot-page #pageSearch{width:40px;height:28px;font-size:12px;border:solid 1px #5974d9;background:#5974d9;color:#fff;cursor:pointer; } -------------------------------------------------------------------------------- /src/assets/common/lib/page/page.js: -------------------------------------------------------------------------------- 1 | import util from 'common/js/util' 2 | import popup from 'popup' 3 | 4 | require('./page.css'); 5 | 6 | function Page(json) { 7 | this.route = json.route; 8 | this.routerName = json.routerName; 9 | this.nowPage = parseInt(json.nowPage); //当前页 10 | this.parent = json.parent; //分页内容所放的div元素 11 | this.call = json.callback; 12 | this.totalCount = json.totalCount; 13 | this.pageSize = json.pageSize; 14 | this.totalPage = Math.ceil(this.totalCount / this.pageSize); //总页数 15 | this.html = ""; 16 | this.type = json.type || 1; 17 | this.setting = json.setting || { 18 | defaultPage: 5, //默认展示的页数 19 | firstPageText: "首页", //第一页的字 (可以是:Home) 20 | prevPageText: "上一页", //上一页的字 21 | nextPageText: "下一页", //下一页的字 22 | lastPageText: "最后一页" //尾页的字 23 | }; 24 | this.centPage = Math.ceil(this.setting.defaultPage / 2); //中间页 25 | this.init(); //初始化 26 | } 27 | //初始化函数 28 | Page.prototype.init = function() { 29 | this.parent.html(""); //清空 30 | this.totalPageText(); //页数显示信息 31 | this.firstPage(); //首页 32 | this.prevPageText(); //上一页 33 | this.everyPage(); //分页 34 | this.nextPage(); //下一页 35 | this.lastPage(); //尾页 36 | this.pageSearch(); //搜索页 37 | this.parent.append(this.html); 38 | this.callback(); 39 | } 40 | 41 | //循环页数 42 | Page.prototype.everyPage = function() { 43 | if (this.totalPage <= this.setting.defaultPage) { 44 | for (var i = 1; i <= this.totalPage; i++) { 45 | if (this.nowPage == i) { 46 | this.html += "" + i + ""; 47 | } else { 48 | this.html += "" + i + ""; 49 | } 50 | } 51 | } else { 52 | for (var i = 1; i <= this.setting.defaultPage; i++) { 53 | var page1 = this.nowPage - this.centPage + i; 54 | var page2 = this.totalPage - this.setting.defaultPage + i; 55 | 56 | if (this.nowPage < this.centPage) { 57 | if (this.nowPage == i) { 58 | this.html += "" + i + ""; 59 | } else { 60 | this.html += "" + i + ""; 61 | } 62 | } else if (this.nowPage > this.totalPage - this.centPage) { 63 | if (this.setting.defaultPage - (this.totalPage - this.nowPage) == i) { 64 | this.html += "" + this.nowPage + ""; 65 | } else { 66 | this.html += "" + page2 + ""; 67 | } 68 | } else { 69 | if (this.centPage == i) { 70 | this.html += "" + page1 + ""; 71 | } else { 72 | this.html += "" + page1 + ""; 73 | } 74 | } 75 | } 76 | } 77 | } 78 | 79 | //首页 80 | Page.prototype.firstPage = function() { 81 | if (this.nowPage > this.centPage && this.totalPage >= this.setting.defaultPage + 1) { 82 | this.html += "" + this.setting.firstPageText + ""; 83 | } 84 | } 85 | //上一页 86 | Page.prototype.prevPageText = function() { 87 | if (this.nowPage >= 2) { 88 | this.html += "" + this.setting.prevPageText + ""; 89 | } 90 | } 91 | 92 | //下一页 93 | Page.prototype.nextPage = function() { 94 | if (this.totalPage - this.nowPage >= 1) { 95 | this.html += "" + this.setting.nextPageText + ""; 96 | } 97 | } 98 | 99 | //尾页 100 | Page.prototype.lastPage = function() { 101 | if (this.totalPage - this.nowPage >= this.centPage && this.totalPage > this.setting.defaultPage) { 102 | this.html += "" + this.setting.lastPageText + ""; 103 | } 104 | } 105 | 106 | //总共页数 107 | Page.prototype.totalPageText = function() { 108 | this.html += "" + this.totalCount + " 条记录 共" + this.totalPage + "    "; 109 | } 110 | 111 | //搜索页数 112 | Page.prototype.pageSearch = function() { 113 | if (this.totalPage > this.setting.defaultPage) { 114 | this.html += "跳转到" 115 | } 116 | } 117 | 118 | //点击分页执行的函数 119 | Page.prototype.callback = function() { 120 | var This = this; 121 | if (this.type == 1) { 122 | //按hash值改变分页 123 | this.parent.find("a").bind("click", function(event) { 124 | event.preventDefault(); //阻止默认行为 ( 表单提交 ) 125 | var nowPage = $(this).attr("href").substring(1); 126 | //请求路由 127 | router.push({ 128 | name: This.routerName, 129 | query: { 130 | page: nowPage 131 | } 132 | }) 133 | This.getPage(nowPage); 134 | }); 135 | //输入搜索查询 136 | $(document).keydown(function(event) { 137 | if (event.keyCode == 13) { 138 | searchpage(); 139 | } 140 | }); 141 | this.parent.find("#pageSearch").click(function() { 142 | searchpage(); 143 | }); 144 | 145 | function searchpage() { 146 | var nowPage = This.parent.find('#Page-search').val(); 147 | if (parseInt(nowPage) > This.totalPage) { 148 | This.parent.find('#Page-search').val(''); 149 | popup.miss({ 150 | title: "超出搜索页数!" 151 | }); 152 | return false; 153 | } 154 | if (parseInt(nowPage) > 0) { 155 | //请求路由 156 | router.push({ 157 | name: This.routerName, 158 | query: { 159 | page: nowPage 160 | } 161 | }) 162 | This.getPage(nowPage); 163 | } 164 | 165 | }; 166 | } else if (this.type == 2) { 167 | //给每个a绑定事件 168 | this.parent.find("a").bind("click", function() { 169 | var nowPage = $(this).attr("href").substring(1); 170 | This.getPage(nowPage); 171 | return false; 172 | }); 173 | //输入搜索查询 174 | this.parent.find("#pageSearch").click(function() { 175 | var nowPage = This.parent.find('#Page-search').val(); 176 | if (parseInt(nowPage) > This.totalPage) { 177 | popup.miss({ 178 | title: "超出搜索页数!" 179 | }); 180 | return false; 181 | } else { 182 | if (parseInt(nowPage) > 0) { 183 | This.getPage(nowPage); 184 | } 185 | } 186 | 187 | }); 188 | } 189 | 190 | 191 | } 192 | 193 | /*请求分页函数*/ 194 | Page.prototype.getPage = function(nowPage) { 195 | // util.showLoading(); 196 | this.parent.html(""); //清空 197 | //写入分页 198 | new Page({ 199 | route: this.route, 200 | routerName: this.routerName, 201 | parent: this.parent, 202 | nowPage: nowPage, 203 | type: this.type, 204 | totalPage: this.totalPage, 205 | pageSize: this.pageSize, 206 | totalCount: this.totalCount, 207 | setting: this.setting, 208 | callback: this.call 209 | }); 210 | if (this.call) { 211 | this.call(nowPage, this.totalPage); //传参 212 | } 213 | } 214 | 215 | 216 | module.exports = function(json) { 217 | new Page(json) 218 | } -------------------------------------------------------------------------------- /src/assets/common/lib/popup/popup.css: -------------------------------------------------------------------------------- 1 | /*layer-mobile-css*/ 2 | @keyframes popScaleShow{from{opacity: 0;}to{opacity: 1;}} 3 | @-webkit-keyframes popScaleShow{from{opacity: 0;}to{opacity: 1;}} 4 | @keyframes popScale{from{opacity: 0;transform:scale(0.5,0.5);}to{opacity: 1;transform:scale(1,1);}} 5 | @-webkit-keyframes popScale{from{opacity: 0;-webkit-transform:scale(0.5,0.5);}to{opacity: 1;-webkit-transform:scale(1,1);}} 6 | iframe { display: block;} 7 | .popup{width:100%;box-sizing:border-box;height:100%;position: fixed;left:0;top:0;z-index:100000;animation:popScaleShow 300ms linear;-webkit-animation:popScaleShow 300ms linear;} 8 | .popup .mask{width:100%;height:100%;position: absolute;left:0;top:0;background: rgba(0,0,0,.6);z-index:-1;} 9 | .popup .popup_main{position:fixed;left:50%;top:50%;min-width:350px;min-height:100px;overflow:hidden;max-width:90%!important; 10 | transform:translateX(-50%);-webkit-transform:translateX(-50%);background:transparent; 11 | } 12 | .maminContent{width:100%;height:100%;background: #fff;overflow: hidden;animation:popScale 300ms;-webkit-animation:popScale 300ms;} 13 | .popup .maskMain{background:rgba(0,0,0,.6);color:#fff;} 14 | .popup .header_poup{height:30px;padding-left:46px;margin-top:10px;line-height:50px;position: relative;font-size:16px;} 15 | .popup .header_poup span{display:block;width:15px;height:15px;cursor:pointer;background: url('../../images/PopLayer-close.png') no-repeat top center;background-size:80% 80%;position: absolute;right:20px;top:15px;} 16 | .popup .header_poup i{width:25px;height:25px;display:inline-block;background: url('../../images/icon-1.png') no-repeat center center;position: absolute; 17 | left:15px;top:10px; 18 | } 19 | .popup .header_poup i.icon-1{background: url('../../images/icon-1.png') no-repeat center center;} 20 | .popup .header_poup i.icon-2{background: url('../../images/icon-2.png') no-repeat center center;} 21 | .popup .header_poup i.icon-3{background: url('../../images/icon-3.png') no-repeat center center;} 22 | .popup .content{line-height:25px;padding:30px 20px 10px 50px;color:#888;} 23 | .popup .footer{height:60px;width:100%;line-height: 40px;position: relative;margin-top:20px;padding-left:50px;} 24 | .popup .footer span{font-size:14px;height:35px;line-height:35px;cursor:pointer;display:inline-block;text-align:center;color:#4a4a4a;} 25 | .popup .footer .yes{padding:0px 25px;background: #ff4200;color:#fff;border-radius:5px;} 26 | .popup .footer .yes:hover, 27 | .popup .footer .yes5:hover{background:#ef6536;} 28 | .popup .footer .yes5{} 29 | .popup .footer .yesok{background:#ff4200;} 30 | .popup .footer .no{padding:0 15px;border:solid 1px #999;border-radius: 5px;margin-left:15px;} 31 | .popup .footer .no:hover{background:#e8e3e3;} 32 | .popup-hide .popup_main{min-width:100px;} 33 | .popup-hide .popup_main .content{line-height:50px;} 34 | .popup-hide .content{text-align:center;} 35 | .popup-loading{cursor: wait;} 36 | .popup-loading .popup_main{min-width:150px;height:60px;padding:0 15px 0 5px;} 37 | .popup-loading .popup_main .content{line-height:60px;} 38 | .popup-loading .popup_main .content:before{content: "";display: block;width:40px;height:60px;background: url('../../images/loading.gif') no-repeat center center;float:left; 39 | background-size: 60%;margin-top:-15px; 40 | } 41 | .popup-loading .content{text-align:center;} 42 | .popup .html{line-height:25px;} 43 | .popup-iframe .popup_main{width:80%;height:80%;left:10%;top:10%;} 44 | .popup-iframe .popup_main .contentios{overflow-scrolling:touch;-webkit-overflow-scrolling:touch;overflow-y: scroll; } 45 | .popup .yesHtml{text-align:center;cursor:pointer;color:#f48e08;padding-top:15px;border-top:solid 1px #dcdcdc;} 46 | .popup .yesHtml:hover{color:#b76b07;} 47 | .popup .popup_main .content-no{padding-top:12px;padding-bottom:12px;line-height:25px;} 48 | .popup .popup_main .miss_popup{border-radius: 5px!important;color:#fff;} 49 | .popup .popup_main .miss_popup .content-no{padding-left:20px;color:#fff;} -------------------------------------------------------------------------------- /src/assets/common/lib/popup/popup.js: -------------------------------------------------------------------------------- 1 | 2 | require('./popup.css'); 3 | //构造函数 4 | function PopLayer(){ 5 | this.setting={}; 6 | } 7 | /*extent json函数*/ 8 | PopLayer.prototype.extend=function(json1,json2){ 9 | var newJson=json1; 10 | for(var i in json1){ 11 | for( var j in json2){ 12 | newJson[j]=json2[j]; 13 | } 14 | } 15 | return newJson; 16 | } 17 | /*公共变量*/ 18 | PopLayer.prototype.varLiang=function(json){ 19 | this.setting={ 20 | time:2000, 21 | header:"信息", //头部信息 22 | haveHeader:true, //是否显示头部 23 | maskHide:true, //是否点击遮罩隐藏 24 | closeBut:false, //是否需要关闭按钮 25 | loadingImg:'loading-1', 26 | type:"msg", 27 | style:'', 28 | title:"请填写提示信息!", 29 | yesHtml:'', 30 | imgs:{ 31 | msg:'icon-1', 32 | error:'icon-2', 33 | success:'icon-3', 34 | }, 35 | yes:function(){}, 36 | callback:function(){}, 37 | }; 38 | if(json){ 39 | this.setting=this.extend(this.setting,json); //继承 40 | } 41 | } 42 | /*页面层*/ 43 | PopLayer.prototype.customHtml=function(json){ 44 | this.varLiang(json); 45 | var str='