微信小程序--自定義新用戶引導頁面


效果展示

在這里插入圖片描述

Demo代碼

wxml

<view class='page-cont' wx:if="{{isTiptrue}}">
  <view class='top'>
    <image src='../images/jiantou.png'></image>
    <view class='p_one'>添加「海轟Pro」小程序 堅持每天學習</view>
  </view>
  <view class='cont'>
    <view class='cont-p'>
      <view class='text'><text>1</text></view><view>點擊右上角</view>
      <image src='../images/jiaonang.jpg'></image>
    </view>
    <view class='cont-p'>
      <view class='text'><text>2</text></view><view>點擊“添加我的小程序”</view>
    </view>
    <view class='cont-p'>
      <view class='text'><text>3</text></view><view>回到微信首頁下拉聊天列表,</view>
    </view>
    <view class='cont-p-lib'>
      <view class='text' style='opacity:0;'><text>3</text></view><view>從“我的小程序”里打開“海轟Pro”</view>
    </view>
    <view class='cont-p-three'>
      <image src='../images/youjiantou.png'></image>
      <view class='right' style=' no-repeat center; background-size: 100% 100%;'>
          <view class='left-p'>
            <view class='title'>我的小程序</view>
            <image src='../images/touxiang.jpg'></image>海轟Pro</view>
          <view class='left-p'>
            <view class='title' style='opacity:0;'>我的小程序</view>
            <view style='color:#4C4C4E;width:27px;height:27px;border-radius:50%;background:#4C4C4E;'></view>小程序</view>
      </view>
    </view>
  </view>
  <view class='bottom' bindtap='closeThis'>記住了  我去試試</view>
</view>
<view wx:else>
測試界面
</view>

js

//index.js
//獲取應用實例
const app = getApp()

Page({
  data:{
    isTiptrue: true,
  },
  onLoad: function (query) {
      let firstOpen = wx.getStorageSync("loadOpen")
      console.log("是否首次打開本頁面==",firstOpen)
      if (firstOpen == undefined || firstOpen == '') { //根據緩存周期決定是否顯示新手引導
        this.setData({
          isTiptrue: true,
        })
      } else {
        this.setData({
          isTiptrue: false,
        })
      }
   },
  closeThis(e){
    console.log("s")
      wx.setStorage({
        key: 'loadOpen',
        data: 'OpenTwo'
      })
      this.setData({
        isTiptrue:false
      })
    },
})

wxss

完整源碼獲取途徑
見文末引言


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM