Java爬虫后台+微信小程序之音乐播放器(上)

微信小程序–音乐播放器(Java爬虫后台在下文篇章公布)

主页面:
在这里插入图片描述wxml:
css就不展示了,比较多

<view class='container' style='width:{
  {wid}} height={
  {he}}'>
    <view class="inputView"> 
      <form bindsubmit='submit'>
    <input class="input" type="text" value="{
  {toname}}" name="toname" placeholder-style="color: red" />
      <view class='bt'>
    <button  type="default"plain="true" form-type='submit'><image src='../../images/08f790529822720e679f1edc70cb0a46f21fab47.jpg' ></image></button>
    </view>
    </form>
    </view>
    <view class='swiper'>
      <swiper indicator-dots="{
  {indicatorDots}}"
  autoplay="{
  {autoplay}}"
  interval="{
  {interval}}"
  duration="{
  {duration}}">
      <block wx:for="{
  {lunbo}}">
        <swiper-item><image src='{
  {item}}'></image></swiper-item>
        </block>
      </swiper>
    </view>
    <view class='rank'>
      <view class='rank-h' bindtap='xingeClick'><view class='rank-i'><image src='../../images/20190321162220.png'></image></view>新歌榜         </view>
      <view class='rank-h' bindtap='regeClick'><view class='rank-i'><image src='../../images/20190321162328.png'></image></view>热歌榜         </view>
      <view class='rank-h'  bindtap='biaoshengClick'><view class='rank-i'><image src='../../images/20190321162656.png'></image></view>飙升榜          </view>
    </view>
      <view class='gedan-head'>推荐歌单 ></view>
     <view class='ggg' >
      <block wx:for="{
  {tuijian}}" class='gedan-body'>
        <view class='gedan-it' bindtap='tuijianClick' id='{
  {index}}'><image src='{
  {item}}'></image><view class='lis'><image src='../../images/20190322105830.png'></image>999+</view></view>
      </block>
    </view>
 </view>

js:

//index.js
const app = getApp()
var method='x';
var tid=''
Page({
  data: {
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
 toname:'',
 wid:'',
 he:'',
    lunbo: [],
  },
  onLoad: function (options) {
    var that = this
    wx.getSystemInfo({
      success: function (res) {
        that.setData({ wid: res.windowWidth })
        that.setData({ he: res.windowHeight })
      },
      
    })
    wx.request({
      url: 'http://localhost:8080/spider/servlet.do',
      data: {
        x: 'index',
        y: ''
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success(res) {
        that.setData({
          lunbo: res.data[0].img,
          tuijian:res.data[1].tuijianImg

        })
      }

    })
  },
  
  submit:function(e){
    if (e.detail.value.toname != null && e.detail.value.toname !=""){
      method="b"
    wx.navigateTo({
      url: '/pages/songlist/songlist?me='+ e.detail.value.toname+"&method="+method,
    })

    }
  }
,

xingeClick (){
method='xinge'
  wx.navigateTo({
    url: '/pages/songlist/songlist?method=' + method,
  })
}
  , regeClick() {
    method = 'rege'
    wx.navigateTo({
      url: '/pages/songlist/songlist?method=' + method,
    })
  }
  , biaoshengClick() {
    method = 'biaosheng'
    wx.navigateTo({
 
  • 5
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值