list.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <view>
  3. <view class="tuan-detail-header">
  4. <swiper v-if="info.lx==1" :indicator-dots="true" indicator-color="rgba(255,255,255,.3)" indicator-active-color="#ffffff" class="tuan-detail-swiper" :autoplay="true" :interval="3000" :duration="400">
  5. <swiper-item style="text-align: center;">
  6. <video id="myVideo" :poster="info.img" :show-center-play-btn="playbtn" :autoplay="autoplay" style="width: 100%;" @timeupdate="timeupdate" :src="info.videourl"></video>
  7. </swiper-item>
  8. </swiper>
  9. </view>
  10. <view class="row" style="margin-bottom: 40upx;">
  11. <block v-for="(value,key) in info.video" :key="key">
  12. <button @click="op(info.id,value.id,value.lx)" class="mini-btn ft12" :type="info.pid==value.id?'warn':'primary'" size="mini">{{value.name}}</button>
  13. </block>
  14. </view>
  15. <view class="tuan-detail-tit pd20_15">
  16. <view class="ft18 cl-main ftw600">{{info.name}}</view>
  17. <view class="flex alcenter space mt12">
  18. <view class="flex alcenter">
  19. <text class="ft14 cl-orange">会员价:</text>
  20. <text class="ft16 cl-orange ftw600">¥{{info.vipprice}}</text>
  21. <text class="ml10 ft12 cl-notice">普通价:</text>
  22. <text class="ft12 cl-notice text-line">¥{{info.price}}</text>
  23. </view>
  24. <view class="cl-notice ft12">{{info.updatetime}}</view>
  25. </view>
  26. </view>
  27. <view class="mt24" style="margin:30upx 30upx 0 30upx;box-shadow: 0px 4px 20px 0px rgba(0,0,0,0.04);">
  28. <home-banner :banners="banners"></home-banner>
  29. </view>
  30. <home-default :datasa="datasa"></home-default>
  31. <view class="form-footer-h">
  32. <view class="form-footer-h form-footer">
  33. <view class="form-footer-main pd10_15 flex alcenter space">
  34. <view class="flex alcenter space" style="width: calc(100% - 400rpx);">
  35. <navigator open-type="reLaunch" url="/pages/client/index">
  36. <view class="form-footer-item text-center">
  37. <view class="iconfont iconicon_bottom_home ft22"></view>
  38. <view class="ft12 mt8">首页</view>
  39. </view>
  40. </navigator>
  41. <view @click="contactAct" class="form-footer-item text-center ">
  42. <view class="iconfont iconicon_bottom_call ft22"></view>
  43. <view class="ft12 mt8">联系</view>
  44. </view>
  45. <button @click="vipcard" class="form-footer-item text-center ">
  46. <view class="iconfont icontabbar01 ft22"></view>
  47. <view class="ft12 mt8">开通VIP</view>
  48. </button>
  49. </view>
  50. <button v-if="info.isplay==0" @click="buyAct" class="btn-big" style="width: 288rpx;" :style="getBtnStyle">¥{{price}}购买</button>
  51. <button v-if="info.isplay==1" class="btn-big" style="width: 288rpx; color: #ffffff; background: #C0C0C0!important;">{{isplaytext}}</button>
  52. </view>
  53. </view>
  54. </view>
  55. <dialog-login v-if="showLogin" @loginYes="loginYes" @closed="showLogin = false"></dialog-login>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data(){
  61. return {
  62. isLogin:false,
  63. showLogin:false,
  64. autoplay:false,
  65. playbtn:true,
  66. selectIndex:0,
  67. tabs:['详情'],
  68. nextStep:'',
  69. datasa:[],
  70. dataconfig:[],
  71. id:'',
  72. mid:0,
  73. info:[],
  74. dda:'',
  75. price:'',
  76. banners:[],
  77. isplaytext:'已经购买',
  78. audioAction: {
  79. method: 'pause'
  80. }
  81. }
  82. },
  83. onLoad(option){
  84. this.dda=uni.createVideoContext('myVideo')
  85. if(option.id){
  86. this.id=option.id
  87. }
  88. if(option.mid){
  89. this.mid=option.mid
  90. }
  91. this.getList();
  92. },
  93. onShow() {
  94. this.$zaudio.stop();
  95. this.getinfo(this.id);
  96. if(uni.getStorageSync("userinfo").token){
  97. this.isLogin = true
  98. this.showLogin = false
  99. }
  100. this.banners=uni.getStorageSync("config").banner
  101. },
  102. onHide() {
  103. this.dda.pause()
  104. },
  105. onShareAppMessage(e){
  106. },
  107. onShareTimeline(e){
  108. },
  109. methods:{
  110. timeupdate(event){
  111. let _this=this;
  112. let currentTime = event.detail.currentTime
  113. if(currentTime>this.info.mrseek && this.info.isplay==0){
  114. //dda.exitFullScreen()
  115. this.dda.seek(this.info.mrseek)
  116. this.dda.pause()
  117. this.dda.stop()
  118. uni.showModal({
  119. title: '温馨提示',
  120. content: '没权限观看当前视频',
  121. showCancel: false,
  122. confirmText: "确定",
  123. success: function (res) {
  124. if (res.confirm) {
  125. } else if (res.cancel) {
  126. }
  127. }
  128. });
  129. }
  130. },
  131. getinfo(id) {
  132. let data = {};
  133. data.id=id
  134. data.mid=this.mid
  135. if(uni.getStorageSync("userinfo").token){
  136. data.token=uni.getStorageSync("userinfo").token
  137. this.isLogin = true
  138. }
  139. uni.request({
  140. url: this.configs.webUrl+'/api/video/info',
  141. data: data,
  142. success: data => {
  143. if(uni.getStorageSync("userinfo").token){
  144. if(data.data.isvip>1){
  145. this.price=data.data.vipprice
  146. }else{
  147. this.price=data.data.price
  148. }
  149. }else{
  150. this.price=data.data.price
  151. }
  152. data.data.pricebuy=this.price
  153. this.info=[];
  154. this.info=data.data
  155. if(data.data.isvip>1){
  156. if(data.data.vipprice*1==0){
  157. this.isplaytext='VIP免费'
  158. }
  159. }else{
  160. if(data.data.price*1==0){
  161. this.isplaytext='免费视频'
  162. }
  163. }
  164. uni.setNavigationBarTitle({
  165. title: this.info.name
  166. });
  167. },
  168. fail: (data, code) => {
  169. }
  170. });
  171. },
  172. getList() {
  173. let data = {
  174. //column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名
  175. };
  176. var limit=10;
  177. data.limit=limit
  178. data.ishot=2
  179. uni.request({
  180. url: this.configs.webUrl+'/api/video/lists',
  181. data: data,
  182. success: data => {
  183. uni.setStorage({//缓存配置信息
  184. key: 'config',
  185. data: data.data.config
  186. })
  187. if (data.data.total>0) {
  188. this.dataconfig=data.data.config
  189. this.datasa=data.data.rows
  190. }
  191. },
  192. fail: (data, code) => {
  193. }
  194. });
  195. },
  196. contactAct(){
  197. if(this.isLogin == false){
  198. this.showLogin = true;
  199. this.nextStep = 'contact';
  200. }else{
  201. uni.navigateTo({
  202. url:'/pages/client/vipcard/adviser'
  203. })
  204. }
  205. },
  206. vipcard(){
  207. uni.navigateTo({
  208. url:'/pages/client/vipcard/index'
  209. })
  210. },
  211. op(id,mid,lx){
  212. if(lx==1){
  213. var fxpid=1
  214. if(uni.getStorageSync("userinfo")){
  215. fxpid=uni.getStorageSync("userinfo").id
  216. }
  217. uni.navigateTo({
  218. url:'/pages/client/tuan/detail?id='+id+'&mid='+mid+'&fxpid='+fxpid
  219. })
  220. }else if(lx==2){
  221. uni.navigateTo({
  222. url:'/pages/client/tuan/audio?id='+id+'&mid='+mid
  223. })
  224. }else if(lx==3){
  225. uni.navigateTo({
  226. url:'/pages/client/tuan/text?id='+id+'&mid='+mid
  227. })
  228. }else{
  229. uni.navigateTo({
  230. url:'/pages/client/tuan/list?id='+id+'&mid='+mid
  231. })
  232. }
  233. },
  234. buyAct(){
  235. if(this.price*1==0){
  236. uni.showToast({ title: '免费视频不需要购买',icon:"none" });
  237. return false;
  238. }
  239. if(this.isLogin == false){
  240. this.showLogin = true;
  241. this.nextStep = 'buy';
  242. }else{
  243. uni.setStorage({//缓存配置信息
  244. key: 'buydata',
  245. data: this.info
  246. })
  247. uni.navigateTo({
  248. url:'/pages/client/tuan/buy?id='+this.id
  249. })
  250. }
  251. },
  252. loginYes(){
  253. if(this.nextStep == 'buy'){
  254. uni.navigateTo({
  255. url:'/pages/client/tuan/buy'
  256. })
  257. }else{
  258. uni.navigateTo({
  259. url:'/pages/client/vipcard/adviser'
  260. })
  261. }
  262. },
  263. changeIndex(index){
  264. this.selectIndex = index;
  265. }
  266. }
  267. }
  268. </script>
  269. <style>
  270. .user-not-vip{
  271. width: 100%;
  272. height: 80rpx;
  273. background: #FDF6EC;
  274. border-radius: 40rpx;
  275. border: 2rpx solid #EFC381;
  276. text-align: center;
  277. line-height: 76rpx;
  278. font-size: 24rpx;
  279. color:#000000;
  280. font-weight: bold;
  281. }
  282. .tuan-detail-header{
  283. position: relative;
  284. }
  285. .tuan-detail-swiper{
  286. height: 500rpx;
  287. }
  288. .tuan-detail-swiper image{
  289. width: 100%;
  290. height: 500rpx;
  291. background: #F2F2F2;
  292. }
  293. .tuan-detail-tit{
  294. width: 100%;
  295. background: #FFFFFF;
  296. border-radius: 40rpx 40rpx 0rpx 0rpx;
  297. position: relative;
  298. margin-top: -32rpx;
  299. }
  300. .tuan-detail-content-tab{
  301. height: 102rpx;
  302. }
  303. .tuan-detail-content{
  304. min-height: calc(100vh - 600rpx);
  305. background: #FFFFFF;
  306. }
  307. .tuan-product-l{
  308. width: 320rpx;
  309. height: 240rpx;
  310. border-radius: 16rpx;
  311. background: #F2F2F2;
  312. }
  313. .tuan-product-r{
  314. width: calc(100% - 320rpx);
  315. }
  316. .cl-orange1{
  317. margin-right: 10upx;
  318. padding: 15upx;
  319. border: 1px solid #CCCCCC;
  320. }
  321. .mini-btn{
  322. margin-left: 10upx;
  323. margin-bottom: 10upx;
  324. }
  325. </style>