Commit ddc2b834 by 潘琦

电子券H5页面针对张家港相关需求代码变动及功能完善;

parent d24031d8
......@@ -6,15 +6,9 @@ const path = require('path')
const url = 'http://voucher.check.icaremgt.com' // 开发
// const url = 'http://voucher.icaremgt.com' // 正式
const sjkgurl = 'https://api-wx-service.check.icaremgt.com' // 机构空间(开发)
// const sjkgurl = 'https://api-wx-service.check.icaremgt.com' // 机构空间(开发)
// const sjkgurl = 'https://sjkg-wx-service.icaremgt.com' // 机构空间(正式)
// console.log('NODE_ENV' + process.env.NODE_ENV)
// if (process.env.NODE_ENV === 'production') {
// let root = process.env.API_ROOT
// axios.defaults.baseURL = root // 开发服
// }
const sjkgurl = 'http://192.168.1.234:9005'
module.exports = {
dev: {
......
......@@ -4,6 +4,7 @@ const prodEnv = require('./prod.env')
const baseUrl = '"http://voucher.check.icaremgt.com"' //打包后请求前缀(开发)
// const baseUrl = '"http://voucher.icaremgt.com"' //打包后请求前缀(正式)
module.exports = merge(prodEnv, {
NODE_ENV: '"production"',
API_ROOT: baseUrl
......
......@@ -685,4 +685,23 @@ ul li {
.mint-indicator-wrapper{
z-index: 9999;
}
.mint-radiolist .mint-cell {
width: 90px;
float: right;
background-image: none;
min-height: 0;
}
.mint-radiolist .mint-cell > .mint-cell-wrapper {
background-image: none;
padding: 0;
font-size: 14px;
}
.mint-radiolist-label {
font-weight: normal;
padding: 0;
}
.mint-radio-input:checked + .mint-radio-core {
background-color: #FF9B44;
border-color: #FF9B44;
}
</style>
......@@ -35,3 +35,30 @@ export function getSignInfo (params) {
data: params
})
}
// 根据区域code获取该区域下所有机构
export function getOrgsByAreaCode (params) {
return request({
url: '/v1/org/orglistByCountry',
method: 'POST',
params: params
})
}
// 签约
export function createSign (params) {
return request({
url: '/v1/voucher/sign',
method: 'POST',
data: params
})
}
// 签约详情(根据sign id)
export function getSignInfoBySignId (params) {
return request({
url: '/v1/voucher/signInfo',
method: 'GET',
params: params
})
}
<template>
<div class="signature-block" ref="signBlock">
<canvas ref="signatureCanvas" @touchstart='touchStart' @touchmove='touchMove' @touchend='touchEnd' @mousedown="mouseDown" @mousemove="mouseMove" @mouseup="mouseUp"></canvas>
</div>
</template>
<script>
export default {
name: 'signature',
data () {
return {
canvasWidth: window.innerWidth,
canvasHeight: window.innerHeight,
canvasImg: '', // 签名图片地址
ctx: null, // 画板
stage_info: [], // 移动端按下点到屏幕的偏差
isDown: false, // 是否按下
points: [], // 按下点组合
startX: 0, // 起始点x坐标
startY: 0
}
},
created () {
},
mounted () {
console.log('mounted 1')
this.init()
},
methods: {
init () {
console.log('init 1')
let canvas = this.$refs.signatureCanvas
this.ctx = canvas.getContext('2d')
this.ctx.strokeStyle = '#000'
this.stage_info = canvas.getBoundingClientRect()
},
touchStart (ev) {
// console.log('touchStart')
// this.$toast({
// message: 'touchStart',
// position: 'center',
// duration: 1 * 1000
// })
let e = ev || event
e.preventDefault()
if (e.touches.length === 1) {
let obj = {
x: e.targetTouches[0].clientX - this.stage_info.left,
y: e.targetTouches[0].clientY - this.stage_info.top
}
this.startX = obj.x
this.startY = obj.y
this.ctx.beginPath()
this.ctx.moveTo(this.startX, this.startY)
this.ctx.lineTo(obj.x, obj.y)
this.ctx.stroke()
this.ctx.closePath()
this.points.push(obj)
}
},
touchMove (ev) {
let e = ev || event
e.preventDefault()
if (e.touches.length === 1) {
let obj = {
x: e.targetTouches[0].clientX - this.stage_info.left,
y: e.targetTouches[0].clientY - this.stage_info.top
}
this.ctx.beginPath()
this.ctx.moveTo(this.startX, this.startY)
this.ctx.lineTo(obj.x, obj.y)
this.ctx.stroke()
this.ctx.closePath()
this.startX = obj.x
this.startY = obj.y
this.points.push(obj)
}
},
touchEnd (ev) {
let e = ev || event
e.preventDefault()
if (e.touches.length === 1) {
let obj = {
x: e.targetTouches[0].clientX - this.stage_info.left,
y: e.targetTouches[0].clientY - this.stage_info.top
}
this.startX = obj.x
this.startY = obj.y
this.ctx.beginPath()
this.ctx.moveTo(this.startX, this.startY)
this.ctx.lineTo(obj.x, obj.y)
this.ctx.stroke()
this.ctx.closePath()
this.points.push(obj)
}
},
// pc
mouseDown (ev) {
let e = ev || event
e.preventDefault()
this.isDown = true
let obj = {
x: e.offsetX,
y: e.offsetY
}
this.startX = obj.x
this.startY = obj.y
this.ctx.beginPath()
this.ctx.moveTo(this.startX, this.startY)
this.ctx.lineTo(obj.x, obj.y)
this.ctx.stroke()
this.ctx.closePath()
this.points.push(obj)
},
mouseMove (ev) {
let e = ev || event
e.preventDefault()
if (this.isDown) {
let obj = {
x: e.offsetX,
y: e.offsetY
}
this.ctx.beginPath()
this.ctx.moveTo(this.startX, this.startY)
this.ctx.lineTo(obj.x, obj.y)
this.ctx.stroke()
this.ctx.closePath()
this.startY = obj.y
this.startX = obj.x
this.points.push(obj)
}
},
mouseUp (ev) {
let e = ev || event
e.preventDefault()
let obj = {
x: ev.offsetX,
y: ev.offsetY
}
this.ctx.beginPath()
this.ctx.moveTo(this.startX, this.startY)
this.ctx.lineTo(obj.x, obj.y)
this.ctx.stroke()
this.ctx.closePath()
this.points.push(obj)
this.points.push({ x: -1, y: -1 })
this.isDown = false
},
handelOverwrite () { // 重写清空
console.log('handelOverwrite')
this.ctx.clearRect(0, 0, this.$refs.signatureCanvas.width, this.$refs.signatureCanvas.height)
this.points = []
},
handelSignSubmit () {
let imgData = this.$refs.canvasF.toDataURL()
console.log(imgData)
}
}
}
</script>
<style scoped>
.signature-block,
.signature-block canvas {
width: 100%;
height: 100%;
}
</style>
......@@ -23,9 +23,11 @@ import {
Indicator,
Actionsheet,
Radio,
Checklist,
InfiniteScroll
} from 'mint-ui'
import 'mint-ui/lib/style.css'
import vueSignature from 'vue-signature'
Vue.component(TabContainer.name, TabContainer)
Vue.component(TabContainerItem.name, TabContainerItem)
......@@ -41,7 +43,9 @@ Vue.component(Spinner.name, Spinner)
Vue.component(DatetimePicker.name, DatetimePicker)
Vue.component(Actionsheet.name, Actionsheet)
Vue.component(Radio.name, Radio)
Vue.component(Checklist.name, Checklist)
Vue.use(InfiniteScroll)
Vue.use(vueSignature)
Vue.prototype.$toast = Toast
Vue.prototype.$MessageBox = MessageBox
......
......@@ -4,10 +4,10 @@ import store from '@/store'
// import {validatenull} from '@/util/validate'
import { getParamsByUrl, removeUrlParam } from '@/util/index'
import { getOauth, getUserByToken } from '@/api/auth/auth'
import baseUrl from '@/util/baseUrl'
import { Toast } from 'mint-ui'
// const baseUrl = 'http://www.icareyou.net' // 正式
const baseUrl = 'http://test.icareyou.net' // 开发
const defaultUrl = baseUrl.authUrl
router.beforeEach((to, from, next) => {
console.log('缓冲设置')
console.log('code ===' + store.getters.code)
......@@ -39,10 +39,13 @@ let getWXOauth = () => {
authId = '&auth_id=' + getParamsByUrl(window.location.href).auth_id
store.dispatch('setAuthId', getParamsByUrl(window.location.href).auth_id)
}
window.location.href = baseUrl + '/wxoauth/route?redirect_uri=' + encodeURIComponent(url) + authId + '&scoe=&auth_scene=voucher'
window.location.href = defaultUrl + '/wxoauth/route?redirect_uri=' + encodeURIComponent(url) + authId + '&scoe=&auth_scene=voucher'
}
let getOauthFn = (callback) => {
if (getParamsByUrl(window.location.href).auth_id) {
store.dispatch('setAuthId', getParamsByUrl(window.location.href).auth_id)
}
let spoauthParams = {
code: store.getters.code
}
......@@ -80,6 +83,10 @@ const getUserByTokenFn = (token, code, callback) => {
getUserByToken(spoauthParams).then(function (res) {
let accessToken = ''
let userId = ''
let accountId = res.accountid
if (accountId && accountId !== '') {
store.dispatch('setAccountId', accountId)
}
if (res.ext && res.ext !== '') {
let extOBJ = JSON.parse(res.ext)
accessToken = extOBJ.access_token
......
......@@ -7,19 +7,24 @@ export default new Router({
routes: [
{
path: '/',
name: 'Home',
name: '起始页',
redirect: '/home'
},
{
path: '/home',
name: '首页',
component: () => import('@/views/home/index'),
meta: {keepAlive: false, title: '凯歌电子券'}
meta: {keepAlive: false, title: '凯歌健康券'}
},
{
path: '/signing',
name: 'signing',
name: '生育全程签约',
component: () => import('@/views/signing/index'),
meta: {keepAlive: false, title: '生育全程签约'}
},
{
path: '/vouchers',
name: 'vouchers',
name: '我的健康券',
component: () => import('@/views/vouchers/index'),
meta: {keepAlive: false, title: '我的健康券'}
},
......
import axios from 'axios'
import store from '../store'
import { Toast } from 'mint-ui'
import router from '@/router/index'
// import router from '@/router/index'
import { removeUrlParam } from '@/util/index'
axios.defaults.timeout = 30000
......@@ -31,7 +31,7 @@ axios.interceptors.request.use(config => {
// respone拦截器
axios.interceptors.response.use(response => {
const res = response.data ? response.data : response
const res = response.data && response.data.code === 0 ? response.data : response
const status = Number(response.status) || 200
console.log('response status:' + status)
if (status !== 200) {
......@@ -49,9 +49,17 @@ axios.interceptors.response.use(response => {
}, 4 * 1000)
} else if (status === 403) {
if (res.msg === '请先进行实名认证') { // 跳转至社区推荐页
router.push({
path: '/recommend'
Toast({
message: '您还未实名认证,进入实名认证页面中...',
position: 'center',
duration: 5 * 1000
})
setTimeout(() => {
// router.push({
// path: '/recommend'
// })
window.location.href = 'http://' + location.host + '/#/recommend/list'
}, 4 * 1000)
}
} else {
return Promise.reject(new Error(res.msg))
......
import axios from 'axios'
import { getStore, setStore } from '@/util/store'
import store from '../store'
import { Toast } from 'mint-ui'
import baseUrl from '@/util/baseUrl'
// import router from '@/router/index'
import { removeUrlParam } from '@/util/index'
axios.defaults.timeout = 30000
console.log('NODE_ENV' + process.env.NODE_ENV)
if (process.env.NODE_ENV === 'production') {
axios.defaults.baseURL = baseUrl.sjkgUrl
}
// 返回其他状态吗
axios.defaults.validateStatus = function (status) {
return status // 默认的
......@@ -11,9 +18,9 @@ axios.defaults.validateStatus = function (status) {
axios.defaults.withCredentials = true
// request拦截器
axios.interceptors.request.use(config => {
let token = getStore({name: 'access_token'})
let token = store.getters.access_token
if (token) {
config.headers['Authorization'] = 'Bearer ' + token
// config.headers['Authorization'] = 'Bearer ' + token
}
return config
}, error => {
......@@ -24,36 +31,49 @@ axios.interceptors.request.use(config => {
// respone拦截器
axios.interceptors.response.use(response => {
const res = response.data ? response.data : response
const res = response.data && response.data.code === 200 ? response.data : response
const status = Number(response.status) || 200
console.log('response status:' + status)
if (status !== 200) {
// Toast({
// message: res.msg,
// position: 'center',
// duration: 5 * 1000
// })
if (status === 401) {
Toast({
message: '您因长时间逗留,验证已过期,正在刷新!',
position: 'center',
duration: 5 * 1000
})
setStore({ name: 'access_token', content: '' })
return
store.dispatch('setToken', '')
store.dispatch('setUserId', '')
store.dispatch('setCode', '')
setTimeout(function () {
window.location.href = removeUrlParam('code')
}, 4 * 1000)
} else if (status === 403) {
if (res.msg === '请先进行实名认证') { // 跳转至社区推荐页
Toast({
message: '您还未实名认证,进入实名认证页面中...',
position: 'center',
duration: 5 * 1000
})
setTimeout(() => {
// router.push({
// path: '/recommend'
// })
window.location.href = 'http://' + location.host + '/#/recommend/list'
}, 4 * 1000)
}
} else {
return Promise.reject(new Error(res.msg))
}
} else if (res.code === 1) {
if (!res.msg) {
res.msg = '内部服务器错误[500]'
}
return Promise.reject(new Error(res.msg))
}
return res
}, error => {
console.log('错误' + error)// for debug
Toast({
message: error.message,
position: 'center',
duration: 5 * 1000
})
return Promise.reject(new Error(error))
})
......
import axios from 'axios'
import { Toast } from 'mint-ui'
import baseUrl from '@/util/baseUrl'
// const defaultUrl = 'http://www.icareyou.net/' // 正式
const defaultUrl = 'http://test.icareyou.net/' // 开发
const defaultUrl = baseUrl.authUrl
// 创建axios实例
const service = axios.create({
......
......@@ -3,6 +3,7 @@ const getters = {
user_id: state => state.user.user_id,
userInfo: state => state.user.userInfo,
code: state => state.user.code,
authId: state => state.user.authId
authId: state => state.user.authId,
accountId: state => state.user.accountId
}
export default getters
/**
* 鉴权地址
*/
const authUrl = 'http://test.icareyou.net' // 开发
// const authUrl = 'http://www.icareyou.net' // 正式
/**
* 项目接口请求地址
*/
const baseUrl = '"http://voucher.check.icaremgt.com"' // 开发
// const baseUrl = '"http://voucher.icaremgt.com"' // 正式
/**
* 机构控件项目接口请求地址
*/
// const sjkgUrl = 'https://api-wx-service.check.icaremgt.com' // 开发
// const sjkgUrl = 'https://sjkg-wx-service.icaremgt.com' // 正式
const sjkgUrl = 'http://192.168.1.234:9005'
const defaultUrl = {
authUrl: authUrl,
baseUrl: baseUrl,
sjkgUrl: sjkgUrl
}
export default defaultUrl
......@@ -27,6 +27,7 @@ import CardItem from '@/components/cardItem'
import ListItem from '@/components/listItem'
import { getUserCard, getunUsedCountById } from '@/api/apply/apply'
import { getUserInfoByUserId } from '@/api/basic/basic'
// import { wxpermission } from '@/wxpermission'
import _itemPoster from '../../assets/images/doctor.jpg'
export default {
......@@ -47,6 +48,16 @@ export default {
}
},
created () {
// let that = this
// wxpermission(() => {
// // setTimeout(() => {
// // that.$router.push({
// // path: '/recommend'
// // })
// // }, 2000)
// // window.location.href = 'http://' + location.host + '/#/recommend/list'
// }, false)
this.getUserCardByIdFn() // 获取当前用户待使用健康券(前3条)
this.getUserInfoByUserIdFn() // 获取当前用户基本信息
this.getunUsedCountByIdFn() // 获取当前用户待使用健康券数量
......
......@@ -191,7 +191,7 @@ export default {
let that = this
setTimeout(function () {
that.$router.push({
path: '/'
path: '/home'
})
}, 2500)
} else {
......
......@@ -267,7 +267,7 @@ export default {
let that = this
setTimeout(function () {
that.$router.push({
path: '/'
path: '/home'
})
}, 2500)
} else {
......
......@@ -371,7 +371,7 @@ export default {
let that = this
setTimeout(function () {
that.$router.push({
path: '/'
path: '/home'
})
}, 2500)
} else {
......
......@@ -180,16 +180,17 @@ export default {
})
})
},
fail: function () {
fail: function (res) {
that.$Indicator.close()
that.$toast({
message: '位置获取失败,请打开定位后再重新尝试!',
// message: JSON.stringify(res),
position: 'center',
duration: 3000
})
}
})
})
}, false)
},
loadMore () {
if (!this.queryAccountId) {
......@@ -273,7 +274,7 @@ export default {
},
goToHome () {
this.$router.push({
path: '/'
path: '/home'
})
},
handleRegister (type) { // 进入成员注册领券页 type=1本人 type=2配偶
......
......@@ -265,4 +265,11 @@ export default {
.line-list > .item > .status > img {
width: 100%;
}
.line-list .card-item > .card-item-content > .card-item-table > .price .label {
font-size: 2em;
}
.line-list .card-item > .card-item-content > .card-item-table > .info .title {
margin-bottom: 5px;
}
</style>
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 to comment