├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── IMG ├── 1.png ├── 2.png └── url.png ├── README.md ├── build ├── build.js ├── check-versions.js ├── logo.png ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js └── webpack.prod.conf.js ├── config ├── dev.env.js ├── index.js ├── prod.env.js └── test.env.js ├── index.html ├── package-lock.json ├── package.json ├── src ├── App.vue ├── api │ ├── api.js │ ├── socket.js │ └── valid.js ├── assets │ ├── 1.jpg │ ├── 1.png │ ├── 2.jpg │ ├── 3.jpg │ ├── 4.jpg │ ├── error.png │ ├── logo.jpg │ └── logo.png ├── components │ ├── Collection.vue │ ├── Tabs.vue │ ├── Upload.vue │ ├── bubble.vue │ ├── button-follow.vue │ ├── head.vue │ ├── input.vue │ ├── item.vue │ ├── like.vue │ ├── loadBottom.vue │ ├── loadItem.vue │ ├── loadTop.vue │ ├── message.vue │ ├── pmessage.vue │ ├── sendInput.vue │ └── tool │ │ └── Global.vue ├── main.js ├── page │ └── main │ │ ├── Publish.vue │ │ ├── addFriend.vue │ │ ├── avatar.vue │ │ ├── chat.vue │ │ ├── chatlist.vue │ │ ├── chats.vue │ │ ├── comment.vue │ │ ├── diaLog.vue │ │ ├── dynamicInfo.vue │ │ ├── fansList.vue │ │ ├── followList.vue │ │ ├── index.vue │ │ ├── login.vue │ │ ├── my.vue │ │ ├── reg.vue │ │ └── seting.vue ├── router │ └── index.js ├── utils │ └── collection.js └── vuex │ ├── modules │ └── userinfo.js │ └── store.js └── static ├── .gitkeep ├── css ├── common.css └── reset.css ├── iconfont ├── iconfont.css ├── iconfont.eot ├── iconfont.js ├── iconfont.svg ├── iconfont.ttf ├── iconfont.woff └── iconfont.woff2 └── js └── common.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": [ 12 | "transform-vue-jsx", 13 | "transform-runtime", 14 | ["component", [ 15 | { 16 | "libraryName":"mint-ui", 17 | "style":true 18 | } 19 | ] 20 | ] 21 | ], 22 | "env": { 23 | "test": { 24 | "presets": ["env", "stage-2"], 25 | "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"] 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | /test/unit/coverage/ 6 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parserOptions: { 6 | parser: 'babel-eslint' 7 | }, 8 | env: { 9 | browser: true, 10 | }, 11 | extends: [ 12 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention 13 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. 14 | 'plugin:vue/essential', 15 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 16 | 'standard' 17 | ], 18 | // required to lint *.vue files 19 | plugins: [ 20 | 'vue' 21 | ], 22 | // add your custom rules here 23 | rules: { 24 | // allow async-await 25 | 'generator-star-spacing': 'off', 26 | // allow debugger during development 27 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | /test/unit/coverage/ 8 | /test/e2e/reports/ 9 | selenium-debug.log 10 | 11 | # Editor directories and files 12 | .idea 13 | .vscode 14 | *.suo 15 | *.ntvs* 16 | *.njsproj 17 | *.sln 18 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /IMG/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/IMG/1.png -------------------------------------------------------------------------------- /IMG/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/IMG/2.png -------------------------------------------------------------------------------- /IMG/url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/IMG/url.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # webchat 2 | 3 | ## 功能 4 | 5 | - [x] 注册登录功能 6 | - [x] 聊天功能 7 | - [x] 查看历史记录 8 | - [x] 多个聊天室 9 | - [x] 图片发送 10 | - [x] 图片预览 11 | - [x] 消息未读 12 | - [x] 断线重连 13 | - [x] 发表动态 14 | - [x] 评论动态 15 | - [x] 动态详情 16 | - [x] 点赞动态 17 | - [x] 点赞评论 18 | - [x] 收藏动态 19 | - [x] 个人中心 20 | - [x] 后续开发 21 | 22 | ## 启动项目 23 | 24 | Dev环境: MongoDB、Node 8.5.0+、Npm 5.3.0+ 25 | 26 | Prod环境: Redis、MongoDB、Node 8.5.0+、Npm 5.3.0+ 27 | 28 | ``` 29 | npm install -----安装依赖 30 | 31 | npm run dev -----运行 32 | 33 | ``` 34 | 35 | ## 打包 36 | 37 | ``` 38 | npm run build 39 | 40 | npm run prod 41 | 42 | ``` 43 | 44 | 在线观看 45 | 46 | [http://loveboxiong.top/](http://loveboxiong.top/) 47 | 48 | ![1](https://github.com/aopama/websocket/blob/master/IMG/url.png) 49 | 50 | ## 技术交流 51 | 52 | QQ :339840649 53 | 54 | ## 技术栈 55 | 56 | - 前端 vue,vue-router,vuex,better-scroll 57 | - 后端 nodejs,express 58 | - 数据库 mysql,redis 59 | - 通讯 websocket 60 | - 脚手架工具 vue-cli 61 | - 图片、视频存储服务器 七牛云 62 | 63 | ## 效果 64 | 65 | ![1](https://github.com/aopama/websocket/blob/master/IMG/1.png) 66 | ![2](https://github.com/aopama/websocket/blob/master/IMG/2.png) 67 | 68 | # 69 | MIT License 70 | 71 | Copyright (c) 2019 aopama 72 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/build/logo.png -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const config = require('../config') 4 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 5 | const packageConfig = require('../package.json') 6 | 7 | exports.assetsPath = function (_path) { 8 | const assetsSubDirectory = process.env.NODE_ENV === 'production' 9 | ? config.build.assetsSubDirectory 10 | : config.dev.assetsSubDirectory 11 | 12 | return path.posix.join(assetsSubDirectory, _path) 13 | } 14 | 15 | exports.cssLoaders = function (options) { 16 | options = options || {} 17 | 18 | const cssLoader = { 19 | loader: 'css-loader', 20 | options: { 21 | sourceMap: options.sourceMap 22 | } 23 | } 24 | 25 | const postcssLoader = { 26 | loader: 'postcss-loader', 27 | options: { 28 | sourceMap: options.sourceMap 29 | } 30 | } 31 | 32 | // generate loader string to be used with extract text plugin 33 | function generateLoaders (loader, loaderOptions) { 34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] 35 | 36 | if (loader) { 37 | loaders.push({ 38 | loader: loader + '-loader', 39 | options: Object.assign({}, loaderOptions, { 40 | sourceMap: options.sourceMap 41 | }) 42 | }) 43 | } 44 | 45 | // Extract CSS when that option is specified 46 | // (which is the case during production build) 47 | if (options.extract) { 48 | return ExtractTextPlugin.extract({ 49 | use: loaders, 50 | fallback: 'vue-style-loader' 51 | }) 52 | } else { 53 | return ['vue-style-loader'].concat(loaders) 54 | } 55 | } 56 | 57 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 58 | return { 59 | css: generateLoaders(), 60 | postcss: generateLoaders(), 61 | less: generateLoaders('less'), 62 | sass: generateLoaders('sass', { indentedSyntax: true }), 63 | scss: generateLoaders('sass'), 64 | stylus: generateLoaders('stylus'), 65 | styl: generateLoaders('stylus') 66 | } 67 | } 68 | 69 | // Generate loaders for standalone style files (outside of .vue) 70 | exports.styleLoaders = function (options) { 71 | const output = [] 72 | const loaders = exports.cssLoaders(options) 73 | 74 | for (const extension in loaders) { 75 | const loader = loaders[extension] 76 | output.push({ 77 | test: new RegExp('\\.' + extension + '$'), 78 | use: loader 79 | }) 80 | } 81 | 82 | return output 83 | } 84 | 85 | exports.createNotifierCallback = () => { 86 | const notifier = require('node-notifier') 87 | 88 | return (severity, errors) => { 89 | if (severity !== 'error') return 90 | 91 | const error = errors[0] 92 | const filename = error.file && error.file.split('!').pop() 93 | 94 | notifier.notify({ 95 | title: packageConfig.name, 96 | message: severity + ': ' + error.name, 97 | subtitle: filename || '', 98 | icon: path.join(__dirname, 'logo.png') 99 | }) 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const vueLoaderConfig = require('./vue-loader.conf') 6 | 7 | function resolve (dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | // const createLintingRule = () => ({ 12 | // test: /\.(js|vue)$/, 13 | // loader: 'eslint-loader', 14 | // enforce: 'pre', 15 | // include: [resolve('src'), resolve('test')], 16 | // options: { 17 | // formatter: require('eslint-friendly-formatter'), 18 | // emitWarning: !config.dev.showEslintErrorsInOverlay 19 | // } 20 | // }) 21 | 22 | module.exports = { 23 | context: path.resolve(__dirname, '../'), 24 | entry: { 25 | app: './src/main.js' 26 | }, 27 | output: { 28 | path: config.build.assetsRoot, 29 | filename: '[name].js', 30 | publicPath: process.env.NODE_ENV === 'production' 31 | ? config.build.assetsPublicPath 32 | : config.dev.assetsPublicPath 33 | }, 34 | resolve: { 35 | extensions: ['.js', '.vue', '.json'], 36 | alias: { 37 | 'vue$': 'vue/dist/vue.esm.js', 38 | '@': resolve('src'), 39 | } 40 | }, 41 | module: { 42 | rules: [ 43 | // ...(config.dev.useEslint ? [createLintingRule()] : []), 44 | { 45 | test: /\.vue$/, 46 | loader: 'vue-loader', 47 | options: vueLoaderConfig 48 | }, 49 | { 50 | test: /\.js$/, 51 | loader: 'babel-loader', 52 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] 53 | }, 54 | { 55 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 56 | loader: 'url-loader', 57 | options: { 58 | limit: 10000, 59 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 60 | } 61 | }, 62 | { 63 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 64 | loader: 'url-loader', 65 | options: { 66 | limit: 10000, 67 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 68 | } 69 | }, 70 | { 71 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 72 | loader: 'url-loader', 73 | options: { 74 | limit: 10000, 75 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 76 | } 77 | } 78 | ] 79 | }, 80 | node: { 81 | // prevent webpack from injecting useless setImmediate polyfill because Vue 82 | // source contains it (although only uses it if it's native). 83 | setImmediate: false, 84 | // prevent webpack from injecting mocks to Node native modules 85 | // that does not make sense for the client 86 | dgram: 'empty', 87 | fs: 'empty', 88 | net: 'empty', 89 | tls: 'empty', 90 | child_process: 'empty' 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const webpack = require('webpack') 4 | const config = require('../config') 5 | const merge = require('webpack-merge') 6 | const path = require('path') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 11 | const portfinder = require('portfinder') 12 | 13 | const HOST = process.env.HOST 14 | const PORT = process.env.PORT && Number(process.env.PORT) 15 | 16 | const devWebpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) 19 | }, 20 | // cheap-module-eval-source-map is faster for development 21 | devtool: config.dev.devtool, 22 | 23 | // these devServer options should be customized in /config/index.js 24 | devServer: { 25 | clientLogLevel: 'warning', 26 | historyApiFallback: { 27 | rewrites: [ 28 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, 29 | ], 30 | }, 31 | hot: true, 32 | contentBase: false, // since we use CopyWebpackPlugin. 33 | compress: true, 34 | host: HOST || config.dev.host, 35 | port: PORT || config.dev.port, 36 | open: config.dev.autoOpenBrowser, 37 | overlay: config.dev.errorOverlay 38 | ? { warnings: false, errors: true } 39 | : false, 40 | publicPath: config.dev.assetsPublicPath, 41 | proxy: config.dev.proxyTable, 42 | quiet: true, // necessary for FriendlyErrorsPlugin 43 | watchOptions: { 44 | poll: config.dev.poll, 45 | } 46 | }, 47 | plugins: [ 48 | new webpack.DefinePlugin({ 49 | 'process.env': require('../config/dev.env') 50 | }), 51 | new webpack.HotModuleReplacementPlugin(), 52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. 53 | new webpack.NoEmitOnErrorsPlugin(), 54 | // https://github.com/ampedandwired/html-webpack-plugin 55 | new HtmlWebpackPlugin({ 56 | filename: 'index.html', 57 | template: 'index.html', 58 | inject: true 59 | }), 60 | // copy custom static assets 61 | new CopyWebpackPlugin([ 62 | { 63 | from: path.resolve(__dirname, '../static'), 64 | to: config.dev.assetsSubDirectory, 65 | ignore: ['.*'] 66 | } 67 | ]) 68 | ] 69 | }) 70 | 71 | module.exports = new Promise((resolve, reject) => { 72 | portfinder.basePort = process.env.PORT || config.dev.port 73 | portfinder.getPort((err, port) => { 74 | if (err) { 75 | reject(err) 76 | } else { 77 | // publish the new Port, necessary for e2e tests 78 | process.env.PORT = port 79 | // add port to devServer config 80 | devWebpackConfig.devServer.port = port 81 | 82 | // Add FriendlyErrorsPlugin 83 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 84 | compilationSuccessInfo: { 85 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 86 | }, 87 | onErrors: config.dev.notifyOnErrors 88 | ? utils.createNotifierCallback() 89 | : undefined 90 | })) 91 | 92 | resolve(devWebpackConfig) 93 | } 94 | }) 95 | }) 96 | -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config') 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 13 | 14 | const env = process.env.NODE_ENV === 'testing' 15 | ? require('../config/test.env') 16 | : require('../config/prod.env') 17 | 18 | const webpackConfig = merge(baseWebpackConfig, { 19 | module: { 20 | rules: utils.styleLoaders({ 21 | sourceMap: config.build.productionSourceMap, 22 | extract: true, 23 | usePostCSS: true 24 | }) 25 | }, 26 | devtool: config.build.productionSourceMap ? config.build.devtool : false, 27 | output: { 28 | path: config.build.assetsRoot, 29 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 30 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 31 | }, 32 | plugins: [ 33 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 34 | new webpack.DefinePlugin({ 35 | 'process.env': env 36 | }), 37 | new UglifyJsPlugin({ 38 | uglifyOptions: { 39 | compress: { 40 | warnings: false 41 | } 42 | }, 43 | sourceMap: config.build.productionSourceMap, 44 | parallel: true 45 | }), 46 | // extract css into its own file 47 | new ExtractTextPlugin({ 48 | filename: utils.assetsPath('css/[name].[contenthash].css'), 49 | // Setting the following option to `false` will not extract CSS from codesplit chunks. 50 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. 51 | // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, 52 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 53 | allChunks: true, 54 | }), 55 | // Compress extracted CSS. We are using this plugin so that possible 56 | // duplicated CSS from different components can be deduped. 57 | new OptimizeCSSPlugin({ 58 | cssProcessorOptions: config.build.productionSourceMap 59 | ? { safe: true, map: { inline: false } } 60 | : { safe: true } 61 | }), 62 | // generate dist index.html with correct asset hash for caching. 63 | // you can customize output by editing /index.html 64 | // see https://github.com/ampedandwired/html-webpack-plugin 65 | new HtmlWebpackPlugin({ 66 | filename: process.env.NODE_ENV === 'testing' 67 | ? 'index.html' 68 | : config.build.index, 69 | template: 'index.html', 70 | inject: true, 71 | minify: { 72 | removeComments: true, 73 | collapseWhitespace: true, 74 | removeAttributeQuotes: true 75 | // more options: 76 | // https://github.com/kangax/html-minifier#options-quick-reference 77 | }, 78 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 79 | chunksSortMode: 'dependency' 80 | }), 81 | // keep module.id stable when vendor modules does not change 82 | new webpack.HashedModuleIdsPlugin(), 83 | // enable scope hoisting 84 | new webpack.optimize.ModuleConcatenationPlugin(), 85 | // split vendor js into its own file 86 | new webpack.optimize.CommonsChunkPlugin({ 87 | name: 'vendor', 88 | minChunks (module) { 89 | // any required modules inside node_modules are extracted to vendor 90 | return ( 91 | module.resource && 92 | /\.js$/.test(module.resource) && 93 | module.resource.indexOf( 94 | path.join(__dirname, '../node_modules') 95 | ) === 0 96 | ) 97 | } 98 | }), 99 | // extract webpack runtime and module manifest to its own file in order to 100 | // prevent vendor hash from being updated whenever app bundle is updated 101 | new webpack.optimize.CommonsChunkPlugin({ 102 | name: 'manifest', 103 | minChunks: Infinity 104 | }), 105 | // This instance extracts shared chunks from code splitted chunks and bundles them 106 | // in a separate chunk, similar to the vendor chunk 107 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk 108 | new webpack.optimize.CommonsChunkPlugin({ 109 | name: 'app', 110 | async: 'vendor-async', 111 | children: true, 112 | minChunks: 3 113 | }), 114 | 115 | // copy custom static assets 116 | new CopyWebpackPlugin([ 117 | { 118 | from: path.resolve(__dirname, '../static'), 119 | to: config.build.assetsSubDirectory, 120 | ignore: ['.*'] 121 | } 122 | ]) 123 | ] 124 | }) 125 | 126 | if (config.build.productionGzip) { 127 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 128 | 129 | webpackConfig.plugins.push( 130 | new CompressionWebpackPlugin({ 131 | asset: '[path].gz[query]', 132 | algorithm: 'gzip', 133 | test: new RegExp( 134 | '\\.(' + 135 | config.build.productionGzipExtensions.join('|') + 136 | ')$' 137 | ), 138 | threshold: 10240, 139 | minRatio: 0.8 140 | }) 141 | ) 142 | } 143 | 144 | if (config.build.bundleAnalyzerReport) { 145 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 146 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 147 | } 148 | 149 | module.exports = webpackConfig 150 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.3.1 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | // Paths 10 | assetsSubDirectory: 'static', 11 | assetsPublicPath: '/', 12 | // Various Dev Server settings 13 | host: 'localhost', // can be overwritten by process.env.HOST 14 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 15 | autoOpenBrowser: false, 16 | errorOverlay: true, 17 | notifyOnErrors: true, 18 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 19 | 20 | // Use Eslint Loader? 21 | // If true, your code will be linted during bundling and 22 | // linting errors and warnings will be shown in the console. 23 | useEslint:false, 24 | // If true, eslint errors and warnings will also be shown in the error overlay 25 | // in the browser. 26 | showEslintErrorsInOverlay: false, 27 | 28 | /** 29 | * Source Maps 30 | */ 31 | 32 | // https://webpack.js.org/configuration/devtool/#development 33 | devtool: 'cheap-module-eval-source-map', 34 | 35 | // If you have problems debugging vue-files in devtools, 36 | // set this to false - it *may* help 37 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 38 | cacheBusting: true, 39 | proxyTable: { 40 | "/users":{ 41 | target: 'http://localhost:8000/', 42 | changeOrigin: true, 43 | pathRewrite: { 44 | '^/users': '' 45 | } 46 | } 47 | }, 48 | cssSourceMap: true 49 | }, 50 | 51 | build: { 52 | // Template for index.html 53 | index: path.resolve(__dirname, '../dist/index.html'), 54 | 55 | // Paths 56 | assetsRoot: path.resolve(__dirname, '../dist'), 57 | assetsSubDirectory: 'static', 58 | assetsPublicPath: './', 59 | 60 | /** 61 | * Source Maps 62 | */ 63 | 64 | productionSourceMap: true, 65 | // https://webpack.js.org/configuration/devtool/#production 66 | devtool: '#source-map', 67 | 68 | // Gzip off by default as many popular static hosts such as 69 | // Surge or Netlify already gzip all static assets for you. 70 | // Before setting to `true`, make sure to: 71 | // npm install --save-dev compression-webpack-plugin 72 | productionGzip: false, 73 | productionGzipExtensions: ['js', 'css'], 74 | 75 | // Run the build command with an extra argument to 76 | // View the bundle analyzer report after build finishes: 77 | // `npm run build --report` 78 | // Set to `true` or `false` to always turn it on or off 79 | bundleAnalyzerReport: process.env.npm_config_report 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /config/test.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const devEnv = require('./dev.env') 4 | 5 | module.exports = merge(devEnv, { 6 | NODE_ENV: '"testing"' 7 | }) 8 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | kill 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sell", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "zx ", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "unit": "jest --config test/unit/jest.conf.js --coverage", 11 | "e2e": "node test/e2e/runner.js", 12 | "test": "npm run unit && npm run e2e", 13 | "lint": "eslint --ext .js,.vue src test/unit test/e2e/specs", 14 | "build": "node build/build.js", 15 | "server": "node server/app.js" 16 | }, 17 | "dependencies": { 18 | "less": "^3.9.0", 19 | "less-loader": "^5.0.0", 20 | "lodash": "^4.17.11", 21 | "mint-ui": "^2.2.13", 22 | "photoswipe": "^4.1.3", 23 | "redis": "^2.8.0", 24 | "socket.io": "^2.2.0", 25 | "socket.io-client": "^2.2.0", 26 | "vue": "^2.5.2", 27 | "vue-cropper": "^0.4.9", 28 | "vue-lazyload": "^1.3.1", 29 | "vue-router": "^3.0.1", 30 | "vue-socket.io": "^2.1.1", 31 | "vuex": "^3.1.0" 32 | }, 33 | "devDependencies": { 34 | "autoprefixer": "^7.1.2", 35 | "axios": "^0.18.0", 36 | "babel-core": "^6.22.1", 37 | "babel-eslint": "^8.2.1", 38 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 39 | "babel-jest": "^21.0.2", 40 | "babel-loader": "^7.1.1", 41 | "babel-plugin-component": "^1.1.1", 42 | "babel-plugin-dynamic-import-node": "^1.2.0", 43 | "babel-plugin-syntax-jsx": "^6.18.0", 44 | "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", 45 | "babel-plugin-transform-runtime": "^6.22.0", 46 | "babel-plugin-transform-vue-jsx": "^3.5.0", 47 | "babel-preset-env": "^1.3.2", 48 | "babel-preset-stage-2": "^6.22.0", 49 | "babel-register": "^6.22.0", 50 | "better-scroll": "^1.15.2", 51 | "chalk": "^2.0.1", 52 | "chromedriver": "^2.46.0", 53 | "copy-webpack-plugin": "^4.0.1", 54 | "cross-spawn": "^5.0.1", 55 | "css-loader": "^0.28.0", 56 | "eslint": "^4.15.0", 57 | "eslint-config-standard": "^10.2.1", 58 | "eslint-friendly-formatter": "^3.0.0", 59 | "eslint-loader": "^1.7.1", 60 | "eslint-plugin-import": "^2.7.0", 61 | "eslint-plugin-node": "^5.2.0", 62 | "eslint-plugin-promise": "^3.4.0", 63 | "eslint-plugin-standard": "^3.0.1", 64 | "eslint-plugin-vue": "^4.0.0", 65 | "extract-text-webpack-plugin": "^3.0.0", 66 | "file-loader": "^1.1.4", 67 | "friendly-errors-webpack-plugin": "^1.6.1", 68 | "html-webpack-plugin": "^2.30.1", 69 | "jest": "^22.0.4", 70 | "jest-serializer-vue": "^0.3.0", 71 | "nightwatch": "^0.9.12", 72 | "node-notifier": "^5.1.2", 73 | "optimize-css-assets-webpack-plugin": "^3.2.0", 74 | "ora": "^1.2.0", 75 | "portfinder": "^1.0.13", 76 | "postcss-import": "^11.0.0", 77 | "postcss-loader": "^2.0.8", 78 | "postcss-url": "^7.2.1", 79 | "rimraf": "^2.6.0", 80 | "selenium-server": "^3.0.1", 81 | "semver": "^5.3.0", 82 | "shelljs": "^0.7.6", 83 | "swiper": "^4.5.0", 84 | "uglifyjs-webpack-plugin": "^1.1.1", 85 | "url-loader": "^0.5.8", 86 | "vue-jest": "^1.0.2", 87 | "vue-loader": "^13.3.0", 88 | "vue-style-loader": "^3.0.1", 89 | "vue-template-compiler": "^2.5.2", 90 | "webpack": "^3.6.0", 91 | "webpack-bundle-analyzer": "^2.9.0", 92 | "webpack-dev-server": "^2.9.1", 93 | "webpack-merge": "^4.1.0" 94 | }, 95 | "engines": { 96 | "node": ">= 6.0.0", 97 | "npm": ">= 3.0.0" 98 | }, 99 | "browserslist": [ 100 | "> 1%", 101 | "last 2 versions", 102 | "not ie <= 8" 103 | ] 104 | } 105 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 26 | 27 | 31 | -------------------------------------------------------------------------------- /src/api/api.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import qs from 'querystring'; 3 | import axios from 'axios'; 4 | 5 | const node_env = { 6 | node_env:'development', 7 | development:'http://localhost:8000/',//本地http://106.13.132.20:8000/http://localhost:8000/ 8 | } 9 | axios.defaults.baseURL = node_env[node_env.node_env]; 10 | axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; 11 | 12 | /** 13 | * 用户名登录 14 | * @param user:用户名 15 | * @param pwd: 密码 16 | */ 17 | const name_login=({username,userpass})=>{ 18 | return axios.get('/users/login',{params:{username:username,userpass:userpass}}) 19 | } 20 | /** 21 | * 注册用户 22 | * @param user:用户名 23 | * @param pwd: 密码 24 | */ 25 | const name_reg=({username,userpass})=>{ 26 | return axios.get('/users/reg',{params:{username:username,userpass:userpass}}) 27 | } 28 | 29 | /** 30 | * 获取用户信息 31 | * @param id:用户id 32 | */ 33 | const getUserByID=({id})=>{ 34 | return axios.get('/users/getUserByID',{params:{id:id}}) 35 | } 36 | /** 37 | * 保存群组聊天记录 38 | */ 39 | const Groupmsg=({room_id,send_id,content,send_name,type,imgs,creat_time})=>{ 40 | return axios.get('/users/Groupmsg',{params:{room_id:room_id,send_id:send_id,content:content,send_name:send_name,type:type,imgs:imgs,creat_time:creat_time}}) 41 | } 42 | /** 43 | * 查询群组聊天记录 44 | */ 45 | const searchGroupmsg=({room_id,current,index})=>{ 46 | return axios.get('/users/searchGroupmsg',{params:{room_id,current,index}}) 47 | } 48 | /** 49 | * 保存私聊记录 50 | */ 51 | 52 | const Privatemsg=({content,send_uid,receive_uid,send_name,receive_name,creat_time,imgs,type})=>{ 53 | return axios.post('/users/Privatemsg',qs.stringify({ 54 | content, 55 | send_uid, 56 | receive_uid, 57 | send_name, 58 | receive_name, 59 | creat_time, 60 | imgs, 61 | type 62 | })); 63 | } 64 | /** 65 | * 查询私聊记录 66 | */ 67 | const searchPrivatemsg=({send_uid,receive_uid,current,index})=>{ 68 | return axios.post('/users/searchPrivatemsg',qs.stringify({ 69 | send_uid,receive_uid,current,index 70 | })) 71 | } 72 | /** 73 | * 查询所有好友 74 | *param uid:用户id 75 | */ 76 | const searchFriends=({uid})=>{ 77 | return axios.post('/users/searchFriends', qs.stringify({ 78 | uid:uid 79 | })) 80 | } 81 | /** 82 | * 查询所有会话 83 | *param uid:用户id 84 | */ 85 | const sFriends=({uid})=>{ 86 | return axios.post('/users/sFriends', qs.stringify({ 87 | uid:uid 88 | })) 89 | } 90 | /** 91 | * 插入会话 92 | *param key:用户id 93 | */ 94 | const insertFriends=({key,value})=>{ 95 | return axios.post('/users/insertFriends', qs.stringify({ 96 | key:key, 97 | value:value, 98 | })) 99 | } 100 | /** 101 | * 删除会话 102 | *param uid:用户id 103 | */ 104 | const delMeet=({key,index})=>{ 105 | return axios.post('/users/delMeet', qs.stringify({ 106 | key:key, 107 | index:index, 108 | })) 109 | } 110 | /** 111 | * 未读消息计数 112 | *param key:用户id 113 | */ 114 | const inrcCache=({key})=>{ 115 | return axios.post('/users/inrcCache', qs.stringify({ 116 | key:key 117 | })) 118 | } 119 | /** 120 | * 获取未读消息 121 | *param key:用户id 122 | */ 123 | const getCacheById=({key})=>{ 124 | return axios.post('/users/getCacheById', qs.stringify({ 125 | key:key 126 | })) 127 | } 128 | /** 129 | * 清空未读消息读消息 130 | *param key:用户id 131 | */ 132 | const deleteCacheById=({key})=>{ 133 | return axios.post('/users/deleteCacheById', qs.stringify({ 134 | key:key 135 | })) 136 | } 137 | /** 138 | * 上传头像 139 | *param data:图片信息 140 | */ 141 | const uploadAvatar=({data})=>{ 142 | return axios.post('/users/uploadAvatar',data) 143 | } 144 | /** 145 | * 上传聊天图片 146 | *param data:图片信息uploadimg 147 | */ 148 | const uploadimg=({data})=>{ 149 | return axios.post('/users/uploadimg',data) 150 | } 151 | /** 152 | * 发表朋友圈 153 | *param data:图片信息uploadimg 154 | */ 155 | const uploadimgs=({data})=>{ 156 | return axios.post('/users/uploadimgs',data) 157 | } 158 | /** 159 | * 查询所有动态 160 | *param current:页码 161 | *param current:每页条数 162 | */ 163 | const searchAllDynamic=({uid,current,index})=>{ 164 | return axios.post('/users/searchAllDynamic',qs.stringify({ 165 | uid,current,index 166 | })) 167 | } 168 | /** 169 | * 查询单个动态 170 | *param uid:本地用户id 171 | *param zp_id:作品id 172 | */ 173 | const searchDynamic=({uid,zp_id})=>{ 174 | return axios.post('/users/searchDynamic',qs.stringify({ 175 | uid,zp_id 176 | })) 177 | } 178 | /** 179 | * 查询所有动态前两条最新评论 180 | */ 181 | const searchPltop=({zp_id,uid})=>{ 182 | return axios.post('/users/searchPltop',qs.stringify({ 183 | zp_id,uid 184 | })) 185 | } 186 | /** 187 | * 添加评论 188 | *param zp_id:作品id 189 | *param send_id:发送者id 190 | *param headurl:头像 191 | *param content:评论内容 192 | *param replay:是否回复 0 不是 1 是 193 | *param r_name:被回复昵称 194 | *param r_id:被回复id 195 | *param r_content:被回复内容 196 | *param like_num:点赞数量 197 | */ 198 | const addComment=({zp_id,send_id,content,replay_id,replay_name,replay_content,like_num})=>{ 199 | return axios.post('/users/addComment',qs.stringify({ 200 | zp_id, 201 | send_id, 202 | content, 203 | replay_id, 204 | replay_name, 205 | replay_content, 206 | like_num 207 | })) 208 | } 209 | /** 210 | * 查询zp_id所有评论 211 | *param current:页码 212 | *param current:每页条数 213 | */ 214 | const searchComment=({zp_id,current,index,uid})=>{ 215 | return axios.post('/users/searchComment',qs.stringify({ 216 | zp_id,current,index,uid 217 | })) 218 | } 219 | /** 220 | * 添加点赞 221 | *param zp_id:作品id 222 | *param type:0(作品),1(评论) 223 | */ 224 | const addLike=({zp_id,zp_uid,user_id})=>{ 225 | return axios.post('/users/addLike',qs.stringify({ 226 | zp_id,user_id,zp_uid 227 | })) 228 | } 229 | /** 230 | * 删除点赞 231 | *param zp_id:作品id 232 | *param type:0(作品),1(评论) 233 | */ 234 | const removeLike=({zp_id,user_id})=>{ 235 | return axios.post('/users/removeLike',qs.stringify({ 236 | zp_id,user_id 237 | })) 238 | } 239 | /** 240 | * 添加点赞 241 | *param zp_id:作品id 242 | *param type:0(作品),1(评论) 243 | */ 244 | const addLikepl=({comment_id,user_id})=>{ 245 | return axios.post('/users/addLikepl',qs.stringify({ 246 | comment_id,user_id 247 | })) 248 | } 249 | /** 250 | * 删除点赞 251 | *param zp_id:作品id 252 | *param type:0(作品),1(评论) 253 | */ 254 | const ulikes=({comment_id,user_id})=>{ 255 | return axios.post('/users/ulikes',qs.stringify({ 256 | comment_id,user_id 257 | })) 258 | } 259 | /** 260 | * 添加收藏 261 | *param zp_id:作品id 262 | *param type:0(作品),1(评论) 263 | */ 264 | const addCollect=({zp_id,user_id})=>{ 265 | return axios.post('/users/addCollect',qs.stringify({ 266 | zp_id,user_id 267 | })) 268 | } 269 | /** 270 | * 删除收藏 271 | *param zp_id:作品id 272 | *param type:0(作品),1(评论) 273 | */ 274 | const removeCollect=({zp_id,user_id})=>{ 275 | return axios.post('/users/removeCollect',qs.stringify({ 276 | zp_id,user_id 277 | })) 278 | } 279 | /** 280 | * 个人中心获取数据 281 | */ 282 | const getUser=({user_id})=>{ 283 | return axios.post('/users/getUser',qs.stringify({ 284 | user_id 285 | })) 286 | } 287 | /** 288 | * 查询个人所有作品 289 | */ 290 | const getDynamic=({user_id,type})=>{ 291 | return axios.post('/users/getDynamic',qs.stringify({ 292 | user_id,type 293 | })) 294 | } 295 | /** 296 | * 查询粉丝 297 | */ 298 | const serchFans=({user_id,current,index})=>{ 299 | return axios.post('/users/serchFans',qs.stringify({ 300 | user_id,current,index 301 | })) 302 | } 303 | /** 304 | * 查询关注 305 | */ 306 | const serchFollows=({user_id,current,index})=>{ 307 | return axios.post('/users/serchFollows',qs.stringify({ 308 | user_id,current,index 309 | })) 310 | } 311 | /** 312 | * 判断是否关注 相互关注0 已关注1 未关注2 313 | */ 314 | const isFriends=({uid,fid})=>{ 315 | return axios.post('/users/isFriends',qs.stringify({ 316 | uid,fid 317 | })) 318 | } 319 | 320 | /** 321 | * 添加好友 322 | */ 323 | const addFriends=({uid,fid})=>{ 324 | return axios.post('/users/addFriends',qs.stringify({ 325 | uid,fid 326 | })) 327 | } 328 | /** 329 | * 删除好友 330 | */ 331 | const removeFriends=({uid,fid})=>{ 332 | return axios.post('/users/removeFriends',qs.stringify({ 333 | uid,fid 334 | })) 335 | } 336 | 337 | 338 | 339 | export { 340 | name_login,name_reg,Groupmsg,searchGroupmsg,searchFriends,Privatemsg, 341 | searchPrivatemsg,sFriends,insertFriends,delMeet,inrcCache,getCacheById, 342 | deleteCacheById,uploadAvatar,uploadimg,uploadimgs,searchAllDynamic, 343 | addComment,getUserByID,searchComment,addLike,removeLike,searchPltop, 344 | addLikepl,ulikes,addCollect,removeCollect,getUser,getDynamic,searchDynamic, 345 | serchFans,serchFollows,addFriends,isFriends,removeFriends 346 | 347 | } -------------------------------------------------------------------------------- /src/api/socket.js: -------------------------------------------------------------------------------- 1 | import io from 'socket.io-client'; 2 | 3 | const socket = io.connect('http://localhost:8000/'); 4 | 5 | export default socket; 6 | -------------------------------------------------------------------------------- /src/api/valid.js: -------------------------------------------------------------------------------- 1 | 2 | //用户名验证 3 | const validname=(user)=>{ 4 | var re = /^[\u4E00-\u9FA5a-zA-Z0-9_]{2,20}$/; 5 | var msg = "汉字 英文字母 数字 下划线组成,3-20位"; 6 | return re.test(user); 7 | } 8 | //密码验证 9 | const validpwd=(pwd)=>{ 10 | var re=/^[\w_-]{3,16}$/; 11 | return re.test(pwd) 12 | } 13 | 14 | export {validname,validpwd} -------------------------------------------------------------------------------- /src/assets/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/src/assets/1.jpg -------------------------------------------------------------------------------- /src/assets/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/src/assets/1.png -------------------------------------------------------------------------------- /src/assets/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/src/assets/2.jpg -------------------------------------------------------------------------------- /src/assets/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/src/assets/3.jpg -------------------------------------------------------------------------------- /src/assets/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/src/assets/4.jpg -------------------------------------------------------------------------------- /src/assets/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/src/assets/error.png -------------------------------------------------------------------------------- /src/assets/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/src/assets/logo.jpg -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/src/assets/logo.png -------------------------------------------------------------------------------- /src/components/Collection.vue: -------------------------------------------------------------------------------- 1 | 4 | 38 | 41 | -------------------------------------------------------------------------------- /src/components/Tabs.vue: -------------------------------------------------------------------------------- 1 | 27 | 30 | -------------------------------------------------------------------------------- /src/components/Upload.vue: -------------------------------------------------------------------------------- 1 | 2 | 62 | 63 | 328 | 329 | 448 | -------------------------------------------------------------------------------- /src/components/bubble.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 138 | -------------------------------------------------------------------------------- /src/components/button-follow.vue: -------------------------------------------------------------------------------- 1 | 26 | 73 | 97 | -------------------------------------------------------------------------------- /src/components/head.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 33 | 34 | -------------------------------------------------------------------------------- /src/components/input.vue: -------------------------------------------------------------------------------- 1 | 16 | 47 | 48 | -------------------------------------------------------------------------------- /src/components/item.vue: -------------------------------------------------------------------------------- 1 | 91 | 92 | 173 | 207 | -------------------------------------------------------------------------------- /src/components/like.vue: -------------------------------------------------------------------------------- 1 | 4 | 61 | 77 | -------------------------------------------------------------------------------- /src/components/loadBottom.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 20 | 21 | -------------------------------------------------------------------------------- /src/components/loadItem.vue: -------------------------------------------------------------------------------- 1 | 31 | 125 | 171 | -------------------------------------------------------------------------------- /src/components/loadTop.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /src/components/message.vue: -------------------------------------------------------------------------------- 1 | 22 | 31 | 133 | -------------------------------------------------------------------------------- /src/components/pmessage.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 22 | 23 | -------------------------------------------------------------------------------- /src/components/sendInput.vue: -------------------------------------------------------------------------------- 1 | 39 | 40 | 168 | 169 | -------------------------------------------------------------------------------- /src/components/tool/Global.vue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | import store from './vuex/store' 7 | import VueSocketio from 'vue-socket.io'; 8 | import socketio from 'socket.io-client'; 9 | import 'mint-ui/lib/style.css'; 10 | import socket from '@/api/socket.js'; 11 | import mintui from 'mint-ui'; 12 | 13 | import {insertFriends,sFriends,inrcCache,getCacheById} from '@/api/api.js'; 14 | 15 | import global_ from '@/components/tool/Global'; 16 | Vue.prototype.GLOBAL = global_; 17 | 18 | Vue.config.productionTip = false; 19 | 20 | socket.on('connect', () => {console.log('连接成功!');}) 21 | socket.emit('begin',store.state.userinfo.userinfo.id); 22 | socket.on('logins', (obj) => { 23 | store.commit('setindex'); 24 | store.commit('addRoomDetailInfos',obj); 25 | }) 26 | //通知新消息 27 | socket.on('chat_m', (obj) => { 28 | //对方id和本地id 29 | let k='unread_'+obj.send_uid+'_'+obj.receive_uid; 30 | inrcCache({key:k}).then(res=>{}); 31 | let uid=JSON.parse(localStorage.getItem('userinfo'))[0].id; 32 | //解构赋值 33 | let {content,creat_time,receive_name,receive_uid,send_name,send_uid,imgs,type,avatar}= 34 | { 35 | content:obj.content,creat_time:obj.creat_time,receive_name:obj.send_name,receive_uid:obj.send_uid,send_name:obj.receive_name,send_uid:obj.receive_uid,imgs:obj.imgs,type:obj.type, 36 | avatar:obj.avatar, 37 | } 38 | getCacheById({key:k}).then(res=>{//获取最新未读消息数 39 | let unread=res.data.data; 40 | let objs={content,creat_time,receive_name,receive_uid,send_name,send_uid,imgs,type,unread:unread,avatar} 41 | //存入/更新redis数据列表 42 | insertFriends({key:uid,value:JSON.stringify(objs)}).then(res=>{ 43 | let arr=store.state.userinfo.mslist; 44 | //置顶消息 45 | arr.map((i,d,arr)=>{ 46 | if(i.receive_name==objs.receive_name){ 47 | arr.splice(d,1)[0]; 48 | } 49 | }) 50 | store.state.userinfo.mslist.unshift(objs); 51 | store.dispatch('updataMslist'); 52 | }) 53 | }) 54 | }); 55 | Vue.use(VueSocketio, socketio('http://localhost:8000/')); 56 | Vue.use(mintui)//全局引入 57 | /* eslint-disable no-new */ 58 | new Vue({ 59 | el: '#app', 60 | router, 61 | store, 62 | components: { App }, 63 | template: '' 64 | }) 65 | 66 | -------------------------------------------------------------------------------- /src/page/main/Publish.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 80 | 81 | 84 | 85 | -------------------------------------------------------------------------------- /src/page/main/addFriend.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 26 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /src/page/main/avatar.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 130 | 142 | -------------------------------------------------------------------------------- /src/page/main/chat.vue: -------------------------------------------------------------------------------- 1 | 46 | 47 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /src/page/main/chatlist.vue: -------------------------------------------------------------------------------- 1 | 59 | 130 | 131 | 132 | 152 | 153 | -------------------------------------------------------------------------------- /src/page/main/chats.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 145 | 146 | -------------------------------------------------------------------------------- /src/page/main/comment.vue: -------------------------------------------------------------------------------- 1 | 65 | 240 | 375 | -------------------------------------------------------------------------------- /src/page/main/diaLog.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 113 | 114 | 134 | 135 | -------------------------------------------------------------------------------- /src/page/main/dynamicInfo.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/page/main/fansList.vue: -------------------------------------------------------------------------------- 1 | 27 | 80 | 136 | -------------------------------------------------------------------------------- /src/page/main/followList.vue: -------------------------------------------------------------------------------- 1 | 26 | 78 | 134 | -------------------------------------------------------------------------------- /src/page/main/index.vue: -------------------------------------------------------------------------------- 1 | 27 | 84 | 88 | -------------------------------------------------------------------------------- /src/page/main/login.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 97 | 98 | -------------------------------------------------------------------------------- /src/page/main/my.vue: -------------------------------------------------------------------------------- 1 | 72 | 146 | 357 | -------------------------------------------------------------------------------- /src/page/main/reg.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 97 | 98 | -------------------------------------------------------------------------------- /src/page/main/seting.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 47 | 61 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Index from '@/page/main/index' 4 | import Login from '@/page/main/login' 5 | import Chats from '@/page/main/chats' 6 | import Chat from '@/page/main/chat' 7 | import Reg from '@/page/main/reg' 8 | import store from '@/vuex/store' 9 | import Chatlist from '@/page/main/chatlist' 10 | import addFriend from '@/page/main/addFriend' 11 | import diaLog from '@/page/main/diaLog' 12 | import my from '@/page/main/my' 13 | import avatar from '@/page/main/avatar' 14 | import seting from '@/page/main/seting' 15 | import Publish from '@/page/main/Publish' 16 | import comment from '@/page/main/comment' 17 | import fansList from '@/page/main/fansList' 18 | import followList from '@/page/main/followList' 19 | import dynamicInfo from '@/page/main/dynamicInfo' 20 | 21 | Vue.use(Router) 22 | 23 | let router = new Router({ 24 | routes: [ 25 | {//首页 26 | path: '/', 27 | name: 'Index', 28 | component: Index, 29 | meta:{ 30 | requireAuth:true, 31 | footab:true, 32 | } 33 | },{//发表评论、评论列表 34 | path: '/comment', 35 | name: 'comment', 36 | component: comment, 37 | meta:{ 38 | requireAuth:true, 39 | footab:false, 40 | } 41 | },{//登录 42 | path:'/Login', 43 | name:'Login', 44 | component:Login, 45 | meta:{ 46 | requireAuth:false, 47 | footab:false, 48 | } 49 | },{//群聊 50 | path:'/Chats', 51 | name:'Chats', 52 | component:Chats, 53 | meta:{ 54 | requireAuth:true, 55 | footab:false, 56 | } 57 | },{//私聊 58 | path:'/Chat', 59 | name:'Chat', 60 | component:Chat, 61 | meta:{ 62 | requireAuth:true, 63 | footab:false, 64 | } 65 | },{//注册 66 | path:'/Reg', 67 | name:'Reg', 68 | component:Reg, 69 | meta:{ 70 | requireAuth:false, 71 | footab:false, 72 | } 73 | },{//好友列表 74 | path:'/Chatlist', 75 | name:'Chatlist', 76 | component:Chatlist, 77 | meta:{ 78 | requireAuth:true, 79 | footab:true, 80 | } 81 | },{//添加好友 82 | path:'/addFriend', 83 | name:'addFriend', 84 | component:addFriend, 85 | meta:{ 86 | requireAuth:true, 87 | footab:false, 88 | } 89 | },{//发布消息 90 | path:'/Publish', 91 | name:'Publish', 92 | component:Publish, 93 | meta:{ 94 | requireAuth:true, 95 | footab:false, 96 | } 97 | },{//会话 98 | path:'/diaLog', 99 | name:'diaLog', 100 | component:diaLog, 101 | meta:{ 102 | requireAuth:true, 103 | footab:true, 104 | } 105 | },{//我的个人中心 106 | path:'/my', 107 | name:'my', 108 | component:my, 109 | meta:{ 110 | requireAuth:true, 111 | footab:true, 112 | } 113 | },{//修改头像 114 | path:'/avatar', 115 | name:'avatar', 116 | component:avatar, 117 | meta:{ 118 | requireAuth:true, 119 | footab:false, 120 | } 121 | },{//设置 122 | path:'/seting', 123 | name:'seting', 124 | component:seting, 125 | meta:{ 126 | requireAuth:true, 127 | footab:false, 128 | } 129 | },{//粉丝列表 130 | path:'/fansList', 131 | name:'fansList', 132 | component:fansList, 133 | meta:{ 134 | requireAuth:true, 135 | footab:false, 136 | } 137 | },{//关注列表 138 | path:'/followList', 139 | name:'followList', 140 | component:followList, 141 | meta:{ 142 | requireAuth:true, 143 | footab:false, 144 | } 145 | }, 146 | {//作品详情 147 | path:'/dynamicInfo', 148 | name:'dynamicInfo', 149 | component:dynamicInfo, 150 | meta:{ 151 | requireAuth:true, 152 | footab:false, 153 | } 154 | }, 155 | ] 156 | }) 157 | //判断没有登录跳转登录 158 | router.beforeEach((to,from,next)=>{ 159 | //判断是否需要显示底部导航 160 | store.commit('changetab',to.meta.footab) 161 | if(to.meta.requireAuth){//判断路由是否需要登录 162 | if(localStorage.getItem('userinfo')!=null){ 163 | store.state.userinfo.islogin=true; 164 | }else{ 165 | store.state.userinfo.islogin=false; 166 | next({ 167 | path:"/Login", 168 | query: {redirect: to.fullPath}//将目的路由地址存入login的query中 169 | }) 170 | } 171 | } 172 | next(); 173 | }) 174 | export default router; -------------------------------------------------------------------------------- /src/utils/collection.js: -------------------------------------------------------------------------------- 1 | const collection = { 2 | //格式化时间 3 | fomatDate: (time) => { 4 | var now = new Date(); 5 | var date = new Date(time); 6 | //计算时间间隔,单位为分钟 7 | var inter = parseInt((now.getTime() - date.getTime()) / 1000 / 60); 8 | if (inter == 0) { 9 | return "现在"; 10 | } 11 | //多少分钟前 12 | else if (inter < 60) { 13 | return inter.toString() + "分钟"; 14 | } 15 | //多少小时前 16 | else if (inter < 60 * 24) { 17 | return parseInt(inter / 60).toString() + "小时"; 18 | } 19 | //本年度内,日期不同,取日期+时间 格式如 06-13 22:11 20 | else if (now.getFullYear() == date.getFullYear()) { 21 | return (date.getMonth() + 1).toString() + "-" + 22 | date.getDate().toString() + " " + 23 | date.getHours() + ":" + 24 | date.getMinutes(); 25 | } else { 26 | return date.getFullYear().toString().substring(2, 3) + "-" + 27 | (date.getMonth() + 1).toString() + "-" + 28 | date.getDate().toString() + " " + 29 | date.getHours() + ":" + 30 | date.getMinutes(); 31 | } 32 | }, 33 | } 34 | module.exports = collection; 35 | -------------------------------------------------------------------------------- /src/vuex/modules/userinfo.js: -------------------------------------------------------------------------------- 1 | //用户登录状态管理 2 | import {searchGroupmsg,searchPrivatemsg,sFriends,delMeet,deleteCacheById,uploadimg} from '@/api/api.js'; 3 | import { Indicator ,Toast} from 'mint-ui'; 4 | const state={ 5 | footnav:false,//底部导航 6 | islogin:false, //是否登录 7 | userinfo:{ 8 | id:window.localStorage.userinfo==undefined?'':JSON.parse(window.localStorage.userinfo)[0].id, 9 | }, 10 | // 存放房间信息 11 | roomdetail: { 12 | id: '', 13 | users: {}, 14 | infos: [], 15 | index:10, 16 | }, 17 | // 存放聊天列表信息 18 | mslist:'', 19 | count:'', 20 | }; 21 | const getters={ 22 | getInfos: state => state.roomdetail.infos, 23 | getMslist:state=> state.mslist 24 | }; 25 | const mutations={ 26 | changetab(e,f){ 27 | state.footnav=f; 28 | }, 29 | changelogin(state,flag){ 30 | state.islogin=flag 31 | }, 32 | setnullindex(data){ 33 | state.roomdetail.index=10; 34 | }, 35 | setindex(data){ 36 | state.roomdetail.index++; 37 | }, 38 | setUserInfo(data) { 39 | state.userinfo.id = data; 40 | }, 41 | addRoomDetailInfos(state, data) { 42 | state.roomdetail.infos.push(data); 43 | }, 44 | addRoomDefatilInfosHis(state, data) { 45 | const list = state.roomdetail.infos; 46 | state.roomdetail.infos = data.concat(list); 47 | }, 48 | setRoomDetailInfos(state) { 49 | state.roomdetail.infos = [] 50 | }, 51 | //聊天列表 52 | setMslist(state,data){ 53 | state.mslist=data; 54 | }, 55 | delMslistitem(data,index){ 56 | state.mslist.splice(index,1)[0]; 57 | } 58 | }; 59 | 60 | const actions={ 61 | changelogin({commit}){ 62 | commit('changelogin',true); 63 | }, 64 | getAllMessHistory({commit},data){ 65 | searchGroupmsg({room_id:data.roomid,current:data.current,index:data.index}).then(res=>{ 66 | if(res.data.status==1){ 67 | commit('addRoomDefatilInfosHis', res.data.data); 68 | } 69 | }) 70 | }, 71 | getPrivatehistory({commit},data){//私聊 72 | searchPrivatemsg({send_uid:data.send_uid,receive_uid:data.receive_uid,current:data.current,index:data.index}).then(res=>{ 73 | commit('addRoomDefatilInfosHis', res.data.data); 74 | }) 75 | }, 76 | updataMslist({commit}){//更新会话 过滤重复会话/删除 77 | sFriends({uid:state.userinfo.id}).then(res=>{ 78 | var arr=res.data.data; 79 | arr.map((i,d)=>{ 80 | arr[d]=JSON.parse(i); 81 | let lone=arr[0].receive_uid; 82 | if(lone==arr[d].receive_uid&&d!=0){ 83 | delMeet({key:state.userinfo.id,index:d}).then(res=>{}) 84 | } 85 | }) 86 | }); 87 | }, 88 | deleteCacheById({commit},data){//删除未读消息 89 | let keys='unread_'+data+'_'+state.userinfo.id 90 | deleteCacheById({key:keys}).then(res=>{}) 91 | }, 92 | uploadImg({commit},data){ 93 | uploadimg({data:data}).then((res)=>{ 94 | if(res.status==200){ 95 | Toast(res.data.msg); 96 | }else{ 97 | Toast(res.data.msg); 98 | } 99 | }) 100 | } 101 | } 102 | 103 | export default { 104 | state, 105 | getters, 106 | mutations, 107 | actions 108 | } 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /src/vuex/store.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuex from 'vuex'; 3 | import userinfo from './modules/userinfo' 4 | 5 | Vue.use(Vuex); 6 | 7 | export default new Vuex.Store({ 8 | modules:{ 9 | userinfo 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/static/.gitkeep -------------------------------------------------------------------------------- /static/css/common.css: -------------------------------------------------------------------------------- 1 | html{ 2 | background:#f0f0f0; 3 | height:100%; 4 | } 5 | #app{height:100%;background:#fff;} 6 | .router-fade-enter-active, .router-fade-leave-active { 7 | transition: opacity .2s; 8 | } 9 | .router-fade-enter, .router-fade-leave-active { 10 | opacity: 0; 11 | } 12 | .z{float:left;} 13 | .y{float:right;} 14 | .clear{clear:both;} 15 | /* 清除浮动 */ 16 | .cl:before, .cl:after{ content:" "; display: table } 17 | .cl:after{ clear: both } 18 | .clb{clear:both;} 19 | .cl { *zoom: 1 } 20 | /*灰色边框*/ 21 | .bt_top{border-top:1px solid #e4e4e4;} 22 | /*淡入淡出 放大缩小*/ 23 | .fade-enter-active{transition: opacity .2s;} 24 | .fade-leave-active {transition: opacity .0s;} 25 | .fade-enter,.fade-leave-to {opacity: 0;} 26 | .fade-enter-active{animation:fade-in .2s;} 27 | .fade-leave-active {animation: fade-in .1s reverse;} 28 | @keyframes fade-in { 29 | 0% { 30 | transform: scale(0); 31 | } 32 | 100% { 33 | transform: scale(1); 34 | } 35 | } 36 | /*旋转45度*/ 37 | .rotate45{ 38 | transform:rotate(45deg); 39 | transition: all .2s; 40 | } 41 | /*点赞效果*/ 42 | .love{animation: fade-in .5s;} 43 | .loves{animation: fade-ins .5s;} 44 | @keyframes fade-in { 45 | 0% { 46 | transform: scale(1); 47 | } 48 | 50% { 49 | transform: scale(1.2); 50 | } 51 | 100% { 52 | transform: scale(1); 53 | } 54 | } 55 | @keyframes fade-ins { 56 | 0% { 57 | transform: scale(1); 58 | } 59 | 50% { 60 | transform: scale(1.1); 61 | } 62 | 100% { 63 | transform: scale(1); 64 | } 65 | } 66 | 67 | body::-webkit-scrollbar{display:none} 68 | .btn{background:#3897f0;width:100%;outline: none;border:none;text-align: center;color:#fff;line-height:1.2rem;height:1.2rem;border-radius:0.1rem;opacity:0.7;font-size:0.4rem;letter-spacing:1px;} 69 | .btn.on{opacity:1;transition:all .3s;} 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /static/css/reset.css: -------------------------------------------------------------------------------- 1 | html { 2 | overflow-x:auto; 3 | overflow-y:scroll; 4 | } 5 | body, dl, dt, dd, ul, ol, li, pre, form, fieldset,button,input, p, blockquote, th, td { 6 | font-weight:400; 7 | margin:0; 8 | padding:0; 9 | border: none; 10 | outline: none; 11 | background: none; 12 | list-style: none; 13 | text-align:left; 14 | } 15 | h1, h2, h3, h4, h4, h5 { 16 | margin:0; 17 | padding:0; 18 | } 19 | body { 20 | background-color:#FFFFFF; 21 | color:#262626; 22 | font-family:Helvetica,Arial,sans-serif; 23 | font-size:0.4rem; 24 | text-align:left; 25 | } 26 | select { 27 | font-size:12px; 28 | } 29 | table { 30 | border-collapse:collapse; 31 | } 32 | fieldset, img { 33 | border:0 none; 34 | } 35 | fieldset { 36 | margin:0; 37 | padding:0; 38 | } 39 | fieldset p { 40 | margin:0; 41 | padding:0 0 0 8px; 42 | } 43 | legend { 44 | display:none; 45 | } 46 | address, caption, em, strong, th, i { 47 | font-style:normal; 48 | font-weight:400; 49 | } 50 | table caption { 51 | margin-left:-1px; 52 | } 53 | hr { 54 | border-bottom:1px solid #FFFFFF; 55 | border-top:1px solid #E4E4E4; 56 | border-width:1px 0; 57 | clear:both; 58 | height:2px; 59 | margin:5px 0; 60 | overflow:hidden; 61 | } 62 | ol, ul { 63 | list-style-image:none; 64 | list-style-position:outside; 65 | list-style-type:none; 66 | } 67 | caption, th { 68 | text-align:left; 69 | } 70 | q:before, q:after, blockquote:before, blockquote:after { 71 | content:””; 72 | } 73 | body { 74 | width:100%; 75 | height:100%; 76 | overflow: auto; 77 | overflow-x:hidden; 78 | text-align:left; 79 | margin:0; 80 | padding:0; 81 | } -------------------------------------------------------------------------------- /static/iconfont/iconfont.css: -------------------------------------------------------------------------------- 1 | @font-face {font-family: "iconfont"; 2 | src: url('iconfont.eot?t=1563158827914'); /* IE9 */ 3 | src: url('iconfont.eot?t=1563158827914#iefix') format('embedded-opentype'), /* IE6-IE8 */ 4 | url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAA/4AAsAAAAAHogAAA+pAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCGTgqqAKI/ATYCJANsCzgABCAFhG0Hgk4bxRkzozaTs1JO9n9K4IZM/BvyqhTLMCGnJmMSSYP6FtedsDp6xEdstRilKPTBq9iwx93Qm20vLbaCaVzJfJ2/M81fdD+XGUoJz/P3tXPf8mfb9jQsjOKAA1tWijDAQMrSwjsU8Fzxc/7eXYLkBQiihU8IZin1pBKkLZKgyasYopV8+E3bQOYPoZp6EAtVSk2Qavg0VCyhoppvxuMBuF++n3iFFdbb8HRROMy0L7hoP13wEDsA4N+t8VBri6+5uih5CKrNzwf+D7alZPOk9STAVWzi+uyGzETCF75WNUEMdolcYoUYLRuONzSo/x4AIEB+P51ft7czLNGx67fZd0oOuAgEaz8tgID5pv5swxjD/RXmwRaKr6hH+bskv+R6Xev+zt9hpsyENYbjIUHO9O/ulLFUi1pLOJBjKTRKoSVCeSC0rp02/r1lER6GsY3pBjtvkAz/uzsERDXNyfzi+gY7DrEKXOHy7GSPnc7LUQaLsCOwSRgj9yTC4ZuxgHfx08s/s4GB4SPIPV0dLxySfPm+nvak3YzupJQfBXaJwII5cDCpba3Ayngukqid1vmBvjbKpfsysspaugYmFu06NvXqw/f3ZVnXZ6ivIgNTL77X5WrrSLjoG5sKzLr4fcuQkpZREVHO2v/G82KKSpKi4gpEQohl5AWycqqQFDRTHCDLFlShngApaACQhoYsGShABVoCiEDLAGVoHSAMb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IEJLLWWTlxn/wDq8cqKQyhmYD6KYNhkVrbuLkkeUk+faVnfEO6LQCvM10du3VAPzKelB7q8ytCvOStLg7V39IErfZkn8yhUkMoWNHcMX+dkWlcZJHz1mbJyk+UJxaNx4s0zCU+KiQqqeEbMYv0I641TJgJdHCEWI/60lUSN/h1d0GVEEd6UyzER6w5mTqDPqROoOZk4HF/TsifFG5wKYkVbLLYKqlk56RodOYfT5ubMopE+otYmo2riTIYCS38aaxhBRzR+A/6iKfaByEyg+v653EufRlHY+9LKEnYgVMQO1Yq12kLSoYOGkDsyDbZ4wd7HhzAW6ZMJ0HwcDAAA=') format('woff2'), 5 | url('iconfont.woff?t=1563158827914') format('woff'), 6 | url('iconfont.ttf?t=1563158827914') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ 7 | url('iconfont.svg?t=1563158827914#iconfont') format('svg'); /* iOS 4.1- */ 8 | } 9 | 10 | .iconfont { 11 | font-family: "iconfont" !important; 12 | font-size: 16px; 13 | font-style: normal; 14 | -webkit-font-smoothing: antialiased; 15 | -moz-osx-font-smoothing: grayscale; 16 | } 17 | 18 | .iconshezhi:before { 19 | content: "\e660"; 20 | } 21 | 22 | .icondianzan1:before { 23 | content: "\e6ac"; 24 | } 25 | 26 | .iconjia:before { 27 | content: "\e6a9"; 28 | } 29 | 30 | .iconfanhui:before { 31 | content: "\e61f"; 32 | } 33 | 34 | .iconwuuiconxiangjifangda:before { 35 | content: "\e620"; 36 | } 37 | 38 | .iconyiguanzhu:before { 39 | content: "\e76c"; 40 | } 41 | 42 | .iconguanbi:before { 43 | content: "\e6a0"; 44 | } 45 | 46 | .iconxiaoxi:before { 47 | content: "\e61e"; 48 | } 49 | 50 | .iconhome:before { 51 | content: "\e612"; 52 | } 53 | 54 | .iconsousuo:before { 55 | content: "\e62d"; 56 | } 57 | 58 | .iconziyuan:before { 59 | content: "\e621"; 60 | } 61 | 62 | .icongengduo:before { 63 | content: "\e63b"; 64 | } 65 | 66 | .iconfriend:before { 67 | content: "\e666"; 68 | } 69 | 70 | .iconshangyige:before { 71 | content: "\e62c"; 72 | } 73 | 74 | .iconQQ:before { 75 | content: "\e600"; 76 | } 77 | 78 | .iconright-arr-gary:before { 79 | content: "\e601"; 80 | } 81 | 82 | .iconhuxiangguanzhu:before { 83 | content: "\e602"; 84 | } 85 | 86 | .iconyuyin:before { 87 | content: "\e773"; 88 | } 89 | 90 | .iconweixin1:before { 91 | content: "\e78b"; 92 | } 93 | 94 | .iconfangkuaizhanshi:before { 95 | content: "\e6e7"; 96 | } 97 | 98 | .icondianzan:before { 99 | content: "\e646"; 100 | } 101 | 102 | .icontupianimgyulan:before { 103 | content: "\e624"; 104 | } 105 | 106 | .iconclose-line:before { 107 | content: "\e62b"; 108 | } 109 | 110 | .iconshoucang:before { 111 | content: "\e61a"; 112 | } 113 | 114 | .iconshezhi1:before { 115 | content: "\e611"; 116 | } 117 | 118 | .iconxiayige-copy:before { 119 | content: "\e78c"; 120 | } 121 | 122 | -------------------------------------------------------------------------------- /static/iconfont/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/static/iconfont/iconfont.eot -------------------------------------------------------------------------------- /static/iconfont/iconfont.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Created by iconfont 9 | 10 | 11 | 12 | 13 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /static/iconfont/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/static/iconfont/iconfont.ttf -------------------------------------------------------------------------------- /static/iconfont/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/static/iconfont/iconfont.woff -------------------------------------------------------------------------------- /static/iconfont/iconfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aopama/websocket/c4f8bad9111875f67d4cf03306d278daadbac30f/static/iconfont/iconfont.woff2 -------------------------------------------------------------------------------- /static/js/common.js: -------------------------------------------------------------------------------- 1 | (function(num){ 2 | function remFn() { 3 | var c = document.documentElement.clientWidth / num; 4 | if(c<64){ 5 | document.documentElement.style.fontSize = c + 'px'; 6 | }else{ 7 | document.documentElement.style.fontSize = '75px'; 8 | } 9 | } 10 | window.addEventListener('resize',remFn,false); 11 | remFn(); 12 | })(10); 13 | 14 | // 错误图片处理 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | --------------------------------------------------------------------------------