getVideo.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view class="container">
  3. <view class="input-box flex-y-center">
  4. <textarea @input="getVideo" type="text" value="" placeholder="请粘贴分享链接,支持某音、某山、某瓜等" />
  5. </view>
  6. <view class="btm-btn" @click="getup">一键抓取</view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. data() {
  12. return {
  13. num: ""
  14. }
  15. },
  16. onLoad() {
  17. },
  18. methods: {
  19. getVideo(e){
  20. this.video_url=e.detail.value;
  21. },
  22. getup(e){
  23. this.request({
  24. url: "videofuneng/video_down",
  25. data:{
  26. url:this.video_url,
  27. },
  28. }).then(res => {
  29. console.log(res, "res")
  30. if (res.code === '200') {
  31. var video_url=res.data.video_url,
  32. video_otherurl=res.data.video_otherurl;
  33. uni.setStorageSync("video_url",video_url);
  34. var pages = getCurrentPages();
  35. var prevPage = pages[pages.length - 2]; //上一个页面
  36. //直接调用上一个页面的setData()方法,把数据存到上一个页面中去
  37. // 上一个页面最后设置userdata
  38. //小程序用setData带参
  39. // #ifdef H5
  40. prevPage.$vm.is_video = 2;
  41. prevPage.$vm.video_otherurl=video_otherurl;
  42. // #endif
  43. // #ifdef MP-WEIXIN
  44. prevPage.setData({
  45. is_video:2,
  46. video_otherurl,
  47. })
  48. // #endif
  49. uni.navigateBack();
  50. }
  51. }).catch((res) => {
  52. uni.showToast({
  53. title: res.message,
  54. icon: 'none'
  55. })
  56. });
  57. },
  58. jihuo() {
  59. if (this.num === '') {
  60. uni.showToast({
  61. title: "请输入账号",
  62. icon: "none"
  63. })
  64. return false
  65. }
  66. this.request({
  67. url: "user/bind",
  68. data: {
  69. code: this.num,
  70. token: uni.getStorageSync("token"),
  71. },
  72. }).then(res => {
  73. console.log(res, "res")
  74. if (res.code === '200') {
  75. uni.showToast({
  76. title: "激活成功",
  77. icon: 'none'
  78. })
  79. setTimeout(() => {
  80. uni.navigateBack({
  81. delta: 1
  82. })
  83. }, 2000)
  84. }
  85. }).catch((res) => {
  86. uni.showToast({
  87. title: res.message,
  88. icon: 'none'
  89. })
  90. });
  91. }
  92. }
  93. }
  94. </script>
  95. <style>
  96. page {
  97. background-color: #FDFDFE;
  98. }
  99. .container {
  100. height: calc(100vh - var(--window-top));
  101. position: relative;
  102. }
  103. .bg-img {
  104. display: block;
  105. width: 100%;
  106. height: 317rpx;
  107. }
  108. .input-box {
  109. width: 670rpx;
  110. margin: 0 auto;
  111. }
  112. .input-box textarea {
  113. background: #ffffff;
  114. border-radius: 8rpx;
  115. box-shadow: 0px 0px 14rpx 0px rgba(162, 180, 203, 0.25);
  116. height: 250rpx;
  117. width: 100%;
  118. padding: 20rpx;
  119. }
  120. /*
  121. .input-box {
  122. width: 670rpx;
  123. background: #ffffff;
  124. border-radius: 8rpx;
  125. box-shadow: 0 0 14rpx 0 rgba(162, 180, 203, 0.25);
  126. margin: 10rpx auto;
  127. box-sizing: border-box;
  128. padding: 0 40rpx;
  129. font-size: 30rpx;
  130. } */
  131. .btm-btn {
  132. width: 670rpx;
  133. height: 98rpx;
  134. background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
  135. border-radius: 8rpx;
  136. box-shadow: 0px 0px 8rpx 0px rgba(51, 135, 255, 0.2);
  137. font-size: 32rpx;
  138. font-weight: 500;
  139. text-align: center;
  140. color: #fff;
  141. line-height: 98rpx;
  142. position: absolute;
  143. left: 40rpx;
  144. bottom: 120rpx;
  145. }
  146. .saoma {
  147. width: 50rpx;
  148. height: 50rpx;margin-left: 20rpx;
  149. }
  150. </style>