柒零 1 год назад
Родитель
Сommit
6db56fd930

+ 3 - 1
app.json

@@ -19,7 +19,9 @@
         "myMattress/myMattress",
         "addMattresses/addMattresses",
         "constitutionDiagnosis/constitutionDiagnosis",
-        "detectionResult/detectionResult"
+        "detectionResult/detectionResult",
+        "helpList/helpList",
+        "helpDetails/helpDetails"
       ]
     }
   ],

+ 1 - 1
pages/index/index.js

@@ -80,7 +80,7 @@ Page({
       icon: "../../static/mine/bzzx.png",
       title: "帮助中心",
       type: "navigate",
-      url: ""
+      url: "/subpages/helpList/helpList"
     }, {
       icon: "../../static/mine/gywm.png",
       title: "关于我们",

+ 7 - 0
project.private.config.json

@@ -10,6 +10,13 @@
   "condition": {
     "miniprogram": {
       "list": [
+        {
+          "name": "subpages/helpList/helpList",
+          "pathName": "subpages/helpList/helpList",
+          "query": "",
+          "launchMode": "default",
+          "scene": null
+        },
         {
           "name": "subpages/constitutionDiagnosis/constitutionDiagnosis",
           "pathName": "subpages/constitutionDiagnosis/constitutionDiagnosis",

+ 95 - 0
subpages/helpDetails/helpDetails.js

@@ -0,0 +1,95 @@
+// subpages/helpDetails/helpDetails.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    helarcid: '',
+    mDetails: { content :""}
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    if (options.id) {
+      this.setData({
+        helarcid:options.id
+      })
+      this.getDetails()
+    }
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  },
+  getDetails() {
+    const that = this;
+    wx.request({
+      url: 'https://aipush.aidsleep.cn/helarcdetail',
+      method: 'POST',
+      data: {
+        tokens: "aa9ebf8360ec36bd0f6cc950b9e2f45e282ae1f93f5d3c56f2ffa6984cd22c66" || wx.getStorageSync('token'),
+        udi: wx.getStorageSync('unionid'),
+        helarcid: that.data.helarcid
+      },
+      success: (res) => {
+        // console.log(res.data);
+        var data = res.data.length ? res.data[0] : {};
+        console.log(data);
+        this.setData({
+          mDetails: data
+        })
+      },
+      fail: () => {
+      }
+    });
+  },
+})

+ 6 - 0
subpages/helpDetails/helpDetails.json

@@ -0,0 +1,6 @@
+{
+  "usingComponents": {},
+  "navigationBarBackgroundColor": "#ffffff",
+  "navigationBarTextStyle": "black",
+  "navigationBarTitleText": "帮助中心"
+}

+ 9 - 0
subpages/helpDetails/helpDetails.wxml

@@ -0,0 +1,9 @@
+<!--subpages/helpDetails/helpDetails.wxml-->
+<view>
+    <view class="card">
+        <text class="title">{{mDetails.title}}</text>
+        <view class="rich-content">
+            <rich-text nodes="{{mDetails.content}}" user-select="{{true}}"></rich-text>
+        </view>
+    </view>
+</view>

+ 30 - 0
subpages/helpDetails/helpDetails.wxss

@@ -0,0 +1,30 @@
+/* subpages/helpDetails/helpDetails.wxss */
+page {
+    background: #F8F9FA;
+}
+
+.card {
+    width: 690rpx;
+    margin: 30rpx;
+    background: #FFFFFF;
+    border-radius: 24rpx;
+    display: flex;
+    flex-direction: column;
+}
+
+.title {
+    margin: 0 auto;
+    padding: 30rpx 0;
+    width: 630rpx;
+    border-bottom: 1rpx solid #E8E8E8;
+    font-size: 28rpx;
+    color: #333333;
+}
+
+.rich-content {
+    margin: 0 auto;
+    padding: 30rpx 0;
+    width: 630rpx;
+    font-size: 24rpx;
+    color: #666666;
+}

+ 130 - 0
subpages/helpList/helpList.js

@@ -0,0 +1,130 @@
+// subpages/helpList/helpList.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    mCateList: []
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    this.getCateList();
+
+  },
+  onClickLeft() {
+    wx.navigateBack();
+  },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  },
+  toDetails(e) {
+    // "helpDetails/helpDetails"
+    console.log(e.currentTarget.dataset.item);
+    wx.navigateTo({
+      url: `/subpages/helpDetails/helpDetails?id=` + e.currentTarget.dataset.item.arcid
+    })
+  },
+  getCateList() {
+    const that = this;
+    wx.request({
+      url: 'https://aipush.aidsleep.cn/allhelcatelist',
+      method: 'POST',
+      data: {
+        tokens: "aa9ebf8360ec36bd0f6cc950b9e2f45e282ae1f93f5d3c56f2ffa6984cd22c66" || wx.getStorageSync('token'),
+        udi: wx.getStorageSync('unionid')
+      },
+      success: async (res) => {
+
+        console.log(res.data);
+        // ""
+        if (res.data) {
+          var tempList = res.data || [];
+          for (let i = 0; i < tempList.length; i++) {
+            const element = tempList[i];
+            element.icon = `https://aipush.aidsleep.cn/assets/helpics/${element.icon}`;
+            that.getList(tempList, i, element.cid)
+          }
+          // [{"cid":11,"name":"房间控制","icon":"all_67362a14b131f.png","subList":"[]"}]
+          // console.log("tempList=>", JSON.stringify(tempList));
+          // console.log("tempList=>", tempList);
+          setTimeout(() => {
+            that.setData({
+              mCateList: tempList
+            })
+          }, 250 * tempList.length);
+
+        }
+
+      },
+      fail: () => {
+      }
+    });
+  },
+  getList(mList = [], index = 0, helcid) {
+    const that = this;
+    wx.request({
+      url: 'https://aipush.aidsleep.cn/allhelarclist',
+      method: 'POST',
+      data: {
+        tokens: "aa9ebf8360ec36bd0f6cc950b9e2f45e282ae1f93f5d3c56f2ffa6984cd22c66" || wx.getStorageSync('token'),
+        udi: wx.getStorageSync('unionid'),
+        helcid
+      },
+      success: (res) => {
+        // console.log(res.data);
+        mList[index]['subList'] = res.data || [];
+      },
+      fail: () => {
+      }
+    });
+  },
+})

