index_old.vue 12 KB

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