页面构成
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
// pages/wode/wode.js
|
||||
const MyApi = require('../../Api/api.js');
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
value: '',
|
||||
show: false,
|
||||
passwordcode: null,
|
||||
intervalId: null,
|
||||
headiconurl: '/static/image/user.png',
|
||||
urlstring: getApp().globalData.BaseURL + "/Images/ToolsIcon/toolsicon",
|
||||
LoginBtnText: '登录注册',
|
||||
UserNameText: '未登录',
|
||||
user_openid: null,
|
||||
YelayMaths_ID: null,
|
||||
IsLogin: null,
|
||||
IsAdministor: null,
|
||||
LastLoginDate: null,
|
||||
UserName: null,
|
||||
NewUser: null
|
||||
},
|
||||
showdialog() {
|
||||
if (wx.getStorageSync('UserInfoCache').IsLogin ) {
|
||||
this.setData({
|
||||
show: true,
|
||||
value: ''
|
||||
});
|
||||
} else {
|
||||
wx.showToast({
|
||||
mask:true,
|
||||
icon: 'error',
|
||||
title: '请登录后操作!',
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
onChange(e) {
|
||||
this.setData({
|
||||
passwordcode: e.detail
|
||||
});
|
||||
},
|
||||
onClose() {
|
||||
this.setData({
|
||||
show: false,
|
||||
passwordcode: null
|
||||
});
|
||||
},
|
||||
GetCourse() {
|
||||
//点击确定后的课程获取
|
||||
if (this.data.passwordcode) {
|
||||
wx.showToast({
|
||||
title: '请稍后...',
|
||||
icon: 'loading',
|
||||
mask:true,
|
||||
duration: 10000
|
||||
});
|
||||
|
||||
MyApi.ApiPasswordCodeValidate(wx.getStorageSync('UserInfoCache').user_openid, this.data.passwordcode)
|
||||
.then(result => {
|
||||
// 成功后执行的代码
|
||||
try {
|
||||
wx.hideToast();
|
||||
} catch (error) {}
|
||||
|
||||
wx.showToast({
|
||||
title: result.Data,
|
||||
icon: 'error',
|
||||
mask:true,
|
||||
duration: 2000
|
||||
});
|
||||
|
||||
//修改缓存已拥有课程
|
||||
if (result.ReturnData) {
|
||||
var tempcourse = wx.getStorageSync('UserInfoCache');
|
||||
tempcourse.OwnedCourse=result.ReturnData;
|
||||
wx.setStorageSync('UserInfoCache', tempcourse);
|
||||
};
|
||||
})
|
||||
.catch(err => {
|
||||
// 失败后执行的代码
|
||||
console.error("请求失败:" + err);
|
||||
});
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '请输入课程码!',
|
||||
icon: 'error',
|
||||
mask:true,
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
|
||||
this.setData({
|
||||
show: false,
|
||||
});
|
||||
},
|
||||
|
||||
redirectToTargetLoginout: function () {
|
||||
wx.navigateTo({
|
||||
url: '/pages/LoginOrOutDetails/LoginOrOutDetails?IsLogin=' + this.IsLogin,
|
||||
})
|
||||
},
|
||||
|
||||
NGT_SetPasswordCode: function () {
|
||||
this.setData({
|
||||
show: false,
|
||||
});
|
||||
wx.navigateTo({
|
||||
url: '/pages/SetPasswordCode/SetPasswordCode',
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
var Storage = wx.getStorageSync('UserInfoCache');
|
||||
if (Storage.IsLogin === "1") {
|
||||
this.setData({
|
||||
IsLogin: Storage.IsLogin,
|
||||
headiconurl: getApp().globalData.BaseURL + "/Images/UsersHeadIcon/" + Storage.user_openid + ".png",
|
||||
LoginBtnText: "个人信息",
|
||||
UserNameText: Storage.UserName,
|
||||
IsAdministor: Storage.IsAdministor,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
IsLogin: null,
|
||||
headiconurl: "/static/image/user.png",
|
||||
LoginBtnText: "登录注册",
|
||||
UserNameText: "未登录",
|
||||
IsAdministor: null,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.onLoad();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
function2_01() {
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '功能安排中。。。',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
})
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-button": "@vant/weapp/button/index"
|
||||
},
|
||||
"navigationBarTitleText": "个人中心"
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<!--pages/wode/wode.wxml-->
|
||||
<van-dialog
|
||||
use-slot
|
||||
show="{{ show }}"
|
||||
show-cancel-button
|
||||
bind:confirm="GetCourse"
|
||||
bind:close="onClose"
|
||||
>
|
||||
<van-button wx:if="{{IsAdministor && IsLogin}}" enabled="{{IsAdministor && IsLogin}}" bind:click="NGT_SetPasswordCode" type="primary" size="large">点击此处设置课程码</van-button>
|
||||
<van-button wx:else disabled="{{true}}" type="primary" size="large">课程码</van-button>
|
||||
<van-field
|
||||
value="{{ value }}"
|
||||
placeholder="请输入课程码"
|
||||
input-align="center"
|
||||
border="{{ false }}"
|
||||
bind:change="onChange"
|
||||
/>
|
||||
</van-dialog>
|
||||
<scroll-view class="container" scroll-y enable-flex type="custom">
|
||||
<view class="login">
|
||||
<view class="touxiangimg">
|
||||
<image class="loginuserimg" src="{{headiconurl}}" mode="aspectFill" />
|
||||
</view>
|
||||
|
||||
<view class="userinfo_name">
|
||||
<text>{{UserNameText}}</text>
|
||||
<button class="loginbtn" bindtap="redirectToTargetLoginout" plain>{{LoginBtnText}}</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 隐藏常用工具区域 -->
|
||||
<!-- <view class="functions1">
|
||||
<text>常用工具</text>
|
||||
<view class="functionstools">
|
||||
<view wx:for="{{1}}" wx:for-item="item" wx:key="index">
|
||||
<navigator class="function001" url="#">
|
||||
<image class="functionimg001" src="{{urlstring}}{{index}}.png" mode="" />
|
||||
<text class="functiontext001">工具{{index}}</text>
|
||||
</navigator>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view> -->
|
||||
<button class="functions2" bind:tap="showdialog">
|
||||
<text class="zuobianwenzi">课程码</text>
|
||||
<text class="jiantou"> > </text>
|
||||
</button>
|
||||
|
||||
<!-- 功能暂不开放 -->
|
||||
<!-- <button class="functions2" bind:tap="function2_01">
|
||||
<text class="zuobianwenzi">成员管理</text>
|
||||
<text class="jiantou"> > </text>
|
||||
</button> -->
|
||||
|
||||
<view class="version">
|
||||
<text style="display: block;">Version 0.0.7</text>
|
||||
<text style="font-size: 20rpx;display: block;">Copyright<text style="font-size: 15rpx;position: relative;top: -10rpx;right: 0rpx;">©</text> 2024 YelayMaths. All Rights Reserved.</text>
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -0,0 +1,115 @@
|
||||
/* pages/wode/wode.wxss */
|
||||
.container {
|
||||
padding:0;
|
||||
align-items:center;
|
||||
flex-direction:column;
|
||||
justify-content:space-between;
|
||||
}
|
||||
|
||||
.login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
/* border: 3rpx solid rgb(110, 110, 110); */
|
||||
width: 710rpx;
|
||||
height: 150rpx;
|
||||
border-radius: 20rpx;
|
||||
margin: 20rpx;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.touxiangimg {
|
||||
display: flex;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50rpx;
|
||||
}
|
||||
.userinfo_name {
|
||||
width: 500rpx;
|
||||
height: 150rpx;
|
||||
margin-left: 30rpx;
|
||||
border-radius: 75rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.loginbtn {
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
.loginbtn[plain] {
|
||||
color: #353535;
|
||||
background-color: transparent;
|
||||
border: 0px solid #353535;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
padding: 0rpx 20rpx;
|
||||
}
|
||||
.loginuserimg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.functions1 {
|
||||
border: 3rpx solid rgb(110, 110, 110);
|
||||
width: 670rpx;
|
||||
border-radius: 20rpx;
|
||||
margin: 20rpx;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
padding: 20rpx;
|
||||
}
|
||||
.functions2 {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
/* border: 3rpx solid rgb(110, 110, 110); */
|
||||
background-color: white;
|
||||
width: 710rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 20rpx;
|
||||
margin: 8rpx 20rpx;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.jiantou {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
.zuobianwenzi {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.function001 {
|
||||
height: 150rpx;
|
||||
width: 75rpx;
|
||||
|
||||
padding: 10rpx 47rpx;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
.functionimg001 {
|
||||
width: 75rpx;
|
||||
height: 75rpx;
|
||||
}
|
||||
.functiontext001 {
|
||||
font-size: 25rpx;
|
||||
}
|
||||
.functionstools {
|
||||
position: relative;
|
||||
top: 20rpx;
|
||||
padding-bottom: 20rpx;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
.version {
|
||||
position: fixed;
|
||||
bottom: 10rpx;
|
||||
color: rgb(197, 197, 197);
|
||||
font-size: 25rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user