Commit 9bce7d2c by 潘琦

1、解决微信分享出去链接被篡改问题;2、添加家庭成员,子女出生年月日;

parent 007b4941
...@@ -3,9 +3,8 @@ ...@@ -3,9 +3,8 @@
// see http://vuejs-templates.github.io/webpack for documentation. // see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path') const path = require('path')
// const url = 'http://voucher.check.icaremgt.com' // 开发 const url = 'http://voucher.check.icaremgt.com' // 开发
// const url = 'http://voucher.icaremgt.com' // 正式 // const url = 'http://voucher.icaremgt.com' // 正式
const url = 'http://192.168.1.151:9999'
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' // 机构空间(正式) // const sjkgurl = 'https://sjkg-wx-service.icaremgt.com' // 机构空间(正式)
......
...@@ -6,27 +6,33 @@ import { getParamsByUrl, removeUrlParam } from '@/util/index' ...@@ -6,27 +6,33 @@ import { getParamsByUrl, removeUrlParam } from '@/util/index'
import { getOauth, getUserByToken } from '@/api/auth/auth' import { getOauth, getUserByToken } from '@/api/auth/auth'
import baseUrl from '@/util/baseUrl' import baseUrl from '@/util/baseUrl'
import { Toast } from 'mint-ui' import { Toast } from 'mint-ui'
import { wxpermission } from '@/wxpermission'
const defaultUrl = baseUrl.authUrl const defaultUrl = baseUrl.authUrl
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log('缓冲设置') console.log('缓冲设置')
console.log('code ===' + store.getters.code) console.log('code ===' + store.getters.code)
// store.dispatch('setToken', '')
// store.dispatch('setUserId', '') // 判断链接是否被微信分享篡改,false需重定向
// let accessToken = store.getters.access_token if (redirectUrl()) {
let storecode = store.getters.code wxpermission(0, () => {})
if (!storecode || storecode === '') { // store.dispatch('setToken', '')
let params = getParamsByUrl(window.location.href) // store.dispatch('setUserId', '')
if (params.code) { // let accessToken = store.getters.access_token
store.dispatch('setCode', params.code) let storecode = store.getters.code
getOauthFn(() => { if (!storecode || storecode === '') {
next() let params = getParamsByUrl(window.location.href)
}) if (params.code) {
store.dispatch('setCode', params.code)
getOauthFn(() => {
next()
})
} else {
getWXOauth()
}
} else { } else {
getWXOauth() next()
} }
} else {
next()
} }
// store.dispatch('setToken', '490cd9b7-dca7-4cc3-87e9-5eacbb5a5d77') // store.dispatch('setToken', '490cd9b7-dca7-4cc3-87e9-5eacbb5a5d77')
}) })
...@@ -132,6 +138,30 @@ const getUserByTokenFn = (token, code, callback) => { ...@@ -132,6 +138,30 @@ const getUserByTokenFn = (token, code, callback) => {
}) })
} }
// 判断链接是否被微信分享篡改
const redirectUrl = () => {
const curUrl = window.location.href
const curUrlArr = curUrl.split('?')
// Toast({
// message: curUrl,
// position: 'center',
// duration: 2 * 1000
// })
// console.log(curUrlArr[1].indexOf('from=singlemessage'))
if (curUrlArr.length === 3 && curUrlArr[1].indexOf('from=singlemessage') >= 0) {
let newUrl = curUrlArr[0] + '#' + curUrlArr[1].split('#')[1] + '?' + curUrlArr[2]
// Toast({
// message: curUrlArr[2],
// position: 'center',
// duration: 5 * 1000
// })
window.location.href = newUrl
return false
} else {
return true
}
}
// const nextToPath = (to, from, next) => { // const nextToPath = (to, from, next) => {
// let toquery = to.query // let toquery = to.query
// if (from.query.code) { // if (from.query.code) {
......
...@@ -217,10 +217,14 @@ export default { ...@@ -217,10 +217,14 @@ export default {
this.BaseValidate.birthKidState = true this.BaseValidate.birthKidState = true
const selectedDate = new Date(date) const selectedDate = new Date(date)
let month = selectedDate.getMonth() + 1 let month = selectedDate.getMonth() + 1
if (selectedDate.getMonth() + 1 <= 9) { if (month < 10) {
month = '0' + (selectedDate.getMonth() + 1) month = '0' + month
}
let day = selectedDate.getDate()
if (day < 10) {
day = '0' + day
} }
this.userData.birthKid = selectedDate.getFullYear() + '-' + month + '-' + selectedDate.getDate() this.userData.birthKid = selectedDate.getFullYear() + '-' + month + '-' + day
}, },
handelSave () { handelSave () {
console.log('submit') console.log('submit')
......
...@@ -249,10 +249,14 @@ export default { ...@@ -249,10 +249,14 @@ export default {
birthPickerConfirm (date) { // 出生日期控件“确认”事件 birthPickerConfirm (date) { // 出生日期控件“确认”事件
const selectedDate = new Date(date) const selectedDate = new Date(date)
let month = selectedDate.getMonth() + 1 let month = selectedDate.getMonth() + 1
if (selectedDate.getMonth() + 1 <= 9) { if (month < 10) {
month = '0' + (selectedDate.getMonth() + 1) month = '0' + month
}
let day = selectedDate.getDate()
if (day < 10) {
day = '0' + day
} }
this.userData.birth = selectedDate.getFullYear() + '-' + month + '-' + selectedDate.getDate() this.userData.birth = selectedDate.getFullYear() + '-' + month + '-' + day
console.log(date) console.log(date)
}, },
openPickerLastMensesTime () { openPickerLastMensesTime () {
......
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