index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div :class="classObj" class="app-wrapper" :style="{'--current-color': theme}">
  3. <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
  4. <sidebar class="sidebar-container"/>
  5. <div :class="{hasTagsView:needTagsView}" class="main-container">
  6. <div :class="{'fixed-header':fixedHeader}">
  7. <navbar />
  8. <tags-view v-if="needTagsView" />
  9. </div>
  10. <app-main />
  11. <right-panel>
  12. <settings />
  13. </right-panel>
  14. <el-dialog :title="call.title" :visible.sync="call.open" width="300px" append-to-body @close="closeDialog" >
  15. <div class="call_content">
  16. <el-input type="text" v-model="mobile" placeholder="请输入手机号" />
  17. <div class="number_list">
  18. <div class="number_item" @click="addNumber(1)"><p class="number">1</p></div>
  19. <div class="number_item" @click="addNumber(2)"><p class="number">2</p></div>
  20. <div class="number_item" @click="addNumber(3)"><p class="number">3</p></div>
  21. <div class="number_item" @click="addNumber(4)"><p class="number">4</p></div>
  22. <div class="number_item" @click="addNumber(5)"><p class="number">5</p></div>
  23. <div class="number_item" @click="addNumber(6)"><p class="number">6</p></div>
  24. <div class="number_item" @click="addNumber(7)"><p class="number">7</p></div>
  25. <div class="number_item" @click="addNumber(8)"><p class="number">8</p></div>
  26. <div class="number_item" @click="addNumber(9)"><p class="number">9</p></div>
  27. <div class="number_item" @click="addNumber('*')"><p class="number">*</p></div>
  28. <div class="number_item" @click="addNumber(0)"><p class="number">0</p></div>
  29. <div class="number_item" @click="addNumber('#')"><p class="number">#</p></div>
  30. </div>
  31. <div slot="footer" class="dialog-footer">
  32. <el-button @click="clearNumber()" >清空</el-button>
  33. <el-button type="primary" @click="callPhone()">呼叫</el-button>
  34. <el-button @click="delNumber()" >删除</el-button>
  35. </div>
  36. </div>
  37. </el-dialog>
  38. <!-- <div class="call" @click="openCall()">
  39. <img src="../assets/image/call.png"/>
  40. </div> -->
  41. <div class="call-controll" v-if="isCall">
  42. <div class="call-item">
  43. <div class="call-title">{{$store.state.user.callTitle}}</div>
  44. <img class="img" @click="callClose()" src="../assets/image/calloff.svg"/>
  45. </div>
  46. </div>
  47. <audio ref="audio" loop controls hidden="true" src="../assets/dudu.mp3"/>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import RightPanel from '@/components/RightPanel'
  53. import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components'
  54. import ResizeMixin from './mixin/ResizeHandler'
  55. import { mapState } from 'vuex'
  56. import variables from '@/assets/styles/variables.scss'
  57. export default {
  58. name: 'Layout',
  59. components: {
  60. AppMain,
  61. Navbar,
  62. RightPanel,
  63. Settings,
  64. Sidebar,
  65. TagsView
  66. },
  67. mixins: [ResizeMixin],
  68. computed: {
  69. ...mapState({
  70. theme: state => state.settings.theme,
  71. sideTheme: state => state.settings.sideTheme,
  72. sidebar: state => state.app.sidebar,
  73. device: state => state.app.device,
  74. needTagsView: state => state.settings.tagsView,
  75. fixedHeader: state => state.settings.fixedHeader,
  76. isCall:state => state.user.isCall,
  77. callTitle:state=>state.user.callTitle,
  78. }),
  79. classObj() {
  80. return {
  81. hideSidebar: !this.sidebar.opened,
  82. openSidebar: this.sidebar.opened,
  83. withoutAnimation: this.sidebar.withoutAnimation,
  84. mobile: this.device === 'mobile'
  85. }
  86. },
  87. variables() {
  88. return variables;
  89. }
  90. },
  91. data() {
  92. return {
  93. mobile: "",
  94. call: {
  95. open: false,
  96. title:'呼叫'
  97. }
  98. }
  99. },
  100. watch: {
  101. callTitle(newValue, oldValue) {
  102. if(newValue.indexOf("正在呼叫")!==-1){
  103. this.playAudio();
  104. }else{
  105. this.pauseAudio();
  106. }
  107. }
  108. },
  109. methods: {
  110. handleClickOutside() {
  111. this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
  112. },
  113. callClose(){
  114. this.callOff()
  115. this.$store.dispatch('CallOff')
  116. },
  117. playAudio() {
  118. let musicDu = new Audio();
  119. musicDu = require("../assets/dudu.mp3");
  120. this.$refs.audio.src = musicDu;
  121. this.$refs.audio.play();
  122. },
  123. pauseAudio(){
  124. this.$refs.audio.pause();
  125. },
  126. clearNumber(){
  127. this.mobile="";
  128. },
  129. addNumber(number){
  130. this.mobile=this.mobile+number
  131. },
  132. delNumber(){
  133. this.mobile= this.mobile.substring(0,this.mobile.length-1);
  134. },
  135. callPhone(){
  136. this.playAudio();
  137. },
  138. closeDialog(){
  139. this.clearNumber();
  140. },
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. @import "~@/assets/styles/mixin.scss";
  146. @import "~@/assets/styles/variables.scss";
  147. .app-wrapper {
  148. @include clearfix;
  149. position: relative;
  150. height: 100%;
  151. width: 100%;
  152. &.mobile.openSidebar {
  153. position: fixed;
  154. top: 0;
  155. }
  156. }
  157. .drawer-bg {
  158. background: #000;
  159. opacity: 0.3;
  160. width: 100%;
  161. top: 0;
  162. height: 100%;
  163. position: absolute;
  164. z-index: 999;
  165. }
  166. .fixed-header {
  167. position: fixed;
  168. top: 0;
  169. right: 0;
  170. z-index: 9;
  171. width: calc(100% - #{$base-sidebar-width});
  172. transition: width 0.28s;
  173. }
  174. .hideSidebar .fixed-header {
  175. width: calc(100% - 54px)
  176. }
  177. .mobile .fixed-header {
  178. width: 100%;
  179. }
  180. .call{
  181. background-color: #fff;
  182. z-index: 99;
  183. position: fixed;
  184. bottom: 50px;
  185. width:50px;
  186. height: 50px;
  187. padding: 10px;
  188. right:30px;
  189. border-radius: 20px;
  190. box-shadow:0px 0px 20px rgb(175, 175, 175);
  191. img{
  192. width:30px;
  193. height:30px;
  194. }
  195. }
  196. .call_content{
  197. .call_number{
  198. width: 100%;
  199. margin: 10px 0px;
  200. font-size: 28px;
  201. }
  202. }
  203. .number_list{
  204. display: flex;
  205. flex-wrap: wrap;
  206. align-items: center;
  207. justify-content: center;
  208. width: 100%;
  209. flex-direction: row;
  210. .number_item{
  211. width: 30%;
  212. height: 70px;
  213. display: flex;
  214. align-items: center;
  215. justify-content: center;
  216. .number{
  217. display: flex;
  218. align-items: center;
  219. justify-content: center;
  220. cursor: pointer;
  221. width: 50px;
  222. height:50px;
  223. border-radius: 50%;
  224. background: #fff;
  225. box-shadow:0px 0px 2px rgb(175, 175, 175);
  226. font-size: 24px;
  227. }
  228. }
  229. }
  230. .dialog-footer{
  231. margin: 10px 0px;
  232. text-align: center;
  233. }
  234. .call-controll{
  235. background-color: #fff;
  236. z-index: 999999;
  237. position: fixed;
  238. top: 120px;
  239. padding: 10px 15px;
  240. right:50px;
  241. border-radius: 20px;
  242. box-shadow:0px 0px 10px rgb(175, 175, 175);
  243. display: flex;
  244. align-items: center;
  245. justify-content: center;
  246. .call-item{
  247. display: flex;
  248. align-items: center;
  249. justify-content: center;
  250. .call-title{
  251. font-size: 16px;
  252. }
  253. .img{
  254. margin-left: 10px;
  255. width:30px;
  256. height:30px;
  257. }
  258. }
  259. }
  260. </style>