+ 4 - 0
subpages/helpList/helpList.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationStyle": "custom"
+}

+ 23 - 0
subpages/helpList/helpList.wxml

@@ -0,0 +1,23 @@
+<!--subpages/helpList/helpList.wxml-->
+<view class="page">
+    <image class="help-bg" src="/subpages/images/help_bg.png"></image>
+    <van-nav-bar title="" left-text="" custom-class="nav-bar" bind:click-left="onClickLeft">
+        <van-icon name="arrow-left" slot="left" />
+    </van-nav-bar>
+
+    <view class="list">
+        <view class="item-card" wx:for="{{mCateList}}" wx:key="index">
+            <view class="h-view" style="margin-top: 30rpx;margin-bottom: 20rpx;">
+                <image class="menu-icon" src="{{item.icon}}" />
+                <text class="menu-title">{{item.name}}</text>
+            </view>
+            <view class="item" wx:for="{{item.subList}}" wx:for-item="subItem" wx:for-index="subIndex"
+                data-item="{{subItem}}" bindtap="toDetails">
+                <text class="item-title">{{subItem.title}}</text>
+                <van-icon name="arrow" color="#999999" size="26rpx" />
+            </view>
+
+        </view>
+    </view>
+
+</view>

+ 84 - 0
subpages/helpList/helpList.wxss

@@ -0,0 +1,84 @@
+/* subpages/helpList/helpList.wxss */
+
+page {
+    background: #F8F9FA;
+    display: flex;
+    flex-direction: column;
+    position: relative;
+}
+
+.help-bg {
+    position: absolute;
+    z-index: -1;
+    width: 100vw;
+    display: block;
+}
+
+.nav-bar {
+    background: transparent !important;
+}
+
+
+
+.list {
+    margin-top: 100rpx;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    width: 100vw;
+    margin-bottom: 24rpx;
+}
+
+.item-card {
+    margin-top: 24rpx;
+    display: flex;
+    flex-direction: column;
+    width: 690rpx;
+    background: #FFFFFF;
+    border-radius: 24rpx;
+
+}
+
+.h-view {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+}
+
+.menu-icon {
+    display: block;
+    margin-left: 30rpx;
+    width: 64rpx;
+    height: 64rpx;
+
+}
+
+.menu-title {
+    font-size: 28rpx;
+    margin-left: 20rpx;
+    color: #333333;
+}
+
+.item {
+    width: 630rpx;
+    margin-left: 30rpx;
+    display: flex;
+    height: 96rpx;
+    flex-direction: row;
+    align-items: center;
+    border-bottom: 1rpx solid #E8E8E8;
+}
+
+.item:active {
+    opacity: 0.7;
+}
+
+.item:last-child {
+    border: 0;
+}
+
+.item-title {
+    flex: 1;
+    font-size: 26rpx;
+    color: #333333;
+}

BIN
subpages/images/help_bg.png