index.vue 12 KB

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