mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-04-16 21:02:42 +08:00
增加微信小程序版
This commit is contained in:
BIN
liferestartWX/pages/.DS_Store
vendored
Normal file
BIN
liferestartWX/pages/.DS_Store
vendored
Normal file
Binary file not shown.
44
liferestartWX/pages/index.js
Normal file
44
liferestartWX/pages/index.js
Normal file
@@ -0,0 +1,44 @@
|
||||
// miniprogram/pages/liferestart/index.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
wx.showShareMenu({
|
||||
withShareTicket: true,
|
||||
menus: ['shareAppMessage', 'shareTimeline']
|
||||
})
|
||||
},
|
||||
toRanking(e) {
|
||||
wx.navigateTo({
|
||||
url: 'ranking'
|
||||
})
|
||||
},
|
||||
toTalents(e) {
|
||||
wx.navigateTo({
|
||||
url: 'talents'
|
||||
})
|
||||
},
|
||||
onShareTimeline(e) {
|
||||
return {
|
||||
title: "人生重开模拟器",
|
||||
imageUrl: "../../../images/liferestart_cover.jpg",
|
||||
}
|
||||
},
|
||||
onShareAppMessage: function () {
|
||||
return {
|
||||
title: '人生重开模拟器',
|
||||
imageUrl: '../../../images/liferestart_cover.jpg',
|
||||
path: '/pages/index/index',
|
||||
}
|
||||
},
|
||||
})
|
||||
8
liferestartWX/pages/index.json
Normal file
8
liferestartWX/pages/index.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"wux-icon": "/utils/wux/icon/index",
|
||||
"wux-button": "/utils/wux/button/index",
|
||||
"wux-wing-blank": "/utils/wux/wing-blank/index",
|
||||
"wux-white-space": "/utils/wux/white-space/index"
|
||||
}
|
||||
}
|
||||
19
liferestartWX/pages/index.wxml
Normal file
19
liferestartWX/pages/index.wxml
Normal file
@@ -0,0 +1,19 @@
|
||||
<!--miniprogram/pages/liferestart/index.wxml-->
|
||||
<view class="container">
|
||||
<view class="title1">人生重开模拟器</view>
|
||||
<view class="title2">这垃圾人生一秒也不想呆了</view>
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<view class="btn-view">
|
||||
<view bindtap="toTalents" class="btn">
|
||||
<view class="btn-text">立即重开</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="btn2-view">
|
||||
<view bindtap="toRanking" class="btn2">
|
||||
<view class="btn2-text">卷起来</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
80
liferestartWX/pages/index.wxss
Normal file
80
liferestartWX/pages/index.wxss
Normal file
@@ -0,0 +1,80 @@
|
||||
/* miniprogram/pages/liferestart/index.wxss */
|
||||
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 100rpx 50rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #222831;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.title1 {
|
||||
font-size: 82rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.title2 {
|
||||
font-size: 42rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
.btn-view {
|
||||
display:flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.btn {
|
||||
width: 400rpx;
|
||||
height: 400rpx;
|
||||
|
||||
background-image: -webkit-radial-gradient(45px 45px, circle cover, #99CC33, #003366);
|
||||
|
||||
animation-name: spin;
|
||||
animation-duration: 3s; /* 3 seconds */
|
||||
animation-iteration-count: infinite;
|
||||
animation-timing-function: linear;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.btn-text {
|
||||
width: 400rpx;
|
||||
height: 400rpx;
|
||||
text-align: center;
|
||||
font-size: 82rpx;
|
||||
line-height: 400rpx;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
.btn2-view {
|
||||
position:fixed;
|
||||
bottom:0;
|
||||
left:0;
|
||||
padding-left: 50px;
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
.btn2 {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
|
||||
background-image: -webkit-radial-gradient(45px 45px, circle cover, #99CC33, #003366);
|
||||
|
||||
animation-name: spin;
|
||||
animation-duration: 3s; /* 3 seconds */
|
||||
animation-iteration-count: infinite;
|
||||
animation-timing-function: linear;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.btn2-text {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
text-align: center;
|
||||
font-size: 42rpx;
|
||||
line-height: 200rpx;
|
||||
color: white;
|
||||
}
|
||||
170
liferestartWX/pages/property.js
Normal file
170
liferestartWX/pages/property.js
Normal file
@@ -0,0 +1,170 @@
|
||||
// miniprogram/pages/liferestart/property.js
|
||||
import {
|
||||
$wuxToptips
|
||||
} from '../utils/wux/index';
|
||||
import {computeTalentsStatus, computeUseableProp, randomProp} from '../utils/liferestart/data/dataUtils.js';
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
propertyResidue : 0,
|
||||
propertyCHR : 0,
|
||||
propertyINT : 0,
|
||||
propertySTR : 0,
|
||||
propertyMNY : 0,
|
||||
propertyCHRMAX : 10,
|
||||
propertyINTMAX : 10,
|
||||
propertySTRMAX : 10,
|
||||
propertyMNYMAX : 10,
|
||||
propertyMaxInit : 0,
|
||||
selectedTalentsID : [],
|
||||
selectedTalents : []
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
wx.showShareMenu({
|
||||
withShareTicket: true,
|
||||
menus: ['shareAppMessage', 'shareTimeline']
|
||||
})
|
||||
this.computeProperty()
|
||||
},
|
||||
|
||||
randomProperty(e) {
|
||||
const arr = randomProp(this.data.propertyMaxInit, [10,10,10,10])
|
||||
// console.log('randomProperty', t, arr)
|
||||
this.setData({
|
||||
propertyCHR : 10 - arr[0],
|
||||
propertyINT : 10 - arr[1],
|
||||
propertySTR : 10 - arr[2],
|
||||
propertyMNY : 10 - arr[3],
|
||||
propertyCHRMAX : 10 - arr[0],
|
||||
propertyINTMAX : 10 - arr[1],
|
||||
propertySTRMAX : 10 - arr[2],
|
||||
propertyMNYMAX : 10 - arr[3],
|
||||
propertyResidue : 0
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
bron(e) {
|
||||
const tData = this.data
|
||||
if (tData.propertyResidue > 0) {
|
||||
$wuxToptips().error({
|
||||
hidden: false,
|
||||
text: '你还有'+tData.propertyResidue+'属性点没有分配完',
|
||||
duration: 5000,
|
||||
success() {},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
wx.setStorage({
|
||||
key: 'propertyCHR',
|
||||
data: tData.propertyCHR
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'propertyINT',
|
||||
data: tData.propertyINT
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'propertySTR',
|
||||
data: tData.propertySTR
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'propertyMNY',
|
||||
data: tData.propertyMNY
|
||||
})
|
||||
|
||||
wx.redirectTo({
|
||||
url: 'trajectory'
|
||||
})
|
||||
},
|
||||
|
||||
onChange(e) {
|
||||
const id = e.currentTarget.id
|
||||
const value = e.detail.value
|
||||
const tdata = this.data
|
||||
switch (id) {
|
||||
case 'propertyCHR':
|
||||
this.setData({
|
||||
propertyCHR : value
|
||||
})
|
||||
break
|
||||
case 'propertyINT':
|
||||
this.setData({
|
||||
propertyINT : value
|
||||
})
|
||||
break
|
||||
case 'propertySTR':
|
||||
this.setData({
|
||||
propertySTR : value
|
||||
})
|
||||
break
|
||||
case 'propertyMNY':
|
||||
this.setData({
|
||||
propertyMNY : value
|
||||
})
|
||||
break
|
||||
}
|
||||
// console.log(tdata.propertyCHR
|
||||
// , tdata.propertyINT
|
||||
// , tdata.propertySTR
|
||||
// , tdata.propertyMNY)
|
||||
var max = tdata.propertyMaxInit
|
||||
- tdata.propertyCHR
|
||||
- tdata.propertyINT
|
||||
- tdata.propertySTR
|
||||
- tdata.propertyMNY
|
||||
max = max < 0 ? 0 : max
|
||||
// console.log(id, value, max)
|
||||
this.setData({
|
||||
propertyResidue : max < 0 ? 0 : max,
|
||||
propertyCHRMAX : max + tdata.propertyCHR >= 10? 10 : max + tdata.propertyCHR,
|
||||
propertyINTMAX : max + tdata.propertyINT >= 10? 10 : max + tdata.propertyINT,
|
||||
propertySTRMAX : max + tdata.propertySTR >= 10? 10 : max + tdata.propertySTR,
|
||||
propertyMNYMAX : max + tdata.propertyMNY >= 10? 10 : max + tdata.propertyMNY,
|
||||
})
|
||||
// console.log(tdata.propertyCHRMAX,tdata.propertyINTMAX,tdata.propertySTRMAX,tdata.propertyMNYMAX)
|
||||
},
|
||||
|
||||
computeProperty: function() {
|
||||
const selectedTalents = wx.getStorageSync('selectedTalents')
|
||||
const selectedTalentsID = wx.getStorageSync('selectedTalentsID')
|
||||
console.log('selectedTalents', selectedTalents)
|
||||
var status = computeTalentsStatus(selectedTalents)
|
||||
// console.log('status', status)
|
||||
var proNum = computeUseableProp(20, status)
|
||||
this.setData({
|
||||
propertyResidue: proNum,
|
||||
propertyMaxInit: proNum,
|
||||
selectedTalents: selectedTalents,
|
||||
selectedTalentsID: selectedTalentsID
|
||||
})
|
||||
// console.log('proNum', proNum)
|
||||
},
|
||||
|
||||
onShareTimeline(e) {
|
||||
return {
|
||||
title: "人生重开模拟器",
|
||||
imageUrl: "../../../images/liferestart_cover.jpg",
|
||||
}
|
||||
},
|
||||
onShareAppMessage: function () {
|
||||
return {
|
||||
title: '人生重开模拟器',
|
||||
imageUrl: '../../../images/liferestart_cover.jpg',
|
||||
path: '/pages/index/index',
|
||||
}
|
||||
},
|
||||
// change(prop, value) {
|
||||
// if(Array.isArray(value)) {
|
||||
// for(const v of value)
|
||||
// this.change(prop, Number(v));
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
})
|
||||
11
liferestartWX/pages/property.json
Normal file
11
liferestartWX/pages/property.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"wux-toptips": "/utils/wux/toptips/index",
|
||||
"wux-button": "/utils/wux/button/index",
|
||||
"wux-cell-group": "/utils/wux/cell-group/index",
|
||||
"wux-cell": "/utils/wux/cell/index",
|
||||
"wux-input-number": "/utils/wux/input-number/index",
|
||||
"wux-wing-blank": "/utils/wux/wing-blank/index",
|
||||
"wux-white-space": "/utils/wux/white-space/index"
|
||||
}
|
||||
}
|
||||
44
liferestartWX/pages/property.wxml
Normal file
44
liferestartWX/pages/property.wxml
Normal file
@@ -0,0 +1,44 @@
|
||||
<!--miniprogram/pages/liferestart/property.wxml-->
|
||||
<wux-toptips id="wux-toptips" />
|
||||
|
||||
<view class="container">
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<view class="title1 wux-text--center">调整初始属性</view>
|
||||
<view class="title2 wux-text--center">可用属性点:{{propertyResidue}}</view>
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<wux-wing-blank size="large">
|
||||
<wux-cell-group>
|
||||
<wux-cell title="颜值" hover-class="none">
|
||||
<wux-input-number id="propertyCHR" value="{{ propertyCHR }}"
|
||||
controlled min="{{ 0 }}" max="{{ propertyCHRMAX }}" bind:change="onChange" longpress
|
||||
color="assertive" slot="footer" />
|
||||
</wux-cell>
|
||||
<wux-cell title="智力" hover-class="none">
|
||||
<wux-input-number id="propertyINT" value="{{ propertyINT }}"
|
||||
controlled min="{{ 0 }}" max="{{ propertyINTMAX }}" bind:change="onChange" longpress
|
||||
color="assertive" slot="footer" />
|
||||
</wux-cell>
|
||||
<wux-cell title="体质" hover-class="none">
|
||||
<wux-input-number id="propertySTR" value="{{ propertySTR }}"
|
||||
controlled min="{{ 0 }}" max="{{ propertySTRMAX }}" bind:change="onChange" longpress
|
||||
color="assertive" slot="footer" />
|
||||
</wux-cell>
|
||||
<wux-cell title="家境" hover-class="none">
|
||||
<wux-input-number id="propertyMNY" value="{{ propertyMNY }}"
|
||||
controlled min="{{ 0 }}" max="{{ propertyMNYMAX }}"bind:change="onChange" longpress
|
||||
color="assertive" slot="footer" />
|
||||
</wux-cell>
|
||||
</wux-cell-group>
|
||||
<wux-white-space size="large" />
|
||||
<view class="title2 wux-text--center">已选天赋</view>
|
||||
<view class="talentsTable">
|
||||
<block wx:for="{{selectedTalents}}" wx:key="*this">
|
||||
<view class="grade{{item.grade}}b">{{item.name}} ({{item.description}})</view>
|
||||
</block>
|
||||
</view>
|
||||
<wux-button block type="royal" bindtap="randomProperty">随机分配</wux-button>
|
||||
<wux-button block type="balanced" bindtap="bron">开启新人生</wux-button>
|
||||
</wux-wing-blank>
|
||||
</view>
|
||||
72
liferestartWX/pages/property.wxss
Normal file
72
liferestartWX/pages/property.wxss
Normal file
@@ -0,0 +1,72 @@
|
||||
/* miniprogram/pages/liferestart/property.wxss */
|
||||
/* miniprogram/pages/liferestart/index.wxss */
|
||||
@import '../utils/wux/styles/index.wxss';
|
||||
.container {
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
/* padding: 50rpx 100rpx; */
|
||||
box-sizing: border-box;
|
||||
background-color: #222831;
|
||||
/* color: #fff; */
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
position: static !important;
|
||||
}
|
||||
|
||||
.title1 {
|
||||
font-size: 82rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.title2 {
|
||||
font-size: 42rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 120rpx !important;
|
||||
border-color: transparent !important;
|
||||
}
|
||||
|
||||
.sub,
|
||||
.add {
|
||||
width: 52rpx !important;
|
||||
border: 2rpx solid #ececec !important;
|
||||
border-radius: 10rpx !important;
|
||||
}
|
||||
|
||||
.talentsTable{
|
||||
width: 100%;
|
||||
position: relative;
|
||||
border: 1px #ccc solid;
|
||||
display: inline-block;
|
||||
margin: 0.1rem 2px;
|
||||
font-size: 42rpx;
|
||||
text-align: center;
|
||||
border-radius: 0.2rem;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.grade0b {
|
||||
background-color: #464646;
|
||||
border: #f8f8f8 2px solid !important;
|
||||
}
|
||||
.grade1b {
|
||||
background-color: #6495ed;
|
||||
border: #f8f8f8 2px solid !important;
|
||||
}
|
||||
.grade2b {
|
||||
background-color: #e2a7ff;
|
||||
border: #f8f8f8 2px solid !important;
|
||||
}
|
||||
.grade3b {
|
||||
background-color: #ffa07a;
|
||||
border: #f8f8f8 2px solid !important;
|
||||
}
|
||||
45
liferestartWX/pages/ranking.js
Normal file
45
liferestartWX/pages/ranking.js
Normal file
@@ -0,0 +1,45 @@
|
||||
// miniprogram/page/liferestart/pages/ranking.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
rankingAGE: [],//最长寿
|
||||
rankingSPR: [],//最快乐
|
||||
rankingMNY: [],//最有钱
|
||||
rankingSTR: [],//最健康
|
||||
rankingINT: [],//最聪明
|
||||
rankingCHR: [],//最漂亮
|
||||
rankingSCO: [],//最NB
|
||||
},
|
||||
|
||||
loadRanking() {
|
||||
console.log('loadRanking')
|
||||
wx.cloud.callFunction({
|
||||
name: 'ranking',
|
||||
data: {
|
||||
handle: 'getRankingAll'
|
||||
}
|
||||
}).then(res => {
|
||||
console.log('ranking page ', res.result)
|
||||
this.setData({
|
||||
rankingAGE: res.result.recordAGE.data,//最长寿
|
||||
rankingSPR: res.result.recordSPR.data,//最快乐
|
||||
rankingMNY: res.result.recordMNY.data,//最有钱
|
||||
rankingSTR: res.result.recordSTR.data,//最健康
|
||||
rankingINT: res.result.recordINT.data,//最聪明
|
||||
rankingCHR: res.result.recordCHR.data,//最漂亮
|
||||
rankingSCO: res.result.recordFinal.data,//最NB
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.loadRanking()
|
||||
},
|
||||
|
||||
})
|
||||
9
liferestartWX/pages/ranking.json
Normal file
9
liferestartWX/pages/ranking.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"wux-button": "/utils/wux/button/index",
|
||||
"wux-row": "/utils/wux/row/index",
|
||||
"wux-col": "/utils/wux/col/index",
|
||||
"wux-wing-blank": "/utils/wux/wing-blank/index",
|
||||
"wux-white-space": "/utils/wux/white-space/index"
|
||||
}
|
||||
}
|
||||
29
liferestartWX/pages/ranking.wxml
Normal file
29
liferestartWX/pages/ranking.wxml
Normal file
@@ -0,0 +1,29 @@
|
||||
<import src="./ranking_item_template.wxml" />
|
||||
<view class="container">
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<view class="title1 wux-text--center">内卷世界</view>
|
||||
<wux-white-space size="large" />
|
||||
<wux-wing-blank size="large">
|
||||
|
||||
<template is="ranking_item" data="{{title_name:'最快乐',rankingData:rankingSPR,type:'rankingSPR'}}"/>
|
||||
|
||||
<template is="ranking_item" data="{{title_name:'最健康',rankingData:rankingSTR,type:'rankingSTR'}}"/>
|
||||
|
||||
<template is="ranking_item" data="{{title_name:'最长寿',rankingData:rankingAGE,type:'rankingAGE'}}"/>
|
||||
|
||||
<template is="ranking_item" data="{{title_name:'最有钱',rankingData:rankingMNY,type:'rankingMNY'}}"/>
|
||||
|
||||
<template is="ranking_item" data="{{title_name:'最聪明',rankingData:rankingINT,type:'rankingINT'}}"/>
|
||||
|
||||
<template is="ranking_item" data="{{title_name:'最漂亮',rankingData:rankingCHR,type:'rankingCHR'}}"/>
|
||||
|
||||
<template is="ranking_item" data="{{title_name:'最NB',rankingData:rankingSCO,type:'rankingSCO'}}"/>
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<wux-button block
|
||||
type="light" class="title2" bindtap="again">
|
||||
再来一次
|
||||
</wux-button>
|
||||
</wux-wing-blank>
|
||||
</view>
|
||||
76
liferestartWX/pages/ranking.wxss
Normal file
76
liferestartWX/pages/ranking.wxss
Normal file
@@ -0,0 +1,76 @@
|
||||
/* miniprogram/pages/liferestart/index.wxss */
|
||||
@import '../utils/wux/styles/index.wxss';
|
||||
.container {
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
/* padding: 50rpx 100rpx; */
|
||||
box-sizing: border-box;
|
||||
background-color: #222831;
|
||||
/* color: #fff; */
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
position: static !important;
|
||||
}
|
||||
|
||||
.title1 {
|
||||
font-size: 82rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.title2 {
|
||||
font-size: 42rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.rankingTable{
|
||||
width: 100%;
|
||||
position: relative;
|
||||
border: 1px #ccc solid;
|
||||
display: inline-block;
|
||||
padding: 6px 6px 6px 6px;
|
||||
font-size: 42rpx;
|
||||
text-align: center;
|
||||
border-radius: 0.2rem;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.userinfo-avatar {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
margin: 5rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.main {
|
||||
border-style: solid;
|
||||
border: 1px #ccc solid;
|
||||
border-width: 2px 2px;
|
||||
border-radius: 0.2rem;
|
||||
margin-top: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-top: 10px;
|
||||
font-size: 42rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
|
||||
padding: 0 10px;
|
||||
border-bottom: 1px dashed #cecece;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.index {
|
||||
flex: 1;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.desc {
|
||||
flex: 4;
|
||||
color: #fff;
|
||||
}
|
||||
27
liferestartWX/pages/ranking_item_template.wxml
Normal file
27
liferestartWX/pages/ranking_item_template.wxml
Normal file
@@ -0,0 +1,27 @@
|
||||
<template name="ranking_item">
|
||||
<wux-white-space size="large" />
|
||||
<view class="title2 wux-text--center">{{title_name}}</view>
|
||||
<view class="rankingTable">
|
||||
<block wx:for="{{rankingData}}" wx:key="*this">
|
||||
<wux-row>
|
||||
<wux-col span="2">
|
||||
<view>
|
||||
<image class="userinfo-avatar" src="{{item.avatar_url.length>0?item.avatar_url:j%2?'https://mmbiz.qpic.cn/mmbiz_png/G4dLFC4lBdRbLc31wbuQNFicqASrMdIK6zSRHzz0Q79EPfa5mDn2d8Jfu6lRI2kXe4o2y2UibR5P6ic97sNFeUAEQ/0?wx_fmt=png':'https://mmbiz.qpic.cn/mmbiz_png/G4dLFC4lBdRbLc31wbuQNFicqASrMdIK6aGmbKnmjDIxrROurLe5gop744hE2NUzR929XN3grVtl0ia0k2ISV1vg/0?wx_fmt=png'}}" />
|
||||
</view>
|
||||
</wux-col>
|
||||
<wux-col span="7">
|
||||
<view>{{item.nick_name}}</view>
|
||||
</wux-col>
|
||||
<wux-col span="3">
|
||||
<view wx:if="{{type == 'rankingSPR'}}">{{item.recordSPR.value}} {{item.recordSPR.judge}}</view>
|
||||
<view wx:if="{{type == 'rankingSTR'}}">{{item.recordSTR.value}} {{item.recordSTR.judge}}</view>
|
||||
<view wx:if="{{type == 'rankingAGE'}}">{{item.recordAGE.value}} {{item.recordAGE.judge}}</view>
|
||||
<view wx:if="{{type == 'rankingMNY'}}">{{item.recordMNY.value}} {{item.recordMNY.judge}}</view>
|
||||
<view wx:if="{{type == 'rankingINT'}}">{{item.recordINT.value}} {{item.recordINT.judge}}</view>
|
||||
<view wx:if="{{type == 'rankingCHR'}}">{{item.recordCHR.value}} {{item.recordCHR.judge}}</view>
|
||||
<view wx:if="{{type == 'rankingSCO'}}">{{item.recordFinal.value}} {{item.recordFinal.judge}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
75
liferestartWX/pages/summary.js
Normal file
75
liferestartWX/pages/summary.js
Normal file
@@ -0,0 +1,75 @@
|
||||
// miniprogram/pages/liferestart/summary.js
|
||||
import {buildSummary,finalSummary} from "../utils/liferestart/data/dataUtils.js";
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
summaryCHR : {},
|
||||
summaryINT : {},
|
||||
summarySTR : {},
|
||||
summaryMNY : {},
|
||||
summaryFinal:{}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
wx.showShareMenu({
|
||||
withShareTicket: true,
|
||||
menus: ['shareAppMessage', 'shareTimeline']
|
||||
})
|
||||
this.initData()
|
||||
},
|
||||
|
||||
initData() {
|
||||
var nickName = "神秘人"
|
||||
var avatarUrl = ""
|
||||
wx.getUserInfo({
|
||||
success: function(res) {
|
||||
var userInfo = res.userInfo
|
||||
nickName = userInfo.nickName
|
||||
avatarUrl = userInfo.avatarUrl
|
||||
}
|
||||
})
|
||||
const record = wx.getStorageSync('currentRecord')
|
||||
const recordCHR = buildSummary(record, 'CHR')
|
||||
const recordINT = buildSummary(record, 'INT');
|
||||
const recordSTR = buildSummary(record, 'STR');
|
||||
const recordMNY = buildSummary(record, 'MNY');
|
||||
const recordSPR = buildSummary(record, 'SPR');
|
||||
const recordAGE = buildSummary(record, 'AGE');
|
||||
const recordFinal = finalSummary(record)
|
||||
|
||||
this.setData({
|
||||
summaryCHR : recordCHR,
|
||||
summaryINT : recordINT,
|
||||
summarySTR : recordSTR,
|
||||
summaryMNY : recordMNY,
|
||||
summarySPR : recordSPR,
|
||||
summaryAGE : recordAGE,
|
||||
summaryFinal : recordFinal
|
||||
})
|
||||
console.log('initData',this.data.summaryFinal)
|
||||
},
|
||||
again(e) {
|
||||
wx.redirectTo({
|
||||
url: 'index'
|
||||
})
|
||||
},
|
||||
onShareTimeline(e) {
|
||||
return {
|
||||
title: "人生重开模拟器",
|
||||
imageUrl: "../../../images/liferestart_cover.jpg",
|
||||
}
|
||||
},
|
||||
onShareAppMessage: function () {
|
||||
return {
|
||||
title: '人生重开模拟器',
|
||||
imageUrl: '../../../images/liferestart_cover.jpg',
|
||||
path: '/pages/index/index',
|
||||
}
|
||||
},
|
||||
})
|
||||
9
liferestartWX/pages/summary.json
Normal file
9
liferestartWX/pages/summary.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"wux-button": "/utils/wux/button/index",
|
||||
"wux-row": "/utils/wux/row/index",
|
||||
"wux-col": "/utils/wux/col/index",
|
||||
"wux-wing-blank": "/utils/wux/wing-blank/index",
|
||||
"wux-white-space": "/utils/wux/white-space/index"
|
||||
}
|
||||
}
|
||||
70
liferestartWX/pages/summary.wxml
Normal file
70
liferestartWX/pages/summary.wxml
Normal file
@@ -0,0 +1,70 @@
|
||||
<view class="container">
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<view class="title1 wux-text--center">人生总结</view>
|
||||
<wux-white-space size="large" />
|
||||
<wux-wing-blank size="large">
|
||||
<wux-row>
|
||||
<wux-col span="3">
|
||||
<view class="userinfo-avatar">
|
||||
<open-data type="userAvatarUrl"></open-data>
|
||||
</view>
|
||||
</wux-col>
|
||||
<wux-col span="9">
|
||||
<view class="userinfo-nickname">
|
||||
<open-data type="userNickName"></open-data> 的来生
|
||||
</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
|
||||
|
||||
<view>
|
||||
<wux-row>
|
||||
<wux-col span="12">
|
||||
<view class="lifeProperty grade{{summaryCHR.grade}}b">颜值:{{summaryCHR.value}} {{summaryCHR.judge}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
<wux-row>
|
||||
<wux-col span="12">
|
||||
<view class="lifeProperty grade{{summaryINT.grade}}b">智力:{{summaryINT.value}} {{summaryINT.judge}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
<wux-row>
|
||||
<wux-col span="12">
|
||||
<view class="lifeProperty grade{{summarySTR.grade}}b">体质:{{summarySTR.value}} {{summarySTR.judge}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
<wux-row>
|
||||
<wux-col span="12">
|
||||
<view class="lifeProperty grade{{summaryMNY.grade}}b">家境:{{summaryMNY.value}} {{summaryMNY.judge}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
<wux-row>
|
||||
<wux-col span="12">
|
||||
<view class="lifeProperty grade{{summarySPR.grade}}b">快乐:{{summarySPR.value}} {{summarySPR.judge}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
<wux-row class="">
|
||||
<wux-col span="12">
|
||||
<view class="lifeProperty grade{{summaryAGE.grade}}b">享年:{{summaryAGE.value}} {{summaryAGE.judge}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
<wux-row class="">
|
||||
<wux-col span="12">
|
||||
<view class="lifeProperty grade{{summaryFinal.grade}}b">总评:{{summaryFinal.value}} {{summaryFinal.judge}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
</view>
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<view class="qcode-view">
|
||||
<image class="qcode" src="../assets/images/app_qcode.jpg" />
|
||||
</view>
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<wux-button block
|
||||
type="light" class="title2" bindtap="again">
|
||||
再来一次
|
||||
</wux-button>
|
||||
</wux-wing-blank>
|
||||
</view>
|
||||
94
liferestartWX/pages/summary.wxss
Normal file
94
liferestartWX/pages/summary.wxss
Normal file
@@ -0,0 +1,94 @@
|
||||
/* miniprogram/pages/liferestart/index.wxss */
|
||||
@import '../utils/wux/styles/index.wxss';
|
||||
|
||||
.container {
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
/* padding: 50rpx 100rpx; */
|
||||
box-sizing: border-box;
|
||||
background-color: #222831;
|
||||
/* color: #fff; */
|
||||
}
|
||||
|
||||
|
||||
.checkbox {
|
||||
position: static !important;
|
||||
}
|
||||
|
||||
.title1 {
|
||||
font-size: 82rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.title2 {
|
||||
font-size: 42rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.main {
|
||||
border-style: solid;
|
||||
border: 1px #ccc solid;
|
||||
border-width: 2px 2px;
|
||||
border-radius: 0.2rem;
|
||||
margin-top: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.lifeProperty{
|
||||
|
||||
width: 100%;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
margin: 0.1rem 2px;
|
||||
font-size: 38rpx;
|
||||
text-align: center;
|
||||
border-radius: 0.2rem;
|
||||
color: white;
|
||||
border-bottom: 1px dashed #cecece;
|
||||
}
|
||||
|
||||
.grade0b {
|
||||
background-color: #464646;
|
||||
border: #f8f8f8 2px solid !important;
|
||||
}
|
||||
.grade1b {
|
||||
background-color: #6495ed;
|
||||
border: #f8f8f8 2px solid !important;
|
||||
}
|
||||
.grade2b {
|
||||
background-color: #e2a7ff;
|
||||
border: #f8f8f8 2px solid !important;
|
||||
}
|
||||
.grade3b {
|
||||
background-color: #ffa07a;
|
||||
border: #f8f8f8 2px solid !important;
|
||||
}
|
||||
.qcode-view {
|
||||
display:flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.qcode {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
|
||||
border-radius: 50%;
|
||||
}
|
||||
.userinfo-avatar {
|
||||
width: 160rpx;
|
||||
height: 150rpx;
|
||||
margin: 20rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.userinfo-nickname {
|
||||
font-size: 42rpx;
|
||||
color: white;
|
||||
text-align: center;
|
||||
background-size: cover;
|
||||
}
|
||||
202
liferestartWX/pages/talents.js
Normal file
202
liferestartWX/pages/talents.js
Normal file
@@ -0,0 +1,202 @@
|
||||
// miniprogram/pages/liferestart/talents.js
|
||||
// 颜值 charm CHR
|
||||
// 智力 intelligence INT
|
||||
// 体质 strength STR
|
||||
// 家境 money MNY
|
||||
// 快乐 spirit SPR
|
||||
// 生命 life LIF
|
||||
// 天赋 talent TLT
|
||||
// 事件 event EVT
|
||||
import {
|
||||
$wuxToptips
|
||||
} from '../utils/wux/index';
|
||||
import {randomTalents,computeTalentsStatus, computeUseableProp, randomProp} from '../utils/liferestart/data/dataUtils.js';
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
talentsArray: [],
|
||||
selectedTalentsID:[],
|
||||
selectedTalents:[],
|
||||
showSelectTalents: false
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function () {
|
||||
// console.log('telents page onLoad')
|
||||
wx.showShareMenu({
|
||||
withShareTicket: true,
|
||||
menus: ['shareAppMessage', 'shareTimeline']
|
||||
})
|
||||
this.clearStorage()
|
||||
this.loadTalents()
|
||||
},
|
||||
|
||||
clearStorage: function() {
|
||||
this.setData({
|
||||
talentsArray: [],
|
||||
selectedTalentsID: [],
|
||||
selectedTalents: []
|
||||
})
|
||||
wx.removeStorageSync('selectedTalentsID')
|
||||
wx.removeStorageSync('selectedTalents')
|
||||
wx.removeStorageSync('propertyCHR')
|
||||
wx.removeStorageSync('propertyINT')
|
||||
wx.removeStorageSync('propertySTR')
|
||||
wx.removeStorageSync('propertyMNY')
|
||||
wx.removeStorageSync('currentRecord')
|
||||
wx.removeStorageSync('trajectory')
|
||||
},
|
||||
|
||||
loadTalents: function() {
|
||||
const showTalents = randomTalents(10)
|
||||
// console.log('telents page loadTalents', showTalents)
|
||||
this.setData({
|
||||
talentsArray: showTalents
|
||||
})
|
||||
},
|
||||
|
||||
onSelectTalents(e) {
|
||||
// console.log('onSelectTalents e',e)
|
||||
const selectedIndex = e.detail.selectedIndex
|
||||
const selectedValue = e.detail.selectedValue
|
||||
if (selectedValue.length > 3) {
|
||||
$wuxToptips().error({
|
||||
hidden: false,
|
||||
text: '只能选三个天赋',
|
||||
duration: 5000,
|
||||
success() {},
|
||||
})
|
||||
// e.detail.selectedValue.pop()
|
||||
e.detail.selectedIndex.pop()
|
||||
}// else {
|
||||
const tData = this.data
|
||||
|
||||
tData.talentsArray.forEach((item) => {
|
||||
item.disabled = false
|
||||
});
|
||||
tData.selectedTalents = []
|
||||
// console.log('selectedIndex',selectedValue)
|
||||
if (selectedValue.length == 3) {
|
||||
tData.talentsArray.forEach(function(item, idx) {
|
||||
// console.log('item',item._id,(selectedValue.includes(item._id)))
|
||||
if (selectedValue.includes(item._id)) {
|
||||
item.disabled = false
|
||||
} else {
|
||||
// console.log('item2',idx,item.inputChecked)
|
||||
item.disabled = true
|
||||
}
|
||||
})
|
||||
}
|
||||
selectedIndex.forEach(function (item, idx) {
|
||||
// for (var i = 0; i < selectedIndex.length; i++) {
|
||||
const currentTalents = tData.talentsArray[item]
|
||||
// console.log('currentTalents=',idx,currentTalents)
|
||||
tData.selectedTalents.push(currentTalents)
|
||||
if ('exclusive' in currentTalents) {
|
||||
const currexc = currentTalents.exclusive
|
||||
// console.log('currexc',currexc.length)
|
||||
currexc.forEach(function (itemexc, idxexc) {
|
||||
// console.log('currexc',itemexc)
|
||||
tData.talentsArray.forEach(function(itemTal, idxTal) {
|
||||
if (itemTal._id == itemexc) {
|
||||
// console.log('itemTal',itemTal)
|
||||
itemTal.disabled = itemTal._id == itemexc
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
this.setData({
|
||||
talentsArray: tData.talentsArray,
|
||||
selectedTalentsID: e.detail.selectedValue,
|
||||
selectedTalents: tData.selectedTalents
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'selectedTalentsID',
|
||||
data: this.data.selectedTalentsID
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'selectedTalents',
|
||||
data: tData.selectedTalents
|
||||
})
|
||||
// console.log('checkbox发生change事件,携带value值为:', this.data.selectedTalents)
|
||||
// }
|
||||
},
|
||||
showTalents(e) {
|
||||
this.setData({
|
||||
showSelectTalents: true
|
||||
})
|
||||
},
|
||||
randomLife(e) {
|
||||
const selectedTalents = randomTalents(3)
|
||||
const selectedTalentsID = selectedTalents.map(function(item) {
|
||||
return item._id
|
||||
});
|
||||
const status = computeTalentsStatus(selectedTalents)
|
||||
// console.log('status', status)
|
||||
const proNum = computeUseableProp(20, status)
|
||||
const arr = randomProp(proNum, [10,10,10,10])
|
||||
console.log('selectedTalentsID', selectedTalentsID, proNum, arr)
|
||||
wx.setStorage({
|
||||
key: 'selectedTalentsID',
|
||||
data: selectedTalentsID
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'selectedTalents',
|
||||
data: selectedTalents
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'propertyCHR',
|
||||
data: arr[0]
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'propertyINT',
|
||||
data: arr[1]
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'propertySTR',
|
||||
data: arr[2]
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'propertyMNY',
|
||||
data: arr[3]
|
||||
})
|
||||
wx.redirectTo({
|
||||
url: 'trajectory'
|
||||
})
|
||||
},
|
||||
|
||||
toProperty(e) {
|
||||
if (this.data.selectedTalents.length < 3) {
|
||||
$wuxToptips().error({
|
||||
hidden: false,
|
||||
text: '请选择三个天赋',
|
||||
duration: 5000,
|
||||
success() {},
|
||||
})
|
||||
} else {
|
||||
wx.redirectTo({
|
||||
url: 'property'
|
||||
})
|
||||
}
|
||||
},
|
||||
onShareTimeline(e) {
|
||||
return {
|
||||
title: "人生重开模拟器",
|
||||
imageUrl: "../../../images/liferestart_cover.jpg",
|
||||
}
|
||||
},
|
||||
onShareAppMessage: function () {
|
||||
return {
|
||||
title: '人生重开模拟器',
|
||||
imageUrl: '../../../images/liferestart_cover.jpg',
|
||||
path: '/pages/index/index',
|
||||
}
|
||||
},
|
||||
|
||||
})
|
||||
13
liferestartWX/pages/talents.json
Normal file
13
liferestartWX/pages/talents.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"wux-toptips": "/utils/wux/toptips/index",
|
||||
"wux-checkbox-group": "/utils/wux/checkbox-group/index",
|
||||
"wux-checkbox": "/utils/wux/checkbox/index",
|
||||
"wux-cell-group": "/utils/wux/cell-group/index",
|
||||
"wux-cell": "/utils/wux/cell/index",
|
||||
"wux-icon": "/utils/wux/icon/index",
|
||||
"wux-button": "/utils/wux/button/index",
|
||||
"wux-wing-blank": "/utils/wux/wing-blank/index",
|
||||
"wux-white-space": "/utils/wux/white-space/index"
|
||||
}
|
||||
}
|
||||
42
liferestartWX/pages/talents.wxml
Normal file
42
liferestartWX/pages/talents.wxml
Normal file
@@ -0,0 +1,42 @@
|
||||
<!--miniprogram/pages/liferestart/talents.wxml-->
|
||||
<wux-toptips id="wux-toptips" />
|
||||
<view class="container">
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<view class="title1 wux-text--center">天赋抽卡</view>
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<wux-wing-blank size="large" wx:if="{{showSelectTalents}}">
|
||||
<scroll-view style="height:100%;width:100%;display: flex;flex-direction: column;" scroll-y="true">
|
||||
<wux-checkbox-group name="talentsList"
|
||||
value="{{ selectedTalentsID }}"
|
||||
bind:change="onSelectTalents">
|
||||
<block wx:for="{{talentsArray}}" wx:key="*this">
|
||||
<wux-checkbox class="grade{{item.grade}}b"
|
||||
title="{{item.name}} ({{item.description}})"
|
||||
value="{{item._id}}" disabled="{{item.disabled?true:false}}"/>
|
||||
</block>
|
||||
</wux-checkbox-group>
|
||||
</scroll-view>
|
||||
<wux-white-space size="large" />
|
||||
<wux-button block bindtap="toProperty" type="light" class="title2">
|
||||
请选择3个
|
||||
</wux-button>
|
||||
</wux-wing-blank>
|
||||
<wux-wing-blank size="large" wx:if="{{!showSelectTalents}}">
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<view class="btn-view">
|
||||
<view bindtap="randomLife" class="btn">
|
||||
<view class="btn-text">盲盒人生</view>
|
||||
</view>
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<view bindtap="showTalents" class="btn">
|
||||
<view class="btn-text">十连抽</view>
|
||||
</view>
|
||||
</view>
|
||||
</wux-wing-blank>
|
||||
</view>
|
||||
87
liferestartWX/pages/talents.wxss
Normal file
87
liferestartWX/pages/talents.wxss
Normal file
@@ -0,0 +1,87 @@
|
||||
/* miniprogram/pages/liferestart/index.wxss */
|
||||
@import '../utils/wux/styles/index.wxss';
|
||||
.container {
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
/* padding: 50rpx 100rpx; */
|
||||
box-sizing: border-box;
|
||||
background-color: #222831;
|
||||
/* color: #fff; */
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
position: static !important;
|
||||
}
|
||||
|
||||
.title1 {
|
||||
font-size: 82rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.title2 {
|
||||
font-size: 42rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
.main {
|
||||
border-style: solid;
|
||||
border: 1px #ccc solid;
|
||||
border-width: 2px 2px;
|
||||
border-radius: 0.2rem;
|
||||
margin-top: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
.item {
|
||||
font-size: 32rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 10px;
|
||||
|
||||
}
|
||||
.btn-view {
|
||||
display:flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.btn {
|
||||
width: 400rpx;
|
||||
height: 400rpx;
|
||||
|
||||
background-image: -webkit-radial-gradient(45px 45px, circle cover, #99CC33, #003366);
|
||||
animation-name: spin;
|
||||
animation-duration: 3s; /* 3 seconds */
|
||||
animation-iteration-count: infinite;
|
||||
animation-timing-function: linear;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.btn-text {
|
||||
width: 400rpx;
|
||||
height: 400rpx;
|
||||
text-align: center;
|
||||
font-size: 82rpx;
|
||||
line-height: 400rpx;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.grade0b {
|
||||
background-color: #464646;
|
||||
/* border: #f8f8f8 2px solid !important; */
|
||||
}
|
||||
.grade1b {
|
||||
background-color: #6495ed;
|
||||
/* border: #f8f8f8 2px solid !important; */
|
||||
}
|
||||
.grade2b {
|
||||
background-color: #e2a7ff;
|
||||
/* border: #f8f8f8 2px solid !important; */
|
||||
}
|
||||
.grade3b {
|
||||
background-color: #ffa07a;
|
||||
/* border: #f8f8f8 2px solid !important; */
|
||||
}
|
||||
106
liferestartWX/pages/trajectory.js
Normal file
106
liferestartWX/pages/trajectory.js
Normal file
@@ -0,0 +1,106 @@
|
||||
// miniprogram/pages/liferestart/trajectory.js
|
||||
import Life from "../utils/liferestart/life";
|
||||
import Property from "../utils/liferestart/property";
|
||||
import {allAge} from "../utils/liferestart/data/dataUtils.js";
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
propertyCHR : 0,
|
||||
propertyINT : 0,
|
||||
propertySTR : 0,
|
||||
propertyMNY : 0,
|
||||
selectedTalentsID : [],
|
||||
isEnd : false,
|
||||
items : []
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.initialData()
|
||||
},
|
||||
|
||||
initialData() {
|
||||
const tData = this.data
|
||||
const _this = this
|
||||
const propertyCHR = wx.getStorageSync('propertyCHR')
|
||||
const propertyINT = wx.getStorageSync('propertyINT')
|
||||
const propertySTR = wx.getStorageSync('propertySTR')
|
||||
const propertyMNY = wx.getStorageSync('propertyMNY')
|
||||
const selectedTalentsID = wx.getStorageSync('selectedTalentsID')
|
||||
|
||||
this.property = new Property(this);
|
||||
this.life = new Life(this)
|
||||
this.life.initial()
|
||||
|
||||
this.life.restart({
|
||||
CHR: propertyCHR,
|
||||
INT: propertyINT,
|
||||
STR: propertySTR,
|
||||
MNY: propertyMNY,
|
||||
SPR: 5,
|
||||
TLT: selectedTalentsID,
|
||||
});
|
||||
var trajectory = this.life.next()
|
||||
|
||||
wx.setStorage({
|
||||
key: 'currentRecord',
|
||||
data: this.life.getRecord()
|
||||
})
|
||||
const { age, content, isEnd } = trajectory
|
||||
tData.items.push(trajectory)
|
||||
const newprop = this.life.getLastRecord()
|
||||
_this.setData({
|
||||
items : tData.items,
|
||||
selectedTalentsID : selectedTalentsID,
|
||||
propertyCHR : newprop.CHR,
|
||||
propertyINT : newprop.INT,
|
||||
propertySTR : newprop.STR,
|
||||
propertyMNY : newprop.MNY,
|
||||
scrollTopVal: 0,
|
||||
isEnd: isEnd,
|
||||
pageHeight: wx.getSystemInfoSync().windowHeight - (isEnd?200:150),
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
nextAge(e) {
|
||||
const tData = this.data
|
||||
// console.log('trajectorypage nextAge')
|
||||
if (!tData.isEnd) {
|
||||
const _this = this
|
||||
var trajectory = this.life.next()
|
||||
const { age, content, isEnd } = trajectory
|
||||
tData.items.push(trajectory)
|
||||
const newprop = this.life.getLastRecord()
|
||||
_this.setData({
|
||||
items : tData.items,
|
||||
propertyCHR : newprop.CHR,
|
||||
propertyINT : newprop.INT,
|
||||
propertySTR : newprop.STR,
|
||||
propertyMNY : newprop.MNY,
|
||||
scrollTopVal: tData.items.length * 999,
|
||||
isEnd: isEnd,
|
||||
pageHeight: wx.getSystemInfoSync().windowHeight - (isEnd?200:150),
|
||||
})
|
||||
}
|
||||
},
|
||||
toSummary(e) {
|
||||
wx.setStorage({
|
||||
key: 'currentRecord',
|
||||
data: this.life.getRecord()
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'trajectory',
|
||||
data: this.data.items
|
||||
})
|
||||
wx.redirectTo({
|
||||
url: 'summary'
|
||||
})
|
||||
},
|
||||
})
|
||||
10
liferestartWX/pages/trajectory.json
Normal file
10
liferestartWX/pages/trajectory.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"wux-divider": "/utils/wux/divider/index",
|
||||
"wux-button": "/utils/wux/button/index",
|
||||
"wux-row": "/utils/wux/row/index",
|
||||
"wux-col": "/utils/wux/col/index",
|
||||
"wux-wing-blank": "/utils/wux/wing-blank/index",
|
||||
"wux-white-space": "/utils/wux/white-space/index"
|
||||
}
|
||||
}
|
||||
61
liferestartWX/pages/trajectory.wxml
Normal file
61
liferestartWX/pages/trajectory.wxml
Normal file
@@ -0,0 +1,61 @@
|
||||
<!--miniprogram/pages/liferestart/talents.wxml-->
|
||||
<view class="container">
|
||||
<wux-white-space size="large" />
|
||||
<wux-white-space size="large" />
|
||||
<wux-wing-blank size="large">
|
||||
<wux-row>
|
||||
<wux-col span="4">
|
||||
<view class="lifeProperty">颜值:{{propertyCHR}}</view>
|
||||
</wux-col>
|
||||
<wux-col span="4">
|
||||
<view class="lifeProperty">智力:{{propertyINT}}</view>
|
||||
</wux-col>
|
||||
<wux-col span="4">
|
||||
<view class="lifeProperty">体质:{{propertySTR}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
<wux-row>
|
||||
<wux-col span="6">
|
||||
<view class="lifeProperty">家境:{{propertyMNY}}</view>
|
||||
</wux-col>
|
||||
<wux-col span="6">
|
||||
<view class="lifeProperty">快乐:{{propertyMNY}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
<view class="main"
|
||||
bindtap="nextAge">
|
||||
<wux-wing-blank size="large">
|
||||
<scroll-view style="height:{{pageHeight}}px;width: 100%;display: flex;flex-direction: column;margin-top: 54rpx;" scroll-y="true" scroll-top="{{scrollTopVal}}" bindtap="resetInputStatus">
|
||||
<block wx:for="{{items}}" wx:key="index">
|
||||
<wux-row>
|
||||
<wux-col span="2">
|
||||
{{ item.age }}岁:
|
||||
</wux-col>
|
||||
<wux-col span="10">
|
||||
|
||||
<block wx:for="{{item.content}}" wx:for-item="itemContent" wx:key="index">
|
||||
<wux-row wx:if="{{itemContent.type == 'TLT'}}">
|
||||
<wux-col span="12">
|
||||
<view>天赋【{{itemContent.name}}】发动:{{itemContent.description}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
<wux-row wx:if="{{itemContent.type == 'EVT'}}">
|
||||
<wux-col span="12">
|
||||
<view>
|
||||
{{itemContent.description}} \r\n{{itemContent.postEvent}}</view>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
</block>
|
||||
</wux-col>
|
||||
</wux-row>
|
||||
<wux-divider show-text="{{ false }}" dashed />
|
||||
</block>
|
||||
</scroll-view>
|
||||
</wux-wing-blank>
|
||||
</view>
|
||||
<wux-button block wx:if="{{isEnd}}"
|
||||
type="light" class="title2" bindtap="toSummary">
|
||||
人生总结
|
||||
</wux-button>
|
||||
</wux-wing-blank>
|
||||
</view>
|
||||
71
liferestartWX/pages/trajectory.wxss
Normal file
71
liferestartWX/pages/trajectory.wxss
Normal file
@@ -0,0 +1,71 @@
|
||||
/* miniprogram/pages/liferestart/index.wxss */
|
||||
@import '../utils/wux/styles/index.wxss';
|
||||
.container {
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
/* padding: 50rpx 100rpx; */
|
||||
box-sizing: border-box;
|
||||
background-color: #222831;
|
||||
/* color: #fff; */
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
position: static !important;
|
||||
}
|
||||
|
||||
.title1 {
|
||||
font-size: 82rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.title2 {
|
||||
font-size: 42rpx;
|
||||
color: white;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.lifeProperty{
|
||||
|
||||
width: 100%;
|
||||
position: relative;
|
||||
border: 1px #ccc solid;
|
||||
display: inline-block;
|
||||
margin: 0.1rem 2px;
|
||||
font-size: 1rem;
|
||||
text-align: center;
|
||||
border-radius: 0.2rem;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
.main {
|
||||
border-style: solid;
|
||||
border: 1px #ccc solid;
|
||||
border-width: 2px 2px;
|
||||
border-radius: 0.2rem;
|
||||
margin-top: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-top: 10px;
|
||||
font-size: 42rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
|
||||
padding: 0 10px;
|
||||
border-bottom: 1px dashed #cecece;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.index {
|
||||
flex: 1;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.desc {
|
||||
flex: 4;
|
||||
color: #fff;
|
||||
}
|
||||
Reference in New Issue
Block a user