Commit aa6ff24a by tangjiale

提交

parent 9fae74ed
...@@ -3,7 +3,10 @@ ...@@ -3,7 +3,10 @@
"pages/index/index", "pages/index/index",
"pages/organ-my/organ-my", "pages/organ-my/organ-my",
"pages/my/my", "pages/my/my",
"pages/sport/sport" "pages/sport/sport",
"subPages/course/list/list",
"subPages/course/detail/detail",
"subPages/course/pay/pay"
], ],
"subpackages": [ "subpackages": [
{ {
...@@ -47,7 +50,9 @@ ...@@ -47,7 +50,9 @@
"root": "subPages/login", "root": "subPages/login",
"name": "login", "name": "login",
"pages": [ "pages": [
"login/index" "login/index",
"mobile-login/mobile-login",
"privacy/privacy"
] ]
} }
], ],
...@@ -66,7 +71,7 @@ ...@@ -66,7 +71,7 @@
"text": "运动" "text": "运动"
}, },
{ {
"pagePath": "pages/organ-my/organ-my", "pagePath": "pages/my/my",
"text": "我的" "text": "我的"
} }
] ]
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @eMail: 932055106@qq.com * @eMail: 932055106@qq.com
* @Date: 2022-06-06 11:29:18 * @Date: 2022-06-06 11:29:18
* @LastEditors: tangjiale * @LastEditors: tangjiale
* @LastEditTime: 2022-06-06 16:54:53 * @LastEditTime: 2022-06-11 17:37:33
*/ */
const organTab = [ const organTab = [
{ {
...@@ -26,7 +26,7 @@ const parentTab = [ ...@@ -26,7 +26,7 @@ const parentTab = [
type:'page', type:'page',
iconPath: "/tabBarImg/xztab-0.png", iconPath: "/tabBarImg/xztab-0.png",
selectedIconPath: "/tabBarImg/xztab-1-active.png", selectedIconPath: "/tabBarImg/xztab-1-active.png",
text: "首页" text: "课程"
},{ },{
pagePath: "/pages/sport/sport", pagePath: "/pages/sport/sport",
type:'page', type:'page',
...@@ -34,7 +34,7 @@ const parentTab = [ ...@@ -34,7 +34,7 @@ const parentTab = [
selectedIconPath: "/tabBarImg/xztab-1-active.png", selectedIconPath: "/tabBarImg/xztab-1-active.png",
text: "运动" text: "运动"
},{ },{
pagePath: "/pages/mine/mine", pagePath: "/pages/my/my",
type:'page', type:'page',
iconPath: "/tabBarImg/xztab-0.png", iconPath: "/tabBarImg/xztab-0.png",
selectedIconPath: "/tabBarImg/xztab-1-active.png", selectedIconPath: "/tabBarImg/xztab-1-active.png",
...@@ -69,10 +69,11 @@ Component({ ...@@ -69,10 +69,11 @@ Component({
} }
}, },
upDateBar(){ upDateBar(){
//employ机构职员 parent家长 visitor游客 Unknown未知
let type = wx.getStorageSync('peopleType') || 'Organ' let type = wx.getStorageSync('peopleType') || 'Organ'
if(type){ if(type){
this.setData({ this.setData({
list:type == 'Parent' ? organTab : parentTab list:type == 'employ' ? organTab : parentTab
}) })
} }
} }
......
// pages/my/my.js /*
* @Author: tangjiale
* @eMail: 932055106@qq.com
* @Date: 2022-06-06 16:44:43
* @LastEditors: tangjiale
* @LastEditTime: 2022-06-13 09:57:53
*/
var app = getApp();
var API = require("../../utils/request.js");
var tool = require("../../utils/util.js")
var falg = '';
Page({ Page({
/**
* 页面的初始数据
*/
data: { data: {
userInfo: {},
tabs:[]
}, },
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) { onLoad: function (options) {
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () { onShow: function () {
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
}, this.getTabBar().upDateBar()
this.getTabBar().setData({
/** selected: 2
* 生命周期函数--监听页面隐藏 })
*/ }
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
}, },
/** //跳转到运动记录页面
* 页面相关事件处理函数--监听用户下拉动作 sportRecord() {
*/ wx.navigateTo({
onPullDownRefresh: function () { url: '../../subPages/sport/sportTime/sportTime?type=1',
})
}, },
sportRecordDay(){
/** wx.navigateTo({
* 页面上拉触底事件的处理函数 url: '../../subPages/sport/sportTime/sportTime?type=2',
*/ })
onReachBottom: function () {
}, },
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
}) })
\ No newline at end of file
{ {
"usingComponents": {} "usingComponents": {},
"navigationBarTitleText": "我的",
"navigationBarTextStyle": "black"
} }
\ No newline at end of file
<view class=""> <view class="mine">
家长端======我的 <view class="mine-top" catchtap="setAvartar">
<image class="mine-bg" src="https://cdn.xiaobentiyu.cn/sport_minapp_img/home/mine_bg.png"></image>
<view class="mine-top-content">
<view class="user-info">
<image class="user-avatar" src="{{userInfo.headImgUrl}}"></image>
<view class="info-content">
<view class="info-name-msg">
<view class="info-name">{{userInfo.name}} <image class="vip" wx:if="{{hasSkipDev}}" src="https://cdn.xiaobentiyu.cn/sport_minapp_img/home/icon_vip.png"></image>
</view>
<view class="update-info" catchtap="setAvartar" id="edit" wx:if="{{!isManagement}}">编辑资料</view>
</view>
<view wx:if="{{userInfo.peopleType!='OrganMember'}}" class="{{userInfo.peopleType=='Student'?'user-type':userInfo.peopleType=='Teacher'?'teacher-type':userInfo.peopleType=='Visitor'?'yk-type':'jg-type'}}">{{userInfo.peopleType=='Student'?'孩子':userInfo.peopleType=='Teacher'?'教师':userInfo.peopleType=='Visitor'?'游客':userInfo.peopleType=='School'?'管理员':'教育局'}}</view>
<view class="sch-msg" wx:if="{{userInfo.peopleType=='OrganArea' || userInfo.peopleType=='OrganProvince' || userInfo.peopleType=='OrganCity'}}">
{{userInfo.schName}}教育局
</view>
<view class="sch-msg" wx:elif="{{userInfo.peopleType=='School'}}">
{{userInfo.schName}}管理员
</view>
<view class="sch-msg" wx:else>
{{userInfo.schName}} <block wx:if="{{userInfo.className}}">| {{userInfo.className}}</block>
</view>
</view>
</view>
<block wx:if="{{userInfo.peopleType=='Student'&&threeStuList.length>1}}">
<view class="user-list">
<view class="stu-list">
<block wx:for="{{threeStuList}}">
<view class="user-list-item {{item.isCur?'user-list-item-a':''}}" data-item="{{item}}" catchtap="checkStu">
<view class="avatar-msg">
<image class="check" src="{{item.imgSrc}}"></image>
<image class="checked" wx:if="{{item.isCur}}" src="https://cdn.xiaobentiyu.cn/sport_minapp_img/home/sf_icon_xz.png"></image>
</view>
<view class="child-name">{{item.name}}</view>
</view>
</block>
</view>
<view class="all-child" catchtap="cutIden">
共有{{allStuList.length}}个孩子<image src="/images/home/next.png"></image>
</view>
</view>
</block>
</view>
</view>
<view class="sport-main" wx:if="{{!isManagement}}">
<view class="mine-main">
<view class="sport-info" bindtap="sportRecord">
<view class="sport-info-title">总运动</view>
<view class="sport-info-time"><text>{{sportTime || 0}}</text>分钟</view>
<view class="sport-info-qk">累计消耗{{sportCalorie || 0}}千卡</view>
<image class="sport-info-next" src="/images/home/next.png"></image>
</view>
<view class="sport-info" bindtap="sportRecordDay">
<view class="sport-info-title">今日运动</view>
<view class="sport-info-time"><text>{{todaySportTime || 0}}</text>分钟</view>
<view class="sport-info-qk">消耗{{todayInfo.calorie || 0}}千卡</view>
<image class="sport-info-next" src="/images/home/next.png"></image>
</view>
</view>
</view>
<view class="mine-main management-bg" wx:else></view>
<!-- 功能菜单 -->
<view class="menu">
<view class="menu-list">
<view class="menu-item" bindtap="problem">
<view class="menu-msg">
<image class="menu-icon" src="https://cdn.xiaobentiyu.cn/sport_minapp_img/home/icon_question.png"></image>
<view class="menu-name">问题咨询</view>
</view>
<image class="jump" src="/images/home/next.png"></image>
</view>
</view>
</view>
<!-- 切换身份 -->
<view class="check-identity {{isManagement ? 'management' : ''}}">
<view class="check-user-btn" catchtap="cutIden">
<image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/home/icon_qhsf.png"></image>
<view class="btn-text">添加/切换身份</view>
</view>
</view>
<view class="block"></view>
<view class="tips" wx:if="{{isTips}}">
<view class="mask" bindtap="closeTips"></view>
<view class="content">
<view class="title">
提示
<image class="close" src="../../images/mine/icon-close.png" bindtap="closeTips"></image>
</view>
<view class="text" wx:if="{{type == 'Parent'}}">为了给您提供更完善的体质健康数据分析请完善您孩子的基本信息</view>
<view class="text" wx:if="{{type == 'Visitor'}}">为了给您提供更完善的体质健康数据分析请完善您的基本信息</view>
<view class="item">
<view class="type">姓名</view>
<view class="name">{{userInfo.name}}</view>
</view>
<view class="item" wx:if="{{type != 'Visitor'}}">
<view class="type">学校</view>
<view class="name">{{userInfo.schName}}</view>
</view>
<view class="item" wx:if="{{type != 'Visitor'}}">
<view class="type">班级</view>
<view class="name">{{userInfo.className}}</view>
</view>
<view class="item">
<view class="type">性别</view>
<picker class="name" bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
<image src="../../images/mine/icon-next.png"></image>
<view class="sex">
{{array[index]}}
</view>
</picker>
</view>
<view class="save" bindtap="save">保存</view>
</view>
</view>
</view> </view>
\ No newline at end of file
...@@ -72,8 +72,50 @@ ...@@ -72,8 +72,50 @@
"name": "", "name": "",
"pathName": "subPages/bluetooth/share/share", "pathName": "subPages/bluetooth/share/share",
"query": "share=0&id=10774740&showMedal=1&sportTime=40", "query": "share=0&id=10774740&showMedal=1&sportTime=40",
"launchMode": "default",
"scene": null
},
{
"name": "登录",
"pathName": "subPages/login/login/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "手机号登录",
"pathName": "subPages/login/mobile-login/mobile-login",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "我的",
"pathName": "pages/my/my",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "课程列表",
"pathName": "subPages/course/list/list",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "subPages/sport/sportTime/sportTime",
"query": "type=2",
"scene": null, "scene": null,
"launchMode": "default" "launchMode": "default"
},
{
"name": "订单支付",
"pathName": "subPages/course/pay/pay",
"query": "",
"launchMode": "default",
"scene": null
} }
] ]
} }
......
/*
* @Author: tangjiale
* @eMail: 932055106@qq.com
* @Date: 2022-06-13 08:57:51
* @LastEditors: tangjiale
* @LastEditTime: 2022-06-13 08:58:38
*/
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="page-bg">
课程详情
</view>
\ No newline at end of file
/* subPages/course/detail/detail.wxss */
\ No newline at end of file
/*
* @Author: tangjiale
* @eMail: 932055106@qq.com
* @Date: 2022-06-11 17:38:58
* @LastEditors: tangjiale
* @LastEditTime: 2022-06-11 17:54:36
*/
var API = require("../../../utils/request.js");
Page({
/**
* 页面的初始数据
*/
data: {
page:0,
list:[],
loading:false,
finish:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function (options) {
this.queryCourseList()
},
onReachBottom:function (){
if(this.data.loading && this.data.finish) return
this.queryCourseList()
},
queryCourseList(){
let that = this
this.data.page ++
this.data.loading = true
API.getData('/px/course/getMobileCourseList', {
page:that.data.page,
size:10,
type:1, //课程类型(1:正式课,2:体验课)
}, (res) => {
that.data.loading = true
that.data.finish = res.data.length < 10
that.data.list = that.data.list.concat(res.data || [])
that.setData({
page:that.data.page,
finish:that.data.finish,
loading:that.data.loading,
list:that.data.list
})
});
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<!-- 课程列表(体验课/班课) -->
<view class="page-bg">
<view class="list">
<view class="item" wx:for="{{list}}">
<image src="{{item.poster}}"></image>
</view>
</view>
</view>
\ No newline at end of file
.page-bg{
min-height: 100vh;
width: 100%;
background-color: #f5f5f5;
}
.list{
margin: 0px 30rpx;
display: flex;
flex-wrap: wrap;
width: calc(100% - 60rpx);
}
.item{
margin-top: 20rpx;
}
\ No newline at end of file
/*
* @Author: tangjiale
* @eMail: 932055106@qq.com
* @Date: 2022-06-13 08:59:17
* @LastEditors: tangjiale
* @LastEditTime: 2022-06-13 09:21:46
*/
// subPages/course/pay/pay.js
Page({
/**
* 页面的初始数据
*/
data: {
param:{
stuName:'',
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="page-bg">
<!-- 支付订单 -->
支付订单
</view>
\ No newline at end of file
/* subPages/course/pay/pay.wxss */
\ No newline at end of file
// subPages/login/login/index.js /*
Page({ * @Author: tangjiale
* @eMail: 932055106@qq.com
/** * @Date: 2022-06-06 15:52:31
* 页面的初始数据 * @LastEditors: tangjiale
* @LastEditTime: 2022-06-11 16:13:22
*/ */
var API = require("../../../utils/request.js");
var postData = {};
Page({
data: { data: {
checkboxValue: 0,
checkedVal:false
}, },
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) { onLoad: function (options) {
//获取用户的openId
this.wxLogin();
//获取用户微信相关的详细信息
// this.wxGetUserInfo()
//用户微信认证,可直接免登陆
this.auth();
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () { onReady: function () {
}, },
/**
* 生命周期函数--监听页面显示
*/
onShow: function () { onShow: function () {
}, },
auth(){
/** wx.showLoading({
* 生命周期函数--监听页面隐藏 title: '加载中...',
*/ })
onHide: function () { wx.login({
success: res => {
API.getData('/wx/user/wx7d7fbc0e6746baf5/auth', {
code: res.code
}, function(res) {
wx.hideLoading();
console.log('/wx/user/auth', res);
if(!res.data || res.data.code != 200) return
//根据用户类型来判断跳转页面
//employ机构职员 parent家长 visitor游客 Unknown未知
if(res.data.peopleType == 'Unknown'){
return
}
wx.setStorageSync('token',res.data.token)
wx.setStorageSync('peopleType',res.data.peopleType)
if(res.data.peopleType == 'parent'){
wx.reLaunch({
url: '/pages/index/index'
})
}else if(res.data.peopleType == 'employ'){
wx.reLaunch({
url: '/pages/index/index'
})
}else if(res.data.peopleType == 'visitor'){
wx.reLaunch({
url: '/pages/index/index'
})
}
}, function(res) {
wx.hideLoading();
console.log('/wx/user/auth', res);
});
}, },
fail: res => {
/** console.log('wx.login 错误');
* 生命周期函数--监听页面卸载 }
*/ })
onUnload: function () {
}, },
wxGetUserInfo(){
/** API.getData('/wx/user/wx7d7fbc0e6746baf5/info', { }, function (res) {
* 页面相关事件处理函数--监听用户下拉动作 }, function () {
*/ // wx.hideLoading()
onPullDownRefresh: function () { });
}, },
agreement() {
/** //this.setData({ checkboxValue:1 })
* 页面上拉触底事件的处理函数 wx.navigateTo({
*/ url: '../privacy/privacy'
onReachBottom: function () { })
},
//微信授权回调
onGotUserInfo(e){
console.log(e);
wx.navigateTo({
url: '../mobile-login/mobile-login'
})
}, },
//手机授权回调
getPhoneNumber(e){
console.log('getPhoneNumber', e);
wx.showLoading({title: '登录中',})
postData.encryptedData = e.detail.encryptedData;
postData.iv = e.detail.iv;
postData.appId = 'wx7d7fbc0e6746baf5';
var _this = this;
if (e.detail.errMsg == 'getPhoneNumber:ok'){
// _this.wxLogin();
_this.loginByWxAuthPhone();
}else{
wx.hideLoading();
}
/** },
* 用户点击右上角分享 wxLogin(){
*/ wx.login({
onShareAppMessage: function () { success: res => {
API.getData('/wx/user/wx7d7fbc0e6746baf5/getOpenId', { code: res.code }, function (res) {
postData.sessionKey = res.data.sessionKey;
postData.openId = res.data.openId;
}, function () {
wx.hideLoading()
});
},
fail: res => {
console.log('wx.login 错误');
}
})
},
loginByWxAuthPhone(){
var _this = this;
API.requestAll('/px/user/loginByWxAuthPhone', postData,function (res) {
console.log('loginByWxAuthPhone', res);
// //employ机构职员 parent家长 visitor游客 Unknown未知
if (res.code == 200) {
wx.hideLoading();
if (res.data.peopleType == 'Unknown') {
// _this.wxLogin();
wx.hideLoading()
wx.showModal({
title:'提示',
title:'登录失败,请重新登录',
success:function(res){
if (res.confirm) {//这里是点击了确定以
_this.wxLogin();
//_this.auth();
} else {//这里是点击了取消以后
console.log('用户点击取消')
}
}
})
}
wx.setStorageSync('token',res.data.token)
wx.setStorageSync('peopleType',res.data.peopleType)
if(res.data.peopleType == 'parent'){
wx.reLaunch({
url: '/pages/index/index'
})
}else if(res.data.peopleType == 'employ'){
wx.reLaunch({
url: '/pages/index/index'
})
}else if(res.data.peopleType == 'visitor'){
wx.reLaunch({
url: '/pages/index/index'
})
}
} else {
wx.showToast({ icon: 'none', title: res.message, duration: 2000 })
}
}, function () {
wx.hideLoading()
});
},
//提示
tips() {
wx.showToast({ icon: 'none', title: '阅读并同意以下协议', duration: 2000 })
},
checkboxChange(e){
console.log(e.detail.value.length);
this.setData({ checkboxValue: e.detail.value.length })
} }
}) })
\ No newline at end of file
<view class='no-login'>
<view class="login">
<image class="no-login-top" src='https://cdn.xiaobentiyu.cn/sport_minapp_img/home/logo.png'></image>
</view>
<button wx:if="{{checkboxValue}}" class="btn" open-type="getPhoneNumber" lang="zh_CN"
bindgetphonenumber="getPhoneNumber">微信一键登录</button>
<button wx:if="{{checkboxValue}}" class="phone"
lang="zh_CN" bindtap="onGotUserInfo">手机号码登录</button>
<view class=""> <button wx:if="{{!checkboxValue}}" class="btn" bindtap="tips">微信一键登录</button>
登录页面 <button wx:if="{{!checkboxValue}}" class="phone" bindtap="tips">手机号码登录</button>
<checkbox-group bindchange="checkboxChange">
<label class="checkbox">
<checkbox checked="{{checkedVal}}"/>
<text>我已阅读并同意</text>
<text class="color" catchtap="agreement">《服务协议》</text>
</label>
</checkbox-group>
<view class="instructions">
小程序主要用于中小学生体质健康服务,教育局、学校需进行信息验证,验证通过即可使用相关功能。
</view>
</view> </view>
\ No newline at end of file
/* subPages/login/login/index.wxss */ .no-login {
\ No newline at end of file position: fixed;
top: 0;
bottom: 0;
background: #ffffff;
width: 100%;
}
.login{
text-align: center;
margin-bottom: 80rpx;
}
.no-login .no-login-top {
width: 160rpx;
height: 160rpx;
margin-top: 160rpx;
}
.no-login .btn {
margin: 32rpx 120rpx;
background: #FF9B4D;
color: #ffffff;
border-radius: 50rpx;
border: 2rpx solid #FF811E;
}
.phone{
margin: 32rpx 120rpx;
background: #FFFFFF;
color: #FF811E;
border: 2rpx solid #FF811E;
border-radius: 50rpx;
}
.v1-login-title {
font-size: 30rpx;
color: #666666;
text-align: center;
margin: 30rpx 0;
}
.v1-login-title2 {
font-size: 30rpx;
color: #666666;
text-align: center;
margin: 30rpx 0;
}
.v1-login-li {
margin-left: 180rpx;
height: 40rpx;
line-height: 40rpx;
margin-bottom: 20rpx;
}
.v1-login-li .dian {
width: 18rpx;
height: 18rpx;
border-radius: 50%;
background: #6fd184;
float: left;
margin: 11rpx 20rpx 0 0;
}
.v1-login-li text {
line-height: 40rpx;
color: #6fd184
}
.v1-login-content {
line-height: 50rpx;
color: #666666;
font-size: 26rpx;
margin: 0 120rpx;
}
checkbox-group {
text-align: center
}
checkbox-group text {
position: relative;
top: 0rpx;
font-size: 26rpx;
display: inline-block;
line-height: 30rpx;
}
checkbox-group .color {
color: #2D89FF;
}
checkbox .wx-checkbox-input {
width: 30rpx;
height: 30rpx;
}
.t-right {
text-align: right
}
.instructions {
margin: 60rpx 120rpx;
font-size: 26rpx;
text-indent: 50rpx;
text-align: justify;
color: rgba(0, 0, 0, 0.5);
}
checkbox .wx-checkbox-input{
border-radius: 50%;/* 圆角 */
width: 28rpx; /* 背景的宽 */
height: 28rpx; /* 背景的高 */
}
/* 选中后的 背景样式*/
checkbox .wx-checkbox-input.wx-checkbox-input-checked{
border: 1rpx solid #FF811E;
background: #FF811E;
}
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before{
border-radius: 50%;/* 圆角 */
width: 40rpx;/* 选中后对勾大小,不要超过背景的尺寸 */
height: 40rpx;/* 选中后对勾大小,不要超过背景的尺寸 */
line-height: 40rpx;
text-align: center;
font-size:18rpx; /* 对勾大小 30rpx */
color:#fff; /* 对勾颜色 白色 */
background: transparent;
transform:translate(-50%, -50%) scale(1);
-webkit-transform:translate(-50%, -50%) scale(1);
}
\ No newline at end of file
var API = require("../../../utils/request.js");
var tool = require("../../../utils/util.js");
var uuid = 0;
var flag = true;
Page({
data: {
base64code: '',
phoneNum: '',
valiteCode: '',
smsCode: '',
smsFlag: true,
time: 10,
num: 31,
inputActiveA: false,
inputActiveB: false,
inputActiveC: false,
btnStyle: false
},
onLoad: function(options) {
this.getCaptcha();
},
isBtn() {
if (this.data.phoneNum == '' && this.data.valiteCode == '' && this.data.smsCode == '') {
this.setData({
btnStyle: false
});
} else {
this.setData({
btnStyle: true
});
}
},
cleanVerify(e) {
let index = e.currentTarget.dataset.item;
this.setData({
inputActiveA: index == 1 ? true : false,
inputActiveB: index == 2 ? true : false,
inputActiveC: index == 3 ? true : false,
});
},
verifyNumber(e) {
let index = e.currentTarget.dataset.item;
this.setData({
inputActiveA: false,
inputActiveB: false,
inputActiveC: false,
});
},
login() {
if(this.data.btnStyle){
var _this = this;
if (flag) {
flag = false;
wx.login({
success: res => {
console.log('1');
API.getData('/wx/user/wx7d7fbc0e6746baf5/getOpenId', {
code: res.code
}, function (res) {
console.log('登录',res)
wx.setStorageSync('openId', res.data.openId);
_this.loginFun(res.data.openId);
}, function () {
flag = true;
wx.hideLoading()
});
},
fail: res => {
flag = true;
console.log('wx.login 错误');
}
})
}
}
},
loginFun(openId) {
console.log(this.data.accountName);
console.log(this.data.inputCode);
this.getCaptcha();
if (!this.data.phoneNum) {
wx.showToast({
title: '请输入手机号',
icon: 'none',
duration: 2000
});
flag = true;
return null
};
if (!this.data.smsCode) {
wx.showToast({
title: '请输入短信验证码',
icon: 'none',
duration: 2000
});
flag = true;
return null;
};
var _this = this;
API.requestAll('/px/user/loginByphone', {
phone: _this.data.phoneNum,
smsCode: _this.data.smsCode,
openId: openId,
appId: 'wx7d7fbc0e6746baf5',
},
function(res) {
console.log(res);
flag = true;
if (res.code == 200) {
wx.setStorageSync('token',res.data.token)
wx.setStorageSync('peopleType',res.data.peopleType)
//根据用户类型来判断跳转页面
//employ机构职员 parent家长 visitor游客 Unknown未知
if(res.data.peopleType == 'Unknown'){
}else if(res.data.peopleType == 'parent'){
wx.reLaunch({
url: '/pages/index/index'
})
}else if(res.data.peopleType == 'employ'){
wx.reLaunch({
url: '/pages/index/index'
})
}else if(res.data.peopleType == 'visitor'){
wx.reLaunch({
url: '/pages/index/index'
})
}
} else {
wx.showToast({
icon: 'none',
title: res.message,
duration: 2000
})
}
},
function() {
});
},
// 用户名
accountBind: function(e) {
// console.log(e.detail.value)
this.setData({
phoneNum: e.detail.value
});
// console.log('当前手机号', this.data.phoneNum)
// console.log('当前图形码', this.data.valiteCode)
// console.log('当前验证码', this.data.smsCode)
this.isBtn();
},
// 图形验证码
inputCodeBind: function(e) {
this.setData({
valiteCode: e.detail.value
});
// if (/^[0-9a-zA-Z]+$/.test(e.detail.value)) {
// this.setData({
// valiteCode: e.detail.value
// });
// return e.detail.value;
// } else {3
// return e.detail.value.substring(0, e.detail.value.length - 1);
// }
this.isBtn();
//this.setData({ valiteCode: e.detail.value });
},
// 短信验证码
inputSmsBind: function(e) {
this.setData({
smsCode: e.detail.value
});
this.isBtn();
},
// 发送短信
sendSms: tool.throttle(function() {
var _this = this;
console.log("111111");
if (!this.data.phoneNum) {
wx.showToast({
icon: 'none',
title: '请输入手机号码',
duration: 2000
});
return null;
}
if (!this.data.valiteCode) {
wx.showToast({
icon: 'none',
title: '请输入图形验证码',
duration: 2000
});
return null;
}
var data = {
uuid: uuid,
phone: this.data.phoneNum,
valiteCode: this.data.valiteCode
};
console.log(data);
API.getData('/px/user/sms', {
uuid: uuid,
phone: this.data.phoneNum,
valiteCode: this.data.valiteCode,
type: 2
},
function(res) {
wx.showToast({
icon: 'success',
title: '发送成功',
duration: 2000
});
_this.settime();
},
function(res) {
console.log(res);
wx.showToast({
icon: 'none',
title: res.message,
duration: 2000
});
});
}),
// 设置时间
settime() {
if (this.data.num == 1) {
this.setData({
num: 31
})
return false;
} else {
this.setData({
num: this.data.num - 1
})
}
console.log(this.data.num);
setTimeout(() => {
this.settime();
}, 1000);
},
getSms() {
this.setData({
smsFlag: false
});
var time = 10;
var handle = setInterval(() => {
time = time - 1;
this.setData({
time: time
})
if (time == 0) {
clearInterval(handle);
this.setData({
smsFlag: true
});
}
}, 1000)
},
getCaptcha() {
uuid = new Date().getTime() + Math.round(Math.random() * (36 - 20)) + 20;
console.log(uuid);
var _this = this;
API.getDataAll('/px/user/checkCode', {
uuid: uuid
}, function(res) {
var data = res.replace(/\n/g, '');
console.log('当前的图形验证码', data);
_this.setData({
base64code: 'data:image/png;base64,' + data
});
}, function() {
});
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText":"登录"
}
\ No newline at end of file
<view class="login">
<!-- <image class="bk" src="https://ttxs01-10066525.file.myqcloud.com/sport/miniapp/mobile/login/bk.jpg" /> -->
<view class="login-wrap">
<!-- <view class="avart"><image src="https://cdn.xiaobentiyu.cn/sport_minapp_img/login/log.png" /></view> -->
<view class="input-item admin {{inputActiveA?'input-focus':'input-blur'}}">
<image wx:if="{{inputActiveA}}" src="https://cdn.xiaobentiyu.cn/sport_minapp_img/login/login_icon_phone_selected.png" />
<image wx:else src="https://cdn.xiaobentiyu.cn/sport_minapp_img/login/login_icon_phone_normal.png" />
<input data-item='1' maxlength="11" placeholder="请输入手机号" placeholder-class="phcolor" bindinput="accountBind" type="number" bindfocus="cleanVerify" bindblur="verifyNumber"></input>
</view>
<view class="input-item code {{inputActiveB?'input-focus':'input-blur'}}">
<image wx:if="{{inputActiveB}}" src="https://cdn.xiaobentiyu.cn/sport_minapp_img/login/login_icon_tuxingyanzhengma_selected.png" />
<image wx:else src="https://cdn.xiaobentiyu.cn/sport_minapp_img/login/login_icon_tuxingyanzhengma_normal.png" />
<input data-item='2' placeholder="请输入图形验证码" placeholder-class="phcolor" class="w-220" maxlength="4" bindinput="inputCodeBind" bindfocus="cleanVerify" bindblur="verifyNumber" />
<image src="{{base64code}}" class="yzm1" bindtap="getCaptcha" />
</view>
<view class="input-item code {{inputActiveC?'input-focus':'input-blur'}}">
<image wx:if="{{inputActiveC}}" src="https://cdn.xiaobentiyu.cn/sport_minapp_img/login/login_icon_duanxinyanzhnegma_selected.png" />
<image wx:else src="https://cdn.xiaobentiyu.cn/sport_minapp_img/login/login_icon_duanxinyanzhnegma_normal.png" />
<input data-item='3' placeholder="请输入短信验证码" placeholder-class="phcolor" class="w-220" type="number" maxlength="6" bindinput="inputSmsBind" bindfocus="cleanVerify" bindblur="verifyNumber" />
<view class="yzm" bindtap="sendSms" wx:if="{{num>30}}">获取验证码</view>
<view class="yzm" wx:if="{{num<31}}">{{num}}秒</view>
<!-- <image src="{{base64code}}" class="yzm" bindtap="getCaptcha"/> -->
</view>
<view class="btn {{btnStyle?'btn-bg-b':'btn-bg-a'}}" bindtap="login">登录</view>
</view>
</view>
\ No newline at end of file
.login {
position: fixed;
top: 0;
bottom: 0;
width: 100%;
}
.bk {
position: fixed;
width: 100%;
height: 100%;
}
.login-wrap {
position: absolute;
top: 16rpx;
margin-left: 55rpx;
background: #fff;
}
.avart {
width: 310rpx;
height: 310rpx;
border-radius: 50%;
position: absolute;
top: -155rpx;
left: 170rpx;
}
.avart image {
width: 100%;
height: 100%;
border-radius: 50%;
}
.input-item {
width: 640rpx;
height: 100rpx;
margin: 0 auto 0 auto;
border-bottom: 1rpx solid #eee;
}
.input-focus {
width: 640rpx;
border-bottom: 4rpx solid #ff9b4d;
}
.input-blur {
width: 640rpx;
border-bottom: 1rpx solid #eee;
}
.phcolor {
color: #d2d2d2;
font-size: 32rpx;
font-weight: 400;
line-height: 44rpx;
}
.input-item image {
width: 48rpx;
height: 48rpx;
float: left;
margin-top: 26rpx;
}
.input-item input {
float: left;
position: relative;
top: 0rpx;
width: 300rpx;
height: 60rpx;
margin-left: 20rpx;
margin-top: 20rpx;
font-size: 32rpx;
font-weight: 400;
color: #353535;
}
.input-item span {
font-size: 28rpx;
color: #6fd184;
}
.yzm {
height: 50rpx !important;
width: 180rpx !important;
float: right !important;
margin-top: 25rpx !important;
text-align: center;
line-height: 50rpx;
font-size: 30rpx;
font-weight: bold;
color: #ff9b4d;
}
.code {
margin-top: 0rpx;
}
.btn {
width: 630rpx;
height: 84rpx;
/* background-color: rgba(255, 155, 77, 0.3); */
/* background-image: linear-gradient(90deg, #6fd184 0%, #6fd184 100%),
linear-gradient(#6fd184, #6fd184);
background-blend-mode: normal, normal; */
border-radius: 42rpx;
margin-top: 46rpx;
font-size: 34rpx;
text-align: center;
line-height: 84rpx;
color: #fff;
margin: 46rpx auto 0 auto;
}
.btn-bg-a {
background-color: rgba(255, 155, 77, 0.3);
}
.btn-bg-b {
background-color: rgba(255, 155, 77, 1);
}
.forget {
float: right;
margin: 20rpx 90rpx 0 0;
font-size: 26rpx;
color: #6fd184;
}
.yzm1 {
height: 50rpx !important;
border: 1rpx solid #e1e1e1;
width: 180rpx !important;
float: right !important;
margin-top: 25rpx !important;
}
var API = require("../../../utils/request.js")
Page({
data: {
content: ''
},
onLoad: function (options) {
this.getData();
},
getData(){
var _this = this;
console.log("------12--------");
API.getDataAll('/api/miniapp/sys/config/register',{}, function (res) {
console.log(res);
_this.setData({
content: res.data.value.replace('<img ', '<img style="max-width:100%;height:auto"')
})
console.log(_this.data.content);
}, function () {
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="rich-text">
<rich-text nodes="{{content}}" class="rich-text1"></rich-text>
</view>
\ No newline at end of file
.rich-text{padding: 0 30rpx 30rpx 30rpx;}
\ No newline at end of file
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<view class="challenge-medal" wx:if="{{perserve}}"> <view class="challenge-medal" wx:if="{{perserve}}">
<view class="challenge-mask"></view> <view class="challenge-mask"></view>
<view class="my-medal"> <view class="my-medal">
<image class="medal-close" catchtap="czyhClose" src="../../../images/index/medal-close.png"></image> <image class="medal-close" catchtap="czyhClose" src="/images/skip/medal-close.png"></image>
<view class="medal-title">恭喜你,已获得</view> <view class="medal-title">恭喜你,已获得</view>
<image class="medal" src="{{nowMedal.hasgetImg}}"></image> <image class="medal" src="{{nowMedal.hasgetImg}}"></image>
<view class="medal-name">{{nowMedal.name}}</view> <view class="medal-name">{{nowMedal.name}}</view>
......
...@@ -82,7 +82,7 @@ Page({ ...@@ -82,7 +82,7 @@ Page({
//获取运动日周月记录 //获取运动日周月记录
getDataList(page,dataType){ getDataList(page,dataType){
var that = this; var that = this;
API.getData('/es/student/report/getDataList', { API.getData('/project/getDataList', {
dateType:dataType, dateType:dataType,
page:page, page:page,
size:size size:size
...@@ -217,7 +217,7 @@ Page({ ...@@ -217,7 +217,7 @@ Page({
//获取运动记录汇总 //获取运动记录汇总
getTotalData(){ getTotalData(){
var that = this; var that = this;
API.getData('/es/student/report/getTotalData', { API.getData('/project/getTotalData', {
}, (res) => { }, (res) => {
that.setData({ that.setData({
......
...@@ -12,8 +12,8 @@ function requestAll(url, postData, doSuccess, doFail) { ...@@ -12,8 +12,8 @@ function requestAll(url, postData, doSuccess, doFail) {
url: wx.getStorageSync('host') + url, url: wx.getStorageSync('host') + url,
header: { header: {
"content-type": "application/json;charset=UTF-8", "content-type": "application/json;charset=UTF-8",
token:'be3531e49c70444189d7511c7bb9602d',
// token: wx.getStorageSync('token'), // token: wx.getStorageSync('token'),
"token": 'be3531e49c70444189d7511c7bb9602d',
version: wx.getStorageSync('version'), version: wx.getStorageSync('version'),
pvmodel:wx.getStorageSync('model'), pvmodel:wx.getStorageSync('model'),
pvversion: wx.getStorageSync('pvversion'), pvversion: wx.getStorageSync('pvversion'),
...@@ -49,8 +49,8 @@ function request(url, postData, doSuccess,doFail) { ...@@ -49,8 +49,8 @@ function request(url, postData, doSuccess,doFail) {
url: wx.getStorageSync('host') + url, url: wx.getStorageSync('host') + url,
header: { header: {
"content-type": "application/json;charset=UTF-8", "content-type": "application/json;charset=UTF-8",
"token":'be3531e49c70444189d7511c7bb9602d'
// token: wx.getStorageSync('token'), // token: wx.getStorageSync('token'),
token:'be3531e49c70444189d7511c7bb9602d',
// version: wx.getStorageSync('version'), // version: wx.getStorageSync('version'),
// pvmodel:wx.getStorageSync('model'), // pvmodel:wx.getStorageSync('model'),
// pvversion: wx.getStorageSync('pvversion'), // pvversion: wx.getStorageSync('pvversion'),
...@@ -81,8 +81,8 @@ function getData(url, data, doSuccess, doFail) { ...@@ -81,8 +81,8 @@ function getData(url, data, doSuccess, doFail) {
url: wx.getStorageSync('host') + url, url: wx.getStorageSync('host') + url,
header: { header: {
"content-type": "application/json;charset=UTF-8", "content-type": "application/json;charset=UTF-8",
"token":'be3531e49c70444189d7511c7bb9602d'
// token: wx.getStorageSync('token'), // token: wx.getStorageSync('token'),
token:'be3531e49c70444189d7511c7bb9602d',
// version: wx.getStorageSync('version'), // version: wx.getStorageSync('version'),
// pvmodel:wx.getStorageSync('model'), // pvmodel:wx.getStorageSync('model'),
// pvversion: wx.getStorageSync('pvversion'), // pvversion: wx.getStorageSync('pvversion'),
...@@ -112,8 +112,8 @@ function getDataAll(url, data, doSuccess, doFail) { ...@@ -112,8 +112,8 @@ function getDataAll(url, data, doSuccess, doFail) {
url: wx.getStorageSync('host') + url, url: wx.getStorageSync('host') + url,
header: { header: {
"content-type": "application/json;charset=UTF-8", "content-type": "application/json;charset=UTF-8",
"token":'be3531e49c70444189d7511c7bb9602d'
// token: wx.getStorageSync('token'), // token: wx.getStorageSync('token'),
token:'be3531e49c70444189d7511c7bb9602d',
// version: wx.getStorageSync('version'), // version: wx.getStorageSync('version'),
// pvmodel:wx.getStorageSync('model'), // pvmodel:wx.getStorageSync('model'),
// pvversion: wx.getStorageSync('pvversion'), // pvversion: wx.getStorageSync('pvversion'),
...@@ -142,8 +142,8 @@ function del(url, data, doSuccess, doFail) { ...@@ -142,8 +142,8 @@ function del(url, data, doSuccess, doFail) {
url: wx.getStorageSync('host') + url, url: wx.getStorageSync('host') + url,
header: { header: {
"content-type": "application/json;charset=UTF-8", "content-type": "application/json;charset=UTF-8",
"token":'be3531e49c70444189d7511c7bb9602d'
// token: wx.getStorageSync('token'), // token: wx.getStorageSync('token'),
token:'be3531e49c70444189d7511c7bb9602d',
// version: wx.getStorageSync('version'), // version: wx.getStorageSync('version'),
// pvmodel:wx.getStorageSync('model'), // pvmodel:wx.getStorageSync('model'),
// pvversion: wx.getStorageSync('pvversion'), // pvversion: wx.getStorageSync('pvversion'),
...@@ -165,8 +165,8 @@ function put(url, data, doSuccess, doFail) { ...@@ -165,8 +165,8 @@ function put(url, data, doSuccess, doFail) {
url: wx.getStorageSync('host') + url, url: wx.getStorageSync('host') + url,
header: { header: {
"content-type": "application/json;charset=UTF-8", "content-type": "application/json;charset=UTF-8",
"token":'be3531e49c70444189d7511c7bb9602d'
// token: wx.getStorageSync('token'), // token: wx.getStorageSync('token'),
token:'be3531e49c70444189d7511c7bb9602d',
// version: wx.getStorageSync('version'), // version: wx.getStorageSync('version'),
// pvmodel:wx.getStorageSync('model'), // pvmodel:wx.getStorageSync('model'),
// pvversion: wx.getStorageSync('pvversion'), // pvversion: wx.getStorageSync('pvversion'),
......
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 to comment