Skip to content

Commit

Permalink
feat: 首页 UI 设计稿还原
Browse files Browse the repository at this point in the history
  • Loading branch information
arleyGuoLei committed Dec 5, 2021
1 parent fc34f87 commit 448c107
Show file tree
Hide file tree
Showing 97 changed files with 2,643 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
typings/
typings/types/wx/
File renamed without changes.
9 changes: 6 additions & 3 deletions miniprogram/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
"pages/home/home"
],
"window": {
"backgroundColor": "#FFFFFF",
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "单词天天斗",
"navigationStyle": "custom"
},
"usingComponents": {
"header": "/components/header/header"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
Expand Down
44 changes: 43 additions & 1 deletion miniprogram/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
import config from './utils/config'
import Store from 'wxministore'

import state, { State } from './utils/state'

export const store = new Store<State>({ state })

export interface IAppOption {
store: Store<State>
initEnv: () => void
initUiGlobal: () => void
}

App<IAppOption>({
globalData: {},
store,
onLaunch () {
this.initUiGlobal()
this.initEnv()
},

initUiGlobal () {
const { statusBarHeight, screenHeight, windowWidth } = wx.getSystemInfoSync()
const capsule = wx.getMenuButtonBoundingClientRect()

// 计算胶囊按钮的高度,作为头部内容区高度
const CustomBarHeight = capsule.bottom + capsule.top - statusBarHeight

store.setState({
ui: {
statusBarHeight,
screenHeight,
windowWidth,
CustomBarHeight
}
})
},

initEnv () {
const envVersion = __wxConfig.envVersion

// 开发环境 (develop):编辑器环境
// 正式环境 (release):小程序体验版 和 正式版
const env = envVersion === 'develop' ? config.cloudEnv.develop : config.cloudEnv.release
wx.cloud.init({ env, traceUser: true })
store.setState({ cloudEnv: env })
}
})
73 changes: 73 additions & 0 deletions miniprogram/app.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@import './miniprogram_npm/wxapp-animate/animate.wxss';

/* 按钮阴影 */
.shadow-lg {
box-shadow: 0rpx 4rpx 6rpx 0rpx rgba(0, 102, 204, 0.2);
}

/* 主题色按钮点击变色 */
.btn-hover {
background: rgb(131, 203, 241)!important;
}

/** 点击放大 10% */
.touch:active {
transform: scale(1.1);
}

/** 点击放大 1% */
.touch-s:active {
transform: scale(1.01);
}

/** 点击放大 2% */
.touch-m:active {
transform: scale(1.02);
}

/* ↓↓↓↓↓↓ 旋转动画,首页设置入口 和 匹配页面公用 ↓↓↓↓↓↓ */
@keyframes rotate {
from {
transform-origin: center;
transform: rotate(0);
}

to {
transform-origin: center;
transform: rotate(360deg);
}
}

@keyframes rotate-reverse {
from {
transform-origin: center;
transform: rotate(0);
}

to {
transform-origin: center;
transform: rotate(-360deg);
}
}

.rotate-reverse {
animation-name: rotate-reverse;
animation-iteration-count: infinite;
animation-timing-function: linear;
}

.rotate {
animation-name: rotate;
animation-iteration-count: infinite;
animation-timing-function: linear;
}

.time-36s {
animation-duration: 36s;
}

.time-2s {
animation-duration: 2s;
}

/* ↑↑↑↑↑↑ 旋转动画,首页设置入口 和 匹配页面公用 ↑↑↑↑↑↑ */
4 changes: 4 additions & 0 deletions miniprogram/components/header/header.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
12 changes: 12 additions & 0 deletions miniprogram/components/header/header.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { IAppOption } from './../../app'

App.Component({
options: {
addGlobalClass: true,
multipleSlots: true
},
data: {
CustomBarHeight: getApp<IAppOption>().store.$state.ui.CustomBarHeight,
StatusBarHeight: getApp<IAppOption>().store.$state.ui.statusBarHeight
}
})
5 changes: 5 additions & 0 deletions miniprogram/components/header/header.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<view class="header" style="height:{{CustomBarHeight}}px;padding-top:{{StatusBarHeight}}px;">
<view class="content" style="top:{{StatusBarHeight}}px;">
<slot name="content"></slot>
</view>
</view>
11 changes: 11 additions & 0 deletions miniprogram/components/header/header.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.header {
width: 100%;
box-sizing: border-box;
}

.content {
display: flex;
align-items: center;
width: 100%;
height: 100%;
}
Binary file added miniprogram/images/challenge-heart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-bgm-close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-bgm-open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-default-avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-finish-fail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-finish-win.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-pk-getGrade.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-pk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-random-in.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-random-out.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-tip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-video-ad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/combat-x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/home-bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/home-book.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/home-btn-ai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/home-btn-hot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/home-btn-pk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/home-btn-random.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/home-github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/home-grade.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/home-issue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/home-pikaqiu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added miniprogram/images/home-pvp.png
Binary file added miniprogram/images/home-rank.png
Binary file added miniprogram/images/home-setting.png
Binary file added miniprogram/images/home-sun.png
Binary file added miniprogram/images/home-tip.png
Binary file added miniprogram/images/home-userwords.png
Binary file added miniprogram/images/home-win.png
Binary file added miniprogram/images/home-zan.png
Binary file added miniprogram/images/loading.png
Binary file added miniprogram/images/message-close.png
Binary file added miniprogram/images/message-logo.png
Binary file added miniprogram/images/ranking-N1.png
Binary file added miniprogram/images/ranking-N2.png
Binary file added miniprogram/images/ranking-N3.png
Binary file added miniprogram/images/ranking-grade.png
Binary file added miniprogram/images/setting-right.png
Binary file added miniprogram/images/share-default-bg.png
Binary file added miniprogram/images/share-pk-bg.png
Binary file added miniprogram/images/word-countdown.png
Binary file added miniprogram/images/word-delete.png
Binary file added miniprogram/images/word-play.png
Binary file added miniprogram/images/word-share.png
Binary file added miniprogram/images/word-tip.png
Binary file added miniprogram/images/word-video-ad.png
Loading

0 comments on commit 448c107

Please sign in to comment.