Commit af95cf13 by 施宇

Merge branch 'master' of http://119.23.72.7/shiyu/icsalesProgram

parents 0a15377b 27995165
......@@ -33,6 +33,7 @@ function addMember(id) {
data: member
});
}
App({
globalData: {
unReadMessageNum: 0,
......@@ -42,10 +43,10 @@ App({
closed: false,
curOpenOpt: {},
open(opt) {
wx.showLoading({
/* wx.showLoading({
title: '正在初始化客户端...',
mask: true
})
}) */
this.curOpenOpt = opt;
WebIM.conn.open(opt);
this.closed = false;
......@@ -59,16 +60,49 @@ App({
},
onLaunch() {
let me = this;
//验证用户是否登录状态
wx.getStorage({
key: 'access_token',
success(res) {
if(res.data){
wx.switchTab({
url: '/pages/tab/home/home'
});
}
}
})
// 查看是否授权
wx.getSetting({
success(res) {
console.log(res)
if (res.authSetting['scope.userInfo']) {
// 已经授权
wx.switchTab({
url: '/pages/tab/home/home'
})
}
}
})
wx.setStorage({
key: "myUsername",
data: '18271408717'
});
this.conn.open({
apiUrl: WebIM.config.apiURL,
user: '18271408717',
pwd: '123456',
appKey: WebIM.config.appkey
});
WebIM.conn.listen({
onOpened(message) {
......@@ -80,10 +114,10 @@ App({
});
},
onSocketConnected() {
wx.showToast({
/* wx.showToast({
title: "socket连接成功",
duration: 2000
});
}); */
},
onClosed() {
wx.showToast({
......
{
"pages": [
"pages/person/auth/index",
"pages/person/verifycode/index",
"pages/person/login/index",
"pages/person/getphone/index",
"pages/person/agreement/index",
"pages/person/successfully/index",
"pages/person/register/index",
"pages/tab/home/home",
"pages/form/good/index",
"pages/tab/good/good",
......@@ -7,7 +14,6 @@
"pages/form/bj/index",
"pages/list/bj/index",
"pages/list/xj/index",
"pages/login/index",
"pages/tab/message/message",
"pages/tab/me/me",
"pages/search/index/index",
......@@ -15,8 +21,7 @@
"pages/form/xj/index",
"pages/detail/good/index",
"pages/detail/xj/index",
"pages/list/qd/index",
"pages/detail/chat/index"
"pages/list/qd/index"
],
"window": {
"backgroundTextStyle": "light",
......
// pages/login/index.js
// pages/person/agreement/index.js
Page({
/**
......
{
"usingComponents": {},
"navigationBarTitleText": "IC业务助手用户协议",
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"backgroundColor": "white"
}
\ No newline at end of file
<view class="agreement">
<text class="t1">本协议是您与猎芯网(简称"本站",网址:http://www.ichunt.com)所有者(以下简称为"猎芯网")之间就猎芯网服务等相关事宜所订立的契约,请您仔细阅读本注册协议,您点击"下一步"按钮后,本协议即构成对双方有约束力的法律文件。</text>
</view>
\ No newline at end of file
.agreement{
padding: 34rpx 55rpx 0 55rpx;
}
.agreement .t1{
font-size: 26rpx;
color: #8A9299;
line-height:30px;
text-align: justify;
}
\ No newline at end of file
const http = require('../../../utils/util.js');
import { apis } from '../../../utils/api.js';
Page({
/**
* 页面的初始数据
*/
data: {
canIUse: wx.canIUse('button.open-type.getUserInfo'),
userinfo: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
/**
* 授权用户信息
*/
bindGetUserInfo(e) {
let self = this;
if (e.detail.errMsg == 'getUserInfo:ok'){
wx.login({
success(res) {
if (res.code) {
//存储用户资料
self.setData({
userinfo: e.detail.userInfo
});
//获取openId
http.getData(apis.getOpenId, {
code: res.code,
'userinfo[avatarUrl]': self.data.userinfo.avatarUrl,
'userinfo[nickName]': self.data.userinfo.nickName
}, function (res) {
if (res.err_code === 0) {
wx.setStorage({
key: "openid",
data: res.data.openid
});
wx.setStorage({
key: "session_key",
data: res.data.session_key
});
//授权成功跳转一键获取手机号
wx.navigateTo({
url: '/pages/person/getphone/index'
});
}
}, true);
} else {
console.log('登录失败!' + res.errMsg);
}
},
fail(res) {
wx.showLoading({
title: '网络不通,请重试'
})
}
})
}else{
//用户拒绝获取资料
wx.navigateTo({
url: '/pages/person/login/index'
});
}
},
/**
* 暂不注册
*/
toUrl: function() {
wx.switchTab({
url: '/pages/tab/home/home'
})
}
})
\ No newline at end of file
......@@ -2,8 +2,8 @@
"usingComponents": {
},
"navigationBarTitleText": "IC登录",
"navigationBarBackgroundColor": "#0D84D1",
"navigationBarTextStyle": "white",
"backgroundColor": "#0d84d1"
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"backgroundColor": "white"
}
\ No newline at end of file
<view class='person'>
<view class='head column verCenter'>
<view class="head-logo column">
<view class='logo'>
<cover-image src="/res/images/imgs/iclogo.png" class="img"></cover-image>
</view>
<text class="t1">IC业务助手</text>
<text class='t2'>让询报价更轻松、便捷</text>
</view>
<!-- 授权 -->
<view class="auth">
<view>
<button wx:if="{{canIUse}}" class="btn-com btn-com-b" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">一键授权</button>
<view wx:else>请升级微信版本</view>
<view class="btn-com btn-com-c" bindtap="toUrl">暂不注册,先看看</view>
</view>
<view class="text-wrap row">
<navigator url="/pages/person/verifycode/index" class="btn-text mr">验证码登录</navigator>
<navigator url="/pages/person/login/index" class="btn-text">密码登录</navigator>
</view>
</view>
</view>
</view>
\ No newline at end of file
const http = require('../../../utils/util.js');
import { apis } from '../../../utils/api.js';
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
/**
* 一键获取手机号
*/
getPhoneNumber(e) {
if (e.detail.errMsg == 'getPhoneNumber:ok'){
http.getData(apis.getwxUserInfo, {
openid: wx.getStorageSync('openid'),
session_key: wx.getStorageSync('session_key'),
encryptedData: e.detail.encryptedData,
iv: e.detail.iv
}, function (res) {
if (res.err_code === 0) {
//注入token
wx.setStorage({
key: "access_token",
data: res.data.access_token
});
wx.switchTab({
url: '/pages/tab/home/home'
});
}
},true);
}else{
//用户拒绝获取手机
wx.navigateTo({
url: '/pages/person/login/index'
});
}
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"backgroundColor": "white"
}
\ No newline at end of file
......@@ -11,12 +11,11 @@
<!-- 授权 -->
<view class="auth">
<view>
<button class="btn-com btn-com-b">一键授权(微信用户资料)</button>
<view class="btn-com btn-com-c">暂不注册,先看看</view>
<button class="btn-com btn-com-b" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">一键获取手机号</button>
</view>
<view class="text-wrap row">
<view class="btn-text mr">验证码登录</view>
<view class="btn-text">密码登录</view>
<navigator url="/pages/person/verifycode/index" class="btn-text mr">验证码登录</navigator>
<navigator url="/pages/person/login/index" class="btn-text">密码登录</navigator>
</view>
</view>
......
/* pages/login/index.wxss */
.person {
padding: 108rpx 0 0 0;
}
.person .logo .img {
width: 225rpx;
height: 201rpx;
}
.person .t1 {
margin-top: 50rpx;
margin-bottom: 10rpx;
font-size: 46rpx;
color: #3f3a3a;
font-weight: 600;
}
.person .t2 {
font-size: 26rpx;
color: #9f9fa0;
}
.person .btn-com {
display: block;
}
.person .auth {
width: 100%;
}
.person .auth .btn-com-b {
margin-top: 80rpx;
}
.person .auth .btn-com-c {
border: 2rpx solid rgba(216, 223, 230, 1);
font-size: 32rpx;
color: #adb6bf;
background: none;
margin-top: 40rpx;
}
.text-wrap {
text-align: center;
align-content: center;
justify-content: center;
padding-top: 260rpx;
}
.btn-text {
color: #8a9299;
font-size: 25rpx;
}
.text-wrap .mr {
margin-right: 60rpx;
}
const http = require('../../../utils/util.js');
import {
apis
} from '../../../utils/api.js';
Page({
/**
* 页面的初始数据
*/
data: {
error: false,
errorText: '',
visiblePwd: false,
passwordType: true,
mobileFlag: false,
passwordFlag: false,
disabled: false,
loading: false,
formData: {
mobile: '',
password: ''
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
/**
* 校验字段
*/
calcForm: function (val, type) {
let mobile = val.mobile;
let password = val.password;
let reg_mobile = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
let reg_pwd = /^[0-9A-Za-z]{6,}$/;
if (!mobile) {
this.setData({
error: true,
errorText: '手机号不能为空',
mobileFlag: true
});
return false;
}
if (!reg_mobile.test(mobile)) {
this.setData({
error: true,
errorText: '请填写正确的手机号',
mobileFlag: true
});
return false;
}
if (!password) {
this.setData({
error: true,
errorText: '密码不能为空',
mobileFlag: false,
passwordFlag: true
});
return false;
}
if (!reg_pwd.test(password)) {
this.setData({
error: true,
errorText: '密码由字母和数字组成,且不能少于6位',
mobileFlag: false,
passwordFlag: true
});
return false;
}
this.setData({
error: false,
errorText: '',
passwordFlag: false,
mobileFlag: false
});
return true;
},
/**
* 校验字段
*/
bindinputFn: function (e) {
let value = e.detail.value
let reg_mobile = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
let reg_pwd = /^[0-9A-Za-z]{6,}$/;
if (e.currentTarget.dataset.type == 1) {
if (value) {
this.setData({
error: true,
errorText: '请填写正确的手机号',
mobileFlag: true
});
if (reg_mobile.test(value)) {
this.setData({
error: false,
errorText: '',
mobileFlag: false
});
}
}
} else {
if (value) {
this.setData({
error: true,
errorText: '密码由字母和数字组成,且不能少于6位',
passwordFlag: true
});
if (reg_pwd.test(value)) {
this.setData({
error: false,
errorText: '',
passwordFlag: false
});
}
}
}
},
/**
* 登录
*/
formSubmit: function (e) {
var self=this;
if (this.calcForm(e.detail.value)) {
self.setData({
disabled: true,
loading: true
});
http.postData(apis.authlogin, e.detail.value, function (res) {
if (res.err_code === 0) {
//注入token
wx.setStorage({
key: "access_token",
data: res.data.access_token
});
wx.switchTab({
url: '/pages/tab/home/home'
})
} else {
wx.showToast({
title: res.err_msg,
icon: 'none',
duration: 2000
});
}
self.setData({
disabled: false,
loading: false
});
});
}
},
/**
* 密码是否可见
*/
toggleFn: function (e) {
if (this.data['visiblePwd']) {
this.setData({
visiblePwd: false,
passwordType: true
});
} else {
this.setData({
visiblePwd: true,
passwordType: false
});
}
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"backgroundColor": "white"
}
\ No newline at end of file
.person {
margin: 0 55rpx;
padding-top: 32rpx;
.tit {
margin-bottom: 50rpx;
.t1 {
font-size: 48rpx;
color: #2e3033;
font-weight: 600;
line-height: 67rpx;
}
}
.inp-wrap {
height: 98rpx;
border-bottom: 1px solid #d8dfe6;
padding-left: 10rpx;
input {
padding-left: 35rpx;
width: 340rpx;
}
.icon {
color: #adb6bf;
}
.pwd-ico {
padding-left: 160rpx;
}
.vcode {
font-size: 32rpx;
color: #61a0f2;
background: none;
font-weight: 400;
border: 0 !important;
&::after {
border: 0 !important;
}
}
.areacode {
border-left: 1px solid #d8dfe6;
.tel-value {
font-size: 32rpx;
color: #515559;
padding: 7rpx 11rpx 7rpx 16rpx;
}
.icon {
color: #d8dfe6;
font-size: 26rpx;
}
}
}
.login-button {
height: 98rpx;
line-height: 98rpx;
background: rgba(13, 132, 209, 1) !important;
box-shadow: 0px 6rpx 10rpx 0rpx rgba(97, 160, 242, 0.3) !important;
border-radius: 8rpx;
color: #fff !important;
font-size: 32rpx;
margin-top: 40rpx;
}
.bottom {
padding-top: 40rpx;
.txt {
font-size: 28rpx;
color: #8a9299;
}
}
.error-wrap {
margin-top: 24rpx;
.error {
.iconfont {
color: #ea1717;
}
.txt {
font-size: 24rpx;
color: #ea1717;
margin-left: 15rpx;
font-weight: 400;
}
}
.forget {
font-size: 28rpx;
color: #61a0f2;
}
}
.placeholderClass {
color: #adb6bf;
font-size: 32rpx;
}
.inp-error {
border-bottom: 1px solid #ea1717;
.icon {
color: #ea1717;
}
input {
color: #ea1717;
}
}
}
<!-- 密码登录 -->
<view class="person">
<view class="column tit">
<text class="t1">Hi,上午好</text>
<text class="t1">欢迎使用IC业务助手!</text>
</view>
<form bindsubmit="formSubmit">
<view class="inp-wrap row verCenter {{mobileFlag ? 'inp-error':''}}">
<text class="icon iconfont iconiconxiantiaoshouji21"></text>
<view class="form-item-right row verCenter bothSide">
<input placeholder="请输入手机号" placeholder-class="placeholderClass" name="mobile" type="number" data-type="1" bindinput='bindinputFn' bindblur='bindblurFn'></input>
<view class="areacode" bindtap="switchPrice">
<text class="tel-value">中国 + 86</text>
<text class="icon iconfont iconbianzu1"></text>
</view>
</view>
</view>
<view class="inp-wrap row verCenter {{passwordFlag ? 'inp-error':''}}">
<text class="icon iconfont iconiconxiantiaoshouji2"></text>
<view class="form-item-right row verCenter bothSide">
<input placeholder="请输入密码" placeholder-class="placeholderClass" class="pwd" name="password" data-type="2" password='{{passwordType}}' bindinput='bindinputFn' bindblur='bindblurFn'></input>
<block wx:if="{{visiblePwd}}">
<text class="icon iconfont iconiconxiantiaoshouji3 pwd-ico" bindtap="toggleFn"></text>
</block>
<block wx:else>
<text class="icon iconfont iconiconxiantiaoshouji4 pwd-ico" bindtap="toggleFn"></text>
</block>
</view>
</view>
<view class="error-wrap row bothSide verCenter">
<view class="error">
<block wx:if="{{error}}">
<text class="icon iconfont iconiconxiantiaoshouji1"></text>
<text class="txt">{{errorText}}</text>
</block>
</view>
<navigator class="forget" url="pages/person/verifycode/index">忘记密码?</navigator>
</view>
<button class="login-button" form-type="submit" disabled="{{disabled}}" loading="{{loading}}">登录</button>
</form>
<view class="bottom row bothSide">
<navigator class="txt" url="/pages/person/verifycode/index">验证码登录</navigator>
<navigator class="txt" url="/pages/person/verifycode/index">注册账户</navigator>
</view>
</view>
\ No newline at end of file
.person {
margin: 0 55rpx;
padding-top: 32rpx;
}
.person .tit {
margin-bottom: 50rpx;
}
.person .tit .t1 {
font-size: 48rpx;
color: #2e3033;
font-weight: 600;
line-height: 67rpx;
}
.person .inp-wrap {
height: 98rpx;
border-bottom: 1px solid #d8dfe6;
padding-left: 10rpx;
}
.person .inp-wrap input {
padding-left: 35rpx;
width: 340rpx;
}
.person .inp-wrap .icon {
color: #adb6bf;
}
.person .inp-wrap .pwd-ico {
padding-left: 160rpx;
}
.person .inp-wrap .vcode {
font-size: 32rpx;
color: #61a0f2;
background: none;
font-weight: 400;
border: 0 !important;
}
.person .inp-wrap .vcode::after {
border: 0 !important;
}
.person .inp-wrap .areacode {
border-left: 1px solid #d8dfe6;
}
.person .inp-wrap .areacode .tel-value {
font-size: 32rpx;
color: #515559;
padding: 7rpx 11rpx 7rpx 16rpx;
}
.person .inp-wrap .areacode .icon {
color: #d8dfe6;
font-size: 26rpx;
}
.person .login-button {
height: 98rpx;
line-height: 98rpx;
background: #0d84d1 !important;
box-shadow: 0px 6rpx 10rpx 0rpx rgba(97, 160, 242, 0.3) !important;
border-radius: 8rpx;
color: #fff !important;
font-size: 32rpx;
margin-top: 40rpx;
}
.person .bottom {
padding-top: 40rpx;
}
.person .bottom .txt {
font-size: 28rpx;
color: #8a9299;
}
.person .error-wrap {
margin-top: 24rpx;
}
.person .error-wrap .error .iconfont {
color: #ea1717;
}
.person .error-wrap .error .txt {
font-size: 24rpx;
color: #ea1717;
margin-left: 15rpx;
font-weight: 400;
}
.person .error-wrap .forget {
font-size: 28rpx;
color: #61a0f2;
}
.person .placeholderClass {
color: #adb6bf;
font-size: 32rpx;
}
.person .inp-error {
border-bottom: 1px solid #ea1717;
}
.person .inp-error .icon {
color: #ea1717;
}
.person .inp-error input {
color: #ea1717;
}
// pages/person/register/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "免费注册",
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"backgroundColor": "white"
}
\ No newline at end of file
.person {
margin: 0 55rpx;
padding-top: 32rpx;
.tit {
margin-bottom: 50rpx;
.t1 {
font-size: 48rpx;
color: #2e3033;
font-weight: 600;
line-height: 67rpx;
}
}
.inp-wrap {
height: 98rpx;
border-bottom: 1px solid #d8dfe6;
padding-left: 10rpx;
input {
padding-left: 35rpx;
width: 340rpx;
}
.icon {
color: #adb6bf;
}
.pwd-ico {
padding-left: 160rpx;
}
.vcode {
font-size: 32rpx;
color: #61a0f2;
background: none;
font-weight: 400;
border: 0 !important;
&::after {
border: 0 !important;
}
}
.areacode {
border-left: 1px solid #d8dfe6;
.tel-value {
font-size: 32rpx;
color: #515559;
padding: 7rpx 11rpx 7rpx 16rpx;
}
.icon {
color: #d8dfe6;
font-size: 26rpx;
}
}
}
.register-button {
height: 98rpx;
line-height: 98rpx;
background: rgba(13, 132, 209, 1);
box-shadow: 0px 6rpx 10rpx 0rpx rgba(97, 160, 242, 0.3);
border-radius: 8rpx;
color: #fff;
font-size: 32rpx;
margin-top: 40rpx;
}
.error-wrap {
margin-top: 24rpx;
.error {
.iconfont {
color: #ea1717;
}
.txt {
font-size: 24rpx;
color: #ea1717;
margin-left: 15rpx;
}
}
.forget {
font-size: 28rpx;
color: #61a0f2;
}
}
.agreement{
margin-top: 40rpx;
text-align: center;
.t1{
font-size: 24rpx;
color: #8A9299;
}
.t2{
font-size: 24rpx;
color: #61A0F2;
}
}
.placeholderClass {
color: #adb6bf;
font-size: 32rpx;
}
}
<!-- 注册 -->
<view class="person">
<view class="column tit">
<text class="t1">Hi,上午好</text>
<text class="t1">欢迎注册账户!</text>
</view>
<view class="inp-wrap row verCenter">
<text class="icon iconfont iconiconxiantiaoshouji21"></text>
<view class="form-item-right row verCenter bothSide">
<input placeholder="请输入手机号" placeholder-class="placeholderClass"></input>
<view class="areacode" bindtap="switchPrice">
<text class="tel-value">中国 + 86</text>
<text class="icon iconfont iconbianzu1"></text>
</view>
</view>
</view>
<view class="inp-wrap row verCenter">
<text class="icon iconfont iconiconxiantiaoshouji2"></text>
<view class="form-item-right row verCenter bothSide">
<input placeholder="请设置密码" placeholder-class="placeholderClass" class="pwd"></input>
<text class="icon iconfont iconiconxiantiaoshouji4 pwd-ico"></text>
</view>
</view>
<view class="inp-wrap row verCenter">
<text class="icon iconfont iconiconxiantiaoshouji"></text>
<view class="form-item-right row verCenter bothSide">
<input placeholder="请输入验证码" placeholder-class="placeholderClass"></input>
<button class="vcode">发送验证码</button>
</view>
</view>
<view class="error-wrap row bothSide verCenter">
<view class="error">
<text class="icon iconfont iconiconxiantiaoshouji1"></text>
<text class="txt">密码错误,请重新输入</text>
</view>
</view>
<button class="register-button">注册</button>
<view class="agreement">
<text class="t1">点击注册即默认同意</text>
<navigator url="/pages/person/agreement/index" class="t2">《IC业务助手用户协议》</navigator>
</view>
</view>
\ No newline at end of file
.person {
margin: 0 55rpx;
padding-top: 32rpx;
}
.person .tit {
margin-bottom: 50rpx;
}
.person .tit .t1 {
font-size: 48rpx;
color: #2e3033;
font-weight: 600;
line-height: 67rpx;
}
.person .inp-wrap {
height: 98rpx;
border-bottom: 1px solid #d8dfe6;
padding-left: 10rpx;
}
.person .inp-wrap input {
padding-left: 35rpx;
width: 340rpx;
}
.person .inp-wrap .icon {
color: #adb6bf;
}
.person .inp-wrap .pwd-ico {
padding-left: 160rpx;
}
.person .inp-wrap .vcode {
font-size: 32rpx;
color: #61a0f2;
background: none;
font-weight: 400;
border: 0 !important;
}
.person .inp-wrap .vcode::after {
border: 0 !important;
}
.person .inp-wrap .areacode {
border-left: 1px solid #d8dfe6;
}
.person .inp-wrap .areacode .tel-value {
font-size: 32rpx;
color: #515559;
padding: 7rpx 11rpx 7rpx 16rpx;
}
.person .inp-wrap .areacode .icon {
color: #d8dfe6;
font-size: 26rpx;
}
.person .register-button {
height: 98rpx;
line-height: 98rpx;
background: #0d84d1;
box-shadow: 0px 6rpx 10rpx 0rpx rgba(97, 160, 242, 0.3);
border-radius: 8rpx;
color: #fff;
font-size: 32rpx;
margin-top: 40rpx;
}
.person .error-wrap {
margin-top: 24rpx;
}
.person .error-wrap .error .iconfont {
color: #ea1717;
}
.person .error-wrap .error .txt {
font-size: 24rpx;
color: #ea1717;
margin-left: 15rpx;
}
.person .error-wrap .forget {
font-size: 28rpx;
color: #61a0f2;
}
.person .agreement {
margin-top: 40rpx;
text-align: center;
}
.person .agreement .t1 {
font-size: 24rpx;
color: #8A9299;
}
.person .agreement .t2 {
font-size: 24rpx;
color: #61A0F2;
}
.person .placeholderClass {
color: #adb6bf;
font-size: 32rpx;
}
// pages/person/successfully/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "注册成功",
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"backgroundColor": "white"
}
\ No newline at end of file
.success {
width: 100%;
padding-top: 50rpx;
.img {
width: 480rpx;
height: 346rpx;
}
.tit {
padding-top: 40rpx;
margin-bottom: 120rpx;
font-size: 48rpx;
color: #2e3033;
line-height: 67rpx;
font-weight: 600;
display: block;
}
.btn {
width: 87%;
height: 98rpx;
line-height: 98rpx;
background: rgba(13, 132, 209, 1);
box-shadow: 0px 6px 10px 0px rgba(97, 160, 242, 0.3);
border-radius: 8px;
font-size: 32rpx;
color: #ffffff;
text-align: center;
display: block;
}
.txt {
margin-top: 40rpx;
padding: 0 114rpx;
text-align: center;
.t1 {
font-size: 26rpx;
color: #8a9299;
}
.t2 {
font-size: 26rpx;
color: #61a0f2;
}
}
.skip-text {
margin-top: 100rpx;
font-size: 28rpx;
color: #8A9299;
}
}
<view class="success column rowCenter verCenter">
<cover-image src="/res/images/imgs/success.png" class="img"></cover-image>
<text class="tit">恭喜您,注册成功</text>
<navigator url="/pages/person/login/index" class="btn">资质认证</navigator>
<view class="txt">
<text class="t1">为了保证询报价的真实性,请完成“</text>
<text class="t2">资质认证</text>
<text class="t1">” 否则将影响您的询价和报价业务</text>
</view>
<text class="skip-text">暂不认证,跳过</text>
</view>
.success {
width: 100%;
padding-top: 50rpx;
}
.success .img {
width: 480rpx;
height: 346rpx;
}
.success .tit {
padding-top: 40rpx;
margin-bottom: 120rpx;
font-size: 48rpx;
color: #2e3033;
line-height: 67rpx;
font-weight: 600;
display: block;
}
.success .btn {
width: 87%;
height: 98rpx;
line-height: 98rpx;
background: #0d84d1;
box-shadow: 0px 6px 10px 0px rgba(97, 160, 242, 0.3);
border-radius: 8px;
font-size: 32rpx;
color: #ffffff;
text-align: center;
display: block;
}
.success .txt {
margin-top: 40rpx;
padding: 0 114rpx;
text-align: center;
}
.success .txt .t1 {
font-size: 26rpx;
color: #8a9299;
}
.success .txt .t2 {
font-size: 26rpx;
color: #61a0f2;
}
.success .skip-text {
margin-top: 100rpx;
font-size: 28rpx;
color: #8A9299;
}
const http = require('../../../utils/util.js');
import {
apis
} from '../../../utils/api.js';
Page({
/**
* 页面的初始数据
*/
data: {
error: false,
errorText: '',
mobileFlag: false,
codeFlag: false,
disabled: false,
disabledBtn: false,
loading: false,
currentTime: 61,
vcode:true,
vcodeFlag:true,
timeText: '发送验证码',
formData: {
mobile: '',
code: ''
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
/**
* 获取验证码
*/
getCode: function() {
let self = this;
var currentTime = this.data.currentTime;
var interval = setInterval(function() {
currentTime--;
self.setData({
timeText: currentTime + 's'
});
if (currentTime <= 0) {
clearInterval(interval);
self.setData({
timeText: '重新发送',
currentTime: 61,
disabled: false
});
}
}, 1000)
},
/**
* 发送验证码
*/
getVerificationCode: function(e) {
let self = this;
if (self.data.formData.mobile) {
http.getData(apis.getWxCode, {
mobile: self.data.formData.code,
code_type: 2
}, function(res) {
if (res.err_code === 0) {
self.getCode();
self.setData({
disabled: true
});
}else{
wx.showToast({
title: '发送失败',
icon: 'none',
duration: 2000
});
}
}, true);
} else {
this.setData({
error: true,
errorText: '手机号不能为空',
mobileFlag: true
});
}
},
/**
* 校验字段
*/
bindinputFn: function(e) {
let value = e.detail.value
let reg_mobile = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
if (e.currentTarget.dataset.type == 1) {
this.setData({
'formData.mobile': value
});
if (value) {
this.setData({
error: true,
errorText: '请填写正确的手机号',
mobileFlag: true
});
if (reg_mobile.test(value)) {
this.setData({
error: false,
errorText: '',
mobileFlag: false
});
}
}
} else {
if (value) {
this.setData({
error: false,
errorText: '',
codeFlag: false
});
}
}
},
/**
* 校验字段
*/
calcForm: function(val, type) {
let mobile = val.mobile;
let code = val.code;
let reg_mobile = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
if (!mobile) {
this.setData({
error: true,
errorText: '手机号不能为空',
mobileFlag: true
});
return false;
}
if (!reg_mobile.test(mobile)) {
this.setData({
error: true,
errorText: '请填写正确的手机号',
mobileFlag: true
});
return false;
}
if (!code) {
this.setData({
error: true,
errorText: '验证码不能为空',
codeFlag: true
});
return false;
}
this.setData({
error: false,
errorText: '',
codeFlag: false,
mobileFlag: false
});
return true;
},
/**
* 登录
*/
formSubmit: function(e) {
var self = this;
if (this.calcForm(e.detail.value)) {
self.setData({
disabledBtn: true,
loading: true
});
http.postData(apis.authMobilelogin, e.detail.value, function(res) {
if (res.err_code === 0) {
//注入token
wx.setStorage({
key: "access_token",
data: res.data.access_token
});
// wx.switchTab({
// url: '/pages/tab/home/home'
// })
} else {
wx.showToast({
title: res.err_msg,
icon: 'none',
duration: 2000
});
}
self.setData({
disabledBtn: false,
loading: false
});
});
}
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"backgroundColor": "white"
}
\ No newline at end of file
.person {
margin: 0 55rpx;
padding-top: 32rpx;
.tit {
margin-bottom: 50rpx;
.t1 {
font-size: 48rpx;
color: #2e3033;
font-weight: 600;
line-height: 67rpx;
}
}
.inp-wrap {
height: 98rpx;
border-bottom: 1px solid #d8dfe6;
padding-left: 10rpx;
input {
padding-left: 35rpx;
width: 340rpx;
}
.icon {
color: #adb6bf;
}
.vcode {
width: 219rpx;
text-align: right;
font-size: 32rpx;
color: #61a0f2;
background: none;
font-weight: 400;
border: 0 !important;
&::after {
border: 0 !important;
}
}
.vcode-color{
color: #ADB6BF;
}
.areacode {
border-left: 1px solid #d8dfe6;
.tel-value {
font-size: 32rpx;
color: #515559;
padding: 7rpx 11rpx 7rpx 16rpx;
}
.icon {
color: #d8dfe6;
font-size: 26rpx;
}
}
}
.login-button {
height: 98rpx;
line-height: 98rpx;
background: rgba(13, 132, 209, 1) !important;
box-shadow: 0px 6rpx 10rpx 0rpx rgba(97, 160, 242, 0.3) !important;
border-radius: 8rpx;
color: #fff !important;
font-size: 32rpx;
margin-top: 40rpx;
}
.bottom {
padding-top: 40rpx;
.txt {
font-size: 28rpx;
color: #8a9299;
}
}
.error {
margin-top: 24rpx;
.iconfont {
color: #ea1717;
}
.txt {
font-size: 24rpx;
color: #ea1717;
margin-left: 15rpx;
}
}
.placeholderClass {
color: #adb6bf;
font-size: 32rpx;
}
.inp-error {
border-bottom: 1px solid #ea1717;
.icon {
color: #ea1717;
}
input {
color: #ea1717;
}
}
}
<!-- 验证码登录 -->
<view class="person">
<view class="column tit">
<text class="t1">Hi,上午好</text>
<text class="t1">欢迎使用IC业务助手!</text>
</view>
<form bindsubmit="formSubmit">
<view class="inp-wrap row verCenter {{mobileFlag ? 'inp-error':''}}">
<text class="icon iconfont iconiconxiantiaoshouji21"></text>
<view class="form-item-right row verCenter bothSide">
<input placeholder="请输入手机号" placeholder-class="placeholderClass" name='mobile' data-type="1" bindinput='bindinputFn'></input>
<view class="areacode" bindtap="switchPrice">
<text class="tel-value">中国 + 86</text>
<text class="icon iconfont iconbianzu1"></text>
</view>
</view>
</view>
<view class="inp-wrap row verCenter {{vcodeFlag ? 'inp-error':''}}" wx:if="{{vcode}}">
<text class="icon iconfont iconiconxiantiaoshouji"></text>
<view class="form-item-right row verCenter bothSide">
<input placeholder="请输入验证码" placeholder-class="placeholderClass" name='code' data-type="2" bindinput='bindinputFn'></input>
<button class="vcode {{disabled ? 'vcode-color':''}}" disabled="{{disabled}}" bindtap="getVerificationCode">{{timeText}}</button>
</view>
</view>
<view class="inp-wrap row verCenter {{codeFlag ? 'inp-error':''}}">
<text class="icon iconfont iconiconxiantiaoshouji"></text>
<view class="form-item-right row verCenter bothSide">
<input placeholder="请输入验证码" placeholder-class="placeholderClass" name='code' data-type="2" bindinput='bindinputFn'></input>
<button class="vcode {{disabled ? 'vcode-color':''}}" disabled="{{disabled}}" bindtap="getVerificationCode">{{timeText}}</button>
</view>
</view>
<view class="error">
<block wx:if="{{error}}">
<text class="icon iconfont iconiconxiantiaoshouji1"></text>
<text class="txt">{{errorText}}</text>
</block>
</view>
<button class="login-button" form-type="submit" disabled="{{disabledBtn}}" loading="{{loading}}">登录</button>
</form>
<view class="bottom row bothSide">
<navigator url="/pages/person/login/index" class="txt">密码登录</navigator>
<navigator url="/pages/person/register/index" class="txt">注册账户</navigator>
</view>
</view>
\ No newline at end of file
.person {
margin: 0 55rpx;
padding-top: 32rpx;
}
.person .tit {
margin-bottom: 50rpx;
}
.person .tit .t1 {
font-size: 48rpx;
color: #2e3033;
font-weight: 600;
line-height: 67rpx;
}
.person .inp-wrap {
height: 98rpx;
border-bottom: 1px solid #d8dfe6;
padding-left: 10rpx;
}
.person .inp-wrap input {
padding-left: 35rpx;
width: 340rpx;
}
.person .inp-wrap .icon {
color: #adb6bf;
}
.person .inp-wrap .vcode {
width: 219rpx;
text-align: right;
font-size: 32rpx;
color: #61a0f2;
background: none;
font-weight: 400;
border: 0 !important;
}
.person .inp-wrap .vcode::after {
border: 0 !important;
}
.person .inp-wrap .vcode-color {
color: #ADB6BF;
}
.person .inp-wrap .areacode {
border-left: 1px solid #d8dfe6;
}
.person .inp-wrap .areacode .tel-value {
font-size: 32rpx;
color: #515559;
padding: 7rpx 11rpx 7rpx 16rpx;
}
.person .inp-wrap .areacode .icon {
color: #d8dfe6;
font-size: 26rpx;
}
.person .login-button {
height: 98rpx;
line-height: 98rpx;
background: #0d84d1 !important;
box-shadow: 0px 6rpx 10rpx 0rpx rgba(97, 160, 242, 0.3) !important;
border-radius: 8rpx;
color: #fff !important;
font-size: 32rpx;
margin-top: 40rpx;
}
.person .bottom {
padding-top: 40rpx;
}
.person .bottom .txt {
font-size: 28rpx;
color: #8a9299;
}
.person .error {
margin-top: 24rpx;
}
.person .error .iconfont {
color: #ea1717;
}
.person .error .txt {
font-size: 24rpx;
color: #ea1717;
margin-left: 15rpx;
}
.person .placeholderClass {
color: #adb6bf;
font-size: 32rpx;
}
.person .inp-error {
border-bottom: 1px solid #ea1717;
}
.person .inp-error .icon {
color: #ea1717;
}
.person .inp-error input {
color: #ea1717;
}
......@@ -5,10 +5,19 @@ const user_url = 'http://userapi.icsales.cc';
const goods_url = 'http://goodsapi.icsales.cc';
const inquiry_url = 'http://inquiryapi.icsales.cc';
const index_url = 'http://www.icsales.cc';
const apis = {
const apis = {
/**
* 授权接口
*/
getOpenId: auth_url + '/v1/getOpenId',
/**
* 用户注册
*/
* 获取微信用户信息
*/
getwxUserInfo: auth_url + '/v1/getwxUserInfo',
/**
* 用户注册
*/
authRegister: auth_url + '/auth/register',
/**
* 账号密码登录
......@@ -31,6 +40,10 @@ const apis = {
*/
getRegistCode: auth_url + '/v1/getRegistCode',
/**
* 微信验证码
*/
getWxCode: auth_url + '/v1/getwxcode',
/**
* 退出
*/
authLogout: auth_url + '/auth/logout',
......@@ -79,8 +92,8 @@ const apis = {
*/
goodsSave: goods_url + '/goods/save',
/***
* 商品上下架
*/
* 商品上下架
*/
goodsStatus: goods_url + "/goods/status",
/****
* 询价搜索 不需要token
......@@ -164,4 +177,8 @@ const apis = {
*/
userMarkmsg: user_url + '/user/markmsg'
}
export default apis
\ No newline at end of file
module.exports = {
apis: apis
}
//数据请求(get)
const getData = (url, callBack) => {
const getData = (url, param, callBack,loading) => {
wx.showNavigationBarLoading();
var params = Object.assign({}, param, { pf: 1 });
if(loading){
wx.showLoading();
}
wx.request({
url: getApp().globalUrl.baseUrl + url,
url: url,
data: params,
header: {
"Content-Type": "applciation/json"
},
success: (res) => {
callBack(true, res.data)
typeof callBack == "function" && callBack(res.data, "");
wx.hideNavigationBarLoading();
wx.hideLoading();
},
fail: (err) => {
callBack(false, err)
typeof callBack == "function" && callBack(null, err.errMsg);
console.log(err);
wx.hideNavigationBarLoading();
wx.hideLoading();
}
})
};
//数据请求(post)
const postData = (url, data, callBack) => {
showLoading("加载中", true)
var Url = getApp().globalUrl.baseUrl + url;
const postData = (url, param, callBack, loading) => {
wx.showNavigationBarLoading();
var params = Object.assign({}, param, { pf: 1 });
if (loading) {
wx.showLoading();
}
wx.request({
url: Url,
data: data,
url: url,
data: params,
header: {
"Content-Type": "applciation/json"
},
method: "POST",
success: (res) => {
wx.hideLoading()
callBack(true, res.data)
typeof callBack == "function" && callBack(res.data, "");
wx.hideNavigationBarLoading();
wx.hideLoading();
},
fail: (err) => {
wx.hideLoading()
callBack(false, err)
typeof callBack == "function" && callBack(null, err.errMsg);
console.log(err);
wx.hideNavigationBarLoading();
wx.hideLoading();
}
})
};
//上传文件
const uploadFile = (paths, callBack) => {
let gUrl = getApp().globalUrl;
......@@ -48,7 +90,10 @@ const uploadFile = (paths, callBack) => {
success: (res) => {
var data = JSON.parse(res.data);
if (data.suc == 'y') {
callBack({ imgSrc: data.data.file.url, image_id: data.data.file.image_id })
callBack({
imgSrc: data.data.file.url,
image_id: data.data.file.image_id
})
} else {
showModal(data.msg);
}
......@@ -77,8 +122,10 @@ const chooseImg = (num, callback) => {
}
})
};
module.exports = {
getData: getData,
postData: postData,
chooseImg: chooseImg
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment