index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. import Vue from "vue";
  2. import {
  3. $showBroadcast,
  4. $hideBroadcast,
  5. $showLoading,
  6. $hideLoading
  7. } from '@/components/popupLayout'
  8. import {$showHotspot,$hideHotspot } from '@/components/hotspot/index.js'
  9. import '@/assets/theme/theme.less'
  10. import {axios, serverName,orginLink} from '../config/http'
  11. import {formatTime} from '../config/utils'
  12. Vue.prototype.$http = axios
  13. Vue.prototype.$serverName = serverName
  14. Vue.prototype.$orginLink = orginLink
  15. Vue.prototype.$bus = new Vue()
  16. Vue.config.productionTip = false
  17. import stitle from "@/components/sTitle";
  18. import sradio from "@/components/radio";
  19. import sbutton from "@/components/sbutton";
  20. import Danmaku from "@/components/Danmaku";
  21. import maside from "@/components/aside";
  22. import returnhome from "@/newcomponents/returnhome";
  23. import clickoutside from "./v-clickoutside";
  24. import clickwindow from "./v-clickwindow";
  25. import { mapState } from "vuex";
  26. let type = [
  27. {
  28. count:1,
  29. name:'Bye'
  30. },
  31. {
  32. count:1,
  33. name:'Greeting'
  34. },
  35. {
  36. count:1,
  37. name:'Right'
  38. },
  39. {
  40. count:'infiniten',
  41. fps: 16,
  42. name:'Speaking1'
  43. },
  44. {
  45. count:'infiniten',
  46. fps: 16,
  47. name:'Speaking2'
  48. },
  49. {
  50. count:'infiniten',
  51. fps: 16,
  52. name:'Speaking3'
  53. },
  54. {
  55. count:'infiniten',
  56. fps: 16,
  57. name:'Speaking4'
  58. },
  59. {
  60. count:'infiniten',
  61. fps: 16,
  62. name:'Speaking5'
  63. },
  64. {
  65. count:1,
  66. name:'Wrong'
  67. },
  68. ]
  69. let g_roleType = {};
  70. ['female_1','female_2','male'].forEach(item => {
  71. let tmp = {}
  72. type.forEach(ii=>{
  73. tmp[ii.name] = {
  74. img: ii.name + '.png',
  75. count: ii.count,
  76. fps: ii.fps,
  77. xingbie: item
  78. }
  79. })
  80. g_roleType[item] = tmp
  81. });
  82. let g_typeStr ={
  83. '1':'一级专家',
  84. '2':'二级专家',
  85. '3':'三级专家',
  86. '4':'院士',
  87. '5':'其他专家',
  88. }
  89. Vue.mixin({
  90. components:{stitle,sradio,sbutton,Danmaku,maside,returnhome},
  91. data(){
  92. return{
  93. g_typeStr,
  94. g_roleType,
  95. g_defaultAvatar:require('@/assets/images/xinjiang/defaultImg.jpg')
  96. }
  97. },
  98. directives: {
  99. clickoutside: clickoutside,
  100. clickwindow: clickwindow,
  101. },
  102. computed: {
  103. ...mapState({
  104. userInfo: (state) => state.common.userInfo,
  105. theme: (state) => state.common.theme
  106. }),
  107. token(){
  108. let token = (window.localStorage.getItem('webtoken')&&window.localStorage.getItem('webtoken')) || ''
  109. return token
  110. }
  111. },
  112. methods: {
  113. $showBroadcast,
  114. $hideBroadcast,
  115. $showHotspot,
  116. $hideHotspot,
  117. $showLoading,
  118. $hideLoading,
  119. g_dealUrl(src){
  120. return window.manage.dealURL(src)
  121. },
  122. handleHighLight(str,key){
  123. if (!str) {
  124. return '-'
  125. }
  126. let tmp = str.replace(RegExp(key, "g"), `<span style="color:#ffe0a6;font-size:inherit;">${key}</span>`)
  127. console.log(tmp);
  128. return tmp
  129. },
  130. handleContent(content,fontsize=16){
  131. if (!content) {
  132. return ''
  133. }
  134. var reg = new RegExp(' {4}', 'g');//g就是代表全部
  135. return content.replace(reg , `<span style="display:inline-block;width:${fontsize*2}px;"></span>`);
  136. },
  137. formatTime,
  138. changetohttp(url){
  139. if (url[0] == '/') {
  140. return url
  141. }
  142. if (url.indexOf('https')<0||url.indexOf('http')<0) {
  143. url = 'http://' + url
  144. }
  145. return url;
  146. }
  147. }
  148. })