YY 2 jaren geleden
bovenliggende
commit
6cccb08102
3 gewijzigde bestanden met toevoegingen van 69 en 9 verwijderingen
  1. 18 0
      pages/apply/detail.js
  2. 23 1
      pages/apply/index.js
  3. 28 8
      pages/market_buy/detail.js

+ 18 - 0
pages/apply/detail.js

@@ -84,9 +84,27 @@ Page({
   onLoad: function (options) {
     //验证规则函数
     this.initValidate()
+    this.watchLogin();
     // 计算高度
     this.searchHeight();
   },
+  // 监听用户是否登录
+  watchLogin: function () {
+    // wx.getStorage({
+    // key: 'user',
+    // success: res => {
+    //   if (res.data) {
+    //     // 查询菜单
+    //     if (res.data) this.searchRouter(res.data);
+    //     res.data.type = type.find((i) => i.value == res.data.type).label;
+    //     if (res.data) this.setData({ userInfo: res.data });
+    //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+    //   } else {
+    //     wx.redirectTo({ url: '/pages/login/index', })
+    //   }
+    // }
+    // })
+  },
   // 计算高度
   searchHeight: function () {
     let frameStyle = this.data.frameStyle;

+ 23 - 1
pages/apply/index.js

@@ -9,7 +9,7 @@ Page({
     // 主体高度
     infoHeight: '',
     // 采购申请
-    list: [{ user_name: '法外狂徒张三', user_phone: '12345678901', examine_date: '111', status_name: '待审', status: '2' }],
+    list: [],
     // 弹框
     dialog: { title: '详细信息', show: false, type: '1' },
     // 详细信息
@@ -34,9 +34,31 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    this.watchLogin();
     // 计算高度
     this.searchHeight();
   },
+  // 监听用户是否登录
+  watchLogin: function () {
+    let data = [
+      { user_name: '法外狂徒张三', user_phone: '12345678901', examine_date: '111', status_name: '待审', status: '2' }
+    ]
+    this.setData({ list: data })
+    // wx.getStorage({
+    // key: 'user',
+    // success: res => {
+    //   if (res.data) {
+    //     // 查询菜单
+    //     if (res.data) this.searchRouter(res.data);
+    //     res.data.type = type.find((i) => i.value == res.data.type).label;
+    //     if (res.data) this.setData({ userInfo: res.data });
+    //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+    //   } else {
+    //     wx.redirectTo({ url: '/pages/login/index', })
+    //   }
+    // }
+    // })
+  },
   // 计算高度
   searchHeight: function () {
     let frameStyle = this.data.frameStyle;

+ 28 - 8
pages/market_buy/detail.js

@@ -12,14 +12,7 @@ Page({
       infoHeight: '',
       userInfo: { id: '00038494480001', user_id: '00038494480001', name: '法外狂徒张三', phone: '1239999999' },
       // 上架的商品
-      marketList: [
-         { id: '001', name: '喜羊羊', money: '20', type_name: '羊肉', type_id: '111', brief: '一份', mech_id: '000000001', mech_name: '羊村', img_one: '', img_url: [], status: '1' },
-         { id: '002', name: '美羊羊', money: '30', type_name: '羊肉', type_id: '222', brief: '一份', mech_id: '000000001', mech_name: '羊村' },
-         { id: '003', name: '懒羊羊', money: '15', type_name: '羊肉', type_id: '333', brief: '一份', mech_id: '000000001', mech_name: '羊村' },
-         { id: '004', name: '沸羊羊', money: '25', type_name: '羊肉', type_id: '444', brief: '一份', mech_id: '000000001', mech_name: '羊村' },
-         { id: '005', name: '慢羊羊', money: '26', type_name: '羊肉', type_id: '555', brief: '一份', mech_id: '000000001', mech_name: '羊村' },
-         { id: '006', name: '暖羊羊', money: '27', type_name: '羊肉', type_id: '666', brief: '一份', mech_id: '000000001', mech_name: '羊村' }
-      ],
+      marketList: [],
       // 类型
       typeList: [],
       // 详细信息
@@ -129,9 +122,36 @@ Page({
       this.setData({ 'receiveForm.receive_user_name': this.data.userInfo.name, 'receiveForm.receive_user_id': this.data.userInfo.user_id, 'receiveForm.receive_user_phone': this.data.userInfo.phone, })
       //验证规则函数
       this.initValidate();
+      this.watchLogin();
       // 计算高度
       this.searchHeight();
    },
+   // 监听用户是否登录
+   watchLogin: function () {
+      let data = [
+         { id: '001', name: '喜羊羊', money: '20', type_name: '羊肉', type_id: '111', brief: '一份', mech_id: '000000001', mech_name: '羊村', img_one: '', img_url: [], status: '1' },
+         { id: '002', name: '美羊羊', money: '30', type_name: '羊肉', type_id: '222', brief: '一份', mech_id: '000000001', mech_name: '羊村' },
+         { id: '003', name: '懒羊羊', money: '15', type_name: '羊肉', type_id: '333', brief: '一份', mech_id: '000000001', mech_name: '羊村' },
+         { id: '004', name: '沸羊羊', money: '25', type_name: '羊肉', type_id: '444', brief: '一份', mech_id: '000000001', mech_name: '羊村' },
+         { id: '005', name: '慢羊羊', money: '26', type_name: '羊肉', type_id: '555', brief: '一份', mech_id: '000000001', mech_name: '羊村' },
+         { id: '006', name: '暖羊羊', money: '27', type_name: '羊肉', type_id: '666', brief: '一份', mech_id: '000000001', mech_name: '羊村' }
+      ]
+      this.setData({ marketList: data })
+      // wx.getStorage({
+      // key: 'user',
+      // success: res => {
+      //   if (res.data) {
+      //     // 查询菜单
+      //     if (res.data) this.searchRouter(res.data);
+      //     res.data.type = type.find((i) => i.value == res.data.type).label;
+      //     if (res.data) this.setData({ userInfo: res.data });
+      //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+      //   } else {
+      //     wx.redirectTo({ url: '/pages/login/index', })
+      //   }
+      // }
+      // })
+   },
    // 计算高度
    searchHeight: function () {
       let frameStyle = this.data.frameStyle;