大理市民卡小程序1.0提交
diff --git a/pages/register/register.js b/pages/register/register.js
new file mode 100644
index 0000000..18a0c47
--- /dev/null
+++ b/pages/register/register.js
@@ -0,0 +1,197 @@
+// pages/register/register.js
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ phone: '',
+ code: '',
+ sendTime: '获取验证码',
+ sendColor: 'rgb(124, 255, 112)',
+ snsMsgWait: 30,
+ smsFlag: true,
+ privacyCheck:''
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function(options) {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function() {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function() {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function() {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function() {
+
+ },
+ showPolicy: function() {
+ wx.navigateTo({
+ url: '../policy/policy',
+ })
+ },
+ setPhone: function(e) {
+ this.setData({
+ phone: e.detail.value
+ })
+ },
+ setCode: function(e) {
+ this.setData({
+ code: e.detail.value
+ })
+ },
+ checkboxChange:function(e){
+ console.log(e.detail.value);
+ this.setData({
+ privacyCheck: e.detail.value
+ })
+
+ },
+ doRegister: function() {
+ var phone = this.data.phone;
+ var code=this.data.code;
+ if (wx.$isEmpty(phone)||wx.$isEmpty(code)) {
+ return;
+ }
+ var agree =this.data.privacyCheck;
+ if (wx.$isEmpty(agree)) {
+ wx.showModal({
+ title: '提示',
+ content: '请同意用户协议与隐私条款',
+ })
+ return;
+ }
+ wx.showLoading({
+ title: '加载中',
+ })
+ var name,platform,version;
+ wx.getSystemInfo({
+ success: function(res) {
+ name=res.model;
+ platform=res.platform;
+ version=res.version
+
+ },
+ })
+
+ var param = {
+ "phone": phone,
+ "code": code,
+ "platform": name + "," + platform + "," + version,
+ "uuid": '123456'
+ }
+
+ console.log(param);
+ wx.$doPost('/i/checkcode',param, function(ok, ret) {
+ if (ok) {
+ wx.hideLoading();
+ console.log(ret)
+ if (ret.data.code == 200) {
+ wx.setStorageSync("phone", phone);
+ wx.setStorageSync("uid", ret.data.uid);
+ wx.setStorageSync("code", ret.data.randcode);
+ wx.removeStorageSync('name');
+
+ wx.navigateTo({
+ url: '../pwdset/pwdset',
+ })
+ } else {
+ wx.showModal({
+ title: '错误',
+ content: ret.data.msg,
+
+ duration: 2000
+ })
+ }
+ } else {
+ wx.hideLoading();
+ wx.showModal({
+ title: '错误',
+ content: "请求失败了,请稍后再试",
+
+ duration: 2000
+ })
+ }
+ })
+
+ },
+ getCode: function() {
+ var phone = this.data.phone;
+ if (wx.$isEmpty(phone)) {
+ return;
+ }
+ if (false == this.data.smsFlag) {
+ return;
+ }
+
+ wx.$doCountdown(this);
+
+ var param = {
+ "phone": phone
+ }
+ wx.$doPost('/i/code', param, function(ok, ret) {
+ console.log(ret.data);
+ if (ok) {
+ if (ret.data.code == 200) {
+ } else {
+ wx.showModal({
+ title: '错误',
+ content: ret.data.msg,
+
+ duration: 2000
+ })
+ }
+ } else {
+ wx.showModal({
+ title: '错误',
+ content: "请求失败了" + ret.status + ",请稍后再试",
+ duration: 2000
+ })
+ }
+ })
+ }
+})
\ No newline at end of file
diff --git a/pages/register/register.json b/pages/register/register.json
new file mode 100644
index 0000000..105ebcd
--- /dev/null
+++ b/pages/register/register.json
@@ -0,0 +1,4 @@
+{
+ "usingComponents": {}
+
+}
\ No newline at end of file
diff --git a/pages/register/register.wxml b/pages/register/register.wxml
new file mode 100644
index 0000000..f52b4f0
--- /dev/null
+++ b/pages/register/register.wxml
@@ -0,0 +1,33 @@
+<view class="container">
+
+ <view class="global-background">
+ <view class="inline-item center" style="margin-top: 50rpx;">
+ <view class="input-desc">
+ 手机号
+ </view>
+ <input value="{{phone}}" maxlength="11" placeholder="请输入市民卡预留的手机号" style="width: 70%;" bindinput="setPhone"></input>
+ </view>
+ <view class="inline-item center" style="">
+ <view class="input-desc">
+ 验证码
+ </view>
+ <input placeholder="请输入验证码 " type="number" style="width:45%" bindinput="setCode"></input>
+ <view class="authcode center" style="color:{{sendColor}}" bindtap="getCode">
+ {{sendTime}}
+ </view>
+
+ </view>
+ <view class="inline-item" style="margin-top:30rpx;background-color:rgb(240, 240, 240)">
+ <checkbox-group bindchange="checkboxChange">
+ <label>
+ <checkbox value="1" class="checkbox" />我已阅读并同意
+ </label>
+ </checkbox-group>
+
+ <view class="policy" bindtap="showPolicy">《用户协议与隐私条款》</view>
+ </view>
+
+ <button bindtap="doRegister" class="long-btn" style="width: 90%;">注册</button>
+
+ </view>
+</view>
\ No newline at end of file
diff --git a/pages/register/register.wxss b/pages/register/register.wxss
new file mode 100644
index 0000000..bb3e2e8
--- /dev/null
+++ b/pages/register/register.wxss
@@ -0,0 +1,8 @@
+/* pages/register/register.wxss */
+
+
+
+
+.policy{
+ color: rgb(82, 178, 243);
+}
\ No newline at end of file