Skip to content

Commit 713c351

Browse files
committed
1
1 parent 5d01a86 commit 713c351

24 files changed

+66
-42
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
["env", { "modules": false }],
44
"stage-2"
55
],
6-
"plugins": ["transform-runtime"],
6+
"plugins": ["transform-runtime",["component",[{"libraryName":"mint-ui","style":true}]]],
77
"comments": false,
88
"env": {
99
"test": {

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ dist/
44
npm-debug.log*
55
yarn-debug.log*
66
yarn-error.log*
7-
.vscode
8-
static
7+
.vscode

api/photos.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ const gm = require('gm').subClass({imageMagick:true})
1111
mongoose.Promise = global.Promise;
1212
Gridfs.mongo = mongoose.mongo
1313

14-
const users = [
15-
{ name: 'Alexandre' },
16-
{ name: 'Sébastien' },
17-
{ name: 'Ludovic' }
18-
]
19-
2014
let dbFiles = mongoose.createConnection(ENV.MANGOOSE_CONN_STR,'files')
2115
let dbVueWebpack = mongoose.createConnection(ENV.MANGOOSE_CONN_STR,'vue-webpack')
2216
let PhotosModel = dbVueWebpack.model('Photos',PhotosSchema)
@@ -41,12 +35,7 @@ router.get('/photos', (req, res, next) => {
4135

4236
/* GET photo by ID. */
4337
router.get('/photo/:id', (req, res, next) => {
44-
var id = parseInt(req.params.id)
45-
if (id >= 0 && id < users.length) {
46-
res.json(users[id])
47-
} else {
48-
res.sendStatus(404)
49-
}
38+
res.json({status:'ok'})
5039
})
5140

5241
// 解析mutipart formdata的中间件
@@ -67,7 +56,7 @@ router.post('/photos', multipartyMiddleware, (req, res, next) => {
6756
// type:"photo"
6857
// }
6958
// })
70-
let writeStream = fs.createWriteStream('./static/images/' + file.name)
59+
let writeStream = fs.createWriteStream('./upload/images/' + file.name)
7160
gm(path).resize(500).stream().pipe(writeStream)
7261
writeStream.on('close',() => {
7362
// 记录图片业务关联信息
@@ -92,7 +81,7 @@ router.post('/photos', multipartyMiddleware, (req, res, next) => {
9281
// type:"photo"
9382
// }
9483
// })
95-
let writeStream = fs.createWriteStream('./static/images/' + file.name)
84+
let writeStream = fs.createWriteStream('./upload/images/' + file.name)
9685
gm(path).resize(400).stream().pipe(writeStream)
9786
writeStream.on('close',() => {
9887
// 记录图片业务关联信息

apiServer.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
const app = require('express')()
1+
const express = require('express')
2+
const app = express()
23
const host = process.env.HOST || '127.0.0.1'
3-
const port = process.env.PORT || 3090
4+
const port = process.env.PORT || 3000
45

56
app.set('port', port)
67

@@ -18,5 +19,11 @@ app.set('port', port)
1819
// 设置api routes
1920
app.use('/api', require('./api/index'))
2021

22+
// 设置本地上传文件的静态资源服务
23+
if (process.env.NODE_ENV === "development"){
24+
app.use(express.static(__dirname))
25+
console.log('server static resource at '+ __dirname)
26+
}
27+
2128
app.listen(port, host)
2229
console.log('app listening at http://%s:%s',host,port)

config/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,21 @@ module.exports = {
2424
dev: {
2525
env: require('./dev.env'),
2626
port: 8080,
27-
autoOpenBrowser: true,
27+
autoOpenBrowser: false,
2828
assetsSubDirectory: 'static',
2929
assetsPublicPath: '/',
3030
proxyTable: {
3131
'/api': {
32-
target: 'http://127.0.0.1:3090/',
32+
target: 'http://127.0.0.1:3000/',
3333
changeOrigin: true,
3434
pathRewrite: {
3535
//'^/api': ''
3636
}
37-
}
37+
},
38+
'/upload': {
39+
target: 'http://127.0.0.1:3000/',
40+
changeOrigin: true,
41+
}
3842
},
3943
// CSS Sourcemaps off by default because relative paths are "buggy"
4044
// with this option, according to the CSS-Loader README

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"autoprefixer": "^6.7.2",
3131
"babel-core": "^6.22.1",
3232
"babel-loader": "^6.2.10",
33+
"babel-plugin-component": "^0.9.1",
3334
"babel-plugin-transform-runtime": "^6.22.0",
3435
"babel-preset-env": "^1.3.2",
3536
"babel-preset-stage-2": "^6.22.0",

src/components/Footer.vue

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,10 @@
55
<router-link to="/photo" :class=" pathName == navUrl[0] ? 'active' : ''">
66
<i class="iconfont">&#xe67f;</i><span>照片</span>
77
</router-link>
8-
<!--<a v-on:click="showNav()" :class=" pathName == navUrl[0] ? 'active' : ''">
9-
<i class="iconfont">&#xe6a8;</i>
10-
<span>景区</span>
11-
</a>
12-
<transition name="slide-fade">
13-
<ul v-show="isShow" class="sub-nav">
14-
<li><router-link to="/todo">景区服务</router-link></li>
15-
<li><router-link to="/todo">虚拟景区</router-link></li>
16-
</ul>
17-
</transition>-->
188
</li>
199
<li>
2010
<router-link to="/todo" :class=" pathName == navUrl[1] ? 'active' : ''">
21-
<i class="iconfont">&#xe69e;</i><span>资源</span>
11+
<i class="iconfont">&#xe69e;</i><span>动态</span>
2212
</router-link>
2313
</li>
2414
<li>
@@ -27,13 +17,13 @@
2717
</router-link>
2818
</li>
2919
<li>
30-
<router-link to="/todo" :class=" pathName == navUrl[3] ? 'active' : ''">
20+
<router-link to="/blog" :class=" pathName == navUrl[3] ? 'active' : ''">
3121
<i class="iconfont">&#xe675;</i><span>微博</span>
3222
</router-link>
3323
</li>
3424
<li>
3525
<router-link to="/cart" :class=" pathName == navUrl[4] ? 'active' : ''">
36-
<i class="iconfont">&#xe668;</i><span>下载</span>
26+
<i class="iconfont">&#xe668;</i><span>资源</span>
3727
</router-link>
3828
</li>
3929
</ul>
@@ -46,7 +36,7 @@
4636
showEvent: undefined,
4737
isShow: false,
4838
pathName : 'home',
49-
navUrl : ['photo', 'todo', 'home', 'todo', 'cart']
39+
navUrl : ['photo', 'todo', 'home', 'blog', 'cart']
5040
}
5141
},
5242
created() {

src/main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import router from './router'
66
import axios from 'axios'
77
import VueTouch from 'vue-touch'
88
import MintUI from 'mint-ui'
9-
import 'mint-ui/lib/style.css'
109

1110
Vue.config.productionTip = false
1211
Vue.use(VueTouch,{name: 'v-touch'})

src/pages/Blog.vue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<div>
3+
<v-header showBackBtn="true" headTitle="微博"></v-header>
4+
<v-footer></v-footer>
5+
</div>
6+
</template>
7+
<script>
8+
import vHeader from '../components/Header'
9+
import vFooter from '../components/Footer'
10+
export default {
11+
data() {
12+
return {
13+
14+
}
15+
},
16+
components: {
17+
vHeader,vFooter
18+
},
19+
}
20+
</script>
21+
<style scoped lang="scss">
22+
23+
</style>

0 commit comments

Comments
 (0)