Commit 34ea879b by 张立顺

配置sentry

1 parent cc96f285
auth.token=45d2be625091494b9a0de35af25bb273c0a471650575471096d60dd61f6995e6
defaults.url = http://sentry.glsx.com.cn
defaults.org = sentry
defaults.project =dj-car-alipay
No preview for this file type
...@@ -12,11 +12,18 @@ ...@@ -12,11 +12,18 @@
"dev": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve" "dev": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve"
}, },
"dependencies": { "dependencies": {
"@sentry/browser": "^7.12.1",
"@sentry/integrations": "^7.12.1",
"@sentry/tracing": "^7.12.1",
"@sentry/vue": "^7.12.1",
"@sentry/webpack-plugin": "^1.19.0",
"autoprefixer": "^8.0.0", "autoprefixer": "^8.0.0",
"axios": "^0.27.2", "axios": "^0.27.2",
"build": "^0.1.4",
"core-js": "^3.6.4", "core-js": "^3.6.4",
"dayjs": "^1.10.5", "dayjs": "^1.10.5",
"lib-flexible": "^0.3.2", "lib-flexible": "^0.3.2",
"npm": "^5.8.0",
"postcss-loader": "^6.2.0", "postcss-loader": "^6.2.0",
"qs": "^6.11.0", "qs": "^6.11.0",
"sass": "^1.54.4", "sass": "^1.54.4",
......
...@@ -120,7 +120,7 @@ service.interceptors.response.use( ...@@ -120,7 +120,7 @@ service.interceptors.response.use(
const ruleResult = baseConfig.axios.result const ruleResult = baseConfig.axios.result
// 这个状态码是和后端约定的 // 这个状态码是和后端约定的
// 有 code 代表这是一个后端接口 可以进行进一步的判断 // 有 code 代表这是一个后端接口 可以进行进一步的判断
var goBackArr = ['20', '21'] // var goBackArr = ['20', '21']
// console.log(dataAxios[ruleResult.code_key]) // console.log(dataAxios[ruleResult.code_key])
// if (goBackArr.includes(dataAxios[ruleResult.code_key])) { // if (goBackArr.includes(dataAxios[ruleResult.code_key])) {
// // await store.dispatch('d2admin/account/logout') // // await store.dispatch('d2admin/account/logout')
......
<template> <template>
<van-overlay :show="show"> <van-overlay :show="show">
<!-- z-index="9999999" --> <!-- z-index="9999999" -->
<div <div class="wrapper"
class="wrapper" @click.stop>
@click.stop
>
<div class="img"> <div class="img">
<div <div class="sprite-icon icon-poster-close"
class="sprite-icon icon-poster-close" @click.prevent="close"></div>
@click.prevent="close" <van-image :src="activityData.posterUrl"
></div>
<van-image
:src="activityData.posterUrl"
width="100%" width="100%"
height="100%" height="100%">
>
<template v-slot:loading> <template v-slot:loading>
<van-loading <van-loading type="spinner"
type="spinner" size="20" />
size="20"
/>
</template> </template>
</van-image> </van-image>
</div> </div>
<div class="btns flex"> <div class="btns flex">
<div <div class="save text-center"
class="save text-center" @click.prevent="save">保存到相册</div>
@click.prevent="save" <div class="share text-center"
>保存到相册</div> @click.prevent="share">分享</div>
<div
class="share text-center"
@click.prevent="share"
>分享</div>
</div> </div>
</div> </div>
</van-overlay> </van-overlay>
...@@ -47,7 +35,7 @@ export default { ...@@ -47,7 +35,7 @@ export default {
img: null img: null
} }
}, },
mounted() {}, mounted() { },
watch: { watch: {
value(n) { value(n) {
this.show = n this.show = n
...@@ -62,8 +50,8 @@ export default { ...@@ -62,8 +50,8 @@ export default {
this.showToast('请长按海报保存') this.showToast('请长按海报保存')
}, },
share() { share() {
let { currentItem, apiName, activityData } = this const { currentItem, apiName, activityData } = this
let flag = apiName != 'shopmallApi' const flag = apiName != 'shopmallApi'
if (currentItem.userId) { if (currentItem.userId) {
console.log(activityData) console.log(activityData)
window.$wx window.$wx
......
...@@ -16,19 +16,19 @@ ...@@ -16,19 +16,19 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
export default { export default {
name: 'ScrollView', name: 'ScrollView',
data () { data() {
return { return {
loading: false, loading: false,
finished: false, finished: false
} }
}, },
props: ['ScrollViewclass'], props: ['ScrollViewclass'],
mounted () { mounted() {
}, },
methods: { methods: {
onLoad () { onLoad() {
this.$emit('ReachBottom') this.$emit('ReachBottom')
}, }
} }
} }
</script> </script>
......
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
}, },
placeholder: String placeholder: String
}, },
data () { data() {
return { return {
value: 0, value: 0,
option: [ option: [
...@@ -54,15 +54,15 @@ export default { ...@@ -54,15 +54,15 @@ export default {
} }
}, },
watch: { watch: {
'updata' (n) { 'updata'(n) {
this.value = this.index this.value = this.index
}, },
'keyword' (n) { 'keyword'(n) {
this.searchValue = n this.searchValue = n
} }
}, },
methods: { methods: {
onEmit (e, name) { onEmit(e, name) {
this.$emit(name, e) this.$emit(name, e)
} }
} }
......
...@@ -38,28 +38,28 @@ export default { ...@@ -38,28 +38,28 @@ export default {
default: new Date().getTime() default: new Date().getTime()
} }
}, },
data () { data() {
return { return {
tabIndex: this.index, tabIndex: this.index,
data: this.list data: this.list
} }
}, },
watch: { watch: {
'index' (n) { 'index'(n) {
this.tabIndex = n this.tabIndex = n
}, },
'updata' (n) { 'updata'(n) {
this.data = this.list this.data = this.list
} }
}, },
mounted () { mounted() {
}, },
methods: { methods: {
click (tabIndex) { click(tabIndex) {
this.tabIndex = tabIndex this.tabIndex = tabIndex
this.$emit('change', tabIndex) this.$emit('change', tabIndex)
}, },
handleChange(id){ handleChange(id) {
this.tabIndex = id this.tabIndex = id
} }
} }
......
...@@ -32,13 +32,13 @@ export default { ...@@ -32,13 +32,13 @@ export default {
} }
} }
}, },
data () { data() {
return { return {
value: '' value: ''
} }
}, },
methods: { methods: {
change (value) { change(value) {
this.$emit('change', value) this.$emit('change', value)
} }
} }
......
...@@ -65,8 +65,8 @@ export default { ...@@ -65,8 +65,8 @@ export default {
name: 'VipDialog', name: 'VipDialog',
props: ['value', 'id'], props: ['value', 'id'],
watch: { watch: {
value (n) { value(n) {
let { id, component_id } = this const { id, component_id } = this
if (component_id == id && n) { if (component_id == id && n) {
this.showBox = true this.showBox = true
return return
...@@ -85,17 +85,17 @@ export default { ...@@ -85,17 +85,17 @@ export default {
} }
} }
}, },
data () { data() {
return { return {
showBox: false, showBox: false,
data: {}, data: {},
component_id: '' component_id: ''
} }
}, },
mounted () { mounted() {
}, },
methods: { methods: {
onCancel () { onCancel() {
this.$emit('cancel') this.$emit('cancel')
} }
} }
......
...@@ -11,5 +11,5 @@ const componentsFiles = require.context(`./`, true, /.vue$/) ...@@ -11,5 +11,5 @@ const componentsFiles = require.context(`./`, true, /.vue$/)
componentsFiles.keys().forEach(path => { componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default const component = componentsFiles(path).default
Vue.component(component.name, component) Vue.component(component.name, component)
})
// export default [Icon, NavBar, TabBar, Organization, CustomerList, CustomerDetail, OrderList, OrderDetail, TimerTabs, CarType, RadioCell, CheckBoxCell, ValidateField]
\ No newline at end of file \ No newline at end of file
})
// export default [Icon, NavBar, TabBar, Organization, CustomerList, CustomerDetail, OrderList, OrderDetail, TimerTabs, CarType, RadioCell, CheckBoxCell, ValidateField]
...@@ -47,6 +47,25 @@ var baseConfig = { ...@@ -47,6 +47,25 @@ var baseConfig = {
secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353' secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
} }
} }
import * as Sentry from '@sentry/vue'
import { BrowserTracing } from '@sentry/tracing'
// 实例化
// process.env.NODE_ENV === 'production' &&
Sentry.init({
Vue,
dsn: 'https://f0db411905b541eebe6d591707f561a4@sentry.glsx.com.cn/26',
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
tracingOrigins: ['localhost', 'my-site-url.com', /^\//]
})
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0
})
// const isMock = ['prod', 'production'].includes(process.env.NODE_ENV) // const isMock = ['prod', 'production'].includes(process.env.NODE_ENV)
// 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取 // 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取
...@@ -62,12 +81,13 @@ fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-c ...@@ -62,12 +81,13 @@ fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-c
} }
) )
.then(response => { .then(response => {
// console.log(response) console.log(response)
const { code, data } = response const { code, data } = response
code == '200' && ((baseConfig = data), (window.$fetchConfig = data)) code == '200' && ((baseConfig = data), (window.$fetchConfig = data))
}) })
.catch(el => { .catch(el => {
console.log(el) // console.log(el)
baseConfig = { baseConfig = {
sysName: '嘀加支付宝h5系统', sysName: '嘀加支付宝h5系统',
hasReg: false, hasReg: false,
...@@ -93,7 +113,7 @@ fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-c ...@@ -93,7 +113,7 @@ fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-c
init() init()
}) })
function init() { function init() {
new VConsole() baseConfig.vconsole && new VConsole()
new Vue({ new Vue({
router, router,
store, store,
......
...@@ -26,7 +26,7 @@ function createRouter() { ...@@ -26,7 +26,7 @@ function createRouter() {
// mode: 'history', // 如果是 history模式 需要配置vue.config.js publicPath // mode: 'history', // 如果是 history模式 需要配置vue.config.js publicPath
base: 'dj-carlife-web-alipay', base: 'dj-carlife-web-alipay',
// base: process.env.BASE_URL, // base: process.env.BASE_URL,
scrollBehavior: function (to, from, savedPosition) { scrollBehavior: function(to, from, savedPosition) {
return savedPosition || { x: 0, y: 0 } return savedPosition || { x: 0, y: 0 }
}, },
routes routes
......
...@@ -34,7 +34,7 @@ function typeColor(type = 'default') { ...@@ -34,7 +34,7 @@ function typeColor(type = 'default') {
* @param {String} info info text * @param {String} info info text
* @param {String} type style * @param {String} type style
*/ */
log.capsule = function (title, info, type = 'primary') { log.capsule = function(title, info, type = 'primary') {
console.log( console.log(
`%c ${title} %c ${info} %c`, `%c ${title} %c ${info} %c`,
'background:#35495E; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;', 'background:#35495E; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;',
...@@ -46,42 +46,42 @@ log.capsule = function (title, info, type = 'primary') { ...@@ -46,42 +46,42 @@ log.capsule = function (title, info, type = 'primary') {
/** /**
* @description 打印彩色文字 * @description 打印彩色文字
*/ */
log.colorful = function (textArr) { log.colorful = function(textArr) {
console.log(`%c${textArr.map(t => t.text || '').join('%c')}`, ...textArr.map(t => `color: ${typeColor(t.type)};`)) console.log(`%c${textArr.map(t => t.text || '').join('%c')}`, ...textArr.map(t => `color: ${typeColor(t.type)};`))
} }
/** /**
* @description 打印 default 样式的文字 * @description 打印 default 样式的文字
*/ */
log.default = function (text) { log.default = function(text) {
log.colorful([{ text }]) log.colorful([{ text }])
} }
/** /**
* @description 打印 primary 样式的文字 * @description 打印 primary 样式的文字
*/ */
log.primary = function (text) { log.primary = function(text) {
log.colorful([{ text, type: 'primary' }]) log.colorful([{ text, type: 'primary' }])
} }
/** /**
* @description 打印 success 样式的文字 * @description 打印 success 样式的文字
*/ */
log.success = function (text) { log.success = function(text) {
log.colorful([{ text, type: 'success' }]) log.colorful([{ text, type: 'success' }])
} }
/** /**
* @description 打印 warning 样式的文字 * @description 打印 warning 样式的文字
*/ */
log.warning = function (text) { log.warning = function(text) {
log.colorful([{ text, type: 'warning' }]) log.colorful([{ text, type: 'warning' }])
} }
/** /**
* @description 打印 danger 样式的文字 * @description 打印 danger 样式的文字
*/ */
log.danger = function (text) { log.danger = function(text) {
log.colorful([{ text, type: 'danger' }]) log.colorful([{ text, type: 'danger' }])
} }
......
...@@ -27,6 +27,6 @@ export default { ...@@ -27,6 +27,6 @@ export default {
} }
}, },
consts: { consts: {
USER_KEY: 'USER_KEY', USER_KEY: 'USER_KEY'
} }
} }
...@@ -133,7 +133,7 @@ export function deepClone(target) { ...@@ -133,7 +133,7 @@ export function deepClone(target) {
// 如果是一个数组的话 // 如果是一个数组的话
if (Array.isArray(target)) { if (Array.isArray(target)) {
result = [] // 将result赋值为一个数组,并且执行遍历 result = [] // 将result赋值为一个数组,并且执行遍历
for (let i in target) { for (const i in target) {
// 递归克隆数组中的每一项 // 递归克隆数组中的每一项
result.push(this.deepClone(target[i])) result.push(this.deepClone(target[i]))
} }
...@@ -146,7 +146,7 @@ export function deepClone(target) { ...@@ -146,7 +146,7 @@ export function deepClone(target) {
} else { } else {
// 否则是普通对象,直接for in循环,递归赋值对象的所有值 // 否则是普通对象,直接for in循环,递归赋值对象的所有值
result = {} result = {}
for (let i in target) { for (const i in target) {
result[i] = this.deepClone(target[i]) result[i] = this.deepClone(target[i])
} }
} }
...@@ -159,7 +159,7 @@ export function deepClone(target) { ...@@ -159,7 +159,7 @@ export function deepClone(target) {
} }
export function fixed(num, decimal) { export function fixed(num, decimal) {
num = num.toString() num = num.toString()
let index = num.indexOf('.') const index = num.indexOf('.')
if (index !== -1) { if (index !== -1) {
num = num.substring(0, decimal + index + 1) num = num.substring(0, decimal + index + 1)
} else { } else {
...@@ -180,11 +180,11 @@ export function transformDecimal(number, i) { ...@@ -180,11 +180,11 @@ export function transformDecimal(number, i) {
// 判断是否为数值型 // 判断是否为数值型
if (!isNaN(num)) { if (!isNaN(num)) {
// 切分整数与小数 // 切分整数与小数
let arr = num.toString().split('.') const arr = num.toString().split('.')
// 是小数且小数位大于保留个数 // 是小数且小数位大于保留个数
if (arr.length > 1 && arr[1].length > i) { if (arr.length > 1 && arr[1].length > i) {
// 小数部分字符串 // 小数部分字符串
let decimal = arr[1].slice(i, i + 1) const decimal = arr[1].slice(i, i + 1)
// toFixed 有 bug,四舍六入五随机 // toFixed 有 bug,四舍六入五随机
// 当四舍五入的数为 5,给其 + 1 // 当四舍五入的数为 5,给其 + 1
if (decimal === '5') { if (decimal === '5') {
......
...@@ -230,7 +230,7 @@ export default { ...@@ -230,7 +230,7 @@ export default {
}, },
// 键盘输入 // 键盘输入
handleKey(key) { handleKey(key) {
const that = this // const that = this
// const { key } = e.currentTarget.dataset // const { key } = e.currentTarget.dataset
// console.log(this) // console.log(this)
// console.log(this) // console.log(this)
...@@ -272,7 +272,7 @@ export default { ...@@ -272,7 +272,7 @@ export default {
}, },
// 支付 // 支付
handlePay() { handlePay() {
const _this = this // const _this = this
const { payMoney, merchantId, unPayMoneyList, userId } = this const { payMoney, merchantId, unPayMoneyList, userId } = this
if (payMoney === '' || unPayMoneyList.includes(payMoney)) return if (payMoney === '' || unPayMoneyList.includes(payMoney)) return
// this.wxPayment(payMoney) // this.wxPayment(payMoney)
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
<script> <script>
export default { export default {
mounted() {
// console.log(test)
}
} }
</script> </script>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
const path = require('path') const path = require('path')
const defaultSettings = require('./src/config/conf.js') const defaultSettings = require('./src/config/conf.js')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const SentryWebpackPlugin = require('@sentry/webpack-plugin')
const resolve = dir => path.join(__dirname, dir) const resolve = dir => path.join(__dirname, dir)
// page title // page title
...@@ -60,7 +61,7 @@ module.exports = { ...@@ -60,7 +61,7 @@ module.exports = {
outputDir: 'dist', // 生产环境构建文件的目录 outputDir: 'dist', // 生产环境构建文件的目录
// assetsDir: 'static', // outputDir的静态资源(js、css、img、fonts)目录 // assetsDir: 'static', // outputDir的静态资源(js、css、img、fonts)目录
lintOnSave: !IS_PROD, lintOnSave: !IS_PROD,
productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。 // productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: { devServer: {
disableHostCheck: true, disableHostCheck: true,
// port: 8080, // 端口 // port: 8080, // 端口
...@@ -139,6 +140,21 @@ module.exports = { ...@@ -139,6 +140,21 @@ module.exports = {
// // externals // // externals
// config.externals = externals // config.externals = externals
// } // }
// sentry 配置
// process.env.NODE_ENV === 'production' &&
Object.assign(config, {
plugins: [
...config.plugins,
new SentryWebpackPlugin({
// webpack specific configuration
release: '0.0.1',
include: './dist', // 需要上传到sentry服务器的资源目录,会自动匹配js 以及map文件
ignore: ['node_modules', 'vue.config.js'], // 忽略文件目录,当然我们在inlcude中制定了文件路径,这个忽略目录可以不加
configFile: '.sentryclirc',
urlPrefix: '~/dj-car-alipay/'
})
]
})
}, },
chainWebpack: config => { chainWebpack: config => {
...@@ -180,15 +196,15 @@ module.exports = { ...@@ -180,15 +196,15 @@ module.exports = {
}) })
.end() .end()
/** /**
* 打包分析 * 打包分析 取消 vuecli4 开始自带有
*/ */
if (IS_PROD) { // if (IS_PROD) {
config.plugin('webpack-report').use(BundleAnalyzerPlugin, [ // config.plugin('webpack-report').use(BundleAnalyzerPlugin, [
{ // {
analyzerMode: 'static' // analyzerMode: 'static'
} // }
]) // ])
} // }
config config
// https://webpack.js.org/configuration/devtool/#development // https://webpack.js.org/configuration/devtool/#development
.when(!IS_PROD, config => config.devtool('cheap-source-map')) .when(!IS_PROD, config => config.devtool('cheap-source-map'))
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!