index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936
  1. <template>
  2. <view class="content">
  3. <view class="">
  4. <loading isFullScreen color="#2f7ff5" :active="isloading" text="开门中..."></loading>
  5. <u-navbar :is-back="false" title=" ">
  6. <view class="slot-wrap">
  7. <view v-if="$isEmpty(plot)" class="padding-left-20" @click="$u.toast('暂无小区信息')">
  8. <u-icon name="map-fill" color="#2f7ff5" size="34"></u-icon>
  9. <text class="padding-left-sm " style="font-size: 34rpx;">暂无小区信息</text>
  10. </view>
  11. <picker v-else @change="typeChange" :value="plotIndex" :range="plotArray">
  12. <view class="padding-left-20 ">
  13. <u-icon name="map-fill" color="#2f7ff5" size="34"></u-icon>
  14. <text class="padding-left-sm " style="font-size: 34rpx;">{{plot}}</text>
  15. </view>
  16. </picker>
  17. </view>
  18. </u-navbar>
  19. <!-- 头图 -->
  20. <swiper class="screen-swiper square-dot " :indicator-dots="true" :circular="true"
  21. :autoplay="true" interval="5000" duration="500">
  22. <swiper-item v-for="(item,index) in adList" :key="index">
  23. <image v-if="item.videoType==0" :src="item.videoUri" mode="aspectFill" ></image>
  24. <video v-if="item.videoType==1" :src="item.videoUri" autoplay loop muted :show-play-btn="false" :controls="false" objectFit="cover"></video>
  25. </swiper-item>
  26. </swiper>
  27. <view class="">
  28. <view class="bg-white" style="height: 10rpx;"></view>
  29. <hotConsult @onTap="jump('../notice/notice')" @detailTap="goNoticeDetail" :swiperTexts="noticeList"></hotConsult>
  30. </view>
  31. <view style="background-color: #FFFFFF;">
  32. <view style="padding: 30rpx 30rpx 0 30rpx;">
  33. <text class="text-bold text-lg">智慧社区</text>
  34. </view>
  35. <view style="padding: 40rpx 10rpx 0rpx;" class="cu-list grid col-5 no-border" >
  36. <view class="cu-item" :class="item.index==5?'img1-lg':''" @click="top(item.index)" v-for="(item,index) in gridList" :key="index">
  37. <block v-if="item.index==5">
  38. <view class="grid-icon" >
  39. <image style="width: 88rpx;height: 88rpx;" :src="modalShow?'../../static/home/open4.png':'../../static/home/open4.png'"/>
  40. </view>
  41. <text style="color: #333333;font-size: 30rpx;font-weight: 800;" >{{item.title}}</text>
  42. </block>
  43. <block v-else>
  44. <view class="grid-icon" >
  45. <image style="width: 48rpx;height: 48rpx;" :src="item.icon"/>
  46. </view>
  47. <text style="color: #333333;font-size: 26rpx;" >{{item.title}}</text>
  48. </block>
  49. <view class="cu-tag bg-red badge" v-if="item.badge>0">{{item.badge}}</view>
  50. </view>
  51. </view>
  52. <!-- 设备列表 -->
  53. <view v-if="modalShow" class="flex justify-around margin-top-10" >
  54. <view @click="open(item.id)" v-for="(item,index) in device_list" :key="index" style="flex-direction: column;" class="flex justify-center align-center">
  55. <image style="width: 60rpx;height: 60rpx;" src="/static/kaimen.png"/>
  56. <view class="text-center padding-top-20 text-cut-1" style="font-size: 24rpx;">
  57. {{item.name}}
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="nav-list bg-white padding-top-20" >
  63. <view hover-class="none"
  64. @click="top(item.index)"
  65. class="nav-li light" navigateTo :style="{backgroundColor:item.color}"
  66. v-for="(item,index) in elements" :key="index">
  67. <view class="nav-title" style="color: #000000;font-size: 28rpx;">{{item.title}}</view>
  68. <view class="" style="padding-top: 10rpx;font-size: 24rpx;color: #acacac;">{{item.name}}</view>
  69. <image :src="item.icon" mode=""></image>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="bg-white">
  74. <image src="http://139.9.103.171:1888/miniofile/cyzhyc/d31d50fd-eb42-4131-9eb0-baf8eebc5357-banner.png" style="width: 100%;" mode="widthFix"></image>
  75. </view>
  76. <view v-if="!this.$isEmpty(goodsList)">
  77. <view class="tj-title">
  78. <view class="">
  79. <text class="text-lg text-bold">为您推荐</text>
  80. <text class="sub-title">有料</text>
  81. <text class="sub-title">好物</text>
  82. <text class="sub-title">有优惠</text>
  83. </view>
  84. <view class="sub-title" style="color: #969696;padding-top: 8rpx;font-size: 24rpx;" @click="jump('/pages/life/life','type')">
  85. <text >查看更多></text>
  86. </view>
  87. </view>
  88. <view>
  89. <goods :goodsList="goodsList"></goods>
  90. </view>
  91. </view>
  92. <view style="height: 80rpx;">
  93. <u-divider bgColor="#f1f1f1;" height="80">到底了</u-divider>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. import loading from "@/comps/loading/loading.vue"
  99. import hotConsult from "@/comps/hot-consult/hot-consult.vue"
  100. import goods from "@/comps/goods/goods.vue"
  101. var app = getApp();
  102. let that;
  103. export default {
  104. components:{
  105. goods,hotConsult,loading
  106. },
  107. data() {
  108. return {
  109. isloading:false,
  110. //开门设备列表
  111. device_list: [],
  112. background: {
  113. backgroundColor: '#e54d42',
  114. },
  115. noticeList:[],
  116. modalShow:false,
  117. userInfo:{},
  118. jsCode:'',
  119. openid:'',
  120. sessionKey:'',
  121. isFirst:false,
  122. goodsList:[],
  123. isIPX:false,
  124. //广告轮播图
  125. swiperIndex: 0,
  126. plot: null,
  127. plotArray: [],
  128. //小区名字
  129. plotIndex: 0,
  130. residentialIdList: [] ,//小区id
  131. adList: [
  132. {
  133. 'videoType': 0,
  134. 'videoUri': "http://139.9.103.171:1888/miniofile/app/banner.jpg"
  135. },
  136. ],
  137. elements: [{
  138. title: '防疫登记',
  139. name: '在线防疫登记',
  140. color: '#e3f5ff',
  141. icon: '../../static/home/fanyi1.png',
  142. index:6
  143. },
  144. {
  145. title: '健康码',
  146. name: '通行防疫码',
  147. color: '#e5eef9',
  148. icon: '../../static/home/health.png',
  149. index:9
  150. },
  151. {
  152. title: '物业报修',
  153. name: '在线物业报修',
  154. color: '#ffefef',
  155. icon: '../../static/home/baoxiu1.png',
  156. index:8
  157. },
  158. {
  159. title: '物业缴费',
  160. name: '在线物业缴费',
  161. color: '#e9f9f3',
  162. icon: '../../static/home/jiaofei.png',
  163. index:7
  164. },
  165. // {
  166. // title: '更多服务',
  167. // name: '更多智慧服务',
  168. // color: '#eeeeee',
  169. // icon: '../../static/home/more.png',
  170. // index:99
  171. // }
  172. ],
  173. gridList:[
  174. {
  175. icon:'../../static/home/fangwu.png',
  176. title:"我的房屋",
  177. badge:0,
  178. index:1
  179. },
  180. {
  181. icon:'../../static/home/renyuan.png',
  182. title:"家庭成员",
  183. badge:0,
  184. index:2
  185. },
  186. {
  187. icon:'../../static/home/open4.png',
  188. title:"开门",
  189. badge:0,
  190. index:5
  191. },
  192. {
  193. icon:'../../static/home/cheliang.png',
  194. title:"我的车辆",
  195. badge:0,
  196. index:3
  197. },
  198. {
  199. icon:'../../static/home/fangke1.png',
  200. title:"访客授权",
  201. badge:this.vuex_auth_audit_count,
  202. index:4
  203. },
  204. ]
  205. }
  206. },
  207. onShow() {
  208. // this.fetchNoticeList()
  209. //获取访客授权待审核的数量
  210. if (this.canReset) this.fetchAuthRecordNum()
  211. this.canReset=true
  212. //获取设备列表
  213. this.getAuthDevice()
  214. //处理进入小程序的不同场景
  215. this.execParam();
  216. this.loadData()
  217. //每次打开此页面都把商品数组打乱
  218. this.$u.randomArray(this.goodsList)
  219. if(this.isFirst){
  220. this.isFirst=false
  221. }else{
  222. this.getRoomByMemberId()
  223. }
  224. },
  225. onLoad(options) {
  226. that=this
  227. //处理进入小程序的场景
  228. that.handelShare(options)
  229. this.isFirst=true
  230. //拉取后台用户信息
  231. this.getOpenId();
  232. this.isIPX=uni.getStorageSync('isIPX')
  233. //获取轮播列表
  234. this.getAdList();
  235. //获取推荐商品列表
  236. this.fetchGoodsList()
  237. },
  238. methods: {
  239. fetchAuthRecordNum(){
  240. try{
  241. let memberId=app.globalData.member.id
  242. if (!this.$isEmpty(memberId)) {
  243. let params={
  244. member_id:memberId,
  245. size:99,
  246. auditStatus:0
  247. }
  248. this.$http.getGuestRecordsByMemberId(params).then(res =>{
  249. let length=res.data.list.length
  250. that.$u.vuex('vuex_auth_audit_count',length)
  251. that.gridList.forEach(item=>{
  252. if (item.index==4) {
  253. item.badge=length
  254. }
  255. })
  256. })
  257. }
  258. }catch(e){
  259. }
  260. },
  261. open(id){
  262. //直接开门
  263. that.openDoor(id)
  264. //进度条加载模式开门
  265. // this.isloading=true
  266. // let that=this
  267. // setTimeout(()=>{
  268. // that.openDoor(id)
  269. // },500)
  270. },
  271. //立即开门
  272. openDoor: function (id) {
  273. let device_id=id
  274. let that = this;
  275. let params = {};
  276. params['member_id'] = app.globalData.member.id;
  277. params['device_id'] = device_id;
  278. // let operation = 'member/openDoor';
  279. that.$http.openDoor(params).then(res =>{
  280. that.isloading=false
  281. app.globalData.oneFailHint(res.data.result_msg,function(){
  282. });
  283. });
  284. },
  285. getAuthDevice: function () {
  286. let that = this;
  287. let params = {};
  288. params['member_id'] = app.globalData.member.id;
  289. params['residential_id'] = uni.getStorageSync("residentialId");
  290. // let operation = 'member/getAuthDeviceByMemberId';
  291. that.$http.getAuthDeviceByMemberId(params).then (res =>{
  292. console.info("设备列表:" ,res.data); //获取成功
  293. if (res.data.result_code == 1) {
  294. let list = [];
  295. if (uni.getStorageSync('plotName')) {
  296. res.data.list.map(item => {
  297. if (item.residentialId.indexOf(uni.getStorageSync('residentialId'))>=0) {
  298. list.push(item);
  299. }
  300. });
  301. } else {
  302. console.log(res.data.list)
  303. list = res.data.list;
  304. }
  305. console.log(list)
  306. that.setData({
  307. device_list: list
  308. });
  309. app.globalData.device_list = list;
  310. }
  311. });
  312. },
  313. async loadData(options){
  314. //进入小程序时进行游客登陆,
  315. //以免直接进入商品详情时会提示用户未授权
  316. await this.$nextTick(function(){
  317. this.touristLogin()
  318. })
  319. },
  320. getParam(e){
  321. // 用来保存所有的属性名称和值
  322. let param = "";
  323. // 开始遍历
  324. for(let p in e){
  325. // 方法
  326. if(typeof(e[p])!="function" && p != 'type'){
  327. // p 为属性名称,e[p]为对应属性的值
  328. param += (param.length > 1 ? '&' : '') + p + "=" + e[p];
  329. }
  330. }
  331. // 最后显示所有的属性
  332. return param;
  333. },
  334. execParam(){
  335. let _this = this;
  336. if(this.e != null){
  337. setTimeout(function(){
  338. if(_this.e == null) return;
  339. if(_this.e.type == "share"){
  340. let path = _this.e.path == null || _this.e.path.length <= 0 ? 'pagesM/pages/goods_des' : '/' + _this.e.path;
  341. let param = _this.getParam(_this.e);
  342. let url = `${path}?${param}`;
  343. console.error("url = " + url);
  344. _this.e = null;
  345. uni.navigateTo({url: url});
  346. }
  347. }, 1000);
  348. }
  349. },
  350. handelShare(options){
  351. //二维码扫描链接 start
  352. if (!this.$isEmpty(options.scene)) {
  353. let scene=decodeURIComponent(options.scene).split(",")
  354. //从小程序二维码进入
  355. console.log(scene+">>>>>>>>>>>>>>>");
  356. let path="/pagesM/pages/goods_des"
  357. let params= "?id="+scene[0]+"&storeId="+scene[1]
  358. if (!this.$isEmpty(scene[2])) {
  359. params=params+"&inviteCode="+scene[2]
  360. }
  361. let url=path+params
  362. console.log(url);
  363. uni.redirectTo({
  364. url:url
  365. })
  366. }
  367. if(!this.$isEmpty(options.source)){
  368. }
  369. //二维码扫描链接 end
  370. //点击转发卡片进入的小程序
  371. this.execParam();
  372. wx.showShareMenu({
  373. withShareTicket: true
  374. })
  375. },
  376. tab(index){
  377. console.log(index);
  378. },
  379. jump(url,type){
  380. if(!this.$isEmpty(type)){
  381. uni.switchTab({
  382. url:url
  383. })
  384. }else{
  385. uni.navigateTo({
  386. url:url
  387. })
  388. }
  389. },
  390. /**
  391. * 获取商品推荐列表
  392. */
  393. async fetchGoodsList(){
  394. let indexProduct = await this.$api.storeHomeProducts();
  395. console.log(indexProduct,"/****");
  396. this.goodsList=indexProduct[0].products
  397. this.$u.randomArray(this.goodsList)
  398. },
  399. //轮播圆点
  400. bindchange(e) {
  401. this.setData({
  402. swiperIndex: e.detail.current
  403. });
  404. },
  405. //改变小区
  406. typeChange: function (e) {
  407. let _this = this;
  408. Promise.all([_this.getRoomByMemberId()]).then(result => {
  409. let value = _this.plotArray[e.detail.value];
  410. let residentialId = _this.residentialIdList[e.detail.value];
  411. _this.fetchNoticeList(residentialId);
  412. let residentialList= uni.getStorageSync('residentialList')
  413. uni.setStorageSync("personTel", residentialList[e.detail.value].personTel);
  414. uni.setStorageSync("plotName", value);
  415. uni.setStorageSync("residentialId", residentialId);
  416. uni.setStorageSync('doorNeedAudit',residentialList[e.detail.value].doorNeedAudit)
  417. _this.setData({
  418. plotIndex: e.detail.value,
  419. plot: value
  420. });
  421. //更新设备列表
  422. _this.getAuthDevice()
  423. }).catch(error => {
  424. console.log(error);
  425. });
  426. },
  427. //一键开门
  428. goOpen: function () {
  429. var that = this;
  430. var member = app.globalData.member;
  431. var anyHousePass = app.globalData.anyHousePass; //会员认证状态:{ 0:未认证,1:待审审核,2:已认证 }
  432. if (member == null) {
  433. //未注册
  434. app.globalData.footaddmore();
  435. return;
  436. } else if (member.state == 0 && !anyHousePass) {
  437. //未认证
  438. app.globalData.choosePlot();
  439. return;
  440. } else if (member.state == 1 && !anyHousePass) {
  441. //待审核
  442. that.pending();
  443. return;
  444. } else if (member.state == 2 || anyHousePass) {
  445. //已认证
  446. uni.navigateTo({
  447. url: '/pages/oneButton/oneButton'
  448. });
  449. }
  450. },
  451. /**
  452. * 获取轮播图列表
  453. */
  454. getAdList: function () {
  455. let that = this;
  456. let params = {};
  457. let operation = 'adPushApp/getList';
  458. // app.globalData.postRequest(params, operation, function (res) {
  459. // //获取成功
  460. // if (res.data.result_code == 1) {
  461. // let adList = res.data.list;
  462. // if (adList && adList.length > 0) {
  463. // that.setData({
  464. // adList: adList
  465. // });
  466. // }
  467. // }
  468. // });
  469. },
  470. fetchNoticeList(id){
  471. let that=this
  472. let operation='notice/noticeList'
  473. let params = {}
  474. params.residentialId = id;
  475. that.$http.getNoticeList(params).then(res=>{
  476. //获取成功
  477. that.noticeList = res.data.noticeList;
  478. });
  479. },
  480. //获取openid
  481. getOpenId: function () {
  482. var that = this;
  483. uni.login({
  484. success: res => {
  485. let params = {};
  486. params['js_code'] = res.code;
  487. params['name'] = 'community';
  488. params['app_type'] = 1;
  489. that.jsCode=res.code;
  490. console.log("aaaaaaaaaaaaaaaaaaaa")
  491. // let operation = 'miniprogram/getOpenid'; //发起请求
  492. that.$http.getOpenid(params).then(res=>{
  493. console.log(JSON.stringify(res)+"?******")
  494. //获取成功
  495. if (res.data.result_code == 1) {
  496. console.log("获取openid成功");
  497. //openid存入缓存
  498. uni.setStorageSync("openid", res.data.openid);
  499. uni.setStorageSync("appletType", res.data.appletType);
  500. that.$u.vuex('vuex_appletType',res.data.appletType);
  501. that.openid=res.data.openid
  502. that.sessionKey=res.data.sessionKey
  503. that.getMemberByOpenid(res.data.openid);
  504. } else {
  505. app.globalData.oneFailHint(res.data.result_msg);
  506. }
  507. }).catch(err=>{
  508. console.log(err,"/*/*");
  509. });
  510. }
  511. });
  512. },
  513. //根据openid获取用户信息
  514. async getMemberByOpenid(openid) {
  515. let _this = this;
  516. let params = {};
  517. params['openid'] = openid;
  518. // let operation = 'miniprogram/getMemberByOpenid';
  519. let res=await this.$http.getMemberByOpenid(params)
  520. if (res.data.result_code == 1) {
  521. app.globalData.member = res.data.member;
  522. uni.setStorageSync("myPhone", res.data.member.tel);
  523. that.$u.vuex('vuex_member',res.data.member)
  524. app.globalData.anyHousePass = res.data.anyHousePass; //获取房屋列表
  525. _this.getRoomByMemberId();
  526. _this.getAuthDevice()
  527. _this.fetchAuthRecordNum()
  528. }
  529. },
  530. /**
  531. * 游客登陆
  532. */
  533. async touristLogin() {
  534. // 检查是否登录
  535. this.isLogin = this.$auth.isAuth
  536. console.log(this.$auth.isAuth);
  537. if (!this.$auth.isAuth) { // 就算是游客,也重新登录
  538. console.log('需要使用游客身份,执行游客登录!')
  539. let resp = await this.$api.touristLogin()
  540. console.log("Resp",resp);
  541. let userType = this.$global.userType.tourist
  542. this.$auth.login(userType, resp.sessionId, resp.userId, resp)
  543. console.log('游客登录成功!', resp)
  544. } else {
  545. console.log(`已登录!`)
  546. }
  547. },
  548. //根据会员id获取我的房屋列表
  549. getRoomByMemberId: function () {
  550. let that = this;
  551. let params = {};
  552. // console.log("app:"+)
  553. params['member_id'] = app.globalData.member.id;
  554. // let operation = 'estate/getRoomByMemberId';
  555. this.$http.getRoomByMemberId(params).then(res => {
  556. console.info("获取成功" , res.data); //获取成功
  557. let list = [];
  558. let doorNeedAuditList=[]
  559. let residentialIdList = [];
  560. let personTelList=[]
  561. if (res.data.result_code == 1) {
  562. that.fetchNoticeList(res.data.list[0].residentialId);
  563. app.globalData.userId=res.data.list[0].userId
  564. res.data.list.map(item => {
  565. if (list.indexOf(item.residentialName) == -1) {
  566. list.push(item.residentialName);
  567. doorNeedAuditList.push(item.doorNeedAudit)
  568. residentialIdList.push(item.residentialId);
  569. personTelList.push(item.personTel)
  570. }
  571. });
  572. if (list.length < 1) {
  573. uni.removeStorageSync("personTel");
  574. uni.removeStorageSync("plotName");
  575. uni.removeStorageSync("residentialId");
  576. uni.removeStorageSync("doorNeedAudit");
  577. } else {
  578. //获取本地储存的当前所在小区
  579. let plot = that.plot;
  580. if (uni.getStorageSync('plotName')) {
  581. plot = uni.getStorageSync('plotName');
  582. that.setData({
  583. plot: plot
  584. });
  585. } else {
  586. uni.setStorageSync("personTel", personTelList[0]);
  587. uni.setStorageSync("doorNeedAudit", doorNeedAuditList[0]);
  588. uni.setStorageSync("plotName", list[0]);
  589. uni.setStorageSync("residentialId", residentialIdList[0]);
  590. that.setData({
  591. plot: list[0]
  592. });
  593. }
  594. }
  595. let residentialList=[]
  596. list.forEach((item,index)=>{
  597. let tmp={}
  598. tmp.residentialName=item
  599. tmp.personTel=personTelList[index]
  600. tmp.residentialId=residentialIdList[index]
  601. tmp.doorNeedAudit=doorNeedAuditList[index]
  602. tmp.estateTel=doorNeedAuditList[index]
  603. residentialList.push(tmp)
  604. })
  605. uni.setStorage({
  606. key:"residentialList",
  607. data:residentialList
  608. })
  609. //为 小区 picker 设置默认项
  610. let defaultPlotId=uni.getStorageSync("residentialId")
  611. if (!that.$isEmpty(defaultPlotId)) {
  612. that.plotIndex=residentialIdList.indexOf(defaultPlotId)
  613. }
  614. that.setData({
  615. plotArray: list,
  616. residentialIdList: residentialIdList
  617. });
  618. }
  619. });
  620. },
  621. /**
  622. * 跳转
  623. * @param {Object} index 当前项的index属性,而不是当前项的下标
  624. */
  625. top: function (index) {
  626. if (index==99) {
  627. //查看更多
  628. uni.navigateTo({
  629. url:"../tool-list/tool-list"
  630. })
  631. return
  632. }
  633. if (index==9) {
  634. uni.navigateToMiniProgram({
  635. appId:'wx2eec5fb00157a603',
  636. })
  637. return
  638. }
  639. var that = this;
  640. var member = app.globalData.member;
  641. var anyHousePass = app.globalData.anyHousePass; //会员认证状态:{ 0:未认证,1:待审审核,2:已认证 }
  642. if (this.$isEmpty(member)) {
  643. //去注册
  644. uni.navigateTo({
  645. url:"../empty/empty"
  646. })
  647. return
  648. } else if (member.state == 0 && !anyHousePass) {
  649. //去认证
  650. uni.navigateTo({
  651. url:"../empty/empty?type=2"
  652. })
  653. return
  654. } else if (member.state == 1 && !anyHousePass) {
  655. //待审核
  656. that.pending();
  657. } else if (member.state == 2 || anyHousePass) {
  658. //已认证
  659. //获取页面传过来的值
  660. var url;
  661. switch (index) {
  662. case 1:
  663. //我的家人
  664. url='/pages/myhome/myhome';
  665. break;
  666. case 2:
  667. //家庭成员
  668. url = '/pages/myFamily/myFamily';
  669. break;
  670. case 3:
  671. //我的车辆
  672. url = "/pages/myCar/myCar";
  673. break;
  674. case 4:
  675. //访客授权
  676. url = '/pages/authorize_record/authorize_record';
  677. break;
  678. case 5:
  679. if (this.$isEmpty(this.device_list)) {
  680. uni.showToast({
  681. title:"暂无设备",
  682. icon:"none"
  683. })
  684. return
  685. }
  686. if (this.device_list.length==1) {
  687. this.open(this.device_list[0].id)
  688. }else{
  689. this.modalShow=!this.modalShow
  690. }
  691. break;
  692. case 6:
  693. //防疫登记
  694. url = '/pages/tool-list/epidemic-pass/epidemic-pass';
  695. break;
  696. case 7:
  697. //物业缴费
  698. uni.showToast({
  699. title:"待开发",
  700. icon:"none"
  701. })
  702. break;
  703. case 8:
  704. //物业报修
  705. url = '/pages/services/property/property';
  706. break;
  707. case 9:
  708. // url = '/pages/healthCode/healthCode';
  709. break;
  710. default:
  711. url = "";
  712. break;
  713. }
  714. if (url != '') {
  715. uni.navigateTo({
  716. url: url,
  717. success: function (res) {
  718. that.setData({
  719. firstJump: false
  720. });
  721. }
  722. });
  723. }
  724. }
  725. },
  726. openBluetoothAdapter: function () {
  727. uni.openBluetoothAdapter({
  728. success: function (res) {
  729. uni.navigateTo({
  730. url: "/pages/bluetooth/bluetooth"
  731. });
  732. },
  733. fail: function (res) {
  734. uni.showModal({
  735. content: '请开启手机蓝牙后再试'
  736. });
  737. }
  738. });
  739. },
  740. //用户信息待审核中
  741. pending: function () {
  742. var openid = uni.getStorageSync("openid");
  743. let params = {};
  744. params['openid'] = openid;
  745. // let operation = 'miniprogram/getMemberByOpenid';
  746. this.$http.getMemberByOpenid(params).then(res=>{
  747. //获取成功
  748. if (res.data.result_code == 1) {
  749. let member = res.data.member; //待审核
  750. if (member.state == 1 && !res.data.anyHousePass) {
  751. app.globalData.oneFailHint('亲,你的信息正在审核,请耐心等待');
  752. } else if (member.state == 2) {
  753. app.globalData.oneFailHint('亲,你的信息已审核通过');
  754. that.getRoomByMemberId()
  755. }
  756. app.globalData.member = member;
  757. app.globalData.anyHousePass = res.data.anyHousePass;
  758. } else {
  759. app.globalData.oneFailHint(res.data.result_msg);
  760. }
  761. });
  762. },
  763. goNoticeDetail(item){
  764. app.globalData.noticeDetail=item
  765. uni.navigateTo({
  766. url:"../notice/detail",
  767. })
  768. }
  769. }
  770. }
  771. </script>
  772. <style lang="scss">
  773. .img1-lg{
  774. margin-top: -80rpx;
  775. }
  776. .location_item{
  777. background-color: #FFFFFF;
  778. display: flex;
  779. padding: 30rpx;
  780. font-size: 32rpx;
  781. }
  782. .active {
  783. transform: none;
  784. transition: all 0.2s ease-in 0s;
  785. }
  786. .tj-title{
  787. display: flex;
  788. justify-content: space-between;
  789. padding: 30rpx;
  790. background-color: #FFFFFF;
  791. font-size: 32rpx;
  792. .sub-title{
  793. font-size: 26rpx;
  794. padding-left: 16rpx;
  795. color: #c7c7c7;
  796. }
  797. }
  798. .nav-list {
  799. display: flex;
  800. flex-wrap: wrap;
  801. justify-content: center;
  802. }
  803. .nav-li {
  804. padding: 30upx 20rpx;
  805. border-radius: 12upx;
  806. width: 40%;
  807. margin: 20rpx 1% 10upx;
  808. // background-image: url(/static/unicorn-base/index/cc3b1807-c684-4b83-8f80-80e5b8a6b975.png);
  809. background-size: cover;
  810. background-position: center;
  811. position: relative;
  812. z-index: 1;
  813. }
  814. .nav-li::after {
  815. content: "";
  816. position: absolute;
  817. z-index: -1;
  818. background-color: inherit;
  819. width: 100%;
  820. height: 100%;
  821. left: 0;
  822. bottom: -10%;
  823. border-radius: 10upx;
  824. opacity: 0.2;
  825. transform: scale(0.9, 0.9);
  826. }
  827. .nav-li.cur {
  828. color: #fff;
  829. background: rgb(94, 185, 94);
  830. box-shadow: 4upx 4upx 6upx rgba(94, 185, 94, 0.4);
  831. }
  832. .nav-title {
  833. font-size: 32upx;
  834. font-weight: 300;
  835. }
  836. .nav-title::first-letter {
  837. font-size: 40upx;
  838. margin-right: 4upx;
  839. }
  840. .nav-name {
  841. font-size: 28upx;
  842. text-transform: Capitalize;
  843. margin-top: 20upx;
  844. position: relative;
  845. }
  846. .nav-name::before {
  847. content: "";
  848. position: absolute;
  849. display: block;
  850. width: 40upx;
  851. height: 6upx;
  852. background: #fff;
  853. bottom: 0;
  854. right: 0;
  855. opacity: 0.5;
  856. }
  857. .nav-name::after {
  858. content: "";
  859. position: absolute;
  860. display: block;
  861. width: 100upx;
  862. height: 1px;
  863. background: #fff;
  864. bottom: 0;
  865. right: 40upx;
  866. opacity: 0.3;
  867. }
  868. .nav-name::first-letter {
  869. font-weight: bold;
  870. font-size: 36upx;
  871. margin-right: 1px;
  872. }
  873. .nav-li image {
  874. position: absolute;
  875. right: 30upx;
  876. top: 30upx;
  877. font-size: 52upx;
  878. width: 70upx;
  879. height: 70upx;
  880. text-align: center;
  881. line-height: 60upx;
  882. }
  883. </style>