e 1 anno fa
parent
commit
80bcb53040

+ 29 - 17
小程序/app.json

@@ -2,7 +2,9 @@
   "pages": [
     "pages/home/home",
     "pages/car/car",
-    "pages/my/my"
+    "pages/my/my",
+    "pages/detail/detail",
+    "pages/list/list"
   ],
   "window": {
     "navigationBarTextStyle": "white",
@@ -15,22 +17,32 @@
     "color": "#000000",
     "selectedColor": "#ff0000",
     "backgroundColor": "#ffffff",
-    "list": [{
-      "pagePath": "pages/home/home",
-      "text": "首页",
-      "iconPath": "/icon/home.png",
-      "selectedIconPath": "/icon/home1.png"
-    }, {
-      "pagePath": "pages/car/car",
-      "text": "购物车",
-      "iconPath": "/icon/shop.png",
-      "selectedIconPath": "/icon/shop1.png"
-    }, {
-      "pagePath": "pages/my/my",
-      "text": "我的",
-      "iconPath": "/icon/my.png",
-      "selectedIconPath": "/icon/my1.png"
-    }]
+    "list": [
+      {
+        "pagePath": "pages/home/home",
+        "text": "首页",
+        "iconPath": "/icon/home.png",
+        "selectedIconPath": "/icon/home1.png"
+      },
+      {
+        "pagePath": "pages/car/car",
+        "text": "购物车",
+        "iconPath": "/icon/shop.png",
+        "selectedIconPath": "/icon/shop1.png"
+      },
+      {
+        "pagePath": "pages/my/my",
+        "text": "我的",
+        "iconPath": "/icon/my.png",
+        "selectedIconPath": "/icon/my1.png"
+      }
+    ]
+  },
+  "networkTimeout": {
+    "request": 20000,
+    "connectSocket": 20000,
+    "uploadFile": 20000,
+    "downloadFile": 20000
   },
   "style": "v2",
   "componentFramework": "glass-easel",

+ 6 - 2
小程序/pages/car/car.js

@@ -12,9 +12,13 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-
+    wx.setStorageSync('aaa', '111')
+  },
+  goJump:function() {
+    wx.reLaunch({
+      url: '/pages/detail/detail',
+    })
   },
-
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 2 - 1
小程序/pages/car/car.wxml

@@ -2,4 +2,5 @@
 <text>购物车</text>
 <import src="/pages/home/home"/>
 <template is="news" data="{{holiday:'假期'}}" />
-<header></header>
+<header></header>
+<button bind:tap="goJump">跳转</button>

+ 66 - 0
小程序/pages/detail/detail.js

@@ -0,0 +1,66 @@
+// pages/detail/detail.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 3 - 0
小程序/pages/detail/detail.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 4 - 0
小程序/pages/detail/detail.wxml

@@ -0,0 +1,4 @@
+<!--pages/detail/detail.wxml-->
+<view>
+  详情页
+</view>

+ 1 - 0
小程序/pages/detail/detail.wxss

@@ -0,0 +1 @@
+/* pages/detail/detail.wxss */

+ 14 - 0
小程序/pages/home/home.js

@@ -42,6 +42,20 @@ Page({
     this.setData({
       inputVaue: event.detail.value
     })
+  },
+  goList:function() {
+    console.log("跳转")
+    // wx.navigateTo({
+    //   url: '/pages/list/list',
+    // })
+    wx.redirectTo({
+      url: '/pages/list/list',
+    })
+  },
+  goShop:function() {
+    wx.switchTab({
+      url: '/pages/car/car',
+    })
   },
     /**
    * 生命周期函数--监听页面加载

+ 4 - 1
小程序/pages/home/home.wxml

@@ -37,4 +37,7 @@
    <template name="news">
       <view>{{holiday}}</view>
    </template>
-</view>
+</view>
+
+<view bind:tap="goList">去列表</view>
+<button bind:tap="goShop">去购物</button>

+ 70 - 0
小程序/pages/list/list.js

@@ -0,0 +1,70 @@
+// pages/list/list.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+  goBack:function(){
+    wx.navigateBack({
+      delta: 1
+    })
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 3 - 0
小程序/pages/list/list.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 3 - 0
小程序/pages/list/list.wxml

@@ -0,0 +1,3 @@
+<!--pages/list/list.wxml-->
+<view>列表页</view>
+<button bind:tap="goBack">返回</button>

+ 1 - 0
小程序/pages/list/list.wxss

@@ -0,0 +1 @@
+/* pages/list/list.wxss */

+ 12 - 3
小程序/pages/my/my.js

@@ -36,14 +36,23 @@ Page({
         id:3,
         urls:'/icon/shop.png'
       }
-    ]
+    ],
+    other:""
   },
-
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-
+    this.setData({
+      other:wx.getStorageSync('aaa')
+    })
+    // wx.showToast("提示")
+  },
+  goList:function() {
+    console.log("跳转")
+    wx.navigateTo({
+      url: '/pages/list/list',
+    })
   },
 
   /**

+ 4 - 2
小程序/pages/my/my.wxml

@@ -33,6 +33,8 @@
     </scroll-view>
   </view>
   <view class="right">
-    右侧
+    右侧{{other}}
   </view>
-</view>
+</view>
+<navigator url="../detail/detail">去详情</navigator>
+<view bind:tap="goList">去列表</view>

+ 7 - 0
小程序/project.private.config.json

@@ -7,6 +7,13 @@
   "condition": {
     "miniprogram": {
       "list": [
+        {
+          "name": "",
+          "pathName": "pages/list/list",
+          "query": "",
+          "launchMode": "default",
+          "scene": null
+        },
         {
           "name": "",
           "pathName": "pages/car/car",

+ 37 - 0
小程序/utils/request.js

@@ -0,0 +1,37 @@
+function request(url, data = {}, method = "GET") {
+  return new Promise(function(resolve, reject) {
+    wx.request({
+      url: url,
+      data: data,
+      method: method,
+      header: {
+        'Content-Type': 'application/json',
+        'X-Dts-Token': wx.getStorageSync('token')
+      },
+      success: function(res) {
+        if (res.statusCode == 200) {
+          if (res.data.errno == 501) {
+            // 清除登录相关内容
+            try {
+              wx.removeStorageSync('userInfo');
+              wx.removeStorageSync('token');
+            } catch (e) {
+              // Do something when catch error
+            }
+            // 切换到登录页面
+            wx.navigateTo({
+              url: '/pages/auth/login/login'
+            });
+          } else {
+            resolve(res.data);
+          }
+        } else {
+          reject(res.errMsg);
+        }
+      },
+      fail: function(err) {
+        reject(err)
+      }
+    })
+  });
+}