Browse Source

upload

master
HolyKnightIX 2 years ago
parent
commit
42f328b1f6
13 changed files with 164 additions and 63 deletions
  1. +31
    -3
      miniprogram/app.js
  2. +3
    -1
      miniprogram/app.json
  3. +10
    -2
      miniprogram/pages/chat/chat.js
  4. +3
    -0
      miniprogram/pages/chat/chat.wxml
  5. +16
    -23
      miniprogram/pages/index/index.js
  6. +1
    -3
      miniprogram/pages/index/index.json
  7. +18
    -21
      miniprogram/pages/index/index.less
  8. +8
    -9
      miniprogram/pages/index/index.wxml
  9. +66
    -0
      miniprogram/pages/productDetail/productDetail.js
  10. +4
    -0
      miniprogram/pages/productDetail/productDetail.json
  11. +1
    -0
      miniprogram/pages/productDetail/productDetail.less
  12. +2
    -0
      miniprogram/pages/productDetail/productDetail.wxml
  13. +1
    -1
      tsconfig.json

+ 31
- 3
miniprogram/app.js View File

@@ -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');
})
}
},
})

+ 3
- 1
miniprogram/app.json View File

@@ -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"
}
}

+ 10
- 2
miniprogram/pages/chat/chat.js View File

@@ -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({


+ 3
- 0
miniprogram/pages/chat/chat.wxml View File

@@ -1,4 +1,7 @@
<!--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="chatItem" wx:for="{{chatList}}" wx:key="index">
<view class="{{item.id == 1 ? 'chatContent right' : 'chatContent left'}}">


+ 16
- 23
miniprogram/pages/index/index.js View File

@@ -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(() => {


+ 1
- 3
miniprogram/pages/index/index.json View File

@@ -1,6 +1,4 @@
{
"navigationBarTitleText": "首页",
"usingComponents": {
"van-notice-bar": "@vant/weapp/notice-bar/index"
}
"usingComponents": {}
}

+ 18
- 21
miniprogram/pages/index/index.less View File

@@ -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;


+ 8
- 9
miniprogram/pages/index/index.wxml View File

@@ -1,11 +1,14 @@
<!--index.wxml-->
<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>

<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 class="introduction">
<view class="title">欢迎使用小闲聊</view>
@@ -21,10 +24,6 @@
<view class="switch bottomRight" data-flag="bottomRight" bindtap="checkCheatCode"></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">
<block wx:if="{{!isDevMode}}">
<block wx:if="{{userInfo.isMember == 0 && userInfo.isValid == 0}}">
@@ -52,7 +51,7 @@
<view wx:if="{{userInfo.coverPhone}}" class="userPhone">当前用户:{{userInfo.coverPhone}}</view>
<view class="userPhone" wx:if="{{userInfo.validEndTime}}">到期时间:{{userInfo.validEndTime}}</view>
<view class="payHistory">
<text bindtap="checkUserProtocol">用户协议</text>
<text bindtap="checkUserProtocol" style="margin-right: 20rpx;">用户协议</text>
<text bindtap="checkPayHistory">延续历史</text>
</view>
<button type="primary" bindtap="goToBuy">延续使用</button>


+ 66
- 0
miniprogram/pages/productDetail/productDetail.js View File

@@ -0,0 +1,66 @@
// pages/productDetail/productDetail.ts
Page({

/**
* 页面的初始数据
*/
data: {

},

/**
* 生命周期函数--监听页面加载
*/
onLoad() {

},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {

},

/**
* 生命周期函数--监听页面显示
*/
onShow() {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide() {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload() {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {

},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {

},

/**
* 用户点击右上角分享
*/
onShareAppMessage() {

}
})

+ 4
- 0
miniprogram/pages/productDetail/productDetail.json View File

@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "关于我们",
"usingComponents": {}
}

+ 1
- 0
miniprogram/pages/productDetail/productDetail.less View File

@@ -0,0 +1 @@
/* pages/productDetail/productDetail.wxss */

+ 2
- 0
miniprogram/pages/productDetail/productDetail.wxml View File

@@ -0,0 +1,2 @@
<!--pages/productDetail/productDetail.wxml-->
<text>关于我们</text>

+ 1
- 1
tsconfig.json View File

@@ -36,7 +36,7 @@
"miniprogram/pages/orderDetail/orderDetail.js",
"miniprogram/pages/userProtocol/userProtocol.js",
"miniprogram/pages/mine/mine.js",
"miniprogram/components/userNumberChkeck/userNumberChkeck.js",
"miniprogram/components/userNumberChkeck/userNumberChkeck.js", "miniprogram/pages/productDetail/productDetail.js",
],
"exclude": [
"node_modules"


Loading…
Cancel
Save