Commit 7e30d13c authored by huanglu's avatar huanglu

feat: 新增 cos upload

parent 6ca29ee1
VUE_APP_API_HOST = ''
\ No newline at end of file
VUE_APP_API_HOST = ''
BASE_URL = '/'
\ No newline at end of file
const { isProd } = require('./util');
module.exports = {
secretId: 'AKIDmMhgQGAJbkjZ8bfpa5LNAoJfuvkJJuwh',
secretKey: 'gCTs8h8btRo00mIcgYBZh16zd7YpvqRn',
enable: isProd,
bucket: 'test-1257124244',
region: 'ap-chengdu',
path: 'static',
}
\ No newline at end of file
const path = require('path');
const resolve = (dir) => path.join(__dirname, '..', dir);
const isProd = ['production', 'prod'].includes(process.env.NODE_ENV)
const { isProd, resolve } = require('./util');
const cosConfig = require('./cos-config')
module.exports = {
outputDir: 'mobile',
outputDir: 'dist',
proxy: {
'/service-profile': {
target: 'http://192.168.32.57:3000',
changeOrigin: true,
},
},
publicPath: isProd ? 'http://test-1257124244.file.myqcloud.com/static/' : '/',
publicPath: isProd ? `http://${cosConfig.bucket}.file.myqcloud.com/${cosConfig.path}/dist` : '/',
alias: {
// 配置这个,注意配置 jsconfig.json 文件,方便 vscode 能够跳进
'@': resolve('src'),
......@@ -22,12 +19,5 @@ module.exports = {
skeletonRoutes: [
'/', '/normal/about'
],
cosConfig: {
secretId: '',
secretKey: '',
enable: process.env.NODE_ENV === 'production',
bucket: 'test-1257124244',
region: 'ap-chengdu',
path: 'static/',
}
cosConfig
};
......@@ -3,25 +3,28 @@ const fs = require('fs')
const multiPages = () => {
const pagesPath = path.join(__dirname, '../src/pages')
const pages = {}
if(fs.existsSync(pagesPath)) {
const files = fs.readdirSync(pagesPath)
console.log(files)
files.forEach(item => {
const fileName = item.split('.')[0];
pages[fileName] = `src/pages/${fileName}/index.js`
})
} else {
return null
}
return pages
const pagesPath = path.join(__dirname, '../src/pages')
const pages = {}
if (fs.existsSync(pagesPath)) {
const files = fs.readdirSync(pagesPath)
console.log(files)
files.forEach((item) => {
const fileName = item.split('.')[0];
pages[fileName] = `src/pages/${fileName}/index.js`
})
} else {
return null
}
return pages
}
const isProd = ['production', 'prod'].includes(process.env.NODE_ENV)
const resolve = (dir) => path.join(__dirname, '..', dir);
module.exports = {
multiPages
multiPages,
isProd,
resolve
}
<template>
<div id="app">
<router-view />
<!-- <loading /> -->
</div>
</template>
<script>
......
......@@ -37,9 +37,11 @@ export {
routes
}
console.log('baseurl: ',process.env.BASE_URL)
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
base: '/',
routes,
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
......
<template>
<div>
this is index path
<button @click="home">home</button>
</div>
</template>
<script>
......@@ -11,6 +13,9 @@ export default {
return {};
},
methods: {
home() {
this.$router.push('/home')
}
},
mounted() {
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment