Browse Source

关注公众号功能,接口联调

feature
mk 1 year ago
parent
commit
93d6a8fa2e
  1. 2
      README.md
  2. 10
      src/api/house.js
  3. 8
      src/router/index.js
  4. 2
      src/router/router.config.js
  5. 11
      src/store/modules/app.js
  6. 11
      src/views/houseQR/index.less
  7. 48
      src/views/houseQR/index.vue

2
README.md

@ -6,7 +6,7 @@
然后跑起来之后你本地的域名就会变成epmet-cloud.elinkservice.cn 然后跑起来之后你本地的域名就会变成epmet-cloud.elinkservice.cn
↓↓↓↓ ↓↓↓↓
在你小程序的公众号开发中输入以下网址就能够访问了 在你小程序的公众号开发中输入以下网址就能够访问了
http://epmet-cloud.elinkservice.cn:80/?appId=wx1078fa1e99424de9&redirect=epmet-cloud.elinkservice.cn http://epmet-cloud.elinkservice.cn:80/?appId=wx1078fa1e99424de9&redirect=epmet-cloud.elinkservice.cn&houseId=123
### Node 版本要求 ### Node 版本要求

10
src/api/house.js

@ -0,0 +1,10 @@
// axios
import request from '@/utils/request'
//扫描二维码获取房屋信息
export function getHouseInfoQR(id) {
return request({
url: `/actual/base/communityHouse/houseQrCode/info/${id}`,
method: 'get',
})
}

8
src/router/index.js

@ -5,7 +5,7 @@ import { constantRouterMap } from './router.config.js'
import { checkWxmpRegister, login } from '@/api/user' import { checkWxmpRegister, login } from '@/api/user'
import { title } from '@/config' import { title } from '@/config'
const whiteList = ['/login', '/register', '/errorPage','/selectAgency'] const whiteList = ['/login', '/register', '/errorPage','/selectAgency','/houseQR']
const originalPush = Router.prototype.push const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) { Router.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject) if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
@ -51,6 +51,12 @@ function paramsFormat(params) {
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
let urlParams = getQueryParams() let urlParams = getQueryParams()
if(urlParams.houseId){
console.log(urlParams);
store.commit('SET_HOUSE_ID', urlParams.houseId)
}else{
store.commit('SET_HOUSE_ID', null)
}
if (urlParams.appId) { if (urlParams.appId) {
if (localStorage.getItem('appId') && urlParams.appId !== localStorage.getItem('appId')) { if (localStorage.getItem('appId') && urlParams.appId !== localStorage.getItem('appId')) {
localStorage.removeItem('token') localStorage.removeItem('token')

2
src/router/router.config.js

@ -6,7 +6,7 @@ export const constantRouterMap = [
{ {
path: '/', path: '/',
name: 'home', name: 'home',
component: () => import('@/views/houseQR'), component: () => import('@/views/home'),
meta: { title: '首页', keepAlive: false } meta: { title: '首页', keepAlive: false }
}, },
{ {

11
src/store/modules/app.js

@ -4,7 +4,8 @@ const state = {
userInfo: {}, userInfo: {},
appId: '', appId: '',
realNameFlag:null, realNameFlag:null,
agencyId:null agencyId:null,
houseId:null
} }
const mutations = { const mutations = {
SET_USER_INFO(state, userInfo) { SET_USER_INFO(state, userInfo) {
@ -12,9 +13,13 @@ const mutations = {
state.agencyId = userInfo.agencyId; state.agencyId = userInfo.agencyId;
state.realNameFlag = userInfo.realName; state.realNameFlag = userInfo.realName;
}, },
SET_APP_ID(state, appId) { SET_APP_ID(state, appId){
state.appId = appId state.appId = appId
} },
SET_HOUSE_ID(state, houseId){
console.log(houseId,'houseIdVueX');
state.houseId = houseId;
},
} }
const actions = { const actions = {
// 设置是否注册 // 设置是否注册

11
src/views/houseQR/index.less

@ -78,4 +78,15 @@ a{
padding-top: 8px; padding-top: 8px;
box-sizing: border-box; box-sizing: border-box;
font-family: pingfang-bold; font-family: pingfang-bold;
}
.footer{
color: #ffffff;
background-color: rgba(51,51,51,0.9) ;
border-radius: 7px;
height: 38px;
padding: 7px 16px;
position: relative;
bottom: 20px;
box-sizing: border-box;
z-index: 10;
} }

48
src/views/houseQR/index.vue

@ -1,15 +1,14 @@
<template> <template>
<div class=""> <div >
<div class="header"> <div class="header">
<div class="mask"></div> <div class="mask"></div>
</div> </div>
<section> <section class="">
<div class="flex flex-y m-bot10"> <div class="flex flex-y m-bot10">
<div class="house_base flex"> <div class="house_base flex">
<img src="@/assets/images/houseQR/house.png" alt=""> <img src="@/assets/images/houseQR/house.png" alt="">
<div class="flex flex-y flex-center1 flex1"> <div class="flex flex-y flex-center1 flex1">
<div class="van-multi-ellipsis--l2">青岛市市北区重青岛市市北区重庆南路青岛市市北区重庆南路庆南路青岛市市北区重庆南路</div> <div class="van-multi-ellipsis--l3">{{ formData.houseAddress }}</div>
<div>120号205户</div>
</div> </div>
</div> </div>
<div class="card flex flex-y basi_content content"> <div class="card flex flex-y basi_content content">
@ -18,14 +17,14 @@
<img src="@/assets/images/icons/community.png" class="img_16 m-right10" alt=""> <img src="@/assets/images/icons/community.png" class="img_16 m-right10" alt="">
<span class="gray">所属社区</span> <span class="gray">所属社区</span>
</div> </div>
<div class="value flex1">市北区</div> <div class="value flex1">{{ formData.communityName || '--' }}</div>
</div> </div>
<div class="flex flex-center m-top15"> <div class="flex flex-center m-top15">
<div class="label"> <div class="label">
<img src="@/assets/images/icons/grid.png" class="img_16 m-right10" alt=""> <img src="@/assets/images/icons/grid.png" class="img_16 m-right10" alt="">
<span class="gray">所属网格</span> <span class="gray">所属网格</span>
</div> </div>
<span class="value flex1">第一网格</span> <span class="value flex1">{{ formData.gridName || '--' }}</span>
</div> </div>
<div class="flex flex-center2 flex-end m-top15"> <div class="flex flex-center2 flex-end m-top15">
<div class="flex"> <div class="flex">
@ -33,9 +32,9 @@
<img src="@/assets/images/icons/grid.png" class="img_16 m-right10" alt=""> <img src="@/assets/images/icons/grid.png" class="img_16 m-right10" alt="">
<span class="gray">社区电话</span> <span class="gray">社区电话</span>
</div> </div>
<div class="value ">0532-66778080</div> <div class="value ">{{ formData.communityTel || '--' }}</div>
</div> </div>
<a :href='`tel:0532-66778080`'>拨打</a> <a :href='`tel:0532-66778080`' v-show="formData.communityTel">拨打</a>
</div> </div>
</div> </div>
</div> </div>
@ -46,7 +45,7 @@
<div class="my_community flex flex-wrap"> <div class="my_community flex flex-wrap">
<div style="width: 25%;" class="flex flex-y flex-center1 flex-center2" <div style="width: 25%;" class="flex flex-y flex-center1 flex-center2"
v-for="(item, index) in myCommunity" :key="index"> v-for="(item, index) in myCommunity" :key="index">
<img :src="item.imgSrc" class="img_33 m-top16" alt=""> <img :src="item.imgSrc" class="img_33 m-top16" alt="" @click="handelCLickJump">
<span class="font-size14 m-top10">{{ item.title }}</span> <span class="font-size14 m-top10">{{ item.title }}</span>
</div> </div>
</div> </div>
@ -55,22 +54,28 @@
<div class="title"><span>服务矩阵</span></div> <div class="title"><span>服务矩阵</span></div>
<div class="my_community flex flex-wrap"> <div class="my_community flex flex-wrap">
<div style="width: 25%;" class="flex flex-y flex-center1 flex-center2" <div style="width: 25%;" class="flex flex-y flex-center1 flex-center2"
v-for="(item, index) in serverList" :key="index"> v-for="(item, index) in serverList" :key="index" @click="handelCLickJump">
<img :src="item.imgSrc" class="img_33 m-top16" alt=""> <img :src="item.imgSrc" class="img_33 m-top16" alt="">
<span class="font-size14 m-top10">{{ item.title }}</span> <span class="font-size14 m-top10">{{ item.title }}</span>
</div> </div>
</div> </div>
</div> </div>
</section> </section>
<div class="footer content flex flex-center2 flex-end">
<span>关注公众号了解更多...</span>
<van-button round color="#ffa800" size="small">关注</van-button>
</div>
</div> </div>
</template> </template>
<script> <script>
import { getHouseInfoQR } from '@/api/house'
import { Notify } from 'vant';
export default { export default {
name: 'houseQR', name: 'houseQR',
data() { data() {
return { return {
houesId: this.$route.query.houseId, houesId: null,
myCommunity: [ myCommunity: [
{ {
imgSrc: require('@/assets/images/houseQR/1.png'), imgSrc: require('@/assets/images/houseQR/1.png'),
@ -113,15 +118,28 @@ export default {
imgSrc: require('@/assets/images/houseQR/bot_4.png'), imgSrc: require('@/assets/images/houseQR/bot_4.png'),
title: '电子社保' title: '电子社保'
}, },
] ],
formData: null
} }
}, },
created() { created() {
console.log(this.$route, '房屋Id'); console.log(this.$store.state.app.houseId, '路由中');
this.houesId = this.$store.state.app.houseId;
this.getHouseInfo();
}, },
mounted() { mounted() { },
methods: {
getHouseInfo() {
console.log(this.houesId);
getHouseInfoQR(this.houesId).then(res => {
this.formData = res
})
},
handelCLickJump(){
Notify({ type: 'primary', message: '功能持续开放中,敬请期待!' });
}
} }
} }
</script> </script>

Loading…
Cancel
Save