Commit 0a183e26 authored by hewenhao's avatar hewenhao

feat: 添加到桌面引导

parent c7fd9ab4
......@@ -118,5 +118,17 @@
"w": 108,
"h": 108,
"ossName": "/pk-math/3NiaMjtuvnppeLtzizUhqeGPmX5T/108x108"
},
"close.png": {
"u": "https://cdn.jkwljy.com/pk-math/4N4KWyfAypYaCbVYVbgLxrmHcNcD/48x48",
"w": 48,
"h": 48,
"ossName": "/pk-math/4N4KWyfAypYaCbVYVbgLxrmHcNcD/48x48"
},
"finger.png": {
"u": "https://cdn.jkwljy.com/pk-math/2iYKx8hQzXQQgwD5DSjHuQGV97LA/32x32",
"w": 32,
"h": 32,
"ossName": "/pk-math/2iYKx8hQzXQQgwD5DSjHuQGV97LA/32x32"
}
}
......@@ -100,5 +100,15 @@ export default {
"u": "https://cdn.jkwljy.com/pk-math/3NiaMjtuvnppeLtzizUhqeGPmX5T/108x108",
"w": 108,
"h": 108
},
"close.png": {
"u": "https://cdn.jkwljy.com/pk-math/4N4KWyfAypYaCbVYVbgLxrmHcNcD/48x48",
"w": 48,
"h": 48
},
"finger.png": {
"u": "https://cdn.jkwljy.com/pk-math/2iYKx8hQzXQQgwD5DSjHuQGV97LA/32x32",
"w": 32,
"h": 32
}
} as const
......@@ -42,6 +42,76 @@
}
}
.guide {
position: absolute;
left: 0;
top: 0;
right: 0;
width: 750px;
display: flex;
align-items: center;
height: 48px;
font-size: 24px;
font-weight: 500;
color: #F0F2F9;
background: rgba(0,0,0,0.6);
padding-left: 20px;
z-index: 20;
box-sizing: border-box;
.guideText {
flex: 1;
white-space: nowrap;
}
.finger {
width: 32px;
height: 32px;
transform: translateX(-50%);
animation-name: updown;
animation-timing-function: ease-out;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-delay: 0s;
}
.guideRight {
display: flex;
align-items: center;
flex-shrink: 0;
padding-right: 12px;
box-sizing: border-box;
justify-content: space-between;
}
.close {
width: 48px;
height: 48px;
}
.dot {
width: 16px;
height: 16px;
background: #FF5E5E;
border: 2px solid #FFFFFF;
box-sizing: border-box;
border-radius: 8px;
margin-right: 8px;
}
}
@keyframes updown {
0% {
transform: translateY(-4px) translateX(-50%);
}
50% {
transform: translateY(4px) translateX(-50%);
}
100% {
transform: translateY(-4px) translateX(-50%);
}
}
.bgTopWrap {
position: relative;
......
import { View, Text, Image } from '@tarojs/components'
import assetsMainNext from '@/assets/oss/assets-main-next'
import { getMenuButtonBoundingClientRect, getSystemInfoSync } from '@tarojs/taro'
import { useMemo } from 'react'
import styles from './chapter.module.scss'
const MainHeader = () => {
const nav = useMemo(getMenuButtonBoundingClientRect, [])
const sys = useMemo(getSystemInfoSync, [])
const guideStyle = useMemo(() => {
return {
width: `${nav.width + sys.windowWidth - nav.right}px`
}
}, [nav, sys])
const fingerStyle = useMemo(() => {
return {
marginLeft: `${nav.width / 4}px`
}
}, [nav])
return (
<>
<View className={styles.bgTopWrap}>
......@@ -16,6 +33,14 @@ const MainHeader = () => {
地心历险记
</View>
</View>
<View className={styles.guide}>
<View className={styles.dot}></View>
<View className={styles.guideText}>保存【PKMath】到桌面,下次练习更方便。</View>
<View className={styles.guideRight} style={guideStyle}>
<Image src={assetsMainNext['finger.png'].u} className={styles.finger} style={fingerStyle}></Image>
<Image src={assetsMainNext['close.png'].u} className={styles.close}></Image>
</View>
</View>
<View className={styles.pk}>
<View className={styles.dot}></View>
......
......@@ -13,6 +13,10 @@ export interface GuideModel {
groupGuideActive: boolean;
/** 学分小店引导激活 */
storeGuideActive: boolean;
/** 添加到桌面引导 */
addDeskGuideActive: boolean;
updateStoreGuideActive: Action<GuideModel, boolean>;
updateGuideActive: Action<GuideModel, boolean>;
updateGroupGuideActive: Action<GuideModel, boolean>;
......@@ -25,6 +29,8 @@ export interface GuideModel {
/** 完成学分小店引导 */
isStoreGuideComplete: boolean | null;
isAddDeskTopGuideComplete: boolean | null;
storeGuideStep: number;
groupGuideStep: number;
nextStoreGuide: Action<GuideModel, number | void>;
......@@ -32,6 +38,7 @@ export interface GuideModel {
nextGroupGuide: Action<GuideModel>;
pointToCardNum: number;
completeAddDeskGuide: Thunk<GuideModel, void, void, AppStoreModel>;
completeStoreGuide: Thunk<GuideModel, void, void, AppStoreModel>;
completeGroupGuide: Thunk<GuideModel, void, void, AppStoreModel>;
completeMainGuide: Thunk<GuideModel, void, void, AppStoreModel>;
......@@ -42,9 +49,12 @@ const guideModel: GuideModel = {
groupGuideActive: false,
mainGuideActive: false,
storeGuideActive: false,
addDeskGuideActive: false,
groupGuideStep: 0,
storeGuideStep: 0,
pointToCardNum: 0,
isAddDeskTopGuideComplete: getStorage(StorageKeys.isAddDeskTopGuideComplete),
isStoreGuideComplete: getStorage(StorageKeys.isStoreGuideComplete),
isMainGuideComplete: getStorage(StorageKeys.isMainGuideComplete),
isErrQuestionGuideComplete: getStorage(StorageKeys.isErrQuestionGuideComplete),
......@@ -88,6 +98,11 @@ const guideModel: GuideModel = {
}
}),
completeAddDeskGuide: thunk(async (actions) => {
actions.updateState({ isAddDeskTopGuideComplete: true })
updateStorage(StorageKeys.isAddDeskTopGuideComplete, true)
}),
completeStoreGuide: thunk(async (actions) => {
actions.updateState({ isStoreGuideComplete: true, storeGuideStep: -1 })
updateStorage(StorageKeys.isStoreGuideComplete, true)
......
......@@ -28,6 +28,9 @@ export enum StorageKeys {
/** 学分小店引导 */
isStoreGuideComplete,
/** 添加到桌面引导 */
isAddDeskTopGuideComplete,
/** 用于强制用户走静默登录接口 */
refreshToken = 100,
}
......@@ -43,6 +46,7 @@ type Storage = {
[StorageKeys.isErrQuestionGuideComplete]: boolean | null;
[StorageKeys.isGroupGuideComplete]: boolean | null;
[StorageKeys.isStoreGuideComplete]: boolean | null;
[StorageKeys.isAddDeskTopGuideComplete]: boolean | null;
[StorageKeys.refreshToken]: string | undefined;
}
......@@ -66,6 +70,7 @@ export function reloadStore () {
StorageKeys.isErrQuestionGuideComplete,
StorageKeys.isGroupGuideComplete,
StorageKeys.isStoreGuideComplete,
StorageKeys.isAddDeskTopGuideComplete,
StorageKeys.refreshToken,
].forEach((element) => {
updateStorage(element, Taro.getStorageSync(`${storagePrefix}${element}`) ?? null)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment