diff --git a/README.md b/README.md
index a1c2f53..7743ddb 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
然后跑起来之后你本地的域名就会变成epmet-cloud.elinkservice.cn
↓↓↓↓
在你小程序的公众号开发中输入以下网址就能够访问了
-http://epmet-cloud.elinkservice.cn:80/?appId=wx1078fa1e99424de9&redirect=epmet-cloud.elinkservice.cn&houseId=1640692803448688642
+http://epmet-test.elinkservice.cn:80/?appId=wx1078fa1e99424de9&redirect=epmet-test.elinkservice.cn&houseId=1640692803448688642
### Node 版本要求
diff --git a/src/assets/images/home/qrcode.jpg b/src/assets/images/home/qrcode.jpg
new file mode 100644
index 0000000..3142fcb
Binary files /dev/null and b/src/assets/images/home/qrcode.jpg differ
diff --git a/src/router/index.js b/src/router/index.js
index bb5c9c0..a7a9905 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -5,7 +5,7 @@ import { constantRouterMap } from './router.config.js'
import { checkWxmpRegister, login } from '@/api/user'
import { title } from '@/config'
-const whiteList = ['/login', '/register', '/errorPage','/selectAgency','/houseQR','/event']
+const whiteList = ['/login', '/register', '/errorPage','/selectAgency','/houseQR','/event','/scanQrCode']
const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
@@ -57,83 +57,84 @@ router.beforeEach((to, from, next) => {
}else{
store.commit('SET_HOUSE_ID', null)
}
- if(urlParams.type && !localStorage.getItem('token') ){
- location.href = 'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzkxNzQ5MzUzNg==&scene=110#wechat_redirect'
- return
- }
- if (urlParams.appId) {
- if (localStorage.getItem('appId') && urlParams.appId !== localStorage.getItem('appId')) {
- localStorage.removeItem('token')
- location.reload()
- }
- store.commit('SET_APP_ID', urlParams.appId)
- localStorage.setItem('appId', urlParams.appId)
- } else {
- store.commit('SET_APP_ID', localStorage.getItem('appId'))
- }
- if (!localStorage.getItem('appId') && to.path !== '/errorPage'&& to.path != '/houseQR') {
- if(to.path === '/errorPage'){
- next('/errorPage')
- }else{
- next('/')
- }
- } else {
- if (to.params.type) {
- document.title = to.params.type === 'edit' ? '编辑' : '注册'
+ if(urlParams.type && !localStorage.getItem('token')&&to.path !=='/scanQrCode' ){
+ next('/scanQrCode')
+ }else{
+ if (urlParams.appId) {
+ if (localStorage.getItem('appId') && urlParams.appId !== localStorage.getItem('appId')) {
+ localStorage.removeItem('token')
+ location.reload()
+ }
+ store.commit('SET_APP_ID', urlParams.appId)
+ localStorage.setItem('appId', urlParams.appId)
} else {
- document.title = to.meta.title ? to.meta.title : title
+ store.commit('SET_APP_ID', localStorage.getItem('appId'))
}
- if (localStorage.getItem('token') && to.path != '/houseQR') {
- store.dispatch('getUserInfo').then((res) => {
- if (res.agencyId) {
- next()
- } else {
- if (to.path === '/selectAgency') {
+ if (!localStorage.getItem('appId') && to.path !== '/errorPage'&& to.path != '/houseQR' && to.path != '/scanQrCode') {
+ if(to.path === '/errorPage'){
+ next('/errorPage')
+ }else{
+ next('/')
+ }
+ } else {
+ if (to.params.type) {
+ document.title = to.params.type === 'edit' ? '编辑' : '注册'
+ } else {
+ document.title = to.meta.title ? to.meta.title : title
+ }
+ if (localStorage.getItem('token') && to.path != '/houseQR') {
+ store.dispatch('getUserInfo').then((res) => {
+ if (res.agencyId) {
next()
} else {
- next({ path: '/selectAgency' })
+ if (to.path === '/selectAgency') {
+ next()
+ } else {
+ next({ path: '/selectAgency' })
+ }
}
- }
- }).catch(err=>{
- localStorage.removeItem('token')
- next({ path: '/login'})
- })
- } else {
- if (getQueryStringByName('code') && to.path != '/houseQR') {
- login({ wxCode: getQueryStringByName('code'),appId:'wx1078fa1e99424de9'}).then(res => {
- localStorage.setItem('token', res.data.token)
- localStorage.setItem('userId', res.data.userH5DTO.id)
- let state = decodeURIComponent(getQueryStringByName('state'))
- state = state.replace(/[\\\b\f\n\r\t]/g, '')
- state = state.replace(/(\s*?{\s*?|\s*?,\s*?)(['"])?([a-zA-Z0-9]+)(['"])?:/g, '$1"$3":')
- state = state
- .replace(/":/g, '":"')
- .replace(/,"/g, '","')
- .replace(/},/g, '"},')
- .replace(/}]/g, '"}]')
- .replace(/}}/g, '"}}')
- .replace(/"{/g, '{')
- .replace(/:{"}/g, ':{}')
- state = JSON.stringify({ path: '/', query: {} });
- let path = `${location.origin}${location.pathname === '/' ? '' : location.pathname}`
- if (state && state != 'undefined') {
- state = JSON.parse(state)
- console.log(state, 'state')
- console.log(`${path}/#${state.path}?${paramsFormat(state.query)}`, 'sss')
- location.href = `${path}/#${state.path}?${paramsFormat(state.query)}`
- } else {
- location.href = path
- }
+ }).catch(err=>{
+ localStorage.removeItem('token')
+ next({ path: '/login'})
})
- } else {
- if (whiteList.includes(to.path)) {
- next()
+ } else {
+ if (getQueryStringByName('code') && to.path != '/houseQR' && to.path != '/scanQrCode') {
+ login({ wxCode: getQueryStringByName('code'),appId:'wx1078fa1e99424de9'}).then(res => {
+ localStorage.setItem('token', res.data.token)
+ localStorage.setItem('userId', res.data.userH5DTO.id)
+ let state = decodeURIComponent(getQueryStringByName('state'))
+ state = state.replace(/[\\\b\f\n\r\t]/g, '')
+ state = state.replace(/(\s*?{\s*?|\s*?,\s*?)(['"])?([a-zA-Z0-9]+)(['"])?:/g, '$1"$3":')
+ state = state
+ .replace(/":/g, '":"')
+ .replace(/,"/g, '","')
+ .replace(/},/g, '"},')
+ .replace(/}]/g, '"}]')
+ .replace(/}}/g, '"}}')
+ .replace(/"{/g, '{')
+ .replace(/:{"}/g, ':{}')
+ state = JSON.stringify({ path: '/', query: {} });
+ let path = `${location.origin}${location.pathname === '/' ? '' : location.pathname}`
+ if (state && state != 'undefined') {
+ state = JSON.parse(state)
+ console.log(state, 'state')
+ console.log(`${path}/#${state.path}?${paramsFormat(state.query)}`, 'sss')
+ location.href = `${path}/#${state.path}?${paramsFormat(state.query)}`
+ } else {
+ location.href = path
+ }
+ })
} else {
- next({ path: '/login', query: { redirect: to.path, params: JSON.stringify(to.query) } })
+ if (whiteList.includes(to.path)) {
+ next()
+ } else {
+ next({ path: '/login', query: { redirect: to.path, params: JSON.stringify(to.query) } })
+ }
}
}
}
- }
+ }
+
})
function getQueryParams() {
diff --git a/src/router/router.config.js b/src/router/router.config.js
index 22a9f03..a0b63e8 100644
--- a/src/router/router.config.js
+++ b/src/router/router.config.js
@@ -219,6 +219,11 @@ export const constantRouterMap = [
name: 'topicListDetail',
component: () => import('@/views/peoSuggestion/topicListDetail.vue'),
meta: { title: '专题详情', keepAlive: false }
+ },{
+ path: '/scanQrCode',
+ name: 'scanQrCode',
+ component: () => import('@/views/scanQrCode/index.vue'),
+ meta: { title: '我的社区', keepAlive: false }
},
]
diff --git a/src/views/scanQrCode/index.vue b/src/views/scanQrCode/index.vue
new file mode 100644
index 0000000..c1b85e6
--- /dev/null
+++ b/src/views/scanQrCode/index.vue
@@ -0,0 +1,26 @@
+
+
+

+
长按识别二维码跳转公众号...
+
+
+
+
+
+