home.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. // pages/home/home.js
  2. import NumberTimeChange from '../../utils/ntc.js'
  3. const app = getApp()
  4. var lock = require('../../utils/lock.js')
  5. var net = require('../../utils/net.js')
  6. var url = require('../../utils/url.js')
  7. var common = require('../../utils/common.js')
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. route: null,
  14. wxuser: {},
  15. user: {
  16. cell: 0,
  17. playGameC: 0,
  18. withdrawalbleFee: 0
  19. },
  20. pageHideTime: 0,
  21. getRoomTime: 0,
  22. room: [],
  23. interval: null,
  24. rankInfo: {},
  25. rankNumber: 0,
  26. rankDanName: '',
  27. addNum: 0,
  28. maxAddNum: 0,
  29. addTime: 12000,
  30. addTimeShow: '00:00:00',
  31. addDefTime: 12000,
  32. lastGameId: 0,
  33. brainCountDomRect: {},
  34. goldCoinDomRect: {},
  35. goldCoinAnim1: {},
  36. goldCoinAnim2: {},
  37. goldCoinAnim3: {},
  38. goldCoinAnim4: {},
  39. goldCoinAnim5: {},
  40. goldCoinAnim6: {},
  41. brainFillAnim: {},
  42. brainFillAnimTime: 0,
  43. hideOpenRoomView: true,
  44. dialogGeneral: {
  45. hidden: true,
  46. title: '官方公告',
  47. content: '为保障发布内容的安全,冲顶王者不支持用户出题。\n冲顶王者内部建立了完备的内容审核机制,为用户精选每一道题。'
  48. },
  49. dialogLogin: { hidden: true },
  50. dialogBrainLack: {
  51. hidden: true,
  52. title: '哎呀,你的脑力值不足',
  53. subtitle: '无法参与娱乐赛,并争夺现金奖励',
  54. button: '分享到群 赚取100万脑力值',
  55. },
  56. dialogRank: { hidden: true },
  57. dialogFriend: { hidden: true },
  58. dialogRoom: {
  59. hidden: true,
  60. title: '今天3次娱乐赛次数已用完',
  61. content: '你可以通过参加排位赛、提高段位来增加娱乐赛次数,段位越高、可玩次数越多! ',
  62. tip: '段位越高,翻倍奖励也越高哦',
  63. button: '现在就去参加排位赛',
  64. share: '',
  65. tap: 'toRank',
  66. },
  67. },
  68. /**
  69. * 生命周期函数--监听页面加载
  70. */
  71. onLoad: function (options) {
  72. app.globalData.isFirstLoad = true
  73. wx.showShareMenu({
  74. withShareTicket: true
  75. })
  76. if (options.recomCode) {
  77. app.globalData.identify.recomCode = options.recomCode
  78. app.globalData.identify.shareIdentify = options.shareIdentify
  79. delete options.recomCode
  80. delete options.shareIdentify
  81. }
  82. if (options.page) {
  83. var route = '../' + options.page + '/' + options.page + '?'
  84. delete options.page
  85. for (var key in options) {
  86. route += (key + '=' + options[key] + '&')
  87. }
  88. route = route.substring(0, route.length - 1)
  89. this.data.route = route
  90. }
  91. app.globalData.nextDayTime = common.getNextDayTime()
  92. // 登录
  93. this.wxLogin()
  94. },
  95. onShow: function () {
  96. //判断是否第一次加载
  97. if (app.globalData.isFirstLoad) {
  98. app.globalData.isFirstLoad = false
  99. } else {
  100. this.setData({
  101. user: app.globalData.user
  102. })
  103. this.updateRankDanInfo()
  104. this.getUserDataByBack()
  105. this.getRoomList()
  106. if (this.data.rankInfo.title == null) {
  107. //若获取排位赛赛季信息失败,返回首页时重新获取
  108. this.data.route = null
  109. this.getRankInfo()
  110. }
  111. }
  112. //判断是否存在隐藏页面时间,存在则倒计时减去差值
  113. if (this.pageHideTime > 0) {
  114. var offset = Math.floor((new Date().getTime() - this.pageHideTime) / 1000)
  115. this.timeline(offset)
  116. this.pageHideTime = 0
  117. }
  118. //页面显示时,启动倒计时定时器
  119. this.interval = setInterval(function (data) {
  120. this.timeline(1)
  121. }.bind(this), 1000)
  122. },
  123. onHide: function () {
  124. //页面隐藏时,停止倒计时定时器
  125. if (this.interval) {
  126. clearInterval(this.interval)
  127. this.pageHideTime = new Date().getTime()
  128. }
  129. },
  130. onUnload: function () {
  131. if (this.interval) {
  132. clearInterval(this.interval)
  133. }
  134. },
  135. onReady: function () {
  136. var query = wx.createSelectorQuery()
  137. //获取脑力值节点中心位置
  138. query.select('#brainCount').boundingClientRect(function (rect) {
  139. var x = Math.ceil(rect.left + rect.width / 2)
  140. var y = Math.ceil(rect.top + rect.height / 2)
  141. this.data.brainCountDomRect = { x: x, y: y }
  142. }.bind(this)).exec()
  143. //获取脑力加油站节点中心位置
  144. query.select('.add-img').boundingClientRect(function (rect) {
  145. var x = Math.ceil(rect.left + rect.width / 2)
  146. var y = Math.ceil(rect.top + rect.height / 2)
  147. this.data.goldCoinDomRect = { x: x, y: y }
  148. }.bind(this)).exec()
  149. },
  150. onShareAppMessage: function (res) {
  151. if ('menu' === res.from) {
  152. return common.shareAction({
  153. title: this.data.wxuser.nickName + '正在用脑力征服世界并掠夺高额奖金哦',
  154. path: '',
  155. type: 1,
  156. success: res => {
  157. }
  158. })
  159. } else {
  160. if (res.target.id === 'friend') {
  161. return common.shareAction({
  162. title: this.data.wxuser.nickName + '向你发起脑力挑战,输的罚XXX!',
  163. path: '&page=pk&type=2&uid=' + app.server.userId,
  164. imageUrl: '../../resource/share_friend_pk.png',
  165. type: 8,
  166. success: res => {
  167. wx.navigateTo({
  168. url: '/pages/pk/pk?type=2'
  169. })
  170. }
  171. })
  172. } else {
  173. this.hideBrainLackDialog()
  174. return common.shareAction({
  175. title: this.data.wxuser.nickName + '邀请你来瓜分8万8千8百8十8元现金奖励!',
  176. path: '',
  177. type: 2,
  178. success: res => {
  179. this.getUserDataByBack()
  180. this.setData({
  181. user: app.globalData.user
  182. })
  183. if (res.data.data.addCell > 0) {
  184. wx.showToast({
  185. title: '分享+' + common.unit(res.data.data.addCell) + '脑力值',
  186. icon: 'none',
  187. duration: 2500
  188. })
  189. }
  190. }
  191. })
  192. }
  193. }
  194. },
  195. route: function () {
  196. //路由操作
  197. if (this.data.route) {
  198. wx.navigateTo({
  199. url: this.data.route,
  200. })
  201. this.data.route = null
  202. }
  203. },
  204. wxLogin: function () {
  205. wx.showLoading({
  206. title: '正在登录',
  207. mask: true,
  208. success: res => {
  209. app.onHomeStart(lock)
  210. }
  211. })
  212. wx.login({
  213. success: res => {
  214. // res.code 可以到后台换取 openId, sessionKey, unionId
  215. app.globalData.code = res.code
  216. //获取用户信息
  217. this.getUserInfo()
  218. },
  219. fail: e => {
  220. this.loginAgain()
  221. }
  222. })
  223. },
  224. loginAgain: function () {
  225. wx.hideLoading()
  226. wx.showModal({
  227. title: '提示',
  228. content: '登录失败,请重试',
  229. showCancel: false,
  230. success: res => {
  231. this.wxLogin()
  232. }
  233. })
  234. },
  235. getUserInfo: function () {
  236. wx.getUserInfo({
  237. success: res => {
  238. this.afterGetUserInfo(res)
  239. },
  240. fail: e => {
  241. //获取用户信息失败,弹出登录框
  242. wx.hideLoading()
  243. this.showLoginDialog()
  244. }
  245. })
  246. },
  247. bindGetUserInfo: function (res) {
  248. //登录弹框登录按钮的绑定函数
  249. if (res.detail.userInfo == null) {
  250. return
  251. }
  252. //用户允许授权,隐藏登录弹框
  253. this.hideLoginDialog()
  254. wx.showLoading({
  255. title: '正在登录',
  256. })
  257. this.afterGetUserInfo(res.detail)
  258. },
  259. afterGetUserInfo(res) {
  260. app.onHomeReady(common)
  261. //用户允许授权后,汇总操作
  262. app.globalData.userInfo = res.userInfo
  263. this.setData({
  264. wxuser: res.userInfo
  265. })
  266. //传递code 用户昵称 头像到服务端 执行登录操作
  267. var state = ''
  268. if (app.globalData.identify.recomCode) {
  269. state = app.globalData.identify.shareIdentify + '#' + app.globalData.identify.recomCode
  270. }
  271. net.connect({
  272. url: url.host + url.login,
  273. data: {
  274. code: app.globalData.code,
  275. rawData: res.rawData,
  276. signature: res.signature,
  277. state: state
  278. },
  279. success: res => {
  280. wx.hideLoading()
  281. if (res.data.code != 200) {
  282. this.loginAgain()
  283. return
  284. }
  285. var _result = res.data.data
  286. var nowTime = _result.nowTime || new Date().getTime()
  287. app.globalData.timeDifference = nowTime - new Date().getTime()
  288. app.globalData.nextDayTime = common.getNextDayTime()
  289. app.server = _result
  290. this.getUserData()
  291. this.updateRankDanInfo()
  292. this.getRoomList()
  293. }
  294. }, true)
  295. },
  296. getUserData: function () {
  297. net.connect({
  298. url: url.host + url.get_user_info,
  299. success: res => {
  300. // 展示审核弹出框
  301. var isOneShow = wx.getStorageSync('isOneShow') || false
  302. if (!isOneShow) {
  303. this.showGeneralDialog()
  304. wx.setStorage({
  305. key: 'isOneShow',
  306. data: true,
  307. })
  308. } else {
  309. var notice = app.server.userNotice
  310. if (notice != null) {
  311. var id = wx.getStorageSync('noticeId') || 0
  312. if (id != notice.noticeId) {
  313. this.data.dialogGeneral.title = notice.title
  314. this.data.dialogGeneral.content = notice.cont
  315. this.showGeneralDialog()
  316. wx.setStorage({
  317. key: 'noticeId',
  318. data: notice.noticeId,
  319. })
  320. }
  321. }
  322. }
  323. if (res.data.code != 200) {
  324. return
  325. }
  326. this.updateUserData(res.data.data)
  327. this.getRankInfo()
  328. }
  329. }, true)
  330. },
  331. getUserDataByBack: function () {
  332. net.connect({
  333. url: url.host + url.get_user_info,
  334. success: res => {
  335. if (res.data.code == 200) {
  336. this.updateUserData(res.data.data)
  337. }
  338. }
  339. }, true)
  340. },
  341. getRankInfo: function () {
  342. net.connect({
  343. url: url.host + url.get_rank,
  344. success: res => {
  345. if (res.data.code == 200) {
  346. if (res.data.data != null) {
  347. this.data.rankInfo = res.data.data
  348. this.data.rankInfo.canPlayRank = true
  349. }
  350. this.route()
  351. }
  352. if (!this.data.rankInfo.canPlayRank) {
  353. this.data.rankInfo = {
  354. canPlayRank: false,
  355. logo: app.server.config.noRankLogo,
  356. title: app.server.config.noRankName
  357. }
  358. }
  359. app.globalData.rankInfo = this.data.rankInfo
  360. this.setData({
  361. rankInfo: this.data.rankInfo
  362. })
  363. }
  364. }, true)
  365. },
  366. getRoomList: function () {
  367. if (app.server.key == null) {
  368. return;
  369. }
  370. net.connect({
  371. url: url.host + url.get_room_list,
  372. success: res => {
  373. if (res.data.code != 200) {
  374. return
  375. }
  376. this.data.getRoomTime = 0
  377. //服务器与本地时间差值计算
  378. var nowTime = res.data.data.nowTime || new Date().getTime()
  379. app.globalData.timeDifference = nowTime - new Date().getTime()
  380. //计算倒计时时间
  381. var rooms = res.data.data.roomList || []
  382. var len = rooms.length || 0
  383. for (var i = 0; i < len; i++) {
  384. var time = (rooms[i].playBeginTime - nowTime) / 1000
  385. rooms[i].countDown = time > 0 ? Math.ceil(time) : 0
  386. }
  387. this.setData({
  388. room: rooms,
  389. hideOpenRoomView: false
  390. })
  391. }
  392. }, true)
  393. },
  394. timeline: function (offset) {
  395. if (app.server.key == null) {
  396. return
  397. }
  398. //页面倒计时,秒轮询
  399. if (new Date().getTime() > app.globalData.nextDayTime) {
  400. //零点处理事件
  401. this.resetShareNum()
  402. }
  403. //脑力加油站倒计时
  404. var addTimeShow, addNum
  405. this.data.addTime = this.data.addTime - offset
  406. if (this.data.addTime > 0) {
  407. //计算当前增加脑力值,每分钟增加
  408. var time = this.data.addDefTime - this.data.addTime
  409. time = Math.floor(time / 60)
  410. addNum = Math.floor(time * 60 * (this.data.maxAddNum / this.data.addDefTime))
  411. addTimeShow = this.secondToHms(this.data.addTime)
  412. } else {
  413. addNum = this.data.maxAddNum
  414. this.data.addTime = 0
  415. addTimeShow = '00:00:00'
  416. //脑力加油站达到最大值,执行动画
  417. if (this.data.brainFillAnimTime == 0) {
  418. this.playBrainFillAnimation()
  419. }
  420. this.data.brainFillAnimTime = this.data.brainFillAnimTime >= 3 ? 0 : this.data.brainFillAnimTime + 1
  421. }
  422. //房间倒计时
  423. var rooms = this.data.room || []
  424. var len = rooms.length || 0
  425. for (var i = 0; i < len; i++) {
  426. var room = rooms[i]
  427. var time = room.countDown - offset
  428. room.countDown = time < 0 ? 0 : time
  429. }
  430. //数据更新
  431. this.setData({
  432. room: rooms,
  433. addNum: addNum,
  434. addTimeShow: addTimeShow
  435. })
  436. //获取房间数据列表
  437. if (this.data.getRoomTime >= app.server.config.schedRoomList) {
  438. this.data.getRoomTime = 0
  439. this.getRoomList()
  440. } else {
  441. this.data.getRoomTime++
  442. }
  443. },
  444. resetShareNum: function () {
  445. app.server.shareCellLack = 0
  446. app.server.shareRoomResult = 0
  447. app.server.shareRoomResult2 = 0
  448. app.server.shareRankPkResult = 0
  449. app.server.shareRankCellLack = 0
  450. app.globalData.nextDayTime = common.getNextDayTime()
  451. },
  452. updateUserData: function (user) {
  453. this.data.user = user
  454. app.globalData.user = user
  455. var addTime = parseInt((this.data.user.nowTime - this.data.user.splitTime) / 1000)
  456. addTime = addTime > this.data.addDefTime ? this.data.addDefTime : addTime
  457. this.data.addTime = this.data.addDefTime - addTime;
  458. this.setData({
  459. user: this.data.user
  460. })
  461. },
  462. updateRankDanInfo: function () {
  463. var arr = common.starToFragment(app.server.config.rankDanList, app.server.starC)
  464. var rankDan = app.server.config.rankDanList[arr[0]]
  465. this.data.rankDan = rankDan
  466. this.data.rankDanName = rankDan.name
  467. this.data.maxAddNum = rankDan.cellSplitMax
  468. this.data.addDefTime = rankDan.cellSplitMax / rankDan.cellSplitSpeed * 120
  469. this.setData({
  470. rankDanName: this.data.rankDanName,
  471. maxAddNum: this.data.maxAddNum,
  472. })
  473. if (this.data.rankNumber != app.server.rank) {
  474. var ntc = new NumberTimeChange({
  475. start: this.data.rankNumber,
  476. end: app.server.rank,
  477. update: n => {
  478. this.setData({
  479. rankNumber: n
  480. })
  481. },
  482. complete: n => {
  483. this.setData({
  484. rankNumber: n
  485. })
  486. }
  487. })
  488. }
  489. },
  490. secondToHms: function (second) {
  491. //秒数转换成时分秒格式
  492. var h, m, s
  493. h = Math.floor(second / 3600)
  494. h = h < 10 ? '0' + h : h
  495. m = Math.floor(second % 3600 / 60)
  496. m = m < 10 ? '0' + m : m
  497. s = Math.floor(second % 3600 % 60)
  498. s = s < 10 ? '0' + s : s
  499. return h + ':' + m + ':' + s
  500. },
  501. getCurrentAddNum: function (e) {
  502. //点击金币,获取脑力值
  503. if (this.data.addNum <= 0) {
  504. this.toAdd()
  505. return
  506. }
  507. if (lock.lockTapDelay(1000)) {
  508. return
  509. }
  510. net.connect({
  511. url: url.host + url.receive_cell,
  512. method: 'POST',
  513. data: {
  514. formId: e.detail.formId,
  515. },
  516. success: res => {
  517. this.playGoldCoinAnimation()
  518. this.data.user.cell = this.data.user.cell + res.data.data
  519. app.globalData.user.cell = this.data.user.cell
  520. this.setData({
  521. addNum: 0,
  522. addTime: this.data.addDefTime,
  523. addTimeShow: '03:20:00'
  524. })
  525. setTimeout(function () {
  526. this.setData({
  527. user: this.data.user
  528. })
  529. }.bind(this), 1200)
  530. }
  531. })
  532. },
  533. playBrainFillAnimation: function () {
  534. var animation = wx.createAnimation()
  535. animation.opacity(1).step({ duration: 1400 })
  536. animation.opacity(0).step({ duration: 1400 })
  537. this.setData({
  538. brainFillAnim: animation.export()
  539. })
  540. },
  541. playGoldCoinAnimation: function () {
  542. //播放获取金币动画
  543. var rect = this.data.brainCountDomRect
  544. var rect2 = this.data.goldCoinDomRect
  545. var targetX = rect.x - rect2.x
  546. var targetY = rect.y - rect2.y
  547. var animations = new Array(6)
  548. for (var i = 0; i < 6; i++) {
  549. var animation = wx.createAnimation()
  550. var x = -60 + i * 25
  551. var y = 42 + (i % 2) * (13 - i)
  552. animation.translate(0, 0).step({ duration: 50 })
  553. animation.opacity(1).translate(x, y).scale(1.5).rotate3d(1, 0, 0, 0).step({ duration: 500, timingFunction: 'ease' })
  554. animation.opacity(0).translate(targetX, targetY).scale(1).rotate3d(0, 0, 0, 0).step({ duration: i * 120, timingFunction: 'ease-out' })
  555. animations[i] = animation
  556. }
  557. this.setData({
  558. goldCoinAnim1: animations[0].export(),
  559. goldCoinAnim2: animations[1].export(),
  560. goldCoinAnim3: animations[2].export(),
  561. goldCoinAnim4: animations[3].export(),
  562. goldCoinAnim5: animations[4].export(),
  563. goldCoinAnim6: animations[5].export()
  564. })
  565. },
  566. toCash: function () {
  567. if (lock.lockTapDelay()) {
  568. return
  569. }
  570. wx.navigateTo({
  571. url: '../cash/cash'
  572. })
  573. },
  574. toRoom: function (e) {
  575. if (lock.lockTapDelay()) {
  576. return
  577. }
  578. var room = this.data.room[e.currentTarget.id]
  579. if (room.curUser >= room.maxUser || room.countDown <= 0) {
  580. wx.showToast({
  581. title: '此房间已爆满,无法进入',
  582. icon: 'none'
  583. })
  584. return
  585. }
  586. if (this.data.lastGameId != room.gameId) {
  587. if (this.data.user.cell < this.data.rankDan.cellRoomCost) {
  588. if (app.server.shareCellLack < app.server.config.shareCellLackMax) {
  589. this.showBrainLackDialog()
  590. } else {
  591. wx.showToast({
  592. title: '脑力值不足',
  593. icon: 'none'
  594. })
  595. }
  596. return
  597. }
  598. var arr = common.starToFragment(app.server.config.rankDanList, app.server.starC)
  599. var rankDan = app.server.config.rankDanList[arr[0]]
  600. var limit = rankDan.roomLimit || 3
  601. if (app.server.playRoom >= limit){
  602. this.data.dialogRoom.title = '今天' + limit +'次娱乐赛次数已用完'
  603. this.showRoomDialog()
  604. return
  605. }
  606. }
  607. this.data.lastGameId = room.gameId
  608. wx.navigateTo({
  609. url: '../room/room?gameId=' + room.gameId
  610. })
  611. },
  612. toOpen: function (event) {
  613. if (lock.lockTapDelay()) {
  614. return
  615. }
  616. wx.navigateTo({
  617. url: '../open/open'
  618. })
  619. },
  620. toRule: function () {
  621. if (lock.lockTapDelay()) {
  622. return
  623. }
  624. wx.navigateTo({
  625. url: '../rules/rules'
  626. })
  627. },
  628. toRank: function () {
  629. if (lock.lockTapDelay()) {
  630. return
  631. }
  632. this.hideRoomDialog()
  633. if (this.data.rankInfo.canPlayRank) {
  634. wx.navigateTo({
  635. url: '../fragmentsList/fragmentsList'
  636. })
  637. } else {
  638. this.showRankDialog()
  639. }
  640. },
  641. toAdd: function () {
  642. if (lock.lockTapDelay()) {
  643. return
  644. }
  645. wx.navigateTo({
  646. url: '../add/add'
  647. })
  648. },
  649. wxvoid: function () {
  650. },
  651. showBrainLackDialog: function () {
  652. this.data.dialogBrainLack.hidden = false
  653. this.data.dialogBrainLack.button = '分享到群 赚取' + common.unit(this.data.maxAddNum) + '脑力值'
  654. this.setData({
  655. dialogBrainLack: this.data.dialogBrainLack
  656. })
  657. },
  658. hideBrainLackDialog: function () {
  659. this.data.dialogBrainLack.hidden = true
  660. this.setData({
  661. dialogBrainLack: this.data.dialogBrainLack
  662. })
  663. },
  664. showLoginDialog: function () {
  665. this.setData({
  666. dialogLogin: { hidden: false }
  667. })
  668. },
  669. hideLoginDialog: function () {
  670. this.setData({
  671. dialogLogin: { hidden: true }
  672. })
  673. },
  674. showRankDialog: function () {
  675. this.setData({
  676. dialogRank: {
  677. hidden: false,
  678. headImg: '../../resource/head_rank_no.png'
  679. }
  680. })
  681. },
  682. hideRankDialog: function () {
  683. this.setData({
  684. dialogRank: { hidden: true }
  685. })
  686. },
  687. showGeneralDialog: function () {
  688. this.data.dialogGeneral.hidden = false
  689. this.setData({
  690. dialogGeneral: this.data.dialogGeneral
  691. })
  692. },
  693. hideGeneralDialog: function () {
  694. this.setData({
  695. dialogGeneral: { hidden: true }
  696. })
  697. },
  698. showRoomDialog: function () {
  699. this.data.dialogRoom.hidden = false
  700. this.setData({
  701. dialogRoom: this.data.dialogRoom
  702. })
  703. },
  704. hideRoomDialog: function () {
  705. this.data.dialogRoom.hidden = true
  706. this.setData({
  707. dialogRoom: this.data.dialogRoom
  708. })
  709. },
  710. })