V0.0.9 更新
修正IOS登录错误
This commit is contained in:
+17
-1
@@ -353,6 +353,21 @@ function ApiDeletePasswordCode(openid,coursePswdCode) {
|
||||
|
||||
}
|
||||
|
||||
function ApiGetTips() {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
url: baseurl+'/API/ApiGetTips.php',
|
||||
method: 'GET', // 或 'POST'
|
||||
success: res => {
|
||||
resolve(res.data); // 将获取的结果通过Promise的resolve传递
|
||||
},
|
||||
fail: err => {
|
||||
reject(err); // 如果请求失败,传递错误给Promise的reject
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ApiGetUserOpenID,
|
||||
@@ -371,7 +386,8 @@ function ApiDeletePasswordCode(openid,coursePswdCode) {
|
||||
ApiAddPasswordCodeBefor,
|
||||
ApiGetPasswordCode,
|
||||
ApiChangePasswordCode,
|
||||
ApiDeletePasswordCode
|
||||
ApiDeletePasswordCode,
|
||||
ApiGetTips
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,14 @@ const MyApi = require('./Api/api.js');
|
||||
App({
|
||||
onLaunch() {
|
||||
|
||||
const deviceInfo = wx.getDeviceInfo();
|
||||
console.log({
|
||||
登录平台: deviceInfo.platform,
|
||||
设备品牌: deviceInfo.brand,
|
||||
设备型号: deviceInfo.model,
|
||||
内存大小: deviceInfo.memorySize + "MB"
|
||||
});
|
||||
|
||||
MyApi.ApiGetUserOpenID()
|
||||
.then(result => {
|
||||
// 获取code成功后执行的代码
|
||||
@@ -22,6 +30,7 @@ App({
|
||||
// 将信息存储到本地缓存中
|
||||
wx.setStorageSync('UserInfoCache', this.globalData);
|
||||
|
||||
|
||||
//查询用户课程数据
|
||||
MyApi.ApiGetUserCourseDataFromDB(result)
|
||||
.then(result => {
|
||||
@@ -50,6 +59,17 @@ App({
|
||||
|
||||
// 将信息存储到本地缓存中
|
||||
wx.setStorageSync('UserInfoCache', this.globalData);
|
||||
|
||||
|
||||
MyApi.ApiGetTips()
|
||||
.then(result => {
|
||||
// 将信息存储到本地缓存中
|
||||
wx.setStorageSync('Tips', result);
|
||||
})
|
||||
.catch(err => {
|
||||
// 失败后执行的代码
|
||||
console.error("请求失败:"+err);
|
||||
});
|
||||
},
|
||||
globalData: {
|
||||
BaseURL:'https://api.yeomai.site',
|
||||
@@ -60,6 +80,7 @@ App({
|
||||
LastLoginDate: null,
|
||||
UserName: null,
|
||||
NewUser: null,
|
||||
OwnedCourse: null
|
||||
OwnedCourse: null,
|
||||
Tips: null
|
||||
}
|
||||
})
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"selectedIconPath": "static/image/shouye-selected.png"
|
||||
},
|
||||
{
|
||||
"text": "课程",
|
||||
"text": "知识",
|
||||
"pagePath": "pages/kecheng/kecheng",
|
||||
"iconPath": "static/image/kecheng.png",
|
||||
"selectedIconPath": "static/image/kecheng-selected.png"
|
||||
|
||||
@@ -24,44 +24,33 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
//只有当登录才有效
|
||||
if (wx.getStorageSync('UserInfoCache').IsLogin) {
|
||||
//获取接收到的视频序号
|
||||
var receivedIndex = options.number ?? null;
|
||||
if (receivedIndex){
|
||||
//获取接收到的视频序号
|
||||
var receivedIndex = options.number ?? null;
|
||||
if (receivedIndex){
|
||||
|
||||
MyApi.ApiGetFreeCourseData(receivedIndex)
|
||||
.then(result => {
|
||||
this.setData({
|
||||
VideoTitle:result.PlayData[0].课程名称,
|
||||
playdata:result.PlayData,
|
||||
VideoImageURL:this.data.BaseURL+"/Course/"+result.课程id+".png",
|
||||
coursedata:result,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
this.setData({
|
||||
playdata:[],
|
||||
});
|
||||
console.error("请求失败:"+err);
|
||||
MyApi.ApiGetFreeCourseData(receivedIndex)
|
||||
.then(result => {
|
||||
this.setData({
|
||||
VideoTitle:result.PlayData[0].课程名称,
|
||||
playdata:result.PlayData,
|
||||
VideoImageURL:this.data.BaseURL+"/Course/"+result.课程id+".png",
|
||||
coursedata:result,
|
||||
});
|
||||
} else {
|
||||
wx.switchTab({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
this.setData({
|
||||
playdata:[],
|
||||
});
|
||||
console.error("请求失败:"+err);
|
||||
});
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
wx.switchTab({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
},50);
|
||||
}
|
||||
wx.switchTab({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}
|
||||
},
|
||||
OnTapVideoList(e){
|
||||
//只有当登录才有效
|
||||
if (wx.getStorageSync('UserInfoCache').IsLogin) {
|
||||
|
||||
// 获取当前点击的索引
|
||||
|
||||
const courseindex = e.currentTarget.dataset.courseindex;
|
||||
@@ -72,13 +61,7 @@ Page({
|
||||
HiddenVideoControl:false,
|
||||
top:420,
|
||||
});
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
wx.switchTab({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
},50);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -92,13 +75,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
if (!wx.getStorageSync('UserInfoCache').IsLogin) {
|
||||
setTimeout(function() {
|
||||
wx.switchTab({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
},50);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,7 @@ Page({
|
||||
wx.uploadFile({
|
||||
filePath: UpLoadfilePath,
|
||||
name: "HeadIconKey",
|
||||
url: getApp().globalData.BaseURL+'/API/ApiChangeUserInfo.php',
|
||||
url: getApp().globalData.BaseURL+'/API/ApiChangeUserInfo.php', //这里会在后端设置为已登录
|
||||
formData:{
|
||||
username: random_username,
|
||||
openid: wx.getStorageSync('UserInfoCache').user_openid
|
||||
|
||||
+14
-2
@@ -14,7 +14,7 @@ Page({
|
||||
FreeCourseList: [],
|
||||
webPageCount: 1,
|
||||
hasTouchBottom:false,
|
||||
bannerImgName:[]
|
||||
bannerImgName:[],
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -129,7 +129,19 @@ updateManager.onUpdateFailed(function () {
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
//逻辑同onLoad()一样,略有修改\
|
||||
//逻辑同onLoad()一样,略有修改
|
||||
//获取小知识
|
||||
MyApi.ApiGetTips()
|
||||
.then(result => {
|
||||
// 将信息存储到本地缓存中
|
||||
wx.setStorageSync('Tips', result);
|
||||
})
|
||||
.catch(err => {
|
||||
// 失败后执行的代码
|
||||
console.error("请求失败:"+err);
|
||||
});
|
||||
|
||||
|
||||
//获取首页banner图片
|
||||
MyApi.ApiGetBannerImg()
|
||||
.then(result => {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<!-- 新课上线 -->
|
||||
<view class="shouyetupianlist">
|
||||
<view class="biaoti01">
|
||||
<view wx:if="{{CourseList.length > 0}}" class="biaoti01">
|
||||
<image class="biaoti01img" src="{{BaseURL}}/Images/Icon/xinke.png" mode="aspectFill" />
|
||||
<text decode> 新课上线</text>
|
||||
</view>
|
||||
@@ -35,11 +35,11 @@
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 免费课程 -->
|
||||
<!-- 自我学习 -->
|
||||
<view class="shouyetupianlist">
|
||||
<view class="biaoti01">
|
||||
<image class="biaoti01img" src="{{BaseURL}}/Images/Icon/xinke.png" mode="aspectFill" />
|
||||
<text decode> 免费课程</text>
|
||||
<view wx:if="{{FreeCourseList.length > 0}}" class="biaoti01">
|
||||
<image class="biaoti01img" src="{{BaseURL}}/Images/Icon/ziwoxuexi.png" mode="aspectFill" />
|
||||
<text decode> 自我学习</text>
|
||||
</view>
|
||||
<view class="shouyetupianlistcontent" wx:for="{{FreeCourseList}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-number="{{item['序号']}}" bind:tap="NavigatorToIndexFreeCourseDetails">
|
||||
<view class="hengxianglist" key="{{index}}">
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<!-- 知识速通 -->
|
||||
<view class="shouyetupianlist">
|
||||
<view class="biaoti01">
|
||||
<view wx:if="{{WebPages.length > 0}}" class="biaoti01">
|
||||
<image class="biaoti01img" src="{{BaseURL}}/Images/Icon/sutong.png" mode="aspectFill" />
|
||||
<text decode> 知识速通</text>
|
||||
</view>
|
||||
|
||||
@@ -62,7 +62,7 @@ page {
|
||||
padding: 0;
|
||||
margin: 20rpx;
|
||||
height: 260rpx;
|
||||
width: 100%;
|
||||
width: 730rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
@@ -82,7 +82,7 @@ page {
|
||||
|
||||
.biaoti01 {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
width: 750rpx;
|
||||
height: 60rpx;
|
||||
align-items: center;
|
||||
padding-left: 20rpx;
|
||||
|
||||
@@ -8,13 +8,20 @@ Page({
|
||||
BaseURL:getApp().globalData.BaseURL,
|
||||
hasCourse: false,
|
||||
OwnedCourse: null,
|
||||
intervalId: null
|
||||
intervalId: null,
|
||||
htmlcontent: " "
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
//设置小知识
|
||||
try {
|
||||
var temphtmlcontent= wx.getStorageSync('Tips');
|
||||
this.setData({htmlcontent: temphtmlcontent[0].content});
|
||||
} catch (error) { };
|
||||
|
||||
|
||||
//每10ms获取一次数据,直到获取到个人信息数据为止
|
||||
// 使用箭头函数确保正确的作用域
|
||||
@@ -30,7 +37,7 @@ this.intervalId = setInterval(() => {
|
||||
//计时500次,即5s后如果没有任何获取到已经登录的标志,依然断开计时器
|
||||
if (longtime>=500){
|
||||
clearInterval(this.intervalId);
|
||||
console.log('暂无已购课程!');
|
||||
console.log('暂无课程!');
|
||||
};
|
||||
longtime=longtime+1;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
|
||||
"Parser":"/Parser/index"
|
||||
},
|
||||
"navigationBarTitleText": "课程"
|
||||
"navigationBarTitleText": "知识"
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
<scroll-view class="container" scroll-y enable-flex type="custom">
|
||||
<block wx:if="{{!hasCourse}}">
|
||||
<text>暂无信息</text>
|
||||
<view style="width: 100%;height: 400rpx;" >
|
||||
<image style="margin-top: 30rpx; margin-left: 20rpx; height: 350rpx; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); width: 710rpx; border-radius: 20rpx; background-color: rgb(0, 255, 255);"
|
||||
src="{{BaseURL}}/Images/Banner/BGbanner.png" mode="aspectFill" />
|
||||
</view>
|
||||
<Parser html="{{htmlcontent}}" />
|
||||
</block>
|
||||
<block wx:else>
|
||||
<view wx:for="{{OwnedCourse}}" wx:for-item="item" wx:for-index="index" wx:key="index" class="kecheng" bind:tap="NavigatorToVideoDetails" data-index="{{index}}">
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
.kecheng_video_up {
|
||||
width: 400rpx;
|
||||
height: 225rpx;
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
</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>
|
||||
<text style="display: block;">Version 0.0.9</text>
|
||||
<text style="font-size: 20rpx;display: block;">Copyright<text style="font-size: 15rpx;position: relative;top: -10rpx;right: 0rpx;">©</text> 2026 YelayMaths. All Rights Reserved.</text>
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
Reference in New Issue
Block a user