index.vue 25 KB

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