index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <gui-page :customFooter="true" iphoneXButtomStyle="background:#F8F8F8"
  3. :footerSets="{height:150, zIndex:100, bg:'none'}" :isLoading="pageLoading">
  4. <!-- 页面主体 -->
  5. <view slot="gBody" class="gui-margin">
  6. <gui-demo-banner :title="fetch.config.name"
  7. :img="fetch.config.home_top"
  8. :desc="fetch.config.info"></gui-demo-banner>
  9. <block v-for="(v, k) in fetch.cate" :key="k">
  10. <view class="gui-margin-top">
  11. <text class="gui-h5 gui-color-gray gui-bold">{{v.name}}</text>
  12. </view>
  13. <view style="margin-top:15rpx" class="gui-flex gui-rows gui-wrap gui-space-between">
  14. <view class="demo" v-for="(v1, k1) in v.button" :key="k1" @click="location(v1)">
  15. <button type="default" class="gui-button gui-bg-primary" :style="{'background-color':v1.bgcolor + ' !important'}">
  16. <text class="gui-icons gui-button-text-mini gui-color-white"
  17. style="padding-right:10rpx;">{{v1.name}}</text>
  18. </button>
  19. </view>
  20. </view>
  21. </block>
  22. <gui-modal ref="show" :title="title">
  23. <view slot="content" class="gui-padding gui-bg-gray">
  24. <text class="gui-block-text gui-text-center gui-text gui-color-gray"
  25. style="line-height:100rpx; padding:10rpx;">{{content}}</text>
  26. </view>
  27. <!-- 利用 flex 布局 可以放置多个自定义按钮哦 -->
  28. <view slot="btns" class="gui-flex gui-rows gui-space-between">
  29. <view class="modal-btns gui-flex1" style="margin-right:80rpx;">
  30. <text class="modal-btns gui-color-gray" @tap="close">取消</text>
  31. </view>
  32. <view class="modal-btns gui-flex1" style="margin-left:80rpx;">
  33. <text class="modal-btns gui-color-blue" @tap="copy">复制</text>
  34. </view>
  35. </view>
  36. </gui-modal>
  37. </view>
  38. <foot ref="foot" slot="gFooter" :value="foot_value"></foot>
  39. <dever-share ref="share" :data="fetch.share" v-if="fetch.share"></dever-share>
  40. </gui-page>
  41. </template>
  42. <script>
  43. import copyText from "@/lib/clipboard.thorui.js";
  44. import deverShare from '@/lib/dever/components/share.vue';
  45. import foot from '@/pages/index/foot.vue';
  46. export default {
  47. data() {
  48. return {
  49. foot_value : 0,
  50. fetch : {
  51. user : {},
  52. config : {
  53. home_top : '',
  54. },
  55. score : {},
  56. xuanchuan : [],
  57. share : false,
  58. },
  59. title : '',
  60. content : '',
  61. }
  62. },
  63. components:{
  64. deverShare,foot,copyText
  65. },
  66. onLoad() {
  67. this.Dever.location('index/list', 'go');
  68. this.getInfo();
  69. },
  70. onShow() {
  71. this.$nextTick(function() {
  72. this.$refs.foot.cur = this.foot_value;
  73. });
  74. },
  75. // 重新加载
  76. onPullDownRefresh: function() {
  77. this.getInfo();
  78. },
  79. methods: {
  80. getInfo : function() {
  81. this.Dever.get(this, 'app/collection/?l=api.home', {id:-1});
  82. },
  83. location : function(v) {
  84. if (v.link) {
  85. this.Dever.location(v.link, 'webview', v.name);
  86. } else if (v.desc) {
  87. this.title = v.name;
  88. this.content = v.desc;
  89. this.$refs.show.open();
  90. } else {
  91. this.Dever.alert('敬请期待');
  92. }
  93. },
  94. close : function() {
  95. this.$refs.show.close();
  96. },
  97. copy : function() {
  98. var self = this;
  99. copyText.getClipboardData(this.content, function(res) {
  100. if (res) {
  101. self.close();
  102. self.Dever.alert('复制成功');
  103. } else {
  104. self.Dever.alert('复制失败');
  105. }
  106. });
  107. }
  108. }
  109. }
  110. </script>
  111. <style>
  112. .demo{width:210rpx; margin:10rpx;}
  113. .button{width:90rpx; height:90rpx; line-height:90rpx; border-radius:8rpx; margin:10rpx;}
  114. .button-text{font-size:38rpx; text-align:center;}
  115. .modal-btns{line-height:88rpx; font-size:26rpx; text-align:center; width:200rpx;}
  116. </style>