练习共享

This commit is contained in:
caoqianming 2020-11-17 20:37:14 +08:00
parent fd88a86074
commit 5affde5711
10 changed files with 158 additions and 129 deletions

View File

@ -1,12 +1,16 @@
// pages/miss/miss.js // pages/miss/miss.js
const api = require("../../utils/request.js");
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
page: 1, query:{
serverUrl: getApp().globalData.serverUrl, a:'listall',
page:1,
rows:10
},
wslist:[] wslist:[]
}, },
@ -51,9 +55,9 @@ Page({
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function () {
var that = this; var that = this;
that.getWslist(1); this.data.query.page = 1;
that.getWslist();
wx.stopPullDownRefresh(); wx.stopPullDownRefresh();
this.data.page = 1;
}, },
/** /**
@ -61,9 +65,16 @@ Page({
*/ */
onReachBottom: function () { onReachBottom: function () {
//上拉分页,将页码加1然后调用分页函数 //上拉分页,将页码加1然后调用分页函数
this.data.page = this.data.page + 1; var that = this
this.getWslist(); if (that.data.total <= that.data.query.page * that.data.query.rows) {
wx.stopPullDownRefresh(); wx.showToast({
title: '没有更多了',
icon: 'none'
})
} else {
that.data.query.page = that.data.query.page + 1
that.getWslist()
}
}, },
/** /**
@ -72,49 +83,18 @@ Page({
onShareAppMessage: function () { onShareAppMessage: function () {
}, },
getWslist: function (page) { getWslist: function () {
var that = this; var that = this
if (page != 1) { page = that.data.page } api.request('api/miss', 'GET', that.data.query).then(res => {
wx.showLoading({ if (that.data.query.page == 1) {
title: '加载中', that.data.wslist = res.rows
}), } else {
wx.request({ that.data.wslist = that.data.wslist.concat(res.rows)
url: this.data.serverUrl + 'api/miss?a=listall&rows=10&page=' + page, }
header: { that.setData({
'content-type': 'application/json', // 默认值 wslist: that.data.wslist,
'Cookie': getApp().globalData.sessionId, total: res.total
}, })
success: res => { })
if (res.statusCode === 200) {
if (res.data.rows.length == 0) {
if (page == 1) {
this.setData({
total: 0,
wslist: []
})
}
else {
wx.showModal({
content: "已经到底啦!",
showCancel: false,
confirmText: "确定",
})
}
} else {
let list
if (page == 1) {
list = res.data.rows
} else {
list = this.data.wslist.concat(res.data.rows)
}
this.setData({
total: res.data.total,
wslist: list
})
}
}
wx.hideLoading();
}
});
}, },
}) })

View File

@ -13,6 +13,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.data.missid = options.missid
this.getWsdetail(options.missid); this.getWsdetail(options.missid);
}, },
@ -41,7 +42,15 @@ Page({
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function () {
// var pages = getCurrentPages()
// var prePage = pages[pages.length-2]
// if(prePage.data.wslist){
// for(var i=0;i<prePage.data.wslist;i++){
// if(prePage.data.wslist[i].missid == this.data.missid){
// }
// }
// }
}, },
/** /**

View File

@ -25,7 +25,7 @@ Page({
//上次选中的列表,用于判断是不是取消选中了 //上次选中的列表,用于判断是不是取消选中了
this.lastTimeSelect = [] this.lastTimeSelect = []
wx.request({ wx.request({
url: getApp().globalData.serverUrl + 'api/questioncat?a=tree', url: getApp().globalData.serverUrl + 'api/questioncat?a=tree3',
header: { header: {
'content-type': 'application/json', // 默认值 'content-type': 'application/json', // 默认值
'Cookie': getApp().globalData.sessionId, 'Cookie': getApp().globalData.sessionId,

View File

@ -6,7 +6,7 @@
<view>姓名</view> <view>姓名</view>
</view> </view>
<view class="weui-cell__ft"> <view class="weui-cell__ft">
{{realname}} {{user__userprofile__realname}}
</view> </view>
</view> </view>
<view class="weui-cell weui-cell_access"> <view class="weui-cell weui-cell_access">
@ -14,7 +14,7 @@
<view>性别</view> <view>性别</view>
</view> </view>
<view class="weui-cell__ft"> <view class="weui-cell__ft">
{{gender}} {{user__userprofile__gender}}
</view> </view>
</view> </view>
<view class="weui-cell weui-cell_access"> <view class="weui-cell weui-cell_access">

View File

@ -26,7 +26,7 @@ Page({
*/ */
onShow: function () { onShow: function () {
var that = this; var that = this;
that.getsafecertlist() that.getsafecertlist2()
}, },
/** /**
@ -167,4 +167,21 @@ Page({
}); });
}, },
getsafecertlist2: function(){
wx.showLoading({ title: '加载中', })
wx.request({
url: getApp().globalData.serverUrl + 'api/safecert?a=listself',
header: {
'content-type': 'application/json', // 默认值
'Cookie': getApp().globalData.sessionId,
},
success: res => {
this.setData({
total: res.data.total,
safecertlist: res.data.rows
})
wx.hideLoading();
}
});
}
}) })

View File

@ -26,7 +26,7 @@ Page({
*/ */
onShow: function () { onShow: function () {
var that = this; var that = this;
that.getSocertlist() that.getSocertlist2()
}, },
/** /**
@ -166,4 +166,22 @@ Page({
}); });
}, },
getSocertlist2: function() {
wx.showLoading({ title: '加载中', })
wx.request({
url: getApp().globalData.serverUrl + 'api/socert?a=listself',
header: {
'content-type': 'application/json', // 默认值
'Cookie': getApp().globalData.sessionId,
},
success: res => {
this.setData({
total: res.data.total,
socertlist: res.data.rows
})
wx.hideLoading();
}
});
}
}) })

View File

@ -6,7 +6,7 @@
<view>姓名</view> <view>姓名</view>
</view> </view>
<view class="weui-cell__ft"> <view class="weui-cell__ft">
{{realname}} {{user__userprofile__realname}}
</view> </view>
</view> </view>
<view class="weui-cell weui-cell_access"> <view class="weui-cell weui-cell_access">
@ -14,7 +14,7 @@
<view>性别</view> <view>性别</view>
</view> </view>
<view class="weui-cell__ft"> <view class="weui-cell__ft">
{{gender}} {{user__userprofile__gender}}
</view> </view>
</view> </view>
<view class="weui-cell weui-cell_access"> <view class="weui-cell weui-cell_access">

View File

@ -10,7 +10,8 @@ Page({
genderarray: ['男','女'], genderarray: ['男','女'],
genderIndex:0, genderIndex:0,
userprofile__realname:'', userprofile__realname:'',
userprofile__cardnum:'' userprofile__cardnum:'',
userprofile__gender:'男'
}, },
bindrealnameInput: function (e) { bindrealnameInput: function (e) {
this.data.userprofile__realname = e.detail.value this.data.userprofile__realname = e.detail.value
@ -161,18 +162,22 @@ Page({
if (res.statusCode === 200) { if (res.statusCode === 200) {
if (res.data.code == 1) { if (res.data.code == 1) {
wx.hideLoading() wx.hideLoading()
wx.navigateBack() wx.showToast({
wx.request({ title: '保存成功',
url: getApp().globalData.serverUrl + 'api/socert?a=addspiderself', icon:'none'
header: { })
'content-type': 'application/json', // 默认值 // wx.navigateBack()
'Cookie': getApp().globalData.sessionId, // wx.request({
}, // url: getApp().globalData.serverUrl + 'api/socert?a=addspiderself',
method: 'GET', // header: {
data: {}, // 'content-type': 'application/json', // 默认值
success: res => { // 'Cookie': getApp().globalData.sessionId,
} // },
}); // method: 'GET',
// data: {},
// success: res => {
// }
// });
} }
} }
} }

View File

@ -1,59 +1,59 @@
{ {
"description": "项目配置文件。", "description": "项目配置文件。",
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"es6": true, "es6": true,
"enhance": false, "enhance": false,
"postcss": true, "postcss": true,
"preloadBackgroundData": false, "preloadBackgroundData": false,
"minified": true, "minified": true,
"newFeature": true, "newFeature": true,
"coverView": true, "coverView": true,
"nodeModules": true, "nodeModules": true,
"autoAudits": false, "autoAudits": false,
"showShadowRootInWxmlPanel": true, "showShadowRootInWxmlPanel": true,
"scopeDataCheck": false, "scopeDataCheck": false,
"uglifyFileName": false, "uglifyFileName": false,
"checkInvalidKey": true, "checkInvalidKey": true,
"checkSiteMap": true, "checkSiteMap": true,
"uploadWithSourceMap": true, "uploadWithSourceMap": true,
"babelSetting": { "compileHotReLoad": false,
"ignore": [], "useMultiFrameRuntime": false,
"disablePlugins": [], "useApiHook": true,
"outputPath": "" "babelSetting": {
}, "ignore": [],
"useCompilerModule": true, "disablePlugins": [],
"userConfirmedUseCompilerModuleSwitch": false, "outputPath": ""
"compileHotReLoad": false, },
"useMultiFrameRuntime": false, "useIsolateContext": true,
"useApiHook": false, "useCompilerModule": true,
"useIsolateContext": true, "userConfirmedUseCompilerModuleSwitch": false,
"packNpmManually": false, "packNpmManually": false,
"packNpmRelationList": [] "packNpmRelationList": []
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.9.4", "libVersion": "2.9.4",
"appid": "wx5c39b569f01c27db", "appid": "wx5c39b569f01c27db",
"projectname": "aqyj", "projectname": "aqyj",
"isGameTourist": false, "isGameTourist": false,
"simulatorType": "wechat", "simulatorType": "wechat",
"simulatorPluginLibVersion": {}, "simulatorPluginLibVersion": {},
"condition": { "condition": {
"search": { "search": {
"current": -1, "current": -1,
"list": [] "list": []
}, },
"conversation": { "conversation": {
"current": -1, "current": -1,
"list": [] "list": []
}, },
"game": { "game": {
"currentL": -1, "currentL": -1,
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": -1, "current": -1,
"list": [] "list": []
} }
} }
} }

View File

@ -2,7 +2,7 @@ function request(url, method, data) {
let promise = new Promise((resolve, reject) => { let promise = new Promise((resolve, reject) => {
wx.showNavigationBarLoading(); wx.showNavigationBarLoading();
wx.request({ wx.request({
url: getApp().globalData.host + url, url: getApp().globalData.serverUrl + url,
method: method, method: method,
data: data, data: data,
header: { header: {