guhongwei 3 年之前
父节点
当前提交
bb94a43cf6
共有 9 个文件被更改,包括 99 次插入24 次删除
  1. 2 3
      app.json
  2. 1 2
      commpents/newsList/index.wxml
  3. 19 0
      pages/home/index.js
  4. 2 2
      pages/home/index.wxml
  5. 17 10
      pages/login/index.js
  6. 2 2
      pages/login/index.wxml
  7. 31 2
      pages/news/index.js
  8. 24 2
      pages/reserve/index.js
  9. 1 1
      pages/reserve/index.wxml

+ 2 - 3
app.json

@@ -1,15 +1,14 @@
 {
   "pages": [
     "pages/home/index",
-    "pages/login/index",
-   
     "pages/food/index",
     "pages/calorie/index",
     "pages/reserve/index",
     "pages/my/index",
     "pages/history/index",
     "pages/news/index",
-    "pages/news/detail"
+    "pages/news/detail",
+    "pages/login/index"
   ],
   "usingComponents": {
     "van-button": "/miniprogram_npm/vant-weapp/button/index",

+ 1 - 2
commpents/newsList/index.wxml

@@ -12,8 +12,7 @@
       </view>
     </view>
     <view class="right">
-      <image wx:if="{{item.img.length>0}}" src="{{item.img[0].url}}"></image>
-      <image wx:else src='/image/logo.png'></image>
+      <image src="{{item.url}}"></image>
     </view>
   </view>
 </view>

+ 19 - 0
pages/home/index.js

@@ -10,6 +10,8 @@ Page({
     navbarData: {
       name: '节俭会'
     },
+    background: '',
+    tenant: '',
     heat: 80,
     heatColor: {
       '0%': '#E1FFFF',
@@ -67,6 +69,23 @@ Page({
    */
   onLoad: function (options) {
     console.log(app.globalData.wxInfo);
+    wx.request({
+      url: `${app.globalData.publicUrl}/api/st/system/tenant/getTenant/${app.globalData.tenant}`,
+      method: "get",
+      header: { 'x-tenant': app.globalData.tenant },
+      data: {},
+      success: res => {
+        const { data } = res.data;
+        this.setData({ background: `${app.globalData.fileUrl}` + data.img.home })
+        this.setData({ tenant: data.name })
+      },
+      error: err => {
+        wx.showToast({
+          title: err.msg,
+          icon: 'error'
+        })
+      }
+    })
   },
 
   /**

+ 2 - 2
pages/home/index.wxml

@@ -1,6 +1,6 @@
 <nav-bar navbar-data='{{navbarData}}' needBack="{{false}}"></nav-bar>
 <view class="main" style="padding-top:{{height}}px;padding-bottom: 48px;">
-  <view class="one" style="background-image:url('/image/home/image1.jpg')">
+  <view class="one" style="background-image:url({{background}})">
     <view class="one_1">
       <view class="tit">健康均衡饮食</view>
       <view class="info">
@@ -43,7 +43,7 @@
   <view class="thr">
     <view class="thr_1">
       <text>用餐卡:</text>
-      <text>当前餐厅</text>
+      <text>{{tenant}}</text>
       <text>【早餐】</text>
     </view>
     <view class="thr_2">

+ 17 - 10
pages/login/index.js

@@ -8,7 +8,7 @@ Page({
    */
   data: {
     height: app.globalData.height * 2 + 25,
-    background: '/image/login.jpg',
+    background: '',
     form: {
       phone: '17319450324',
       password: '1'
@@ -41,15 +41,6 @@ Page({
       wx.switchTab({
         url: '/pages/home/index',
       })
-      // wx.getUserProfile({
-      //   desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
-      //   success: (res) => {
-      //     app.globalData.userInfo = res
-      //     wx.switchTab({
-      //       url: '/pages/home/index',
-      //     })
-      //   }
-      // })
     }
   },
   /**
@@ -57,6 +48,22 @@ Page({
    */
   onLoad: function (options) {
     this.initValidate()//验证规则函数
+    wx.request({
+      url: `${app.globalData.publicUrl}/api/st/system/tenant/getTenant/${app.globalData.tenant}`,
+      method: "get",
+      header: { 'x-tenant': app.globalData.tenant },
+      data: {},
+      success: res => {
+        const { data } = res.data;
+        this.setData({ background: `${app.globalData.fileUrl}` + data.img.login })
+      },
+      error: err => {
+        wx.showToast({
+          title: err.msg,
+          icon: 'error'
+        })
+      }
+    })
   },
 
   /**

+ 2 - 2
pages/login/index.wxml

@@ -4,14 +4,14 @@
   </view>
   <view class="two">
     <form bindsubmit="formSubmit">
-      <!-- <view class='content'>
+      <view class='content'>
         <view class='input'>
           <input type='number' name="phone" value="{{form.phone}}" maxlength="11" placeholder='请输入账号'></input>
         </view>
         <view class='input'>
           <input type='text' name="password" value="{{form.password}}" placeholder='请输入密码' password></input>
         </view>
-      </view> -->
+      </view>
       <view class="save">
         <button form-type="submit" size="small">微信授权登录</button>
       </view>

+ 31 - 2
pages/news/index.js

@@ -11,6 +11,7 @@ Page({
     navbarData: {
       name: '新闻'
     },
+    logo: '',
     currentTab: 0,
     // 國内新聞
     oneList: [],
@@ -40,13 +41,15 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    this.searchST();
     wx.request({
       url: `${app.globalData.publicUrl}/api/st/system/news`,
       method: "get",
       header: { 'x-tenant': app.globalData.tenant },
       data: { "type": '国内新闻' },
       success: res => {
-        this.setData({ oneList: res.data.data })
+        let data = this.dealImg(res.data.data)
+        this.setData({ oneList: data })
       },
       error: err => {
         wx.showToast({
@@ -61,7 +64,33 @@ Page({
       header: { 'x-tenant': app.globalData.tenant },
       data: { "type": '健康资讯' },
       success: res => {
-        this.setData({ twoList: res.data.data })
+        let data = this.dealImg(res.data.data)
+        this.setData({ twoList: data })
+      },
+      error: err => {
+        wx.showToast({
+          title: err.msg,
+          icon: 'error'
+        })
+      }
+    })
+  },
+  dealImg(list) {
+    for (let i of list) {
+      if (i.img && i.img.length > 0 && i.img[0]) i.url = `${app.globalData.fileUrl}${i.img[0].url}`;
+      else i.url = this.data.logo;
+    }
+    return list;
+  },
+  searchST: function () {
+    wx.request({
+      url: `${app.globalData.publicUrl}/api/st/system/tenant/getTenant/${app.globalData.tenant}`,
+      method: "get",
+      header: { 'x-tenant': app.globalData.tenant },
+      data: {},
+      success: res => {
+        const { data } = res.data;
+        this.setData({ logo: `${app.globalData.fileUrl}` + data.img.logo })
       },
       error: err => {
         wx.showToast({

+ 24 - 2
pages/reserve/index.js

@@ -18,7 +18,8 @@ Page({
     navbarData: {
       name: '报餐'
     },
-    restaurant: '当前餐厅',
+    tenant: '',
+    logo: '',
     today: '',
     // 点餐
     currentTab: 0,
@@ -171,6 +172,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    this.searchST();
     let today = moment().format('YYYY-MM-DD');
     this.setData({ today: today })
     this.searchDate();
@@ -207,10 +209,30 @@ Page({
   },
   dealImg(list) {
     for (let i of list) {
-      if (i.img && i.img.length > 0 && i.img[0]) i.url = `${app.globalData.fileUrl}${i.img[0].url}`
+      if (i.img && i.img.length > 0 && i.img[0]) i.url = `${app.globalData.fileUrl}${i.img[0].url}`;
+      else i.url = this.data.logo;
     }
     return list;
   },
+  searchST: function () {
+    wx.request({
+      url: `${app.globalData.publicUrl}/api/st/system/tenant/getTenant/${app.globalData.tenant}`,
+      method: "get",
+      header: { 'x-tenant': app.globalData.tenant },
+      data: {},
+      success: res => {
+        const { data } = res.data;
+        this.setData({ tenant: data.name });
+        this.setData({ logo: `${app.globalData.fileUrl}` + data.img.logo })
+      },
+      error: err => {
+        wx.showToast({
+          title: err.msg,
+          icon: 'error'
+        })
+      }
+    })
+  },
 
   /**
    * 生命周期函数--监听页面初次渲染完成

+ 1 - 1
pages/reserve/index.wxml

@@ -1,7 +1,7 @@
 <nav-bar navbar-data='{{navbarData}}' needBack="{{false}}"></nav-bar>
 <view class="main" style="padding-top:{{height}}px;height:{{windowHeight-height}}px">
   <view class="one">
-    <view class="one_1">您的绑定餐厅为:{{restaurant}}</view>
+    <view class="one_1">您的绑定餐厅为:{{tenant}}</view>
     <view class="one_2">
       <view>请您在前一天21点前报餐</view>
       <view>