videoCall.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="page">
  3. <view class="v-shiping" v-if="call_data.content_type == 6">
  4. <view class="page-shipin">
  5. <view class="shipin"></view>
  6. </view>
  7. <view class="page-user-info">
  8. <view class="page-user-img">
  9. <image :src="user_info.photo||default_img">
  10. </image>
  11. </view>
  12. <view class="page-user-msg">
  13. <text class="page-user-name">{{user_info.username}}</text>
  14. <text class="page-invite-msg">{{info}}</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="v-yinpin" v-else>
  19. <view class="page-user-clunm">
  20. <image :src="user_info.photo||default_img"></image>
  21. <text>{{user_info.username}}</text>
  22. <text>{{info}}</text>
  23. </view>
  24. </view>
  25. <view class="page-bak"></view>
  26. <view class="page-do">
  27. <view class="page-do-guaduan" @tap="doCancel">
  28. <image src="/static/theme/default/my/guaduan.png"></image>
  29. <text>挂断</text>
  30. </view>
  31. <view class="page-do-jieting" @tap="doGetCall">
  32. <image src="/static/theme/default/my/jieting.png"></image>
  33. <text>接听</text>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import _get from '../../common/_get';
  40. import _action from '../../common/_action';
  41. import _data from '../../common/_data';
  42. import _hook from '../../common/_hook';
  43. export default {
  44. data () {
  45. return {
  46. back_in:false,
  47. back:false,
  48. click:true,
  49. // #ifdef APP-PLUS
  50. call:uni.requireNativePlugin('TUICallingUniPlugin-TUICallingModule'),
  51. // #endif
  52. call_data:{},
  53. user_info:{
  54. username:'',
  55. photo:'',
  56. },
  57. info:'',
  58. ret:false,
  59. default_img:'http://111.230.134.49:88/static/photo//default_photo_path.png?_=0.10315836224650199'
  60. }
  61. },
  62. onShow () {
  63. /** 监听新的个人数据 */
  64. let _this = this;
  65. _hook.routeSonHook();
  66. _this.user_info.photo = _data.staticPhoto()+_this.call_data.myavatar;
  67. _this.user_info.username = _this.call_data.name;
  68. _this.info = _this.call_data.wait;
  69. //关闭页面
  70. uni.$off('close_call');
  71. uni.$once('close_call',function(data){
  72. _this.back_in = true;
  73. let user = _data.data('user_info');
  74. if(user.id == data.user_id && !_this.back){
  75. _this.back = true;
  76. _action.stopVoice();
  77. uni.navigateBack();
  78. }
  79. });
  80. },
  81. onLoad (options) {
  82. this.call_data = options;
  83. _action.playVoice('/static/voice/video.mp3', true);
  84. },
  85. onHide () {
  86. },
  87. onUnload(){
  88. uni.$off('close_call');
  89. },
  90. computed: {
  91. },
  92. methods: {
  93. doCancel(){
  94. console.log("取消.....")
  95. let _this = this;
  96. _action.stopVoice();
  97. if(!_this.click){
  98. _this.back = true;
  99. uni.navigateBack({
  100. delta:1
  101. })
  102. return false;
  103. }
  104. _this.click = false;
  105. _get.cancelCall(_this.call_data,function (res) {
  106. });
  107. },
  108. doGetCall(){
  109. // #ifdef APP-PLUS
  110. //发送消息接受消息
  111. let _this = this;
  112. if(!_this.click){
  113. return false;
  114. }
  115. _action.stopVoice();
  116. _this.click = false;
  117. _get.agreeVedio(_this.call_data,function () {
  118. _this.call.call(
  119. {
  120. type: 1, //使用默认界面
  121. ..._this.call_data
  122. }, ret => {
  123. if(ret.code == 1 && ret.time != undefined && !_this.ret){
  124. _this.call_data.time = ret.time;
  125. _this.ret = true;
  126. _get.cancelCall(_this.call_data, function (res) {
  127. });
  128. }
  129. });
  130. });
  131. // #endif
  132. }
  133. },
  134. watch: {
  135. },
  136. }
  137. </script>
  138. <style>
  139. page{
  140. background-color: #424242;
  141. }
  142. .page-user-clunm{
  143. display: flex;
  144. justify-content: center;
  145. flex-direction: column;
  146. align-items: center;
  147. color: white;
  148. margin-top: 150rpx;
  149. }
  150. .page-bak{
  151. height: 500rpx;
  152. }
  153. .page-do{
  154. display: flex;
  155. align-items: center;
  156. justify-content: center;
  157. height:100%;
  158. }
  159. .page-user-name{
  160. font-size: 16px;
  161. font-weight: 400;
  162. }
  163. .page-user-info{
  164. margin-left: 60rpx;
  165. }
  166. .page-shipin{
  167. display: flex;
  168. justify-content: flex-end;
  169. }
  170. .page-do-guaduan{
  171. display: flex;
  172. justify-content: center;
  173. align-items: center;
  174. flex-direction: column;
  175. width:100%;
  176. color:#FFFFFF;
  177. }
  178. .page-do-guaduan image{
  179. width: 50px;
  180. height: 50px;
  181. padding: 20rpx 0;
  182. }
  183. .page-user-clunm image{
  184. width: 50px;
  185. height: 50px;
  186. padding: 20rpx 0;
  187. }
  188. .page-do-jieting image{
  189. width: 50px;
  190. height: 50px;
  191. padding: 20rpx 0;
  192. }
  193. .page-do-jieting{
  194. width:100%;
  195. display: flex;
  196. flex-direction: column;
  197. justify-content: center;
  198. align-items: center;
  199. color:#FFFFFF;
  200. }
  201. .page-user-img image{
  202. height: 50px;
  203. width: 50px;
  204. }
  205. .page-user-msg{
  206. display: flex;
  207. flex-direction: column;
  208. justify-content: center;
  209. margin-left: 20rpx;
  210. color: white;
  211. }
  212. .page-user-msg text{
  213. display: flex;
  214. }
  215. .page{
  216. height: 100%;
  217. display: flex;
  218. flex-direction: column;
  219. }
  220. .page .shipin {
  221. height: 400rpx;
  222. width: 220rpx;
  223. background-color: black;
  224. margin-right: 25rpx;
  225. margin-top:30rpx;
  226. }
  227. .page-user-info{
  228. display: flex;
  229. }
  230. </style>