Commit 0bcb494b authored by 不吃草的咩's avatar 不吃草的咩

增加模拟登录,是否登录

parent b6426068
......@@ -20,6 +20,9 @@ Page({
tabCur: e.detail.index
})
},
getPhoneNumber (e) {
console.log(e.detail)
},
checkChange(e) {
this.setData({
check: e.detail
......
......@@ -3,7 +3,7 @@
<text slot="center">登录</text>
</ui-navbar>
<view class="p-5">
<view class="text-xxl">
<!-- <view class="text-xxl">
<view class="text-bold py-2">欢迎登录ColorUI组件库</view>
</view>
<view class="mt-5">
......@@ -56,11 +56,10 @@
<text>立即注册</text>
<text class="cicon-round-angle-o ml-3"/>
</view>
</view>
</view> -->
<ui-fixed bottom>
<view class="p-5">
<ui-title title="其他登录方式" align="center" hasLine tpl="center-column"/>
<button class="ui-btn bg-green-gradient radius lg block shadow-green" bindtap="wxloginSubmit" disabled="{{isLoading}}">
<button class="ui-btn bg-green-gradient radius lg block shadow-green" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">
<text class="cicon-weixin icon-xl mr-3"/>
<text>微信一键登录</text>
<text class="cicon-loading1 icon-spin ml-3" wx:if="{{wxisLoading}}"/>
......
const app = getApp();
import Toast from '../../vantPackage/toast/toast';
Page({
data: {
scrollTop: 0,
show:false,
title:'登录,享受更多服务。'
},
tapToUrl(e) {
wx.navigateTo({
url: e.currentTarget.dataset.url
tapToUrl() {
// wx.navigateTo({
// url: e.currentTarget.dataset.url
// })
this.setData({
show:true
})
},
randomWord(randomFlag, min, max){
let str = "",
range = min,
arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
// 随机产生
if(randomFlag){
range = Math.round(Math.random() * (max-min)) + min;
}
for(var i=0; i<range; i++){
let pos = Math.round(Math.random() * (arr.length-1));
str += arr[pos];
}
return str;
},
getPhoneNumber (e) {
//如果返回成功手机号,就随机生成一串字符串存进去
if(e.detail.code !== undefined){
// let random = Math.random().toString(36).substr(2);
let random = this.randomWord(false, 43);
try {
wx.setStorageSync('token', random);
Toast.success('登录成功');
this.setData({
show:false,
title:13520051245
})
} catch (e) {
wx.showToast({
title: '数据存储失败!',
icon: 'none'
})
}
}else{
wx.showToast({
title: '授权失败,请您重新登录!',
icon: 'none'
})
}
},
onClose(){
this.setData({
show:false
})
},
tapCopy(e) {
......@@ -26,6 +75,30 @@ Page({
},
});
},
mycenter(){
let token = wx.getStorageSync('token'); //是否登录
if(token != ''){
wx.navigateTo({
url: '/pages/seeSignup/seeSignup',
})
}else{
this.setData({
show:true
})
}
},
seesign(){
let token = wx.getStorageSync('token'); //是否登录
if(token != ''){
wx.navigateTo({
url: '/pages/seeSignup/seeSignup',
})
}else{
this.setData({
show:true
})
}
},
// 监听用户滑动页面事件。
onPageScroll(e) {
// 注意:请只在需要的时候才在 page 中定义此方法,不要定义空方法。以减少不必要的事件派发对渲染层-逻辑层通信的影响。
......
.van-cell-group--inset{
margin: 0 !important;
}
.yang{
}
.logintit{
width: 100%;
height: 50rpx;
line-height: 50rpx;
text-align: center;
font-size: 26rpx;
font-weight: bold;
margin-top: 20rpx;
}
.del{
width: 100%;
margin-top: 30rpx;
font-size: 20rpx;
}
\ No newline at end of file
......@@ -6,12 +6,26 @@
<view class="flex-bar my-4" data-url="/pages/demo/login/login" bindtap="tapToUrl">
<ui-avatar ui="xxl ellipse" src="/static/logo.png" />
<view class="flex-sub pl-3">
<view class="text-xl">登录,享受更多服务。</view>
<view class="text-xl">{{title}}</view>
</view>
</view>
<van-cell-group inset>
<van-cell title="我的报名" isLink url="/pages/seeSignup/seeSignup"/>
<van-cell title="个人中心" isLink bind:click="mycenter"/>
<van-cell title="我的报名" isLink url="/pages/seeSignup/seeSignup" bind:click="seesign"/>
<van-cell title="设置" isLink url=""/>
</van-cell-group>
</view>
<van-popup show="{{ show }}" bind:close="onClose" round closeable custom-class="yang">
<view class="logintit"><text>登录或注册</text></view>
<view class="p-5">
<button class="ui-btn bg-green-gradient radius lg block shadow-green" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">
<text class="cicon-weixin icon-xl mr-3"/>
<text>微信账号快速登录</text>
<text class="cicon-loading1 icon-spin ml-3" wx:if="{{wxisLoading}}"/>
</button>
<view class="del">登录代表您已同意用户协议</view>
</view>
</van-popup>
<van-toast id="van-toast" />
</ui-sys>
\ No newline at end of file
......@@ -7,6 +7,11 @@ Page({
data: {
},
onClickLeft(){
wx.switchTab({
url: "/pages/my/home",
})
},
/**
* 生命周期函数--监听页面加载
......
.van-nav-bar{
padding-top: 0px !important;
}
.box{
width: 98%;
margin: 2% auto 0;
}
\ No newline at end of file
<!--pages/seeSignup/seeSignup.wxml-->
<text>pages/seeSignup/seeSignup.wxml</text>
<!-- 我的报名查询 -->
<ui-sys>
<ui-navbar isSlot>
<view style="width: 100%;height: 100%;">
<van-nav-bar
title="报名查询"
left-text="返回"
left-arrow
border="{{false}}"
bind:click-left="onClickLeft"
/>
</view>
</ui-navbar>
<view class="box">
<van-cell-group>
<van-cell title="5g小课堂" label="¥5488.00" >
<view>
<van-button type="primary" size="small" center>查看协议</van-button>
</view>
</van-cell>
<van-cell title="教你修电脑" label="¥5488.00" >
<view>
<van-button type="primary" size="small" center>查看协议</van-button>
</view>
</van-cell>
</van-cell-group>
</view>
</ui-sys>
\ No newline at end of file
......@@ -7,13 +7,32 @@ Page({
*/
data: {
isperson:'在线报名',
params:'',
courseData:[]
},
toSignup(e){
let token = wx.getStorageSync('token');
if(token == ''){
wx.showToast({
title: '您还未登录,请先去登录',
icon: 'none'
})
setTimeout(()=>{
wx.switchTab({
url: '/pages/my/home',
})
},2000);
}else{
wx.navigateTo({
url: `/pages/document/subsign/subsign?name=${e.currentTarget.dataset.name}&price=${e.currentTarget.dataset.price}`,
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
///pages/document/subsign/subsign?name={{item.name}}&price={{item.price}}
// if(options.type == '1'){
// this.setData({isperson:'个人报名'})
// }else{
......@@ -25,6 +44,13 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
app.colorUISdk.request({
url:'wxcourse/list',
method: 'GET',
......@@ -37,12 +63,6 @@ Page({
}).catch(err=>{
console.log(err)
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
app.information = {};
},
......
......@@ -31,8 +31,9 @@
<ui-menu ui="mt-5 radius border">
<ui-menu-item title="{{item.name}}" icon="cicon-tag text-orange" isAction wx:for="{{courseData}}" wx:key="index">
<view slot="action">
<navigator url="/pages/document/subsign/subsign?name={{item.name}}&price={{item.price}}" >
<ui-tag bg="bg-blue-thin" info="立即报名" ui="sm"/></navigator>
<!-- <navigator url="/pages/document/subsign/subsign?name={{item.name}}&price={{item.price}}" > -->
<ui-tag bg="bg-blue-thin" info="立即报名" ui="sm" data-name="{{item.name}}" data-price="{{item.price}}" bindtap="toSignup"/>
<!-- </navigator> -->
</view>
</ui-menu-item>
</ui-menu>
......
......@@ -31,7 +31,7 @@
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": false,
"useIsolateContext": true,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
......@@ -45,7 +45,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.21.3",
"appid": "wx06060b7a7634db15",
"appid": "wx95ac219beca2f34f",
"projectname": "MP-CU",
"debugOptions": {
"hidedInDevtools": []
......
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