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 @@
"dev": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve"
},
"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",
"axios": "^0.27.2",
"build": "^0.1.4",
"core-js": "^3.6.4",
"dayjs": "^1.10.5",
"lib-flexible": "^0.3.2",
"npm": "^5.8.0",
"postcss-loader": "^6.2.0",
"qs": "^6.11.0",
"sass": "^1.54.4",
......
......@@ -120,7 +120,7 @@ service.interceptors.response.use(
const ruleResult = baseConfig.axios.result
// 这个状态码是和后端约定的
// 有 code 代表这是一个后端接口 可以进行进一步的判断
var goBackArr = ['20', '21']
// var goBackArr = ['20', '21']
// console.log(dataAxios[ruleResult.code_key])
// if (goBackArr.includes(dataAxios[ruleResult.code_key])) {
// // await store.dispatch('d2admin/account/logout')
......
<template>
<van-overlay :show="show">
<!-- z-index="9999999" -->
<div
class="wrapper"
@click.stop
>
<div class="wrapper"
@click.stop>
<div class="img">
<div
class="sprite-icon icon-poster-close"
@click.prevent="close"
></div>
<van-image
:src="activityData.posterUrl"
width="100%"
height="100%"
>
<div class="sprite-icon icon-poster-close"
@click.prevent="close"></div>
<van-image :src="activityData.posterUrl"
width="100%"
height="100%">
<template v-slot:loading>
<van-loading
type="spinner"
size="20"
/>
<van-loading type="spinner"
size="20" />
</template>
</van-image>
</div>
<div class="btns flex">
<div
class="save text-center"
@click.prevent="save"
>保存到相册</div>
<div
class="share text-center"
@click.prevent="share"
>分享</div>
<div class="save text-center"
@click.prevent="save">保存到相册</div>
<div class="share text-center"
@click.prevent="share">分享</div>
</div>
</div>
</van-overlay>
......@@ -47,7 +35,7 @@ export default {
img: null
}
},
mounted() {},
mounted() { },
watch: {
value(n) {
this.show = n
......@@ -62,8 +50,8 @@ export default {
this.showToast('请长按海报保存')
},
share() {
let { currentItem, apiName, activityData } = this
let flag = apiName != 'shopmallApi'
const { currentItem, apiName, activityData } = this
const flag = apiName != 'shopmallApi'
if (currentItem.userId) {
console.log(activityData)
window.$wx
......@@ -133,4 +121,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
......@@ -16,19 +16,19 @@
<script type='text/ecmascript-6'>
export default {
name: 'ScrollView',
data () {
data() {
return {
loading: false,
finished: false,
finished: false
}
},
props: ['ScrollViewclass'],
mounted () {
mounted() {
},
methods: {
onLoad () {
onLoad() {
this.$emit('ReachBottom')
},
}
}
}
</script>
......@@ -38,4 +38,4 @@ export default {
overflow-y: scroll;
box-sizing: border-box;
}
</style>
\ No newline at end of file
</style>
......@@ -40,7 +40,7 @@ export default {
},
placeholder: String
},
data () {
data() {
return {
value: 0,
option: [
......@@ -54,15 +54,15 @@ export default {
}
},
watch: {
'updata' (n) {
'updata'(n) {
this.value = this.index
},
'keyword' (n) {
'keyword'(n) {
this.searchValue = n
}
},
methods: {
onEmit (e, name) {
onEmit(e, name) {
this.$emit(name, e)
}
}
......
......@@ -38,28 +38,28 @@ export default {
default: new Date().getTime()
}
},
data () {
data() {
return {
tabIndex: this.index,
data: this.list
}
},
watch: {
'index' (n) {
'index'(n) {
this.tabIndex = n
},
'updata' (n) {
'updata'(n) {
this.data = this.list
}
},
mounted () {
mounted() {
},
methods: {
click (tabIndex) {
click(tabIndex) {
this.tabIndex = tabIndex
this.$emit('change', tabIndex)
},
handleChange(id){
handleChange(id) {
this.tabIndex = id
}
}
......@@ -81,4 +81,4 @@ export default {
.van-tab--active {
font-size: 16px !important;
}
</style>
\ No newline at end of file
</style>
......@@ -32,13 +32,13 @@ export default {
}
}
},
data () {
data() {
return {
value: ''
}
},
methods: {
change (value) {
change(value) {
this.$emit('change', value)
}
}
......
......@@ -65,8 +65,8 @@ export default {
name: 'VipDialog',
props: ['value', 'id'],
watch: {
value (n) {
let { id, component_id } = this
value(n) {
const { id, component_id } = this
if (component_id == id && n) {
this.showBox = true
return
......@@ -85,17 +85,17 @@ export default {
}
}
},
data () {
data() {
return {
showBox: false,
data: {},
component_id: ''
}
},
mounted () {
mounted() {
},
methods: {
onCancel () {
onCancel() {
this.$emit('cancel')
}
}
......@@ -158,4 +158,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
......@@ -9,7 +9,7 @@
import Vue from 'vue'
const componentsFiles = require.context(`./`, true, /.vue$/)
componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default
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
const component = componentsFiles(path).default
Vue.component(component.name, component)
})
// export default [Icon, NavBar, TabBar, Organization, CustomerList, CustomerDetail, OrderList, OrderDetail, TimerTabs, CarType, RadioCell, CheckBoxCell, ValidateField]
......@@ -47,6 +47,25 @@ var baseConfig = {
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)
// 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取
......@@ -62,12 +81,13 @@ fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-c
}
)
.then(response => {
// console.log(response)
console.log(response)
const { code, data } = response
code == '200' && ((baseConfig = data), (window.$fetchConfig = data))
})
.catch(el => {
console.log(el)
// console.log(el)
baseConfig = {
sysName: '嘀加支付宝h5系统',
hasReg: false,
......@@ -93,7 +113,7 @@ fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-c
init()
})
function init() {
new VConsole()
baseConfig.vconsole && new VConsole()
new Vue({
router,
store,
......
......@@ -26,7 +26,7 @@ function createRouter() {
// mode: 'history', // 如果是 history模式 需要配置vue.config.js publicPath
base: 'dj-carlife-web-alipay',
// base: process.env.BASE_URL,
scrollBehavior: function (to, from, savedPosition) {
scrollBehavior: function(to, from, savedPosition) {
return savedPosition || { x: 0, y: 0 }
},
routes
......
......@@ -34,7 +34,7 @@ function typeColor(type = 'default') {
* @param {String} info info text
* @param {String} type style
*/
log.capsule = function (title, info, type = 'primary') {
log.capsule = function(title, info, type = 'primary') {
console.log(
`%c ${title} %c ${info} %c`,
'background:#35495E; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;',
......@@ -46,42 +46,42 @@ log.capsule = function (title, info, type = 'primary') {
/**
* @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)};`))
}
/**
* @description 打印 default 样式的文字
*/
log.default = function (text) {
log.default = function(text) {
log.colorful([{ text }])
}
/**
* @description 打印 primary 样式的文字
*/
log.primary = function (text) {
log.primary = function(text) {
log.colorful([{ text, type: 'primary' }])
}
/**
* @description 打印 success 样式的文字
*/
log.success = function (text) {
log.success = function(text) {
log.colorful([{ text, type: 'success' }])
}
/**
* @description 打印 warning 样式的文字
*/
log.warning = function (text) {
log.warning = function(text) {
log.colorful([{ text, type: 'warning' }])
}
/**
* @description 打印 danger 样式的文字
*/
log.danger = function (text) {
log.danger = function(text) {
log.colorful([{ text, type: 'danger' }])
}
......
......@@ -27,6 +27,6 @@ export default {
}
},
consts: {
USER_KEY: 'USER_KEY',
USER_KEY: 'USER_KEY'
}
}
\ No newline at end of file
}
......@@ -32,7 +32,7 @@ export function parseTime(time, cFormat) {
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
......@@ -89,10 +89,10 @@ export function param2Obj(url) {
return JSON.parse(
'{"' +
decodeURIComponent(search)
.replace(/"/g, '\\"')
.replace(/&/g, '","')
.replace(/=/g, '":"')
.replace(/\+/g, ' ') +
.replace(/"/g, '\\"')
.replace(/&/g, '","')
.replace(/=/g, '":"')
.replace(/\+/g, ' ') +
'"}'
)
}
......@@ -116,7 +116,7 @@ export function throttle(fn, delay = 500) {
}
timer = setTimeout(() => {
fn.apply(this, arguments)
// fn(e)
// fn(e)
timer = null
}, delay)
}
......@@ -128,25 +128,25 @@ export function throttle(fn, delay = 500) {
export function deepClone(target) {
// 定义一个变量
let result
// 如果当前需要深拷贝的是一个对象的话
// 如果当前需要深拷贝的是一个对象的话
if (typeof target === 'object') {
// 如果是一个数组的话
if (Array.isArray(target)) {
result = [] // 将result赋值为一个数组,并且执行遍历
for (let i in target) {
for (const i in target) {
// 递归克隆数组中的每一项
result.push(this.deepClone(target[i]))
}
// 判断如果当前的值是null的话;直接赋值为null
} else if (target === null) {
result = null
// 判断如果当前的值是一个RegExp对象的话,直接赋值
// 判断如果当前的值是一个RegExp对象的话,直接赋值
} else if (target.constructor === RegExp) {
result = target
} else {
// 否则是普通对象,直接for in循环,递归赋值对象的所有值
result = {}
for (let i in target) {
for (const i in target) {
result[i] = this.deepClone(target[i])
}
}
......@@ -159,7 +159,7 @@ export function deepClone(target) {
}
export function fixed(num, decimal) {
num = num.toString()
let index = num.indexOf('.')
const index = num.indexOf('.')
if (index !== -1) {
num = num.substring(0, decimal + index + 1)
} else {
......@@ -175,18 +175,18 @@ export function fixed(num, decimal) {
*/
export function transformDecimal(number, i) {
let decimalNum = null
// 先转换为数值型
// 先转换为数值型
let num = Number(number)
// 判断是否为数值型
// 判断是否为数值型
if (!isNaN(num)) {
// 切分整数与小数
let arr = num.toString().split('.')
// 是小数且小数位大于保留个数
const arr = num.toString().split('.')
// 是小数且小数位大于保留个数
if (arr.length > 1 && arr[1].length > i) {
// 小数部分字符串
let decimal = arr[1].slice(i, i + 1)
// toFixed 有 bug,四舍六入五随机
// 当四舍五入的数为 5,给其 + 1
const decimal = arr[1].slice(i, i + 1)
// toFixed 有 bug,四舍六入五随机
// 当四舍五入的数为 5,给其 + 1
if (decimal === '5') {
// 这里可能会存在 0.1 ** 5 = 0.000010000000000000003 但不影响四舍五入
num += Math.pow(0.1, i + 1)
......@@ -198,4 +198,4 @@ export function transformDecimal(number, i) {
decimalNum = Number(decimalNum).toFixed(i)
}
return decimalNum
}
\ No newline at end of file
}
......@@ -230,7 +230,7 @@ export default {
},
// 键盘输入
handleKey(key) {
const that = this
// const that = this
// const { key } = e.currentTarget.dataset
// console.log(this)
// console.log(this)
......@@ -272,7 +272,7 @@ export default {
},
// 支付
handlePay() {
const _this = this
// const _this = this
const { payMoney, merchantId, unPayMoneyList, userId } = this
if (payMoney === '' || unPayMoneyList.includes(payMoney)) return
// this.wxPayment(payMoney)
......
......@@ -9,7 +9,9 @@
<script>
export default {
mounted() {
// console.log(test)
}
}
</script>
......
......@@ -2,6 +2,7 @@
const path = require('path')
const defaultSettings = require('./src/config/conf.js')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const SentryWebpackPlugin = require('@sentry/webpack-plugin')
const resolve = dir => path.join(__dirname, dir)
// page title
......@@ -60,7 +61,7 @@ module.exports = {
outputDir: 'dist', // 生产环境构建文件的目录
// assetsDir: 'static', // outputDir的静态资源(js、css、img、fonts)目录
lintOnSave: !IS_PROD,
productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
// productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: {
disableHostCheck: true,
// port: 8080, // 端口
......@@ -139,6 +140,21 @@ module.exports = {
// // 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 => {
......@@ -180,15 +196,15 @@ module.exports = {
})
.end()
/**
* 打包分析
* 打包分析 取消 vuecli4 开始自带有
*/
if (IS_PROD) {
config.plugin('webpack-report').use(BundleAnalyzerPlugin, [
{
analyzerMode: 'static'
}
])
}
// if (IS_PROD) {
// config.plugin('webpack-report').use(BundleAnalyzerPlugin, [
// {
// analyzerMode: 'static'
// }
// ])
// }
config
// https://webpack.js.org/configuration/devtool/#development
.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!