Task:指引页

This commit is contained in:
linxi
2025-01-16 18:09:07 +08:00
parent c6ff84ca5d
commit 30c2d18412
4 changed files with 73 additions and 12 deletions
+5 -1
View File
@@ -6,7 +6,7 @@
</view> --> </view> -->
<view class="btn-group flex_center" :style="{bottom: functionGuideData.btnGroupPosition || '-150rpx'}"> <view class="btn-group flex_center" :style="{bottom: functionGuideData.btnGroupPosition || '-150rpx'}">
<view class="btn flex_center" @click="jump">跳过</view> <view class="btn flex_center" @click="jump">跳过</view>
<view class="btn flex_center" @click="next">{{ functionGuideData.step==maxStep ? '知道了' : '下一步' }}</view> <view class="next-btn v12-primary flex_center" @click="next">{{ functionGuideData.step==maxStep ? '知道了' : '下一步' }}</view>
</view> </view>
</view> </view>
</view> </view>
@@ -97,6 +97,10 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.next-btn {
color: #fff;
padding: 2rpx 10rpx;
}
.plus { .plus {
width: 140rpx; width: 140rpx;
height: 2rpx; height: 2rpx;
+12 -1
View File
@@ -5,7 +5,7 @@
}" }"
class="xdd-tabbar-wrap" class="xdd-tabbar-wrap"
> >
<view class="center-img" @click="switchTabFn('/pages/cloud/haveFun')"> <view class="center-img" id="quweiIcon" @click="switchTabFn('/pages/cloud/haveFun')">
<image <image
:src="webUrl + '/home/tabbar-center.png'" :src="webUrl + '/home/tabbar-center.png'"
class="img" class="img"
@@ -95,7 +95,18 @@ export default {
]] ]]
} }
}, },
mounted() {
this.getElementData('#quweiIcon')
},
methods: { methods: {
getElementData(el) {
const query = uni.createSelectorQuery().in(this)
query.select(el).boundingClientRect().exec((res)=> {
if(res[0]) {
this.$emit('getElementData', res[0])
}
})
},
/** /**
* 跳转至目标页面 * 跳转至目标页面
* type: 1-tabbar页面,2-非tabbar页面 * type: 1-tabbar页面,2-非tabbar页面
+3
View File
@@ -11,6 +11,8 @@ export default {
}, },
screenWidth: 0, screenWidth: 0,
scrollLeft: 0, scrollLeft: 0,
totalWidth: 0,
scrollViewWidth: 0,
} }
}, },
onLoad() { onLoad() {
@@ -27,6 +29,7 @@ export default {
getElementData(el, cb) { getElementData(el, cb) {
const query = uni.createSelectorQuery().in(this) const query = uni.createSelectorQuery().in(this)
query.select(el).boundingClientRect().exec((res)=> { query.select(el).boundingClientRect().exec((res)=> {
console.log(res, 'getElementData');
if(res[0]) { if(res[0]) {
cb(res[0]) cb(res[0])
} }
+53 -10
View File
@@ -48,7 +48,7 @@
<!-- 导航v9 --> <!-- 导航v9 -->
<view class="menus-wrap"> <view class="menus-wrap">
<view class="menus-bg" /> <view class="menus-bg" />
<scroll-view scroll-x :scroll-into-view="scrollView" scroll-with-animation > <scroll-view scroll-x :scroll-into-view="scrollView" class="scroll-view" scroll-with-animation @scroll="onscroll" >
<view class="menus-list"> <view class="menus-list">
<view <view
v-for="(item, index) in menus" v-for="(item, index) in menus"
@@ -338,8 +338,8 @@
@ok="handleOk" @ok="handleOk"
paddingBottom="200rpx" paddingBottom="200rpx"
/> />
<FunctionGuide :maxStep="14" :guideData="functionGuideData" ref="FunctionGuide"></FunctionGuide> <FunctionGuide :maxStep="15" :guideData="functionGuideData" ref="FunctionGuide"></FunctionGuide>
<xdd-tabbar :curr-index="0" /> <xdd-tabbar :curr-index="0" @getElementData="elementData" />
</view> </view>
</template> </template>
@@ -408,6 +408,7 @@ export default {
lotteryCanDraw: false, lotteryCanDraw: false,
videoContext: null, videoContext: null,
isPlay: true, isPlay: true,
tabIconPostion: {}
} }
}, },
onLoad() { onLoad() {
@@ -441,12 +442,31 @@ export default {
this.scrollTop = e.scrollTop this.scrollTop = e.scrollTop
}, },
methods: { methods: {
elementData(e) {
this.tabIconPostion = e
},
onscroll(e) {
console.log(e);
this.scrollViewWidth = e.detail.scrollWidth
this.getElementData(`#box-item${this.functionGuideData.step}`, res=>{
this.setFunctionGuideData({
tips: '介绍模块2,简述一下模块功能',
btnGroupPosition: '20rpx',
tipsPosition: '',
position: {
top: res.top + 'px',
left: res.left + 'px',
width: `${res.height}px`,
height: `${res.height}px`
}
})
})
},
showFunctionGuide() { showFunctionGuide() {
if(this._step == this.functionGuideData.step) return if(this._step == this.functionGuideData.step) return
this._step = this.functionGuideData.step this._step = this.functionGuideData.step
if(this.functionGuideData.step == 1) { if(this.functionGuideData.step == 1) {
this.getElementData('#step1', res=>{ this.getElementData('#step1', res=>{
console.log(res);
this.screenWidth = res.width - 20 this.screenWidth = res.width - 20
this.setFunctionGuideData({ this.setFunctionGuideData({
tips: '介绍模块1,简述一下模块功能', tips: '介绍模块1,简述一下模块功能',
@@ -462,8 +482,29 @@ export default {
}) })
}else { }else {
if(this.functionGuideData.step == 15) {
console.log(this.functionGuideData.step, 'quweiIcon');
this.setFunctionGuideData({
tips: '介绍模块2,简述一下模块功能',
btnGroupPosition: '',
tipsPosition: '',
position: {
top: this.tabIconPostion.top + 'px',
left: this.tabIconPostion.left + 'px',
width: `${this.tabIconPostion.width}px`,
height: `${this.tabIconPostion.height}px`,
}
})
return
}
this.getElementData(`#box-item${this.functionGuideData.step}`, res=>{ this.getElementData(`#box-item${this.functionGuideData.step}`, res=>{
console.log(res); this.totalWidth += res.width
if(res.left + res.width / 2 > this.screenWidth) {
this.$nextTick(()=> {
this.scrollView = `box-item${this.functionGuideData.step}`
})
return
}
this.setFunctionGuideData({ this.setFunctionGuideData({
tips: '介绍模块2,简述一下模块功能', tips: '介绍模块2,简述一下模块功能',
btnGroupPosition: '', btnGroupPosition: '',
@@ -475,9 +516,7 @@ export default {
height: `${res.height}px`, height: `${res.height}px`,
} }
}) })
this.$nextTick(()=> {
this.scrollView = `box-item${this.functionGuideData.step}`
})
}) })
} }
@@ -842,6 +881,10 @@ export default {
z-index: 5; z-index: 5;
padding: 21rpx 21rpx 0 21rpx; padding: 21rpx 21rpx 0 21rpx;
} }
.scroll-view{
background: #fff;
border-radius: 16rpx;
}
.menus-wrap { .menus-wrap {
position: relative; position: relative;
.menus-list { .menus-list {
@@ -851,14 +894,14 @@ export default {
flex-shrink: 0; flex-shrink: 0;
padding: 12rpx 24rpx; padding: 12rpx 24rpx;
border-radius: 16rpx; border-radius: 16rpx;
background-color: #fff; // background-color: #fff;
overflow-x: auto;
.item + .item { .item + .item {
// margin: 0 0 0 36rpx; // margin: 0 0 0 36rpx;
} }
.item { .item {
width: 150rpx; width: 150rpx;
padding: 10rpx 20rpx; padding: 10rpx 20rpx;
background-color: #fff;
.img { .img {
width: 86rpx; width: 86rpx;
height: 86rpx; height: 86rpx;