文字信息走配置
This commit is contained in:
+19
@@ -264,6 +264,24 @@ function ApiGetBannerImg() {
|
||||
|
||||
}
|
||||
|
||||
function ApiGetConfig() {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
url: baseurl+'/API/ApiGetConfig.php',
|
||||
method: 'GET', // 或 'POST'
|
||||
data: {
|
||||
},
|
||||
success: res => {
|
||||
resolve(res.data); // 将获取的结果通过Promise的resolve传递
|
||||
},
|
||||
fail: err => {
|
||||
reject(err); // 如果请求失败,传递错误给Promise的reject
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function ApiAddPasswordCode(openid,courseID,courseName,coursePswdCode,courseEndDate,courseInfo,courseCount) {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
@@ -403,6 +421,7 @@ function ApiGetTips() {
|
||||
ApiGetIndexCourseList,
|
||||
ApiGetIndexFreeCourseList,
|
||||
ApiGetBannerImg,
|
||||
ApiGetConfig,
|
||||
ApiAddPasswordCode,
|
||||
ApiAddPasswordCodeBefor,
|
||||
ApiGetPasswordCode,
|
||||
|
||||
@@ -12,6 +12,16 @@ App({
|
||||
内存大小: deviceInfo.memorySize + "MB"
|
||||
});
|
||||
|
||||
MyApi.ApiGetConfig()
|
||||
.then(result => {
|
||||
// 将信息存储到本地缓存中
|
||||
wx.setStorageSync('Config', result);
|
||||
})
|
||||
.catch(err => {
|
||||
// 失败后执行的代码
|
||||
console.error("请求失败:"+err);
|
||||
});
|
||||
|
||||
MyApi.ApiGetUserOpenID()
|
||||
.then(result => {
|
||||
// 获取code成功后执行的代码
|
||||
|
||||
@@ -15,12 +15,27 @@ Page({
|
||||
webPageCount: 1,
|
||||
hasTouchBottom:false,
|
||||
bannerImgName:[],
|
||||
text1: wx.getStorageSync('Config')[2].value,
|
||||
text2: wx.getStorageSync('Config')[3].value,
|
||||
text3: wx.getStorageSync('Config')[4].value,
|
||||
text4: wx.getStorageSync('Config')[11].value,
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
//获取配置
|
||||
MyApi.ApiGetConfig()
|
||||
.then(result => {
|
||||
// 将信息存储到本地缓存中
|
||||
wx.setStorageSync('Config', result);
|
||||
})
|
||||
.catch(err => {
|
||||
// 失败后执行的代码
|
||||
console.error("请求失败:"+err);
|
||||
});
|
||||
|
||||
//获取首页banner图片
|
||||
MyApi.ApiGetBannerImg()
|
||||
.then(result => {
|
||||
@@ -130,6 +145,18 @@ updateManager.onUpdateFailed(function () {
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
//逻辑同onLoad()一样,略有修改
|
||||
//获取配置
|
||||
MyApi.ApiGetConfig()
|
||||
.then(result => {
|
||||
// 将信息存储到本地缓存中
|
||||
wx.setStorageSync('Config', result);
|
||||
})
|
||||
.catch(err => {
|
||||
// 失败后执行的代码
|
||||
console.error("请求失败:"+err);
|
||||
});
|
||||
|
||||
|
||||
//获取小知识
|
||||
MyApi.ApiGetTips()
|
||||
.then(result => {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<view class="shouyetupianlist">
|
||||
<view wx:if="{{CourseList.length > 0}}" class="biaoti01">
|
||||
<image class="biaoti01img" src="{{BaseURL}}/Images/Icon/xinke.png" mode="aspectFill" />
|
||||
<text decode> 新课上线</text>
|
||||
<text decode> {{text1}}</text>
|
||||
</view>
|
||||
<view class="shouyetupianlistcontent" wx:for="{{CourseList}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-number="{{index}}" bind:tap="NavigatorToIndexNewCourseDetails">
|
||||
<view class="hengxianglist" key="{{index}}">
|
||||
@@ -39,7 +39,7 @@
|
||||
<view class="shouyetupianlist">
|
||||
<view wx:if="{{FreeCourseList.length > 0}}" class="biaoti01">
|
||||
<image class="biaoti01img" src="{{BaseURL}}/Images/Icon/ziwoxuexi.png" mode="aspectFill" />
|
||||
<text decode> 自我学习</text>
|
||||
<text decode> {{text2}}</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}}">
|
||||
@@ -52,7 +52,7 @@
|
||||
<view class="shouyetupianlist">
|
||||
<view wx:if="{{WebPages.length > 0}}" class="biaoti01">
|
||||
<image class="biaoti01img" src="{{BaseURL}}/Images/Icon/sutong.png" mode="aspectFill" />
|
||||
<text decode> 知识速通</text>
|
||||
<text decode> {{text3}}</text>
|
||||
</view>
|
||||
|
||||
<view class="shouyetupianlistcontent01" wx:for="{{WebPages}}" wx:for-item="imageshuzu" wx:for-index="index" wx:key="index" bind:tap="NavigatorToWebPageDetails" data-index="{{index}}">
|
||||
@@ -67,7 +67,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view style="width: auto; margin: 0px auto; margin-bottom: 10px;">
|
||||
<text wx:if="{{hasTouchBottom}}">已经到底啦!</text>
|
||||
<text wx:if="{{hasTouchBottom}}">{{text4}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
+6
-2
@@ -13,7 +13,6 @@ Page({
|
||||
intervalId: null,
|
||||
headiconurl: '/static/image/user.png',
|
||||
urlstring: getApp().globalData.BaseURL + "/Images/ToolsIcon/toolsicon",
|
||||
CodeURL:getApp().globalData.BaseURL + "/Images/WXCode/Yeomai.png",
|
||||
LoginBtnText: '登录注册',
|
||||
UserNameText: '未登录',
|
||||
user_openid: null,
|
||||
@@ -22,7 +21,12 @@ Page({
|
||||
IsAdministor: null,
|
||||
LastLoginDate: null,
|
||||
UserName: null,
|
||||
NewUser: null
|
||||
NewUser: null,
|
||||
text2: wx.getStorageSync('Config')[7].value,
|
||||
text3: wx.getStorageSync('Config')[8].value,
|
||||
text4: wx.getStorageSync('Config')[9].value,
|
||||
text5: wx.getStorageSync('Config')[10].value,
|
||||
CodeURL:getApp().globalData.BaseURL + "/Images/WXCode/"+wx.getStorageSync('Config')[5].value+".png",
|
||||
},
|
||||
showdialog() {
|
||||
if (wx.getStorageSync('UserInfoCache').IsLogin ) {
|
||||
|
||||
@@ -63,22 +63,22 @@
|
||||
</button>
|
||||
|
||||
<button wx:if="{{IsLogin}}" class="functions2" bind:tap="ChangeUserInfo">
|
||||
<text class="zuobianwenzi">修改资料</text>
|
||||
<text class="zuobianwenzi">{{text2}}</text>
|
||||
<text class="jiantou"> > </text>
|
||||
</button>
|
||||
|
||||
<button class="functions2" open-type="share">
|
||||
<text class="zuobianwenzi">好友分享</text>
|
||||
<text class="zuobianwenzi">{{text3}}</text>
|
||||
<text class="jiantou"> > </text>
|
||||
</button>
|
||||
|
||||
<button class="functions2" open-type="contact" bindcontact="handleContact">
|
||||
<text class="zuobianwenzi">在线沟通</text>
|
||||
<text class="zuobianwenzi">{{text4}}</text>
|
||||
<text class="jiantou"> > </text>
|
||||
</button>
|
||||
|
||||
<button class="functions2" bind:tap="showCode">
|
||||
<text class="zuobianwenzi">YelayMaths</text>
|
||||
<text class="zuobianwenzi">{{text5}}</text>
|
||||
<text class="jiantou"> > </text>
|
||||
</button>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user