index.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. import { getWaterDrop } from '../../../utils/index/index'
  2. import {closeCycleSecondaryScreen} from "../../../utils/index/callAmpe";
  3. const app = getApp()
  4. Page({
  5. data: {
  6. list: [{
  7. name: '基本设置',
  8. path: '/pages/settings/basicPage/index',
  9. icon: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/settings/one.png'
  10. },
  11. {
  12. name: '辖区设置',
  13. path: '/pages/settings/jurisdiction/index',
  14. icon: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/settings/two.png'
  15. },
  16. {
  17. name: '高级设置',
  18. path: '/pages/settings/advanced/index',
  19. icon: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/settings/three.png'
  20. },
  21. {
  22. name: '超时时长设置',
  23. path: '/pages/settings/timeoutDuration/index',
  24. icon: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/settings/four.png'
  25. },
  26. {
  27. name: '语音设置',
  28. path: '/pages/settings/voice/index',
  29. icon: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/settings/five.png'
  30. },
  31. {
  32. name: '密码设置',
  33. path: '/pages/settings/cipher/index',
  34. icon: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/settings/six.png'
  35. },
  36. {
  37. name: '受访人列表',
  38. path: '/pages/settings/interviewee/index',
  39. icon: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/settings/seven.png'
  40. },
  41. {
  42. name: '访客记录',
  43. path: '/pages/settings/visitorLog/index',
  44. icon: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/settings/eight.png'
  45. },
  46. {
  47. name: '退出应用',
  48. path: '',
  49. icon: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/settings/quitTheApp.png'
  50. },
  51. {
  52. name: '显示/隐藏导航栏',
  53. path: '',
  54. icon: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/settings/hideNavigationBar.png'
  55. },
  56. ],
  57. cusModalObj: {
  58. visible: false,
  59. },
  60. hideNavigationBarStatus: true,
  61. isPortraitScreen: false,// 是否为竖屏:true竖屏 false横屏
  62. screenIntervalId: null, //定时器
  63. },
  64. onLoad() {
  65. my.hideBackHome();
  66. const _this = this
  67. this.initScreenType().then(isPortraitScreenRes=>{
  68. console.log('isPortraitScreenRes', isPortraitScreenRes)
  69. _this.setData({
  70. isPortraitScreen: isPortraitScreenRes
  71. })
  72. })
  73. },
  74. initScreenType() {
  75. let that = this
  76. return new Promise((resolve,reject) => {
  77. if (app.globalData.isPortraitScreen) {
  78. if (app.globalData.isPortraitScreen != null) {
  79. resolve(app.globalData.isPortraitScreen)
  80. }
  81. } else {
  82. that.data.screenIntervalId = setInterval(function () {
  83. console.log('asdasdsaddasdad', app.globalData)
  84. if (app.globalData.isPortraitScreen != null) {
  85. resolve(app.globalData.isPortraitScreen)
  86. clearInterval(that.data.screenIntervalId);
  87. }
  88. }, 1000);
  89. }
  90. })
  91. },
  92. clickAudio(){
  93. getWaterDrop()
  94. },
  95. goto(e) {
  96. let item = e.currentTarget.dataset.item
  97. console.log(item)
  98. const _this = this;
  99. switch (item.name) {
  100. case '退出应用':
  101. _this.setData({
  102. 'cusModalObj.visible': true
  103. })
  104. break;
  105. case '显示/隐藏导航栏':
  106. _this.onHideNavigationBarFuc()
  107. break;
  108. default:
  109. my.reLaunch({
  110. url: item.path,
  111. })
  112. break
  113. }
  114. },
  115. // 退出应用
  116. onQuitTheAppFuc() {
  117. closeCycleSecondaryScreen()
  118. let params = {
  119. "action": "deviceConfig",
  120. "event": "open",
  121. "params": {
  122. "deviceConfig": {
  123. "exitApplet": 1
  124. }
  125. }
  126. }
  127. try {
  128. my.call("ampeHHCommunication", params, res => {
  129. console.log(res, '退出应用')
  130. // if (res.success) {
  131. // }
  132. })
  133. } catch (error) {
  134. console.log(error);
  135. }
  136. },
  137. // 隐藏底部导航栏
  138. onHideNavigationBarFuc() {
  139. let params = {
  140. "action": "deviceConfig",
  141. "event": "open",
  142. "params": {
  143. "deviceConfig": {
  144. "hideNavigationBar": this.data.hideNavigationBarStatus?1:2
  145. }
  146. }
  147. }
  148. try {
  149. let _this = this;
  150. my.call("ampeHHCommunication", params, res => {
  151. console.log(res, '显示/隐藏导航栏', this.data.hideNavigationBarStatus)
  152. if (res.success){
  153. _this.setData({
  154. hideNavigationBarStatus: !_this.data.hideNavigationBarStatus
  155. })
  156. }
  157. })
  158. } catch (error) {
  159. console.log(error);
  160. }
  161. },
  162. sure() {},
  163. onOk() {
  164. this.onQuitTheAppFuc()
  165. this.setData({
  166. 'cusModalObj.visible': false
  167. })
  168. },
  169. onCancel() {
  170. this.setData({
  171. 'cusModalObj.visible': false
  172. })
  173. }
  174. });