navDet.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <view class="container">
  3. <view class="conwarp">
  4. <view class="gdHead dffs">
  5. <view class="head flex1">{{ goodInfo.info.name }}</view>
  6. <text v-for="(item, index) in goodInfo.info.tags.split('|')" class="desc">{{ item }}</text>
  7. </view>
  8. <view class="subtit textgrey fontssm">{{ goodInfo.info.desc }}</view>
  9. <block v-if="goodInfo.class_vedio_status == 1">
  10. <view v-if="goodInfo.info.vedio" class="cl-one">
  11. <video class="vidBox" :src="goodInfo.info.vedio" controls></video>
  12. </view>
  13. </block>
  14. </view>
  15. <view class="conwarp">
  16. <view class="gdHead"><view class="head">解析文档</view></view>
  17. <view class="cl-one">
  18. <view class="xqcont">
  19. <u-parse :content="goodInfo.info.content"></u-parse>
  20. <!-- <view class="xqleft dffd">
  21. <image
  22. @click="cliCot(1)"
  23. class="small"
  24. :src="goodInfo.info.is_collection == 1 ? '/static/img/pro/navcolsel.png' : '/static/img/pro/navcol.png'"
  25. mode=""
  26. ></image>
  27. <view class="word">收藏</view>
  28. <image @click="cliCot(2)" class="big" :src="goodInfo.info.is_give == 1 ? '/static/img/pro/navgodsel.png' : '/static/img/pro/navgod.png'" mode=""></image>
  29. <view class="word">{{ goodInfo.info.like_num || 0 }}</view>
  30. <button open-type="share" class=" shareBtn " type="default">
  31. <image class="small" src="/static/img/pro/navshare.png" mode=""></image>
  32. <view class="word">分享</view>
  33. </button>
  34. </view> -->
  35. <view class="btnsBox dffd">
  36. <image @click="cliCot(2)" class="small" :src="goodInfo.info.is_give == 1 ? '/static/img/pro/navgodsel.png' : '/static/img/pro/navgod.png'" mode=""></image>
  37. <view class="fontssm textgrey">{{ goodInfo.info.like_num || 0 }}人喜欢</view>
  38. <view class="dfsb">
  39. <view @click="cliCot(1)" class="btns dfsb">
  40. <image class="icon" :src="goodInfo.info.is_collection == 1 ? '/static/img/pro/navcolsel.png' : '/static/img/pro/navcol.png'" mode=""></image>
  41. <view class="word">收藏</view>
  42. </view>
  43. <button open-type="share" class="btns shareBtn dfsb">
  44. <image class="icon" src="/static/img/pro/navshare1.png" mode=""></image>
  45. <view class="word">分享</view>
  46. </button>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="conwarp">
  53. <view class="gdHead"><view class="head">文档下载</view></view>
  54. <view class="cl-one"><video-list :flag="2" :list="goodInfo.files"></video-list></view>
  55. </view>
  56. <view class="fixBox dfsb">
  57. <view @tap="toPay()" class="li flex1 dffs">
  58. <image src="/static/img/pro/navlidown.png" mode=""></image>
  59. 普通下载
  60. </view>
  61. <view class="line"></view>
  62. <view @tap="toPay()" class="li flex1 dffs">
  63. <image src="/static/img/pro/navlivdown.png" mode=""></image>
  64. 会员下载
  65. </view>
  66. <!-- <navigator :url="'/pages/pay/pay?id=' + id" class="li flex1 dffs">
  67. <image src="/static/img/pro/navlidown.png" mode=""></image>
  68. 普通下载
  69. </navigator>
  70. <view class="line"></view>
  71. <navigator :url="'/pages/pay/pay?id=' + id" class="li flex1 dffs">
  72. <image src="/static/img/pro/navlivdown.png" mode=""></image>
  73. 会员下载
  74. </navigator> -->
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import videoList from './components/wordlist.vue';
  80. export default {
  81. components: {
  82. videoList
  83. },
  84. data() {
  85. return {
  86. id: 0, //商品id
  87. goodInfo: { tags: '', info: '' }
  88. };
  89. },
  90. onLoad(option) {
  91. console.log(option);
  92. if (option.scene) {
  93. let scene = decodeURIComponent(option.scene);
  94. let id =scene.split('=')[1]
  95. console.log(scene);
  96. this.id = id;
  97. } else {
  98. this.id = option.id;
  99. }
  100. this.loadData();
  101. this.$store.dispatch('getUserInfo');
  102. },
  103. onShareAppMessage() {
  104. let that = this;
  105. return {
  106. title: that.goodInfo.info.name,
  107. path: `/pages/index/navDet?id=${this.id}&invite_id=${this.token()}`
  108. };
  109. },
  110. methods: {
  111. // val 1收藏 2点赞
  112. cliCot(val) {
  113. let url = val == 1 ? 'collection/setCollection' : 'give/setGive';
  114. // type 2 类型: 1=商品 2=文档 3=视频
  115. // coll_id 收藏ID (分为: 商品ID , 文档ID , 视频ID)
  116. this.$api
  117. .request(url, {
  118. coll_id: this.goodInfo.info.id || '',
  119. r_id: this.goodInfo.info.id || '',
  120. type: 2
  121. })
  122. .then(res => {
  123. this.$api.toast(res.msg);
  124. if (res.code == '200') {
  125. setTimeout(res => {
  126. this.loadData();
  127. }, 600);
  128. }
  129. });
  130. },
  131. /**
  132. * 请求数据只是为了代码不那么乱
  133. * 分次请求未作整合
  134. */
  135. async loadData() {
  136. let url = 'index/getClassInfo';
  137. this.$api
  138. .request(url, {
  139. id: this.id
  140. })
  141. .then(res => {
  142. if (res.code == '200') {
  143. let data = res.data;
  144. this.goodInfo = data;
  145. }
  146. });
  147. },
  148. showPopup(key, type) {
  149. this.$refs[key].open(type);
  150. },
  151. toPay()
  152. {
  153. if(this.goodInfo.info.level_time == 0)
  154. {
  155. uni.showToast({
  156. icon:'none',
  157. title: '普通会员无法下载!',
  158. duration: 2000,
  159. });
  160. setTimeout(res => {
  161. uni.navigateTo({
  162. url: '/pages/user/mine/member'
  163. });
  164. }, 2000);
  165. return;
  166. }
  167. uni.navigateTo({
  168. url: '/pages/pay/pay?id=' + this.id
  169. });
  170. },
  171. //立即购买
  172. buyNow(data) {
  173. const parms = this.getConfirmData(data);
  174. console.log(parms);
  175. if (!parms) {
  176. return;
  177. }
  178. // parms.id = parms.gid;
  179. this.hidePopup('skuPopup');
  180. this.navTo('/pages/order/createOrder?data=' + JSON.stringify(parms), 'post', {
  181. login: true
  182. });
  183. }
  184. // ,
  185. //立即购买
  186. // async buyNow(data) {
  187. // this.getConfirmData(data);
  188. // this.$request('/api/cart/addCart', {
  189. // goods_id: this.id,
  190. // nums: 1,
  191. // nums_type: 2
  192. // })
  193. // .then(res => {
  194. // if (res.code == '200') {
  195. // this.navTo('/pages/order/createOrder?type=buyNow&ids=' + res.data, {
  196. // login: true
  197. // })
  198. // } else {
  199. // this.$util.msg(res.msg);
  200. // }
  201. // });
  202. // }
  203. }
  204. };
  205. </script>
  206. <style lang="scss" scoped>
  207. .container {
  208. padding-bottom: 120rpx;
  209. .conwarp {
  210. background-color: #fff;
  211. padding: 26rpx 30rpx 39rpx;
  212. border-radius: 16rpx;
  213. margin-bottom: 20rpx;
  214. .gdHead {
  215. line-height: 58rpx;
  216. margin-bottom: 16rpx;
  217. .head {
  218. font-size: 34rpx;
  219. font-family: PingFangSC-Medium, PingFang SC;
  220. font-weight: 600;
  221. color: #333333;
  222. line-height: 48rpx;
  223. }
  224. .desc {
  225. background: #f89638;
  226. border-radius: 5rpx;
  227. font-size: 18rpx;
  228. height: 32rpx;
  229. line-height: 32rpx;
  230. padding: 0rpx 8rpx;
  231. display: inline-block;
  232. color: #fff;
  233. margin-left: 10rpx;
  234. &:nth-of-type(2) {
  235. background: #7fc06e;
  236. }
  237. &:nth-of-type(3) {
  238. background: #75b2c4;
  239. }
  240. &:nth-of-type(4) {
  241. background: #8875c0;
  242. }
  243. }
  244. }
  245. .subtit {
  246. margin-top: 10rpx;
  247. }
  248. .cl-one {
  249. .vidBox {
  250. margin-top: 30rpx;
  251. width: 690rpx;
  252. height: 335rpx;
  253. }
  254. .xqcont {
  255. min-height: 800rpx;
  256. width: 100%;
  257. align-items: center;
  258. .xqleft {
  259. position: fixed;
  260. top: 50%;
  261. right: 0;
  262. align-items: center;
  263. justify-content: center;
  264. .small {
  265. width: 54rpx;
  266. height: 54rpx;
  267. }
  268. .big {
  269. width: 108rpx;
  270. height: 108rpx;
  271. }
  272. .word {
  273. margin: 8rpx 0 48rpx;
  274. font-size: 20rpx;
  275. color: #999;
  276. }
  277. }
  278. .btnsBox {
  279. align-items: center;
  280. .small {
  281. width: 90rpx;
  282. height: 90rpx;
  283. margin: 60rpx 0 16rpx;
  284. opacity: 0.8;
  285. }
  286. .btns {
  287. margin: 70rpx 60rpx 0;
  288. width: 154rpx;
  289. height: 54rpx;
  290. background: #f6f6f6;
  291. border-radius: 31px;
  292. align-items: center;
  293. padding: 0 15rpx;
  294. justify-content: space-around;
  295. .icon {
  296. width: 35rpx;
  297. height: 31rpx;
  298. }
  299. .word {
  300. font-size: 22rpx;
  301. color: #666;
  302. }
  303. }
  304. }
  305. }
  306. }
  307. }
  308. .fixBox {
  309. padding: 34rpx;
  310. .line {
  311. width: 1rpx;
  312. height: 20rpx;
  313. background: #b7b7bd;
  314. }
  315. .li {
  316. justify-content: center;
  317. color: #7fc06e;
  318. image {
  319. width: 42rpx;
  320. height: 32rpx;
  321. margin-right: 20rpx;
  322. }
  323. }
  324. }
  325. }
  326. </style>