ソースを参照

feat[litemall-wx, litemall-wx-api]: 增加帮助中心页面

Junling Bu 6 年 前
コミット
35b161cb84

+ 0 - 6
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallIssueService.java

@@ -16,12 +16,6 @@ public class LitemallIssueService {
     @Resource
     private LitemallIssueMapper issueMapper;
 
-    public List<LitemallIssue> query() {
-        LitemallIssueExample example = new LitemallIssueExample();
-        example.or().andDeletedEqualTo(false);
-        return issueMapper.selectByExample(example);
-    }
-
     public void deleteById(Integer id) {
         issueMapper.logicalDeleteByPrimaryKey(id);
     }

+ 1 - 1
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxGoodsController.java

@@ -105,7 +105,7 @@ public class WxGoodsController {
 		Callable<List> productListCallable = () -> productService.queryByGid(id);
 
 		// 商品问题,这里是一些通用问题
-		Callable<List> issueCallable = () -> goodsIssueService.query();
+		Callable<List> issueCallable = () -> goodsIssueService.querySelective("", 1, 4, "", "");
 
 		// 商品品牌商
 		Callable<LitemallBrand> brandCallable = ()->{

+ 45 - 0
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxIssueController.java

@@ -0,0 +1,45 @@
+package org.linlinjava.litemall.wx.web;
+
+import com.github.pagehelper.PageInfo;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.linlinjava.litemall.core.util.ResponseUtil;
+import org.linlinjava.litemall.core.validator.Order;
+import org.linlinjava.litemall.core.validator.Sort;
+import org.linlinjava.litemall.db.domain.LitemallIssue;
+import org.linlinjava.litemall.db.service.LitemallIssueService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/wx/issue")
+@Validated
+public class WxIssueController {
+    private final Log logger = LogFactory.getLog(WxIssueController.class);
+
+    @Autowired
+    private LitemallIssueService issueService;
+
+    /**
+     * 帮助中心
+     */
+    @RequestMapping("/list")
+    public Object list(String question,
+                       @RequestParam(defaultValue = "1") Integer page,
+                       @RequestParam(defaultValue = "10") Integer size,
+                       @Sort @RequestParam(defaultValue = "add_time") String sort,
+                       @Order @RequestParam(defaultValue = "desc") String order) {
+        List<LitemallIssue> issueList = issueService.querySelective(question, page, size, sort, order);
+        long total = PageInfo.of(issueList).getTotal();
+        Map<String, Object> data = new HashMap<String, Object>();
+        data.put("data", issueList);
+        data.put("count", total);
+        return ResponseUtil.ok(data);
+    }
+
+}

+ 2 - 1
litemall-wx/app.json

@@ -36,7 +36,8 @@
     "pages/groupon/myGroupon/myGroupon",
     "pages/groupon/grouponDetail/grouponDetail",
     "pages/groupon/grouponList/grouponList",
-    "pages/coupon/coupon"
+    "pages/coupon/coupon",
+    "pages/help/help"
   ],
   "window": {
     "navigationBarBackgroundColor": "#FFFFFF",

+ 1 - 0
litemall-wx/config/api.js

@@ -96,5 +96,6 @@ module.exports = {
   StorageUpload: WxApiRoot + 'storage/upload', //图片上传,
 
   UserIndex: WxApiRoot + 'user/index', //个人页面用户相关信息
+  IssueList: WxApiRoot + 'issue/list', //帮助信息
 
 };

+ 120 - 0
litemall-wx/pages/help/help.js

@@ -0,0 +1,120 @@
+var util = require('../../utils/util.js');
+var api = require('../../config/api.js');
+var app = getApp()
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    issueList: [],
+    page: 1,
+    size: 10,
+    count: 0,
+    showPage: false
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.getIssue();
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  },
+  nextPage: function (event) {
+    var that = this;
+    if (this.data.page > that.data.count / that.data.size) {
+      return true;
+    }
+
+    that.setData({
+      page: that.data.page + 1
+    });
+
+    this.getIssue();
+
+  },
+  getIssue: function () {
+
+    let that = this;
+    that.setData({
+      showPage: false,
+      issueList: []
+    });
+
+    util.request(api.IssueList, {
+      page: that.data.page,
+      size: that.data.size
+    }).then(function (res) {
+      if (res.errno === 0) {
+
+        that.setData({
+          issueList: res.data.data,
+          showPage: true,
+          count: res.data.count
+        });
+      }
+    });
+
+  },
+  prevPage: function (event) {
+    if (this.data.page <= 1) {
+      return false;
+    }
+
+    var that = this;
+    that.setData({
+      page: that.data.page - 1
+    });
+    this.getIssue();
+  }
+})

+ 3 - 0
litemall-wx/pages/help/help.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "帮助中心"
+}

+ 20 - 0
litemall-wx/pages/help/help.wxml

