• 1 需要开启 renren-api
    • 2 需要开启nginx服务

    image.png
    image.png

    image.png
    image.png
    index.vue页面代码

    1. <template>
    2. <view>
    3. <view class="search-container">
    4. <image src="../../static/img/logo-small.jpg" class="logo"></image>
    5. <view class="search-bar">
    6. <icon type="search" size="16" class="search-icon"></icon>
    7. <input type="text" placeholder="请输入关键字" class="search" confirm-type="search" v-model="keyword" @confirm="handleSearch" />
    8. </view>
    9. </view>
    10. <swiper :indicator-dots="false" :autoplay="true" :interval="5000"
    11. :duration="1000" class="swiper-container">
    12. <swiper-item v-for="one in swiper" :key="one.id"
    13. @tap="toCurriculum" :data-id="one.id">
    14. <image :src="one.banner" class="swiper-image"></image></swiper-item>
    15. </swiper>
    16. </view>
    17. </template>
    18. <script>
    19. export default {
    20. data() {
    21. return {
    22. keyword: null,
    23. swiper: []
    24. };
    25. },
    26. methods: {
    27. handleSearch: function() {
    28. console.log(this.keyword);
    29. },
    30. onShow: function() {
    31. console.log('onShow==55======');
    32. //let token=wx.getStorageSync("token");
    33. let token = uni.getStorageSync('token');
    34. let ref = this;
    35. uni.request({
    36. url: ref.url.curriculum_swiper,
    37. header: {
    38. token: token
    39. },
    40. success: function(resp) {
    41. console.log(resp);
    42. //清空
    43. ref.swiper.length = 0;
    44. for (let one of resp.data.data) {
    45. ref.swiper.push({
    46. id: one.id,
    47. banner: `${ref.url.image_server}/${one.banner}`
    48. });
    49. }
    50. console.log(ref.swiper);
    51. }
    52. });
    53. },
    54. toCurriculum: function(e) {
    55. let id = e.currentTarget.dataset.id;
    56. uni.navigateTo({
    57. url: '../curriculum/curriculum?id=' + id
    58. });
    59. }
    60. }
    61. };
    62. </script>
    63. <style lang="less">
    64. @import url('index.less');
    65. </style>