From 5affde57115a5a5f4d5c81f0a0d4da484206fb01 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 17 Nov 2020 20:37:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=83=E4=B9=A0=E5=85=B1=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/miss/miss.js | 82 +++++++++--------------- pages/miss/missdetail.js | 9 +++ pages/questioncat/index.js | 2 +- pages/safecert/detail.wxml | 4 +- pages/safecert/index.js | 19 +++++- pages/socert/socert.js | 20 +++++- pages/socert/socertdetail.wxml | 4 +- pages/user/userdetail.js | 31 +++++---- project.config.json | 114 ++++++++++++++++----------------- utils/request.js | 2 +- 10 files changed, 158 insertions(+), 129 deletions(-) diff --git a/pages/miss/miss.js b/pages/miss/miss.js index f833262..25d96ba 100644 --- a/pages/miss/miss.js +++ b/pages/miss/miss.js @@ -1,12 +1,16 @@ // pages/miss/miss.js +const api = require("../../utils/request.js"); Page({ /** * 页面的初始数据 */ data: { - page: 1, - serverUrl: getApp().globalData.serverUrl, + query:{ + a:'listall', + page:1, + rows:10 + }, wslist:[] }, @@ -51,9 +55,9 @@ Page({ */ onPullDownRefresh: function () { var that = this; - that.getWslist(1); + this.data.query.page = 1; + that.getWslist(); wx.stopPullDownRefresh(); - this.data.page = 1; }, /** @@ -61,9 +65,16 @@ Page({ */ onReachBottom: function () { //上拉分页,将页码加1,然后调用分页函数 - this.data.page = this.data.page + 1; - this.getWslist(); - wx.stopPullDownRefresh(); + var that = this + if (that.data.total <= that.data.query.page * that.data.query.rows) { + wx.showToast({ + title: '没有更多了', + icon: 'none' + }) + } else { + that.data.query.page = that.data.query.page + 1 + that.getWslist() + } }, /** @@ -72,49 +83,18 @@ Page({ onShareAppMessage: function () { }, - getWslist: function (page) { - var that = this; - if (page != 1) { page = that.data.page } - wx.showLoading({ - title: '加载中', - }), - wx.request({ - url: this.data.serverUrl + 'api/miss?a=listall&rows=10&page=' + page, - header: { - 'content-type': 'application/json', // 默认值 - 'Cookie': getApp().globalData.sessionId, - }, - 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(); - } - }); + getWslist: function () { + var that = this + api.request('api/miss', 'GET', that.data.query).then(res => { + if (that.data.query.page == 1) { + that.data.wslist = res.rows + } else { + that.data.wslist = that.data.wslist.concat(res.rows) + } + that.setData({ + wslist: that.data.wslist, + total: res.total + }) + }) }, }) \ No newline at end of file diff --git a/pages/miss/missdetail.js b/pages/miss/missdetail.js index 674333f..dfa17a9 100644 --- a/pages/miss/missdetail.js +++ b/pages/miss/missdetail.js @@ -13,6 +13,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + this.data.missid = options.missid this.getWsdetail(options.missid); }, @@ -41,7 +42,15 @@ Page({ * 生命周期函数--监听页面卸载 */ onUnload: function () { + // var pages = getCurrentPages() + // var prePage = pages[pages.length-2] + // if(prePage.data.wslist){ + // for(var i=0;i姓名 - {{realname}} + {{user__userprofile__realname}} @@ -14,7 +14,7 @@ 性别 - {{gender}} + {{user__userprofile__gender}} diff --git a/pages/safecert/index.js b/pages/safecert/index.js index 0c7a3f3..26353f1 100644 --- a/pages/safecert/index.js +++ b/pages/safecert/index.js @@ -26,7 +26,7 @@ Page({ */ onShow: function () { 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(); + } + }); + } }) \ No newline at end of file diff --git a/pages/socert/socert.js b/pages/socert/socert.js index ad9d737..700cd59 100644 --- a/pages/socert/socert.js +++ b/pages/socert/socert.js @@ -26,7 +26,7 @@ Page({ */ onShow: function () { 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(); + } + }); + } }) \ No newline at end of file diff --git a/pages/socert/socertdetail.wxml b/pages/socert/socertdetail.wxml index 2eba2f0..1bf8f7b 100644 --- a/pages/socert/socertdetail.wxml +++ b/pages/socert/socertdetail.wxml @@ -6,7 +6,7 @@ 姓名 - {{realname}} + {{user__userprofile__realname}} @@ -14,7 +14,7 @@ 性别 - {{gender}} + {{user__userprofile__gender}} diff --git a/pages/user/userdetail.js b/pages/user/userdetail.js index 8905111..38ba02e 100644 --- a/pages/user/userdetail.js +++ b/pages/user/userdetail.js @@ -10,7 +10,8 @@ Page({ genderarray: ['男','女'], genderIndex:0, userprofile__realname:'', - userprofile__cardnum:'' + userprofile__cardnum:'', + userprofile__gender:'男' }, bindrealnameInput: function (e) { this.data.userprofile__realname = e.detail.value @@ -161,18 +162,22 @@ Page({ if (res.statusCode === 200) { if (res.data.code == 1) { wx.hideLoading() - wx.navigateBack() - wx.request({ - url: getApp().globalData.serverUrl + 'api/socert?a=addspiderself', - header: { - 'content-type': 'application/json', // 默认值 - 'Cookie': getApp().globalData.sessionId, - }, - method: 'GET', - data: {}, - success: res => { - } - }); + wx.showToast({ + title: '保存成功', + icon:'none' + }) + // wx.navigateBack() + // wx.request({ + // url: getApp().globalData.serverUrl + 'api/socert?a=addspiderself', + // header: { + // 'content-type': 'application/json', // 默认值 + // 'Cookie': getApp().globalData.sessionId, + // }, + // method: 'GET', + // data: {}, + // success: res => { + // } + // }); } } } diff --git a/project.config.json b/project.config.json index a811634..5e8956e 100644 --- a/project.config.json +++ b/project.config.json @@ -1,59 +1,59 @@ { - "description": "项目配置文件。", - "setting": { - "urlCheck": false, - "es6": true, - "enhance": false, - "postcss": true, - "preloadBackgroundData": false, - "minified": true, - "newFeature": true, - "coverView": true, - "nodeModules": true, - "autoAudits": false, - "showShadowRootInWxmlPanel": true, - "scopeDataCheck": false, - "uglifyFileName": false, - "checkInvalidKey": true, - "checkSiteMap": true, - "uploadWithSourceMap": true, - "babelSetting": { - "ignore": [], - "disablePlugins": [], - "outputPath": "" - }, - "useCompilerModule": true, - "userConfirmedUseCompilerModuleSwitch": false, - "compileHotReLoad": false, - "useMultiFrameRuntime": false, - "useApiHook": false, - "useIsolateContext": true, - "packNpmManually": false, - "packNpmRelationList": [] - }, - "compileType": "miniprogram", - "libVersion": "2.9.4", - "appid": "wx5c39b569f01c27db", - "projectname": "aqyj", - "isGameTourist": false, - "simulatorType": "wechat", - "simulatorPluginLibVersion": {}, - "condition": { - "search": { - "current": -1, - "list": [] - }, - "conversation": { - "current": -1, - "list": [] - }, - "game": { - "currentL": -1, - "list": [] - }, - "miniprogram": { - "current": -1, - "list": [] - } - } + "description": "项目配置文件。", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": false, + "postcss": true, + "preloadBackgroundData": false, + "minified": true, + "newFeature": true, + "coverView": true, + "nodeModules": true, + "autoAudits": false, + "showShadowRootInWxmlPanel": true, + "scopeDataCheck": false, + "uglifyFileName": false, + "checkInvalidKey": true, + "checkSiteMap": true, + "uploadWithSourceMap": true, + "compileHotReLoad": false, + "useMultiFrameRuntime": false, + "useApiHook": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "useIsolateContext": true, + "useCompilerModule": true, + "userConfirmedUseCompilerModuleSwitch": false, + "packNpmManually": false, + "packNpmRelationList": [] + }, + "compileType": "miniprogram", + "libVersion": "2.9.4", + "appid": "wx5c39b569f01c27db", + "projectname": "aqyj", + "isGameTourist": false, + "simulatorType": "wechat", + "simulatorPluginLibVersion": {}, + "condition": { + "search": { + "current": -1, + "list": [] + }, + "conversation": { + "current": -1, + "list": [] + }, + "game": { + "currentL": -1, + "list": [] + }, + "miniprogram": { + "current": -1, + "list": [] + } + } } \ No newline at end of file diff --git a/utils/request.js b/utils/request.js index a71ae2b..b1da53b 100644 --- a/utils/request.js +++ b/utils/request.js @@ -2,7 +2,7 @@ function request(url, method, data) { let promise = new Promise((resolve, reject) => { wx.showNavigationBarLoading(); wx.request({ - url: getApp().globalData.host + url, + url: getApp().globalData.serverUrl + url, method: method, data: data, header: {