index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <gracePage :customHeader="false">
  3. <view class="container" slot="gBody">
  4. <ourLoading isFullScreen :active="pageLoading" :text="pageLoadingText" />
  5. <view class="wrap2" @click="goInfo">
  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" @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. </view>
  42. </gracePage>
  43. </template>
  44. <script>
  45. import buy from "@/pages/dream/buy.vue";
  46. import ranking from "@/pages/dream/ranking.vue";
  47. import info from "@/pages/dream/info.vue";
  48. export default{
  49. data() {
  50. return {
  51. id : 0,
  52. swiper : {
  53. index : 0,
  54. circular : true,
  55. },
  56. fetch: {
  57. is_buy : false,
  58. info : {},
  59. button : {},
  60. code : '',
  61. },
  62. buyState : false,
  63. rankingState : false,
  64. infoState : false,
  65. }
  66. },
  67. onLoad(option) {
  68. this.id = option.id;
  69. this.Dever.login = 'user/login?id=' + this.id;
  70. this.Dever.checkLogin();
  71. this.getData();
  72. },
  73. // 重新加载
  74. onPullDownRefresh: function() {
  75. this.getData();
  76. },
  77. methods:{
  78. change : function(e) {
  79. this.swiper.index = e.detail.current;
  80. },
  81. getData : function() {
  82. this.Dever.get(this, 'app/collection/?l=api.getInfo', {id:this.id}, function(t) {
  83. uni.setNavigationBarTitle({
  84. title:t.info.name
  85. });
  86. });
  87. },
  88. goView : function() {
  89. //是否购买
  90. if (!this.fetch.is_buy) {
  91. this.showBuy();
  92. } else {
  93. this.view();
  94. }
  95. },
  96. view : function() {
  97. this.Dever.location('dream/view?code='+this.fetch.code + '&name=' + this.fetch.info.name);
  98. },
  99. showBuy : function() {
  100. this.buyState = true;
  101. },
  102. hideBuy : function() {
  103. this.buyState = false;
  104. },
  105. hideRanking : function() {
  106. this.rankingState = false;
  107. },
  108. goRanking : function() {
  109. this.rankingState = true;
  110. },
  111. goInfo : function() {
  112. this.infoState = true;
  113. },
  114. hideInfo : function() {
  115. this.infoState = false;
  116. },
  117. share : function() {
  118. //从后端获取分享链接需要的加密参数
  119. }
  120. },
  121. components:{
  122. buy,ranking,info
  123. }
  124. }
  125. </script>
  126. <style>
  127. .btn-title {
  128. text-align: center;
  129. font-size: 24rpx;
  130. font-weight: bold;
  131. }
  132. .btn-title .grace-title-text {
  133. border-bottom: 1px solid #bababa;
  134. color:#F5F6F8;
  135. }
  136. .wrap2{
  137. width:220rpx;
  138. position: absolute;
  139. right: 20rpx;
  140. top: 20rpx;
  141. z-index: 10;
  142. }
  143. .demo2{line-height:66rpx; display:block; width:100%; text-align:center; font-size:28rpx;}
  144. .container {
  145. position: absolute;
  146. height: 100%;
  147. width: 100%;
  148. left: 0;
  149. top: 0;
  150. overflow: hidden;
  151. }
  152. .btn-wrapper {
  153. justify-content: space-around;
  154. width: 100%;
  155. }
  156. .button {
  157. height: 80rpx;
  158. border: 1rpx solid #cc1619;
  159. color: #cc1619;
  160. font-size: 30rpx;
  161. min-width: 300rpx;
  162. border-radius: 40rpx;
  163. text-align: center;
  164. line-height: 80rpx;
  165. display: block;
  166. position: relative;
  167. }
  168. .button>button{
  169. position: absolute;
  170. width: 100%;
  171. height: 100%;
  172. left: 0;
  173. top: 0;
  174. opacity: 0;
  175. }
  176. .button.big {
  177. width: 630rpx;
  178. }
  179. .button.primary {
  180. background-color: #cc1619;
  181. color: #fff;
  182. }
  183. .button.blk {
  184. background-color: #000;
  185. color: #fff;
  186. border-color: #000;
  187. }
  188. .cover {
  189. width: 750rpx;
  190. height: 100%;
  191. }
  192. swiper-item>view{
  193. height: 100%;
  194. }
  195. swiper-item image{
  196. width: 750rpx;
  197. height: 100%;
  198. }
  199. .btn-ctrls {
  200. position: absolute;
  201. bottom: 40rpx;
  202. left: 200rpx;
  203. right: 200rpx;
  204. }
  205. .btn-ctrls .btn-wrapper {
  206. margin-top: 20rpx;
  207. width: 350rpx;
  208. display: flex;
  209. align-items: center;
  210. border-radius: 5rpx;
  211. background-color: #000;
  212. }
  213. .btn-ctrls .btn-wrapper .button{
  214. border-radius: 0;
  215. min-width: 100rpx;
  216. background-color: transparent;
  217. border: 0;
  218. flex: 1;
  219. }
  220. .btn-ctrls .btn-wrapper .spliter{
  221. flex-shrink: 0;
  222. width: 1rpx;
  223. background: #fff;
  224. height: 40rpx;
  225. color: #333;
  226. }
  227. .btn-ctrls .btn-wrapper .button.small{
  228. min-width: 150rpx;
  229. }
  230. .btn-ctrls .btn-wrapper .button.big{
  231. width: 420rpx;
  232. }
  233. .btn-ctrls .dots{
  234. display: flex;
  235. justify-content: center;
  236. margin-top: 20rpx;
  237. }
  238. .btn-ctrls .dots text{
  239. display: block;
  240. width: 16rpx;
  241. height: 8rpx;
  242. background: rgba(255, 255, 255, 0.5);
  243. border-radius: 8rpx;
  244. margin: 0 5rpx;
  245. }
  246. .btn-ctrls .dots text.cur{
  247. background-color: rgba(255, 255, 255, 1);
  248. }
  249. .btn-ctrls .scorelist{
  250. text-align: center;
  251. }
  252. .btn-ctrls .scorelist navigator{
  253. display: inline-block;
  254. font-size: 26rpx;
  255. color: #FFFFFF;
  256. text-decoration: underline;
  257. }
  258. .space-between{
  259. justify-content: space-between;
  260. }
  261. .btn-wrapper{
  262. display: flex;
  263. }
  264. .ios-pay{
  265. display: none;
  266. }
  267. .pulloff{
  268. position: fixed;
  269. width: 100%;
  270. height: 100%;
  271. top: 0;
  272. left: 0;
  273. z-index: 20;
  274. display: flex;
  275. align-items: center;
  276. justify-content: center;
  277. }
  278. .pulloff>view{
  279. background-color: rgba(0, 0, 0, 0.65);
  280. padding: 53rpx 53rpx 53rpx 74rpx;
  281. border-radius: 10rpx;
  282. text-align: center;
  283. }
  284. .pulloff>view text{
  285. color: #fff;
  286. font-size: 30rpx;
  287. line-height: 53rpx;
  288. }
  289. .preselltip .layer{
  290. border-radius: 5rpx;
  291. padding:70rpx 40rpx;
  292. }
  293. .preselltip .layer .tit{
  294. font-size: 24rpx;
  295. text-align: center;
  296. margin: 16rpx 0 80rpx;
  297. }
  298. .preselltip .layer .btn-wrapper{
  299. position: absolute;
  300. bottom: 0;
  301. left: 0;
  302. }
  303. .preselltip .layer .btn-wrapper .button{
  304. width: 100%;
  305. border-radius: 0 0 5rpx 5rpx;
  306. }
  307. .recharge-layer{
  308. padding: 50rpx 55rpx 62rpx;
  309. background-color: #fff;
  310. position: absolute;
  311. bottom: 0;
  312. left: 0;
  313. right: 0;
  314. transform: translateY(100%);
  315. transition-property: transform;
  316. transition-duration: 0.3s;
  317. transition-timing-function: ease-in;
  318. }
  319. .recharge-layer.slidein{
  320. transform: translateY(0);
  321. }
  322. .recharge-layer .tit{
  323. font-weight: bolder;
  324. font-size: 36rpx;
  325. margin: 0 0 40rpx;
  326. }
  327. .recharge-layer .msg{
  328. font-size: 22rpx;
  329. line-height: 36rpx;
  330. width: 640rpx;
  331. margin: 0 auto 47rpx;
  332. }
  333. .recharge-layer input{
  334. width: 640rpx;
  335. height: 88rpx;
  336. border: 1rpx solid #EEEEEE;
  337. border-radius: 5rpx;
  338. box-sizing: border-box;
  339. padding: 0 25rpx;
  340. font-size: 24rpx;
  341. }
  342. .recharge-layer .errtip {
  343. color: #d1171a;
  344. font-size: 24rpx;
  345. margin: 21rpx 0 0;
  346. height: 34rpx;
  347. }
  348. .recharge-layer .btn-wrapper{
  349. display: flex;
  350. justify-content: space-between;
  351. padding-top: 20rpx;
  352. }
  353. .recharge-layer .btn-wrapper .button{
  354. border: 0;
  355. min-width: 0;
  356. border-radius: 5rpx;
  357. box-sizing: border-box;
  358. color: #999999;
  359. width: 284rpx;
  360. }
  361. .recharge-layer .btn-wrapper .button.primary{
  362. border:0;
  363. color: #fff;
  364. }
  365. .recharge-layer .btn-wrapper .button.cancel{
  366. border:0;
  367. background-color: #CCCCCC;
  368. color: #fff;
  369. }
  370. .recharge-mask{
  371. position: fixed;
  372. width: 100%;
  373. height: 100%;
  374. background: rgba(0, 0, 0, 0.5);
  375. left: 0;
  376. top: 0;
  377. display: none;
  378. }
  379. </style>