Skip to content

Commit

Permalink
feat: 关于页面
Browse files Browse the repository at this point in the history
  • Loading branch information
arleyGuoLei committed Feb 20, 2022
1 parent 3e8631b commit 131d49a
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 6 deletions.
3 changes: 2 additions & 1 deletion miniprogram/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"pages/learning/learning",
"pages/review/review",
"pages/ranking/ranking",
"pages/setting/setting"
"pages/setting/setting",
"pages/about/about"
],
"window": {
"backgroundColor": "#FFFFFF",
Expand Down
1 change: 1 addition & 0 deletions miniprogram/models/kv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface AppConfig {
/** 对战背景音乐 */
backgroundMusicUrl: string
wechat: string
about: string
}

export interface IKV {
Expand Down
8 changes: 8 additions & 0 deletions miniprogram/pages/about/about.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"usingComponents": {},
"navigationStyle": "default",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTitleText": "关于",
"backgroundColor": "#f8f8f8"
}
1 change: 1 addition & 0 deletions miniprogram/pages/about/about.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
App.Page({})
3 changes: 3 additions & 0 deletions miniprogram/pages/about/about.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<view class="rich-content">
<rich-text nodes="{{$state.appConfig.about}}" />
</view>
4 changes: 4 additions & 0 deletions miniprogram/pages/about/about.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.rich-content {
box-sizing: border-box;
padding: 16rpx 32rpx;
}
2 changes: 1 addition & 1 deletion miniprogram/pages/home/components/footer/footer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ App.Component({
void app.routes.pages.ranking.go({})
},
onAbout () {

void app.routes.pages.about.go({})
}
}
})
6 changes: 4 additions & 2 deletions miniprogram/pages/setting/setting.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import config from './../../utils/config'
import userModel from './../../models/user'
import userWordModel from './../../models/userWord'
import { store } from './../../app'
import { store, IAppOption } from './../../app'
import { getUserInfo } from './../../utils/helper'

const app = getApp<IAppOption>()

App.Page({
onSelect (event: WechatMiniprogram.BaseEvent<WechatMiniprogram.IAnyObject, {type: 'combatQuestionNumber' | 'backgroundMusic' | 'pronounce' | 'vibrate'} >) {
const { type } = event.currentTarget.dataset
Expand Down Expand Up @@ -67,6 +69,6 @@ App.Page({
void wx.setClipboardData({ data: store.$state.appConfig.wechat })
},
onAbout () {

void app.routes.pages.about.go({})
}
})
5 changes: 4 additions & 1 deletion miniprogram/utils/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export const routesConfig = [
{ path: '/combat', route: '/pages/combat/combat' },
{ path: '/review', route: '/pages/review/review' },
{ path: '/ranking', route: '/pages/ranking/ranking' },
{ path: '/setting', route: '/pages/setting/setting' }
{ path: '/setting', route: '/pages/setting/setting' },
{ path: '/about', route: '/pages/about/about' }
]

export interface ICombatRoute {
Expand Down Expand Up @@ -43,6 +44,8 @@ export interface IRoutes {
ranking: Route<{}>
/** 设置页 */
setting: Route<{}>
/** 关于 */
about: Route<{}>
}
}

Expand Down
3 changes: 2 additions & 1 deletion miniprogram/utils/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ const state: State = {
learning: null,
appConfig: {
backgroundMusicUrl: '',
wechat: '34805850'
wechat: '34805850',
about: ''
}
}

Expand Down
6 changes: 6 additions & 0 deletions project.private.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
"pathName": "pages/setting/setting",
"query": "",
"scene": null
},
{
"name": "关于",
"pathName": "pages/about/about",
"query": "",
"scene": null
}
]
}
Expand Down

0 comments on commit 131d49a

Please sign in to comment.