index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <template>
  2. <gracePage :customHeader="false">
  3. <view class="container" slot="gBody">
  4. <ourLoading isFullScreen :active="pageLoading" :text="pageLoadingText" />
  5. <view class="wrap2" @click="showBuy">
  6. <graceBorderRadius :style="fetch.button.bgcolor" :radius="['20rpx','20rpx','20rpx','0rpx']">
  7. <text class="demo2 grace-white" :style="fetch.button.color">{{fetch.info.name}}</text>
  8. </graceBorderRadius>
  9. </view>
  10. <swiper class="cover" @change="change" :circular="swiper.circular">
  11. <swiper-item v-for="(v, k) in fetch.info.pic_bg" :key="k">
  12. <view class="default">
  13. <image :src="v" mode="widthFix" style="height:auto;"></image>
  14. </view>
  15. </swiper-item>
  16. </swiper>
  17. <view class="btn-ctrls">
  18. <view class="btn-title" v-if="fetch.info.uid > 0" style="display: none;">
  19. <text class="grace-title-text grace-black">{{fetch.info.user.username}}创作</text>
  20. </view>
  21. <view class="btn-wrapper space-between" v-if="fetch.button" :style="fetch.button.bgcolor">
  22. <view class="button primary big" :style="fetch.button.color" v-if="fetch.button.name && fetch.button.name[0]" @click="goView">{{fetch.button.name[0]}}</view>
  23. <block v-if="fetch.button.name && fetch.button.name[1]">
  24. <text class="spliter"></text>
  25. <view class="button primary big" :style="fetch.button.color" @click="goRanking">{{fetch.button.name[1]}}</view>
  26. </block>
  27. </view>
  28. <view class="dots">
  29. <text :class="swiper.index == k ? 'cur' : ''" v-for="(v, k) in fetch.info.pic_bg" :key="k"></text>
  30. </view>
  31. </view>
  32. <view v-if="buyState">
  33. <buy :id="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" :code="fetch.code" :name="fetch.info.name" @hideBuy="hideBuy" @share="share" @view="view"></buy>
  34. </view>
  35. <view v-if="rankingState">
  36. <ranking :id="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" @hideRanking="hideRanking"></ranking>
  37. </view>
  38. <view v-if="infoState">
  39. <info :id="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" @hideInfo="hideInfo"></info>
  40. </view>
  41. <dever-share ref="share" :id="id" :code="fetch.code" :data="fetch.share" v-if="fetch.share"></dever-share>
  42. <view class="mask buy-layer" v-if="inviteState && fetch.share_user">
  43. <view class="buytip-layer layer " catchtap="handleStop">
  44. <view class="buy-tit buy-user"><image :src="fetch.share_user.avatar" mode="widthFix"></image></view>
  45. <view class="buy-tit" style="margin-top: 10rpx;">{{fetch.share_user.username}}赠送</view>
  46. <view v-if="fetch.share_user.ticket && fetch.share_user.ticket.desc">
  47. <text class="p">{{fetch.share_user.ticket.desc}}</text>
  48. <text class="p">——“他”是这么说的</text>
  49. </view>
  50. <view v-else>
  51. <text class="p">{{fetch.share.content}}</text>
  52. <text class="p">——{{fetch.share.title}}</text>
  53. </view>
  54. <view class="btn-wrapper">
  55. <view class="button cancel" @click="hideInvite">不要
  56. </view>
  57. <view class="button primary" :style="fetch.button.bgcolor" @click="hideInvite">收下
  58. <button formType="submit"></button>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </gracePage>
  65. </template>
  66. <script>
  67. import buy from "@/pages/dream/buy.vue";
  68. import ranking from "@/pages/dream/ranking.vue";
  69. import info from "@/pages/dream/info.vue";
  70. import deverShare from '@/lib/dever/components/share.vue';
  71. export default{
  72. data() {
  73. return {
  74. id : 0,
  75. swiper : {
  76. index : 0,
  77. circular : true,
  78. },
  79. fetch: {
  80. is_buy : false,
  81. info : {},
  82. button : {},
  83. code : '',
  84. share : {},
  85. },
  86. buyState : false,
  87. rankingState : false,
  88. infoState : false,
  89. inviteState : true,
  90. }
  91. },
  92. onLoad(option) {
  93. this.id = option.id;
  94. this.code = option.code;
  95. this.Dever.login = 'user/login?id=' + this.id;
  96. this.Dever.checkLogin();
  97. this.getData();
  98. },
  99. // 重新加载
  100. onPullDownRefresh: function() {
  101. this.getData();
  102. },
  103. methods:{
  104. change : function(e) {
  105. this.swiper.index = e.detail.current;
  106. },
  107. getData : function() {
  108. var url = this.Dever.host + '/pages/dream/index';
  109. this.Dever.get(this, 'app/collection/?l=api.getInfo', {id:this.id,code:this.code,url:url}, function(t) {
  110. uni.setNavigationBarTitle({
  111. title:t.info.name
  112. });
  113. });
  114. },
  115. goView : function() {
  116. //是否购买
  117. if (!this.fetch.is_buy) {
  118. this.showBuy();
  119. } else {
  120. this.view();
  121. }
  122. },
  123. view : function() {
  124. this.Dever.location('dream/view?code='+this.fetch.code + '&name=' + this.fetch.info.name);
  125. },
  126. showInvite : function() {
  127. this.inviteState = true;
  128. },
  129. hideInvite : function() {
  130. this.inviteState = false;
  131. },
  132. showBuy : function() {
  133. this.buyState = true;
  134. },
  135. hideBuy : function() {
  136. this.buyState = false;
  137. },
  138. hideRanking : function() {
  139. this.rankingState = false;
  140. },
  141. goRanking : function() {
  142. this.rankingState = true;
  143. },
  144. goInfo : function() {
  145. this.infoState = true;
  146. },
  147. hideInfo : function() {
  148. this.infoState = false;
  149. },
  150. share : function() {
  151. this.$refs.share.open();
  152. }
  153. },
  154. components:{
  155. buy,ranking,info,deverShare
  156. }
  157. }
  158. </script>
  159. <style>
  160. .btn-title {
  161. text-align: center;
  162. font-size: 24rpx;
  163. font-weight: bold;
  164. }
  165. .btn-title .grace-title-text {
  166. border-bottom: 1px solid #bababa;
  167. color:#F5F6F8;
  168. }
  169. .wrap2{
  170. width:220rpx;
  171. position: absolute;
  172. right: 20rpx;
  173. top: 20rpx;
  174. z-index: 10;
  175. }
  176. .demo2{line-height:66rpx; display:block; width:100%; text-align:center; font-size:28rpx;}
  177. .container {
  178. position: absolute;
  179. height: 100%;
  180. width: 100%;
  181. left: 0;
  182. top: 0;
  183. overflow: hidden;
  184. }
  185. .btn-wrapper {
  186. justify-content: space-around;
  187. width: 100%;
  188. }
  189. .button {
  190. height: 80rpx;
  191. border: 1rpx solid #cc1619;
  192. color: #cc1619;
  193. font-size: 30rpx;
  194. min-width: 300rpx;
  195. border-radius: 40rpx;
  196. text-align: center;
  197. line-height: 80rpx;
  198. display: block;
  199. position: relative;
  200. }
  201. .button>button{
  202. position: absolute;
  203. width: 100%;
  204. height: 100%;
  205. left: 0;
  206. top: 0;
  207. opacity: 0;
  208. }
  209. .button.big {
  210. width: 630rpx;
  211. }
  212. .button.primary {
  213. background-color: #cc1619;
  214. color: #fff;
  215. }
  216. .button.blk {
  217. background-color: #000;
  218. color: #fff;
  219. border-color: #000;
  220. }
  221. .cover {
  222. width: 750rpx;
  223. height: 100%;
  224. }
  225. swiper-item>view{
  226. height: 100%;
  227. }
  228. swiper-item image{
  229. width: 750rpx;
  230. height: 100%;
  231. }
  232. .btn-ctrls {
  233. position: absolute;
  234. bottom: 40rpx;
  235. left: 200rpx;
  236. right: 200rpx;
  237. }
  238. .btn-ctrls .btn-wrapper {
  239. margin-top: 20rpx;
  240. width: 350rpx;
  241. display: flex;
  242. align-items: center;
  243. border-radius: 5rpx;
  244. background-color: #000;
  245. }
  246. .btn-ctrls .btn-wrapper .button{
  247. border-radius: 0;
  248. min-width: 100rpx;
  249. background-color: transparent;
  250. border: 0;
  251. flex: 1;
  252. }
  253. .btn-ctrls .btn-wrapper .spliter{
  254. flex-shrink: 0;
  255. width: 1rpx;
  256. background: #fff;
  257. height: 40rpx;
  258. color: #333;
  259. }
  260. .btn-ctrls .btn-wrapper .button.small{
  261. min-width: 150rpx;
  262. }
  263. .btn-ctrls .btn-wrapper .button.big{
  264. width: 420rpx;
  265. }
  266. .btn-ctrls .dots{
  267. display: flex;
  268. justify-content: center;
  269. margin-top: 20rpx;
  270. }
  271. .btn-ctrls .dots text{
  272. display: block;
  273. width: 16rpx;
  274. height: 8rpx;
  275. background: rgba(255, 255, 255, 0.5);
  276. border-radius: 8rpx;
  277. margin: 0 5rpx;
  278. }
  279. .btn-ctrls .dots text.cur{
  280. background-color: rgba(255, 255, 255, 1);
  281. }
  282. .btn-ctrls .scorelist{
  283. text-align: center;
  284. }
  285. .btn-ctrls .scorelist navigator{
  286. display: inline-block;
  287. font-size: 26rpx;
  288. color: #FFFFFF;
  289. text-decoration: underline;
  290. }
  291. .space-between{
  292. justify-content: space-between;
  293. }
  294. .btn-wrapper{
  295. display: flex;
  296. }
  297. .ios-pay{
  298. display: none;
  299. }
  300. .pulloff{
  301. position: fixed;
  302. width: 100%;
  303. height: 100%;
  304. top: 0;
  305. left: 0;
  306. z-index: 20;
  307. display: flex;
  308. align-items: center;
  309. justify-content: center;
  310. }
  311. .pulloff>view{
  312. background-color: rgba(0, 0, 0, 0.65);
  313. padding: 53rpx 53rpx 53rpx 74rpx;
  314. border-radius: 10rpx;
  315. text-align: center;
  316. }
  317. .pulloff>view text{
  318. color: #fff;
  319. font-size: 30rpx;
  320. line-height: 53rpx;
  321. }
  322. .preselltip .layer{
  323. border-radius: 5rpx;
  324. padding:70rpx 40rpx;
  325. }
  326. .preselltip .layer .tit{
  327. font-size: 24rpx;
  328. text-align: center;
  329. margin: 16rpx 0 80rpx;
  330. }
  331. .preselltip .layer .btn-wrapper{
  332. position: absolute;
  333. bottom: 0;
  334. left: 0;
  335. }
  336. .preselltip .layer .btn-wrapper .button{
  337. width: 100%;
  338. border-radius: 0 0 5rpx 5rpx;
  339. }
  340. .recharge-layer{
  341. padding: 50rpx 55rpx 62rpx;
  342. background-color: #fff;
  343. position: absolute;
  344. bottom: 0;
  345. left: 0;
  346. right: 0;
  347. transform: translateY(100%);
  348. transition-property: transform;
  349. transition-duration: 0.3s;
  350. transition-timing-function: ease-in;
  351. }
  352. .recharge-layer.slidein{
  353. transform: translateY(0);
  354. }
  355. .recharge-layer .tit{
  356. font-weight: bolder;
  357. font-size: 36rpx;
  358. margin: 0 0 40rpx;
  359. }
  360. .recharge-layer .msg{
  361. font-size: 22rpx;
  362. line-height: 36rpx;
  363. width: 640rpx;
  364. margin: 0 auto 47rpx;
  365. }
  366. .recharge-layer input{
  367. width: 640rpx;
  368. height: 88rpx;
  369. border: 1rpx solid #EEEEEE;
  370. border-radius: 5rpx;
  371. box-sizing: border-box;
  372. padding: 0 25rpx;
  373. font-size: 24rpx;
  374. }
  375. .recharge-layer .errtip {
  376. color: #d1171a;
  377. font-size: 24rpx;
  378. margin: 21rpx 0 0;
  379. height: 34rpx;
  380. }
  381. .recharge-layer .btn-wrapper{
  382. display: flex;
  383. justify-content: space-between;
  384. padding-top: 20rpx;
  385. }
  386. .recharge-layer .btn-wrapper .button{
  387. border: 0;
  388. min-width: 0;
  389. border-radius: 5rpx;
  390. box-sizing: border-box;
  391. color: #999999;
  392. width: 284rpx;
  393. }
  394. .recharge-layer .btn-wrapper .button.primary{
  395. border:0;
  396. color: #fff;
  397. }
  398. .recharge-layer .btn-wrapper .button.cancel{
  399. border:0;
  400. background-color: #CCCCCC;
  401. color: #fff;
  402. }
  403. .recharge-mask{
  404. position: fixed;
  405. width: 100%;
  406. height: 100%;
  407. background: rgba(0, 0, 0, 0.5);
  408. left: 0;
  409. top: 0;
  410. display: none;
  411. }
  412. .mask {
  413. position: fixed;
  414. left: 0;
  415. top: 0;
  416. right: 0;
  417. bottom: 0;
  418. background: rgba(0, 0, 0, 0.5);
  419. z-index:100;
  420. }
  421. .mask .layer {
  422. width: 570rpx;
  423. box-sizing: border-box;
  424. padding: 70rpx 60rpx;
  425. background: #fff;
  426. border-radius: 10rpx;
  427. position: absolute;
  428. top: 50%;
  429. left: 50%;
  430. transform: translate(-50%,-50%);
  431. }
  432. .mask .layer .tit {
  433. text-align: center;
  434. font-size: 40rpx;
  435. margin: 16rpx 0 60rpx;
  436. }
  437. .mask .layer input {
  438. border-radius: 10rpx;
  439. border: 1rpx solid #999;
  440. height: 88rpx;
  441. line-height: 88rpx;
  442. padding: 0 28rpx;
  443. box-sizing: border-box;
  444. font-size: 24rpx;
  445. }
  446. .mask .layer .errtip {
  447. color: #d1171a;
  448. text-align: center;
  449. font-size: 24rpx;
  450. margin: 21rpx 0;
  451. height: 34rpx;
  452. }
  453. .mask .layer .btn-wrapper {
  454. padding-top: 30rpx;
  455. }
  456. .buytip{
  457. font-size: 24rpx;
  458. color: #999999;
  459. text-decoration: underline;
  460. padding-bottom: 40rpx;
  461. }
  462. .p{
  463. font-size: 28rpx;
  464. text-align: justify;
  465. line-height: 40rpx;
  466. margin-bottom: 12rpx;
  467. display: block;
  468. box-sizing: border-box;
  469. }
  470. .buy-tit{
  471. font-size: 40rpx;
  472. /* font-weight: bolder; */
  473. text-align: center;
  474. margin-bottom: 40rpx;
  475. }
  476. .mask .buytip-layer{
  477. padding: 60rpx;
  478. }
  479. .buy-layer .btn-wrapper{
  480. display: flex;
  481. justify-content: space-between;
  482. padding-top: 20rpx;
  483. }
  484. .buy-layer .btn-wrapper .button{
  485. border: 0;
  486. min-width: 0;
  487. box-sizing: border-box;
  488. color: #999999;
  489. width: 200rpx;
  490. border-radius: 5rpx;
  491. }
  492. .buy-layer .btn-wrapper .button.primary{
  493. border:0;
  494. color: #fff;
  495. }
  496. .buy-layer .btn-wrapper .button.cancel{
  497. border:0;
  498. background-color: #CCCCCC;
  499. color: #fff;
  500. }
  501. .buy-user {
  502. width:150rpx;
  503. height:150rpx;
  504. border-radius: 50%;
  505. object-fit: cover;
  506. object-position: center;
  507. position: absolute;
  508. top: -20%;
  509. left: 208rpx;
  510. }
  511. .buy-user image {
  512. border-radius: 50%;
  513. }
  514. </style>