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