From 42f328b1f6c55299989eb722ad2bc20e4ef5772c Mon Sep 17 00:00:00 2001 From: XiaoXinPro 14 IAH5R <568170040@qq.com> Date: Wed, 10 May 2023 17:12:33 +0800 Subject: [PATCH] upload --- miniprogram/app.js | 34 +++++++++- miniprogram/app.json | 4 +- miniprogram/pages/chat/chat.js | 12 +++- miniprogram/pages/chat/chat.wxml | 3 + miniprogram/pages/index/index.js | 39 +++++------ miniprogram/pages/index/index.json | 4 +- miniprogram/pages/index/index.less | 39 +++++------ miniprogram/pages/index/index.wxml | 17 +++-- .../pages/productDetail/productDetail.js | 66 +++++++++++++++++++ .../pages/productDetail/productDetail.json | 4 ++ .../pages/productDetail/productDetail.less | 1 + .../pages/productDetail/productDetail.wxml | 2 + tsconfig.json | 2 +- 13 files changed, 164 insertions(+), 63 deletions(-) create mode 100644 miniprogram/pages/productDetail/productDetail.js create mode 100644 miniprogram/pages/productDetail/productDetail.json create mode 100644 miniprogram/pages/productDetail/productDetail.less create mode 100644 miniprogram/pages/productDetail/productDetail.wxml diff --git a/miniprogram/app.js b/miniprogram/app.js index 122a849..6a254a6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -3,6 +3,13 @@ import { timestampToTime } from './utils/util' App({ globalData: { + sessionKey: "", + openId: "", + token: "", + userInfo: null, + promotContentCount: "", + completionContentCount: "", + noticeText: "" }, onLaunch() { const that = this @@ -38,9 +45,8 @@ App({ that.globalData.openId = res.data.openId wx.setStorageSync('token', res.data.token) that.globalData.token = res.data.token - - // 检查用户信息 - checkUserInfo() + // 获取通知栏信息文本 + getNoticeText() }).catch(err => { console.log(err); wx.showToast({ @@ -80,5 +86,27 @@ App({ console.log(err, 'err'); }) } + + /** + * @description 获取通知栏信息文本 + * @returns list + */ + const getNoticeText = () => { + const that = this + request.get({ + url: '/api/notice/list' + }).then(res => { + console.log(res, 'getNoticeText'); + let noticeText = '' + res.data.forEach((item, index) => { + noticeText += index + 1 + '、' + item.content + ' ' + }) + that.globalData.noticeText = noticeText + // 检查用户信息 + checkUserInfo() + }).catch(err => { + console.log(err, 'err'); + }) + } }, }) \ No newline at end of file diff --git a/miniprogram/app.json b/miniprogram/app.json index 1665b15..cec93e6 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -7,7 +7,8 @@ "pages/chat/chat", "pages/orderDetail/orderDetail", "pages/userProtocol/userProtocol", - "pages/mine/mine" + "pages/mine/mine", + "pages/productDetail/productDetail" ], "window": { "backgroundTextStyle": "light", @@ -18,6 +19,7 @@ "style": "v2", "sitemapLocation": "sitemap.json", "usingComponents": { + "van-notice-bar": "@vant/weapp/notice-bar/index", "van-toast": "@vant/weapp/toast/index" } } \ No newline at end of file diff --git a/miniprogram/pages/chat/chat.js b/miniprogram/pages/chat/chat.js index a5b46e8..3ec3fd0 100644 --- a/miniprogram/pages/chat/chat.js +++ b/miniprogram/pages/chat/chat.js @@ -21,7 +21,8 @@ Page({ clearTimer: null, interval: null, promotContentCount: 0, - completionContentCount: 0 + completionContentCount: 0, + noticeText: '' }, /** @@ -32,7 +33,8 @@ Page({ this.chatLimit() this.setData({ promotContentCount: wx.getStorageSync('promotContentCount'), - completionContentCount: wx.getStorageSync('completionContentCount') + completionContentCount: wx.getStorageSync('completionContentCount'), + noticeText: app.globalData.noticeText ? app.globalData.noticeText : '' }) }, @@ -67,6 +69,12 @@ Page({ }) }, + // 跳转至产品详情页面 + goToProductDetail() { + wx.navigateTo({ + url: '/pages/productDetail/productDetail', + }) + }, chatLimit() { request.get({ diff --git a/miniprogram/pages/chat/chat.wxml b/miniprogram/pages/chat/chat.wxml index bf2f992..87e34c2 100644 --- a/miniprogram/pages/chat/chat.wxml +++ b/miniprogram/pages/chat/chat.wxml @@ -1,4 +1,7 @@ + + + diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js index 0d6eca5..eae847a 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -15,7 +15,8 @@ Page({ logoActive: false, timer: null, touchFlag: "", - isNotRead: true + isNotRead: true, + noticeText: '' }, // 事件处理函数 bindViewTap() { @@ -34,7 +35,11 @@ Page({ userInfo: res.data, isPhone: that.data.userInfo.phone ? true : false }) - this.getNoticeText() + if (app.globalData.noticeText) { + that.setData({ + noticeText: app.globalData.noticeText + }) + } } }, getUserProfile() { @@ -60,6 +65,13 @@ Page({ }) }, + // 跳转至产品详情页面 + goToProductDetail() { + wx.navigateTo({ + url: '/pages/productDetail/productDetail', + }) + }, + // 跳转至购买历史页面 checkPayHistory() { wx.navigateTo({ @@ -67,13 +79,11 @@ Page({ }) }, - getUserPhone(e) { const sessionKey = wx.getStorageSync('sessionKey') this.doGetUserPhone(e.detail.encryptedData, e.detail.iv, sessionKey, request.appId) }, - /** 获取手机号授权 */ doGetUserPhone(encryptedData, iv, sessionKey, appId) { request.post({ @@ -172,7 +182,8 @@ Page({ checkCheatCodeStatus() { if (this.data.logoActive) { this.setData({ - isDevMode: true + isDevMode: true, + noticeText: '𝙒𝙚𝙡𝙘𝙤𝙢𝙚 𝘿𝙚𝙫𝙚𝙡𝙤𝙥𝙚𝙧 𝙔𝙒𝙌 !' }) } }, @@ -215,24 +226,6 @@ Page({ }) }, - /** - * @description 获取通知栏信息文本 - * @returns list - */ - getNoticeText() { - const that = this - request.get({ - url: '/api/notice/list' - }).then(res => { - console.log(res, 'getNoticeText'); - that.setData({ - noticeText: '"小闲聊"是一款基于人工智能技术开发的智能聊天机器人应用' - }) - }).catch(err => { - console.log(err, 'err'); - }) - }, - onShareAppMessage() { const promise = new Promise(resolve => { setTimeout(() => { diff --git a/miniprogram/pages/index/index.json b/miniprogram/pages/index/index.json index 8c57617..a860429 100644 --- a/miniprogram/pages/index/index.json +++ b/miniprogram/pages/index/index.json @@ -1,6 +1,4 @@ { "navigationBarTitleText": "首页", - "usingComponents": { - "van-notice-bar": "@vant/weapp/notice-bar/index" - } + "usingComponents": {} } \ No newline at end of file diff --git a/miniprogram/pages/index/index.less b/miniprogram/pages/index/index.less index 82cc8a0..e286794 100644 --- a/miniprogram/pages/index/index.less +++ b/miniprogram/pages/index/index.less @@ -2,6 +2,7 @@ padding: 0 0 25rpx 0; .logo { + position: relative; width: 500rpx; height: 120rpx; line-height: 120rpx; @@ -16,12 +17,28 @@ &.active { color: aqua; } + + .tinyChatICon { + position: absolute; + top: 15rpx; + left: 20rpx; + width: 60rpx; + text-align: center; + transition: all 0.3s; + + &.active { + transform: scale(1.05); + } + + image { + width: 100%; + } + } } .introduction { position: relative; width: 600rpx; - height: 850rpx; margin: 50rpx auto; padding: 0 20rpx; border: 1px dashed #747474; @@ -37,7 +54,6 @@ .contain { width: 500rpx; - height: 520rpx; font-size: 30rpx; color: #585858; text-indent: 1cm; @@ -88,27 +104,8 @@ } - .tinyChatICon { - position: relative; - top: -85rpx; - text-align: center; - transition: all 0.3s; - - &.active { - transform: scale(1.05); - } - - image { - position: absolute; - left: 50%; - transform: translate(-50%, 50%); - width: 100rpx; - } - } - .buttons { font-size: 25rpx; - margin-top: 150rpx; .userProtocolModel { text-align: center; diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml index 4e0089d..c4a424a 100644 --- a/miniprogram/pages/index/index.wxml +++ b/miniprogram/pages/index/index.wxml @@ -1,11 +1,14 @@ - - + + -