index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="page">
  3. <view class="container">
  4. <view style="width: 100%; margin-top: 20px;">
  5. <video style="width: 100%; border-radius: 10px 10px 10px 10px;" id="myVideo" ref="videoPlayer" src="http://hdcs-3.ifastore.com.cn:9005/api/media/visit?media=5bq35LmD5b+D6ams5qG25Lqn5ZOB5a6j5Lyg6KeG6aKRIyMyMDIzMTEyNTIwMzA1Nzc5Mi5tcDQ="
  6. @error="videoErrorCallback" controls></video>
  7. </view>
  8. <view style="width: 100%; height: 60%; margin-top: 10px; margin-bottom: 10px;" >
  9. <image style="height: 100%; border-radius: 10px 10px 10px 10px;" src="http://hdcs-3.ifastore.com.cn:9005/api/media/visit?media=5Lit55S15bGV5Lya5Y2w5Yi2LTIjIzIwMjMxMTI1MjAzMjE2Njg2LmpwZw=="></image>
  10. </view>
  11. <view style="width: 100%; margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; background-color: aliceblue;
  12. border-radius: 10px 10px 10px 10px;">
  13. <view style="display: flex; align-items: center; flex-direction: row; height: 50px; border-radius: 2%; "
  14. @click="makeCall">
  15. <text :style="getTextStyle(textFlag)">点击获取优惠价格(拨打400)</text>
  16. <view style="height: 30px; width: 30px; margin-left: 10px;">
  17. <image style="height: 100%; width: 100%;" :animation="animationData" mode="aspectFill" src="../../static/tel.png"></image>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. animationData: {},
  29. animation:null,
  30. textFlag:false
  31. }
  32. },
  33. onReady: function (res) {
  34. this.videoContext = uni.createVideoContext('myVideo')
  35. setTimeout(()=>{
  36. this.playVideo(); // 自动播放方法
  37. },1000)
  38. var animation = uni.createAnimation({
  39. duration: 500,
  40. timingFunction: 'ease',
  41. })
  42. setInterval(()=>{
  43. setTimeout(function() {
  44. this.animation = animation
  45. this.animation.scale(1,1).step()
  46. this.animation.scale(1.5,1.5).step()
  47. this.animationData = animation.export()
  48. this.textFlag = !this.textFlag
  49. }.bind(this), 1000);
  50. },1000)
  51. },
  52. onShow() {
  53. setTimeout(()=>{
  54. this.playVideo();
  55. },2000)
  56. },
  57. methods: {
  58. videoErrorCallback: function (e) {
  59. console.log('视频错误信息:')
  60. console.log(e.target.errMsg)
  61. },
  62. makeCall() {
  63. uni.makePhoneCall({
  64. phoneNumber: '4001019698',
  65. });
  66. },
  67. playVideo() {
  68. this.videoContext.play()
  69. },
  70. scaleAnimal(){
  71. this.animation.scale(2,2).step()
  72. this.animationData = animation.export()
  73. },
  74. getTextStyle(flag){
  75. if(flag){
  76. return 'font-size: 20px; color: red;'
  77. }else {
  78. return 'font-size: 20px; color: gold;'
  79. }
  80. }
  81. }
  82. }
  83. </script>
  84. <style>
  85. .page {
  86. display: flex;
  87. align-items: center;
  88. justify-content: center;
  89. background-color: #bee9fc;
  90. height: 100%;
  91. width: 100%;
  92. }
  93. .container {
  94. display: flex;
  95. flex-direction: column;
  96. align-items: center;
  97. width: 80%;
  98. height: 100%;
  99. }
  100. .text-area {
  101. display: flex;
  102. justify-content: center;
  103. }
  104. .title {
  105. font-size: 36rpx;
  106. color: #8f8f94;
  107. }
  108. </style>