index.vue 12 KB

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