'对接接口部分'
This commit is contained in:
@@ -1,58 +1,121 @@
|
|||||||
// index.js
|
// index.js
|
||||||
|
const request = require('../../utils/request')
|
||||||
|
const ui = require('../../utils/ui')
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
data: {
|
data: {
|
||||||
codes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
|
codes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
|
||||||
faq: [{
|
codes_current_page: 1,
|
||||||
title: '超出焊接时间',
|
codes_has_prev: false,
|
||||||
date: '08.04 00:48'
|
codes_has_next: false,
|
||||||
},
|
|
||||||
{
|
codes_total_count: 0,
|
||||||
title: '时间超长',
|
codes_total_pages: 0,
|
||||||
date: '08.04 00:48'
|
categorys: []
|
||||||
},
|
|
||||||
{
|
|
||||||
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'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
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) {
|
jumpPage(e) {
|
||||||
let jumpType = e.currentTarget.dataset.jumptype;
|
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(jumpType == 1);
|
||||||
if(jumpType == 1){
|
console.log(aid);
|
||||||
|
console.log(cid);
|
||||||
|
// 类目
|
||||||
|
if (jumpType == 1 && cid) {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: "/pages/list/list?id=1"
|
url: "/pages/list/list?cid=" + cid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(jumpType == 2){
|
if (jumpType == 2 && aid) {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: "/pages/list/list?id=1"
|
url: "/pages/details/details?aid=" + aid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 搜索页面
|
||||||
if (jumpType == 3) {
|
if (jumpType == 3) {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: "/pages/search/index"
|
url: "/pages/search/index"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// wx.navigateTo({
|
|
||||||
// url: this.data.category[index].url
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
bindFocus(e) {
|
bindFocus(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|||||||
@@ -18,12 +18,12 @@
|
|||||||
<view class="section-title">故障码快速查询</view>
|
<view class="section-title">故障码快速查询</view>
|
||||||
<view class="code-grid">
|
<view class="code-grid">
|
||||||
<block wx:for="{{codes}}" wx:key="index">
|
<block wx:for="{{codes}}" wx:key="index">
|
||||||
<view class="code-button" bind:tap="jumpPage" data-jumpType="2">{{item}}</view>
|
<view class="code-button" bind:tap="jumpPage" data-aid="{{item.id}}" data-jumpType="2">{{item.code}}</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<view class="pagination">
|
<view class="pagination">
|
||||||
<button class="pagination-button btn-disabled">上一页</button>
|
<button class="pagination-button {{codes_has_prev?'btn-background':'btn-disabled'}}" bind:tap="codesPrev">上一页</button>
|
||||||
<button class="pagination-button btn-background">下一页</button>
|
<button class="pagination-button {{codes_has_next?'btn-background':'btn-disabled'}}" bind:tap="codesNext">下一页</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -31,18 +31,26 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<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-box">
|
||||||
<view class="group-item">
|
<view class="group-item">
|
||||||
<view class="group-item-header">
|
<view class="group-item-header">
|
||||||
<view class="group-item-header-tip"></view>
|
<view class="group-item-header-tip"></view>
|
||||||
<view class="group-item-header-title">常见问题解决</view>
|
<view class="group-item-header-title">{{itemName.name}}</view>
|
||||||
<view class="group-item-header-tip" bind:tap="jumpPage" data-jumpType="1">
|
<view class="group-item-header-tip" bind:tap="jumpPage" data-cid="{{itemName.scode}}" data-jumpType="1">
|
||||||
<view class="group-item-header-tip-txt">全部</view>
|
<view class="group-item-header-tip-txt">全部</view>
|
||||||
<image class="group-item-header-tip-image" src="../../images/jt.png"></image>
|
<image class="group-item-header-tip-image" src="../../images/jt.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="group-txt-item" bind:tap="jumpPage" data-jumpType="2">
|
<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>
|
<view class="group-txt-item-bullet"></view>
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
<text class="group-txt-item-text">超出焊接时间</text>
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||||
@@ -56,11 +64,15 @@
|
|||||||
<view class="group-txt-item-bullet"></view>
|
<view class="group-txt-item-bullet"></view>
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
<text class="group-txt-item-text">超出焊接时间</text>
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="group-item-box">
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <view class="group-item-box">
|
||||||
<view class="group-item">
|
<view class="group-item">
|
||||||
<view class="group-item-header">
|
<view class="group-item-header">
|
||||||
<view class="group-item-header-tip"></view>
|
<view class="group-item-header-tip"></view>
|
||||||
@@ -86,10 +98,10 @@
|
|||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
|
|
||||||
<view class="group-item-box">
|
<!-- <view class="group-item-box">
|
||||||
<view class="group-item">
|
<view class="group-item">
|
||||||
<view class="group-item-header">
|
<view class="group-item-header">
|
||||||
<view class="group-item-header-tip"></view>
|
<view class="group-item-header-tip"></view>
|
||||||
@@ -115,7 +127,7 @@
|
|||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
<text class="group-txt-item-text-time">08.04 00:48</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
|
|
||||||
<!-- <view class="group-item-box">
|
<!-- <view class="group-item-box">
|
||||||
|
|||||||
@@ -1,16 +1,82 @@
|
|||||||
// pages/list/list.js
|
// pages/list/list.js
|
||||||
|
const request = require('../../utils/request')
|
||||||
|
const ui = require('../../utils/ui')
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
|
categoryName: "",
|
||||||
|
categoryId: 0,
|
||||||
|
total_count: 0,
|
||||||
|
total_pages: 0,
|
||||||
|
has_next: false,
|
||||||
|
has_next: false,
|
||||||
|
current_page: 1,
|
||||||
|
list: []
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
let that = this;
|
||||||
|
if (!options.cid) {
|
||||||
|
wx.navigateBack()
|
||||||
|
this.triggerEvent('onBack')
|
||||||
|
}
|
||||||
|
that.setData({
|
||||||
|
categoryId: options.cid
|
||||||
|
})
|
||||||
|
that.GetCategoryInfo()
|
||||||
|
that.GetList()
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
GetCategoryInfo() {
|
||||||
|
let that = this;
|
||||||
|
request.request({
|
||||||
|
method: "GET",
|
||||||
|
url: "/api.php/doc/category_info?cid=" + that.data.categoryId
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data.code === 1) {
|
||||||
|
that.setData({
|
||||||
|
categoryName: res.data.data.data.name,
|
||||||
|
categoryId: res.data.data.data.scode,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('ERROR')
|
||||||
|
});
|
||||||
|
},
|
||||||
|
GetList() {
|
||||||
|
let that = this;
|
||||||
|
request.request({
|
||||||
|
method: "GET",
|
||||||
|
url: "/api.php/doc/list?cid=" + that.data.categoryId + "&pageSize=16"
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data.code === 1) {
|
||||||
|
that.setData({
|
||||||
|
list: res.data.data.data,
|
||||||
|
current_page: res.data.data.current_page,
|
||||||
|
has_next: res.data.data.has_next,
|
||||||
|
has_prev: res.data.data.has_prev,
|
||||||
|
total_count: res.data.data.total_count,
|
||||||
|
total_pages: res.data.data.total_pages,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// ui.showToast(res.data.errorMsg)
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('ERROR')
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
jumpPage(e) {
|
jumpPage(e) {
|
||||||
|
|
||||||
let jumpType = e.currentTarget.dataset.jumptype;
|
let jumpType = e.currentTarget.dataset.jumptype;
|
||||||
console.log(jumpType == 2);
|
console.log(jumpType == 2);
|
||||||
if (jumpType == 2) {
|
if (jumpType == 2) {
|
||||||
@@ -18,19 +84,52 @@ Page({
|
|||||||
url: "/pages/details/details?id=1"
|
url: "/pages/details/details?id=1"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// wx.navigateTo({
|
|
||||||
// url: this.data.category[index].url
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 页面上拉触底事件的处理函数
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onReachBottom() {
|
||||||
|
console.log(111);
|
||||||
|
// if (this.data.has_next) {
|
||||||
|
// that.setData({
|
||||||
|
// current_page: this.current_page + 1
|
||||||
|
// })
|
||||||
|
// //加载下一页
|
||||||
|
// this.GetList();
|
||||||
|
// } else {
|
||||||
|
// ui.showToast({
|
||||||
|
// icon: "none",
|
||||||
|
// title: '没有更多数据了'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
loadData: function () {
|
||||||
|
wx.request({
|
||||||
|
url: 'http://test.com', //假的后台接口
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
pageSize: this.pageSize,
|
||||||
|
pageNum: this.pageNum,
|
||||||
|
},
|
||||||
|
success: function (res) {
|
||||||
|
this.pageNum = res.data.content.pageNum;
|
||||||
|
this.totalPage = res.data.content.totalPageNum;
|
||||||
|
this.resultData = res.data.content.rows;
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<!-- <list-nav-bar title="Weixin" back="{{false}}" color="black" background="#3c8bf6"></list-nav-bar> -->
|
<!-- <list-nav-bar title="Weixin" back="{{false}}" color="black" background="#3c8bf6"></list-nav-bar> -->
|
||||||
<!-- <navigation-bar title="Weixin" back="{{false}}" color="black" background="#3c8bf6"></navigation-bar> -->
|
<!-- <navigation-bar title="Weixin" back="{{false}}" color="black" background="#3c8bf6"></navigation-bar> -->
|
||||||
|
|
||||||
<list-nav-bar title="WeixinWeixinWeixin" background="#3c8bf6" showNavBtn="{{true}}"></list-nav-bar>
|
<list-nav-bar title="{{categoryName}}" background="#3c8bf6" showNavBtn="{{true}}"></list-nav-bar>
|
||||||
<scroll-view style="height: 100%; overflow:hidden;" scroll-y type="list">
|
<scroll-view style="height: 100%; overflow:hidden;" scroll-y type="list">
|
||||||
<view class="container">
|
<view class="container">
|
||||||
|
<block wx:for="{{list}}" wx:for-index="index" wx:for-item="itemArt">
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
<view class="card" bind:tap="jumpPage" data-aid="{{itemArt.id}}" data-jumpType="2">
|
||||||
<view class="card-header">
|
<view class="card-header">
|
||||||
<view class="dot"></view>
|
<view class="dot"></view>
|
||||||
<text class="title">超出焊接时间</text>
|
<text class="title">{{itemArt.title}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="details">
|
<view class="details">
|
||||||
<!-- 查看详情 -->
|
<!-- 查看详情 -->
|
||||||
@@ -16,135 +16,7 @@
|
|||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
<image class="details-icon" src="../../images/jt.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<list-nav-bar title="WeixinWeixinWeixin" background="#3c8bf6" showNavBtn="{{true}}"></list-nav-bar>
|
<list-nav-bar title="搜索" background="#3c8bf6" showNavBtn="{{true}}"></list-nav-bar>
|
||||||
<view class="cont-box">
|
<view class="cont-box">
|
||||||
<view class="dis-flex search-input-box">
|
<view class="dis-flex search-input-box">
|
||||||
<view class="search-input">
|
<view class="search-input">
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<icon color="rgba(180,180,180,1)" size="15" type="search"></icon>
|
<icon color="rgba(180,180,180,1)" size="15" type="search"></icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<input bindinput="getSearchContent" class="input" focus="true" placeholder="请输入您搜索的商品" placeholderStyle="color:#aba9a9" type="text"></input>
|
<input bindinput="getSearchContent" class="input" focus="true" placeholder="请输入故障代码或关键词" placeholderStyle="color:#aba9a9" type="text"></input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -5,5 +5,5 @@
|
|||||||
"compileHotReLoad": true,
|
"compileHotReLoad": true,
|
||||||
"skylineRenderEnable": true
|
"skylineRenderEnable": true
|
||||||
},
|
},
|
||||||
"libVersion": "3.5.3"
|
"libVersion": "3.5.4"
|
||||||
}
|
}
|
||||||
89
utils/request.js
Normal file
89
utils/request.js
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
const ui = require('./ui');
|
||||||
|
const BASE_URL = 'https://app.19year.cn'
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网络请求request
|
||||||
|
* obj.data 请求接口需要传递的数据
|
||||||
|
* obj.showLoading 控制是否显示加载Loading 默认为false不显示
|
||||||
|
* obj.contentType 默认为 application/json
|
||||||
|
* obj.method 请求的方法 默认为GET
|
||||||
|
* obj.url 请求的接口路径
|
||||||
|
* obj.message 加载数据提示语
|
||||||
|
*/
|
||||||
|
function request(obj) {
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
if(obj.showLoading){
|
||||||
|
ui.showLoading(obj.message? obj.message : '加载中...');
|
||||||
|
}
|
||||||
|
var data = {};
|
||||||
|
if(obj.data) {
|
||||||
|
data = obj.data;
|
||||||
|
}
|
||||||
|
var contentType = 'application/json';
|
||||||
|
if(obj.contentType){
|
||||||
|
contentType = obj.contentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
var method = 'GET';
|
||||||
|
if(obj.method){
|
||||||
|
method = obj.method;
|
||||||
|
}
|
||||||
|
|
||||||
|
wx.request({
|
||||||
|
url: BASE_URL + obj.url,
|
||||||
|
data: data,
|
||||||
|
method: method,
|
||||||
|
//添加请求头
|
||||||
|
header: {
|
||||||
|
'Content-Type': contentType ,
|
||||||
|
'token': wx.getStorageSync('token') //获取保存的token
|
||||||
|
},
|
||||||
|
//请求成功
|
||||||
|
success: function(res) {
|
||||||
|
console.log('===============================================================================================')
|
||||||
|
console.log('== 接口地址:' + obj.url);
|
||||||
|
console.log('== 接口参数:' + JSON.stringify(data));
|
||||||
|
console.log('== 请求类型:' + method);
|
||||||
|
console.log("== 接口状态:" + res.statusCode);
|
||||||
|
console.log("== 接口数据:" + JSON.stringify(res.data));
|
||||||
|
console.log('===============================================================================================')
|
||||||
|
if (res.statusCode == 200) {
|
||||||
|
resolve(res);
|
||||||
|
} else if (res.statusCode == 401) {//授权失效
|
||||||
|
reject("登录已过期");
|
||||||
|
jumpToLogin();//跳转到登录页
|
||||||
|
} else {
|
||||||
|
//请求失败
|
||||||
|
reject("请求失败:" + res.statusCode)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: function(err) {
|
||||||
|
//服务器连接异常
|
||||||
|
console.log('===============================================================================================')
|
||||||
|
console.log('== 接口地址:' + url)
|
||||||
|
console.log('== 接口参数:' + JSON.stringify(data))
|
||||||
|
console.log('== 请求类型:' + method)
|
||||||
|
console.log("== 服务器连接异常")
|
||||||
|
console.log('===============================================================================================')
|
||||||
|
reject("服务器连接异常,请检查网络再试");
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
ui.hideLoading();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//跳转到登录页
|
||||||
|
function jumpToLogin(){
|
||||||
|
wx.reLaunch({
|
||||||
|
url: '/pages/login/login',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
request,
|
||||||
|
}
|
||||||
|
|
||||||
26
utils/ui.js
Normal file
26
utils/ui.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
export const showToast = function(content,duration) {
|
||||||
|
if(!duration) duration = 2000
|
||||||
|
wx.showToast({
|
||||||
|
title: content,
|
||||||
|
icon: 'none',
|
||||||
|
duration: duration,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var isShowLoading = false
|
||||||
|
export const showLoading = function(title) {
|
||||||
|
if(isShowLoading) return
|
||||||
|
wx.showLoading({
|
||||||
|
title: title?title:'',
|
||||||
|
mask:true,
|
||||||
|
success:()=>{
|
||||||
|
isShowLoading = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const hideLoading = function() {
|
||||||
|
if(!isShowLoading) return
|
||||||
|
isShowLoading = false
|
||||||
|
wx.hideLoading()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user