微信小程序

第一周学了新建页面的基础功能,包括app.json, js wxml wxss,页面跳转等基础功能,跟上个学期学期web应用开发类似 功能都差不多 

"pages":[

"pages/like/like",

"pages/my/my",

"pages/login/login",

"pages/index/index",

"pages/logs/logs",

"pages/type/type"

],

第二周学习组件 数据绑定的 监听,图片的使用地址等等

 data: {

    like:[ '我的','热门','娱乐','知识','游戏','故事'],

    num:0,

    con:[ '修狗','热门','娱乐','知识','游戏','故事'],

    srcs:['../../images/aa.gif','../../images/Alfred Pennyworth.png']

  },

  fu:function(e){

    this.setData({

      num:e.target.dataset.id

    })

  },

<view>

  <Text bindtap="fu" data-id="{{index}}" class="{{index==num?'current':''}}" wx:for="{{like}}">{{item}}</Text>

</view>

<!-- wx:if="表达式" 表达式为真显示,假隐藏 -->

<view>

<text  wx:if="{{index==num}}" wx:for="{{con}}" >{{item}}</text>

<image  wx:if="{{index==num}}" wx:for="{{srcs}}" src="{{item}}"></image>

</view>

第三周 学习了 数据监听 云平台 存储数据等,

<input type="text" bindinput="getuser" placeholder="请输入用户名"/>

<input type="password" bindinput="getpass" placeholder="请输入密码"/>

<button bindtap="add">增加数据</button>

<button bindtap="select">查询</button>

 add:function(){

    const db = wx.cloud.database()

    db.collection('student').add({

      data:{

        user:this.data.user,

        pass:this.data.pass

      },

      success:function(res){

        console.log(res)

      }

    })

  },

  getuser:function(e){

    this.setData({

      user:e.detail.value

    })

  },

  getpass:function(e){

    this.setData({

      pass:e.detail.value

    })

  },

  select:function(){

    const db = wx.cloud.database()

    db.collection('student').where({

      user:'cxy',

      pass:'204'

    })

    .get({

      success:function(res){

        console.log(res.data)

      }

    })

  },

第四周学了 播放音乐 播放视频 发弹幕 发评论。

音乐

data: {

        num:1

    },

    change:function(){

        if(this.data.num==0){

            this.setData({

                num:1

            })

            innerAudioContext.play()

        }else{

            this.setData({

                num:0

            })

            innerAudioContext.pause()

        }

    },

<text>pages/muisc/muisc.wxml</text>

<image class="{{num==0?'paused':''}}" bindtap="change" src="../../images/001.jpg" mode="widthFix"></image>

视频 弹幕

 data: {

        danmu:[

            {

                text:'001',

                color:'pink',

                time:1

            },

            {

                text:'232',

                color:'blue',

                time:2

            }

            ],

        con:''

    },

    user:function(e){

        console.log(e.detail.value)

        this.setData({

            con:e.detail.value

        })

    },

    send:function(){

        this.video.sendDanmu({

            text:this.data.con,

            color:'pink'

        })

<video src="cloud://cloud1-2gxee6dj870a3e7d.636c-cloud1-2gxee6dj870a3e7d-1309767398/001.mp4" danmu-list="{{danmu}}" id="myVideo"></video>

<input type="text" placeholder="请输入弹幕" bindinput="getcon" />

<button type="primary" bindtap="send">发布弹幕</button>

评论  评论发布的时间

<textarea name="" id="" cols="30" rows="10" bindinput="getcon"></textarea>

<button type="primary" bindtap="send">发布</button>

<view wx:for="{{list}}" class="list">

<text>{{item.con}} </text>

<text class="right">{{item.date}}</text>

</view>

data: {

        list:[

            {

                con:'啊对对对',

                date:'5156215221'

            },

            {

                con:'老坛酸菜',

                date:'54542154'

            },

           

        ],

            con:''

    },

    getcon:function(e){

        console.log(e.detail.value)

        this.setData({

            con:e.detail.value

        })

    },

    send:function(){

        var date=new Date()

        var year=date.getFullYear()

        var month=date.getMonth()+1

        var d=date.getDate()

        var hours=date.getHours()

        var minutes=date.getMinutes()

        var seconds=date.getSeconds()

        var mylist=this.data.list;

        mylist.push({

            con:this.data.con,

            date:year+'-'+month+'-'+d+' '+hours+':'+minutes+':'+seconds

        })

        this.setData({

            list:mylist

        })

    },

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值