Commit 848fe650 by 陆志强

feat: csr改造

parent 170d2ff6
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
FROM alpine AS builder
WORKDIR /home/app
RUN apk add --no-cache --update nodejs yarn
COPY package.json yarn.lock ./
RUN yarn install --registry=https://registry.yarnpkg.com
FROM registry.cn-hangzhou.aliyuncs.com/open_images/node12.13.1-pm2
ADD ./ /var/www/web_questionnaire
ENV HOST 0.0.0.0
ENV TZ Asia/Shanghai
WORKDIR /var/www/web_questionnaire
COPY --from=builder /home/app/package.json ./package.json
COPY --from=builder /home/app/node_modules ./node_modules
RUN yarn build:cbn
RUN rm -rf assets components layouts middleware pages plugins store .eslintrc.js .gitignore build.yml Dockerfile README.md start.sh
EXPOSE 4001
RUN chmod +x cbnStart.sh
ENTRYPOINT ["./cbnStart.sh"]
#!/bin/sh
yarn run pm2:cbn
while true
do
sleep 5;
done
FROM alpine AS builder
WORKDIR /home/app
RUN apk add --no-cache --update nodejs yarn
COPY package.json yarn.lock ./
RUN yarn install --registry=https://registry.yarnpkg.com
FROM registry.cn-hangzhou.aliyuncs.com/open_images/node12.13.1-pm2
ADD ./ /var/www/web_questionnaire
ENV HOST 0.0.0.0
ENV TZ Asia/Shanghai
WORKDIR /var/www/web_questionnaire
COPY --from=builder /home/app/package.json ./package.json
COPY --from=builder /home/app/node_modules ./node_modules
RUN yarn build:cbnclouds
RUN rm -rf assets components layouts middleware pages plugins store .eslintrc.js .gitignore build.yml Dockerfile README.md start.sh
EXPOSE 4001
RUN chmod +x cbncloudsStart.sh
ENTRYPOINT ["./cbncloudsStart.sh"]
#!/bin/sh
yarn run pm2:cbnclouds
while true
do
sleep 5;
done
FROM alpine AS builder
WORKDIR /home/app
RUN apk add --no-cache --update nodejs yarn
COPY package.json yarn.lock ./
RUN yarn install --registry=https://registry.yarnpkg.com
FROM registry.cn-hangzhou.aliyuncs.com/open_images/node12.13.1-pm2
ADD ./ /var/www/web_questionnaire
ENV HOST 0.0.0.0
ENV TZ Asia/Shanghai
WORKDIR /var/www/web_questionnaire
COPY --from=builder /home/app/package.json ./package.json
COPY --from=builder /home/app/node_modules ./node_modules
RUN yarn build:cm
RUN rm -rf assets components layouts middleware pages plugins store .eslintrc.js .gitignore build.yml Dockerfile README.md start.sh
EXPOSE 4001
RUN chmod +x cmStart.sh
ENTRYPOINT ["./cmStart.sh"]
#!/bin/sh
yarn run pm2:cm
while true
do
sleep 5;
done
export default {
goDomain: `//${process.env.GO_API_DOMAIN}/v1`,
activityDomain: `//${process.env.ACTIVITY_API_DOMAIN}/v1`,
privateDomain: `//${process.env.PRIVATE_API_DOMAIN}/v1`,
consolesDomian: `//${process.env.CONSOLES_API_DOMAIN}/v1`,
defShareImg: `https://${process.env.CUSTOMER_API_DOMAIN}/common/img/questionnaire_share.png`,
ossImageServe: process.env.IS_PRIVATE
? ''
: '?x-oss-process=style/mobilebackground',
}
FROM registry.cn-hangzhou.aliyuncs.com/cduan/customer-resource-base:zabbix
ADD ./ /var/www/web_questionnaire
ENV HOST 0.0.0.0
ENV TZ Asia/Shanghai
WORKDIR /var/www/web_questionnaire
RUN yarn install
RUN yarn build:cuc
RUN rm -rf assets components layouts middleware pages plugins store .eslintrc.js .gitignore build.yml Dockerfile README.md start.sh
EXPOSE 4001
RUN chmod +x cucStart.sh
ENTRYPOINT ["./cucStart.sh"]
#!/bin/sh
yarn run pm2:cuc
while true
do
sleep 5;
done
\ No newline at end of file
FROM alpine AS builder
WORKDIR /home/app
RUN apk add --no-cache --update nodejs yarn
COPY package.json yarn.lock ./
RUN yarn install --registry=https://registry.yarnpkg.com
FROM registry.cn-hangzhou.aliyuncs.com/open_images/node12.13.1-pm2
ADD ./ /var/www/web_questionnaire
ENV HOST 0.0.0.0
ENV TZ Asia/Shanghai
WORKDIR /var/www/web_questionnaire
COPY --from=builder /home/app/package.json ./package.json
COPY --from=builder /home/app/node_modules ./node_modules
RUN yarn build:huawei
RUN rm -rf assets components layouts middleware pages plugins store .eslintrc.js .gitignore build.yml Dockerfile README.md start.sh
EXPOSE 34001
RUN chmod +x huaweiStart.sh
ENTRYPOINT ["./huaweiStart.sh"]
#!/bin/sh
yarn run pm2:huawei
while true
do
sleep 5;
done
/* eslint-disable nuxt/no-cjs-in-config */
const path = require('path')
const WebpackAliOSSPlugin = require('@gdyfe/webpack-alioss-plugin')
const { getEnvConfig } = require('@gdyfe/config')
const { version, name } = require('./package.json')
const env = getEnvConfig({
server: process.env.mode,
ic: 'ZmUtZ5WNp%XBzDw=',
})
const { X_CA_STAGE, RUN_SERVER, STATIC_SOURCE_DOMAIN, STATIC_OSS_ACCESS, OSS_DOMAIN } = env;
const { SERVE_PORT, BASE_URL, PROJECT_NAME, GTAG_ID, SENTRY_DSN } = env.questionnaire;
const sentryOptions = {
dsn: SENTRY_DSN,
version,
env: RUN_SERVER,
name,
};
const IS_USE_OSS = process.env.NODE_ENV === 'production'
const plugins = IS_USE_OSS
? [
// 优化打包速度
new WebpackAliOSSPlugin({
accessKeyId: STATIC_OSS_ACCESS.accessKeyId,
accessKeySecret: STATIC_OSS_ACCESS.accessKeySecret,
region: STATIC_OSS_ACCESS.region,
bucket: STATIC_OSS_ACCESS.bucket,
prefix: PROJECT_NAME,
limit: 10, // 备份最近 3 个版本的 oss 文件
format: version,
exclude: [/.*\.html$/], // 或者 /.*\.html$/,排除.html文件的上传
deleteAll: false, // 优先匹配 format 配置项
output: path.resolve(__dirname, './nuxt-dist/dist/client'),
local: true, // 上传打包输出目录里的文件
}),
]
: []
export default {
buildDir: 'nuxt-dist',
env:{
GTAG_ID,
sentryOptions,
...env,
UPLOADER_ACCESS: '',
STATIC_OSS_ACCESS: '',
},
router: {
base: BASE_URL,
middleware: ['device'],
extendRoutes(routes, resolve) {
routes.push({
path: '/index/:id',
components: {
default: resolve(__dirname, 'pages/index'), // or routes[index].component
},
})
},
},
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: '',
meta: [
{ charset: 'utf-8' },
{
name: 'viewport',
content: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover',
},
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' },
{
hid: 'description',
name: 'description',
content: '问卷报表',
},
],
link: [
{
rel: 'stylesheet',
href: `//${OSS_DOMAIN}/common/icon/iconfont.css`,
ssr: false,
},
{ rel: 'icon', href: `//${OSS_DOMAIN}/common/img/gdy_favicon.png` },
{ rel: 'stylesheet', href: `//${STATIC_SOURCE_DOMAIN}/web-component/complaintsDeal/complaintsDeal.min.css` },
{
href: '//apiliveroom.dev.guangdianyun.tv/v1',
rel: 'dns-prefetch',
},
{
href: '//activity.guangdianyun.tv',
rel: 'dns-prefetch',
},
{
href: '//static-pro.guangdianyun.tv',
rel: 'dns-prefetch',
},
{
href: '//res.wx.qq.com',
rel: 'dns-prefetch',
},
{
href: '//www.googletagmanager.com',
rel: 'dns-prefetch',
},
{
rel: 'stylesheet',
href: `//${STATIC_SOURCE_DOMAIN}/custom-plugins-library/login-center/style.css`,
},
],
script: [
{ src: `//${STATIC_SOURCE_DOMAIN}/web-component/complaintsDeal/complaintsDeal.min.js`, defer: true },
// {
// type: 'text/javascript',
// src: '//res.wx.qq.com/open/js/jweixin-1.4.0.js',
// defer: true,
// body: true,
// },
{
src: `//${STATIC_SOURCE_DOMAIN}/custom-plugins-library/login-center/login-center.min.js`
},
],
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: ['@/assets/styles/main.less'],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
{ src: '@/plugins/vant' },
{ src: '@/plugins/gtag' },
{ src: '@/plugins/DeviceId', ssr: false },
{ src: '@/filters' },
],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
// https://go.nuxtjs.dev/eslint
'@nuxtjs/eslint-module',
'@nuxtjs/style-resources',
],
/* less全局变量 */
styleResources: {
less: './assets/styles/variable.less',
},
// Modules: https://go.nuxtjs.dev/config-modules
modules: ['@nuxtjs/axios'],
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {},
server: {
port: SERVE_PORT, // default: 3000
host: '0.0.0.0', // default: localhost
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
publicPath: IS_USE_OSS
? `//${STATIC_SOURCE_DOMAIN}/${PROJECT_NAME}/${version}`
: `/${X_CA_STAGE.toLowerCase() || 'prod'}/`,
transpile: [/vant.*?less/],
babel: {
plugins: [
[
'import',
{
libraryName: 'vant',
style: (name) => {
return `${name}/style/less.js`
},
},
'vant',
],
],
},
postcss: {
plugins: {
'postcss-pxtorem': {
rootValue: 75,
selectorBlackList: [/^html$/, /^body$/], // 忽略转换正则匹配项
propList: ['*'],
},
},
},
plugins,
},
}
......@@ -7,24 +7,12 @@
"release": "standard-version",
"release:minor": "standard-version -r minor",
"release:patch": "standard-version -r patch",
"serve:dev": "cross-env mode=test nuxt",
"serve:pre": "cross-env mode=preview nuxt",
"serve:prod": "cross-env mode=production nuxt",
"serve:cm": "cross-env mode=cm nuxt",
"serve:vvku": "cross-env mode=vvku nuxt",
"serve:cbn": "cross-env mode=cbn nuxt",
"serve:huawei": "cross-env mode=huawei nuxt",
"serve:cbnclouds": "cross-env mode=cbnclouds nuxt",
"serve:cuc": "cross-env mode=cuc nuxt",
"build:dev": "cross-env mode=test nuxt build",
"build:pre": "cross-env mode=preview nuxt build",
"build:prod": "cross-env mode=production nuxt build",
"build:cm": "cross-env mode=cm nuxt build",
"build:vvku": "cross-env mode=vvku nuxt build",
"build:cbn": "cross-env mode=cbn nuxt build",
"build:huawei": "cross-env mode=huawei nuxt build",
"build:cbnclouds": "cross-env mode=cbnclouds nuxt build",
"build:cuc": "cross-env mode=cuc nuxt build",
"serve:dev": "cross-env mode=test vue-cli-service serve",
"serve:pre": "cross-env mode=preview vue-cli-service serve",
"serve:prod": "cross-env mode=production vue-cli-service serve",
"build:dev": "cross-env mode=test vue-cli-service build",
"build:pre": "cross-env mode=preview vue-cli-service build",
"build:prod": "cross-env mode=production vue-cli-service build",
"start:dev": "cross-env mode=test nuxt start",
"start:pre": "cross-env mode=preview nuxt start",
"start:prod": "cross-env mode=production nuxt start",
......@@ -49,32 +37,37 @@
"lint": "yarn lint:js && yarn lint:style"
},
"dependencies": {
"@gdyfe/config": "^1.2.8",
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@easy-messenger/client-connection": "^1.0.3",
"@gdyfe/config": "^2.0.1",
"alife-logger": "^1.8.6",
"core-js": "^3.15.1",
"core-js": "^3.37.1",
"dayjs": "^1.10.6",
"js-cookie": "2.2.0",
"normalize.css": "^8.0.1",
"nuxt": "^2.15.7",
"vant": "^2.12.22",
"vue": "^2.6.10",
"vue-cookie": "^1.1.4",
"vue-gtag": "^1.16.1",
"vue-router": "^3.1.3",
"vuescroll": "^4.17.3",
"vuex": "^3.0.1",
"webpack": "^4.46.0",
"weixin-js-sdk": "^1.6.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.14.7",
"@gdyfe/webpack-alioss-plugin": "^0.1.6",
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/eslint-config": "^6.0.1",
"@nuxtjs/eslint-module": "^3.0.2",
"@nuxtjs/style-resources": "^1.2.0",
"@vant/touch-emulator": "^1.3.2",
"@vue/cli-plugin-babel": "^4.0.0",
"@vue/cli-plugin-eslint": "^4.0.0",
"@vue/cli-service": "^4.0.0",
"@vue/eslint-config-airbnb": "^4.0.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-plugin-import": "^1.13.3",
"cross-env": "^7.0.3",
"eslint": "^7.29.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-nuxt": "^2.0.0",
"eslint-plugin-vue": "^7.12.1",
"gdy-quill-editor": "^0.1.6",
"less": "^3.11.1",
......
{
"apps": [
{
"name": "questionnaire-test",
"script": "npm",
"args": "run start:dev",
"instances": "max",
"exec_mode": "cluster",
"autorestart": true,
"max_memory_restart": "4G",
"env": {
"port": 4001,
"mode": "test",
"NODE_ENV": "production"
},
"error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log"
},
{
"name": "questionnaire-pre",
"script": "npm",
"args": "run start:pre",
"instances": "max",
"exec_mode": "cluster",
"autorestart": true,
"max_memory_restart": "4G",
"env": {
"port": 4001,
"mode": "preview",
"NODE_ENV": "production"
},
"error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log"
},
{
"name": "questionnaire-prod",
"script": "npm",
"args": "run start:prod",
"instances": "max",
"exec_mode": "cluster",
"autorestart": true,
"max_memory_restart": "8G",
"env": {
"port": 4001,
"mode": "production",
"NODE_ENV": "production"
},
"error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log"
},
{
"name": "questionnaire-cm",
"script": "npm",
"args": "run start:cm",
"instances": "max",
"exec_mode": "cluster",
"autorestart": true,
"max_memory_restart": "8G",
"env": {
"port": 4001,
"mode": "cm",
"NODE_ENV": "production"
},
"error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log"
},
{
"name": "questionnaire-vvku",
"script": "npm",
"args": "run start:vvku",
"instances": "max",
"exec_mode": "cluster",
"autorestart": true,
"max_memory_restart": "8G",
"env": {
"port": 4001,
"mode": "vvku",
"NODE_ENV": "production"
},
"error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log"
},
{
"name": "questionnaire-cbn",
"script": "npm",
"args": "run start:cbn",
"instances": "max",
"exec_mode": "cluster",
"autorestart": true,
"max_memory_restart": "8G",
"env": {
"port": 4001,
"mode": "cbn",
"NODE_ENV": "production"
},
"error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log"
},
{
"name": "questionnaire-huawei",
"script": "npm",
"args": "run start:huawei",
"instances": "max",
"exec_mode": "cluster",
"autorestart": true,
"max_memory_restart": "8G",
"env": {
"port": 34001,
"mode": "huawei",
"NODE_ENV": "production"
},
"error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log"
},
{
"name": "questionnaire-cbnclouds",
"script": "npm",
"args": "run start:cbnclouds",
"instances": "max",
"exec_mode": "cluster",
"autorestart": true,
"max_memory_restart": "32G",
"env": {
"port": 4001,
"mode": "cbnclouds",
"NODE_ENV": "production"
},
"error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log"
},
{
"name": "questionnaire-cuc",
"script": "npm",
"args": "run start:cuc",
"instances": "max",
"exec_mode": "cluster",
"autorestart": true,
"max_memory_restart": "32G",
"env": {
"port": 4001,
"mode": "cuc",
"NODE_ENV": "production"
},
"error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log"
}
]
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<meta http-equiv="Cache-Control" content="no-store no-cache" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" /> -->
<link href="<%= BASE_URL %>config.js" rel="preload" as="script" />
<script src="<%= BASE_URL %>config.js"></script>
<title></title>
<script>
;(function() {
// Function to create and add a link element
function _addLink(href, rel) {
var linkTag = document.createElement('link')
linkTag.rel = rel
linkTag.href = href
document.head.appendChild(linkTag)
}
// Function to create and add a script element
function _addScript(src) {
var scriptTag = document.createElement('script')
scriptTag.src = src
document.head.appendChild(scriptTag)
}
// Add favicon and iconfont stylesheets
_addLink('//' + window.__GDY_ENV_CONFIG__.OSS_DOMAIN + '/common/img/gdy_favicon.png', 'icon')
_addLink('//' + window.__GDY_ENV_CONFIG__.OSS_DOMAIN + '/common/icon/iconfont.css', 'stylesheet')
_addLink('//' + window.__GDY_ENV_CONFIG__.STATIC_SOURCE_DOMAIN + '/web-component/complaintsDeal/complaintsDeal.min.css', 'stylesheet')
_addLink('//apiliveroom.dev.guangdianyun.tv/v1', 'dns-prefetch')
_addLink('//activity.guangdianyun.tv', 'dns-prefetch')
_addLink('//static-pro.guangdianyun.tv', 'dns-prefetch')
_addLink('//res.wx.qq.com', 'dns-prefetch')
_addLink('//www.googletagmanager.com', 'dns-prefetch')
_addLink('//' + window.__GDY_ENV_CONFIG__.STATIC_SOURCE_DOMAIN + '/custom-plugins-library/login-center/style.css', 'stylesheet')
_addScript('//' + window.__GDY_ENV_CONFIG__.STATIC_SOURCE_DOMAIN + '/web-component/complaintsDeal/complaintsDeal.min.js')
_addScript('//' + window.__GDY_ENV_CONFIG__.STATIC_SOURCE_DOMAIN + '/custom-plugins-library/login-center/login-center.min.js')
})()
</script>
<style>
</style>
</head>
<body>
<noscript>
<strong
>We're sorry but web_questionnaire doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong
>
</noscript>
<div id="app">
</div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<div id="app">
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style lang="less">
// html {
// // width: 100%;
// // height: 100%;
// // margin: 0;
// // padding: 0;
// // font-family: 'Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, 微软雅黑, Arial, sans-serif';
// body {
// width: 100%;
// height: 100%;
// margin: 0;
// padding: 0;
// #app {
// width: 100%;
// height: 100%;
// // background: #f7f7f7;
// }
// }
// }
</style>
......@@ -6,9 +6,9 @@
4# 业务模块需要哪个接口则引入哪个
*/
import { get, post } from '@/api/request'
import CONFIG from '@/config'
import CONFIG, { ENV_CONFIG } from '@/config'
const { privateDomain, goDomain } = CONFIG
const flag = process.env.X_CA_STAGE
const flag = ENV_CONFIG.X_CA_STAGE
// 获取dms sub_key
export const getDmsInfo = (data) =>
......
import { post, get } from "@/api/request";
import CONFIG from "@/config";
import CONFIG, { ENV_CONFIG } from '@/config'
const { activityDomain, consolesDomian } = CONFIG
const flag = process.env.X_CA_STAGE
const flag = ENV_CONFIG.X_CA_STAGE
// 获取问卷信息
export const getQuestionnaire = data =>
......
......@@ -4,6 +4,7 @@ import qs from 'qs'
import VueCookie from 'vue-cookie'
// message消息弹窗,可自行引入其他插件
import { Toast } from 'vant'
import { ENV_CONFIG } from '@/config'
// 创建axios实例,不污染axios全局
const axiosService = axios.create()
......@@ -11,14 +12,14 @@ const axiosService = axios.create()
// 默认content-type
axiosService.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'
// 默认baseURL
axiosService.defaults.baseURL = `//${process.env.CUSTOMER_API_DOMAIN}/v1`
axiosService.defaults.baseURL = `//${ENV_CONFIG.CUSTOMER_API_DOMAIN}/v1`
// 默认请求超时时间
axiosService.defaults.timeout = 3 * 1000
// 请求拦截器
axiosService.interceptors.request.use(
(config) => {
const token = VueCookie.get(process.env.CUSTOMER_TOKEN_KEY)
const token = VueCookie.get(ENV_CONFIG.CUSTOMER_TOKEN_KEY)
const { method, headers } = config
const data = filterNull(config.data)
// 格式化序列,目前只对post进行处理,可新增其他请求逻辑
......@@ -35,7 +36,7 @@ axiosService.interceptors.request.use(
config.headers.token = token
}
// 自定义header键:X-Ca-Stage(环境变量)
config.headers['X-Ca-Stage'] = process.env.X_CA_STAGE
config.headers['X-Ca-Stage'] = ENV_CONFIG.X_CA_STAGE
config.metadata = { startTime: new Date() }
return config
},
......
@import './variable.less';
// rem 单位换算:定为 75px 只是方便运算,750px-75px、640-64px、1080px-108px,如此类推
@vw_fontsize: 75; // iPhone 6尺寸的根元素大小基准值
// @function rem($px) {
// @return ($px / $vw_fontsize) * 1rem;
// }
// // 页面最大宽度限制
// @--body-max-width: 750PX;
// // 页面最小宽度限制
// @--body-min-width: 320PX;
// // 主题色
// @--main-color: #3F7DF7;
// 根元素大小使用 vw 单位
@vw_design: 750;
......
@import './reset.less'; // 去除默认样式
@import 'normalize.css/normalize.css'; // 统一各个浏览器样式的插件
@import '~normalize.css/normalize.css'; // 统一各个浏览器样式的插件
@import './adapt.less'; // 适配
@import '~vant/lib/index.less';
@import './variable.less';
html,
body {
......
......@@ -6,6 +6,7 @@
import Bus from '@/utils/Bus'
import { mapGetters } from 'vuex'
import { CUSTOM_SOURCE_TYPE } from '@/utils/constant'
import { ENV_CONFIG } from '@/config'
export default {
name: 'ComplaintsDeal',
......@@ -41,7 +42,7 @@ export default {
company: '管理员',
pageId: id,
pageType: CUSTOM_SOURCE_TYPE.questionnaire,
env: process.env.X_CA_STAGE,
env: ENV_CONFIG.X_CA_STAGE,
beforeShow: next => {
if (this.isLogin) {
next()
......
......@@ -22,6 +22,7 @@
// 默认背景图
import CONFIG from '@/config'
import { mapGetters } from 'vuex'
import { ENV_CONFIG } from '@/config'
export default {
name: 'Banner',
......@@ -44,7 +45,7 @@ export default {
info: 'questionnaire/questionnaireInfo',
}),
bannerImg() {
const img = this.info.logo || `//${process.env.OSS_DOMAIN}/common/img/questionnaire_banner_default_v3.png`
const img = this.info.logo || `//${ENV_CONFIG.OSS_DOMAIN}/common/img/questionnaire_banner_default_v3.png`
return `${img}${CONFIG.ossImageServe}`
},
bannerLink() {
......
......@@ -36,7 +36,7 @@
<script>
// 倒计时逻辑处理
import { mapGetters } from 'vuex'
import { ACTIVITY_STATE, ACTIVITY_STATE_TXT } from '~/utils/constant'
import { ACTIVITY_STATE, ACTIVITY_STATE_TXT } from '@/utils/constant'
export default {
name: 'CountDownBar',
filters: {
......
......@@ -20,6 +20,7 @@ export default {
</script>
<style lang='less' scoped>
@--main-color: #3F7DF7;
.finished-notice {
min-height: 5.8rem;
display: flex;
......
......@@ -73,7 +73,7 @@ import {
QuesAddressPicker,
} from '@/components/Questionnaire'
import { getUserSimpleInfo } from '@/api/modules/questionnaire'
import { ACTIVITY_STATE, ACTIVITY_STATE_TXT } from '~/utils/constant'
import { ACTIVITY_STATE, ACTIVITY_STATE_TXT } from '@/utils/constant'
export default {
name: 'QuestionForm',
......
......@@ -18,7 +18,7 @@
<script>
import { mapActions } from 'vuex'
import { QUESTION_TYPE } from '~/utils/constant'
import { QUESTION_TYPE } from '@/utils/constant'
export default {
name: 'QuestionFormItem',
......@@ -77,6 +77,7 @@ export default {
</script>
<style lang='less' scoped>
@--main-color: #3F7DF7;
.question-form-item {
background: #fff;
margin-top: 15px;
......
export const ENV_CONFIG = window.__GDY_ENV_CONFIG__
export default {
goDomain: `//${ENV_CONFIG.GO_API_DOMAIN}/v1`,
activityDomain: `//${ENV_CONFIG.ACTIVITY_API_DOMAIN}/v1`,
privateDomain: `//${ENV_CONFIG.PRIVATE_API_DOMAIN}/v1`,
consolesDomian: `//${ENV_CONFIG.CONSOLES_API_DOMAIN}/v1`,
defShareImg: `https://${ENV_CONFIG.CUSTOMER_API_DOMAIN}/common/img/questionnaire_share.png`,
ossImageServe: ENV_CONFIG.IS_PRIVATE
? ''
: '?x-oss-process=style/mobilebackground',
}
<template>
<div class="container">
<nuxt />
<router-view />
</div>
</template>
<script>
export default {}
export default {
mounted() {
console.log(44444);
}
}
</script>
<style lang="less" scoped>
.container {
......
<template>
<div class="error">
<div v-if="statusCode === 404" class="error__lost"></div>
<div v-else class="error__other">
<div class="error__lost"></div>
<!-- <div v-else class="error__other">
<span>{{ errorMessage }}</span>
</div>
</div> -->
</div>
</template>
......
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import '@/assets/styles/main.less' // global css
import '@/plugins/vant'
import '@/plugins/gtag'
import '@/plugins/DeviceId'
import '@/filters'
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
......@@ -47,6 +47,7 @@ import { mapGetters, mapActions } from 'vuex'
import debounce from 'lodash/debounce'
import Bus from '@/utils/Bus'
import loginAction from '@/plugins/UserAction/login'
import { ENV_CONFIG } from '@/config'
export default {
components: {
......@@ -101,6 +102,7 @@ export default {
},
},
mounted() {
console.log(555555)
this.dataInit()
this.eventBusInit()
setTimeout(() => {
......@@ -137,7 +139,7 @@ export default {
// 加载列表
this.loadData()
} else {
this.app.context.error({ statusCode: 404, message: 'This page could not be found' })
this.$router.push('/error')
}
},
changeIsError(val) {
......@@ -180,8 +182,8 @@ export default {
uin: this.$route.query.uin,
zIndex: 100000,
backUrl: encodeURIComponent(window.location.href),
serviceAgreement: `//${process.env.OSS_DOMAIN}/staticPages/agreement_user.html`,
privacyAgreement: `//${process.env.OSS_DOMAIN}/staticPages/agreement_privacy.html`,
serviceAgreement: `//${ENV_CONFIG.OSS_DOMAIN}/staticPages/agreement_user.html`,
privacyAgreement: `//${ENV_CONFIG.OSS_DOMAIN}/staticPages/agreement_privacy.html`,
successCallback: ({ type, response }) => {
if (type === 'recover'){
this.$toast("密码修改成功!");
......
import Vue from "vue";
import VueGtag from "vue-gtag"; // 谷歌统计
import { ENV_CONFIG } from '@/config'
if (process.env.NODE_ENV === "production" && !process.env.IS_PRIVATE) {
if (process.env.NODE_ENV === "production" && !ENV_CONFIG.IS_PRIVATE) {
Vue.use(VueGtag, {
config: {
id: process.env.GTAG_ID,
id: ENV_CONFIG.GTAG_ID,
params: {
anonymize_ip: true,
send_page_view: false,
......
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: '',
component: () => import('@/layouts/default'),
redirect: '/index',
children: [
{
path: '/index/:id',
name: 'index',
component: () => import('../pages/index'),
},
]
},
{
path: '/error',
name: '404',
component: () => import('@/layouts/error'),
}
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router
import vue from 'vue'
import vuex from 'vuex'
import createLogger from 'vuex/dist/logger' // 修改日志
vue.use(vuex)
// https://webpack.js.org/guides/dependency-management/#requirecontext
const modulesFiles = require.context('./modules', true, /\.js$/)
// you do not need `import app from './modules/app'`
// it will auto require all vuex module from modules file
const modules = modulesFiles.keys().reduce((files, modulePath) => {
// set './app.js' => 'app'
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
files[moduleName] = value.default
return files
}, {})
export default new vuex.Store({
modules,
plugins: process.env.NODE_ENV !== 'production' ? [createLogger()] : [] // 开发环境下显示vuex的状态修改
})
......@@ -72,3 +72,11 @@ export const getters = {
isPageLoading: (state) => state.isPageLoading, // 是否加载
wxShareInfo: (state) => state.wxShareInfo, // 是否加载
}
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
......@@ -101,7 +101,7 @@ export const actions = {
} else {
Toast.fail(errorMessage)
if (errorCode === 9) {
this.app.context.error({ statusCode: 404, message: 'This page could not be found' })
this.$router.push('/error')
}
}
})
......@@ -197,3 +197,11 @@ export const getters = {
isLoading: (state) => state.isLoading,
isError: (state) => state.isError,
}
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
......@@ -65,3 +65,10 @@ export const getters = {
userInfo: (state) => state.userInfo, // 用户信息
uin: (state) => state.uin,
}
export default {
namespaced: true,
state,
mutations,
actions,
getters
}
......@@ -13,9 +13,10 @@
* api(请求地址,请求成功与否,请求耗时,请求状态码,请求返回 Msg)
*/
const BrowerLogger = require('alife-logger')
import { ENV_CONFIG } from '@/config'
const __bl = (pid, disableHook = false, enableSPA = true) => {
if (process.env.NODE_ENV === 'production' && !process.env.IS_PRIVATE) {
if (process.env.NODE_ENV === 'production' && !ENV_CONFIG.IS_PRIVATE) {
try {
return BrowerLogger.singleton({
pid,
......
import ROP from '@whzcorcd/rop-client'
import { ENV_CONFIG } from '@/config'
export default new ROP({
ICS_ADDR: `mqttdms.${process.env.ROP_DOMAIN}`,
ROP_FLASH_SITE: `https://cdn.${process.env.ROP_DOMAIN}/dms/`
ICS_ADDR: `mqttdms.${ENV_CONFIG.ROP_DOMAIN}`,
ROP_FLASH_SITE: `https://cdn.${ENV_CONFIG.ROP_DOMAIN}/dms/`
})
import wx from 'weixin-js-sdk'
import { getWxShareSecret } from '@/api/modules/common'
import { ENV_CONFIG } from '@/config'
class WxShare {
constructor() {
......@@ -58,7 +59,7 @@ class WxShare {
link: info?.link || window.location.href,
title: info?.title || '分享',
desc: info?.desc || window.location.href, // 副标题
imgUrl: info?.imgUrl || `${window.location.protocol}//${process.env.OSS_DOMAIN}/common/img/shop_share.png`,
imgUrl: info?.imgUrl || `${window.location.protocol}//${ENV_CONFIG.OSS_DOMAIN}/common/img/shop_share.png`,
success: info?.success || function () {},
fail: info?.fail || function () {},
}
......
const path = require('path')
/* config 配置下载 */
const { downloadConfigFile } = require('@gdyfe/config')
const { log } = require('console')
// 下载到指定目录
downloadConfigFile({
server: process.env.mode,
ic: 'ZmUtZ5WNp%XBzDw=',
path: path.resolve(__dirname, './public/config.js')
})
.then(() => {
console.log('$$ config file downloaded $$')
})
.catch(err => {
console.log('$$ config file download failed $$', err)
})
const BASE_URL = '/questionnaire/'
module.exports = {
publicPath: BASE_URL, // vue-cli3 从baseUrl更名为publicPath
productionSourceMap: false,
chainWebpack: config => {
// 别名
config.resolve.alias.set('assets', path.resolve('src/assets')).set('public', path.resolve(__dirname, 'public')).set('@', path.resolve(__dirname, 'src'))
// DefinePlugin
config.plugin('define').tap(args => {
args[0]['process.env'] = {
...args[0]['process.env'],
mode: JSON.stringify(process.env.mode),
BASE_URL: JSON.stringify(BASE_URL)
}
return args
})
// terser
if (process.env.NODE_ENV === 'production') {
config.optimization.minimizer('terser').tap(args => {
args[0].terserOptions.parallel = 4
args[0].terserOptions.cache = true
args[0].terserOptions.compress.drop_console = true
args[0].terserOptions.compress.drop_debugger = true
return args
})
}
},
configureWebpack: {
plugins: [],
// 警告 webpack 的性能提示
performance: {
hints: false
}
},
runtimeCompiler: true,
devServer: {
disableHostCheck: true
},
css: {
sourceMap: false,
loaderOptions: {
less: {
// 配置less(其他样式解析用法一致)
lessOptions:{
javascriptEnabled: true,
}
},
postcss: {
plugins: [
require('postcss-pxtorem')({
rootValue: 75,
selectorBlackList: [/^html$/, /^body$/], // 忽略转换正则匹配项
propList: ['*'],
})
]
},
}
},
lintOnSave: false
}
FROM alpine AS builder
WORKDIR /home/app
RUN apk add --no-cache --update nodejs yarn
COPY package.json yarn.lock ./
RUN yarn install --registry=https://registry.yarnpkg.com
FROM registry.cn-hangzhou.aliyuncs.com/open_images/node12.13.1-pm2
ADD ./ /var/www/web_questionnaire
ENV HOST 0.0.0.0
ENV TZ Asia/Shanghai
WORKDIR /var/www/web_questionnaire
COPY --from=builder /home/app/package.json ./package.json
COPY --from=builder /home/app/node_modules ./node_modules
RUN yarn build:vvku
RUN rm -rf assets components layouts middleware pages plugins store .eslintrc.js .gitignore build.yml Dockerfile README.md start.sh
EXPOSE 4001
RUN chmod +x vvkuStart.sh
ENTRYPOINT ["./vvkuStart.sh"]
#!/bin/sh
yarn run pm2:vvku
while true
do
sleep 5;
done
This source diff could not be displayed because it is too large. You can view the blob instead.
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 sign in to comment