'对接接口部分'
This commit is contained in:
@@ -1,60 +1,123 @@
|
||||
// index.js
|
||||
const request = require('../../utils/request')
|
||||
const ui = require('../../utils/ui')
|
||||
Page({
|
||||
|
||||
data: {
|
||||
codes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
|
||||
faq: [{
|
||||
title: '超出焊接时间',
|
||||
date: '08.04 00:48'
|
||||
},
|
||||
{
|
||||
title: '时间超长',
|
||||
date: '08.04 00:48'
|
||||
},
|
||||
{
|
||||
title: '常见问题常见问题',
|
||||
date: '08.04 00:48'
|
||||
}
|
||||
],
|
||||
knowledge: [{
|
||||
title: '超出焊接时间',
|
||||
date: '08.04 00:48'
|
||||
},
|
||||
{
|
||||
title: '时间超长',
|
||||
date: '08.04 00:48'
|
||||
},
|
||||
{
|
||||
title: '常见问题常见问题',
|
||||
date: '08.04 00:48'
|
||||
}
|
||||
]
|
||||
},
|
||||
data: {
|
||||
codes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
|
||||
codes_current_page: 1,
|
||||
codes_has_prev: false,
|
||||
codes_has_next: false,
|
||||
|
||||
// 页面跳转
|
||||
jumpPage(e) {
|
||||
let jumpType = e.currentTarget.dataset.jumptype;
|
||||
console.log(jumpType == 1);
|
||||
if(jumpType == 1){
|
||||
wx.navigateTo({
|
||||
url: "/pages/list/list?id=1"
|
||||
})
|
||||
}
|
||||
if(jumpType == 2){
|
||||
wx.navigateTo({
|
||||
url: "/pages/list/list?id=1"
|
||||
})
|
||||
}
|
||||
if(jumpType == 3){
|
||||
wx.navigateTo({
|
||||
url: "/pages/search/index"
|
||||
})
|
||||
}
|
||||
// wx.navigateTo({
|
||||
// url: this.data.category[index].url
|
||||
// })
|
||||
},
|
||||
bindFocus(e){
|
||||
console.log(e);
|
||||
codes_total_count: 0,
|
||||
codes_total_pages: 0,
|
||||
categorys: []
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
//获取接口数据
|
||||
|
||||
let that = this;
|
||||
that.GetCodes()
|
||||
that.GetIndexList()
|
||||
},
|
||||
|
||||
|
||||
GetIndexList() {
|
||||
let that = this;
|
||||
request.request({
|
||||
method: "GET",
|
||||
url: "/api.php/doc/index_category"
|
||||
}).then(res => {
|
||||
if (res.data.code === 1) {
|
||||
console.log(res.data.data);
|
||||
that.setData({
|
||||
categorys: res.data.data.data
|
||||
})
|
||||
}
|
||||
// ui.showToast(res.data.errorMsg)
|
||||
}).catch(err => {
|
||||
console.log('ERROR')
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
codesPrev() {
|
||||
let that = this;
|
||||
console.log(that.data.codes_has_prev);
|
||||
if (that.data.codes_has_prev) {
|
||||
console.log("shang");
|
||||
that.setData({
|
||||
codes_current_page: that.data.codes_current_page - 1
|
||||
})
|
||||
that.GetCodes()
|
||||
console.log("shang");
|
||||
}
|
||||
},
|
||||
codesNext() {
|
||||
let that = this;
|
||||
if (that.data.codes_has_next) {
|
||||
that.setData({
|
||||
codes_current_page: that.data.codes_current_page + 1
|
||||
})
|
||||
that.GetCodes()
|
||||
console.log("xia");
|
||||
}
|
||||
},
|
||||
GetCodes() {
|
||||
let that = this;
|
||||
request.request({
|
||||
method: "GET",
|
||||
url: "/api.php/doc/index_codes?page=" + that.data.codes_current_page + "&pageSize=16"
|
||||
}).then(res => {
|
||||
if (res.data.code === 1) {
|
||||
that.setData({
|
||||
codes: res.data.data.data,
|
||||
codes_current_page: res.data.data.current_page,
|
||||
codes_has_next: res.data.data.has_next,
|
||||
codes_has_prev: res.data.data.has_prev,
|
||||
codes_total_count: res.data.data.total_count,
|
||||
codes_total_pages: res.data.data.total_pages,
|
||||
})
|
||||
}
|
||||
// ui.showToast(res.data.errorMsg)
|
||||
}).catch(err => {
|
||||
console.log('ERROR')
|
||||
});
|
||||
},
|
||||
// 页面跳转
|
||||
jumpPage(e) {
|
||||
let jumpType = e.currentTarget.dataset.jumptype;
|
||||
// 文章id
|
||||
let aid = e.currentTarget.dataset.aid;
|
||||
// 类目id
|
||||
let cid = e.currentTarget.dataset.cid;
|
||||
console.log(jumpType == 1);
|
||||
console.log(aid);
|
||||
console.log(cid);
|
||||
// 类目
|
||||
if (jumpType == 1 && cid) {
|
||||
wx.navigateTo({
|
||||
url: "/pages/list/list?cid=" + cid
|
||||
})
|
||||
}
|
||||
if (jumpType == 2 && aid) {
|
||||
wx.navigateTo({
|
||||
url: "/pages/details/details?aid=" + aid
|
||||
})
|
||||
}
|
||||
// 搜索页面
|
||||
if (jumpType == 3) {
|
||||
wx.navigateTo({
|
||||
url: "/pages/search/index"
|
||||
})
|
||||
}
|
||||
},
|
||||
bindFocus(e) {
|
||||
console.log(e);
|
||||
}
|
||||
})
|
||||
@@ -1,66 +1,78 @@
|
||||
<index-nav-bar></index-nav-bar>
|
||||
<scroll-view style="height: 100%;overflow:hidden;" scroll-y type="list">
|
||||
<view class="container">
|
||||
<view class="header-background"></view>
|
||||
<view class="search-box">
|
||||
<view class="search">
|
||||
<view class="search_in">
|
||||
<image src="../../images/search.png"></image>
|
||||
<view style="width: 600rpx;color: #b5b5b5;" bind:tap="jumpPage" data-jumpType="3">请输入故障代码或关键词</view>
|
||||
<!-- <input type="text" bindfocus="bindFocus" bindblur="bindFocus" placeholder="请输入故障代码或关键词" /> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="container">
|
||||
<view class="header-background"></view>
|
||||
<view class="search-box">
|
||||
<view class="search">
|
||||
<view class="search_in">
|
||||
<image src="../../images/search.png"></image>
|
||||
<view style="width: 600rpx;color: #b5b5b5;" bind:tap="jumpPage" data-jumpType="3">请输入故障代码或关键词</view>
|
||||
<!-- <input type="text" bindfocus="bindFocus" bindblur="bindFocus" placeholder="请输入故障代码或关键词" /> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 故障码快速查询 -->
|
||||
<view class="quick-search-box">
|
||||
<view class="quick-search">
|
||||
<view class="section-title">故障码快速查询</view>
|
||||
<view class="code-grid">
|
||||
<block wx:for="{{codes}}" wx:key="index">
|
||||
<view class="code-button" bind:tap="jumpPage" data-jumpType="2">{{item}}</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="pagination">
|
||||
<button class="pagination-button btn-disabled">上一页</button>
|
||||
<button class="pagination-button btn-background">下一页</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 故障码快速查询 -->
|
||||
<view class="quick-search-box">
|
||||
<view class="quick-search">
|
||||
<view class="section-title">故障码快速查询</view>
|
||||
<view class="code-grid">
|
||||
<block wx:for="{{codes}}" wx:key="index">
|
||||
<view class="code-button" bind:tap="jumpPage" data-aid="{{item.id}}" data-jumpType="2">{{item.code}}</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="pagination">
|
||||
<button class="pagination-button {{codes_has_prev?'btn-background':'btn-disabled'}}" bind:tap="codesPrev">上一页</button>
|
||||
<button class="pagination-button {{codes_has_next?'btn-background':'btn-disabled'}}" bind:tap="codesNext">下一页</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<block wx:for="{{categorys}}" wx:for-index="idx" wx:for-item="itemName">
|
||||
<block wx:if="{{itemName.name != '故障相关'}}">
|
||||
<view class="group-item-box">
|
||||
<view class="group-item">
|
||||
<view class="group-item-header">
|
||||
<view class="group-item-header-tip"></view>
|
||||
<view class="group-item-header-title">常见问题解决</view>
|
||||
<view class="group-item-header-tip" bind:tap="jumpPage" data-jumpType="1">
|
||||
<view class="group-item-header-tip-txt">全部</view>
|
||||
<image class="group-item-header-tip-image" src="../../images/jt.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="group-txt-item" bind:tap="jumpPage" data-jumpType="2">
|
||||
<view class="group-txt-item-bullet"></view>
|
||||
<text class="group-txt-item-text">超出焊接时间</text>
|
||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||
</view>
|
||||
<view class="group-txt-item" bind:tap="jumpPage" data-jumpType="2">
|
||||
<view class="group-txt-item-bullet"></view>
|
||||
<text class="group-txt-item-text">超出焊接时间</text>
|
||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||
</view>
|
||||
<view class="group-txt-item" bind:tap="jumpPage" data-jumpType="2">
|
||||
<view class="group-txt-item-bullet"></view>
|
||||
<text class="group-txt-item-text">超出焊接时间</text>
|
||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||
</view>
|
||||
<view class="group-item">
|
||||
<view class="group-item-header">
|
||||
<view class="group-item-header-tip"></view>
|
||||
<view class="group-item-header-title">{{itemName.name}}</view>
|
||||
<view class="group-item-header-tip" bind:tap="jumpPage" data-cid="{{itemName.scode}}" data-jumpType="1">
|
||||
<view class="group-item-header-tip-txt">全部</view>
|
||||
<image class="group-item-header-tip-image" src="../../images/jt.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<block wx:for="{{itemName.arts}}" wx:for-index="index" wx:for-item="itemArt">
|
||||
<view class="group-txt-item" bind:tap="jumpPage" data-aid="{{itemArt.id}}" data-jumpType="2">
|
||||
<view class="group-txt-item-bullet"></view>
|
||||
<text class="group-txt-item-text">{{itemArt.title}}</text>
|
||||
<text class="group-txt-item-text-time">{{itemArt.date}}</text>
|
||||
</view>
|
||||
</block>
|
||||
<!-- <view class="group-txt-item" bind:tap="jumpPage" data-jumpType="2">
|
||||
<view class="group-txt-item-bullet"></view>
|
||||
<text class="group-txt-item-text">超出焊接时间</text>
|
||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||
</view>
|
||||
<view class="group-txt-item" bind:tap="jumpPage" data-jumpType="2">
|
||||
<view class="group-txt-item-bullet"></view>
|
||||
<text class="group-txt-item-text">超出焊接时间</text>
|
||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||
</view>
|
||||
<view class="group-txt-item" bind:tap="jumpPage" data-jumpType="2">
|
||||
<view class="group-txt-item-bullet"></view>
|
||||
<text class="group-txt-item-text">超出焊接时间</text>
|
||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||
</view> -->
|
||||
|
||||
<view class="group-item-box">
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
|
||||
<!-- <view class="group-item-box">
|
||||
<view class="group-item">
|
||||
<view class="group-item-header">
|
||||
<view class="group-item-header-tip"></view>
|
||||
@@ -86,10 +98,10 @@
|
||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
|
||||
<view class="group-item-box">
|
||||
<!-- <view class="group-item-box">
|
||||
<view class="group-item">
|
||||
<view class="group-item-header">
|
||||
<view class="group-item-header-tip"></view>
|
||||
@@ -115,10 +127,10 @@
|
||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
|
||||
<!-- <view class="group-item-box">
|
||||
<!-- <view class="group-item-box">
|
||||
<view class="group-item">
|
||||
<view class="group-item-header">
|
||||
<view class="group-item-header-tip"></view>
|
||||
@@ -146,7 +158,7 @@
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="copyright">iuu by © 2017-2024版权所有</view>
|
||||
</view>
|
||||
<view class="copyright">iuu by © 2017-2024版权所有</view>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
Reference in New Issue
Block a user