| @@ -3,6 +3,13 @@ import { timestampToTime } from './utils/util' | |||||
| App({ | App({ | ||||
| globalData: { | globalData: { | ||||
| sessionKey: "", | |||||
| openId: "", | |||||
| token: "", | |||||
| userInfo: null, | |||||
| promotContentCount: "", | |||||
| completionContentCount: "", | |||||
| noticeText: "" | |||||
| }, | }, | ||||
| onLaunch() { | onLaunch() { | ||||
| const that = this | const that = this | ||||
| @@ -38,9 +45,8 @@ App({ | |||||
| that.globalData.openId = res.data.openId | that.globalData.openId = res.data.openId | ||||
| wx.setStorageSync('token', res.data.token) | wx.setStorageSync('token', res.data.token) | ||||
| that.globalData.token = res.data.token | that.globalData.token = res.data.token | ||||
| // 检查用户信息 | |||||
| checkUserInfo() | |||||
| // 获取通知栏信息文本 | |||||
| getNoticeText() | |||||
| }).catch(err => { | }).catch(err => { | ||||
| console.log(err); | console.log(err); | ||||
| wx.showToast({ | wx.showToast({ | ||||
| @@ -80,5 +86,27 @@ App({ | |||||
| console.log(err, 'err'); | 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'); | |||||
| }) | |||||
| } | |||||
| }, | }, | ||||
| }) | }) | ||||
| @@ -7,7 +7,8 @@ | |||||
| "pages/chat/chat", | "pages/chat/chat", | ||||
| "pages/orderDetail/orderDetail", | "pages/orderDetail/orderDetail", | ||||
| "pages/userProtocol/userProtocol", | "pages/userProtocol/userProtocol", | ||||
| "pages/mine/mine" | |||||
| "pages/mine/mine", | |||||
| "pages/productDetail/productDetail" | |||||
| ], | ], | ||||
| "window": { | "window": { | ||||
| "backgroundTextStyle": "light", | "backgroundTextStyle": "light", | ||||
| @@ -18,6 +19,7 @@ | |||||
| "style": "v2", | "style": "v2", | ||||
| "sitemapLocation": "sitemap.json", | "sitemapLocation": "sitemap.json", | ||||
| "usingComponents": { | "usingComponents": { | ||||
| "van-notice-bar": "@vant/weapp/notice-bar/index", | |||||
| "van-toast": "@vant/weapp/toast/index" | "van-toast": "@vant/weapp/toast/index" | ||||
| } | } | ||||
| } | } | ||||
| @@ -21,7 +21,8 @@ Page({ | |||||
| clearTimer: null, | clearTimer: null, | ||||
| interval: null, | interval: null, | ||||
| promotContentCount: 0, | promotContentCount: 0, | ||||
| completionContentCount: 0 | |||||
| completionContentCount: 0, | |||||
| noticeText: '' | |||||
| }, | }, | ||||
| /** | /** | ||||
| @@ -32,7 +33,8 @@ Page({ | |||||
| this.chatLimit() | this.chatLimit() | ||||
| this.setData({ | this.setData({ | ||||
| promotContentCount: wx.getStorageSync('promotContentCount'), | 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() { | chatLimit() { | ||||
| request.get({ | request.get({ | ||||
| @@ -1,4 +1,7 @@ | |||||
| <!--pages/chat/chat.wxml--> | <!--pages/chat/chat.wxml--> | ||||
| <block wx:if="{{noticeText}}" class="noticeBar"> | |||||
| <van-notice-bar color="#ffffff" background="#4ac987" left-icon="volume-o" text="{{noticeText}}" bindtap="goToProductDetail" /> | |||||
| </block> | |||||
| <view class="content" id='scrollSingel' bindtap="contentWatch"> | <view class="content" id='scrollSingel' bindtap="contentWatch"> | ||||
| <view class="chatItem" wx:for="{{chatList}}" wx:key="index"> | <view class="chatItem" wx:for="{{chatList}}" wx:key="index"> | ||||
| <view class="{{item.id == 1 ? 'chatContent right' : 'chatContent left'}}"> | <view class="{{item.id == 1 ? 'chatContent right' : 'chatContent left'}}"> | ||||
| @@ -15,7 +15,8 @@ Page({ | |||||
| logoActive: false, | logoActive: false, | ||||
| timer: null, | timer: null, | ||||
| touchFlag: "", | touchFlag: "", | ||||
| isNotRead: true | |||||
| isNotRead: true, | |||||
| noticeText: '' | |||||
| }, | }, | ||||
| // 事件处理函数 | // 事件处理函数 | ||||
| bindViewTap() { | bindViewTap() { | ||||
| @@ -34,7 +35,11 @@ Page({ | |||||
| userInfo: res.data, | userInfo: res.data, | ||||
| isPhone: that.data.userInfo.phone ? true : false | isPhone: that.data.userInfo.phone ? true : false | ||||
| }) | }) | ||||
| this.getNoticeText() | |||||
| if (app.globalData.noticeText) { | |||||
| that.setData({ | |||||
| noticeText: app.globalData.noticeText | |||||
| }) | |||||
| } | |||||
| } | } | ||||
| }, | }, | ||||
| getUserProfile() { | getUserProfile() { | ||||
| @@ -60,6 +65,13 @@ Page({ | |||||
| }) | }) | ||||
| }, | }, | ||||
| // 跳转至产品详情页面 | |||||
| goToProductDetail() { | |||||
| wx.navigateTo({ | |||||
| url: '/pages/productDetail/productDetail', | |||||
| }) | |||||
| }, | |||||
| // 跳转至购买历史页面 | // 跳转至购买历史页面 | ||||
| checkPayHistory() { | checkPayHistory() { | ||||
| wx.navigateTo({ | wx.navigateTo({ | ||||
| @@ -67,13 +79,11 @@ Page({ | |||||
| }) | }) | ||||
| }, | }, | ||||
| getUserPhone(e) { | getUserPhone(e) { | ||||
| const sessionKey = wx.getStorageSync('sessionKey') | const sessionKey = wx.getStorageSync('sessionKey') | ||||
| this.doGetUserPhone(e.detail.encryptedData, e.detail.iv, sessionKey, request.appId) | this.doGetUserPhone(e.detail.encryptedData, e.detail.iv, sessionKey, request.appId) | ||||
| }, | }, | ||||
| /** 获取手机号授权 */ | /** 获取手机号授权 */ | ||||
| doGetUserPhone(encryptedData, iv, sessionKey, appId) { | doGetUserPhone(encryptedData, iv, sessionKey, appId) { | ||||
| request.post({ | request.post({ | ||||
| @@ -172,7 +182,8 @@ Page({ | |||||
| checkCheatCodeStatus() { | checkCheatCodeStatus() { | ||||
| if (this.data.logoActive) { | if (this.data.logoActive) { | ||||
| this.setData({ | 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() { | onShareAppMessage() { | ||||
| const promise = new Promise(resolve => { | const promise = new Promise(resolve => { | ||||
| setTimeout(() => { | setTimeout(() => { | ||||
| @@ -1,6 +1,4 @@ | |||||
| { | { | ||||
| "navigationBarTitleText": "首页", | "navigationBarTitleText": "首页", | ||||
| "usingComponents": { | |||||
| "van-notice-bar": "@vant/weapp/notice-bar/index" | |||||
| } | |||||
| "usingComponents": {} | |||||
| } | } | ||||
| @@ -2,6 +2,7 @@ | |||||
| padding: 0 0 25rpx 0; | padding: 0 0 25rpx 0; | ||||
| .logo { | .logo { | ||||
| position: relative; | |||||
| width: 500rpx; | width: 500rpx; | ||||
| height: 120rpx; | height: 120rpx; | ||||
| line-height: 120rpx; | line-height: 120rpx; | ||||
| @@ -16,12 +17,28 @@ | |||||
| &.active { | &.active { | ||||
| color: aqua; | 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 { | .introduction { | ||||
| position: relative; | position: relative; | ||||
| width: 600rpx; | width: 600rpx; | ||||
| height: 850rpx; | |||||
| margin: 50rpx auto; | margin: 50rpx auto; | ||||
| padding: 0 20rpx; | padding: 0 20rpx; | ||||
| border: 1px dashed #747474; | border: 1px dashed #747474; | ||||
| @@ -37,7 +54,6 @@ | |||||
| .contain { | .contain { | ||||
| width: 500rpx; | width: 500rpx; | ||||
| height: 520rpx; | |||||
| font-size: 30rpx; | font-size: 30rpx; | ||||
| color: #585858; | color: #585858; | ||||
| text-indent: 1cm; | 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 { | .buttons { | ||||
| font-size: 25rpx; | font-size: 25rpx; | ||||
| margin-top: 150rpx; | |||||
| .userProtocolModel { | .userProtocolModel { | ||||
| text-align: center; | text-align: center; | ||||
| @@ -1,11 +1,14 @@ | |||||
| <!--index.wxml--> | <!--index.wxml--> | ||||
| <view class="content"> | <view class="content"> | ||||
| <block wx:if="{{noticeText}}"> | |||||
| <van-notice-bar color="#ffffff" background="#4ac987" mode="closeable" left-icon="volume-o" text="{{noticeText}}" /> | |||||
| <block wx:if="{{noticeText}}" class="noticeBar"> | |||||
| <van-notice-bar color="#ffffff" background="#4ac987" left-icon="volume-o" text="{{noticeText}}" bindtap="goToProductDetail" /> | |||||
| </block> | </block> | ||||
| <view class="{{logoActive ? 'logo active' : 'logo' }}" bindtap="checkCheatCodeStatus"> | |||||
| 𝑺𝒎𝒂𝒓𝒕-𝑪𝒉𝒂𝒕 | |||||
| <view class="{{logoActive ? 'logo active' : 'logo' }}"> | |||||
| <view class="{{holdingSwitch ? 'tinyChatICon active' : 'tinyChatICon' }}" bindtouchstart="iconTouchStart" bindtouchend="iconTouchEnd"> | |||||
| <image src="../../asset/icon/tiny-Chat-rotate.png" mode="widthFix" /> | |||||
| </view> | |||||
| <text bindtap="checkCheatCodeStatus">𝑺𝒎𝒂𝒓𝒕-𝑪𝒉𝒂𝒕</text> | |||||
| </view> | </view> | ||||
| <view class="introduction"> | <view class="introduction"> | ||||
| <view class="title">欢迎使用小闲聊</view> | <view class="title">欢迎使用小闲聊</view> | ||||
| @@ -21,10 +24,6 @@ | |||||
| <view class="switch bottomRight" data-flag="bottomRight" bindtap="checkCheatCode"></view> | <view class="switch bottomRight" data-flag="bottomRight" bindtap="checkCheatCode"></view> | ||||
| </view> | </view> | ||||
| <view class="{{holdingSwitch ? 'tinyChatICon active' : 'tinyChatICon' }}" bindtouchstart="iconTouchStart" bindtouchend="iconTouchEnd"> | |||||
| <image src="../../asset/icon/tiny-Chat.png" mode="widthFix" /> | |||||
| </view> | |||||
| <view class="buttons"> | <view class="buttons"> | ||||
| <block wx:if="{{!isDevMode}}"> | <block wx:if="{{!isDevMode}}"> | ||||
| <block wx:if="{{userInfo.isMember == 0 && userInfo.isValid == 0}}"> | <block wx:if="{{userInfo.isMember == 0 && userInfo.isValid == 0}}"> | ||||
| @@ -52,7 +51,7 @@ | |||||
| <view wx:if="{{userInfo.coverPhone}}" class="userPhone">当前用户:{{userInfo.coverPhone}}</view> | <view wx:if="{{userInfo.coverPhone}}" class="userPhone">当前用户:{{userInfo.coverPhone}}</view> | ||||
| <view class="userPhone" wx:if="{{userInfo.validEndTime}}">到期时间:{{userInfo.validEndTime}}</view> | <view class="userPhone" wx:if="{{userInfo.validEndTime}}">到期时间:{{userInfo.validEndTime}}</view> | ||||
| <view class="payHistory"> | <view class="payHistory"> | ||||
| <text bindtap="checkUserProtocol">用户协议</text> | |||||
| <text bindtap="checkUserProtocol" style="margin-right: 20rpx;">用户协议</text> | |||||
| <text bindtap="checkPayHistory">延续历史</text> | <text bindtap="checkPayHistory">延续历史</text> | ||||
| </view> | </view> | ||||
| <button type="primary" bindtap="goToBuy">延续使用</button> | <button type="primary" bindtap="goToBuy">延续使用</button> | ||||
| @@ -0,0 +1,66 @@ | |||||
| // pages/productDetail/productDetail.ts | |||||
| Page({ | |||||
| /** | |||||
| * 页面的初始数据 | |||||
| */ | |||||
| data: { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面加载 | |||||
| */ | |||||
| onLoad() { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面初次渲染完成 | |||||
| */ | |||||
| onReady() { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面显示 | |||||
| */ | |||||
| onShow() { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面隐藏 | |||||
| */ | |||||
| onHide() { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面卸载 | |||||
| */ | |||||
| onUnload() { | |||||
| }, | |||||
| /** | |||||
| * 页面相关事件处理函数--监听用户下拉动作 | |||||
| */ | |||||
| onPullDownRefresh() { | |||||
| }, | |||||
| /** | |||||
| * 页面上拉触底事件的处理函数 | |||||
| */ | |||||
| onReachBottom() { | |||||
| }, | |||||
| /** | |||||
| * 用户点击右上角分享 | |||||
| */ | |||||
| onShareAppMessage() { | |||||
| } | |||||
| }) | |||||
| @@ -0,0 +1,4 @@ | |||||
| { | |||||
| "navigationBarTitleText": "关于我们", | |||||
| "usingComponents": {} | |||||
| } | |||||
| @@ -0,0 +1 @@ | |||||
| /* pages/productDetail/productDetail.wxss */ | |||||
| @@ -0,0 +1,2 @@ | |||||
| <!--pages/productDetail/productDetail.wxml--> | |||||
| <text>关于我们</text> | |||||
| @@ -36,7 +36,7 @@ | |||||
| "miniprogram/pages/orderDetail/orderDetail.js", | "miniprogram/pages/orderDetail/orderDetail.js", | ||||
| "miniprogram/pages/userProtocol/userProtocol.js", | "miniprogram/pages/userProtocol/userProtocol.js", | ||||
| "miniprogram/pages/mine/mine.js", | "miniprogram/pages/mine/mine.js", | ||||
| "miniprogram/components/userNumberChkeck/userNumberChkeck.js", | |||||
| "miniprogram/components/userNumberChkeck/userNumberChkeck.js", "miniprogram/pages/productDetail/productDetail.js", | |||||
| ], | ], | ||||
| "exclude": [ | "exclude": [ | ||||
| "node_modules" | "node_modules" | ||||