Commit 681641f5 by 张立顺

v4.11.0 功能开发

1 parent 02dda58d
...@@ -8,16 +8,31 @@ module.exports = { ...@@ -8,16 +8,31 @@ module.exports = {
parser: 'babel-eslint' parser: 'babel-eslint'
}, },
rules: { rules: {
'vue/max-attributes-per-line': [ // 强制第一个属性的位置(属性换行)
2, 'vue/first-attribute-linebreak': 'off',
{ // [
singleline: 10, // 2,
multiline: { // {
max: 1, // // 单行时,第一属性前不允许使用换行符
allowFirstLine: false // singleline: 'beside',
} // // 多行时,第一属性前必须使用换行符
} // multiline: 'beside'
], // }
// ],
// 强制每行的最大属性数
'vue/max-attributes-per-line': 'off',
// [
// 2,
// {
// // 单行时可以接收最大数量
// singleline: 10,
// // 多行时可以接收最大数量
// multiline: {
// max: 1
// }
// }
// ],
'"vue/max-attributes-per-line"': 'off',
'vue/singleline-html-element-content-newline': 'off', 'vue/singleline-html-element-content-newline': 'off',
'vue/multiline-html-element-content-newline': 'off', 'vue/multiline-html-element-content-newline': 'off',
'vue/name-property-casing': ['error', 'PascalCase'], 'vue/name-property-casing': ['error', 'PascalCase'],
......
...@@ -10,12 +10,14 @@ module.exports = { ...@@ -10,12 +10,14 @@ module.exports = {
// selectorBlackList: ['van-','ignore','ign-','.hairlines'] // selectorBlackList: ['van-','ignore','ign-','.hairlines']
// }, // },
'postcss-px-to-viewport': { 'postcss-px-to-viewport': {
viewportWidth: 375, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750 // viewportWidth: 375, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750
viewportWidth: 750, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750
unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数(很多时候无法整除) unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数(很多时候无法整除)
viewportUnit: 'vw', // 指定需要转换成的视窗单位,建议使用vw viewportUnit: 'vw', // 指定需要转换成的视窗单位,建议使用vw
selectorBlackList: ['.ignore', '.hairlines', 'ign-'], // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名 selectorBlackList: ['.ignore', '.hairlines', 'ign-'], // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名
minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值 minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值
exclude: [/node_modules/],
mediaQuery: false // 允许在媒体查询中转换`px` mediaQuery: false // 允许在媒体查询中转换`px`
} }
} }
}
\ No newline at end of file \ No newline at end of file
}
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
to continue.</strong> to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<!-- 接入支付宝sdk -->
<script src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.min.js"> </script> <script src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.min.js"> </script>
<!-- <script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> --> <!-- <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> --> <!-- <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script> -->
......
import request from './request' import request from './request'
import RequestMethods from './request.methods' import RequestMethods from './request.methods'
const path = 'dj.api.' const path = 'dj.api.smartcarlife.'
export function getProductType(data) {
data.method = `${path}goods.type.list` // /router/dj.api.smartcarlife.alipay.oauth.token
return request(data) // 支付宝授权码换取用户ID
export function alipayOauthToken(data) {
data.method = `${path}alipay.oauth.token`
return request(data, RequestMethods.POST)
} }
// 银行列表 // 发起支付
export function getBankListApi(data) { export function createWxPayH5(data) {
data.method = `${path}yseBankInfo.bankList` data.method = `${path}payOrder.createWxPayH5.noLogin`
console.log(data) console.log(data)
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST)
} }
...@@ -13,7 +13,7 @@ import { baseConfig } from '@/main' ...@@ -13,7 +13,7 @@ import { baseConfig } from '@/main'
const request = (params = {}, method = RequestMethods.GET, noSignAttr = [], options) => { const request = (params = {}, method = RequestMethods.GET, noSignAttr = [], options) => {
// console.log(baseConfig) // console.log(baseConfig)
// params.source = 'glsx' // params.source = 'glsx'
console.log(params) // console.log(params)
// params.appKey = 'd7ffc3346fc9a45bccaaa35300d59022' // params.appKey = 'd7ffc3346fc9a45bccaaa35300d59022'
params.appKey = baseConfig?.axios?.appkey params.appKey = baseConfig?.axios?.appkey
// clg // clg
...@@ -35,7 +35,6 @@ const request = (params = {}, method = RequestMethods.GET, noSignAttr = [], opti ...@@ -35,7 +35,6 @@ const request = (params = {}, method = RequestMethods.GET, noSignAttr = [], opti
const path = '/rop-dj-car-boutique/router' const path = '/rop-dj-car-boutique/router'
// baseConfig.axios.baseURL + params.method // baseConfig.axios.baseURL + params.method
const url = `${baseConfig.axios.baseURL}${path}?method=${params.method}` const url = `${baseConfig.axios.baseURL}${path}?method=${params.method}`
console.log(url)
// console.log(url) // console.log(url)
/** /**
* 调后端接口,请使用以下代码。 * 调后端接口,请使用以下代码。
......
...@@ -8,7 +8,7 @@ import sha1 from 'sha1' ...@@ -8,7 +8,7 @@ import sha1 from 'sha1'
import qs from 'qs' import qs from 'qs'
import { baseConfig } from '@/main' import { baseConfig } from '@/main'
import { util } from '@/utils' import { util } from '@/utils'
console.log(util) // console.log(util)
// // 等后面再处理 // // 等后面再处理
// console.log(baseConfig) // console.log(baseConfig)
......
...@@ -22,7 +22,10 @@ import { bus, tools, store as local, util } from './utils' ...@@ -22,7 +22,10 @@ import { bus, tools, store as local, util } from './utils'
import './utils/util' import './utils/util'
import 'components' import 'components'
import { components } from '@/plugins/vant' import { components } from '@/plugins/vant'
components.forEach(component => Vue.use(component)) components.forEach(component => {
// console.log(component)
Vue.use(component)
})
Vue.prototype.api = api Vue.prototype.api = api
Vue.prototype.bus = bus Vue.prototype.bus = bus
Vue.prototype.tools = tools Vue.prototype.tools = tools
...@@ -44,9 +47,10 @@ var baseConfig = { ...@@ -44,9 +47,10 @@ var baseConfig = {
secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353' secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
} }
} }
// 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不能通过配置中心动态获取
fetch('http://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-alipay-config') fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-alipay-config')
.then( .then(
response => { response => {
// 处理http响应 // 处理http响应
...@@ -58,65 +62,71 @@ fetch('http://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-ca ...@@ -58,65 +62,71 @@ fetch('http://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-ca
} }
) )
.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))
// window.$fetchConfig = res })
// console.log('data', data) .catch(el => {
// if (data.vconsole) console.log(el)
new VConsole() baseConfig = {
new Vue({ sysName: '嘀加支付宝h5系统',
router, hasReg: false,
store, hasAuth: false,
// i18n, vconsole: true,
render: h => { env: 'develop',
// data.axios.baseURL = axios: {
// 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router' baseURL: 'http://192.168.3.226:9711',
Vue.prototype.baseConfig = data appkey: '48e5e13229b82c1b4e6e8c96151f0637',
return h(App) secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
timeout: 50000,
result: {
data_key: 'data',
message_key: 'message',
code_key: 'code',
code_success_value: 0,
code_message_map: {}
}
} }
// created () { }
// 处理路由 得到每一级的路由设置
// this.$store.commit('d2admin/page/init', frameInRoutes)
// 设置顶栏菜单 (暂时不需要)
// this.$store.commit('d2admin/menu/headerSet', menuHeader)
// 设置侧边栏菜单 (TODO 进行过滤)
// this.$store.commit('d2admin/menu/asideSet', menuAside)
// 初始化菜单搜索功能
// this.$store.commit('d2admin/search/init', menuHeader)
// },
// created() {
// // 系统配置
// Vue.config.devtools = true
// // 展示系统信息
// this.$store.commit('d2admin/releases/versionShow')
// // 用户登录后从数据库加载一系列的设置
// this.$store.dispatch('d2admin/account/load')
// // 获取并记录用户 UA
// this.$store.commit('d2admin/ua/get')
// // 初始化全屏监听
// this.$store.dispatch('d2admin/fullscreen/listen')
// },
// mounted() {}
}).$mount('#app')
}) })
// fetchConfig(!isMock).then(res => { .finally(() => {
// // 从配置服务器获取动态配置 init()
// // 设置 js中可以访问 $cdn })
// Vue.use(cfg) function init() {
// window.$fetchConfig = res new VConsole()
// if (res.vconsole) new VConsole() new Vue({
router,
// /** 登录过期 重新登录 */ store,
// // window.reLogin = () => { // i18n,
// // console.log('重新登录') render: h => {
// // // util.clearSessionId() // data.axios.baseURL =
// // } // 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router'
// window.vm = new Vue({ // Vue.prototype.baseConfig = data
// el: '#app', return h(App)
// router, }
// store, // created () {
// render: h => h(App) // 处理路由 得到每一级的路由设置
// }) // this.$store.commit('d2admin/page/init', frameInRoutes)
// }) // 设置顶栏菜单 (暂时不需要)
// this.$store.commit('d2admin/menu/headerSet', menuHeader)
// 设置侧边栏菜单 (TODO 进行过滤)
// this.$store.commit('d2admin/menu/asideSet', menuAside)
// 初始化菜单搜索功能
// this.$store.commit('d2admin/search/init', menuHeader)
// },
// created() {
// // 系统配置
// Vue.config.devtools = true
// // 展示系统信息
// this.$store.commit('d2admin/releases/versionShow')
// // 用户登录后从数据库加载一系列的设置
// this.$store.dispatch('d2admin/account/load')
// // 获取并记录用户 UA
// this.$store.commit('d2admin/ua/get')
// // 初始化全屏监听
// this.$store.dispatch('d2admin/fullscreen/listen')
// },
// mounted() {}
}).$mount('#app')
}
export { baseConfig } export { baseConfig }
...@@ -8,88 +8,90 @@ ...@@ -8,88 +8,90 @@
*/ */
// 按需全局引入 vant组件 // 按需全局引入 vant组件
import { import {
Button, // Button,
List, // List,
Cell, // Cell,
Tabbar, // Tabbar,
TabbarItem, // TabbarItem,
NavBar, // NavBar,
Search, // Search,
ActionSheet, // ActionSheet,
CellGroup, // CellGroup,
Image as VanImage, // Image as VanImage,
Tag, // Tag,
Field, // Field,
Stepper, // Stepper,
Divider, // Divider,
Step, // Step,
Steps, // Steps,
NoticeBar, // NoticeBar,
RadioGroup, // RadioGroup,
Radio, // Radio,
Uploader, // Uploader,
Tab, // Tab,
Tabs, // Tabs,
DropdownMenu, // DropdownMenu,
DropdownItem, // DropdownItem,
Grid, // Grid,
GridItem, // GridItem,
Popup, // Popup,
Calendar, // Calendar,
Cascader, // Cascader,
Checkbox, // Checkbox,
CheckboxGroup, // CheckboxGroup,
Notify, // Notify,
Icon, // Icon,
Empty, // Empty,
PullRefresh, // PullRefresh,
Picker, // Picker,
Dialog, // Dialog,
ShareSheet, // ShareSheet,
Overlay, // Overlay,
loading, // loading,
SwipeCell // SwipeCell
Toast
} from 'vant' } from 'vant'
export const components = [ export const components = [
Button,
List,
Cell,
Tabbar,
TabbarItem,
NavBar,
Search,
ActionSheet,
CellGroup,
VanImage,
Tag,
Field,
Stepper,
Divider,
Step,
Steps,
NoticeBar,
RadioGroup,
Radio,
Uploader,
Tab,
Tabs,
DropdownMenu,
DropdownItem,
Grid,
GridItem,
Popup,
Calendar,
Cascader,
Checkbox,
CheckboxGroup,
Notify,
Icon,
Empty,
PullRefresh,
Picker,
Dialog,
ShareSheet,
Overlay,
loading,
SwipeCell
]
\ No newline at end of file \ No newline at end of file
Toast
// Button,
// List,
// Cell,
// Tabbar,
// TabbarItem,
// NavBar,
// Search,
// ActionSheet,
// CellGroup,
// VanImage,
// Tag,
// Field,
// Stepper,
// Divider,
// Step,
// Steps,
// NoticeBar,
// RadioGroup,
// Radio,
// Uploader,
// Tab,
// Tabs,
// DropdownMenu,
// DropdownItem,
// Grid,
// GridItem,
// Popup,
// Calendar,
// Cascader,
// Checkbox,
// CheckboxGroup,
// Notify,
// Icon,
// Empty,
// PullRefresh,
// Picker,
// Dialog,
// ShareSheet,
// Overlay,
// loading,
// SwipeCell
]
...@@ -33,7 +33,20 @@ function createRouter() { ...@@ -33,7 +33,20 @@ function createRouter() {
} }
// http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-attachment-activity/ // http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-attachment-activity/
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
// // 判断当前浏览器环境 不是支付宝就跳转提示页面
const AlipayClient = /AlipayClient/.test(window.navigator.userAgent)
// console.log(AlipayClient)
// if (!AlipayClient && to.path !== '/tipsPage') return next('/tipsPage')
// if (/MicroMessenger/.test(window.navigator.userAgent)) {
// alert('微信客户端')
// } else if () {
// alert('支付宝客户端')
// } else {
// alert('其他浏览器')
// }
/* 路由发生变化修改页面title */ /* 路由发生变化修改页面title */
console.log('meta', to)
if (to.meta.title) { if (to.meta.title) {
store.dispatch('setPageMeta', to.meta) store.dispatch('setPageMeta', to.meta)
} else { } else {
......
...@@ -89,6 +89,18 @@ const routes = [ ...@@ -89,6 +89,18 @@ const routes = [
component: () => import('@/views/layouts') component: () => import('@/views/layouts')
}, },
{ {
path: '/tipsPage',
name: 'tipsPage',
meta: {
title: '提示'
},
// redirect: {
// name: 'index'
// },
// component: import('@/views/layouts/index')
component: () => import('@/views/tipsPage')
},
{
// path: '/ailpay', // path: '/ailpay',
path: '/', path: '/',
redirect: { name: 'index' }, redirect: { name: 'index' },
...@@ -99,6 +111,9 @@ const routes = [ ...@@ -99,6 +111,9 @@ const routes = [
// 支付页面 // 支付页面
path: '/alipay', path: '/alipay',
name: 'alipay', name: 'alipay',
meta: {
title: '支付宝支付'
},
component: () => import('@/views/alipay') component: () => import('@/views/alipay')
} }
] ]
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { getProductType, getBankListApi } from '@/api/alipayApi' // import { getProductType, getBankListApi } from '@/api/alipayApi'
export default { export default {
name: 'AppLayout', name: 'AppLayout',
computed: { computed: {
......
<template>
<div class="cont">
<img class="tipIcon"
src="../images/tipIcon.png"
alt="">
<p class="tips">请使用支付宝扫描二维码完成支付</p>
</div>
</template>
<script>
export default {
}
</script>
<style scoped lang="scss">
.cont {
display: flex;
flex-direction: column;
align-items: center;
.tips {
font-size: 28px;
}
}
.tipIcon {
width: 120px;
height: 120px;
margin: 70px 0 30px;
}
</style>
...@@ -5,7 +5,8 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl ...@@ -5,7 +5,8 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
const resolve = dir => path.join(__dirname, dir) const resolve = dir => path.join(__dirname, dir)
// page title // page title
const name = defaultSettings.title || 'vue mobile template' // const name = defaultSettings.title || 'vue mobile template'
const name = '嘀加 支付宝'
// 生产环境,测试和正式 // 生产环境,测试和正式
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV) const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
// externals // externals
...@@ -61,6 +62,7 @@ module.exports = { ...@@ -61,6 +62,7 @@ module.exports = {
productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。 productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: { devServer: {
disableHostCheck: true, disableHostCheck: true,
// port: 8080, // 端口
port: 80, // 端口 port: 80, // 端口
open: false, // 启动后打开浏览器 open: false, // 启动后打开浏览器
// public: 'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main/#/', // public: 'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main/#/',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!