index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917
  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="/static/common/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. this.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. let operation='guestRecord/getListByMemberId'
  249. getApp().globalData.postRequest(params,operation,function(res){
  250. let length=res.data.list.length
  251. that.$u.vuex('vuex_auth_audit_count',length)
  252. that.gridList.forEach(item=>{
  253. if (item.index==4) {
  254. item.badge=length
  255. }
  256. })
  257. })
  258. }
  259. }catch(e){
  260. }
  261. },
  262. open(id){
  263. //直接开门
  264. that.openDoor(id)
  265. //进度条加载模式开门
  266. // this.isloading=true
  267. // let that=this
  268. // setTimeout(()=>{
  269. // that.openDoor(id)
  270. // },500)
  271. },
  272. //立即开门
  273. openDoor: function (id) {
  274. let device_id=id
  275. let that = this;
  276. let params = {};
  277. params['member_id'] = app.globalData.member.id;
  278. params['device_id'] = device_id;
  279. let operation = 'member/openDoor';
  280. app.globalData.postRequest(params, operation, function (res) {
  281. that.isloading=false
  282. app.globalData.oneFailHint(res.data.result_msg,function(){
  283. });
  284. });
  285. },
  286. getAuthDevice: function () {
  287. let that = this;
  288. let params = {};
  289. params['member_id'] = app.globalData.member.id;
  290. let operation = 'member/getAuthDeviceByMemberId';
  291. app.globalData.postRequest(params, operation, function (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. //二维码扫描链接 end
  368. //点击转发卡片进入的小程序
  369. this.execParam();
  370. wx.showShareMenu({
  371. withShareTicket: true
  372. })
  373. },
  374. tab(index){
  375. console.log(index);
  376. },
  377. jump(url,type){
  378. if(!this.$isEmpty(type)){
  379. uni.switchTab({
  380. url:url
  381. })
  382. }else{
  383. uni.navigateTo({
  384. url:url
  385. })
  386. }
  387. },
  388. /**
  389. * 获取商品推荐列表
  390. */
  391. async fetchGoodsList(){
  392. let indexProduct = await this.$api.storeHomeProducts();
  393. console.log(indexProduct,"/****");
  394. this.goodsList=indexProduct[0].products
  395. this.$u.randomArray(this.goodsList)
  396. },
  397. //轮播圆点
  398. bindchange(e) {
  399. this.setData({
  400. swiperIndex: e.detail.current
  401. });
  402. },
  403. //改变小区
  404. typeChange: function (e) {
  405. let _this = this;
  406. Promise.all([_this.getRoomByMemberId()]).then(result => {
  407. let value = _this.plotArray[e.detail.value];
  408. let residentialId = _this.residentialIdList[e.detail.value];
  409. _this.fetchNoticeList(residentialId);
  410. let residentialList= uni.getStorageSync('residentialList')
  411. uni.setStorageSync("personTel", residentialList[e.detail.value].personTel);
  412. uni.setStorageSync("plotName", value);
  413. uni.setStorageSync("residentialId", residentialId);
  414. uni.setStorageSync('doorNeedAudit',residentialList[e.detail.value].doorNeedAudit)
  415. _this.setData({
  416. plotIndex: e.detail.value,
  417. plot: value
  418. });
  419. //更新设备列表
  420. _this.getAuthDevice()
  421. }).catch(error => {
  422. console.log(error);
  423. });
  424. },
  425. //一键开门
  426. goOpen: function () {
  427. var that = this;
  428. var member = app.globalData.member;
  429. var anyHousePass = app.globalData.anyHousePass; //会员认证状态:{ 0:未认证,1:待审审核,2:已认证 }
  430. if (member == null) {
  431. //未注册
  432. app.globalData.footaddmore();
  433. return;
  434. } else if (member.state == 0 && !anyHousePass) {
  435. //未认证
  436. app.globalData.choosePlot();
  437. return;
  438. } else if (member.state == 1 && !anyHousePass) {
  439. //待审核
  440. that.pending();
  441. return;
  442. } else if (member.state == 2 || anyHousePass) {
  443. //已认证
  444. uni.navigateTo({
  445. url: '/pages/oneButton/oneButton'
  446. });
  447. }
  448. },
  449. /**
  450. * 获取轮播图列表
  451. */
  452. getAdList: function () {
  453. let that = this;
  454. let params = {};
  455. let operation = 'adPushApp/getList';
  456. app.globalData.postRequest(params, operation, function (res) {
  457. //获取成功
  458. if (res.data.result_code == 1) {
  459. let adList = res.data.list;
  460. if (adList && adList.length > 0) {
  461. that.setData({
  462. adList: adList
  463. });
  464. }
  465. }
  466. });
  467. },
  468. fetchNoticeList(id){
  469. let that=this
  470. let operation='notice/noticeList'
  471. let params = {}
  472. params.residentialId = id;
  473. app.globalData.postRequest(params, operation, function (res) {
  474. //获取成功
  475. that.noticeList=res.data.noticeList
  476. });
  477. },
  478. //获取openid
  479. getOpenId: function () {
  480. var that = this;
  481. uni.login({
  482. success: res => {
  483. let params = {};
  484. params['js_code'] = res.code;
  485. params['name'] = 'community';
  486. that.jsCode=res.code
  487. let operation = 'miniprogram/getOpenid'; //发起请求
  488. app.globalData.postRequest(params, operation, function (res) {
  489. //获取成功
  490. if (res.data.result_code == 1) {
  491. console.log("获取openid成功")
  492. //openid存入缓存
  493. uni.setStorageSync("openid", res.data.openid);
  494. uni.setStorageSync("appletType", res.data.appletType);
  495. that.$u.vuex('vuex_appletType',res.data.appletType)
  496. that.openid=res.data.openid
  497. that.sessionKey=res.data.sessionKey
  498. that.getMemberByOpenid(res.data.openid);
  499. } else {
  500. app.globalData.oneFailHint(res.data.result_msg);
  501. }
  502. });
  503. }
  504. });
  505. },
  506. //根据openid获取用户信息
  507. async getMemberByOpenid(openid) {
  508. let _this = this;
  509. let params = {};
  510. params['openid'] = openid;
  511. let operation = 'miniprogram/getMemberByOpenid';
  512. let res=await app.globalData.postRequestAsync(params, operation)
  513. if (res.data.result_code == 1) {
  514. app.globalData.member = res.data.member;
  515. uni.setStorageSync("myPhone", res.data.member.tel);
  516. that.$u.vuex('vuex_member',res.data.member)
  517. app.globalData.anyHousePass = res.data.anyHousePass; //获取房屋列表
  518. _this.getRoomByMemberId();
  519. _this.getAuthDevice()
  520. _this.fetchAuthRecordNum()
  521. }
  522. },
  523. /**
  524. * 游客登陆
  525. */
  526. async touristLogin() {
  527. // 检查是否登录
  528. this.isLogin = this.$auth.isAuth
  529. console.log(this.$auth.isAuth);
  530. if (!this.$auth.isAuth) { // 就算是游客,也重新登录
  531. console.log('需要使用游客身份,执行游客登录!')
  532. let resp = await this.$api.touristLogin()
  533. console.log("Resp",resp);
  534. let userType = this.$global.userType.tourist
  535. this.$auth.login(userType, resp.sessionId, resp.userId, resp)
  536. console.log('游客登录成功!', resp)
  537. } else {
  538. console.log(`已登录!`)
  539. }
  540. },
  541. //根据会员id获取我的房屋列表
  542. getRoomByMemberId: function () {
  543. let that = this;
  544. let params = {};
  545. params['member_id'] = app.globalData.member.id;
  546. let operation = 'estate/getRoomByMemberId';
  547. app.globalData.postRequest(params, operation, function (res) {
  548. console.info("获取成功" , res.data); //获取成功
  549. let list = [];
  550. let doorNeedAuditList=[]
  551. let residentialIdList = [];
  552. let personTelList=[]
  553. if (res.data.result_code == 1) {
  554. that.fetchNoticeList(res.data.list[0].residentialId);
  555. app.globalData.userId=res.data.list[0].userId
  556. res.data.list.map(item => {
  557. if (list.indexOf(item.residentialName) == -1) {
  558. list.push(item.residentialName);
  559. doorNeedAuditList.push(item.doorNeedAudit)
  560. residentialIdList.push(item.residentialId);
  561. personTelList.push(item.personTel)
  562. }
  563. });
  564. if (list.length < 1) {
  565. uni.removeStorageSync("personTel");
  566. uni.removeStorageSync("plotName");
  567. uni.removeStorageSync("residentialId");
  568. uni.removeStorageSync("doorNeedAudit");
  569. } else {
  570. //获取本地储存的当前所在小区
  571. let plot = that.plot;
  572. if (uni.getStorageSync('plotName')) {
  573. plot = uni.getStorageSync('plotName');
  574. that.setData({
  575. plot: plot
  576. });
  577. } else {
  578. uni.setStorageSync("personTel", personTelList[0]);
  579. uni.setStorageSync("doorNeedAudit", doorNeedAuditList[0]);
  580. uni.setStorageSync("plotName", list[0]);
  581. uni.setStorageSync("residentialId", residentialIdList[0]);
  582. that.setData({
  583. plot: list[0]
  584. });
  585. }
  586. }
  587. let residentialList=[]
  588. list.forEach((item,index)=>{
  589. let tmp={}
  590. tmp.residentialName=item
  591. tmp.personTel=personTelList[index]
  592. tmp.residentialId=residentialIdList[index]
  593. tmp.doorNeedAudit=doorNeedAuditList[index]
  594. tmp.estateTel=doorNeedAuditList[index]
  595. residentialList.push(tmp)
  596. })
  597. uni.setStorage({
  598. key:"residentialList",
  599. data:residentialList
  600. })
  601. //为 小区 picker 设置默认项
  602. let defaultPlotId=uni.getStorageSync("residentialId")
  603. if (!that.$isEmpty(defaultPlotId)) {
  604. that.plotIndex=residentialIdList.indexOf(defaultPlotId)
  605. }
  606. that.setData({
  607. plotArray: list,
  608. residentialIdList: residentialIdList
  609. });
  610. }
  611. });
  612. },
  613. /**
  614. * 跳转
  615. * @param {Object} index 当前项的index属性,而不是当前项的下标
  616. */
  617. top: function (index) {
  618. if (index==99) {
  619. //查看更多
  620. uni.navigateTo({
  621. url:"../tool-list/tool-list"
  622. })
  623. return
  624. }
  625. if (index==9) {
  626. uni.navigateToMiniProgram({
  627. appId:'wx2eec5fb00157a603',
  628. })
  629. return
  630. }
  631. var that = this;
  632. var member = app.globalData.member;
  633. var anyHousePass = app.globalData.anyHousePass; //会员认证状态:{ 0:未认证,1:待审审核,2:已认证 }
  634. if (this.$isEmpty(member)) {
  635. //去注册
  636. uni.navigateTo({
  637. url:"../empty/empty"
  638. })
  639. return
  640. } else if (member.state == 0 && !anyHousePass) {
  641. //去认证
  642. uni.navigateTo({
  643. url:"../empty/empty?type=2"
  644. })
  645. return
  646. } else if (member.state == 1 && !anyHousePass) {
  647. //待审核
  648. that.pending();
  649. } else if (member.state == 2 || anyHousePass) {
  650. //已认证
  651. //获取页面传过来的值
  652. var url;
  653. switch (index) {
  654. case 1:
  655. //我的家人
  656. url='/pages/myhome/myhome';
  657. break;
  658. case 2:
  659. //家庭成员
  660. url = '/pages/myFamily/myFamily';
  661. break;
  662. case 3:
  663. //我的车辆
  664. url = "/pages/myCar/myCar";
  665. break;
  666. case 4:
  667. //访客授权
  668. url = '/pages/authorize_record/authorize_record';
  669. break;
  670. case 5:
  671. if (this.$isEmpty(this.device_list)) {
  672. uni.showToast({
  673. title:"暂无设备",
  674. icon:"none"
  675. })
  676. return
  677. }
  678. if (this.device_list.length==1) {
  679. this.open(this.device_list[0].id)
  680. }else{
  681. this.modalShow=!this.modalShow
  682. }
  683. break;
  684. case 6:
  685. //防疫登记
  686. url = '/pages/tool-list/epidemic-pass/epidemic-pass';
  687. break;
  688. case 7:
  689. //物业缴费
  690. uni.showToast({
  691. title:"待开发",
  692. icon:"none"
  693. })
  694. break;
  695. case 8:
  696. //物业报修
  697. url = '/pages/services/property/property';
  698. break;
  699. case 9:
  700. // url = '/pages/healthCode/healthCode';
  701. break;
  702. default:
  703. url = "";
  704. break;
  705. }
  706. if (url != '') {
  707. uni.navigateTo({
  708. url: url,
  709. success: function (res) {
  710. that.setData({
  711. firstJump: false
  712. });
  713. }
  714. });
  715. }
  716. }
  717. },
  718. openBluetoothAdapter: function () {
  719. uni.openBluetoothAdapter({
  720. success: function (res) {
  721. uni.navigateTo({
  722. url: "/pages/bluetooth/bluetooth"
  723. });
  724. },
  725. fail: function (res) {
  726. uni.showModal({
  727. content: '请开启手机蓝牙后再试'
  728. });
  729. }
  730. });
  731. },
  732. //用户信息待审核中
  733. pending: function () {
  734. var openid = uni.getStorageSync("openid");
  735. let params = {};
  736. params['openid'] = openid;
  737. let operation = 'miniprogram/getMemberByOpenid';
  738. app.globalData.postRequest(params, operation, function (res) {
  739. //获取成功
  740. if (res.data.result_code == 1) {
  741. let member = res.data.member; //待审核
  742. if (member.state == 1 && !res.data.anyHousePass) {
  743. app.globalData.oneFailHint('亲,你的信息正在审核,请耐心等待');
  744. } else if (member.state == 2) {
  745. app.globalData.oneFailHint('亲,你的信息已审核通过');
  746. that.getRoomByMemberId()
  747. }
  748. app.globalData.member = member;
  749. app.globalData.anyHousePass = res.data.anyHousePass;
  750. } else {
  751. app.globalData.oneFailHint(res.data.result_msg);
  752. }
  753. });
  754. },
  755. goNoticeDetail(item){
  756. app.globalData.noticeDetail=item
  757. uni.navigateTo({
  758. url:"../notice/detail",
  759. })
  760. }
  761. }
  762. }
  763. </script>
  764. <style lang="scss">
  765. .img1-lg{
  766. margin-top: -80rpx;
  767. }
  768. .location_item{
  769. background-color: #FFFFFF;
  770. display: flex;
  771. padding: 30rpx;
  772. font-size: 32rpx;
  773. }
  774. .active {
  775. transform: none;
  776. transition: all 0.2s ease-in 0s;
  777. }
  778. .tj-title{
  779. display: flex;
  780. justify-content: space-between;
  781. padding: 30rpx;
  782. background-color: #FFFFFF;
  783. font-size: 32rpx;
  784. .sub-title{
  785. font-size: 26rpx;
  786. padding-left: 16rpx;
  787. color: #c7c7c7;
  788. }
  789. }
  790. .nav-list {
  791. display: flex;
  792. flex-wrap: wrap;
  793. justify-content: center;
  794. }
  795. .nav-li {
  796. padding: 30upx 20rpx;
  797. border-radius: 12upx;
  798. width: 40%;
  799. margin: 20rpx 1% 10upx;
  800. // background-image: url(/static/unicorn-base/index/cc3b1807-c684-4b83-8f80-80e5b8a6b975.png);
  801. background-size: cover;
  802. background-position: center;
  803. position: relative;
  804. z-index: 1;
  805. }
  806. .nav-li::after {
  807. content: "";
  808. position: absolute;
  809. z-index: -1;
  810. background-color: inherit;
  811. width: 100%;
  812. height: 100%;
  813. left: 0;
  814. bottom: -10%;
  815. border-radius: 10upx;
  816. opacity: 0.2;
  817. transform: scale(0.9, 0.9);
  818. }
  819. .nav-li.cur {
  820. color: #fff;
  821. background: rgb(94, 185, 94);
  822. box-shadow: 4upx 4upx 6upx rgba(94, 185, 94, 0.4);
  823. }
  824. .nav-title {
  825. font-size: 32upx;
  826. font-weight: 300;
  827. }
  828. .nav-title::first-letter {
  829. font-size: 40upx;
  830. margin-right: 4upx;
  831. }
  832. .nav-name {
  833. font-size: 28upx;
  834. text-transform: Capitalize;
  835. margin-top: 20upx;
  836. position: relative;
  837. }
  838. .nav-name::before {
  839. content: "";
  840. position: absolute;
  841. display: block;
  842. width: 40upx;
  843. height: 6upx;
  844. background: #fff;
  845. bottom: 0;
  846. right: 0;
  847. opacity: 0.5;
  848. }
  849. .nav-name::after {
  850. content: "";
  851. position: absolute;
  852. display: block;
  853. width: 100upx;
  854. height: 1px;
  855. background: #fff;
  856. bottom: 0;
  857. right: 40upx;
  858. opacity: 0.3;
  859. }
  860. .nav-name::first-letter {
  861. font-weight: bold;
  862. font-size: 36upx;
  863. margin-right: 1px;
  864. }
  865. .nav-li image {
  866. position: absolute;
  867. right: 30upx;
  868. top: 30upx;
  869. font-size: 52upx;
  870. width: 70upx;
  871. height: 70upx;
  872. text-align: center;
  873. line-height: 60upx;
  874. }
  875. </style>