diff --git a/app.json b/app.json index 37c628c..5c7cbe7 100644 --- a/app.json +++ b/app.json @@ -1,9 +1,9 @@ { "pages": [ "pages/loginModule/pwdLogin/pwdLogin", + "pages/personCenter/mine/mine", "pages/loginModule/agreement/agreement", "pages/loginModule/privacyPolicy/privacyPolicy", - "pages/personCenter/mine/mine", "pages/personCenter/subCommissionSetting/subCommissionSetting", "pages/test/testVideo/testVideo", "pages/personCenter/withdrawal/withdrawal", @@ -24,7 +24,9 @@ "pages/personCenter/resetPwd/resetPwd", "pages/personCenter/bindBankCard/bindBankCard", "pages/projectModule/settlement/settlement", - "pages/projectModule/subSettlement/subSettlement" + "pages/projectModule/subSettlement/subSettlement", + "pages/course/homepage/homepage", + "pages/course/searchCourses/searchCourses" ], "window": { "navigationBarTextStyle": "black", @@ -47,6 +49,12 @@ "iconPath": "/static/jd1.png", "selectedIconPath": "/static/jd2.png" }, + { + "pagePath": "pages/course/homepage/homepage", + "text": "课程", + "iconPath": "/static/jd1.png", + "selectedIconPath": "/static/jd1.png" + }, { "pagePath": "pages/personCenter/mine/mine", "text": "我的", diff --git a/pages/course/homepage/homepage.js b/pages/course/homepage/homepage.js new file mode 100644 index 0000000..6ee67d7 --- /dev/null +++ b/pages/course/homepage/homepage.js @@ -0,0 +1,72 @@ +// pages/course/homepage/homepage.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + items: [null,null,null,null,null,null,null] + }, + + gotoSearch() { + wx.navigateTo({ + url: '/pages/course/searchCourses/searchCourses', + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/course/homepage/homepage.json b/pages/course/homepage/homepage.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/course/homepage/homepage.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/course/homepage/homepage.wxml b/pages/course/homepage/homepage.wxml new file mode 100644 index 0000000..8da08ac --- /dev/null +++ b/pages/course/homepage/homepage.wxml @@ -0,0 +1,52 @@ + + + + + 搜索更多好课 + + + + + + + 考公考研 + + + + 自媒体 + + + + 财经 + + + 热门课程 + + + + + + 区块链和加密数字货币(随报随学认证班) + + 券后99元起 + 18523人学习 + + + + + \ No newline at end of file diff --git a/pages/course/homepage/homepage.wxss b/pages/course/homepage/homepage.wxss new file mode 100644 index 0000000..8bdec29 --- /dev/null +++ b/pages/course/homepage/homepage.wxss @@ -0,0 +1,137 @@ +.ml-3 { + margin-left: 5.63rpx; +} +.mt-17 { + margin-top: 31.88rpx; +} +.page { + padding: 0rpx 0 10.88rpx; + background-color: #ffffff; + width: 100%; + overflow-y: auto; + overflow-x: hidden; + height: 100%; +} +.group { + padding-left: 30rpx; + padding-right: 28.13rpx; +} +.section { + padding: 11.25rpx 0; + background-color: #f2f2f2; + border-radius: 93.75rpx; +} +.image { + width: 35.63rpx; + height: 35.63rpx; +} +.text { + color: #a8a8a8; + font-size: 22.5rpx; + font-family: SourceHanSerifCN; + line-height: 20.83rpx; +} +.equal-division { + align-self: stretch; + margin: 21.88rpx 31.46rpx 0 29.48rpx; +} +.group_2 { + flex: 1 1 229.69rpx; +} +.group_1 { + padding: 13.56rpx 0 9.99rpx; +} +.image_3 { + width: 96rpx; + height: 96rpx; +} +.font { + font-size: 26.25rpx; + font-family: SourceHanSansCN; + line-height: 24.15rpx; + color: #000000; +} +.text_1 { + line-height: 24.26rpx; +} +.group_3 { + padding: 13.56rpx 0 10.09rpx; +} +.text_3 { + line-height: 24.23rpx; +} +.group_4 { + padding: 13.56rpx 0 10.13rpx; +} +.text_4 { + line-height: 24.13rpx; +} +.text_2 { + margin-left: 35.04rpx; + margin-top: 38.16rpx; + color: #000000; + font-size: 30rpx; + font-family: SourceHanSansCN; + line-height: 27.75rpx; +} +.list { + margin-top: 9.56rpx; +} +.group_5 { + padding: 18.75rpx 29.46rpx 0 35.63rpx; + height: 180rpx; +} +.list-divider { + background-color: #d6d6d6; + height: 1.88rpx; +} +.pos_3 { + position: absolute; + left: 35.63rpx; + right: 33.81rpx; + top: 178.13rpx; +} +.image_4 { + border-radius: 9.38rpx; + width: 208.13rpx; + height: 133.13rpx; +} +.pos { + position: absolute; + left: 35.63rpx; + top: 50%; + transform: translateY(-50%); +} +.group_6 { + width: 453.49rpx; +} +.pos_2 { + position: absolute; + right: 29.46rpx; + top: 50%; + transform: translateY(-50%); +} +.font_2 { + font-size: 26.25rpx; + font-family: SourceHanSansCN; + line-height: 31.88rpx; + color: #000000; +} +.font_3 { + font-size: 26.25rpx; + font-family: AlibabaPuHuiTi; + line-height: 24.15rpx; + color: #ff5733; +} +.font_4 { + font-size: 22.5rpx; + font-family: AlibabaPuHuiTi; + line-height: 20.34rpx; + color: #a6a6a6; +} +.swiper { + border-radius: 9.38rpx; + width: 691.88rpx; + height: 324.38rpx; + margin-top: 22.5rpx; +} \ No newline at end of file diff --git a/pages/course/homepage/image/cj.png b/pages/course/homepage/image/cj.png new file mode 100644 index 0000000..3047ad3 Binary files /dev/null and b/pages/course/homepage/image/cj.png differ diff --git a/pages/course/homepage/image/kgky.png b/pages/course/homepage/image/kgky.png new file mode 100644 index 0000000..f0b7253 Binary files /dev/null and b/pages/course/homepage/image/kgky.png differ diff --git a/pages/course/homepage/image/sousuo.png b/pages/course/homepage/image/sousuo.png new file mode 100644 index 0000000..d58893a Binary files /dev/null and b/pages/course/homepage/image/sousuo.png differ diff --git a/pages/course/homepage/image/zmt.png b/pages/course/homepage/image/zmt.png new file mode 100644 index 0000000..382810f Binary files /dev/null and b/pages/course/homepage/image/zmt.png differ diff --git a/pages/course/searchCourses/images/sousuo.png b/pages/course/searchCourses/images/sousuo.png new file mode 100644 index 0000000..d58893a Binary files /dev/null and b/pages/course/searchCourses/images/sousuo.png differ diff --git a/pages/course/searchCourses/searchCourses.js b/pages/course/searchCourses/searchCourses.js new file mode 100644 index 0000000..d17ad36 --- /dev/null +++ b/pages/course/searchCourses/searchCourses.js @@ -0,0 +1,66 @@ +// pages/course/searchCourses/searchCourses.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/course/searchCourses/searchCourses.json b/pages/course/searchCourses/searchCourses.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/course/searchCourses/searchCourses.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/course/searchCourses/searchCourses.wxml b/pages/course/searchCourses/searchCourses.wxml new file mode 100644 index 0000000..1623166 --- /dev/null +++ b/pages/course/searchCourses/searchCourses.wxml @@ -0,0 +1,26 @@ + + + + + + + + + + + + 区块链和加密数字货币(随报随学认证班) + + 券后99元起 + 18523人学习 + + + + + \ No newline at end of file diff --git a/pages/course/searchCourses/searchCourses.wxss b/pages/course/searchCourses/searchCourses.wxss new file mode 100644 index 0000000..123018e --- /dev/null +++ b/pages/course/searchCourses/searchCourses.wxss @@ -0,0 +1,89 @@ +/* pages/course/searchCourses/searchCourses.wxss */ + +.ml-3 { + margin-left: 5.63rpx; +} +.mt-17 { + margin-top: 31.88rpx; +} +.page { + padding: 26.25rpx 0 918.73rpx; + background-color: #ffffff; + width: 100%; + overflow-y: auto; + overflow-x: hidden; + height: 100%; +} +.section { + margin-left: 28.13rpx; + margin-right: 26.27rpx; + padding: 11.25rpx 24.38rpx; + background-color: #f2f2f2; + border-radius: 93.75rpx; +} +.image { + width: 35.63rpx; + height: 35.63rpx; +} +.text { + color: #a8a8a8; + font-size: 22.5rpx; + font-family: SourceHanSerifCN; + line-height: 20.83rpx; +} +.list { + padding-top: 11.25rpx; + border-top: solid 1.88rpx #d1d1d1; +} +.list-item { + padding: 28.13rpx 29.46rpx 0 35.63rpx; + height: 189.39rpx; +} +.list-divider { + background-color: #d6d6d6; + height: 1.88rpx; +} +.pos_3 { + position: absolute; + left: 35.63rpx; + right: 33.81rpx; + top: 187.52rpx; +} +.image_2 { + border-radius: 9.38rpx; + width: 208.13rpx; + height: 133.13rpx; +} +.pos { + position: absolute; + left: 35.63rpx; + top: 50%; + transform: translateY(-50%); +} +.group_2 { + width: 453.49rpx; +} +.pos_2 { + position: absolute; + right: 29.46rpx; + top: 50%; + transform: translateY(-50%); +} +.font { + font-size: 26.25rpx; + font-family: SourceHanSansCN; + line-height: 31.88rpx; + color: #000000; +} +.font_2 { + font-size: 26.25rpx; + font-family: AlibabaPuHuiTi; + line-height: 24.15rpx; + color: #ff5733; +} +.font_3 { + font-size: 22.5rpx; + font-family: AlibabaPuHuiTi; + line-height: 20.34rpx; + color: #a6a6a6; +} \ No newline at end of file diff --git a/pages/personCenter/bindBankCard/bindBankCard.js b/pages/personCenter/bindBankCard/bindBankCard.js index f5f62f1..f84e961 100644 --- a/pages/personCenter/bindBankCard/bindBankCard.js +++ b/pages/personCenter/bindBankCard/bindBankCard.js @@ -217,8 +217,11 @@ Page({ icon: 'success', }); // 这里可以跳转到其他页面 - wx.navigateTo({ - url: '/pages/personCenter/withdrawal/withdrawal', + let pages = getCurrentPages(); // 获取小程序页面栈 + let beforePage = pages[pages.length - 2]; // 获取上个页面的实例对象 + beforePage.getAccountInfo(); + wx.navigateBack({ + delta:1 }); }, fail(err) { @@ -251,7 +254,9 @@ Page({ /** * 生命周期函数--监听页面显示 */ - onShow() {}, + onShow() { + this.getAccountInfo() + }, /** * 生命周期函数--监听页面隐藏 diff --git a/pages/personCenter/bindBankCard/bindBankCard.wxml b/pages/personCenter/bindBankCard/bindBankCard.wxml index 5bdc39d..bb16150 100644 --- a/pages/personCenter/bindBankCard/bindBankCard.wxml +++ b/pages/personCenter/bindBankCard/bindBankCard.wxml @@ -30,6 +30,7 @@ placeholder="请输入持卡人身份证号" data-field="idCardNumber" bindinput="handleInputChange" + type="idcard" value="{{ idCardNumber }}" /> diff --git a/pages/personCenter/resetPwd/resetPwd.js b/pages/personCenter/resetPwd/resetPwd.js index a14f723..11072a8 100644 --- a/pages/personCenter/resetPwd/resetPwd.js +++ b/pages/personCenter/resetPwd/resetPwd.js @@ -18,7 +18,9 @@ Page({ resetPwd() { const { phone, verificationCode, password, currentPwd } = this.data; - formatPassword(password,currentPwd); + if( !formatPassword(password,currentPwd) ) { + return; + } wx.request({ url: baseUrl + '/userInfo/mini/in/reset/pwd', method: 'POST', diff --git a/pages/personCenter/withdrawalAccount/withdrawalAccount.js b/pages/personCenter/withdrawalAccount/withdrawalAccount.js index fb8c05a..68d0013 100644 --- a/pages/personCenter/withdrawalAccount/withdrawalAccount.js +++ b/pages/personCenter/withdrawalAccount/withdrawalAccount.js @@ -74,7 +74,6 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - this.getAccountInfo() }, /** diff --git a/pages/projectModule/applyCode/applyCode.js b/pages/projectModule/applyCode/applyCode.js index 5684f69..986542e 100644 --- a/pages/projectModule/applyCode/applyCode.js +++ b/pages/projectModule/applyCode/applyCode.js @@ -1,4 +1,5 @@ const { baseUrl } = require('../../../request'); +import { decodeBase64 } from '../../../utils/decodebase64' Page({ data: { @@ -12,7 +13,7 @@ Page({ onLoad(options) { this.setData({ projectId: options.id || '', - promoCodeDesc: decodeURIComponent(options.desc || ''), + promoCodeDesc: decodeBase64(options.desc), mode: options.mode || 'add', salespersonName: options.name ? decodeURIComponent(options.name) : '', salespersonPhone: options.phone ? decodeURIComponent(options.phone) : '' @@ -34,6 +35,7 @@ Page({ // 申请资料报备 onApply() { + console.log('---->',this.data.promoCodeDesc); // 如果是查看模式,阻止提交 if (this.data.mode === 'view') return; diff --git a/pages/projectModule/projectDetail/projectDetail.js b/pages/projectModule/projectDetail/projectDetail.js index 312ff02..4ce87ce 100644 --- a/pages/projectModule/projectDetail/projectDetail.js +++ b/pages/projectModule/projectDetail/projectDetail.js @@ -1,5 +1,6 @@ const { baseUrl } = require('../../../request'); import { globalImgUrl } from '../../../request'; +import { decodeBase64 } from '../../../utils/decodebase64' Page({ data: { @@ -55,10 +56,10 @@ Page({ notificationList: detail.projectNotificationVOList || [], settlementDetailList: detail.projectAllDetailVOList || [], promoCodeList: detail.promoCodeApplyVOList || [], - settlementDesc: this.decode64(detail.settlementDesc), - projectDesc: this.decode64(detail.projectDesc), - projectFlow: this.decode64(detail.projectFlow), - projectDescription: this.decode64(detail.projectDescription) + settlementDesc: decodeBase64(detail.settlementDesc), + projectDesc: decodeBase64(detail.projectDesc), + projectFlow: decodeBase64(detail.projectFlow), + projectDescription: decodeBase64(detail.projectDescription) }); } else { wx.showToast({ @@ -76,13 +77,6 @@ Page({ }); }, - // base64转为字符串 - decode64(text) { - var decoder = new TextDecoder(); - return new TextDecoder().decode(Uint8Array.from(atob(text), (c) => c.charCodeAt(0))); - // return decodeURIComponent(escape(String.fromCharCode(...[text]))); - }, - switchTab(e) { const idx = +e.currentTarget.dataset.index; this.setData({ activeTab: idx }); diff --git a/utils/decodebase64.js b/utils/decodebase64.js new file mode 100644 index 0000000..00a70ae --- /dev/null +++ b/utils/decodebase64.js @@ -0,0 +1,58 @@ +function decodeBase64(base64Str) { + try { + // 第一步:先 URL 解码(解决 %2B、%3D 等问题) + const urlDecoded = decodeURIComponent(base64Str); + + // 第二步:处理 Base64 字符(替换 URL 安全字符) + let safeBase64 = urlDecoded + .replace(/-/g, "+") + .replace(/_/g, "/") + .replace(/\s/g, ""); + + // 补全等号 + const pad = safeBase64.length % 4; + safeBase64 = safeBase64.padEnd( + safeBase64.length + (pad ? 4 - pad : 0), + "=" + ); + + // 第三步:使用微信小程序提供的 base64 解码函数 + const arrayBuffer = wx.base64ToArrayBuffer(safeBase64); + const bytes = new Uint8Array(arrayBuffer); + + // 第四步:手动 UTF-8 解码 + let utf8Str = ""; + let i = 0; + while (i < bytes.length) { + const byte = bytes[i]; + if (byte < 0x80) { + utf8Str += String.fromCharCode(byte); + i++; + } else if (byte < 0xe0) { + utf8Str += String.fromCharCode( + ((byte & 0x1f) << 6) | (bytes[i + 1] & 0x3f) + ); + i += 2; + } else if (byte < 0xf0) { + utf8Str += String.fromCharCode( + ((byte & 0x0f) << 12) | + ((bytes[i + 1] & 0x3f) << 6) | + (bytes[i + 2] & 0x3f) + ); + i += 3; + } else { + // 四字节字符跳过 + i += 4; + } + } + + return utf8Str; + } catch (e) { + console.error("Base64解码失败:", e); + return "

内容解析错误

"; + } +} + +module.exports = { + decodeBase64 +}; diff --git a/utils/util.js b/utils/util.js index 65c55d3..dc98657 100644 --- a/utils/util.js +++ b/utils/util.js @@ -20,29 +20,40 @@ const formatPassword = (pwd , currentPwd) => { title: '密码不能为空', icon: 'error' }) - return; + return false; } - if (pwd.length < 6) { + if (pwd.length < 6 || pwd.length > 10) { wx.showToast({ - title: '密码不能小于6位', + title: '密码长度必须在6-10位', icon: 'error' }) - return; + return false; } if (currentPwd === '') { wx.showToast({ title: '请输入二次确认密码', icon: 'error' }) - return; + return false; } if (currentPwd !== pwd) { wx.showToast({ title: '两次密码不一致', icon: 'error' }) - return; + return false; } + // 纪文昊写的 密码必须包含字母和数字 + const hasLetter = /[a-zA-z]/.test(pwd); + const hasNumber = /[0-9]/.test(pwd); + if (!hasLetter || !hasNumber) { + wx.showToast({ + title: '密码必须包含字母和数字', + icon: 'none' + }) + return false; + } + return true; } module.exports = {