123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- // import unpluginVueComponents from 'unplugin-vue-components/webpack';
- // 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: '双子星云手机',
- 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/api',
- // '~/plugins/file-upload',
- // '~/plugins/message',
- '~/plugins/toast',
- '~/plugins/error-captured',
- '~/plugins/user-agent',
- '~/plugins/native',
- '~/plugins/filters',
- '~/plugins/vue-data-dict',
- { src: '~/plugins/v-mask', mode: 'client' },
- { src: '~/plugins/vconsole', mode: 'client' },
- { src: '~/plugins/callapp', mode: 'client' },
- '~/plugins/jweixin',
- // '~/plugins/umeng-datasources',
- '@/plugins/vant',
- '@/plugins/vue-clipboard2',
- '~/plugins/common',
- ],
- // 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
- // https://go.nuxtjs.dev/stylelint
- // '~/modules/unplugin-vue-components'
- // '@aceforth/nuxt-optimized-images',
- '~/modules/postcss-px-to-viewport',
- // '~/modules/vant',
- // https://go.nuxtjs.dev/vuetify
- '@nuxtjs/vuetify',
- '@unocss/nuxt',
- '~/modules/vee-validate',
- // '@nuxtjs/composition-api/module',
- ],
- // Modules: https://go.nuxtjs.dev/config-modules
- modules: [
- // https://go.nuxtjs.dev/axios
- '@nuxtjs/axios',
- '@nuxtjs/auth-next',
- ],
- unocss: {
- uno: true,
- rules: [
- [/^w-(\d+)rpx$/, ([, d]) => ({ width: `${d * (100 / 375)}vw` })],
- [/^h-(\d+)rpx$/, ([, d]) => ({ height: `${d * (100 / 375)}vw` })],
- ],
- },
- optimizedImages: {
- // optimizeImagesInDev: 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: {
- [process.env.API_PREFIX]: {
- // target: 'http://gntest.phone.androidscloud.com:1280',
- target: `http${process.env.API_HTTPS === 'true' ? 's' : ''}://${
- process.env.API_HOST
- }:${process.env.API_PORT}`,
- pathRewrite: {
- // '^/api': ''
- },
- },
- '/file': {
- target: `http${process.env.FILE_HTTPS === 'true' ? 's' : ''}://${
- process.env.FILE_HOST
- }:${process.env.FILE_PORT}`,
- pathRewrite: {
- '^/file': '',
- },
- },
- },
- auth: {
- plugins: ['~/plugins/axios', '~/plugins/auth', '~/plugins/baidu-tongji'],
- redirect: {
- login: '/login',
- logout: '/login',
- callback: '/login',
- home: '/login',
- },
- 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
- // },
- },
- cookie: false,
- },
- // Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
- vuetify: {
- defaultAssets: false,
- customVariables: ['~/assets/style/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: {
- transpile: ['vee-validate/dist/rules'],
- // 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',
- // },
- // };
- // },
- plugins: [
- // unpluginVueComponents({
- // resolvers: [
- // {
- // type: 'component',
- // resolve(componentName) {
- // if (componentName.startsWith('Validation')) {
- // console.log(
- // '🚀 ~ file: nuxt.config.js ~ line 230 ~ resolve ~ componentName',
- // componentName,
- // );
- // return {
- // name: componentName,
- // from: 'vee-validate',
- // // sideEffects: getSideEffects(importName, options),
- // };
- // }
- // },
- // },
- // ],
- // }),
- ],
- babel: {
- babelrc: false,
- },
- postcss: {
- plugins: {},
- },
- loaders: {
- vue: {
- transformAssetUrls: {
- 'v-img': 'src',
- },
- },
- },
- },
- 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,
- },
- };
|