├── .babelrc
├── .electron-vue
├── build.js
├── dev-client.js
├── dev-runner.js
├── webpack.main.config.js
├── webpack.renderer.config.js
└── webpack.web.config.js
├── .eslintignore
├── .eslintrc.js
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── appveyor.yml
├── build
└── icons
│ ├── 256x256.png
│ ├── icon.icns
│ └── icon.ico
├── dist
├── electron
│ └── .gitkeep
└── web
│ └── .gitkeep
├── package-lock.json
├── package.json
├── src
├── index.ejs
├── main
│ ├── index.dev.js
│ └── index.js
├── models
│ ├── address_group.js
│ ├── address_list.js
│ ├── config.js
│ ├── email_list.js
│ ├── emails.js
│ └── user.js
└── renderer
│ ├── App.vue
│ ├── assets
│ └── .gitkeep
│ ├── common
│ ├── javascript
│ │ ├── cache.js
│ │ ├── config.js
│ │ ├── getEmail.js
│ │ ├── parseEmail.js
│ │ └── sendEmail.js
│ └── style
│ │ └── reset.css
│ ├── components
│ ├── address-list-table.vue
│ ├── header.vue
│ ├── letter-table.vue
│ └── slide.vue
│ ├── main.js
│ ├── pages
│ ├── address-list.vue
│ ├── drafts-mail.vue
│ ├── inbox-mail.vue
│ ├── letter.vue
│ ├── login.vue
│ ├── mail-details.vue
│ ├── notfind.vue
│ ├── sent-mail.vue
│ ├── star-mail.vue
│ └── write.vue
│ ├── router
│ └── index.js
│ └── store
│ ├── actions.js
│ ├── getters.js
│ ├── index.js
│ ├── mutations-type.js
│ ├── mutations.js
│ └── state.js
├── static
└── .gitkeep
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "comments": false,
3 | "env": {
4 | "main": {
5 | "presets": [
6 | ["env", {
7 | "targets": { "node": 7 }
8 | }],
9 | "stage-0"
10 | ]
11 | },
12 | "renderer": {
13 | "presets": [
14 | ["env", {
15 | "modules": false
16 | }],
17 | "stage-0"
18 | ]
19 | },
20 | "web": {
21 | "presets": [
22 | ["env", {
23 | "modules": false
24 | }],
25 | "stage-0"
26 | ]
27 | }
28 | },
29 | "plugins": ["transform-runtime"]
30 | }
31 |
--------------------------------------------------------------------------------
/.electron-vue/build.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | process.env.NODE_ENV = 'production'
4 |
5 | const { say } = require('cfonts')
6 | const chalk = require('chalk')
7 | const del = require('del')
8 | const { spawn } = require('child_process')
9 | const webpack = require('webpack')
10 | const Multispinner = require('multispinner')
11 |
12 |
13 | const mainConfig = require('./webpack.main.config')
14 | const rendererConfig = require('./webpack.renderer.config')
15 | const webConfig = require('./webpack.web.config')
16 |
17 | const doneLog = chalk.bgGreen.white(' DONE ') + ' '
18 | const errorLog = chalk.bgRed.white(' ERROR ') + ' '
19 | const okayLog = chalk.bgBlue.white(' OKAY ') + ' '
20 | const isCI = process.env.CI || false
21 |
22 | if (process.env.BUILD_TARGET === 'clean') clean()
23 | else if (process.env.BUILD_TARGET === 'web') web()
24 | else build()
25 |
26 | function clean () {
27 | del.sync(['build/*', '!build/icons', '!build/icons/icon.*'])
28 | console.log(`\n${doneLog}\n`)
29 | process.exit()
30 | }
31 |
32 | function build () {
33 | greeting()
34 |
35 | del.sync(['dist/electron/*', '!.gitkeep'])
36 |
37 | const tasks = ['main', 'renderer']
38 | const m = new Multispinner(tasks, {
39 | preText: 'building',
40 | postText: 'process'
41 | })
42 |
43 | let results = ''
44 |
45 | m.on('success', () => {
46 | process.stdout.write('\x1B[2J\x1B[0f')
47 | console.log(`\n\n${results}`)
48 | console.log(`${okayLog}take it away ${chalk.yellow('`electron-builder`')}\n`)
49 | process.exit()
50 | })
51 |
52 | pack(mainConfig).then(result => {
53 | results += result + '\n\n'
54 | m.success('main')
55 | }).catch(err => {
56 | m.error('main')
57 | console.log(`\n ${errorLog}failed to build main process`)
58 | console.error(`\n${err}\n`)
59 | process.exit(1)
60 | })
61 |
62 | pack(rendererConfig).then(result => {
63 | results += result + '\n\n'
64 | m.success('renderer')
65 | }).catch(err => {
66 | m.error('renderer')
67 | console.log(`\n ${errorLog}failed to build renderer process`)
68 | console.error(`\n${err}\n`)
69 | process.exit(1)
70 | })
71 | }
72 |
73 | function pack (config) {
74 | return new Promise((resolve, reject) => {
75 | webpack(config, (err, stats) => {
76 | if (err) reject(err.stack || err)
77 | else if (stats.hasErrors()) {
78 | let err = ''
79 |
80 | stats.toString({
81 | chunks: false,
82 | colors: true
83 | })
84 | .split(/\r?\n/)
85 | .forEach(line => {
86 | err += ` ${line}\n`
87 | })
88 |
89 | reject(err)
90 | } else {
91 | resolve(stats.toString({
92 | chunks: false,
93 | colors: true
94 | }))
95 | }
96 | })
97 | })
98 | }
99 |
100 | function web () {
101 | del.sync(['dist/web/*', '!.gitkeep'])
102 | webpack(webConfig, (err, stats) => {
103 | if (err || stats.hasErrors()) console.log(err)
104 |
105 | console.log(stats.toString({
106 | chunks: false,
107 | colors: true
108 | }))
109 |
110 | process.exit()
111 | })
112 | }
113 |
114 | function greeting () {
115 | const cols = process.stdout.columns
116 | let text = ''
117 |
118 | if (cols > 85) text = 'lets-build'
119 | else if (cols > 60) text = 'lets-|build'
120 | else text = false
121 |
122 | if (text && !isCI) {
123 | say(text, {
124 | colors: ['yellow'],
125 | font: 'simple3d',
126 | space: false
127 | })
128 | } else console.log(chalk.yellow.bold('\n lets-build'))
129 | console.log()
130 | }
131 |
--------------------------------------------------------------------------------
/.electron-vue/dev-client.js:
--------------------------------------------------------------------------------
1 | const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
2 |
3 | hotClient.subscribe(event => {
4 | /**
5 | * Reload browser when HTMLWebpackPlugin emits a new index.html
6 | *
7 | * Currently disabled until jantimon/html-webpack-plugin#680 is resolved.
8 | * https://github.com/SimulatedGREG/electron-vue/issues/437
9 | * https://github.com/jantimon/html-webpack-plugin/issues/680
10 | */
11 | // if (event.action === 'reload') {
12 | // window.location.reload()
13 | // }
14 |
15 | /**
16 | * Notify `mainWindow` when `main` process is compiling,
17 | * giving notice for an expected reload of the `electron` process
18 | */
19 | if (event.action === 'compiling') {
20 | document.body.innerHTML += `
21 |
34 |
35 |
36 | Compiling Main Process...
37 |
38 | `
39 | }
40 | })
41 |
--------------------------------------------------------------------------------
/.electron-vue/dev-runner.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | const chalk = require('chalk')
4 | const electron = require('electron')
5 | const path = require('path')
6 | const { say } = require('cfonts')
7 | const { spawn } = require('child_process')
8 | const webpack = require('webpack')
9 | const WebpackDevServer = require('webpack-dev-server')
10 | const webpackHotMiddleware = require('webpack-hot-middleware')
11 |
12 | const mainConfig = require('./webpack.main.config')
13 | const rendererConfig = require('./webpack.renderer.config')
14 |
15 | let electronProcess = null
16 | let manualRestart = false
17 | let hotMiddleware
18 |
19 | function logStats (proc, data) {
20 | let log = ''
21 |
22 | log += chalk.yellow.bold(`┏ ${proc} Process ${new Array((19 - proc.length) + 1).join('-')}`)
23 | log += '\n\n'
24 |
25 | if (typeof data === 'object') {
26 | data.toString({
27 | colors: true,
28 | chunks: false
29 | }).split(/\r?\n/).forEach(line => {
30 | log += ' ' + line + '\n'
31 | })
32 | } else {
33 | log += ` ${data}\n`
34 | }
35 |
36 | log += '\n' + chalk.yellow.bold(`┗ ${new Array(28 + 1).join('-')}`) + '\n'
37 |
38 | console.log(log)
39 | }
40 |
41 | function startRenderer () {
42 | return new Promise((resolve, reject) => {
43 | rendererConfig.entry.renderer = [path.join(__dirname, 'dev-client')].concat(rendererConfig.entry.renderer)
44 |
45 | const compiler = webpack(rendererConfig)
46 | hotMiddleware = webpackHotMiddleware(compiler, {
47 | log: false,
48 | heartbeat: 2500
49 | })
50 |
51 | compiler.plugin('compilation', compilation => {
52 | compilation.plugin('html-webpack-plugin-after-emit', (data, cb) => {
53 | hotMiddleware.publish({ action: 'reload' })
54 | cb()
55 | })
56 | })
57 |
58 | compiler.plugin('done', stats => {
59 | logStats('Renderer', stats)
60 | })
61 |
62 | const server = new WebpackDevServer(
63 | compiler,
64 | {
65 | contentBase: path.join(__dirname, '../'),
66 | quiet: true,
67 | before (app, ctx) {
68 | app.use(hotMiddleware)
69 | ctx.middleware.waitUntilValid(() => {
70 | resolve()
71 | })
72 | }
73 | }
74 | )
75 |
76 | server.listen(9080)
77 | })
78 | }
79 |
80 | function startMain () {
81 | return new Promise((resolve, reject) => {
82 | mainConfig.entry.main = [path.join(__dirname, '../src/main/index.dev.js')].concat(mainConfig.entry.main)
83 |
84 | const compiler = webpack(mainConfig)
85 |
86 | compiler.plugin('watch-run', (compilation, done) => {
87 | logStats('Main', chalk.white.bold('compiling...'))
88 | hotMiddleware.publish({ action: 'compiling' })
89 | done()
90 | })
91 |
92 | compiler.watch({}, (err, stats) => {
93 | if (err) {
94 | console.log(err)
95 | return
96 | }
97 |
98 | logStats('Main', stats)
99 |
100 | if (electronProcess && electronProcess.kill) {
101 | manualRestart = true
102 | process.kill(electronProcess.pid)
103 | electronProcess = null
104 | startElectron()
105 |
106 | setTimeout(() => {
107 | manualRestart = false
108 | }, 5000)
109 | }
110 |
111 | resolve()
112 | })
113 | })
114 | }
115 |
116 | function startElectron () {
117 | electronProcess = spawn(electron, ['--inspect=5858', path.join(__dirname, '../dist/electron/main.js')])
118 |
119 | electronProcess.stdout.on('data', data => {
120 | electronLog(data, 'blue')
121 | })
122 | electronProcess.stderr.on('data', data => {
123 | electronLog(data, 'red')
124 | })
125 |
126 | electronProcess.on('close', () => {
127 | if (!manualRestart) process.exit()
128 | })
129 | }
130 |
131 | function electronLog (data, color) {
132 | let log = ''
133 | data = data.toString().split(/\r?\n/)
134 | data.forEach(line => {
135 | log += ` ${line}\n`
136 | })
137 | if (/[0-9A-z]+/.test(log)) {
138 | console.log(
139 | chalk[color].bold('┏ Electron -------------------') +
140 | '\n\n' +
141 | log +
142 | chalk[color].bold('┗ ----------------------------') +
143 | '\n'
144 | )
145 | }
146 | }
147 |
148 | function greeting () {
149 | const cols = process.stdout.columns
150 | let text = ''
151 |
152 | if (cols > 104) text = 'electron-vue'
153 | else if (cols > 76) text = 'electron-|vue'
154 | else text = false
155 |
156 | if (text) {
157 | say(text, {
158 | colors: ['yellow'],
159 | font: 'simple3d',
160 | space: false
161 | })
162 | } else console.log(chalk.yellow.bold('\n electron-vue'))
163 | console.log(chalk.blue(' getting ready...') + '\n')
164 | }
165 |
166 | function init () {
167 | greeting()
168 |
169 | Promise.all([startRenderer(), startMain()])
170 | .then(() => {
171 | startElectron()
172 | })
173 | .catch(err => {
174 | console.error(err)
175 | })
176 | }
177 |
178 | init()
179 |
--------------------------------------------------------------------------------
/.electron-vue/webpack.main.config.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | process.env.BABEL_ENV = 'main'
4 |
5 | const path = require('path')
6 | const { dependencies } = require('../package.json')
7 | const webpack = require('webpack')
8 |
9 | const BabiliWebpackPlugin = require('babili-webpack-plugin')
10 |
11 | let mainConfig = {
12 | entry: {
13 | main: path.join(__dirname, '../src/main/index.js')
14 | },
15 | externals: [
16 | ...Object.keys(dependencies || {})
17 | ],
18 | module: {
19 | rules: [
20 | {
21 | test: /\.(js)$/,
22 | enforce: 'pre',
23 | exclude: /node_modules/,
24 | use: {
25 | loader: 'eslint-loader',
26 | options: {
27 | formatter: require('eslint-friendly-formatter')
28 | }
29 | }
30 | },
31 | {
32 | test: /\.js$/,
33 | use: 'babel-loader',
34 | exclude: /node_modules/
35 | },
36 | {
37 | test: /\.node$/,
38 | use: 'node-loader'
39 | }
40 | ]
41 | },
42 | node: {
43 | __dirname: process.env.NODE_ENV !== 'production',
44 | __filename: process.env.NODE_ENV !== 'production'
45 | },
46 | output: {
47 | filename: '[name].js',
48 | libraryTarget: 'commonjs2',
49 | path: path.join(__dirname, '../dist/electron')
50 | },
51 | plugins: [
52 | new webpack.NoEmitOnErrorsPlugin()
53 | ],
54 | resolve: {
55 | extensions: ['.js', '.json', '.node']
56 | },
57 | target: 'electron-main'
58 | }
59 |
60 | /**
61 | * Adjust mainConfig for development settings
62 | */
63 | if (process.env.NODE_ENV !== 'production') {
64 | mainConfig.plugins.push(
65 | new webpack.DefinePlugin({
66 | '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
67 | })
68 | )
69 | }
70 |
71 | /**
72 | * Adjust mainConfig for production settings
73 | */
74 | if (process.env.NODE_ENV === 'production') {
75 | mainConfig.plugins.push(
76 | new BabiliWebpackPlugin(),
77 | new webpack.DefinePlugin({
78 | 'process.env.NODE_ENV': '"production"'
79 | })
80 | )
81 | }
82 |
83 | module.exports = mainConfig
84 |
--------------------------------------------------------------------------------
/.electron-vue/webpack.renderer.config.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | process.env.BABEL_ENV = 'renderer'
4 |
5 | const path = require('path')
6 | const { dependencies } = require('../package.json')
7 | const webpack = require('webpack')
8 |
9 | const BabiliWebpackPlugin = require('babili-webpack-plugin')
10 | const CopyWebpackPlugin = require('copy-webpack-plugin')
11 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
12 | const HtmlWebpackPlugin = require('html-webpack-plugin')
13 |
14 | /**
15 | * List of node_modules to include in webpack bundle
16 | *
17 | * Required for specific packages like Vue UI libraries
18 | * that provide pure *.vue files that need compiling
19 | * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
20 | */
21 | let whiteListedModules = ['vue']
22 |
23 | let rendererConfig = {
24 | devtool: '#cheap-module-eval-source-map',
25 | entry: {
26 | renderer: path.join(__dirname, '../src/renderer/main.js')
27 | },
28 | externals: [
29 | ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d))
30 | ],
31 | module: {
32 | rules: [
33 | {
34 | test: /\.(js|vue)$/,
35 | enforce: 'pre',
36 | exclude: /node_modules/,
37 | use: {
38 | loader: 'eslint-loader',
39 | options: {
40 | formatter: require('eslint-friendly-formatter')
41 | }
42 | }
43 | },
44 | {
45 | test: /\.css$/,
46 | use: ExtractTextPlugin.extract({
47 | fallback: 'style-loader',
48 | use: 'css-loader'
49 | })
50 | },
51 | {
52 | test: /\.html$/,
53 | use: 'vue-html-loader'
54 | },
55 | {
56 | test: /\.js$/,
57 | use: 'babel-loader',
58 | exclude: /node_modules/
59 | },
60 | {
61 | test: /\.node$/,
62 | use: 'node-loader'
63 | },
64 | {
65 | test: /\.vue$/,
66 | use: {
67 | loader: 'vue-loader',
68 | options: {
69 | extractCSS: process.env.NODE_ENV === 'production',
70 | loaders: {
71 | sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1',
72 | scss: 'vue-style-loader!css-loader!sass-loader'
73 | }
74 | }
75 | }
76 | },
77 | {
78 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
79 | use: {
80 | loader: 'url-loader',
81 | query: {
82 | limit: 10000,
83 | name: 'imgs/[name]--[folder].[ext]'
84 | }
85 | }
86 | },
87 | {
88 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
89 | loader: 'url-loader',
90 | options: {
91 | limit: 10000,
92 | name: 'media/[name]--[folder].[ext]'
93 | }
94 | },
95 | {
96 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
97 | use: {
98 | loader: 'url-loader',
99 | query: {
100 | limit: 10000,
101 | name: 'fonts/[name]--[folder].[ext]'
102 | }
103 | }
104 | }
105 | ]
106 | },
107 | node: {
108 | __dirname: process.env.NODE_ENV !== 'production',
109 | __filename: process.env.NODE_ENV !== 'production'
110 | },
111 | plugins: [
112 | new ExtractTextPlugin('styles.css'),
113 | new HtmlWebpackPlugin({
114 | filename: 'index.html',
115 | template: path.resolve(__dirname, '../src/index.ejs'),
116 | minify: {
117 | collapseWhitespace: true,
118 | removeAttributeQuotes: true,
119 | removeComments: true
120 | },
121 | nodeModules: process.env.NODE_ENV !== 'production'
122 | ? path.resolve(__dirname, '../node_modules')
123 | : false
124 | }),
125 | new webpack.HotModuleReplacementPlugin(),
126 | new webpack.NoEmitOnErrorsPlugin()
127 | ],
128 | output: {
129 | filename: '[name].js',
130 | libraryTarget: 'commonjs2',
131 | path: path.join(__dirname, '../dist/electron')
132 | },
133 | resolve: {
134 | alias: {
135 | '@src': path.join(__dirname, '../src'),
136 | '@': path.join(__dirname, '../src/renderer'),
137 | 'vue$': 'vue/dist/vue.esm.js'
138 | },
139 | extensions: ['.js', '.vue', '.json', '.css', '.node']
140 | },
141 | target: 'electron-renderer'
142 | }
143 |
144 | /**
145 | * Adjust rendererConfig for development settings
146 | */
147 | if (process.env.NODE_ENV !== 'production') {
148 | rendererConfig.plugins.push(
149 | new webpack.DefinePlugin({
150 | '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
151 | })
152 | )
153 | }
154 |
155 | /**
156 | * Adjust rendererConfig for production settings
157 | */
158 | if (process.env.NODE_ENV === 'production') {
159 | rendererConfig.devtool = ''
160 |
161 | rendererConfig.plugins.push(
162 | new BabiliWebpackPlugin(),
163 | new CopyWebpackPlugin([
164 | {
165 | from: path.join(__dirname, '../static'),
166 | to: path.join(__dirname, '../dist/electron/static'),
167 | ignore: ['.*']
168 | }
169 | ]),
170 | new webpack.DefinePlugin({
171 | 'process.env.NODE_ENV': '"production"'
172 | }),
173 | new webpack.LoaderOptionsPlugin({
174 | minimize: true
175 | })
176 | )
177 | }
178 |
179 | module.exports = rendererConfig
180 |
--------------------------------------------------------------------------------
/.electron-vue/webpack.web.config.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | process.env.BABEL_ENV = 'web'
4 |
5 | const path = require('path')
6 | const webpack = require('webpack')
7 |
8 | const BabiliWebpackPlugin = require('babili-webpack-plugin')
9 | const CopyWebpackPlugin = require('copy-webpack-plugin')
10 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
11 | const HtmlWebpackPlugin = require('html-webpack-plugin')
12 |
13 | let webConfig = {
14 | devtool: '#cheap-module-eval-source-map',
15 | entry: {
16 | web: path.join(__dirname, '../src/renderer/main.js')
17 | },
18 | module: {
19 | rules: [
20 | {
21 | test: /\.(js|vue)$/,
22 | enforce: 'pre',
23 | exclude: /node_modules/,
24 | use: {
25 | loader: 'eslint-loader',
26 | options: {
27 | formatter: require('eslint-friendly-formatter')
28 | }
29 | }
30 | },
31 | {
32 | test: /\.css$/,
33 | use: ExtractTextPlugin.extract({
34 | fallback: 'style-loader',
35 | use: 'css-loader'
36 | })
37 | },
38 | {
39 | test: /\.html$/,
40 | use: 'vue-html-loader'
41 | },
42 | {
43 | test: /\.js$/,
44 | use: 'babel-loader',
45 | include: [ path.resolve(__dirname, '../src/renderer') ],
46 | exclude: /node_modules/
47 | },
48 | {
49 | test: /\.vue$/,
50 | use: {
51 | loader: 'vue-loader',
52 | options: {
53 | extractCSS: true,
54 | loaders: {
55 | sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1',
56 | scss: 'vue-style-loader!css-loader!sass-loader'
57 | }
58 | }
59 | }
60 | },
61 | {
62 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
63 | use: {
64 | loader: 'url-loader',
65 | query: {
66 | limit: 10000,
67 | name: 'imgs/[name].[ext]'
68 | }
69 | }
70 | },
71 | {
72 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
73 | use: {
74 | loader: 'url-loader',
75 | query: {
76 | limit: 10000,
77 | name: 'fonts/[name].[ext]'
78 | }
79 | }
80 | }
81 | ]
82 | },
83 | plugins: [
84 | new ExtractTextPlugin('styles.css'),
85 | new HtmlWebpackPlugin({
86 | filename: 'index.html',
87 | template: path.resolve(__dirname, '../src/index.ejs'),
88 | minify: {
89 | collapseWhitespace: true,
90 | removeAttributeQuotes: true,
91 | removeComments: true
92 | },
93 | nodeModules: false
94 | }),
95 | new webpack.DefinePlugin({
96 | 'process.env.IS_WEB': 'true'
97 | }),
98 | new webpack.HotModuleReplacementPlugin(),
99 | new webpack.NoEmitOnErrorsPlugin()
100 | ],
101 | output: {
102 | filename: '[name].js',
103 | path: path.join(__dirname, '../dist/web')
104 | },
105 | resolve: {
106 | alias: {
107 | '@': path.join(__dirname, '../src/renderer'),
108 | 'vue$': 'vue/dist/vue.esm.js'
109 | },
110 | extensions: ['.js', '.vue', '.json', '.css']
111 | },
112 | target: 'web'
113 | }
114 |
115 | /**
116 | * Adjust webConfig for production settings
117 | */
118 | if (process.env.NODE_ENV === 'production') {
119 | webConfig.devtool = ''
120 |
121 | webConfig.plugins.push(
122 | new BabiliWebpackPlugin(),
123 | new CopyWebpackPlugin([
124 | {
125 | from: path.join(__dirname, '../static'),
126 | to: path.join(__dirname, '../dist/web/static'),
127 | ignore: ['.*']
128 | }
129 | ]),
130 | new webpack.DefinePlugin({
131 | 'process.env.NODE_ENV': '"production"'
132 | }),
133 | new webpack.LoaderOptionsPlugin({
134 | minimize: true
135 | })
136 | )
137 | }
138 |
139 | module.exports = webConfig
140 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ooooevan/Vmail/c2e95c18fd6e136cf33d6f170858da6aebae8ad4/.eslintignore
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parser: 'babel-eslint',
4 | parserOptions: {
5 | sourceType: 'module'
6 | },
7 | env: {
8 | browser: true,
9 | node: true
10 | },
11 | extends: 'standard',
12 | globals: {
13 | __static: true
14 | },
15 | plugins: [
16 | 'html'
17 | ],
18 | 'rules': {
19 | // allow paren-less arrow functions
20 | 'arrow-parens': 0,
21 | // allow async-await
22 | 'generator-star-spacing': 0,
23 | // allow debugger during development
24 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | dist/electron/*
3 | dist/web/*
4 | build/*
5 | !build/icons
6 | node_modules/
7 | npm-debug.log
8 | npm-debug.log.*
9 | thumbs.db
10 | !.gitkeep
11 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | osx_image: xcode8.3
2 | sudo: required
3 | dist: trusty
4 | language: c
5 | matrix:
6 | include:
7 | - os: osx
8 | - os: linux
9 | env: CC=clang CXX=clang++ npm_config_clang=1
10 | compiler: clang
11 | cache:
12 | directories:
13 | - node_modules
14 | - "$HOME/.electron"
15 | - "$HOME/.cache"
16 | addons:
17 | apt:
18 | packages:
19 | - libgnome-keyring-dev
20 | - icnsutils
21 | before_install:
22 | - mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v1.2.1/git-lfs-$([
23 | "$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-1.2.1.tar.gz
24 | | tar -xz -C /tmp/git-lfs --strip-components 1 && /tmp/git-lfs/git-lfs pull
25 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install --no-install-recommends -y icnsutils graphicsmagick xz-utils; fi
26 | install:
27 | - nvm install 7
28 | - curl -o- -L https://yarnpkg.com/install.sh | bash
29 | - source ~/.bashrc
30 | - npm install -g xvfb-maybe
31 | - yarn
32 | script:
33 | - yarn run build
34 | branches:
35 | only:
36 | - master
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 evan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 关于项目
2 |
3 | 这是我的毕业设计(2018),邮件客户端
4 |
5 | 包含收发邮件、通讯录、多账户登录、本地数据保存等功能
6 |
7 | ## 使用的相关模块
8 |
9 | * 用electron-vue构建项目
10 | * 用node-imap模块接收邮件
11 | * 用nodemailer发送邮件
12 | * 用element-ui组件库
13 | * 用lowdb做本地数据存储
14 | * 用iconv-lite、quoted-printable、utf8等处理编码
15 | * 用vue-quill-editor做富文本编辑器
16 |
17 | ## 调试运行
18 |
19 | ``` bash
20 | npm run dev # 调试运行,localhost:9080
21 |
22 | npm run build # 打包
23 | ```
24 |
25 | ## 页面截图
26 |
27 | 
28 |
29 | 
30 |
31 | 
32 |
33 | 
34 |
35 | ## 项目目录
36 |
37 | 最外层结构是由electron-vue创建,主要看src的结构
38 |
39 | ``` md
40 | ─ src
41 | ├── main
42 | │ ├── index.js #主进程,创建渲染进程
43 | ├── models #定义模型,用于封装对象
44 | ├── renrender #渲染进程,里面就是一个vue项目目录
45 | │ ├── common #一些重要的js函数与公共样式
46 | │ ├── javascript
47 | │ ├── cache.js #硬盘存取相关函数
48 | │ ├── config.js #存放配置及正则表达式
49 | │ ├── getEmail.js #获取email的函数
50 | │ ├── parseEmail.js #解析email的函数
51 | │ ├── sendEmail.js #发送email的函数
52 | │ ├── style
53 | │ ├── components #存放组件
54 | │ ├── pages #存放页面
55 | │ ├── router #路由
56 | │ ├── store #vuex的store相关文件
57 | │ ├── app.vue #vue页面最外层结构
58 | │ ├── main.js #vue项目入口
59 | ├── index.ejs #electron页面入口
60 | ```
61 |
62 | 具体可看[博客](https://ooooevan.github.io/2018/05/10/electron-vue%E9%82%AE%E4%BB%B6%E5%AE%A2%E6%88%B7%E7%AB%AF/)
63 |
64 | 如果有错,望指正,若觉得还可以,可以点个star
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 0.1.{build}
2 |
3 | branches:
4 | only:
5 | - master
6 |
7 | image: Visual Studio 2017
8 | platform:
9 | - x64
10 |
11 | cache:
12 | - node_modules
13 | - '%APPDATA%\npm-cache'
14 | - '%USERPROFILE%\.electron'
15 | - '%USERPROFILE%\AppData\Local\Yarn\cache'
16 |
17 | init:
18 | - git config --global core.autocrlf input
19 |
20 | install:
21 | - ps: Install-Product node 8 x64
22 | - choco install yarn --ignore-dependencies
23 | - git reset --hard HEAD
24 | - yarn
25 | - node --version
26 |
27 | build_script:
28 | - yarn build
29 |
30 | test: off
31 |
--------------------------------------------------------------------------------
/build/icons/256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ooooevan/Vmail/c2e95c18fd6e136cf33d6f170858da6aebae8ad4/build/icons/256x256.png
--------------------------------------------------------------------------------
/build/icons/icon.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ooooevan/Vmail/c2e95c18fd6e136cf33d6f170858da6aebae8ad4/build/icons/icon.icns
--------------------------------------------------------------------------------
/build/icons/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ooooevan/Vmail/c2e95c18fd6e136cf33d6f170858da6aebae8ad4/build/icons/icon.ico
--------------------------------------------------------------------------------
/dist/electron/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ooooevan/Vmail/c2e95c18fd6e136cf33d6f170858da6aebae8ad4/dist/electron/.gitkeep
--------------------------------------------------------------------------------
/dist/web/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ooooevan/Vmail/c2e95c18fd6e136cf33d6f170858da6aebae8ad4/dist/web/.gitkeep
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vmail",
3 | "version": "0.9.0",
4 | "author": "ooooevan <635638508@qq.com>",
5 | "description": "An email client",
6 | "license": null,
7 | "main": "./dist/electron/main.js",
8 | "scripts": {
9 | "build": "node .electron-vue/build.js && electron-builder",
10 | "build:dir": "node .electron-vue/build.js && electron-builder --dir",
11 | "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
12 | "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
13 | "dev": "node .electron-vue/dev-runner.js",
14 | "lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src",
15 | "lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src",
16 | "pack": "npm run pack:main && npm run pack:renderer",
17 | "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
18 | "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
19 | "postinstall": "npm run lint:fix"
20 | },
21 | "build": {
22 | "productName": "vmail",
23 | "appId": "org.simulatedgreg.vmail",
24 | "directories": {
25 | "output": "build"
26 | },
27 | "publish": [
28 | {
29 | "provider": "generic",
30 | "url": "http://localhost:9080/build"
31 | }
32 | ],
33 | "files": [
34 | "dist/electron/**/*"
35 | ],
36 | "dmg": {
37 | "contents": [
38 | {
39 | "x": 410,
40 | "y": 150,
41 | "type": "link",
42 | "path": "/Applications"
43 | },
44 | {
45 | "x": 130,
46 | "y": 150,
47 | "type": "file"
48 | }
49 | ]
50 | },
51 | "mac": {
52 | "icon": "build/icons/icon.icns"
53 | },
54 | "win": {
55 | "icon": "build/icons/icon.ico"
56 | },
57 | "linux": {
58 | "icon": "build/icons"
59 | }
60 | },
61 | "dependencies": {
62 | "electron-updater": "^2.21.10",
63 | "element-ui": "^2.2.0",
64 | "iconv-lite": "^0.4.19",
65 | "imap": "^0.8.19",
66 | "lowdb": "^1.0.0",
67 | "moment": "^2.20.1",
68 | "nodemailer": "^4.6.0",
69 | "quoted-printable": "^1.0.1",
70 | "utf8": "^3.0.0",
71 | "vue": "^2.3.3",
72 | "vue-electron": "^1.0.6",
73 | "vue-quill-editor": "^3.0.5",
74 | "vue-router": "^2.5.3",
75 | "vuex": "^2.3.1"
76 | },
77 | "devDependencies": {
78 | "babel-core": "^6.25.0",
79 | "babel-eslint": "^7.2.3",
80 | "babel-loader": "^7.1.1",
81 | "babel-plugin-transform-runtime": "^6.23.0",
82 | "babel-preset-env": "^1.6.0",
83 | "babel-preset-stage-0": "^6.24.1",
84 | "babel-register": "^6.24.1",
85 | "babili-webpack-plugin": "^0.1.2",
86 | "cfonts": "^1.1.3",
87 | "chalk": "^2.1.0",
88 | "copy-webpack-plugin": "^4.0.1",
89 | "cross-env": "^5.0.5",
90 | "css-loader": "^0.28.4",
91 | "del": "^3.0.0",
92 | "devtron": "^1.4.0",
93 | "electron": "^7.2.4",
94 | "electron-builder": "^19.19.1",
95 | "electron-debug": "^1.4.0",
96 | "electron-devtools-installer": "^2.2.0",
97 | "electron-prebuilt": "^1.4.13",
98 | "electron-rebuild": "^1.7.3",
99 | "eslint": "^4.4.1",
100 | "eslint-config-standard": "^10.2.1",
101 | "eslint-friendly-formatter": "^3.0.0",
102 | "eslint-loader": "^1.9.0",
103 | "eslint-plugin-html": "^3.1.1",
104 | "eslint-plugin-import": "^2.7.0",
105 | "eslint-plugin-node": "^5.1.1",
106 | "eslint-plugin-promise": "^3.5.0",
107 | "eslint-plugin-standard": "^3.0.1",
108 | "extract-text-webpack-plugin": "^3.0.0",
109 | "file-loader": "^0.11.2",
110 | "html-webpack-plugin": "^2.30.1",
111 | "multispinner": "^0.2.1",
112 | "node-loader": "^0.6.0",
113 | "style-loader": "^0.18.2",
114 | "url-loader": "^0.5.9",
115 | "vue-html-loader": "^1.2.4",
116 | "vue-loader": "^13.0.5",
117 | "vue-style-loader": "^3.0.1",
118 | "vue-template-compiler": "^2.4.2",
119 | "webpack": "^3.5.2",
120 | "webpack-dev-server": "^2.7.1",
121 | "webpack-hot-middleware": "^2.18.2"
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/src/index.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | vmail
6 | <% if (htmlWebpackPlugin.options.nodeModules) { %>
7 |
8 |
11 | <% } %>
12 |
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/main/index.dev.js:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is used specifically and only for development. It installs
3 | * `electron-debug` & `vue-devtools`. There shouldn't be any need to
4 | * modify this file, but it can be used to extend your development
5 | * environment.
6 | */
7 |
8 | /* eslint-disable */
9 |
10 | // Set environment for development
11 | process.env.NODE_ENV = 'development'
12 |
13 | // Install `electron-debug` with `devtron`
14 | require('electron-debug')({ showDevTools: true })
15 |
16 | // Install `vue-devtools`
17 | require('electron').app.on('ready', () => {
18 | let installExtension = require('electron-devtools-installer')
19 | installExtension.default(installExtension.VUEJS_DEVTOOLS)
20 | .then(() => {})
21 | .catch(err => {
22 | console.log('Unable to install `vue-devtools`: \n', err)
23 | })
24 | })
25 |
26 | // Require `main` process to boot app
27 | require('./index')
28 |
--------------------------------------------------------------------------------
/src/main/index.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | import { app, BrowserWindow } from 'electron'
3 | import Config from '../models/config'
4 | const low = require('lowdb')
5 | const FileSync = require('lowdb/adapters/FileSync')
6 | const path = require('path')
7 |
8 | /**
9 | * Set `__static` path to static files in production
10 | * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
11 | */
12 | if (process.env.NODE_ENV !== 'development') {
13 | global.__static = path.join(__dirname, '/static').replace(/\\/g, '\\\\')
14 | }
15 |
16 | // console.log(`home ${app.getPath('home')}`) // 获取用户根目录
17 | // console.log(`userData ${app.getPath('userData')}`) // 用于存储 app 用户数据目录
18 | // console.log(`appData ${app.getPath('appData')}`) // 用于存储 app 数据的目录,升级会被覆盖
19 | // console.log(`desktop ${app.getPath('desktop')}`) // 桌面目录
20 | const config = new FileSync(path.join(app.getPath('userData'), 'config.json'))
21 | const db = low(config)
22 | db.defaults(new Config()).write()
23 | let mainWindow
24 | const winURL = process.env.NODE_ENV === 'development'
25 | ? `http://localhost:9080`
26 | : `file://${__dirname}/index.html`
27 | function createWindow () {
28 | mainWindow = new BrowserWindow({
29 | height: 563,
30 | useContentSize: true,
31 | autoHideMenuBar: true,
32 | title: 'Vmail',
33 | disableAutoHideCursor: true,
34 | frame: false, // 没有边框
35 | // transparent: true, // 边框,不随系统
36 | // titleBarStyle: 'hidden-inset',
37 | width: 1000
38 | })
39 |
40 | mainWindow.loadURL(winURL)
41 | mainWindow.on('closed', () => {
42 | mainWindow = null
43 | })
44 | }
45 |
46 | app.on('ready', createWindow)
47 |
48 | app.on('window-all-closed', () => {
49 | if (process.platform !== 'darwin') {
50 | app.quit()
51 | }
52 | })
53 |
54 | app.on('activate', () => {
55 | if (mainWindow === null) {
56 | createWindow()
57 | }
58 | })
59 |
60 | /**
61 | * Auto Updater
62 | *
63 | * Uncomment the following code below and install `electron-updater` to
64 | * support auto updating. Code Signing with a valid certificate is required.
65 | * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-builder.html#auto-updating
66 | */
67 |
68 | /*
69 | import { autoUpdater } from 'electron-updater'
70 | autoUpdater.on('update-downloaded', () => {
71 | autoUpdater.quitAndInstall()
72 | })
73 | app.on('ready', () => {
74 | if (process.env.NODE_ENV === 'production') autoUpdater.checkForUpdates()
75 | })
76 | */
77 |
--------------------------------------------------------------------------------
/src/models/address_group.js:
--------------------------------------------------------------------------------
1 | export default class Group {
2 | constructor (name, id = +new Date()) {
3 | this.name = name
4 | this.id = id
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/models/address_list.js:
--------------------------------------------------------------------------------
1 | export default class Friends {
2 | constructor (name, email, group, status = 0) {
3 | this.name = name
4 | this.email = email
5 | this.group = group
6 | this.status = status
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/models/config.js:
--------------------------------------------------------------------------------
1 | import User from './user'
2 | export default class Config {
3 | constructor (currentUser = User, userList = []) {
4 | this.currentUser = currentUser
5 | this.userList = userList
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/models/email_list.js:
--------------------------------------------------------------------------------
1 | export default class EmailList {
2 | constructor (id, from, to, date, subject, isRead = false, isStar = false) {
3 | this.id = id
4 | this.from = (this.from || []).concat(from)
5 | this.to = (this.to || []).concat(to)
6 | this.date = date
7 | this.subject = (this.subject || []).concat(subject)
8 | this.isRead = isRead
9 | this.isStar = isStar
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/models/emails.js:
--------------------------------------------------------------------------------
1 | export default class Emails {
2 | constructor (id, from, to, date, subject, bodyText, emailText, bodyHtml, attachment = [], status = '', isStar = false) {
3 | this.id = id
4 | this.from = from
5 | this.to = to
6 | this.date = date
7 | this.subject = subject
8 | this.emailText = emailText
9 | this.bodyText = bodyText
10 | this.bodyHtml = bodyHtml
11 | this.attachment = attachment
12 | this.status = status
13 | this.isStar = isStar
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/models/user.js:
--------------------------------------------------------------------------------
1 | export default class User {
2 | constructor (email = '', name = '', password = '', sentList = [], emailList = [], draftList = [], addressList = [], groupList = [], updateAt = new Date()) {
3 | this.email = email
4 | this.name = name
5 | this.password = password
6 | this.emailList = emailList
7 | this.sentList = sentList
8 | this.draftList = draftList
9 | this.addressList = addressList
10 | this.groupList = groupList
11 | this.updateAt = updateAt
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/renderer/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
71 |
72 |
80 |
--------------------------------------------------------------------------------
/src/renderer/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ooooevan/Vmail/c2e95c18fd6e136cf33d6f170858da6aebae8ad4/src/renderer/assets/.gitkeep
--------------------------------------------------------------------------------
/src/renderer/common/javascript/cache.js:
--------------------------------------------------------------------------------
1 | // import electron from 'electron'
2 | // import User from '../../../models/user'
3 | import { PATH, getPersonalPath, getPersonalDirPath, getEmailDetailPath, htmlTypeReg, mixedMultipart } from './config'
4 | import User from '../../../models/user'
5 | const fs = require('fs')
6 | // const iconv = require('iconv-lite')
7 | // import { getEmailList } from './getEmail'
8 | const low = require('lowdb')
9 | const FileSync = require('lowdb/adapters/FileSync')
10 |
11 | // 从硬盘获取邮件列表
12 | export function _getDiskMailList (_box) {
13 | let box = 'emailList'
14 | if (_box === 'sent') {
15 | box = 'sentList'
16 | } else if (_box === 'draft') {
17 | box = 'draftList'
18 | }
19 | const email = _getUser().email
20 | if (!email) {
21 | // 没有已登录的账户
22 | return null
23 | } else {
24 | const userData = low(new FileSync(getPersonalPath(email)))
25 | return userData.get(box).write()
26 | }
27 | }
28 |
29 | export function _getDiskAdressList () {
30 | const email = _getUser().email
31 | if (!email) {
32 | // 没有已登录的账户
33 | return null
34 | } else {
35 | const userData = low(new FileSync(getPersonalPath(email)))
36 | return userData.get('addressList').write()
37 | }
38 | }
39 | export function _getDiskGroupList () {
40 | const email = _getUser().email
41 | if (!email) {
42 | // 没有已登录的账户
43 | return null
44 | } else {
45 | const userData = low(new FileSync(getPersonalPath(email)))
46 | return userData.get('groupList').write()
47 | }
48 | }
49 | // 保存通讯录列表
50 | export function _saveAddressList (list) {
51 | const email = _getUser().email
52 | const userData = low(new FileSync(getPersonalPath(email)))
53 | userData.set('addressList', list).write()
54 | return list
55 | }
56 | // 保存通讯录分组列表
57 | export function _saveGroupList (list) {
58 | const email = _getUser().email
59 | const userData = low(new FileSync(getPersonalPath(email)))
60 | userData.set('groupList', list).write()
61 | return list
62 | }
63 |
64 | // 保存收件箱列表
65 | export function _saveEmailList (list) {
66 | const email = _getUser().email
67 | const userData = low(new FileSync(getPersonalPath(email)))
68 | userData.set('emailList', list).write()
69 | return list
70 | }
71 | // 保存发件箱列表
72 | export function _saveSentEmailList (list) {
73 | const email = _getUser().email
74 | const userData = low(new FileSync(getPersonalPath(email)))
75 | userData.set('sentList', list).write()
76 | return list
77 | }
78 | // 保存草稿箱列表
79 | export function _saveDraftsEmailList (list) {
80 | const email = _getUser().email
81 | const userData = low(new FileSync(getPersonalPath(email)))
82 | userData.set('draftList', list).write()
83 | return list
84 | }
85 |
86 | // 从硬盘获取一封邮件信息,若没有此文件则自动创建
87 | export function _getDiskEmail (id) {
88 | const email = _getUser().email
89 | const emailDetail = low(new FileSync(getEmailDetailPath(email, id)))
90 | return emailDetail.getState()
91 | }
92 | // 将网络获取的邮件存储在硬盘
93 | export function _saveDiskEmail (detail) {
94 | delete detail.emailText
95 | const email = _getUser().email
96 | const contentType = detail.header['content-type'].join('')
97 | let db
98 | let _detail = {
99 | ...detail
100 | }
101 | db = low(new FileSync(getEmailDetailPath(email, `${_detail.attr.uid}`)))
102 | if (contentType.match(htmlTypeReg)) {
103 | fs.writeFileSync(getEmailDetailPath(email, `${_detail.attr.uid}.html`), _detail.body.bodyHtml.replace(/charset=([^]+?")/, '"'))
104 | // 单独存了html,就不用再重复存了,bodyHtml属性存地址
105 | _detail = {
106 | ..._detail,
107 | body: {
108 | ..._detail.body,
109 | bodyHtml: getEmailDetailPath(email, `${_detail.attr.uid}.html`)
110 | }
111 | }
112 | } else if (contentType.match(mixedMultipart)) {
113 | const prefix = `${Math.random()}`.substr(2)
114 | _detail.body.attachment.forEach(item => {
115 | fs.writeFileSync(getEmailDetailPath(email, `${prefix}${item.name.trim()}`), Buffer.from(item.content, 'base64'))
116 | })
117 | _detail = {
118 | ..._detail,
119 | body: {
120 | ..._detail.body,
121 | attachment: _detail.body.attachment.map(x => ({name: x.name, location: getEmailDetailPath(email, `${prefix}${x.name.trim()}`)}))
122 | }
123 | }
124 | }
125 | // 添加:将html也单独为一个文件
126 | if (!contentType.match(htmlTypeReg)) {
127 | const html = _detail.body.bodyHtml
128 | if (html && html.length > 100 && (html.match(/
222 |
--------------------------------------------------------------------------------
/src/renderer/components/header.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
72 |
121 |
--------------------------------------------------------------------------------
/src/renderer/components/letter-table.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
15 |
16 |
17 | {{type === 'inbox' ? '发件人' : '收件人'}} |
18 | 主题 |
19 | 日期 |
20 |
21 |
22 |
23 |
28 | {{cutstr(type == 'inbox' ? item.from.join(';') : item.to.join(';'))}} |
29 | {{item.subject}} |
30 | {{item.date}} |
31 | |
32 |
33 |
34 |
35 |
36 | 目前还没有邮件
37 |
38 |
45 |
46 |
47 |
115 |
183 |
--------------------------------------------------------------------------------
/src/renderer/components/slide.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
42 |
43 |
44 |
92 |
130 |
--------------------------------------------------------------------------------
/src/renderer/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import ElementUI from 'element-ui'
3 | import moment from 'moment'
4 | import 'element-ui/lib/theme-chalk/index.css'
5 | import './common/style/reset.css'
6 | import VueQuillEditor from 'vue-quill-editor'
7 | // require VueQuillEditor styles
8 | import 'quill/dist/quill.core.css'
9 | import 'quill/dist/quill.snow.css'
10 | import 'quill/dist/quill.bubble.css'
11 | import App from './App'
12 | import router from './router'
13 | import store from './store'
14 |
15 | Object.defineProperty(Vue.prototype, '$moment', {value: moment})
16 | Vue.use(VueQuillEditor)
17 | Vue.use(ElementUI)
18 | if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
19 | // Vue.config.productionTip = false
20 |
21 | /* eslint-disable no-new */
22 | new Vue({
23 | components: { App },
24 | router,
25 | store,
26 | template: ''
27 | }).$mount('#app')
28 |
--------------------------------------------------------------------------------
/src/renderer/pages/address-list.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
21 |
33 |
--------------------------------------------------------------------------------
/src/renderer/pages/drafts-mail.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
18 |
45 |
--------------------------------------------------------------------------------
/src/renderer/pages/inbox-mail.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
28 |
55 |
--------------------------------------------------------------------------------
/src/renderer/pages/letter.vue:
--------------------------------------------------------------------------------
1 |
2 |
32 |
33 |
69 |
89 |
--------------------------------------------------------------------------------
/src/renderer/pages/login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | 帮助
4 |
5 |
6 |
7 |
12 |
13 |
14 |
15 |
16 |
17 | 登录
18 |
19 |
20 |
21 |
22 |
93 |
110 |
--------------------------------------------------------------------------------
/src/renderer/pages/mail-details.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
{{header.subject.join(',')}}
9 |
发件人:{{header.from.join(',').replace(/"/g, '')}}
10 |
时间:{{header.date.length && this.$moment(header.date.join(',')).format('YYYY-MM-DD HH:mm:ss') || ''}}
11 |
收件人:{{header.to.join(',').substr(0, 45).replace(/"/g, '')}}
12 |
附件:{{body.attachment.map(x => (x.name)).join('、').substr(0, 45)}}
13 |
14 |
15 |
{{attach.name}}
16 |
17 |
18 |
19 |
20 |
21 |
{{body.bodyText}}
22 |
23 |
24 |
25 |
159 |
221 |
--------------------------------------------------------------------------------
/src/renderer/pages/notfind.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | notfind
4 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/src/renderer/pages/sent-mail.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
23 |
50 |
--------------------------------------------------------------------------------
/src/renderer/pages/star-mail.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
23 |
50 |
--------------------------------------------------------------------------------
/src/renderer/pages/write.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
28 | 选择文件
29 |
30 |
31 |
32 |
37 |
38 |
39 |
40 |
47 |
48 |
49 |
58 |
59 |
67 |
68 |
69 |
70 |
71 |
72 |
197 |
238 |
--------------------------------------------------------------------------------
/src/renderer/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import letter from '@/pages/letter'
4 | import inboxMail from '@/pages/inbox-mail'
5 | import starMail from '@/pages/star-mail'
6 | import draftsMail from '@/pages/drafts-mail'
7 | import sentMail from '@/pages/sent-mail'
8 | import writeMail from '@/pages/write'
9 | import mailDetails from '@/pages/mail-details'
10 | import addressList from '@/pages/address-list'
11 |
12 | import notfind from '@/pages/notfind'
13 | Vue.use(Router)
14 |
15 | export default new Router({
16 | routes: [
17 | {
18 | path: '/',
19 | redirect: '/letter'
20 | // component: letter
21 | },
22 | {
23 | path: '/letter',
24 | redirect: '/letter/inbox',
25 | component: letter,
26 | children: [
27 | {
28 | path: 'inbox',
29 | component: inboxMail
30 | },
31 | {
32 | path: 'star',
33 | component: starMail
34 | },
35 | {
36 | path: 'drafts',
37 | component: draftsMail
38 | },
39 | {
40 | path: 'sent',
41 | component: sentMail
42 | },
43 | {
44 | path: 'write',
45 | redirect: '/write'
46 | }
47 | ]
48 | },
49 | {
50 | path: '/mailDetails/:id',
51 | component: mailDetails
52 | },
53 | {
54 | path: '/write',
55 | component: writeMail
56 | },
57 | {
58 | path: '/addressList',
59 | component: addressList
60 | },
61 | {
62 | path: '*',
63 | // redirect: '/',
64 | component: notfind
65 | }
66 | ]
67 | })
68 |
--------------------------------------------------------------------------------
/src/renderer/store/actions.js:
--------------------------------------------------------------------------------
1 | import * as types from './mutations-type'
2 | import store from './index'
3 | import { _saveEmailList, _saveSentEmailList, _saveDiskEmail, _saveUser, _deleteUser, _getDiskEmail, _getDiskMailList, _getDiskAdressList, _getDiskGroupList, _saveGroupList, _saveAddressList, _saveDraftsEmailList, _getUserList } from '@/common/javascript/cache'
4 | import { _getEmailList, _getEmailDetail, _testAccount } from '@/common/javascript/getEmail'
5 | import { _sendEmail } from '@/common/javascript/sendEmail'
6 | import Friends from '@src/models/address_list'
7 | import Groups from '@src/models/address_group'
8 | import EmailList from '@src/models/email_list'
9 | const { shell } = require('electron')
10 | export function updateEmailList ({commit, state}) {
11 | commit(types.SET_UPDATING, true)
12 | let inboxResult = [].concat(state.inboxMail)
13 | let sentResult = [].concat(state.sentMail)
14 | let draftResult = [].concat(state.draftMail)
15 | const user = state.user
16 | let done = 0
17 | if (!user.email) {
18 | return false
19 | }
20 | _getEmailList(user, 'inbox', inboxResult[0] && inboxResult[0].id).then(res => {
21 | store.dispatch('isOffline', false)
22 | res.forEach(item => {
23 | let add = true
24 | state.inboxMail.forEach(email => {
25 | if (email.id === item.id) {
26 | add = false
27 | }
28 | })
29 | if (add) {
30 | // 新的邮件,自动去获取并保存
31 | store.dispatch('getEmailDetail', {id: item.id, type: 'inbox'})
32 | inboxResult = [item].concat(inboxResult)
33 | }
34 | })
35 | commit(types.UPDATE_MAIL_LIST, _saveEmailList(inboxResult))
36 | done++
37 | if (done === 3) {
38 | commit(types.SET_UPDATING, false)
39 | }
40 | }).catch(err => {
41 | if (done === 0) {
42 | store.dispatch('isOffline', true)
43 | commit(types.SET_UPDATING, false)
44 | } else {
45 | alert('获取收件箱错误:' + JSON.stringify(err))
46 | }
47 | })
48 | _getEmailList(user, 'sent').then(res => {
49 | store.dispatch('isOffline', false)
50 | res.forEach(item => {
51 | let add = true
52 | state.sentMail.forEach(email => {
53 | if (email.id === item.id) {
54 | add = false
55 | }
56 | })
57 | if (add) {
58 | store.dispatch('getEmailDetail', {id: item.id, type: 'sent'})
59 | sentResult = [item].concat(sentResult)
60 | }
61 | })
62 | commit(types.SET_SENT_MAIL_LIST, _saveSentEmailList(sentResult))
63 | done++
64 | if (done === 3) {
65 | commit(types.SET_UPDATING, false)
66 | }
67 | }).catch(err => {
68 | if (done === 0) {
69 | store.dispatch('isOffline', true)
70 | commit(types.SET_UPDATING, false)
71 | } else {
72 | alert('获取发件箱错误:' + JSON.stringify(err))
73 | }
74 | })
75 | _getEmailList(user, 'draft').then(res => {
76 | store.dispatch('isOffline', false)
77 | res.forEach(item => {
78 | let add = true
79 | state.draftMail.forEach(email => {
80 | if (email.id === item.id) {
81 | add = false
82 | }
83 | })
84 | if (add) {
85 | store.dispatch('getEmailDetail', {id: item.id, type: 'draft'})
86 | draftResult = [item].concat(draftResult)
87 | }
88 | })
89 | commit(types.SET_DRAFTS_MAIL_LIST, _saveDraftsEmailList(draftResult))
90 | done++
91 | if (done === 3) {
92 | commit(types.SET_UPDATING, false)
93 | }
94 | }).catch(err => {
95 | if (done === 0) {
96 | store.dispatch('isOffline', true)
97 | commit(types.SET_UPDATING, false)
98 | } else {
99 | alert('获取草稿箱错误:' + JSON.stringify(err))
100 | }
101 | })
102 | }
103 |
104 | export function getEmailDetail ({commit, state}, {id, type}) {
105 | const email = _getDiskEmail(id)
106 | if (email.body && (email.body.bodyHtml || email.body.bodyText)) {
107 | commit(types.SET_EMAIL_DETAIL, email)
108 | } else {
109 | const user = state.user
110 | _getEmailDetail(user, id, type).then(res => {
111 | if (!res.body || (!res.body.bodyHtml && !res.header.to)) {
112 | alert('该邮件太久远,无法获取')
113 | window.history.back()
114 | } else {
115 | commit(types.SET_EMAIL_DETAIL, _saveDiskEmail(res))
116 | }
117 | })
118 | }
119 | }
120 |
121 | export function sendEmail ({commit, state}, {emailData, fileList}) {
122 | commit(types.SET_SENDING_STATUS, {
123 | sending: true
124 | })
125 | const user = state.user
126 | _sendEmail(user, emailData, fileList).then(res => {
127 | commit(types.SET_SENDING_STATUS, {
128 | sending: false,
129 | err: null
130 | })
131 | }).catch(err => {
132 | commit(types.SET_SENDING_STATUS, {
133 | sending: false,
134 | err
135 | })
136 | })
137 | }
138 |
139 | export function saveDraft ({commit, state}, {emailData}) {
140 | const id = `${Math.random()}`.substr(2)
141 | const item = new EmailList(id, state.user.email, emailData.to, new Date(), emailData.subject)
142 | const draftResult = [item].concat(state.draftMail)
143 | commit(types.SET_DRAFTS_MAIL_LIST, _saveDraftsEmailList(draftResult))
144 | }
145 |
146 | export function addOneAddress ({commit, state}, form) {
147 | form = new Friends(form.name, form.email, form.group)
148 | let result = [].concat(state.addressList)
149 | let add = true
150 | state.addressList.forEach(item => {
151 | if (form.email === item.email) {
152 | add = false
153 | }
154 | })
155 | if (add) {
156 | result = [form].concat(result)
157 | commit(types.SET_ADDRESS_LIST, _saveAddressList(result))
158 | } else {
159 | alert(`邮箱${form.email} 已经在通讯录`)
160 | }
161 | }
162 | export function delOneAddress ({commit, state}, item) {
163 | const email = item.email
164 | let result = [].concat(state.addressList)
165 | result = result.filter(x => (x.email !== email))
166 | commit(types.SET_ADDRESS_LIST, _saveAddressList(result))
167 | }
168 | export function addGroup ({commit, state}, name) {
169 | const group = new Groups(name)
170 | let result = [].concat(state.groupList)
171 | let add = true
172 | state.groupList.forEach(item => {
173 | if (name === item.name) {
174 | add = false
175 | }
176 | })
177 | if (add) {
178 | result = [group].concat(result)
179 | commit(types.SET_GROUP_LIST, _saveGroupList(result))
180 | } else {
181 | alert(`已经存在"${name}"分组`)
182 | }
183 | }
184 | export function removeGroup ({commit, state}, tag) {
185 | const id = tag.id
186 | let result = [].concat(state.groupList)
187 | result = result.filter(x => (x.id !== id))
188 | commit(types.SET_GROUP_LIST, _saveGroupList(result))
189 | }
190 |
191 | export function testAccount ({commit, state}, user) {
192 | _testAccount(user).then(res => {
193 | store.dispatch('changeUser', user)
194 | store.dispatch('hideLogin')
195 | }).catch(eee => {
196 | if (user.email.match(/163/) && eee.message.match(/unsafe/i)) {
197 | const url = `http://config.mail.163.com/settings/imap/index.jsp?uid=${user.email}`
198 | shell.openExternal(url)
199 | } else {
200 | alert('登录失败')
201 | }
202 | store.dispatch('hideLogin')
203 | })
204 | }
205 |
206 | export function isOffline ({commit, state}, boolean) {
207 | commit(types.SET_IS_OFFLINE, boolean)
208 | }
209 |
210 | export function showLogin ({commit, state}) {
211 | commit(types.SET_SHOW_LOGIN, true)
212 | }
213 |
214 | export function hideLogin ({commit, state}) {
215 | commit(types.SET_SHOW_LOGIN, false)
216 | }
217 |
218 | export function changeUser ({commit, state}, user) {
219 | _saveUser(user).then(() => {
220 | commit(types.SET_USER, user)
221 | commit(types.UPDATE_MAIL_LIST, _getDiskMailList('inbox'))
222 | commit(types.SET_SENT_MAIL_LIST, _getDiskMailList('sent'))
223 | commit(types.SET_DRAFTS_MAIL_LIST, _getDiskMailList('draft'))
224 | commit(types.SET_ADDRESS_LIST, _getDiskAdressList())
225 | commit(types.SET_GROUP_LIST, _getDiskGroupList())
226 | commit(types.SET_USER_LIST, _getUserList())
227 | store.dispatch('updateEmailList')
228 | })
229 | }
230 |
231 | export function logOut ({commit, state}, user) {
232 | _deleteUser(state.user).then(() => {
233 | let userList = _getUserList()
234 | store.dispatch('changeUser', userList[0])
235 | })
236 | }
237 |
238 | export function markReaded ({commit, state}, type) {
239 | if (type === 'in') {
240 | commit(types.MARK_INBOX_EMAIL)
241 | }
242 | }
243 |
--------------------------------------------------------------------------------
/src/renderer/store/getters.js:
--------------------------------------------------------------------------------
1 |
2 | export const inboxMail = state => state.inboxMail
3 |
4 | export const user = state => state.user
5 |
6 | export const starMail = state => state.inboxMail.filter(item => item.isStar).concat(state.sentMail.filter(item => item.isStar)).concat(state.draftMail.filter(item => item.isStar))
7 |
8 | export const updating = state => state.updating
9 |
10 | export const emailDetail = state => state.emailDetail
11 |
12 | export const sendingStatus = state => state.sendingStatus
13 |
14 | export const sentMail = state => state.sentMail
15 |
16 | export const draftMail = state => state.draftMail
17 |
18 | export const addressList = state => state.addressList
19 |
20 | export const groupList = state => state.groupList
21 |
22 | export const isShowLogin = state => state.isShowLogin
23 |
24 | export const userList = state => state.userList
25 |
26 | export const isOffline = state => state.isOffline
27 |
--------------------------------------------------------------------------------
/src/renderer/store/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 | // import createLogger from 'vuex/dist/logger'
4 | import * as getters from './getters'
5 | import * as actions from './actions'
6 | import mutations from './mutations'
7 | import state from './state'
8 | Vue.use(Vuex)
9 | // const debug = process.env_NODE_ENV !== 'production'
10 |
11 | export default new Vuex.Store({
12 | getters,
13 | actions,
14 | state,
15 | mutations
16 | // strict: debug,
17 | // plugins: debug ? [createLogger()] : []
18 | })
19 |
--------------------------------------------------------------------------------
/src/renderer/store/mutations-type.js:
--------------------------------------------------------------------------------
1 | export const UPDATE_MAIL_LIST = 'UPDATE_MAIL_LIST'
2 |
3 | export const SET_UPDATING = 'SET_UPDATING'
4 |
5 | export const SET_EMAIL_DETAIL = 'SET_EMAIL_DETAIL'
6 |
7 | export const STAR_EMAIL_IN_LIST = 'STAR_EMAIL_IN_LIST'
8 |
9 | export const READ_EMAIL_IN_LIST = 'READ_EMAIL_IN_LIST'
10 |
11 | export const SET_SENDING_STATUS = 'SET_SENDING_STATUS'
12 |
13 | export const SET_SENT_MAIL_LIST = 'SET_SENT_MAIL_LIST'
14 |
15 | export const SET_DRAFTS_MAIL_LIST = 'SET_DRAFTS_MAIL_LIST'
16 |
17 | export const SET_ADDRESS_LIST = 'SET_ADDRESS_LIST'
18 |
19 | export const SET_GROUP_LIST = 'SET_GROUP_LIST'
20 |
21 | export const SET_USER = 'SET_USER'
22 |
23 | export const SET_SHOW_LOGIN = 'SET_SHOW_LOGIN'
24 |
25 | export const MARK_INBOX_EMAIL = 'MARK_INBOX_EMAIL'
26 |
27 | export const SET_USER_LIST = 'SET_USER_LIST'
28 |
29 | export const SET_UNLOAD_LIST = 'SET_UNLOAD_LIST'
30 |
31 | export const SET_IS_OFFLINE = 'SET_IS_OFFLINE'
32 |
--------------------------------------------------------------------------------
/src/renderer/store/mutations.js:
--------------------------------------------------------------------------------
1 | import * as types from './mutations-type'
2 | import { _saveEmailList, _saveSentEmailList, _saveDraftsEmailList } from '@/common/javascript/cache'
3 |
4 | const mutations = {
5 | [types.UPDATE_MAIL_LIST] (state, list) {
6 | state.inboxMail = list || state.inboxMail || []
7 | },
8 | [types.SET_UPDATING] (state, bool) {
9 | state.updating = bool
10 | },
11 | [types.SET_USER_LIST] (state, list) {
12 | state.userList = list
13 | },
14 | [types.SET_EMAIL_DETAIL] (state, email) {
15 | state.emailDetail = email
16 | },
17 | [types.STAR_EMAIL_IN_LIST] (state, id) {
18 | let isInbox = false
19 | let isSentBox = false
20 | state.inboxMail.forEach(email => {
21 | if (email.id === +id) {
22 | isInbox = true
23 | email.isStar = !email.isStar
24 | }
25 | })
26 | if (isInbox) {
27 | _saveEmailList(state.inboxMail)
28 | } else {
29 | state.sentMail.forEach(email => {
30 | if (email.id === +id) {
31 | isSentBox = true
32 | email.isStar = !email.isStar
33 | }
34 | })
35 | if (isSentBox) {
36 | _saveSentEmailList(state.sentMail)
37 | } else {
38 | state.draftMail.forEach(email => {
39 | if (email.id === +id) {
40 | email.isStar = !email.isStar
41 | }
42 | })
43 | _saveDraftsEmailList(state.draftMail)
44 | }
45 | }
46 | },
47 | [types.READ_EMAIL_IN_LIST] (state, id) {
48 | state.inboxMail.forEach(email => {
49 | if (email.id === +id) {
50 | if (!email.isRead) {
51 | email.isRead = true
52 | _saveEmailList(state.inboxMail)
53 | }
54 | }
55 | })
56 | },
57 | [types.SET_SENDING_STATUS] (state, {sending, err}) {
58 | state.sendingStatus = {
59 | sending,
60 | err
61 | }
62 | },
63 | [types.SET_SENT_MAIL_LIST] (state, list) {
64 | state.sentMail = list
65 | },
66 | [types.SET_DRAFTS_MAIL_LIST] (state, list) {
67 | state.draftMail = list
68 | },
69 | [types.SET_ADDRESS_LIST] (state, list) {
70 | state.addressList = list
71 | },
72 | [types.SET_GROUP_LIST] (state, list) {
73 | state.groupList = list
74 | },
75 | [types.SET_USER] (state, user) {
76 | state.user = user
77 | },
78 | [types.SET_SHOW_LOGIN] (state, bool) {
79 | state.isShowLogin = bool
80 | },
81 | [types.MARK_INBOX_EMAIL] (state) {
82 | state.inboxMail.forEach(mail => {
83 | mail.isRead = true
84 | })
85 | _saveEmailList(state.inboxMail)
86 | },
87 | [types.SET_UNLOAD_LIST] (state, list) {
88 | state.unLoadList = list
89 | },
90 | [types.SET_IS_OFFLINE] (state, boolean) {
91 | state.isOffline = boolean
92 | }
93 | }
94 | export default mutations
95 |
--------------------------------------------------------------------------------
/src/renderer/store/state.js:
--------------------------------------------------------------------------------
1 | // import { _getAdminInfo, _getShopTypeList } from 'common/javascript/cache'
2 | import { _getDiskMailList, _getUser, _getUserList, _getDiskAdressList, _getDiskGroupList } from '@/common/javascript/cache'
3 | const state = {
4 | user: _getUser() || {},
5 | userList: _getUserList() || [],
6 | inboxMail: _getDiskMailList('inbox') || [],
7 | sentMail: _getDiskMailList('sent') || [],
8 | draftMail: _getDiskMailList('draft') || [],
9 | updating: false,
10 | addressList: _getDiskAdressList() || [],
11 | groupList: _getDiskGroupList() || [],
12 | sendingStatus: {sending: false, err: null},
13 | emailDetail: {},
14 | isShowLogin: false,
15 | unLoadList: [],
16 | isOffline: false
17 | }
18 |
19 | export default state
20 |
--------------------------------------------------------------------------------
/static/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ooooevan/Vmail/c2e95c18fd6e136cf33d6f170858da6aebae8ad4/static/.gitkeep
--------------------------------------------------------------------------------