Commit bf75fc12a5657006d72c6ef2c020f19550c9ba8a

Authored by shaoshuai
1 parent 9356464c02
Exists in master

登录

Showing 12 changed files with 176 additions and 6 deletions

woman/app.json View file @ bf75fc1
... ... @@ -8,6 +8,7 @@
8 8 "pages/articleDetail/articleDetail",
9 9 "pages/hospitalDetail/hospitalDetail",
10 10 "pages/login/login",
  11 + "pages/phoneLogin/phoneLogin",
11 12 "pages/folicAcid/folicAcid",
12 13 "pages/cancerCheck/cancerCheck",
13 14 "pages/report_first/report_first",
woman/pages/login/login.js View file @ bf75fc1
... ... @@ -14,7 +14,12 @@
14 14 inputFocus: { codeInput: false },
15 15 time: '60s',
16 16 },
17   -
  17 + login(){
  18 + console.log("登录");
  19 + wx.navigateTo({
  20 + url: '../phoneLogin/phoneLogin'
  21 + })
  22 + },
18 23 // 获取验证码
19 24 getVerifyCode: function (e) {
20 25 if (timeCount < 60) {
woman/pages/login/login.json View file @ bf75fc1
1 1 {
2   - "navigationBarBackgroundColor": "#ffffff",
3   - "navigationBarTitleText": "手机登录",
4   - "navigationBarTextStyle": "black"
  2 + "navigationBarBackgroundColor": "#ffffff",
  3 + "navigationBarTitleText": "登录",
  4 + "navigationBarTextStyle": "black",
  5 + "navigationStyle": "custom"
  6 +
5 7 }
woman/pages/login/login.wxml View file @ bf75fc1
1 1 <view class="backgroundView">
2   -
  2 + <view class="i-column i-align-center">
  3 + <image class="logo" src="../../source/imageSource/bg/logo.png"></image>
  4 +
  5 + <button class="login" style="width: 670rpx;" bindtap="login">微信登陆</button>
  6 + </view>
3 7 </view>
woman/pages/login/login.wxss View file @ bf75fc1
1   -
  1 +.logo{
  2 + width: 200rpx;
  3 + height: 200rpx;
  4 + margin-top: 300rpx;
  5 +}
  6 +.login{
  7 + width: 670rpx;
  8 +height: 100rpx;
  9 +background: linear-gradient(135deg, #FFB4B4 0%, #FF8EA9 100%);
  10 +border-radius: 10rpx 10rpx 10rpx 10rpx;
  11 +opacity: 1;
  12 +color: white;
  13 +margin-top: 264rpx;
  14 +font-size: 34rpx;
  15 +line-height: 70rpx;
  16 +}
2 17 .input-placeholder {
3 18 font-size: 13px;
4 19 color: #979797;
woman/pages/mine/mine.js View file @ bf75fc1
... ... @@ -22,6 +22,11 @@
22 22 url: '../message/message'
23 23 })
24 24 },
  25 + goLogin() {
  26 + wx.navigateTo({
  27 + url: '../login/login'
  28 + })
  29 + },
25 30 /**
26 31 * 生命周期函数--监听页面加载
27 32 */
woman/pages/mine/mine.wxml View file @ bf75fc1
... ... @@ -42,5 +42,6 @@
42 42 <image class="icon-next" src="../../source/imageSource/icon/arrow_right.png"> </image>
43 43  
44 44 </view>
  45 + <view bindtap="goLogin">登录</view>
45 46 </view>
woman/pages/phoneLogin/phoneLogin.js View file @ bf75fc1
  1 +
  2 +// 网络请求工具类
  3 +var networkUtil = require('../../utils/network_util.js')
  4 +var numberUtil = require('../../utils/numberUtil.js')
  5 +var api = require('../../utils/apiFile.js')
  6 +
  7 +var timeCount = 60;
  8 +var timer;
  9 +var phone;
  10 +var name;
  11 +var isFirst = true
  12 +Page({
  13 + data: {
  14 + inputFocus: { codeInput: false },
  15 + time: '60s',
  16 + },
  17 + login(){
  18 + console.log("登录");
  19 +
  20 + },
  21 + // 获取验证码
  22 + getVerifyCode: function (e) {
  23 + if (timeCount < 60) {
  24 + return
  25 + }
  26 +
  27 + var that = this
  28 + networkUtil._post(api.bindDoc, { username: name, phone: phone }, function (res) {
  29 +
  30 + }, function (res) {
  31 + // timeCount = 60
  32 + // clearTimeout(timer);
  33 + // that.setData({
  34 + // time: '0s'
  35 + // })
  36 + // networkUtil.showErrorToast('获取验证码失败,请稍后再试')
  37 + })
  38 + if (timeCount == 60) {
  39 + this.keepTime()
  40 + }
  41 + // if (numberUtil.IsTelPhoneNumber(phone)) {
  42 +
  43 + // } else {
  44 + // wx.showToast({
  45 + // title: '请输入正确手机号码',
  46 + // })
  47 + // return
  48 + // }
  49 +
  50 +
  51 + },
  52 + // 计时器
  53 + keepTime: function () {
  54 + var that = this
  55 + timeCount--
  56 + that.setData({
  57 + time: timeCount + 's'
  58 + })
  59 + if (timeCount == 0) {
  60 + timeCount = 60
  61 + clearTimeout(timer);
  62 + return
  63 + }
  64 + timer = setTimeout(function () {
  65 + that.keepTime()
  66 + }, 1000)
  67 + },
  68 + blurInput: function (e) {
  69 + console.log(e)
  70 + phone = e.detail.value
  71 + },
  72 + // 提交表单
  73 + formSubmit: function (e) {
  74 +
  75 + // wx.navigateTo({
  76 + // url: '../childcare_knowledge/childcare_knowledge'
  77 + // })
  78 + var self = this
  79 + if (e.detail.value.code == "") {
  80 + wx.showModal({
  81 + title: '提示',
  82 + content: '请输入验证码',
  83 + showCancel: false,
  84 + success: function (res) {
  85 + }
  86 + })
  87 + return
  88 + }
  89 + // networkUtil.showLoading()
  90 + var param = { code: e.detail.value.code, phone: phone }
  91 + if (getApp().globalData.openInfo.mpid) {
  92 + param.gzopenid = getApp().globalData.openInfo.mpid
  93 + console.log('绑定mpid', param)
  94 + }
  95 + if (getApp().globalData.openInfo.childCode) {
  96 + param.jscode = getApp().globalData.openInfo.childCode
  97 + console.log('绑定code', param)
  98 + }
  99 + networkUtil._get(api.verifyCode, param, function (res) {
  100 + console.log(res)
  101 + self.loginSuccess(res.data)
  102 + }, function (res) {
  103 + networkUtil.showErrorToast(res.errormsg)
  104 + })
  105 + },
  106 + loginSuccess(data) {
  107 + console.log(data)
  108 + wx.setStorageSync('userToken', data.token)
  109 + getApp().globalData.token = data.token
  110 + // wx.navigateTo({
  111 + // url: '../HasDocumentedVerifySuccess/HasDocumentedVerifySuccess?name=' + name
  112 + // })
  113 + }
  114 +}
  115 +
  116 +)
woman/pages/phoneLogin/phoneLogin.json View file @ bf75fc1
  1 +{
  2 + "navigationBarBackgroundColor": "#ffffff",
  3 + "navigationBarTitleText": "手机登录",
  4 + "navigationBarTextStyle": "black"
  5 +
  6 +
  7 +}
woman/pages/phoneLogin/phoneLogin.wxml View file @ bf75fc1
  1 +<view class="backgroundView">
  2 + <view class="i-column i-align-center">
  3 + <image class="logo" src="../../source/imageSource/bg/logo.png"></image>
  4 +
  5 + <button class="login" style="width: 670rpx;" bindtap="login">微信登陆</button>
  6 + </view>
  7 +</view>
woman/pages/phoneLogin/phoneLogin.wxss View file @ bf75fc1
  1 +.title{
  2 + height: 62rpx;
  3 + font-size: 44rpx;
  4 + font-weight: 500;
  5 + color: #333333;
  6 + line-height: 52rpx;
  7 +}
woman/source/imageSource/bg/logo.png View file @ bf75fc1

17.9 KB