index.vue 25 KB

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