bookinfo.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <template>
  2. <view class="page">
  3. <view class="padd">
  4. <view class="wrap">
  5. <u-swiper :list="list1" mode='number' height='750' indicator-pos="bottomRight"></u-swiper>
  6. </view>
  7. <view class="back" style="margin-top: 24rpx;">
  8. <view class="">{{datainfo.title}}</view>
  9. <view class="item-jian">教材级别:{{datainfo.level.title}}</view>
  10. <view class="item-jian">适用层次:{{datainfo.arrangement.title}}</view>
  11. <view class="item-jian">适用专业:{{datainfo.speciality.title}}</view>
  12. <view class="item-jian">ISBN:{{datainfo.isbn}}</view>
  13. <view class="item-jian">作者:{{datainfo.author}}</view>
  14. <view class="item-jian" v-if="datainfo.is_free==1">纸质定价:¥{{datainfo.entity_price}}</view>
  15. </view>
  16. </view>
  17. <view class="height"></view>
  18. <view class="series" v-if="datainfo.is_series==0">
  19. <view class="u-flex u-row-between">
  20. <view class="abount">相关系列</view>
  21. <view class="updown" @click="toupdown(2)">系列下载</view>
  22. </view>
  23. <view class="" style="margin-top: 24rpx;">
  24. <swiper style="height: 400rpx;" class="swiper" circular :indicator-dots="true" :autoplay="true">
  25. <swiper-item v-for="(parent,index) in swiptlist" :key="index">
  26. <view class="u-flex swiper-item">
  27. <view class="" v-for="child in parent" @click="toinfo(child.id)">
  28. <image :src="child.image" style="width: 196rpx;height: 280rpx;" mode=""></image>
  29. <view class="u-line-1" style="width: 196rpx;">{{child.title}}</view>
  30. <view class="">
  31. 定价:<span style="color:rgba(204, 51, 0, 1) ;">¥{{child.price}}</span>
  32. </view>
  33. </view>
  34. </view>
  35. </swiper-item>
  36. </swiper>
  37. </view>
  38. </view>
  39. <view class="height"></view>
  40. <view class="content">
  41. <view class="">
  42. <u-tabs active-color='#06A971' :list="list" :is-scroll="false" :current="current"
  43. @change="change"></u-tabs>
  44. </view>
  45. <view v-if="current==0" class="padd content-box">
  46. <view class="u-flex">
  47. <view class="">
  48. <view class="chu">开本:{{datainfo.format}}</view>
  49. <view class="chu">印制:{{datainfo.print}}</view>
  50. <view class="chu">版次:{{datainfo.edition}}</view>
  51. </view>
  52. <view class="" style="margin-left: 100rpx;">
  53. <view class="chu">印张:{{datainfo.sheet}}</view>
  54. <view class="chu">出版日期:{{pubdate}}</view>
  55. <view class="chu">出版单位:{{datainfo.publisher}}</view>
  56. </view>
  57. </view>
  58. <view class="tu">
  59. <view class="" style="position: relative;">
  60. <view class="brief">前言</view>
  61. <image class="image" src="/static/images/compile.png" mode=""></image>
  62. </view>
  63. <view class="fonta">
  64. {{datainfo.preface}}
  65. </view>
  66. </view>
  67. <view class="tu">
  68. <view class="" style="position: relative;">
  69. <view class="brief">内容简介</view>
  70. <image class="image" src="/static/images/compile2.png" mode=""></image>
  71. </view>
  72. <view class="fonta">
  73. {{datainfo.content_desc}}
  74. </view>
  75. </view>
  76. <view class="tu">
  77. <view class="" style="position: relative;">
  78. <view class="brief">作者简介</view>
  79. <image class="image" src="/static/images/compile2.png" mode=""></image>
  80. </view>
  81. <view class="fonta">
  82. {{datainfo.author_desc}}
  83. </view>
  84. </view>
  85. </view>
  86. <view v-if="current==1" class="padd data">
  87. <!-- 样章 -->
  88. <view class="" v-if="specimen_file.length>0">
  89. <view class="sample">样章</view>
  90. <view @click="tourl(item.url)" class="" v-for="(item,index) in specimen_file" :key="index"
  91. style="display: flex;margin-top: 28rpx;">
  92. <view class="" style="display: flex;">
  93. <image src="/static/images/pdf.png" class="image3" mode=""></image>
  94. <view class="pdf u-line-1" style="width: 530rpx;">{{item.title}}</view>
  95. </view>
  96. <image src="/static/images/updown.png" mode="" style="width: 32rpx;height: 32rpx;"></image>
  97. </view>
  98. </view>
  99. <view class="">
  100. <view class="sample u-flex u-row-between">
  101. <view class="">资源包</view>
  102. <view v-if="datainfo.is_free==1" class="u-flex">
  103. <view class="selling">资源售价</view>
  104. <!-- <view class="selling">纸质售价</view> -->
  105. <view class="money5">¥{{price}}</view>
  106. <view class="button4" @click="orderinfo">付费下载</view>
  107. </view>
  108. </view>
  109. <view class="courseware">课件</view>
  110. <view @click='touser(item.url)' v-for="(item,index) in courseware_file" :key="index" class=""
  111. style="display: flex;margin-top: 28rpx;justify-content: space-between;">
  112. <div style="display: flex;">
  113. <image src="/static/images/pdf.png" class="image3" mode=""></image>
  114. <view class="pdf u-line-1" style="width: 530rpx;">{{item.title}}</view>
  115. </div>
  116. <image src="/static/images/updown.png" mode="" style="width: 32rpx;height: 32rpx;"></image>
  117. </view>
  118. <view class="" v-if="resource_file.length>0">
  119. <view class="courseware">资源</view>
  120. <view @click='touser(item.url)' v-for="(item,index) in resource_file" :key="index" class=""
  121. style="display: flex;margin-top: 28rpx;justify-content: space-between;">
  122. <view class="" style="display: flex;">
  123. <image src="/static/images/pdf.png" class="image3" mode=""></image>
  124. <view class="pdf u-line-1" style="width: 530rpx;">{{item.title}}</view>
  125. </view>
  126. <image src="/static/images/updown.png" mode="" style="width: 32rpx;height: 32rpx;"></image>
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. <view class="" style=" height: 166rpx;"></view>
  133. <view class="bottom u-flex">
  134. <view class="left" @click="stylebook">样书申请</view>
  135. <view v-if="datainfo.is_free==0" class="right" @click="show=true">免费下载</view>
  136. <view v-if="datainfo.is_certificate==0" @click="show=true" class="right">体验下载</view>
  137. <view v-if="datainfo.is_pay==0" class="right" @click="show=true">已购买,可下载</view>
  138. <view v-if="datainfo.is_pay!=0&&datainfo.is_certificate!=0&&datainfo.is_free!=0" @click="tourl(url)"
  139. class="right">在线试读</view>
  140. </view>
  141. <u-popup v-model="show" mode="bottom" border-radius="24">
  142. <view class="" style="padding: 32rpx 28rpx;">
  143. <view class="u-flex u-row-center" style="text-align: center;position: relative;">
  144. <view class="courseware" style="margin-top: 0;">资源下载</view>
  145. <image @click="show= false" src="../../static/images/close.png"
  146. style="width: 44rpx;height: 44rpx;position: absolute;top: 0;right: 0;" mode=""></image>
  147. </view>
  148. <view class="" v-if="specimen_file.length>0">
  149. <view class="sample">样章</view>
  150. <view @click="tourl(item.url)" class="u-row-between" v-for="(item,index) in specimen_file"
  151. :key="index" style="display: flex;margin-top: 28rpx;">
  152. <view class="" style="display: flex;">
  153. <image src="/static/images/pdf.png" class="image3" mode=""></image>
  154. <view class="pdf u-line-1" style="width: 530rpx;">{{item.title}}</view>
  155. </view>
  156. <image src="/static/images/updown.png" mode="" style="width: 32rpx;height: 32rpx;"></image>
  157. </view>
  158. </view>
  159. <view class="">
  160. <view class="sample u-flex u-row-between">
  161. <view class="">资源包</view>
  162. </view>
  163. <view class="courseware">电子书</view>
  164. <view @click="touser(item.url)" v-for="(item,index) in courseware_file" :key="index" class=""
  165. style="display: flex;margin-top: 28rpx;justify-content: space-between;">
  166. <div style="display: flex;">
  167. <image src="/static/images/pdf.png" class="image3" mode=""></image>
  168. <view class="pdf u-line-1" style="width: 530rpx;">{{item.title}}</view>
  169. </div>
  170. <image src="/static/images/updown.png" mode="" style="width: 32rpx;height: 32rpx;"></image>
  171. </view>
  172. <view class="courseware">课件</view>
  173. <view @click="touser(item.url)" v-for="(item,index) in courseware_file" :key="index" class=""
  174. style="display: flex;margin-top: 28rpx;justify-content: space-between;">
  175. <div style="display: flex;">
  176. <image src="/static/images/pdf.png" class="image3" mode=""></image>
  177. <view class="pdf u-line-1" style="width: 530rpx;">{{item.title}}</view>
  178. </div>
  179. <image src="/static/images/updown.png" mode="" style="width: 32rpx;height: 32rpx;"></image>
  180. </view>
  181. <view class="" v-if="resource_file.length>0">
  182. <view class="courseware">资源</view>
  183. <view @click="touser(item.url)" v-for="(item,index) in resource_file" :key="index" class=""
  184. style="display: flex;margin-top: 28rpx;justify-content: space-between;">
  185. <view class="" style="display: flex;">
  186. <image src="/static/images/pdf.png" class="image3" mode=""></image>
  187. <view class="pdf u-line-1" style="width: 530rpx;">{{item.title}}</view>
  188. </view>
  189. <image src="/static/images/updown.png" mode="" style="width: 32rpx;height: 32rpx;"></image>
  190. </view>
  191. </view>
  192. </view>
  193. </view>
  194. </u-popup>
  195. </view>
  196. </template>
  197. <script>
  198. export default {
  199. data() {
  200. return {
  201. list: [{
  202. name: '内容介绍',
  203. }, {
  204. name: '资料',
  205. }],
  206. current: 0,
  207. show: false,
  208. list1: [],
  209. id: '',
  210. datainfo: {
  211. sheet: '',
  212. publisher: '',
  213. preface: "",
  214. author_desc: '',
  215. title: '',
  216. isbn: '',
  217. author: '',
  218. entity_price: '',
  219. format: '',
  220. print: '',
  221. edition: '',
  222. content_desc: "",
  223. level: {
  224. title: ''
  225. },
  226. arrangement: {
  227. title: ''
  228. },
  229. speciality: {
  230. title: ''
  231. },
  232. series_id: '',
  233. is_series: '', //是否可以系列购买
  234. is_certificate: '', //是否体验中
  235. is_pay: '', //是否已购买
  236. is_free: '', //是否免费
  237. },
  238. swiptlist: [],
  239. pubdate: '',
  240. courseware_file: [],
  241. resource_file: [],
  242. specimen_file: [],
  243. price: '', //资源价格,
  244. url: ''
  245. };
  246. },
  247. onLoad(options) {
  248. this.id = options.id
  249. this.getBookInfo()
  250. },
  251. methods: {
  252. //跳转下载
  253. touser(url) {
  254. if (this.datainfo.is_certificate == 0 || this.datainfo.is_pay == 0 || this.datainfo.is_free == 0) {
  255. console.log(this.url);
  256. window.location.href = url
  257. } else {
  258. uni.showModal({
  259. title: '提示',
  260. content: '所选资料为付费资料,请购买后下载',
  261. confirmText: '我知道了',
  262. success: function(res) {
  263. if (res.confirm) {
  264. console.log('用户点击确定');
  265. } else if (res.cancel) {
  266. console.log('用户点击取消');
  267. }
  268. }
  269. });
  270. }
  271. },
  272. tourl(url){
  273. window.location.href = url
  274. },
  275. //跳转详情
  276. toinfo(id) {
  277. this.id = id
  278. this.getBookInfo()
  279. },
  280. //立即购买
  281. orderinfo() {
  282. this.$u.post('api/order/createOrder', {
  283. goods_id: this.id,
  284. type: 0
  285. }).then(res => {
  286. if (res.code == 1) {
  287. uni.setStorageSync('bookid', this.id)
  288. uni.navigateTo({
  289. url: '/pages/index/orderinfo?id=' + res.data.id + '&&index=' + 1
  290. })
  291. }
  292. })
  293. },
  294. // 系列
  295. getSeriesBooks() {
  296. this.$u.post('api/books/getSeriesBooks', {
  297. series_id: this.series_id
  298. }).then(res => {
  299. this.swiptlist = res.data.reduce((a, b) => {
  300. let lastIndex = a.length - 1
  301. if (a[lastIndex].length < 3) {
  302. a[lastIndex].push(b)
  303. } else {
  304. a.push([b])
  305. }
  306. return a
  307. }, [
  308. []
  309. ])
  310. })
  311. },
  312. //详情
  313. getBookInfo() {
  314. this.$u.post('api/books/getBookInfo', {
  315. id: this.id
  316. }).then(res => {
  317. console.log('info', res);
  318. this.datainfo = res.data
  319. this.series_id = res.data.series_id
  320. this.pubdate = res.data.pubdate.slice(0, 4) + '年' + res.data.pubdate.slice(5, 7) + "月"
  321. this.getSeriesBooks()
  322. this.courseware_file = res.data.courseware_file
  323. this.resource_file = res.data.resource_file
  324. this.specimen_file = res.data.specimen_file
  325. if (res.data.specimen_file.length > 0) {
  326. this.url = res.data.specimen_file[0].url
  327. }
  328. this.price = res.data.price
  329. var arr = res.data.banner.map(item => {
  330. let obj = {}
  331. obj.image = item
  332. return obj
  333. })
  334. console.log(arr);
  335. this.list1 = arr
  336. })
  337. },
  338. change(index) {
  339. this.current = index;
  340. },
  341. toupdown(index) {
  342. uni.setStorageSync('bookid', this.id)
  343. uni.navigateTo({
  344. url: '/pages/index/updown?id=' + this.id + "&&index=" + index
  345. })
  346. },
  347. stylebook() {
  348. uni.navigateTo({
  349. url: '/pages/index/stylebook?id=' + this.id
  350. })
  351. }
  352. }
  353. }
  354. </script>
  355. <style lang="scss">
  356. .courseware {
  357. font-size: 28rpx;
  358. font-family: PingFangSC, PingFang SC;
  359. font-weight: 500;
  360. color: #222222;
  361. margin-top: 24rpx;
  362. }
  363. .money5 {
  364. font-size: 32rpx;
  365. font-family: SFPro, SFPro;
  366. font-weight: 500;
  367. color: #CC3300;
  368. }
  369. .button4 {
  370. width: 120rpx;
  371. height: 52rpx;
  372. background: #06A971;
  373. border-radius: 6rpx;
  374. margin-left: 16rpx;
  375. font-size: 24rpx;
  376. font-family: PingFangSC, PingFang SC;
  377. font-weight: 400;
  378. color: #FFFFFF;
  379. text-align: center;
  380. line-height: 52rpx;
  381. }
  382. .selling {
  383. font-size: 24rpx;
  384. font-family: PingFangSC, PingFang SC;
  385. font-weight: 400;
  386. color: #555555;
  387. margin-right: 4rpx;
  388. }
  389. .image3 {
  390. width: 28rpx;
  391. height: 28rpx;
  392. }
  393. .pdf {
  394. font-size: 24rpx;
  395. font-family: PingFangSC, PingFang SC;
  396. font-weight: 400;
  397. color: #222222;
  398. margin-left: 24rpx;
  399. margin-right: 80rpx;
  400. }
  401. .sample {
  402. height: 72rpx;
  403. background: #F5F5F5;
  404. border-radius: 8rpx;
  405. font-size: 28rpx;
  406. font-family: PingFangSC, PingFang SC;
  407. font-weight: 500;
  408. color: #222222;
  409. padding: 14rpx 10rpx 14rpx 20rpx;
  410. margin-top: 28rpx;
  411. }
  412. .data {
  413. border-top: 2rpx solid rgba(151, 151, 151, 0.1);
  414. padding-top: 26rpx !important;
  415. }
  416. .fonta {
  417. font-size: 24rpx;
  418. font-family: PingFangSC, PingFang SC;
  419. font-weight: 400;
  420. color: #222222;
  421. margin-top: 24rpx;
  422. }
  423. .tu {
  424. margin-top: 32rpx;
  425. }
  426. .image {
  427. width: 694rpx;
  428. height: 50rpx;
  429. }
  430. .brief {
  431. position: absolute;
  432. left: 28rpx;
  433. font-size: 28rpx;
  434. font-family: PingFangSC, PingFang SC;
  435. font-weight: 500;
  436. color: #06A971;
  437. line-height: 50rpx;
  438. }
  439. .chu {
  440. margin-top: 20rpx;
  441. }
  442. .content-box {
  443. border-top: 2rpx solid rgba(151, 151, 151, 0.1);
  444. padding-top: 42rpx !important;
  445. }
  446. ::v-deep .u-tab-bar {
  447. background-color: #06A971 !important;
  448. }
  449. // 系列
  450. .series {
  451. padding: 44rpx 28rpx 32rpx;
  452. }
  453. .about {
  454. font-size: 28rpx;
  455. font-family: PingFangSC, PingFang SC;
  456. font-weight: 500;
  457. color: #222222;
  458. }
  459. .updown {
  460. width: 134rpx;
  461. height: 56rpx;
  462. background: #06A971;
  463. border-radius: 6rpx;
  464. font-size: 24rpx;
  465. font-family: PingFangSC, PingFang SC;
  466. font-weight: 500;
  467. color: #FFFFFF;
  468. line-height: 56rpx;
  469. text-align: center;
  470. }
  471. .wrap {
  472. height: 750rpx;
  473. padding: 0 106rpx;
  474. }
  475. .back {
  476. padding: 0 0 40rpx 0;
  477. background: #fff;
  478. }
  479. .padd {
  480. padding: 0 28rpx;
  481. }
  482. .page {
  483. // background: #F5F5F5;
  484. min-height: 100vh;
  485. }
  486. .height {
  487. width: 750rpx;
  488. height: 20rpx;
  489. background: #F5F5F5;
  490. }
  491. .item-jian {
  492. font-size: 24rpx;
  493. font-family: PingFangSC, PingFang SC;
  494. font-weight: 400;
  495. color: #444444;
  496. margin-top: 18rpx;
  497. }
  498. .bottom {
  499. width: 750rpx;
  500. height: 166rpx;
  501. background: #FFFFFF;
  502. padding: 16rpx 28rpx 0;
  503. position: fixed;
  504. bottom: 0;
  505. left: 0;
  506. .left {
  507. width: 336rpx;
  508. height: 88rpx;
  509. background: #FFA30E;
  510. border-radius: 12rpx;
  511. font-size: 32rpx;
  512. font-family: PingFangSC, PingFang SC;
  513. font-weight: 500;
  514. color: #FFFFFF;
  515. text-align: center;
  516. line-height: 88rpx;
  517. }
  518. .right {
  519. width: 336rpx;
  520. height: 88rpx;
  521. background: #06A971;
  522. border-radius: 12rpx;
  523. font-size: 32rpx;
  524. font-family: PingFangSC, PingFang SC;
  525. font-weight: 500;
  526. color: #FFFFFF;
  527. text-align: center;
  528. line-height: 88rpx;
  529. margin-left: 12rpx;
  530. }
  531. }
  532. .swiper-item :not(:last-child) {
  533. margin-right: 14rpx;
  534. }
  535. </style>