Index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div class="hello">
  3. <div class="block">
  4. <div class="row header">
  5. <div class="right pull-right">
  6. <ul class="inline pull-right">
  7. <li>
  8. <router-link :to="link">{{link_text}}</router-link>&nbsp;&nbsp;&nbsp;
  9. <a
  10. target="_blank"
  11. v-if="lang =='zh-cn'"
  12. href="https://www.showdoc.cc/clients"
  13. >客户端</a>
  14. </li>
  15. </ul>
  16. </div>
  17. </div>
  18. <el-carousel :height="height" :autoplay="false" arrow="always">
  19. <el-carousel-item style="background-color: #1bbc9b;">
  20. <div class="slide">
  21. <img src="static/logo/b_64.png" alt />
  22. <h2>{{$t("section_title1")}}</h2>
  23. <p>
  24. <span v-html="$t('section_description1')"></span>
  25. </p>
  26. <p>
  27. <a class="el-button" href="https://www.showdoc.cc/demo" target="_blank">{{$t("demo")}}</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  28. <a
  29. class="el-button"
  30. href="https://www.showdoc.cc/help"
  31. target="_blank"
  32. >{{$t("help")}}&nbsp;</a>
  33. </p>
  34. </div>
  35. </el-carousel-item>
  36. <el-carousel-item style="background-color: #2C606A;">
  37. <div class="slide">
  38. <h2>{{$t("section_title2")}}</h2>
  39. <p>
  40. <span v-html="$t('section_description2')"></span>
  41. </p>
  42. </div>
  43. </el-carousel-item>
  44. <el-carousel-item style="background-color: #f90;">
  45. <div class="slide">
  46. <h2>{{$t("section_title3")}}</h2>
  47. <p>
  48. <span v-html="$t('section_description3')"></span>
  49. </p>
  50. </div>
  51. </el-carousel-item>
  52. <el-carousel-item style="background-color: #7CBD9D;">
  53. <div class="slide">
  54. <h2>{{$t("section_title4")}}</h2>
  55. <p>
  56. <span v-html="$t('section_description4')"></span>
  57. </p>
  58. </div>
  59. </el-carousel-item>
  60. <el-carousel-item style="background-color: #A77DC2;">
  61. <div class="slide">
  62. <h2>{{$t("section_title5")}}</h2>
  63. <p>
  64. <span v-html="$t('section_description5')"></span>
  65. </p>
  66. </div>
  67. </el-carousel-item>
  68. <el-carousel-item style="background-color: #85CE92;">
  69. <div class="slide">
  70. <h2>{{$t("section_title6")}}</h2>
  71. <p>
  72. <span v-html="$t('section_description6')"></span>
  73. </p>
  74. </div>
  75. </el-carousel-item>
  76. <el-carousel-item style="background-color: #4BBFC3;">
  77. <div class="slide">
  78. <h2>{{$t("section_title7")}}</h2>
  79. <p>
  80. <span v-html="$t('section_description7')"></span>
  81. </p>
  82. </div>
  83. </el-carousel-item>
  84. <el-carousel-item style="background-color: #1bbc9b;">
  85. <div class="slide">
  86. <h2></h2>
  87. <p>{{$t("section_description8")}}</p>
  88. <p>
  89. <el-button>
  90. <router-link to="/user/login">{{$t("section_title8")}}</router-link>
  91. </el-button>
  92. </p>
  93. </div>
  94. </el-carousel-item>
  95. </el-carousel>
  96. </div>
  97. </div>
  98. </template>
  99. <script>
  100. export default {
  101. name: 'Index',
  102. data() {
  103. return {
  104. height: '',
  105. link: '',
  106. link_text: '',
  107. lang: ''
  108. }
  109. },
  110. methods: {
  111. getHeight() {
  112. var winHeight
  113. if (window.innerHeight) {
  114. winHeight = window.innerHeight
  115. } else if (document.body && document.body.clientHeight) {
  116. winHeight = document.body.clientHeight
  117. }
  118. this.height = winHeight + 'px'
  119. },
  120. homePageSetting() {
  121. var url = DocConfig.server + '/api/common/homePageSetting'
  122. this.axios.post(url, this.form).then(response => {
  123. if (response.data.error_code === 0) {
  124. if (response.data.data.home_page == 2) {
  125. // 跳转到登录页面
  126. this.$router.replace({
  127. path: '/user/login'
  128. })
  129. }
  130. if (
  131. response.data.data.home_page == 3 &&
  132. response.data.data.home_item
  133. ) {
  134. // 跳转到指定项目
  135. this.$router.replace({
  136. path: '/' + response.data.data.home_item
  137. })
  138. }
  139. }
  140. })
  141. }
  142. },
  143. mounted() {
  144. var that = this
  145. this.lang = DocConfig.lang
  146. this.getHeight()
  147. this.homePageSetting()
  148. that.link = '/user/login'
  149. that.link_text = that.$t('index_login_or_register')
  150. this.get_user_info(function(response) {
  151. if (response.data.error_code === 0) {
  152. that.link = '/item/index'
  153. that.link_text = that.$t('my_item')
  154. }
  155. })
  156. }
  157. }
  158. </script>
  159. <!-- Add "scoped" attribute to limit CSS to this component only -->
  160. <style scoped>
  161. .el-carousel__item {
  162. text-align: center;
  163. font: 25px 'Microsoft Yahei';
  164. color: #fff;
  165. }
  166. .header {
  167. padding-right: 50px;
  168. padding-top: 30px;
  169. font-size: 18px;
  170. position: fixed;
  171. right: 0;
  172. left: 0;
  173. z-index: 1030;
  174. margin-bottom: 0;
  175. }
  176. .header a {
  177. color: white;
  178. font-size: 12px;
  179. font-weight: bold;
  180. }
  181. .slide {
  182. width: 100%;
  183. max-width: 700px;
  184. position: absolute;
  185. top: 50%;
  186. left: 50%;
  187. transform: translate(-50%, -50%);
  188. padding-top: 0px;
  189. padding-left: 15px;
  190. padding-right: 15px;
  191. padding-bottom: 0px;
  192. box-sizing: border-box;
  193. }
  194. @media only screen and (max-width: 800px) {
  195. .slide p {
  196. font-size: 14px;
  197. }
  198. }
  199. </style>