Commit 62a2110d by 张立顺

Merge branch 'dev_v4.11.0' into 'master'

Dev v4.11.0

See merge request !1
2 parents 05d7bc21 34ea879b
auth.token=45d2be625091494b9a0de35af25bb273c0a471650575471096d60dd61f6995e6
defaults.url = http://sentry.glsx.com.cn
defaults.org = sentry
defaults.project =dj-car-alipay
......@@ -11,7 +11,7 @@ const plugins = [
'vant'
]
]
// 去除 console.log
// 去除 console.log 先打开调试
if (IS_PROD) {
plugins.push('transform-remove-console')
}
......
{
"name": "gh-hall",
"name": "dj-car-alipay",
"version": "1.0.0",
"description": "GH Hall By Work WeChat",
"description": "dj-car-alipay By h5",
"author": "limin <limin.mail@qq.com>",
"private": true,
"scripts": {
......@@ -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",
......@@ -40,6 +47,7 @@
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"file-loader": "^4.0.0",
"postcss-px-to-viewport": "^1.1.1",
"postcss-pxtorem": "^5.1.1",
"sass-loader": "^8.0.2",
......
......@@ -4,13 +4,13 @@
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no,viewport-fit=cover">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
<!-- <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
<% } %>
<title>
<%= webpackConfig.name %>
</title>
<% } %> -->
<title>
<%= webpackConfig.name %>
</title>
</head>
<body>
......@@ -24,10 +24,10 @@
<!-- <script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> -->
<!-- <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script> -->
<!-- 使用CDN加速的JS文件,配置在vue.config.js下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<!-- <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
<!-- built files will be auto injected -->
<% } %> -->
<!-- built files will be auto injected -->
</body>
</html>
\ No newline at end of file
......@@ -5,7 +5,9 @@ const path = 'dj.api.smartcarlife.'
// /router/dj.api.smartcarlife.alipay.oauth.token
// 支付宝授权码换取用户ID
export function alipayOauthToken(data) {
console.log('data', data)
data.method = `${path}alipay.oauth.token`
console.log('data', data)
return request(data, RequestMethods.POST)
}
// 发起支付
......
......@@ -116,10 +116,11 @@ service.interceptors.response.use(
// subErrors: null
// }
const dataAxios = response.data
console.log('dataAxios', dataAxios)
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')
......@@ -141,6 +142,7 @@ service.interceptors.response.use(
},
error => {
console.log(error, 'error')
if (error && error.response) {
switch (error.response.status) {
case 400:
......
<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,
......
......@@ -24,8 +24,9 @@ const router = createRouter()
function createRouter() {
return new Router({
// mode: 'history', // 如果是 history模式 需要配置vue.config.js publicPath
base: process.env.BASE_URL,
scrollBehavior: function (to, from, savedPosition) {
base: 'dj-carlife-web-alipay',
// base: process.env.BASE_URL,
scrollBehavior: function(to, from, savedPosition) {
return savedPosition || { x: 0, y: 0 }
},
routes
......@@ -36,7 +37,7 @@ router.beforeEach((to, from, next) => {
// // 判断当前浏览器环境 不是支付宝就跳转提示页面
const AlipayClient = /AlipayClient/.test(window.navigator.userAgent)
// console.log(AlipayClient)
// if (!AlipayClient && to.path !== '/tipsPage') return next('/tipsPage')
if (!AlipayClient && to.path !== '/tipsPage') return next('/tipsPage')
// if (/MicroMessenger/.test(window.navigator.userAgent)) {
// alert('微信客户端')
......
......@@ -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
}
......@@ -116,31 +116,40 @@ export default {
// openId: 'oQ6Sh5cGirPd55Oc1J1oJSRpboFM',
// openId: '',
userId: '', // 测试用数据
// userId: '2088012113317722', // 测试用数据
// userId: '2088012113317722' // 测试用数据
tradeNO: ''// 测试用数据
// tradeNO: '2022083122001417721446143547'// 测试用数据
}
},
mounted() {
const that = this
console.log(baseConfig)
const { appId } = baseConfig
// console.log(appId)
const { merchantName, merchantId } = this.getHrefParams()
this.merchantId = merchantId
this.merchantName = merchantName
// console.log(merchanInfo)
console.log(appId, 'appId')
// console.log('ap.getAuthCode', ap.getAuthCode)
// ap.alert(appId)
// 请求用户授权
// ap.getAuthCode({
// // appId: '${appId}',
// appId,
// // scopes: ['auth_user']
// // 主动授权:auth_user,静默授权:auth_base。或者其它scope
// scopes: ['auth_base']
// }, function (res) {
// res.authCode && that.gteOpenId(res.authCode)
// })
// this.gteOpenId('ab3aa51e466140b5b96475706653UX72')
ap.getAuthCode({
// appId: '${appId}',
appId,
// scopes: ['auth_user']
// 主动授权:auth_user,静默授权:auth_base。或者其它scope
scopes: ['auth_base']
}, function (res) {
// ap.alert(JSON.stringify(res))
console.log(JSON.stringify(res))
res.authCode && that.getOpenId(res.authCode)
}, function (res) {
// alert(JSON.stringify(res))
console.log('res.fail', res)
// res.authCode && that.getOpenId(res.authCode)
})
// this.getOpenId('ab3aa51e466140b5b96475706653UX72')
// this.aliPayment()
......@@ -152,15 +161,17 @@ export default {
// })
},
methods: {
gteOpenId(code) {
// ap.alert(JSON.stringify(code))
// console.log('gteOpenId', code)
getOpenId(code) {
console.log('getOpenId', code)
console.log(alipayOauthToken)
// !code&&console.log('alipayOauthToken')
code && alipayOauthToken({ code }).then((result) => {
// alert('alipayOauthToken', JSON.stringify(result))
console.log('alipayOauthToken', result)
const { userId } = result
this.userId = userId
// ap.alert(JSON.stringify(result))
}).catch((err) => {
// alert(JSON.stringify(err))
// ap.alert(JSON.stringify(err))
console.log('err', err)
})
......@@ -219,7 +230,7 @@ export default {
},
// 键盘输入
handleKey(key) {
const that = this
// const that = this
// const { key } = e.currentTarget.dataset
// console.log(this)
// console.log(this)
......@@ -261,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)
......@@ -290,8 +301,9 @@ export default {
// return
createWxPayH5(params).then((result) => {
const { tradeNO } = JSON.parse(result.jsapiPayInfo)
this.outTradeNo = tradeNO
this.outTradeNo && this.aliPayment()
this.tradeNO = tradeNO
console.log('tradeNO', tradeNO)
this.tradeNO && this.aliPayment()
}).catch((err) => {
console.log(err)
}).finally(() => {
......@@ -301,7 +313,7 @@ export default {
aliPayment() {
const that = this
// 调用支付宝api唤起支付功能
console.log('this.outTradeNo', this.tradeNO)
console.log('this.tradeNO', this.tradeNO)
const { tradeNO } = this
AlipayJSBridge.call(
'tradePay',
......@@ -352,6 +364,13 @@ export default {
</script>
<style scoped>
* {
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.clearfix::after {
content: '';
display: table;
......@@ -448,6 +467,8 @@ export default {
}
.deletIcon {
/* 禁用图片保存事件 */
pointer-events: none;
width: 54px;
height: 42px;
}
......
......@@ -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
......@@ -53,13 +54,14 @@ const spritesmithFunction = data => {
return `${shared}\n${perSprite}`
}
module.exports = {
// publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-lwk/', // 本地调试时需登录时使用
publicPath: IS_PROD ? '/dj-carlife-web-alipay' : './', // 本地调试时需登录时使用
// publicPath: './',
publicPath: '/dj-carlife-web-alipay', // 署应用包时的基本 URL。 vue-router history模式使用
// publicPath: '/dj-carlife-web-alipay', // 署应用包时的基本 URL。 vue-router history模式使用
// publicPath: '/dj-carlife-web-alipay/', // 署应用包时的基本 URL。 vue-router history模式使用
outputDir: 'dist', // 生产环境构建文件的目录
assetsDir: 'static', // outputDir的静态资源(js、css、img、fonts)目录
// 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, // 端口
......@@ -138,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 => {
......@@ -179,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!