capturePicture.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. var _this, dataObj = [],heAnth = null;
  2. new Vue({
  3. el: '#app',
  4. filters: {
  5. getNew(key){
  6. let _sf = getDTime(new Date((key+"").length>10?parseInt(key):parseInt(key)*1000));
  7. return _sf[0] + _sf[1];
  8. },
  9. setImg(_key){
  10. return [_key]
  11. }
  12. },
  13. data: function() {
  14. return {
  15. dataLi: [],
  16. nowTab: {},
  17. pictureLi: [],
  18. nowDate: null,
  19. vidSrc: "",
  20. dialogVisible: false,
  21. disAb: true
  22. }
  23. },
  24. created() {
  25. _this = this;
  26. heAnth = JSON.parse(localStorage.getItem("nowShip"));
  27. _this.initAjax();
  28. },
  29. watch: {
  30. nowDate(newVal){
  31. if(newVal == null){
  32. _this.nowDate = null;
  33. _this.disAb = true;
  34. _this.initAjax();
  35. }else{
  36. _this.disAb = false;
  37. }
  38. }
  39. },
  40. mounted(){
  41. window.addEventListener('message',(data)=>{
  42. if(data.data.cmd == undefined){
  43. heAnth = JSON.parse(localStorage.getItem("nowShip"));
  44. _this.nowDate = null;
  45. _this.initAjax();
  46. }
  47. })
  48. },
  49. methods: {
  50. initAjax(){
  51. if(heAnth !=null && heAnth != "null"&&heAnth.other_info !=null && heAnth.other_info != ""){
  52. var dsd = heAnth.other_info.split(",");
  53. const loading = this.$loading({
  54. background: 'rgba(0, 0, 0, 0.4)'
  55. })
  56. let _opts = {
  57. url: helUrl + "/index.php?ctl=bruce&act=get_group_member_list",
  58. type:"POST"
  59. };
  60. let _data = {
  61. admin_id: 7903,
  62. udid: "11111111",
  63. g_id: dsd[0]
  64. };
  65. postAxios(_opts, _data, {}).then((res) =>{
  66. if(res.status){
  67. let _obj = res.data;
  68. _this.dataLi = _obj.filter(item => item.device_id == dsd[1]);
  69. _this.nowTab = _this.dataLi[0];
  70. _this.getPlay();
  71. }else{
  72. _this.dataLi = [];
  73. }
  74. loading.close();
  75. })
  76. }else{
  77. _this.dataLi = [];
  78. }
  79. },
  80. getPlay(){
  81. const sfdsg = this.$loading({
  82. background: 'rgba(0, 0, 0, 0.4)'
  83. })
  84. setTimeout(()=>{
  85. let _opts = {
  86. url: helUrl + "/index.php?ctl=report&act=get_user_image",
  87. type:"POST"
  88. };
  89. let _data = {
  90. user_id: _this.nowTab.user_id,
  91. p: 1
  92. };
  93. let _dataY = {
  94. user_id: _this.nowTab.user_id,
  95. date: _this.nowDate,
  96. p: 1
  97. };
  98. postAxios(_opts,(_this.nowDate!=null?_dataY:_data), {}).then((res) =>{
  99. if(res.status){
  100. _this.pictureLi = res.data;
  101. }else{
  102. _this.pictureLi = [];
  103. }
  104. sfdsg.close();
  105. })
  106. },200)
  107. },
  108. changTab(id){
  109. let ind = _this.dataLi.findIndex((it,ind) => {return id == it.device_id});
  110. if(ind != -1){
  111. if(_this.dataLi[ind].device_id != _this.nowTab.device_id){
  112. _this.nowTab = _this.dataLi[ind];
  113. _this.getPlay();
  114. }
  115. }
  116. },
  117. handleClose(done) {
  118. _this.vidSrc = "";
  119. _this.dialogVisible = false;
  120. },
  121. prenDay(nu){
  122. if(_this.nowDate != null){
  123. let _dat = dayChange(_this.nowDate, parseInt(nu));
  124. if(_dat != undefined){
  125. _this.nowDate = getDTime(_dat)[0];
  126. _this.getPlay();
  127. }
  128. }else{
  129. _this.$message({
  130. message: '请先选择时间!',
  131. type: 'warning'
  132. });
  133. }
  134. },
  135. pickCli(ev){
  136. if(ev != null){
  137. _this.getPlay();
  138. }
  139. }
  140. }
  141. })