Browse Source

选择站点

zhaoxiaohai 3 years ago
parent
commit
4460064a61
4 changed files with 115 additions and 0 deletions
  1. 85 0
      pages/login/selectSite.js
  2. 4 0
      pages/login/selectSite.json
  3. 22 0
      pages/login/selectSite.scss
  4. 4 0
      pages/login/selectSite.wxml

+ 85 - 0
pages/login/selectSite.js

@@ -0,0 +1,85 @@
+// pages/login/selectSite.js
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        account_list: wx.getStorageSync('account_list')
+    },
+
+    /* 
+    wx.switchTab({
+                url: '/pages/tabbar/home/index'
+            })
+    */
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad(options) {
+        console.log(this.data.account_list)
+    },
+
+    toHome(e) {
+        const {
+            item
+        } = e.currentTarget.dataset;
+        wx.setStorageSync('userMsg', item)
+        let pages = getCurrentPages();
+        let prevPage = pages[pages.length - 2]; // 获取当前的页面栈
+        if (prevPage.__route__ == 'pages/tabbar/home/index') prevPage.refreshData(item);
+        wx.switchTab({
+            url: '/pages/tabbar/home/index'
+        })
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 4 - 0
pages/login/selectSite.json

@@ -0,0 +1,4 @@
+{
+    "navigationBarTitleText": "选择站点",
+    "usingComponents": {}
+}

+ 22 - 0
pages/login/selectSite.scss

@@ -0,0 +1,22 @@
+navigator {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    width: 690rpx;
+    height: 90rpx;
+    margin: 20rpx auto 0;
+    background-color: #ffffff;
+    border-radius: 16rpx;
+    padding: 0 30rpx;
+    box-sizing: border-box;
+
+    view {
+        font-size: 28rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+    }
+
+    .iconfont {
+        color: #CCCCCC;
+    }
+}

+ 4 - 0
pages/login/selectSite.wxml

@@ -0,0 +1,4 @@
+<navigator wx:for="{{account_list}}" url="#" data-item='{{item}}' bindtap="toHome">
+    <view>{{item.sitename}}</view>
+    <view class="iconfont icon-a-wodetiaozhuan" />
+</navigator>