From 8ed8234449f288c2f86b04ed0b15bf4605466dec Mon Sep 17 00:00:00 2001 From: linhaohong <1834469680@qq.com> Date: Fri, 24 Nov 2017 14:49:09 +0800 Subject: [PATCH] =?UTF-8?q?#4=20#95=20=E7=AC=AC4=E6=AC=A1=E5=AE=9E?= =?UTF-8?q?=E9=AA=8C=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1514080901115/pages/add_card/add_card.js | 158 +++++++++++++++++++++ 1514080901115/pages/add_card/add_card.json | 1 + 1514080901115/pages/add_card/add_card.wxml | 88 ++++++++++++ 1514080901115/pages/add_card/add_card.wxss | 1 + 4 files changed, 248 insertions(+) create mode 100644 1514080901115/pages/add_card/add_card.js create mode 100644 1514080901115/pages/add_card/add_card.json create mode 100644 1514080901115/pages/add_card/add_card.wxml create mode 100644 1514080901115/pages/add_card/add_card.wxss diff --git a/1514080901115/pages/add_card/add_card.js b/1514080901115/pages/add_card/add_card.js new file mode 100644 index 00000000..8e1babfa --- /dev/null +++ b/1514080901115/pages/add_card/add_card.js @@ -0,0 +1,158 @@ +// pages/form/form.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + //text: '勿忘初心', + text1:'勿忘初心', + text2:'', + text3: '', + text4: '', + text5: '', + text6: '', + area1: '...', + count1: '...'.length + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var that = this; + wx.getStorage({ + key: 'input', + success: function (res) { + console.log(res.data.area.length) + + that.setData({ + text: res.data.text, + area: res.data.area, + count: res.data.area.length + }) + } + }) + // 从服务器取回来 JSON + wx.request({ + url: 'https://infoaas.com/data/hzc.json', + //仅为示例,并非真实的接口地址 + data: { }, + header: { + 'content-type': 'application/json' // 默认值 + }, + success: function (res) { + console.log(res.data) + /* + that.setData({ + hasError: true, + errorText: res.data.name + ',' + res.data.teacher + ' ' + res.data.year + })*/ + } + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + onSubmit : function(event) { + console.dir(event) + var that = this + var text = event.detail.value.text + if (!text) { + console.dir(text) + that.setData({ + hasError: true, + errorText: '文字不能为空!' + }) + } else { + that.setData({ + hasError: false + }) + wx.setStorage({ + key: "input", + data: event.detail.value, + success: function(res) { + wx.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000 + }) + + } + }) + } + }, + + /*onTextChange: function(e) { + var that = this; + console.dir(e) + var text = e.detail.value + console.dir(text); + if (!text) { + that.setData({ + hasError: true, + errorText: '文字不能为空!' + }) + } else { + that.setData({ + hasError: false + }) + } + },*/ + + onChange : function(e) { + var that = this; + var value = e.detail.value; + console.dir(value) + that.setData({ + count: value.length + }) + } +}) \ No newline at end of file diff --git a/1514080901115/pages/add_card/add_card.json b/1514080901115/pages/add_card/add_card.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/1514080901115/pages/add_card/add_card.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/1514080901115/pages/add_card/add_card.wxml b/1514080901115/pages/add_card/add_card.wxml new file mode 100644 index 00000000..ffc2225f --- /dev/null +++ b/1514080901115/pages/add_card/add_card.wxml @@ -0,0 +1,88 @@ + + + + 添加名片 + + + +
+ {{errorText}} + + *姓名: + + + + + + + + + *手机: + + + + + + + + + 邮箱: + + + + + + + + + 公司: + + + + + + + + + 职位: + + + + + + + + + 地址: + + + + + + + + + + 简介: + + + +