index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. import {
  140. startPhoneListener,
  141. stopPhoneListener,
  142. checkIsAutoRecord,
  143. toCallAutoRecorderPage,
  144. navigateToCallRecordingSettings,
  145. jumpToPermissionPage,
  146. makePhoneCall,
  147. allRecorderFilesAction,
  148. } from '@/uni_modules/yao-lister';
  149. export default {
  150. components: {
  151. iconImg
  152. },
  153. computed: {
  154. ...mapState({
  155. nickName: (state) => state.user.userInfo.nickName,
  156. callAccount: (state) => state.app.callAccount,
  157. signInState: (state) => state.app.signInState,
  158. ipAddress: (state) => (state.app.registerInfo && state.app.registerInfo.register) ? state.app
  159. .registerInfo.register['IPv4'].slice(-3) : '异常',
  160. redisStatus: (state) => state.app.redisStatus,
  161. callSystem: (state) => state.app.callSystem,
  162. uuid: (state) => state.user.uuid,
  163. isCallOff : (state)=> state.user.netConfig.isCallOff
  164. }),
  165. },
  166. data() {
  167. return {
  168. isX5: false,
  169. isRecord: false,
  170. isLocation: false,
  171. system: "",
  172. deviceBrand: "",
  173. systemLocation: false
  174. }
  175. },
  176. methods: {
  177. // 刷新
  178. handleReset() {
  179. this.getAllStatus();
  180. uni.$u.toast("刷新成功");
  181. },
  182. // 打开设置
  183. handleOpenSet() {
  184. permision.gotoAppPermissionSetting("android.permission.RECORD_AUDIO");
  185. },
  186. // 注册
  187. handleRegisterFun() {
  188. this.$store.dispatch("app/getExtensionByUserId", {
  189. userId: this.$store.state.user.userInfo.userId
  190. }).then((res) => {
  191. Promise.all([permision.requestAndroidPermission("android.permission.RECORD_AUDIO"), permision
  192. .requestAndroidPermission('android.permission.MODIFY_AUDIO_SETTINGS')
  193. ]).then(result => {
  194. const flag = result.every(v => v == 1);
  195. if (flag) {
  196. this.$store.dispatch("app/createWv");
  197. }
  198. })
  199. });
  200. },
  201. // 检测定位服务是否开启
  202. checkSystemEnableLocation() {
  203. let context = plus.android.importClass("android.content.Context");
  204. let locationManager = plus.android.importClass("android.location.LocationManager");
  205. let main = plus.android.runtimeMainActivity();
  206. let mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  207. let result = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER);
  208. return result;
  209. },
  210. getAllStatus() {
  211. uni.getSystemInfo({
  212. success: (res) => {
  213. this.deviceBrand = res.deviceBrand + " " + res.model;
  214. this.system = res.system ? res.system : "获取失败";
  215. this.isX5 = res.browserName.includes("x5");
  216. }
  217. });
  218. permision.requestAndroidPermission("android.permission.RECORD_AUDIO").then(result => {
  219. this.isRecord = result == "1";
  220. });
  221. this.systemLocation = this.checkSystemEnableLocation();
  222. permision.requestAndroidPermission("android.permission.ACCESS_FINE_LOCATION").then(result => {
  223. this.isLocation = result == "1";
  224. });
  225. }
  226. },
  227. mounted() {
  228. this.getAllStatus();
  229. }
  230. }
  231. </script>
  232. <style lang="scss" scoped>
  233. .right_btn {
  234. display: flex;
  235. align-items: center;
  236. font-size: 14px;
  237. .copy_btn {
  238. display: flex;
  239. align-items: center;
  240. margin-right: 20rpx;
  241. }
  242. .reset {
  243. display: flex;
  244. align-items: center;
  245. }
  246. }
  247. .tips_wrap {
  248. display: flex;
  249. align-items: center;
  250. justify-content: space-evenly;
  251. height: 40px;
  252. background: #ececec;
  253. border-radius: 4px;
  254. margin-top: 15px;
  255. margin-left: 15px;
  256. margin-right: 15px;
  257. margin-bottom: 50px;
  258. .right {
  259. display: flex;
  260. align-items: center;
  261. }
  262. .left {
  263. display: flex;
  264. align-items: center;
  265. }
  266. .icon_img {
  267. width: 40rpx;
  268. height: 40rpx;
  269. margin-right: 20rpx;
  270. }
  271. }
  272. .option_list {
  273. margin-top: 30rpx;
  274. padding: 0 30rpx;
  275. .option_item {
  276. display: flex;
  277. justify-content: space-between;
  278. align-items: center;
  279. padding-bottom: 36rpx;
  280. padding-top: 36rpx;
  281. border-bottom: 2rpx solid #dfdfdf;
  282. .item_left {
  283. display: flex;
  284. align-items: center;
  285. image {
  286. width: 32rpx;
  287. height: 32rpx;
  288. margin-right: 20rpx;
  289. }
  290. .label {
  291. font-size: 28rpx;
  292. color: #202020;
  293. }
  294. }
  295. .item-right {
  296. display: flex;
  297. justify-content: space-between;
  298. align-items: center;
  299. text {
  300. font-size: 24rpx;
  301. color: #999999;
  302. margin-right: 10rpx;
  303. }
  304. .btn {
  305. color: #108CFF;
  306. }
  307. .icon_img {
  308. width: 40rpx;
  309. height: 40rpx;
  310. }
  311. }
  312. }
  313. }
  314. </style>