功能新增
添加个人页面信息 添加二维码图片 添加好友分享按钮
This commit is contained in:
+21
@@ -169,6 +169,26 @@ function ApiLogout(openid) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ApiLogin(openid,username) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
wx.request({
|
||||||
|
url: baseurl+'/API/ApiLogin.php',
|
||||||
|
method: 'GET', // 或 'POST'
|
||||||
|
data: {
|
||||||
|
openid: openid,
|
||||||
|
username: username,
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
resolve(res.data); // 将获取的结果通过Promise的resolve传递
|
||||||
|
},
|
||||||
|
fail: err => {
|
||||||
|
reject(err); // 如果请求失败,传递错误给Promise的reject
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function ApiPasswordCodeValidate(openid, passwordcode) {
|
function ApiPasswordCodeValidate(openid, passwordcode) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@@ -375,6 +395,7 @@ function ApiGetTips() {
|
|||||||
ApiGetWebPagesFromDB,
|
ApiGetWebPagesFromDB,
|
||||||
ApiGetWebPageContent,
|
ApiGetWebPageContent,
|
||||||
ApiGetUserCourseDataFromDB,
|
ApiGetUserCourseDataFromDB,
|
||||||
|
ApiLogin,
|
||||||
ApiLogout,
|
ApiLogout,
|
||||||
ApiGetCourseData,
|
ApiGetCourseData,
|
||||||
ApiGetFreeCourseData,
|
ApiGetFreeCourseData,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ App({
|
|||||||
this.globalData.LastLoginDate= result1.data.最后登录日期;
|
this.globalData.LastLoginDate= result1.data.最后登录日期;
|
||||||
this.globalData.UserName= result1.data.用户名;
|
this.globalData.UserName= result1.data.用户名;
|
||||||
this.globalData.NewUser= result1.result;
|
this.globalData.NewUser= result1.result;
|
||||||
|
this.globalData.HeadiconID= result1.data.HeadiconID;
|
||||||
// 将信息存储到本地缓存中
|
// 将信息存储到本地缓存中
|
||||||
wx.setStorageSync('UserInfoCache', this.globalData);
|
wx.setStorageSync('UserInfoCache', this.globalData);
|
||||||
|
|
||||||
@@ -81,6 +82,7 @@ App({
|
|||||||
UserName: null,
|
UserName: null,
|
||||||
NewUser: null,
|
NewUser: null,
|
||||||
OwnedCourse: null,
|
OwnedCourse: null,
|
||||||
Tips: null
|
Tips: null,
|
||||||
|
HeadiconID: null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
"pages/VideoDetailsPage/VideoDetailsPage",
|
"pages/VideoDetailsPage/VideoDetailsPage",
|
||||||
"pages/IndexNewCourseDetails/IndexNewCourseDetails",
|
"pages/IndexNewCourseDetails/IndexNewCourseDetails",
|
||||||
"pages/IndexFreeCourseDetails/IndexFreeCourseDetails",
|
"pages/IndexFreeCourseDetails/IndexFreeCourseDetails",
|
||||||
"pages/SetPasswordCode/SetPasswordCode"
|
"pages/SetPasswordCode/SetPasswordCode",
|
||||||
|
"pages/ChangeUserInfo/ChangeUserInfo"
|
||||||
],
|
],
|
||||||
"window": {
|
"window": {
|
||||||
"navigationBarTextStyle": "black",
|
"navigationBarTextStyle": "black",
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// pages/ChangeUserInfo/ChangeUserInfo.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<!--pages/ChangeUserInfo/ChangeUserInfo.wxml-->
|
||||||
|
<text>pages/ChangeUserInfo/ChangeUserInfo.wxml</text>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/* pages/ChangeUserInfo/ChangeUserInfo.wxss */
|
||||||
@@ -58,23 +58,60 @@ Page({
|
|||||||
|
|
||||||
console.log("用户名: "+random_username);
|
console.log("用户名: "+random_username);
|
||||||
|
|
||||||
// 复制本地图片到用户数据路径,如果文件不存在,先复制
|
// // 复制本地图片到用户数据路径,如果文件不存在,先复制
|
||||||
const UpLoadfilePath = wx.env.USER_DATA_PATH + '/defaultAvatar.png';
|
// const UpLoadfilePath = wx.env.USER_DATA_PATH + '/defaultAvatar.png';
|
||||||
try {wx.getFileSystemManager().accessSync(UpLoadfilePath);}
|
// try {wx.getFileSystemManager().accessSync(UpLoadfilePath);}
|
||||||
catch (e) {
|
// catch (e) {
|
||||||
wx.getFileSystemManager().copyFileSync('static/image/defaultAvatar.png', UpLoadfilePath);
|
// wx.getFileSystemManager().copyFileSync('static/image/defaultAvatar.png', UpLoadfilePath);
|
||||||
}
|
// }
|
||||||
|
|
||||||
wx.uploadFile({
|
// wx.uploadFile({
|
||||||
filePath: UpLoadfilePath,
|
// filePath: UpLoadfilePath,
|
||||||
name: "HeadIconKey",
|
// name: "HeadIconKey",
|
||||||
url: getApp().globalData.BaseURL+'/API/ApiChangeUserInfo.php', //这里会在后端设置为已登录
|
// url: getApp().globalData.BaseURL+'/API/ApiChangeUserInfo.php', //这里会在后端设置为已登录
|
||||||
formData:{
|
// formData:{
|
||||||
username: random_username,
|
// username: random_username,
|
||||||
openid: wx.getStorageSync('UserInfoCache').user_openid
|
// openid: wx.getStorageSync('UserInfoCache').user_openid
|
||||||
},
|
// },
|
||||||
success(res) {
|
// success(res) {
|
||||||
//打印服务器返回数据
|
// //打印服务器返回数据
|
||||||
|
// wx.showToast({
|
||||||
|
// title: '成功!',
|
||||||
|
// icon: 'success',
|
||||||
|
// mask:true,
|
||||||
|
// duration: 4000
|
||||||
|
// });
|
||||||
|
// //这里修改缓存
|
||||||
|
// var tempuesrinfo=wx.getStorageSync('UserInfoCache')
|
||||||
|
// tempuesrinfo.UserName=random_username
|
||||||
|
// tempuesrinfo.IsAdministor=isAdmin
|
||||||
|
// tempuesrinfo.IsLogin="1"
|
||||||
|
// wx.setStorageSync('UserInfoCache', tempuesrinfo)
|
||||||
|
|
||||||
|
// setTimeout(function() {
|
||||||
|
// wx.hideToast();
|
||||||
|
// wx.switchTab({
|
||||||
|
// url: '/pages/wode/wode',
|
||||||
|
// })
|
||||||
|
// },3000);
|
||||||
|
|
||||||
|
// },
|
||||||
|
// fail(res) {
|
||||||
|
// //打印服务器返回数据
|
||||||
|
// console.log(res);
|
||||||
|
// setTimeout(function() {
|
||||||
|
// wx.hideToast();
|
||||||
|
// wx.switchTab({
|
||||||
|
// url: '/pages/wode/wode',
|
||||||
|
// })
|
||||||
|
// },3000);
|
||||||
|
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
MyApi.ApiLogin(wx.getStorageSync('UserInfoCache').user_openid, random_username)
|
||||||
|
.then(result1 => {
|
||||||
|
//打印服务器返回数据
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '成功!',
|
title: '成功!',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@@ -94,20 +131,9 @@ Page({
|
|||||||
url: '/pages/wode/wode',
|
url: '/pages/wode/wode',
|
||||||
})
|
})
|
||||||
},3000);
|
},3000);
|
||||||
|
})
|
||||||
},
|
.catch(err => {
|
||||||
fail(res) {
|
});
|
||||||
//打印服务器返回数据
|
|
||||||
console.log(res);
|
|
||||||
setTimeout(function() {
|
|
||||||
wx.hideToast();
|
|
||||||
wx.switchTab({
|
|
||||||
url: '/pages/wode/wode',
|
|
||||||
})
|
|
||||||
},3000);
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+30
-3
@@ -8,10 +8,12 @@ Page({
|
|||||||
data: {
|
data: {
|
||||||
value: '',
|
value: '',
|
||||||
show: false,
|
show: false,
|
||||||
|
showCode: false,
|
||||||
passwordcode: null,
|
passwordcode: null,
|
||||||
intervalId: null,
|
intervalId: null,
|
||||||
headiconurl: '/static/image/user.png',
|
headiconurl: '/static/image/user.png',
|
||||||
urlstring: getApp().globalData.BaseURL + "/Images/ToolsIcon/toolsicon",
|
urlstring: getApp().globalData.BaseURL + "/Images/ToolsIcon/toolsicon",
|
||||||
|
CodeURL:getApp().globalData.BaseURL + "/Images/WXCode/Yeomai.png",
|
||||||
LoginBtnText: '登录注册',
|
LoginBtnText: '登录注册',
|
||||||
UserNameText: '未登录',
|
UserNameText: '未登录',
|
||||||
user_openid: null,
|
user_openid: null,
|
||||||
@@ -37,17 +39,42 @@ Page({
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
ChangeUserInfo() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/ChangeUserInfo/ChangeUserInfo',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onChange(e) {
|
onChange(e) {
|
||||||
this.setData({
|
this.setData({
|
||||||
passwordcode: e.detail
|
passwordcode: e.detail
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onClose() {
|
onClose() {
|
||||||
this.setData({
|
this.setData({
|
||||||
show: false,
|
show: false,
|
||||||
passwordcode: null
|
passwordcode: null,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showCode() {
|
||||||
|
this.setData({
|
||||||
|
showCode: true,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
OnClickCodeImage() {
|
||||||
|
console.log("点击了二维码");
|
||||||
|
},
|
||||||
|
|
||||||
|
onCodeClose() {
|
||||||
|
this.setData({
|
||||||
|
showCode: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
GetCourse() {
|
GetCourse() {
|
||||||
//点击确定后的课程获取
|
//点击确定后的课程获取
|
||||||
if (this.data.passwordcode) {
|
if (this.data.passwordcode) {
|
||||||
@@ -122,8 +149,8 @@ Page({
|
|||||||
if (Storage.IsLogin === "1") {
|
if (Storage.IsLogin === "1") {
|
||||||
this.setData({
|
this.setData({
|
||||||
IsLogin: Storage.IsLogin,
|
IsLogin: Storage.IsLogin,
|
||||||
headiconurl: getApp().globalData.BaseURL + "/Images/UsersHeadIcon/" + Storage.user_openid + ".png",
|
headiconurl: getApp().globalData.BaseURL + "/Images/Headicons/Headicon" + Storage.HeadiconID + ".png",
|
||||||
LoginBtnText: "个人信息",
|
LoginBtnText: "退出登录",
|
||||||
UserNameText: Storage.UserName,
|
UserNameText: Storage.UserName,
|
||||||
IsAdministor: Storage.IsAdministor,
|
IsAdministor: Storage.IsAdministor,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"van-dialog": "@vant/weapp/dialog/index",
|
"van-dialog": "@vant/weapp/dialog/index",
|
||||||
"van-field": "@vant/weapp/field/index",
|
"van-field": "@vant/weapp/field/index",
|
||||||
"van-button": "@vant/weapp/button/index"
|
"van-button": "@vant/weapp/button/index",
|
||||||
|
"van-popup": "@vant/weapp/popup/index",
|
||||||
|
"van-image": "@vant/weapp/image/index"
|
||||||
},
|
},
|
||||||
"navigationBarTitleText": "个人中心"
|
"navigationBarTitleText": "个人中心"
|
||||||
}
|
}
|
||||||
+30
-8
@@ -1,4 +1,19 @@
|
|||||||
<!--pages/wode/wode.wxml-->
|
<!--pages/wode/wode.wxml-->
|
||||||
|
<van-popup show="{{ showCode }}" bind:close="onCodeClose">
|
||||||
|
<view class="code-container">
|
||||||
|
<text class="tip-text">长按图片识别</text>
|
||||||
|
<van-image
|
||||||
|
show-menu-by-longpress="true"
|
||||||
|
use-loading-slot
|
||||||
|
use-error-slot
|
||||||
|
bind:click="OnClickCodeImage"
|
||||||
|
width="600rpx"
|
||||||
|
height="816rpx"
|
||||||
|
src="{{CodeURL}}"
|
||||||
|
/>
|
||||||
|
<van-loading slot="loading" type="spinner" size="20" vertical />
|
||||||
|
</view>
|
||||||
|
</van-popup>
|
||||||
<van-dialog
|
<van-dialog
|
||||||
use-slot
|
use-slot
|
||||||
show="{{ show }}"
|
show="{{ show }}"
|
||||||
@@ -42,25 +57,32 @@
|
|||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
<button class="functions2" bind:tap="showdialog">
|
<button wx:if="{{IsLogin}}" class="functions2" bind:tap="showdialog">
|
||||||
<text class="zuobianwenzi">课程码</text>
|
<text class="zuobianwenzi">课程码</text>
|
||||||
<text class="jiantou"> > </text>
|
<text class="jiantou"> > </text>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button wx:if="{{IsLogin}}" class="functions2" bind:tap="ChangeUserInfo">
|
||||||
|
<text class="zuobianwenzi">修改资料</text>
|
||||||
|
<text class="jiantou"> > </text>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button class="functions2" open-type="share">
|
||||||
|
<text class="zuobianwenzi">好友分享</text>
|
||||||
|
<text class="jiantou"> > </text>
|
||||||
|
</button>
|
||||||
|
|
||||||
<button class="functions2" open-type="contact" bindcontact="handleContact">
|
<button class="functions2" open-type="contact" bindcontact="handleContact">
|
||||||
<text class="zuobianwenzi">联系客服</text>
|
<text class="zuobianwenzi">在线沟通</text>
|
||||||
<text class="jiantou"> > </text>
|
<text class="jiantou"> > </text>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="functions2" bind:tap="showdialog3">
|
<button class="functions2" bind:tap="showCode">
|
||||||
<text class="zuobianwenzi">点击复制微信:YelayMaths</text>
|
<text class="zuobianwenzi">YelayMaths</text>
|
||||||
<text class="jiantou"> > </text>
|
<text class="jiantou"> > </text>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="functions2" bind:tap="showdialog4">
|
|
||||||
<text class="zuobianwenzi">分享给朋友</text>
|
|
||||||
<text class="jiantou"> > </text>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- 功能暂不开放 -->
|
<!-- 功能暂不开放 -->
|
||||||
<!-- <button class="functions2" bind:tap="function2_01">
|
<!-- <button class="functions2" bind:tap="function2_01">
|
||||||
|
|||||||
+21
-1
@@ -5,6 +5,22 @@
|
|||||||
flex-direction:column;
|
flex-direction:column;
|
||||||
justify-content:space-between;
|
justify-content:space-between;
|
||||||
}
|
}
|
||||||
|
.code-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center; /* 水平居中 */
|
||||||
|
padding: 20rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: rgb(0, 201, 77);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 文字样式:可选加粗、颜色、间距等 */
|
||||||
|
.tip-text {
|
||||||
|
font-size: 34rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
margin-bottom: 20rpx; /* 与图片保持间距 */
|
||||||
|
text-align: center; /* 冗余保险,虽然 flex 已居中 */
|
||||||
|
}
|
||||||
|
|
||||||
.login {
|
.login {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -15,7 +31,6 @@
|
|||||||
height: 150rpx;
|
height: 150rpx;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
margin: 20rpx;
|
margin: 20rpx;
|
||||||
border-radius: 20rpx;
|
|
||||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||||
}
|
}
|
||||||
.touxiangimg {
|
.touxiangimg {
|
||||||
@@ -91,6 +106,11 @@
|
|||||||
width: 75rpx;
|
width: 75rpx;
|
||||||
height: 75rpx;
|
height: 75rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.functionimg002 {
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
}
|
||||||
.functiontext001 {
|
.functiontext001 {
|
||||||
font-size: 25rpx;
|
font-size: 25rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user