├── sign ├── .eslintignore ├── src │ ├── pages │ │ ├── sign │ │ │ ├── sign │ │ │ │ ├── main.json │ │ │ │ ├── main.js │ │ │ │ └── index.vue │ │ │ ├── add │ │ │ │ ├── main.json │ │ │ │ ├── main.js │ │ │ │ └── index.vue │ │ │ ├── search │ │ │ │ ├── main.json │ │ │ │ ├── main.js │ │ │ │ └── index.vue │ │ │ ├── list │ │ │ │ ├── main.json │ │ │ │ ├── main.js │ │ │ │ └── index.vue │ │ │ └── detail │ │ │ │ ├── main.js │ │ │ │ └── index.vue │ │ ├── my │ │ │ ├── main.json │ │ │ ├── main.js │ │ │ └── index.vue │ │ └── index │ │ │ ├── main.js │ │ │ └── index.vue │ ├── store │ │ ├── modules │ │ │ ├── index.js │ │ │ ├── user.js │ │ │ ├── interview.js │ │ │ └── sign.js │ │ └── index.js │ ├── main.js │ ├── app.json │ ├── api │ │ └── index.js │ ├── utils │ │ ├── distance.js │ │ ├── request.js │ │ └── index.js │ ├── App.vue │ └── components │ │ ├── signList.vue │ │ └── map.vue ├── config │ ├── prod.env.js │ ├── dev.env.js │ └── index.js ├── static │ ├── images │ │ ├── add.png │ │ ├── job.png │ │ ├── logo.png │ │ ├── my.png │ │ ├── location.png │ │ ├── location.svg │ │ └── arrow.svg │ └── libs │ │ └── qqmap-wx-jssdk.js ├── .postcssrc.js ├── .editorconfig ├── project.swan.json ├── package.swan.json ├── .gitignore ├── index.html ├── build │ ├── dev-client.js │ ├── vue-loader.conf.js │ ├── build.js │ ├── check-versions.js │ ├── webpack.dev.conf.js │ ├── utils.js │ ├── dev-server.js │ ├── webpack.prod.conf.js │ └── webpack.base.conf.js ├── .babelrc ├── .eslintrc.js ├── README.md ├── project.config.json └── package.json └── .gitignore /sign/.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | -------------------------------------------------------------------------------- /sign/src/pages/sign/sign/main.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /sign/src/pages/my/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "个人中心" 3 | } 4 | -------------------------------------------------------------------------------- /sign/config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /sign/src/pages/sign/add/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "添加面试" 3 | } 4 | -------------------------------------------------------------------------------- /sign/src/pages/sign/search/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "选择面试地址" 3 | } 4 | -------------------------------------------------------------------------------- /sign/static/images/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emperorY/Sign/HEAD/sign/static/images/add.png -------------------------------------------------------------------------------- /sign/static/images/job.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emperorY/Sign/HEAD/sign/static/images/job.png -------------------------------------------------------------------------------- /sign/static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emperorY/Sign/HEAD/sign/static/images/logo.png -------------------------------------------------------------------------------- /sign/static/images/my.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emperorY/Sign/HEAD/sign/static/images/my.png -------------------------------------------------------------------------------- /sign/static/images/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emperorY/Sign/HEAD/sign/static/images/location.png -------------------------------------------------------------------------------- /sign/src/pages/sign/list/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "面试列表", 3 | "onReachBottomDistance": 30 4 | } 5 | -------------------------------------------------------------------------------- /sign/src/pages/my/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | 5 | const app = new Vue(App) 6 | app.$mount() 7 | -------------------------------------------------------------------------------- /sign/src/pages/sign/search/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /sign/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-mpvue-wxss": {} 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /sign/config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /sign/.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 | -------------------------------------------------------------------------------- /sign/project.swan.json: -------------------------------------------------------------------------------- 1 | { 2 | "appid": "testappid", 3 | "setting": { 4 | "urlCheck": false 5 | }, 6 | "condition": { 7 | "swan": { 8 | "current": -1, 9 | "list": [] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /sign/package.swan.json: -------------------------------------------------------------------------------- 1 | { 2 | "appid": "wx3375420e2c184d34", 3 | "setting": { 4 | "urlCheck": false 5 | }, 6 | "condition": { 7 | "swan": { 8 | "current": -1, 9 | "list": [] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /sign/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | server/ 5 | npm-debug.log* 6 | yarn-debug.log* 7 | yarn-error.log* 8 | 9 | # Editor directories and files 10 | .idea 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | -------------------------------------------------------------------------------- /sign/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | sign 6 | 7 | 8 |
9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /sign/build/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 4 | 5 | hotClient.subscribe(function (event) { 6 | if (event.action === 'reload') { 7 | window.location.reload() 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /sign/src/pages/index/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /sign/src/pages/sign/add/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /sign/src/pages/sign/detail/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /sign/src/pages/sign/list/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /sign/src/pages/sign/sign/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /sign/.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": ["transform-runtime"], 12 | "env": { 13 | "test": { 14 | "presets": ["env", "stage-2"], 15 | "plugins": ["istanbul"] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /sign/static/images/location.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sign/src/store/modules/index.js: -------------------------------------------------------------------------------- 1 | const state = { 2 | count: 1 3 | }; 4 | 5 | const getters = { 6 | 7 | }; 8 | 9 | // 同步改变 10 | const mutations = { 11 | changeCount(state, payload){ 12 | console.log('state...', state, payload); 13 | payload === '+'?state.count++: state.count--; 14 | } 15 | }; 16 | 17 | // 异步改变 18 | const actions = { 19 | 20 | }; 21 | 22 | export default { 23 | // 命名空间 24 | namespaced: true, 25 | state, 26 | getters, 27 | mutations, 28 | actions 29 | } 30 | -------------------------------------------------------------------------------- /sign/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | // 引入store 4 | import store from '@/store/index' 5 | // 引入QQMap 6 | import QQMapWx from '../static/libs/qqmap-wx-jssdk.js' 7 | 8 | Vue.config.productionTip = false 9 | App.mpType = 'app' 10 | 11 | // 挂载store到原型链上 12 | Vue.prototype.$store = store; 13 | // 挂载QQMap到原型上 14 | var $map = new QQMapWx({ 15 | key: 'X7RBZ-MMOKR-UQEWJ-WSCXC-IVXVK-IFFLL' 16 | }) 17 | Vue.prototype.$map = $map; 18 | 19 | const app = new Vue(App) 20 | app.$mount() 21 | -------------------------------------------------------------------------------- /sign/static/images/arrow.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sign/src/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/main", 4 | "pages/my/main", 5 | "pages/sign/add/main", 6 | "pages/sign/search/main", 7 | "pages/sign/list/main", 8 | "pages/sign/detail/main", 9 | "pages/sign/sign/main" 10 | ], 11 | "permission": { 12 | "scope.userLocation": { 13 | "desc": "你的位置信息将用于小程序地图定位" 14 | } 15 | }, 16 | "window": { 17 | "backgroundTextStyle": "light", 18 | "navigationBarBackgroundColor": "#fff", 19 | "navigationBarTitleText": "一面而就", 20 | "navigationBarTextStyle": "black" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sign/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var config = require('../config') 3 | // var isProduction = process.env.NODE_ENV === 'production' 4 | // for mp 5 | var isProduction = true 6 | 7 | module.exports = { 8 | loaders: utils.cssLoaders({ 9 | sourceMap: isProduction 10 | ? config.build.productionSourceMap 11 | : config.dev.cssSourceMap, 12 | extract: isProduction 13 | }), 14 | transformToRequire: { 15 | video: 'src', 16 | source: 'src', 17 | img: 'src', 18 | image: 'xlink:href' 19 | }, 20 | fileExt: config.build.fileExt 21 | } 22 | -------------------------------------------------------------------------------- /sign/src/store/modules/user.js: -------------------------------------------------------------------------------- 1 | import {decrypt} from '@/api/index'; 2 | 3 | const state = { 4 | phone: '' 5 | } 6 | 7 | const mutations = { 8 | updateState(state, payload){ 9 | for (let key in payload){ 10 | state[key] = payload[key]+'' 11 | } 12 | } 13 | } 14 | 15 | 16 | const actions = { 17 | async getPhoneNumber({commit}, payload){ 18 | return new Promise(async (resolve, reject)=>{ 19 | let data = await decrypt(payload); 20 | commit('updateState', {phone: data.data.phoneNumber}); 21 | resolve(data); 22 | }) 23 | } 24 | } 25 | 26 | 27 | export default { 28 | namespaced: true, 29 | state, 30 | mutations, 31 | actions 32 | } 33 | -------------------------------------------------------------------------------- /sign/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuex from 'vuex'; 3 | // import createLogger from 'vuex/dist/logger'; 4 | 5 | // 挂载modules 6 | import index from './modules/index' 7 | import interview from './modules/interview' 8 | import sign from './modules/sign' 9 | import user from './modules/user' 10 | 11 | Vue.use(Vuex); 12 | 13 | export default new Vuex.Store({ 14 | modules: { 15 | sign, 16 | user, 17 | index, 18 | interview 19 | }, 20 | state: { 21 | info: {} // 用户信息 22 | }, 23 | mutations: { 24 | // 更新全局的state 25 | updateState(state, payload){ 26 | state.info = payload; 27 | } 28 | }, 29 | // plugins: [createLogger()] 30 | }) 31 | -------------------------------------------------------------------------------- /sign/src/api/index.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | // 登陆接口 4 | export let login = code=>{ 5 | return request.post('/user/code2session', { 6 | code 7 | }) 8 | } 9 | 10 | // 添加面试 11 | export let addSign = params=>{ 12 | return request.post('/sign', params); 13 | } 14 | 15 | // 获取面试列表 16 | export let getSignList = params=>{ 17 | return request.get('/sign', params); 18 | } 19 | 20 | // 获取面试详情 21 | export let getSignDetail = id=>{ 22 | return request.get('/sign/'+id); 23 | } 24 | 25 | // 更新面试状态 26 | export let updateSignDetail = (id, params)=>{ 27 | return request.put('/sign/'+id, params); 28 | } 29 | 30 | // 解密数据 31 | export let decrypt = params=>{ 32 | return request.post('/user/decrypt', params) 33 | } 34 | -------------------------------------------------------------------------------- /sign/src/store/modules/interview.js: -------------------------------------------------------------------------------- 1 | import {addSign} from '@/api/index'; 2 | 3 | const state = { 4 | list: [], 5 | current: { 6 | company: '', 7 | phone: '', 8 | address: '', 9 | description: '' 10 | } 11 | } 12 | 13 | const mutations = { 14 | updateState(state, payload){ 15 | state.current = {...state.current, ...payload}; 16 | } 17 | } 18 | 19 | 20 | const actions = { 21 | async submit(state, {...payload}){ 22 | return new Promise(async (resolve, reject)=>{ 23 | // 填充经纬度 24 | payload.latitude = payload.address.location.lat; 25 | payload.longitude = payload.address.location.lng; 26 | // 序列号地址 27 | payload.address = JSON.stringify(payload.address); 28 | let result = await addSign(payload); 29 | resolve(result); 30 | }) 31 | } 32 | } 33 | 34 | export default { 35 | namespaced: true, 36 | state, 37 | actions, 38 | mutations 39 | } 40 | -------------------------------------------------------------------------------- /sign/src/utils/distance.js: -------------------------------------------------------------------------------- 1 | var EARTH_RADIUS = 6378137.0; //单位M 2 | var PI = Math.PI; 3 | 4 | function getRad(d) { 5 | return d * PI / 180.0; 6 | } 7 | 8 | export default function getDistance(lat1, lng1, lat2, lng2) { 9 | var f = getRad((lat1 + lat2) / 2); 10 | var g = getRad((lat1 - lat2) / 2); 11 | var l = getRad((lng1 - lng2) / 2); 12 | 13 | var sg = Math.sin(g); 14 | var sl = Math.sin(l); 15 | var sf = Math.sin(f); 16 | 17 | var s, c, w, r, d, h1, h2; 18 | var a = EARTH_RADIUS; 19 | var fl = 1 / 298.257; 20 | 21 | sg = sg * sg; 22 | sl = sl * sl; 23 | sf = sf * sf; 24 | 25 | s = sg * (1 - sl) + (1 - sf) * sl; 26 | c = (1 - sg) * (1 - sl) + sf * sl; 27 | 28 | w = Math.atan(Math.sqrt(s / c)); 29 | r = Math.sqrt(s * c) / w; 30 | d = 2 * w * a; 31 | h1 = (3 * r - 1) / 2 / c; 32 | h2 = (3 * r + 1) / 2 / s; 33 | 34 | return d * (1 + fl * (h1 * sf * (1 - sg) - h2 * (1 - sf) * sg)); 35 | } 36 | -------------------------------------------------------------------------------- /sign/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // http://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module' 8 | }, 9 | env: { 10 | browser: false, 11 | node: true, 12 | es6: true 13 | }, 14 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 15 | extends: 'standard', 16 | // required to lint *.vue files 17 | plugins: [ 18 | 'html' 19 | ], 20 | // add your custom rules here 21 | 'rules': { 22 | // allow paren-less arrow functions 23 | 'arrow-parens': 0, 24 | // allow async-await 25 | 'generator-star-spacing': 0, 26 | // allow debugger during development 27 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 28 | }, 29 | globals: { 30 | App: true, 31 | Page: true, 32 | wx: true, 33 | swan: true, 34 | tt: true, 35 | my: true, 36 | getApp: true, 37 | getPage: true, 38 | requirePlugin: true, 39 | mpvue: true, 40 | mpvuePlatform: true 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | -------------------------------------------------------------------------------- /sign/README.md: -------------------------------------------------------------------------------- 1 | # sign 2 | 3 | > 面试管理软件 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # 初始化项目 9 | vue init mpvue/mpvue-quickstart myproject 10 | cd myproject 11 | 12 | # 安装依赖 13 | yarn 14 | 15 | # 开发时构建 16 | npm dev 17 | 18 | # 打包构建 19 | npm build 20 | 21 | # 指定平台的开发时构建(微信、百度、头条、支付宝) 22 | npm dev:wx 23 | npm dev:swan 24 | npm dev:tt 25 | npm dev:my 26 | 27 | # 指定平台的打包构建 28 | npm build:wx 29 | npm build:swan 30 | npm build:tt 31 | npm build:my 32 | 33 | # 生成 bundle 分析报告 34 | npm run build --report 35 | ``` 36 | 37 | For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 38 | 39 | 40 | ## 功能列表 41 | 42 | - [x] 定位功能 43 | - [x] 我的功能 44 | - [x] 绑定手机号 45 | - [x] 面试功能 46 | - [x] 添加面试 47 | - [x] 面试列表 48 | - [x] 面试详情 49 | - [x] 面试分享 50 | - [x] 面试推送 51 | - [x] 打卡功能 52 | - [ ] 面试导航 53 | - [ ] 支付功能 54 | 55 | 56 | ## 更新日志 57 | ### 1.1.0 58 | - 时间:2019.04.11 59 | - 增加面试打卡功能,100m以内 60 | 61 | ### 1.0.2 62 | - 时间:2019.03.27 63 | - 修复分页数据获取失败 64 | - 优化消息推送通知放大关键字 65 | - 修复手机号绑定之后,弹框还在 66 | - 修复消息推送之后状态没改 67 | - 修复非面试创建人不能查看面试消息 68 | - 开启用户进入小程序就获取位置 69 | 70 | ### 1.0.1 71 | - 时间: 2019.03.26 72 | - 修复手机号绑定失败 73 | ### 1.0.0 74 | - 时间: 2019.03.26 75 | - 初次提交 76 | -------------------------------------------------------------------------------- /sign/src/App.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 59 | -------------------------------------------------------------------------------- /sign/build/build.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | process.env.NODE_ENV = 'production' 4 | process.env.PLATFORM = process.argv[process.argv.length - 1] || 'wx' 5 | 6 | var ora = require('ora') 7 | var rm = require('rimraf') 8 | var path = require('path') 9 | var chalk = require('chalk') 10 | var webpack = require('webpack') 11 | var config = require('../config') 12 | var webpackConfig = require('./webpack.prod.conf') 13 | var utils = require('./utils') 14 | 15 | var spinner = ora('building for production...') 16 | spinner.start() 17 | 18 | rm(path.join(config.build.assetsRoot, '*'), err => { 19 | if (err) throw err 20 | webpack(webpackConfig, function (err, stats) { 21 | spinner.stop() 22 | if (err) throw err 23 | if (process.env.PLATFORM === 'swan') { 24 | utils.writeFrameworkinfo() 25 | } 26 | process.stdout.write(stats.toString({ 27 | colors: true, 28 | modules: false, 29 | children: false, 30 | chunks: false, 31 | chunkModules: false 32 | }) + '\n\n') 33 | 34 | if (stats.hasErrors()) { 35 | console.log(chalk.red(' Build failed with errors.\n')) 36 | process.exit(1) 37 | } 38 | 39 | console.log(chalk.cyan(' Build complete.\n')) 40 | console.log(chalk.yellow( 41 | ' Tip: built files are meant to be served over an HTTP server.\n' + 42 | ' Opening index.html over file:// won\'t work.\n' 43 | )) 44 | }) 45 | }) 46 | -------------------------------------------------------------------------------- /sign/build/check-versions.js: -------------------------------------------------------------------------------- 1 | var chalk = require('chalk') 2 | var semver = require('semver') 3 | var packageConfig = require('../package.json') 4 | var shell = require('shelljs') 5 | function exec (cmd) { 6 | return require('child_process').execSync(cmd).toString().trim() 7 | } 8 | 9 | var versionRequirements = [ 10 | { 11 | name: 'node', 12 | currentVersion: semver.clean(process.version), 13 | versionRequirement: packageConfig.engines.node 14 | } 15 | ] 16 | 17 | if (shell.which('npm')) { 18 | versionRequirements.push({ 19 | name: 'npm', 20 | currentVersion: exec('npm --version'), 21 | versionRequirement: packageConfig.engines.npm 22 | }) 23 | } 24 | 25 | module.exports = function () { 26 | var warnings = [] 27 | for (var i = 0; i < versionRequirements.length; i++) { 28 | var mod = versionRequirements[i] 29 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 30 | warnings.push(mod.name + ': ' + 31 | chalk.red(mod.currentVersion) + ' should be ' + 32 | chalk.green(mod.versionRequirement) 33 | ) 34 | } 35 | } 36 | 37 | if (warnings.length) { 38 | console.log('') 39 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 40 | console.log() 41 | for (var i = 0; i < warnings.length; i++) { 42 | var warning = warnings[i] 43 | console.log(' ' + warning) 44 | } 45 | console.log() 46 | process.exit(1) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /sign/src/utils/request.js: -------------------------------------------------------------------------------- 1 | import Fly from "flyio/dist/npm/wx" 2 | 3 | export let fly = new Fly 4 | 5 | //设置超时 6 | fly.config.timeout=10000; 7 | //设置请求基地址 8 | fly.config.baseURL = 'https://sign.jasonandjay.com/' 9 | // fly.config.baseURL = "http://123.206.55.50:7001/" 10 | // fly.config.baseURL = "http://169.254.12.68:7001/" 11 | // fly.config.baseURL = 'http://127.0.0.1:7001/' 12 | 13 | const HOST = 'https://127.0.0.1' // 更改 14 | //添加请求拦截器 15 | fly.interceptors.request.use((request) => { 16 | // 把openid放在请求头部 17 | let openid = wx.getStorageSync('openid'); 18 | if (openid){ 19 | request.headers['openid'] = openid; 20 | } 21 | //给所有请求添加自定义header 22 | // request.headers["Cookie"] = map(cookies, (v, k) => k + '=' + v).join(';') 23 | //打印出请求体 24 | // console.log(request.body) 25 | //终止请求 26 | //var err=new Error("xxx") 27 | //err.request=request 28 | //return Promise.reject(new Error("")) 29 | 30 | //可以显式返回request, 也可以不返回,没有返回值时拦截器中默认返回request 31 | return request; 32 | }) 33 | 34 | //添加响应拦截器,响应拦截器会在then/catch处理之前执行 35 | fly.interceptors.response.use( 36 | (response) => { 37 | if (response.request.url.indexOf(HOST) == 0) { 38 | let hcks = response.headers['set-cookie'] || response.headers['Set-Cookie'] 39 | if (hcks != null) { 40 | hcks.forEach(v => { 41 | let ck = v.split(';')[0].split('=') 42 | cookies[ck[0]] = ck[1] 43 | }) 44 | } 45 | } 46 | //只将请求结果的data字段返回 47 | return response.data 48 | }, 49 | (err) => { 50 | //发生网络错误后会走到这里 51 | //return Promise.resolve("ssss") 52 | } 53 | ) 54 | 55 | export default fly 56 | 57 | -------------------------------------------------------------------------------- /sign/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "项目配置文件。", 3 | "setting": { 4 | "urlCheck": true, 5 | "es6": true, 6 | "postcss": true, 7 | "minified": true, 8 | "newFeature": true, 9 | "autoAudits": false 10 | }, 11 | "miniprogramRoot": "dist/wx/", 12 | "compileType": "miniprogram", 13 | "appid": "wx3375420e2c184d34", 14 | "projectname": "一面而就", 15 | "condition": { 16 | "search": { 17 | "current": -1, 18 | "list": [] 19 | }, 20 | "conversation": { 21 | "current": -1, 22 | "list": [] 23 | }, 24 | "plugin": { 25 | "current": -1, 26 | "list": [] 27 | }, 28 | "game": { 29 | "currentL": -1, 30 | "list": [] 31 | }, 32 | "miniprogram": { 33 | "current": 4, 34 | "list": [ 35 | { 36 | "id": 0, 37 | "name": "匹配地址", 38 | "pathName": "pages/sign/search/main", 39 | "query": "", 40 | "scene": null 41 | }, 42 | { 43 | "id": 1, 44 | "name": "添加面试", 45 | "pathName": "pages/sign/add/main", 46 | "query": "", 47 | "scene": null 48 | }, 49 | { 50 | "id": -1, 51 | "name": "我的页面", 52 | "pathName": "pages/my/main", 53 | "query": "", 54 | "scene": null 55 | }, 56 | { 57 | "id": -1, 58 | "name": "面试列表", 59 | "pathName": "pages/sign/list/main", 60 | "query": "", 61 | "scene": null 62 | }, 63 | { 64 | "id": 4, 65 | "name": "面试详情", 66 | "pathName": "pages/sign/detail/main", 67 | "query": "id=669", 68 | "scene": null 69 | }, 70 | { 71 | "id": -1, 72 | "name": "打卡页面", 73 | "pathName": "pages/sign/sign/main", 74 | "query": "", 75 | "scene": null 76 | } 77 | ] 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /sign/src/utils/index.js: -------------------------------------------------------------------------------- 1 | function formatNumber(n) { 2 | const str = n.toString() 3 | return str[1] ? str : `0${str}` 4 | } 5 | 6 | export function formatTime(date) { 7 | const year = date.getFullYear() 8 | const month = date.getMonth() + 1 9 | const day = date.getDate() 10 | 11 | const hour = date.getHours() 12 | const minute = date.getMinutes() 13 | const second = date.getSeconds() 14 | 15 | const t1 = [year, month, day].map(formatNumber).join('/') 16 | const t2 = [hour, minute, second].map(formatNumber).join(':') 17 | 18 | return `${t1} ${t2}` 19 | } 20 | 21 | // 获取用户定位 22 | export function getLocation() { 23 | return new Promise((resolve, reject) => { 24 | wx.getLocation({ 25 | type: 'gcj02', 26 | success(res) { 27 | resolve(res); 28 | } 29 | }) 30 | }) 31 | } 32 | 33 | /** 34 | * 通用授权逻辑 35 | * @export 36 | * @param {*} scope 权限信息 37 | * @param {*} callback 授权成功回调 38 | */ 39 | export function getAuth(scope, callback) { 40 | wx.getSetting({ 41 | success: res => { 42 | // 如果已授权 43 | if (res.authSetting[scope]) { 44 | callback(); 45 | } else { 46 | wx.authorize({ 47 | scope, 48 | success: callback, 49 | fail: () => { 50 | wx.showModal({ 51 | title: '亲爱的用户', //提示的标题, 52 | content: '同意我们的授权,让我们为你提供更加优质的服务', //提示的内容, 53 | showCancel: false, //是否显示取消按钮, 54 | confirmText: '去设置', //确定按钮的文字,默认为取消,最多 4 个字符, 55 | confirmColor: '#3CC51F', //确定按钮的文字颜色 56 | success: res => { 57 | wx.openSetting() 58 | } 59 | }) 60 | } 61 | }) 62 | } 63 | } 64 | }) 65 | } 66 | 67 | // 函数去抖 68 | export function debounce(func, delay){ 69 | var timer=null; 70 | return function(){ 71 | var context=this, args=arguments; 72 | clearTimeout(timer); 73 | timer=setTimeout(function(){ 74 | func.apply(context,args); 75 | }, delay); 76 | } 77 | } 78 | 79 | export default { 80 | formatNumber, 81 | formatTime, 82 | getLocation, 83 | getAuth, 84 | debounce 85 | } 86 | -------------------------------------------------------------------------------- /sign/src/pages/sign/list/index.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 56 | 57 | 94 | -------------------------------------------------------------------------------- /sign/config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | var fileExtConfig = { 4 | swan: { 5 | template: 'swan', 6 | script: 'js', 7 | style: 'css', 8 | platform: 'swan' 9 | }, 10 | tt: { 11 | template: 'ttml', 12 | script: 'js', 13 | style: 'ttss', 14 | platform: 'tt' 15 | }, 16 | wx: { 17 | template: 'wxml', 18 | script: 'js', 19 | style: 'wxss', 20 | platform: 'wx' 21 | }, 22 | my: { 23 | template: 'axml', 24 | script: 'js', 25 | style: 'acss', 26 | platform: 'my' 27 | } 28 | } 29 | var fileExt = fileExtConfig[process.env.PLATFORM] 30 | 31 | module.exports = { 32 | build: { 33 | env: require('./prod.env'), 34 | index: path.resolve(__dirname, `../dist/${fileExt.platform}/index.html`), 35 | assetsRoot: path.resolve(__dirname, `../dist/${fileExt.platform}`), 36 | assetsSubDirectory: '', 37 | assetsPublicPath: '/', 38 | productionSourceMap: false, 39 | // Gzip off by default as many popular static hosts such as 40 | // Surge or Netlify already gzip all static assets for you. 41 | // Before setting to `true`, make sure to: 42 | // npm install --save-dev compression-webpack-plugin 43 | productionGzip: false, 44 | productionGzipExtensions: ['js', 'css'], 45 | // Run the build command with an extra argument to 46 | // View the bundle analyzer report after build finishes: 47 | // `npm run build --report` 48 | // Set to `true` or `false` to always turn it on or off 49 | bundleAnalyzerReport: process.env.npm_config_report, 50 | fileExt: fileExt 51 | }, 52 | dev: { 53 | env: require('./dev.env'), 54 | port: 8080, 55 | // 在小程序开发者工具中不需要自动打开浏览器 56 | autoOpenBrowser: false, 57 | assetsSubDirectory: '', 58 | assetsPublicPath: '/', 59 | proxyTable: {}, 60 | // CSS Sourcemaps off by default because relative paths are "buggy" 61 | // with this option, according to the CSS-Loader README 62 | // (https://github.com/webpack/css-loader#sourcemaps) 63 | // In our experience, they generally work as expected, 64 | // just be aware of this issue when enabling this option. 65 | cssSourceMap: false, 66 | fileExt: fileExt 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /sign/src/pages/index/index.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 61 | 62 | 116 | -------------------------------------------------------------------------------- /sign/src/store/modules/sign.js: -------------------------------------------------------------------------------- 1 | import {getSignList, getSignDetail, updateSignDetail} from '@/api/index'; 2 | const moment = require('moment'); 3 | 4 | const state = { 5 | active: 1, //表示当前面试类型,0表示全部,1表示未开始,1表示已打卡,2表示已放弃 6 | list: [], //面试列表 7 | info: {}, //面试详情数据 8 | hasMore: true, //是否有更多数据 9 | page: 1, //当前页码 10 | pageSize: 10 //每页数据 11 | } 12 | 13 | const mutations = { 14 | updateState(state, payload){ 15 | // 判断是否还有更多页码 16 | if (payload.list){ 17 | if (payload.list.length === state.pageSize*state.page){ 18 | state.hasMore = true 19 | }else{ 20 | state.hasMore = false 21 | } 22 | } 23 | for (let key in payload){ 24 | state[key] = payload[key] 25 | } 26 | } 27 | } 28 | 29 | const actions = { 30 | // 获取面试列表 31 | getList({commit, state}, payload){ 32 | console.log('payload...', payload); 33 | return new Promise(async (resolve, reject)=>{ 34 | let params = {}; 35 | // 修正面试状态 36 | if (state.active){ 37 | params.status = state.active-2; 38 | } 39 | // 拼接面试页码和每页数量 40 | params.page = state.page; 41 | params.pageSize = state.pageSize; 42 | let result = await getSignList(params); 43 | result.data.forEach(item=>{ 44 | item.address = JSON.parse(item.address); 45 | item.start_time = formatTime(item.start_time); 46 | }) 47 | // 判断是替换还是追加 48 | if (state.page === 1){ 49 | commit('updateState',{list: result.data}) 50 | }else{ 51 | commit('updateState',{list: [...state.list, ...result.data]}) 52 | } 53 | // 调用resolve通知前端 54 | resolve(); 55 | }) 56 | }, 57 | // 获取面试详情 58 | getDetail({commit}, payload){ 59 | return new Promise(async (resolve, reject)=>{ 60 | let data = await getSignDetail(payload); 61 | if (data.data.address){ 62 | data.data.address = JSON.parse(data.data.address); 63 | } 64 | data.data.start_time = formatTime(data.data.start_time); 65 | commit('updateState', {info: data.data}); 66 | resolve(); 67 | }) 68 | }, 69 | // 更新面试状态 70 | updateDetail({commit,dispatch}, payload){ 71 | return new Promise(async (resolve, reject)=>{ 72 | let data = await updateSignDetail(payload.id, payload.params); 73 | if (data.code == 0){ 74 | // 重新获取详情 75 | dispatch('getDetail', payload.id); 76 | } 77 | resolve(data); 78 | }) 79 | } 80 | } 81 | 82 | function formatTime(start_time){ 83 | return moment(start_time*1).format('YYYY-MM-DD HH:mm'); 84 | } 85 | 86 | export default { 87 | namespaced: true, 88 | state, 89 | mutations, 90 | actions 91 | } 92 | -------------------------------------------------------------------------------- /sign/src/components/signList.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 37 | 38 | 106 | -------------------------------------------------------------------------------- /sign/src/pages/sign/search/index.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 69 | 70 | 115 | -------------------------------------------------------------------------------- /sign/src/components/map.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 107 | 108 | 128 | -------------------------------------------------------------------------------- /sign/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var webpack = require('webpack') 3 | var config = require('../config') 4 | var merge = require('webpack-merge') 5 | var baseWebpackConfig = require('./webpack.base.conf') 6 | // var HtmlWebpackPlugin = require('html-webpack-plugin') 7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 8 | var MpvueVendorPlugin = require('webpack-mpvue-vendor-plugin') 9 | 10 | // copy from ./webpack.prod.conf.js 11 | var path = require('path') 12 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 13 | var CopyWebpackPlugin = require('copy-webpack-plugin') 14 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 15 | 16 | // add hot-reload related code to entry chunks 17 | // Object.keys(baseWebpackConfig.entry).forEach(function (name) { 18 | // baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 19 | // }) 20 | 21 | module.exports = merge(baseWebpackConfig, { 22 | module: { 23 | rules: utils.styleLoaders({ 24 | sourceMap: config.dev.cssSourceMap, 25 | extract: true 26 | }) 27 | }, 28 | // cheap-module-eval-source-map is faster for development 29 | // devtool: '#cheap-module-eval-source-map', 30 | // devtool: '#source-map', 31 | output: { 32 | path: config.build.assetsRoot, 33 | // filename: utils.assetsPath('[name].[chunkhash].js'), 34 | // chunkFilename: utils.assetsPath('[id].[chunkhash].js') 35 | filename: utils.assetsPath('[name].js'), 36 | chunkFilename: utils.assetsPath('[id].js') 37 | }, 38 | plugins: [ 39 | new webpack.DefinePlugin({ 40 | 'process.env': config.dev.env 41 | }), 42 | 43 | // copy from ./webpack.prod.conf.js 44 | // extract css into its own file 45 | new ExtractTextPlugin({ 46 | // filename: utils.assetsPath('[name].[contenthash].css') 47 | filename: utils.assetsPath(`[name].${config.dev.fileExt.style}`) 48 | }), 49 | // Compress extracted CSS. We are using this plugin so that possible 50 | // duplicated CSS from different components can be deduped. 51 | new OptimizeCSSPlugin({ 52 | cssProcessorOptions: { 53 | safe: true 54 | } 55 | }), 56 | new webpack.optimize.CommonsChunkPlugin({ 57 | name: 'common/vendor', 58 | minChunks: function (module, count) { 59 | // any required modules inside node_modules are extracted to vendor 60 | return ( 61 | module.resource && 62 | /\.js$/.test(module.resource) && 63 | module.resource.indexOf('node_modules') >= 0 64 | ) || count > 1 65 | } 66 | }), 67 | new webpack.optimize.CommonsChunkPlugin({ 68 | name: 'common/manifest', 69 | chunks: ['common/vendor'] 70 | }), 71 | new MpvueVendorPlugin({ 72 | platform: process.env.PLATFORM 73 | }), 74 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 75 | // new webpack.HotModuleReplacementPlugin(), 76 | new webpack.NoEmitOnErrorsPlugin(), 77 | // https://github.com/ampedandwired/html-webpack-plugin 78 | // new HtmlWebpackPlugin({ 79 | // filename: 'index.html', 80 | // template: 'index.html', 81 | // inject: true 82 | // }), 83 | new FriendlyErrorsPlugin() 84 | ] 85 | }) 86 | -------------------------------------------------------------------------------- /sign/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sign", 3 | "version": "1.0.0", 4 | "mpvueTemplateProjectVersion": "0.1.0", 5 | "description": "面试管理软件", 6 | "author": "jason <342690199@qq.com>", 7 | "private": true, 8 | "scripts": { 9 | "dev:wx": "node build/dev-server.js wx", 10 | "start:wx": "npm run dev:wx", 11 | "build:wx": "node build/build.js wx", 12 | "dev:swan": "node build/dev-server.js swan", 13 | "start:swan": "npm run dev:swan", 14 | "build:swan": "node build/build.js swan", 15 | "dev:tt": "node build/dev-server.js tt", 16 | "start:tt": "npm run dev:tt", 17 | "build:tt": "node build/build.js tt", 18 | "dev:my": "node build/dev-server.js my", 19 | "start:my": "npm run dev:my", 20 | "build:my": "node build/build.js my", 21 | "dev": "node build/dev-server.js wx", 22 | "start": "npm run dev", 23 | "build": "node build/build.js wx", 24 | "lint": "eslint --ext .js,.vue src" 25 | }, 26 | "dependencies": { 27 | "flyio": "^0.6.14", 28 | "moment": "^2.24.0", 29 | "mpvue": "^2.0.0", 30 | "vuex": "^3.0.1" 31 | }, 32 | "devDependencies": { 33 | "babel-core": "^6.22.1", 34 | "babel-eslint": "^8.2.3", 35 | "babel-loader": "^7.1.1", 36 | "babel-plugin-transform-runtime": "^6.22.0", 37 | "babel-preset-env": "^1.3.2", 38 | "babel-preset-stage-2": "^6.22.0", 39 | "babel-register": "^6.22.0", 40 | "chalk": "^2.4.0", 41 | "connect-history-api-fallback": "^1.3.0", 42 | "copy-webpack-plugin": "^4.5.1", 43 | "css-loader": "^0.28.11", 44 | "cssnano": "^3.10.0", 45 | "eslint": "^4.19.1", 46 | "eslint-config-standard": "^11.0.0", 47 | "eslint-friendly-formatter": "^4.0.1", 48 | "eslint-loader": "^2.0.0", 49 | "eslint-plugin-html": "^4.0.3", 50 | "eslint-plugin-import": "^2.11.0", 51 | "eslint-plugin-node": "^6.0.1", 52 | "eslint-plugin-promise": "^3.4.0", 53 | "eslint-plugin-standard": "^3.0.1", 54 | "eventsource-polyfill": "^0.9.6", 55 | "express": "^4.16.3", 56 | "extract-text-webpack-plugin": "^3.0.2", 57 | "file-loader": "^1.1.11", 58 | "friendly-errors-webpack-plugin": "^1.7.0", 59 | "glob": "^7.1.2", 60 | "html-webpack-plugin": "^3.2.0", 61 | "http-proxy-middleware": "^0.18.0", 62 | "mkdirp": "^0.5.1", 63 | "mpvue-loader": "^2.0.0", 64 | "mpvue-template-compiler": "^2.0.0", 65 | "mpvue-webpack-target": "^1.0.3", 66 | "node-sass": "^4.11.0", 67 | "optimize-css-assets-webpack-plugin": "^3.2.0", 68 | "ora": "^2.0.0", 69 | "portfinder": "^1.0.13", 70 | "postcss-loader": "^2.1.4", 71 | "postcss-mpvue-wxss": "^1.0.0", 72 | "prettier": "~1.12.1", 73 | "px2rpx-loader": "^0.1.10", 74 | "relative": "^3.0.2", 75 | "rimraf": "^2.6.0", 76 | "sass-loader": "^7.1.0", 77 | "semver": "^5.3.0", 78 | "shelljs": "^0.8.1", 79 | "uglifyjs-webpack-plugin": "^1.2.5", 80 | "url-loader": "^1.0.1", 81 | "vue-style-loader": "^4.1.0", 82 | "webpack": "^3.11.0", 83 | "webpack-bundle-analyzer": "^2.2.1", 84 | "webpack-dev-middleware-hard-disk": "^1.12.0", 85 | "webpack-merge": "^4.1.0", 86 | "webpack-mpvue-asset-plugin": "^2.0.0", 87 | "webpack-mpvue-vendor-plugin": "^2.0.0" 88 | }, 89 | "engines": { 90 | "node": ">= 4.0.0", 91 | "npm": ">= 3.0.0" 92 | }, 93 | "browserslist": [ 94 | "> 1%", 95 | "last 2 versions", 96 | "not ie <= 8" 97 | ] 98 | } 99 | -------------------------------------------------------------------------------- /sign/build/utils.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var fs = require('fs') 3 | var config = require('../config') 4 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 5 | var mpvueInfo = require('../node_modules/mpvue/package.json') 6 | var packageInfo = require('../package.json') 7 | var mkdirp = require('mkdirp') 8 | 9 | exports.assetsPath = function (_path) { 10 | var assetsSubDirectory = process.env.NODE_ENV === 'production' 11 | ? config.build.assetsSubDirectory 12 | : config.dev.assetsSubDirectory 13 | return path.posix.join(assetsSubDirectory, _path) 14 | } 15 | 16 | exports.cssLoaders = function (options) { 17 | options = options || {} 18 | 19 | var cssLoader = { 20 | loader: 'css-loader', 21 | options: { 22 | minimize: process.env.NODE_ENV === 'production', 23 | sourceMap: options.sourceMap 24 | } 25 | } 26 | 27 | var postcssLoader = { 28 | loader: 'postcss-loader', 29 | options: { 30 | sourceMap: true 31 | } 32 | } 33 | 34 | var px2rpxLoader = { 35 | loader: 'px2rpx-loader', 36 | options: { 37 | baseDpr: 1, 38 | rpxUnit: 0.5 39 | } 40 | } 41 | 42 | // generate loader string to be used with extract text plugin 43 | function generateLoaders (loader, loaderOptions) { 44 | var loaders = [cssLoader, px2rpxLoader, postcssLoader] 45 | if (loader) { 46 | loaders.push({ 47 | loader: loader + '-loader', 48 | options: Object.assign({}, loaderOptions, { 49 | sourceMap: options.sourceMap 50 | }) 51 | }) 52 | } 53 | 54 | // Extract CSS when that option is specified 55 | // (which is the case during production build) 56 | if (options.extract) { 57 | return ExtractTextPlugin.extract({ 58 | use: loaders, 59 | fallback: 'vue-style-loader' 60 | }) 61 | } else { 62 | return ['vue-style-loader'].concat(loaders) 63 | } 64 | } 65 | 66 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 67 | return { 68 | css: generateLoaders(), 69 | wxss: generateLoaders(), 70 | postcss: generateLoaders(), 71 | less: generateLoaders('less'), 72 | sass: generateLoaders('sass', { indentedSyntax: true }), 73 | scss: generateLoaders('sass'), 74 | stylus: generateLoaders('stylus'), 75 | styl: generateLoaders('stylus') 76 | } 77 | } 78 | 79 | // Generate loaders for standalone style files (outside of .vue) 80 | exports.styleLoaders = function (options) { 81 | var output = [] 82 | var loaders = exports.cssLoaders(options) 83 | for (var extension in loaders) { 84 | var loader = loaders[extension] 85 | output.push({ 86 | test: new RegExp('\\.' + extension + '$'), 87 | use: loader 88 | }) 89 | } 90 | return output 91 | } 92 | 93 | const writeFile = async (filePath, content) => { 94 | let dir = path.dirname(filePath) 95 | let exist = fs.existsSync(dir) 96 | if (!exist) { 97 | await mkdirp(dir) 98 | } 99 | await fs.writeFileSync(filePath, content, 'utf8') 100 | } 101 | 102 | exports.writeFrameworkinfo = function () { 103 | var buildInfo = { 104 | 'toolName': mpvueInfo.name, 105 | 'toolFrameWorkVersion': mpvueInfo.version, 106 | 'toolCliVersion': packageInfo.mpvueTemplateProjectVersion || '', 107 | 'createTime': Date.now() 108 | } 109 | 110 | var content = JSON.stringify(buildInfo) 111 | var fileName = '.frameworkinfo' 112 | var rootDir = path.resolve(__dirname, `../${fileName}`) 113 | var distDir = path.resolve(config.build.assetsRoot, `./${fileName}`) 114 | 115 | writeFile(rootDir, content) 116 | writeFile(distDir, content) 117 | } 118 | -------------------------------------------------------------------------------- /sign/src/pages/sign/sign/index.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 98 | 99 | 153 | -------------------------------------------------------------------------------- /sign/build/dev-server.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | process.env.PLATFORM = process.argv[process.argv.length - 1] || 'wx' 4 | var config = require('../config') 5 | if (!process.env.NODE_ENV) { 6 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) 7 | } 8 | 9 | // var opn = require('opn') 10 | var path = require('path') 11 | var express = require('express') 12 | var webpack = require('webpack') 13 | var proxyMiddleware = require('http-proxy-middleware') 14 | var portfinder = require('portfinder') 15 | var webpackConfig = require('./webpack.dev.conf') 16 | var utils = require('./utils') 17 | 18 | // default port where dev server listens for incoming traffic 19 | var port = process.env.PORT || config.dev.port 20 | // automatically open browser, if not set will be false 21 | var autoOpenBrowser = !!config.dev.autoOpenBrowser 22 | // Define HTTP proxies to your custom API backend 23 | // https://github.com/chimurai/http-proxy-middleware 24 | var proxyTable = config.dev.proxyTable 25 | 26 | var app = express() 27 | var compiler = webpack(webpackConfig) 28 | if (process.env.PLATFORM === 'swan') { 29 | utils.writeFrameworkinfo() 30 | } 31 | 32 | // var devMiddleware = require('webpack-dev-middleware')(compiler, { 33 | // publicPath: webpackConfig.output.publicPath, 34 | // quiet: true 35 | // }) 36 | 37 | // var hotMiddleware = require('webpack-hot-middleware')(compiler, { 38 | // log: false, 39 | // heartbeat: 2000 40 | // }) 41 | // force page reload when html-webpack-plugin template changes 42 | // compiler.plugin('compilation', function (compilation) { 43 | // compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { 44 | // hotMiddleware.publish({ action: 'reload' }) 45 | // cb() 46 | // }) 47 | // }) 48 | 49 | // proxy api requests 50 | Object.keys(proxyTable).forEach(function (context) { 51 | var options = proxyTable[context] 52 | if (typeof options === 'string') { 53 | options = { target: options } 54 | } 55 | app.use(proxyMiddleware(options.filter || context, options)) 56 | }) 57 | 58 | // handle fallback for HTML5 history API 59 | app.use(require('connect-history-api-fallback')()) 60 | 61 | // serve webpack bundle output 62 | // app.use(devMiddleware) 63 | 64 | // enable hot-reload and state-preserving 65 | // compilation error display 66 | // app.use(hotMiddleware) 67 | 68 | // serve pure static assets 69 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) 70 | app.use(staticPath, express.static('./static')) 71 | 72 | // var uri = 'http://localhost:' + port 73 | 74 | var _resolve 75 | var readyPromise = new Promise(resolve => { 76 | _resolve = resolve 77 | }) 78 | 79 | // console.log('> Starting dev server...') 80 | // devMiddleware.waitUntilValid(() => { 81 | // console.log('> Listening at ' + uri + '\n') 82 | // // when env is testing, don't need open it 83 | // if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { 84 | // opn(uri) 85 | // } 86 | // _resolve() 87 | // }) 88 | 89 | module.exports = new Promise((resolve, reject) => { 90 | portfinder.basePort = port 91 | portfinder.getPortPromise() 92 | .then(newPort => { 93 | if (port !== newPort) { 94 | console.log(`${port}端口被占用,开启新端口${newPort}`) 95 | } 96 | var server = app.listen(newPort, 'localhost') 97 | // for 小程序的文件保存机制 98 | require('webpack-dev-middleware-hard-disk')(compiler, { 99 | publicPath: webpackConfig.output.publicPath, 100 | quiet: true 101 | }) 102 | resolve({ 103 | ready: readyPromise, 104 | close: () => { 105 | server.close() 106 | } 107 | }) 108 | }).catch(error => { 109 | console.log('没有找到空闲端口,请打开任务管理器杀死进程端口再试', error) 110 | }) 111 | }) 112 | -------------------------------------------------------------------------------- /sign/src/pages/sign/detail/index.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 37 | 117 | 118 | 170 | -------------------------------------------------------------------------------- /sign/src/pages/my/index.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 99 | 100 | 175 | -------------------------------------------------------------------------------- /sign/build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var webpack = require('webpack') 4 | var config = require('../config') 5 | var merge = require('webpack-merge') 6 | var baseWebpackConfig = require('./webpack.base.conf') 7 | var UglifyJsPlugin = require('uglifyjs-webpack-plugin') 8 | var CopyWebpackPlugin = require('copy-webpack-plugin') 9 | // var HtmlWebpackPlugin = require('html-webpack-plugin') 10 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 11 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 12 | var MpvueVendorPlugin = require('webpack-mpvue-vendor-plugin') 13 | var env = config.build.env 14 | 15 | var webpackConfig = merge(baseWebpackConfig, { 16 | module: { 17 | rules: utils.styleLoaders({ 18 | sourceMap: config.build.productionSourceMap, 19 | extract: true 20 | }) 21 | }, 22 | devtool: config.build.productionSourceMap ? '#source-map' : false, 23 | output: { 24 | path: config.build.assetsRoot, 25 | // filename: utils.assetsPath('[name].[chunkhash].js'), 26 | // chunkFilename: utils.assetsPath('[id].[chunkhash].js') 27 | filename: utils.assetsPath('[name].js'), 28 | chunkFilename: utils.assetsPath('[id].js') 29 | }, 30 | plugins: [ 31 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 32 | new webpack.DefinePlugin({ 33 | 'process.env': env 34 | }), 35 | // extract css into its own file 36 | new ExtractTextPlugin({ 37 | // filename: utils.assetsPath('[name].[contenthash].css') 38 | filename: utils.assetsPath(`[name].${config.build.fileExt.style}`) 39 | }), 40 | // Compress extracted CSS. We are using this plugin so that possible 41 | // duplicated CSS from different components can be deduped. 42 | new OptimizeCSSPlugin({ 43 | cssProcessorOptions: { 44 | safe: true 45 | } 46 | }), 47 | // generate dist index.html with correct asset hash for caching. 48 | // you can customize output by editing /index.html 49 | // see https://github.com/ampedandwired/html-webpack-plugin 50 | // new HtmlWebpackPlugin({ 51 | // filename: config.build.index, 52 | // template: 'index.html', 53 | // inject: true, 54 | // minify: { 55 | // removeComments: true, 56 | // collapseWhitespace: true, 57 | // removeAttributeQuotes: true 58 | // // more options: 59 | // // https://github.com/kangax/html-minifier#options-quick-reference 60 | // }, 61 | // // necessary to consistently work with multiple chunks via CommonsChunkPlugin 62 | // chunksSortMode: 'dependency' 63 | // }), 64 | // keep module.id stable when vender modules does not change 65 | new webpack.HashedModuleIdsPlugin(), 66 | // split vendor js into its own file 67 | new webpack.optimize.CommonsChunkPlugin({ 68 | name: 'common/vendor', 69 | minChunks: function (module, count) { 70 | // any required modules inside node_modules are extracted to vendor 71 | return ( 72 | module.resource && 73 | /\.js$/.test(module.resource) && 74 | module.resource.indexOf('node_modules') >= 0 75 | ) || count > 1 76 | } 77 | }), 78 | // extract webpack runtime and module manifest to its own file in order to 79 | // prevent vendor hash from being updated whenever app bundle is updated 80 | new webpack.optimize.CommonsChunkPlugin({ 81 | name: 'common/manifest', 82 | chunks: ['common/vendor'] 83 | }), 84 | new MpvueVendorPlugin({ 85 | platform: process.env.PLATFORM 86 | }) 87 | ] 88 | }) 89 | 90 | // if (config.build.productionGzip) { 91 | // var CompressionWebpackPlugin = require('compression-webpack-plugin') 92 | 93 | // webpackConfig.plugins.push( 94 | // new CompressionWebpackPlugin({ 95 | // asset: '[path].gz[query]', 96 | // algorithm: 'gzip', 97 | // test: new RegExp( 98 | // '\\.(' + 99 | // config.build.productionGzipExtensions.join('|') + 100 | // ')$' 101 | // ), 102 | // threshold: 10240, 103 | // minRatio: 0.8 104 | // }) 105 | // ) 106 | // } 107 | 108 | if (config.build.bundleAnalyzerReport) { 109 | var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 110 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 111 | } 112 | 113 | var useUglifyJs = process.env.PLATFORM !== 'swan' 114 | if (useUglifyJs) { 115 | webpackConfig.plugins.push(new UglifyJsPlugin({ 116 | sourceMap: true 117 | })) 118 | } 119 | 120 | module.exports = webpackConfig 121 | -------------------------------------------------------------------------------- /sign/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var fs = require('fs') 3 | var utils = require('./utils') 4 | var config = require('../config') 5 | var webpack = require('webpack') 6 | var merge = require('webpack-merge') 7 | var vueLoaderConfig = require('./vue-loader.conf') 8 | var MpvuePlugin = require('webpack-mpvue-asset-plugin') 9 | var glob = require('glob') 10 | var CopyWebpackPlugin = require('copy-webpack-plugin') 11 | var relative = require('relative') 12 | 13 | function resolve (dir) { 14 | return path.join(__dirname, '..', dir) 15 | } 16 | 17 | function getEntry (rootSrc) { 18 | var map = {}; 19 | glob.sync(rootSrc + '/pages/**/main.js') 20 | .forEach(file => { 21 | var key = relative(rootSrc, file).replace('.js', ''); 22 | map[key] = file; 23 | }) 24 | return map; 25 | } 26 | 27 | const appEntry = { app: resolve('./src/main.js') } 28 | const pagesEntry = getEntry(resolve('./src'), 'pages/**/main.js') 29 | const entry = Object.assign({}, appEntry, pagesEntry) 30 | 31 | let baseWebpackConfig = { 32 | // 如果要自定义生成的 dist 目录里面的文件路径, 33 | // 可以将 entry 写成 {'toPath': 'fromPath'} 的形式, 34 | // toPath 为相对于 dist 的路径, 例:index/demo,则生成的文件地址为 dist/index/demo.js 35 | entry, 36 | target: require('mpvue-webpack-target'), 37 | output: { 38 | path: config.build.assetsRoot, 39 | jsonpFunction: 'webpackJsonpMpvue', 40 | filename: '[name].js', 41 | publicPath: process.env.NODE_ENV === 'production' 42 | ? config.build.assetsPublicPath 43 | : config.dev.assetsPublicPath 44 | }, 45 | resolve: { 46 | extensions: ['.js', '.vue', '.json'], 47 | alias: { 48 | 'vue': 'mpvue', 49 | '@': resolve('src') 50 | }, 51 | symlinks: false, 52 | aliasFields: ['mpvue', 'weapp', 'browser'], 53 | mainFields: ['browser', 'module', 'main'] 54 | }, 55 | module: { 56 | rules: [ 57 | // { 58 | // test: /\.(js|vue)$/, 59 | // loader: 'eslint-loader', 60 | // enforce: 'pre', 61 | // include: [resolve('src'), resolve('test')], 62 | // options: { 63 | // formatter: require('eslint-friendly-formatter') 64 | // } 65 | // }, 66 | { 67 | test: /\.vue$/, 68 | loader: 'mpvue-loader', 69 | options: vueLoaderConfig 70 | }, 71 | { 72 | test: /\.js$/, 73 | include: [resolve('src'), resolve('test')], 74 | use: [ 75 | 'babel-loader', 76 | { 77 | loader: 'mpvue-loader', 78 | options: Object.assign({checkMPEntry: true}, vueLoaderConfig) 79 | }, 80 | ] 81 | }, 82 | { 83 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 84 | loader: 'url-loader', 85 | options: { 86 | limit: 10000, 87 | name: utils.assetsPath('img/[name].[ext]') 88 | } 89 | }, 90 | { 91 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 92 | loader: 'url-loader', 93 | options: { 94 | limit: 10000, 95 | name: utils.assetsPath('media/[name].[ext]') 96 | } 97 | }, 98 | { 99 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 100 | loader: 'url-loader', 101 | options: { 102 | limit: 10000, 103 | name: utils.assetsPath('fonts/[name].[ext]') 104 | } 105 | } 106 | ] 107 | }, 108 | plugins: [ 109 | // api 统一桥协议方案 110 | new webpack.DefinePlugin({ 111 | 'mpvue': 'global.mpvue', 112 | 'mpvuePlatform': 'global.mpvuePlatform' 113 | }), 114 | new MpvuePlugin(), 115 | new CopyWebpackPlugin([{ 116 | from: '**/*.json', 117 | to: '' 118 | }], { 119 | context: 'src/' 120 | }), 121 | new CopyWebpackPlugin([ 122 | { 123 | from: path.resolve(__dirname, '../static'), 124 | to: path.resolve(config.build.assetsRoot, './static'), 125 | ignore: ['.*'] 126 | } 127 | ]) 128 | ] 129 | } 130 | 131 | // 针对百度小程序,由于不支持通过 miniprogramRoot 进行自定义构建完的文件的根路径 132 | // 所以需要将项目根路径下面的 project.swan.json 拷贝到构建目录 133 | // 然后百度开发者工具将 dist/swan 作为项目根目录打 134 | const projectConfigMap = { 135 | tt: '../project.config.json', 136 | swan: '../project.swan.json' 137 | } 138 | 139 | const PLATFORM = process.env.PLATFORM 140 | if (/^(swan)|(tt)$/.test(PLATFORM)) { 141 | baseWebpackConfig = merge(baseWebpackConfig, { 142 | plugins: [ 143 | new CopyWebpackPlugin([{ 144 | from: path.resolve(__dirname, projectConfigMap[PLATFORM]), 145 | to: path.resolve(config.build.assetsRoot) 146 | }]) 147 | ] 148 | }) 149 | } 150 | 151 | module.exports = baseWebpackConfig 152 | -------------------------------------------------------------------------------- /sign/src/pages/sign/add/index.vue: -------------------------------------------------------------------------------- 1 |