detail.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <view class="content" v-if="content">
  3. <view class="acitve-content">
  4. <video autoplay :src="content" controls></video>
  5. </view>
  6. <view class="titles">{{title}}</view>
  7. </view>
  8. </template>
  9. <script>
  10. import { promoTerminalDetail } from '@/api/video.js'
  11. export default {
  12. data() {
  13. return {
  14. title: null,
  15. content: '',
  16. id: null
  17. }
  18. },
  19. onLoad(opts) {
  20. if(opts.form=='videoList'){
  21. this.title = opts.title
  22. this.content = opts.content
  23. }else{
  24. this.id = opts.sn
  25. this.getDetail()
  26. }
  27. },
  28. methods: {
  29. getDetail(){
  30. promoTerminalDetail({sn:this.id}).then(res => {
  31. this.title = res.data.name
  32. this.content = res.data.content
  33. uni.setNavigationBarTitle({
  34. title: res.data.name || '活动内容'
  35. })
  36. })
  37. }
  38. }
  39. }
  40. </script>
  41. <style lang="less">
  42. page{
  43. padding: 0;
  44. }
  45. .content{
  46. padding: 0;
  47. .titles{
  48. text-align: center;
  49. padding: 20rpx;
  50. font-weight: bold;
  51. }
  52. .acitve-content{
  53. padding: 0;
  54. video{
  55. width:100%;
  56. }
  57. }
  58. }
  59. </style>