index.vue 25 KB

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