@@ -0,0 +1,20 @@
+<view class="container">
+
+  <view class="common-problem">
+    <view class="item" wx:for="{{issueList}}" wx:key="id">
+      <view class="question-box">
+        <text class="spot"></text>
+        <text class="question">{{item.question}}</text>
+      </view>
+      <view class="answer">
+        {{item.answer}}
+      </view>
+    </view>
+  </view>
+
+  <view class="page" wx:if="{{showPage}}">
+    <view class="prev {{ page <= 1 ? 'disabled' : ''}}" bindtap="prevPage">上一页</view>
+    <view class="next {{ (count / size) < page ? 'disabled' : ''}}" bindtap="nextPage">下一页</view>
+  </view>
+
+</view>

+ 70 - 0
litemall-wx/pages/help/help.wxss

@@ -0,0 +1,70 @@
+.common-problem {
+  width: 750rpx;
+  height: auto;
+  overflow: hidden;
+  padding: 0rpx 30rpx;
+  background: #fff;
+}
+
+.item {
+  height: auto;
+  overflow: hidden;
+  padding-bottom: 25rpx;
+}
+
+.question-box .spot {
+  float: left;
+  display: block;
+  height: 10rpx;
+  width: 10rpx;
+  background: #b4282d;
+  border-radius: 50%;
+  margin-top: 11rpx;
+}
+
+.question-box .question {
+  float: left;
+  line-height: 30rpx;
+  padding-left: 8rpx;
+  display: block;
+  font-size: 26rpx;
+  padding-bottom: 15rpx;
+  color: #303030;
+  width: 680rpx;
+
+}
+
+.answer {
+  line-height: 36rpx;
+  padding-left: 16rpx;
+  font-size: 26rpx;
+  color: #787878;
+  display: block;
+
+}
+
+
+.page{
+    width: 750rpx;
+    height: 108rpx;
+    background: #fff;
+    margin-bottom: 20rpx;
+}
+
+.page view{
+    height: 108rpx;
+    width: 50%;
+    float: left;
+    font-size: 29rpx;
+    color: #333;
+    text-align: center;
+    line-height: 108rpx;
+}
+
+.page .prev{
+    border-right: 1px solid #D9D9D9;
+}
+
+.page .disabled{
+    color: #ccc;
+}

+ 5 - 0
litemall-wx/pages/ucenter/index/index.js

@@ -196,6 +196,11 @@ Page({
       url: '/pages/about/about'
     });
   },
+  goHelp: function () {
+    wx.navigateTo({
+      url: '/pages/help/help'
+    });
+  },  
   exitLogin: function() {
     wx.showModal({
       title: '',

+ 13 - 7
litemall-wx/pages/ucenter/index/index.wxml

@@ -35,6 +35,10 @@
         <image class='user_column_item_image' src='/static/images/comment.png'></image>
         <view class='user_column_item_text'>待评价</view>
       </view>
+      <view class='user_column_item' bindtap='goAfterSale'>
+        <image class='user_column_item_image' src='/static/images/aftersale.png'></image>
+        <view class='user_column_item_text'>售后</view>
+      </view>
     </view>
   </view>
 
@@ -61,9 +65,10 @@
       <image class='user_column_item_image' src='/static/images/group.png'></image>
       <view class='user_column_item_text'>我的拼团</view>
     </view>
-    <view class='user_column_item' bindtap='goAfterSale'>
-      <image class='user_column_item_image' src='/static/images/aftersale.png'></image>
-      <view class='user_column_item_text'>售后</view>
+
+    <view class='user_column_item' bindtap='goAddress'>
+      <image class='user_column_item_image' src='/static/images/address.png'></image>
+      <view class='user_column_item_text'>地址管理</view>
     </view>
   </view>
   <view class='separate'></view>
@@ -72,14 +77,15 @@
     <view class='user_row_left'>必备工具</view>
   </view>
   <view class='user_column'>
-    <view class='user_column_item' bindtap='goAddress'>
-      <image class='user_column_item_image' src='/static/images/address.png'></image>
-      <view class='user_column_item_text'>地址管理</view>
-    </view>
+
     <button class="user_column_item_phone" open-type="getPhoneNumber" bindgetphonenumber="bindPhoneNumber">
       <image class='user_column_item_image' src='/static/images/mobile.png'></image>
       <view class='user_column_item_text'>绑定手机</view>
     </button>
+    <view class='user_column_item' bindtap='goHelp'>
+      <image class='user_column_item_image' src='/static/images/ic_menu_topic_nor.png'></image>
+      <view class='user_column_item_text'>帮助中心</view>
+    </view>
     <view class='user_column_item' bindtap='goFeedback'>
       <image class='user_column_item_image' src='/static/images/feedback.png'></image>
       <view class='user_column_item_text'>意见反馈</view>

+ 8 - 1
litemall-wx/project.config.json

@@ -258,8 +258,15 @@
 					"name": "优惠券列表",
 					"pathName": "pages/coupon/coupon",
 					"query": ""
+				},
+				{
+					"id": -1,
+					"name": "帮助中心",
+					"pathName": "pages/help/help",
+					"query": "",
+					"scene": null
 				}
 			]
 		}
 	}
-}
+}