123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- // pages/style/style.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- currentTab: 0,
- showView: true,
- list: [{
- "title": "你是不是傻"
- },
- {
- "title": "ni'hao"
- },
- ],
- scanCodeMsg: "",
- tempFilePaths: ''
- },
- chooseimage: function () {
- var _this = this;
- wx.chooseImage({
- count: 1, // 默认9
- sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
- success: function (res) {
- console.log(res.tempFilePaths);
- // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
- _this.setData({
- tempFilePaths: res.tempFilePaths
- })
- }
- })
- },
- scanCode: function () {
- var that = this;
- wx.scanCode({ //扫描API
- success(res) { //扫描成功
- console.log(res) //输出回调信息
- that.setData({
- scanCodeMsg: res.result
- });
- wx.showToast({
- title: '成功',
- duration: 1000
- })
- }
- })
- },
- //滑动切换nihao
- swiperTab: function (e) {
- var that = this;
- that.setData({
- currentTab: e.detail.current
- });
- },
- //点击切换
- clickTab: function (e) {
- var that = this;
- if (this.data.currentTab === e.target.dataset.current) {
- return false;
- } else {
- that.setData({
- currentTab: e.target.dataset.current
- })
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- showView: (options.showView == "true" ? true : false)
- },
- // 上下效果
- onChangeShowState: function () {
- var that = this;
- that.setData({
- showView: (!that.data.showView)
- })
- },
- // 页面跳转
- // 判断id
- onDetail: function (e) {
- console.log(e.currentTarget.id)
- wx.navigateTo({
- url: '/pages/job/loginPage?id=' + e.currentTarget.id // 希望跳转过去的页面
- })
- },
- // 无id,模拟数据跳转
- onDetail: function () {
- wx.navigateTo({
- url: '/pages/index/index'
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|