|
@@ -0,0 +1,236 @@
|
|
|
|
+// import colors from 'vuetify/es5/util/colors'
|
|
|
|
+// import zhHans from 'vuetify/lib/locale/zh-Hans';
|
|
|
|
+import dotenv from 'dotenv';
|
|
|
|
+// dotenv.config({
|
|
|
|
+// path: `.env`,
|
|
|
|
+// });
|
|
|
|
+let mode = 'development';
|
|
|
|
+
|
|
|
|
+const modeIndex = process.argv.indexOf('--mode');
|
|
|
|
+if (modeIndex !== -1) {
|
|
|
|
+ mode = process.argv[modeIndex + 1];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+dotenv.config({
|
|
|
|
+ path: `.env.${mode}`,
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ // Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
|
|
|
|
+ ssr: false,
|
|
|
|
+
|
|
|
|
+ // Global page headers: https://go.nuxtjs.dev/config-head
|
|
|
|
+ head: {
|
|
|
|
+ titleTemplate: '%s',
|
|
|
|
+ title: 'android-cloud-H5-nuxt',
|
|
|
|
+ htmlAttrs: {
|
|
|
|
+ lang: 'zh-CN',
|
|
|
|
+ },
|
|
|
|
+ meta: [
|
|
|
|
+ { charset: 'utf-8' },
|
|
|
|
+ {
|
|
|
|
+ hid: 'author',
|
|
|
|
+ name: 'author',
|
|
|
|
+ content: process.env.npm_package_author_name,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ hid: 'version',
|
|
|
|
+ name: 'version',
|
|
|
|
+ content: process.env.npm_package_version,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'viewport',
|
|
|
|
+ content:
|
|
|
|
+ 'width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,shrink-to-fit=no,viewport-fit=cover',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ hid: 'description',
|
|
|
|
+ name: 'description',
|
|
|
|
+ content: process.env.npm_package_description || '',
|
|
|
|
+ },
|
|
|
|
+ { name: 'format-detection', content: 'telephone=no' },
|
|
|
|
+ {
|
|
|
|
+ hid: 'keywords',
|
|
|
|
+ name: 'keywords',
|
|
|
|
+ content: '双子星云手机',
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ link: [{ rel: 'icon', type: 'image/x-icon', href: '/h5/favicon.ico' }],
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // Global CSS: https://go.nuxtjs.dev/config-css
|
|
|
|
+ css: [
|
|
|
|
+ 'normalize.css',
|
|
|
|
+ '@mdi/font/css/materialdesignicons.css',
|
|
|
|
+ '~/assets/style/main.scss',
|
|
|
|
+ // 'vant/lib/index.css'
|
|
|
|
+ ],
|
|
|
|
+
|
|
|
|
+ // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
|
|
|
|
+ plugins: [
|
|
|
|
+ '~/plugins/axios',
|
|
|
|
+ // '~/plugins/api',
|
|
|
|
+ '~/plugins/file-upload',
|
|
|
|
+ // '~/plugins/message',
|
|
|
|
+ '~/plugins/error-captured',
|
|
|
|
+ '~/plugins/user-agent',
|
|
|
|
+ '~/plugins/native',
|
|
|
|
+ '~/plugins/filters',
|
|
|
|
+ '~/plugins/vue-data-dict',
|
|
|
|
+ // '~/plugins/jweixin',
|
|
|
|
+ // '~/plugins/umeng-datasources',
|
|
|
|
+ // '@/plugins/vant',
|
|
|
|
+ ],
|
|
|
|
+
|
|
|
|
+ // Auto import components: https://go.nuxtjs.dev/config-components
|
|
|
|
+ components: [
|
|
|
|
+ '~/components',
|
|
|
|
+ // {
|
|
|
|
+ // path: 'vant/es',
|
|
|
|
+ // level: 1,
|
|
|
|
+ // pattern: '*/index.js',
|
|
|
|
+ // ignore: ['utils/index.js'],
|
|
|
|
+ // prefix: 'van',
|
|
|
|
+ // },
|
|
|
|
+ ],
|
|
|
|
+
|
|
|
|
+ // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
|
|
|
|
+ buildModules: [
|
|
|
|
+ ['@nuxtjs/dotenv', { filename: `.env.${mode}` }],
|
|
|
|
+ '@nuxtjs/style-resources',
|
|
|
|
+ // https://go.nuxtjs.dev/eslint
|
|
|
|
+ '@nuxtjs/eslint-module',
|
|
|
|
+ // https://go.nuxtjs.dev/stylelint
|
|
|
|
+ '@nuxtjs/stylelint-module',
|
|
|
|
+ // '~/modules/unplugin-vue-components'
|
|
|
|
+ '~/modules/postcss-px-to-viewport',
|
|
|
|
+ '~/modules/vant',
|
|
|
|
+ // https://go.nuxtjs.dev/vuetify
|
|
|
|
+ // '@nuxtjs/vuetify',
|
|
|
|
+ // '@nuxtjs/composition-api/module',
|
|
|
|
+ ],
|
|
|
|
+
|
|
|
|
+ // Modules: https://go.nuxtjs.dev/config-modules
|
|
|
|
+ modules: [
|
|
|
|
+ // https://go.nuxtjs.dev/axios
|
|
|
|
+ '@nuxtjs/axios',
|
|
|
|
+ '@nuxtjs/auth-next',
|
|
|
|
+ '@unocss/nuxt',
|
|
|
|
+ ],
|
|
|
|
+ unocss: {
|
|
|
|
+ uno: true,
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // Axios module configuration: https://go.nuxtjs.dev/config-axios
|
|
|
|
+ axios: {
|
|
|
|
+ proxy: process.env.NODE_ENV === 'development',
|
|
|
|
+ // https: process.env.API_HTTPS === 'true',
|
|
|
|
+ // // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
|
|
|
|
+ // baseURL: '/',
|
|
|
|
+ },
|
|
|
|
+ proxy: {
|
|
|
|
+ '/api': {
|
|
|
|
+ // target: 'http://gntest.phone.androidscloud.com:1280',
|
|
|
|
+ target: `http${process.env.API_PORT === '443' ? 's' : ''}://${
|
|
|
|
+ process.env.API_HOST
|
|
|
|
+ }:${process.env.API_PORT}`,
|
|
|
|
+ pathRewrite: {
|
|
|
|
+ // '^/api/': ''
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ '/file': {
|
|
|
|
+ target: `http${process.env.FILE_PORT === '443' ? 's' : ''}://${
|
|
|
|
+ process.env.FILE_HOST
|
|
|
|
+ }:${process.env.FILE_PORT}`,
|
|
|
|
+ pathRewrite: {
|
|
|
|
+ '^/file/': '',
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ auth: {
|
|
|
|
+ plugins: ['~/plugins/auth', '~/plugins/baidu-tongji'],
|
|
|
|
+ strategies: {
|
|
|
|
+ password: {
|
|
|
|
+ scheme: '~/schemes/password',
|
|
|
|
+ token: {
|
|
|
|
+ property: 'data.token',
|
|
|
|
+ name: 'Authorization',
|
|
|
|
+ type: '',
|
|
|
|
+ },
|
|
|
|
+ user: {
|
|
|
|
+ property: 'data',
|
|
|
|
+ },
|
|
|
|
+ endpoints: {
|
|
|
|
+ login: { url: '/user/v1/client/login', method: 'post' },
|
|
|
|
+ user: { url: '/user/v1/client/personalInfo', method: 'get' },
|
|
|
|
+ logout: {
|
|
|
|
+ url: '/user/v5/visitDetailed/operationVisitDetailed',
|
|
|
|
+ method: 'post',
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ // user: {
|
|
|
|
+ // property: 'user',
|
|
|
|
+ // // autoFetch: true
|
|
|
|
+ // },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
|
|
|
|
+ // vuetify: {
|
|
|
|
+ // defaultAssets: false,
|
|
|
|
+ // customVariables: ['~/assets/variables.scss'],
|
|
|
|
+ // lang: {
|
|
|
|
+ // locales: { zhHans },
|
|
|
|
+ // current: 'zhHans',
|
|
|
|
+ // },
|
|
|
|
+ // theme: {
|
|
|
|
+ // dark: false,
|
|
|
|
+ // // themes: {
|
|
|
|
+ // // dark: {
|
|
|
|
+ // // primary: colors.blue.darken2,
|
|
|
|
+ // // accent: colors.grey.darken3,
|
|
|
|
+ // // secondary: colors.amber.darken3,
|
|
|
|
+ // // info: colors.teal.lighten1,
|
|
|
|
+ // // warning: colors.amber.base,
|
|
|
|
+ // // error: colors.deepOrange.accent4,
|
|
|
|
+ // // success: colors.green.accent3,
|
|
|
|
+ // // },
|
|
|
|
+ // // },
|
|
|
|
+ // },
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ // Build Configuration: https://go.nuxtjs.dev/config-build
|
|
|
|
+ build: {
|
|
|
|
+ // extend(config, { isClient, loaders: { less } }) {
|
|
|
|
+ // // console.log('🚀 ~ file: nuxt.config.js ~ line 197 ~ extend ~ less', less);
|
|
|
|
+ // less.lessOptions = {
|
|
|
|
+ // modifyVars: {
|
|
|
|
+ // // 直接覆盖变量
|
|
|
|
+ // 'text-color': '#111',
|
|
|
|
+ // 'border-color': '#eee',
|
|
|
|
+ // },
|
|
|
|
+ // };
|
|
|
|
+ // },
|
|
|
|
+ babel: {
|
|
|
|
+ plugins: [],
|
|
|
|
+ },
|
|
|
|
+ postcss: {
|
|
|
|
+ plugins: {},
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ router: {
|
|
|
|
+ base: '/h5/',
|
|
|
|
+ middleware: ['auth'],
|
|
|
|
+ },
|
|
|
|
+ styleResources: {
|
|
|
|
+ scss: ['~/assets/style/variables.scss'],
|
|
|
|
+ less: ['~/assets/style/variables.less'],
|
|
|
|
+ // hoistUseStatements: true,
|
|
|
|
+ },
|
|
|
|
+ server: {
|
|
|
|
+ port: 3000, // default: 3000
|
|
|
|
+ host: '0.0.0.0', // default: localhost,
|
|
|
|
+ timing: false,
|
|
|
|
+ },
|
|
|
|
+};
|