12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- import {
- createStoreBindings
- } from 'mobx-miniprogram-bindings'
- import {
- store
- } from '~/store/index'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- victory: {},
- defeated: {},
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.storeBindings = createStoreBindings(this, {
- store,
- fields: {
- userInfo: 'userInfo',
- readDetail: 'readDetail',
- pkData: 'pkData'
- },
- })
- this.storeBindings.updateStoreBindings()
- this.compareScore()
- },
- compareScore() {
- let pkData = {
- audioPath: "https://reader-wx.ai160.com/reader/resource/20221222/1671682237419428.mp3",
- avatar: "wxfile://,tmp_ba795553cc21cd941badc3ce06597c245f08fd6a674fe165.jpg",
- nickName: "小舞",
- score: 96,
- }
- let score = pkData.score
- let myResult = {
- audioPath: this.data.readDetail.tempFilePath,
- nickName: this.data.userInfo.nickName || this.data.userInfo.uid,
- avatar: this.data.userInfo.avatar,
- score: this.data.readDetail.myOverall || 100
- }
- this.setData({
- victory: myResult.score > score ? myResult : pkData,
- defeated: myResult.score < score ? myResult : pkData,
- })
- },
- result() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|