index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view class="cirumstances_wrap">
  3. <u-navbar placeholder :autoBack="true" title="环境监测" v-hideNav>
  4. <view class="u-nav-slot right_btn" slot="right">
  5. <view class="reset" @click="handleReset">
  6. <u-icon name="reload" color="#108CFF"></u-icon>刷新
  7. </view>
  8. </view>
  9. </u-navbar>
  10. <view class="option_list">
  11. <view class="option_item">
  12. <view class="item_left">
  13. <text class="label">登录用户</text>
  14. </view>
  15. <view class="item-right">
  16. <text>{{nickName}}</text>
  17. </view>
  18. </view>
  19. <template v-if="isCallOff === '1'">
  20. <view class="option_item">
  21. <view class="item_left">
  22. <text class="label">外呼分机号</text>
  23. </view>
  24. <view class="item-right">
  25. <text>{{callAccount ? callAccount.extenNum : "未配置分机号"}}</text>
  26. </view>
  27. </view>
  28. <view class="option_item">
  29. <view class="item_left">
  30. <text class="label">外呼注册状态</text>
  31. </view>
  32. <view class="item-right" @longpress="handleRegisterFun">
  33. <text v-if="callAccount != null && callSystem != null">
  34. {{ ipAddress }}
  35. </text>
  36. <text class="btn" v-else @click="handleRegisterFun">点击注册</text>
  37. <icon-img :value="callAccount != null && callSystem != null"></icon-img>
  38. </view>
  39. </view>
  40. <view class="option_item">
  41. <view class="item_left">
  42. <text class="label">外呼签入状态</text>
  43. </view>
  44. <view class="item-right">
  45. <text v-if="signInState">正常</text>
  46. <text class="btn" v-else @click="handleRegisterFun">点击签入</text>
  47. <icon-img :value="signInState"></icon-img>
  48. <icon-img :value="redisStatus"></icon-img>
  49. </view>
  50. </view>
  51. </template>
  52. <template v-else>
  53. <view class="option_item">
  54. <view class="item_left">
  55. <text class="label">呼叫中心</text>
  56. </view>
  57. <view class="item-right" @longpress="handleRegisterFun">
  58. <text>不启用</text>
  59. <icon-img :value="isCallOff === '1'"></icon-img>
  60. </view>
  61. </view>
  62. </template>
  63. <view class="option_item">
  64. <view class="item_left">
  65. <text class="label">麦克风权限</text>
  66. </view>
  67. <view class="item-right">
  68. <text v-if="isRecord">已授权</text>
  69. <text class="btn" v-else @click="handleOpenSet">点击授权</text>
  70. <icon-img :value="isRecord"></icon-img>
  71. </view>
  72. </view>
  73. <view class="option_item">
  74. <view class="item_left">
  75. <text class="label">定位服务</text>
  76. </view>
  77. <view class="item-right">
  78. <text v-if="systemLocation">已开启</text>
  79. <text v-else>未开启</text>
  80. <icon-img :value="systemLocation"></icon-img>
  81. </view>
  82. </view>
  83. <view class="option_item">
  84. <view class="item_left">
  85. <text class="label">定位权限</text>
  86. </view>
  87. <view class="item-right">
  88. <text v-if="isLocation">已授权</text>
  89. <text class="btn" v-else @click="handleOpenSet">点击授权</text>
  90. <icon-img :value="isLocation"></icon-img>
  91. </view>
  92. </view>
  93. <view class="option_item">
  94. <view class="item_left">
  95. <text class="label">X5引擎</text>
  96. </view>
  97. <view class="item-right">
  98. <text v-if="isX5">启用</text>
  99. <text v-else>不启用</text>
  100. <icon-img :value="isX5"></icon-img>
  101. </view>
  102. </view>
  103. <view class="option_item">
  104. <view class="item_left">
  105. <text class="label">品牌型号</text>
  106. </view>
  107. <view class="item-right">
  108. <text>{{deviceBrand}}</text>
  109. </view>
  110. </view>
  111. <view class="option_item">
  112. <view class="item_left">
  113. <text class="label">所用系统</text>
  114. </view>
  115. <view class="item-right">
  116. <text>{{system}}</text>
  117. </view>
  118. </view>
  119. </view>
  120. <view class="tips_wrap" @longpress="handleOpenSet">
  121. <view class="left">
  122. <image src="../../static/circumstances/success.png" mode="" class="icon_img">
  123. </image>
  124. <text>正常</text>
  125. </view>
  126. <view class="right">
  127. <image src="../../static/circumstances/error.png" mode="" class="icon_img"></image>
  128. <text>不正常</text>
  129. </view>
  130. </view>
  131. </view>
  132. </template>
  133. <script>
  134. import {
  135. mapState
  136. } from 'vuex';
  137. import iconImg from "./components/iconImg.vue"
  138. import permision from "@/js_sdk/wa-permission/permission.js";
  139. export default {
  140. components: {
  141. iconImg
  142. },
  143. computed: {
  144. ...mapState({
  145. nickName: (state) => state.user.userInfo.nickName,
  146. callAccount: (state) => state.app.callAccount,
  147. signInState: (state) => state.app.signInState,
  148. ipAddress: (state) => (state.app.registerInfo && state.app.registerInfo.register) ? state.app
  149. .registerInfo.register['IPv4'].slice(-3) : '异常',
  150. redisStatus: (state) => state.app.redisStatus,
  151. callSystem: (state) => state.app.callSystem,
  152. uuid: (state) => state.user.uuid,
  153. isCallOff : (state)=> state.user.netConfig.isCallOff
  154. }),
  155. },
  156. data() {
  157. return {
  158. isX5: false,
  159. isRecord: false,
  160. isLocation: false,
  161. system: "",
  162. deviceBrand: "",
  163. systemLocation: false
  164. }
  165. },
  166. methods: {
  167. // 刷新
  168. handleReset() {
  169. this.getAllStatus();
  170. uni.$u.toast("刷新成功");
  171. },
  172. // 打开设置
  173. handleOpenSet() {
  174. permision.gotoAppPermissionSetting("android.permission.RECORD_AUDIO");
  175. },
  176. // 注册
  177. handleRegisterFun() {
  178. this.$store.dispatch("app/getExtensionByUserId", {
  179. userId: this.$store.state.user.userInfo.userId
  180. }).then((res) => {
  181. Promise.all([permision.requestAndroidPermission("android.permission.RECORD_AUDIO"), permision
  182. .requestAndroidPermission('android.permission.MODIFY_AUDIO_SETTINGS')
  183. ]).then(result => {
  184. const flag = result.every(v => v == 1);
  185. if (flag) {
  186. this.$store.dispatch("app/createWv");
  187. }
  188. })
  189. });
  190. },
  191. // 检测定位服务是否开启
  192. checkSystemEnableLocation() {
  193. let context = plus.android.importClass("android.content.Context");
  194. let locationManager = plus.android.importClass("android.location.LocationManager");
  195. let main = plus.android.runtimeMainActivity();
  196. let mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  197. let result = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER);
  198. return result;
  199. },
  200. getAllStatus() {
  201. uni.getSystemInfo({
  202. success: (res) => {
  203. this.deviceBrand = res.deviceBrand + " " + res.model;
  204. this.system = res.system ? res.system : "获取失败";
  205. this.isX5 = res.browserName.includes("x5");
  206. }
  207. });
  208. permision.requestAndroidPermission("android.permission.RECORD_AUDIO").then(result => {
  209. this.isRecord = result == "1";
  210. });
  211. this.systemLocation = this.checkSystemEnableLocation();
  212. permision.requestAndroidPermission("android.permission.ACCESS_FINE_LOCATION").then(result => {
  213. this.isLocation = result == "1";
  214. });
  215. }
  216. },
  217. mounted() {
  218. this.getAllStatus();
  219. }
  220. }
  221. </script>
  222. <style lang="scss" scoped>
  223. .right_btn {
  224. display: flex;
  225. align-items: center;
  226. font-size: 14px;
  227. .copy_btn {
  228. display: flex;
  229. align-items: center;
  230. margin-right: 20rpx;
  231. }
  232. .reset {
  233. display: flex;
  234. align-items: center;
  235. }
  236. }
  237. .tips_wrap {
  238. display: flex;
  239. align-items: center;
  240. justify-content: space-evenly;
  241. height: 40px;
  242. background: #ececec;
  243. border-radius: 4px;
  244. margin-top: 15px;
  245. margin-left: 15px;
  246. margin-right: 15px;
  247. margin-bottom: 50px;
  248. .right {
  249. display: flex;
  250. align-items: center;
  251. }
  252. .left {
  253. display: flex;
  254. align-items: center;
  255. }
  256. .icon_img {
  257. width: 40rpx;
  258. height: 40rpx;
  259. margin-right: 20rpx;
  260. }
  261. }
  262. .option_list {
  263. margin-top: 30rpx;
  264. padding: 0 30rpx;
  265. .option_item {
  266. display: flex;
  267. justify-content: space-between;
  268. align-items: center;
  269. padding-bottom: 36rpx;
  270. padding-top: 36rpx;
  271. border-bottom: 2rpx solid #dfdfdf;
  272. .item_left {
  273. display: flex;
  274. align-items: center;
  275. image {
  276. width: 32rpx;
  277. height: 32rpx;
  278. margin-right: 20rpx;
  279. }
  280. .label {
  281. font-size: 28rpx;
  282. color: #202020;
  283. }
  284. }
  285. .item-right {
  286. display: flex;
  287. justify-content: space-between;
  288. align-items: center;
  289. text {
  290. font-size: 24rpx;
  291. color: #999999;
  292. margin-right: 10rpx;
  293. }
  294. .btn {
  295. color: #108CFF;
  296. }
  297. .icon_img {
  298. width: 40rpx;
  299. height: 40rpx;
  300. }
  301. }
  302. }
  303. }
  304. </style>