问答页面

This commit is contained in:
高健 2021-07-23 11:18:54 +08:00
parent cce80cae33
commit 7db05db737
37 changed files with 1195 additions and 298 deletions

81
app.js
View File

@ -1,19 +1,33 @@
// app.js
var restAjax = require('utils/restAjax.js');
App({
restAjax: restAjax,
apis: restAjax.apis,
baseUrls: restAjax.baseUrl,
onLaunch() {
//设置状态栏
wx.getSystemInfo({
success: e => {
this.globalData.StatusBar = e.statusBarHeight;
let capsule = wx.getMenuButtonBoundingClientRect();
if (capsule) {
this.globalData.Custom = capsule;
this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
} else {
this.globalData.CustomBar = e.statusBarHeight + 50;
this.globalData.windowHeight = wx.getSystemInfoSync().windowHeight
//设置状态栏
wx.getSystemInfo({
success: e => {
this.globalData.StatusBar = e.statusBarHeight;
let capsule = wx.getMenuButtonBoundingClientRect();
if (capsule) {
this.globalData.Custom = capsule;
this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
} else {
this.globalData.CustomBar = e.statusBarHeight + 50;
}
}
})
//获取是否绑定手机号
try {
var bindPhone = wx.getStorageSync('bindPhone')
if (bindPhone != '' && bindPhone.length > 0) {
this.globalData.bindPhone = bindPhone
}
} catch (error) {
}
}
})
// 登录
wx.login({
success: res => {
@ -21,7 +35,46 @@ App({
}
})
},
// 登录
doLogin: function () {
var self = this;
wx.login({
success(res) {
console.log(res)
app.restAjax.post(app.restAjax.path(apis.login, [baseUrls.loginUrl]), {
jsCode: res.code
}, null, function (code, data) {
var token = data.data.split('_')[0]
self.setData({
token: token,
bindPhone: data.data.split('_')[1]
})
wx.setStorageSync('token', token)
wx.setStorageSync('bindPhone', data.data.split('_')[1])
app.globalData.token = token
self.getUserInfo()
}, function (code, data) {
app.dialog.msg(data.msg);
});
}
})
},
// 获取用户信息
getUserInfo: function () {
var self = this
app.restAjax.get(app.restAjax.path('{loginUrl}app/user/get-app-user', [app.personIntroUrl]), {}, {
headers: {
token: app.globalData.token
}
}, function (code, data) {
app.globalData.userInfo = data
}, function (code, data) {
app.dialog.msg(data.msg);
});
},
globalData: {
userInfo: null
userInfo: null,
bindPhone: '',
token: 'dEIwTEV0MEp5d1o2dlNBYUd4MVp0akV2MXVFbktCMWZ5cjFIbGpNMytQWkRLMWUvdjBUcDkrSk13ajBiYzJSS2JtY1p0cTlhYUxqRm10TUM4S1lSSFhabHVZdlRJRkwrUjA2Uk5pN2UyU0FYYXVQWVpxZHhEUTlCT1p3QURHcVNKVlVrakhOUlZJb2lyQ05wdVQvY1hCSHM5Wmk5VDBEM0ZOQlV1MWlwYm0yVjRGdmExNzRTS3Iyb1IyTThhSkczQk9uS3NOL25jVzJJSEJlbWpId2lKakREWm8yOHVhaUlRZVVKVmptbFdvbGZtUllBUG43M3pjKzhNcm11ZUY2ZHpsZmk1dU5kS04yTWM0Z0JiSmljV1E9PQ=='
}
})
})

View File

@ -12,7 +12,8 @@
"pages/results/resultsdetail",
"pages/card/carddetail",
"pages/index/mineinfo",
"pages/branches/branchesdetail"
"pages/branches/branchesdetail",
"pages/answer/answerdetail"
],
"window": {
"backgroundTextStyle": "dark",
@ -30,6 +31,7 @@
"van-swipe-cell": "/vant/dist/swipe-cell/index",
"van-cell-group": "/vant/dist/cell-group/index",
"van-cell": "/vant/dist/cell/index",
"van-empty": "/vant/dist/empty/index"
"van-empty": "/vant/dist/empty/index",
"van-popup": "/vant/dist/popup/index"
}
}

View File

@ -27,7 +27,7 @@ page {
}
.content {
width: 80%;
width: 70%;
display: flex;
flex-direction: column;
justify-content: space-around;
@ -94,6 +94,22 @@ page {
border-radius: 20rpx;
}
.table-item-no {
display: flex;
width: 96%;
flex-direction: row;
padding-top: 20rpx;
padding-bottom: 20rpx;
}
.line-gray {
display: flex;
width: 90%;
flex-direction: row;
height: 1rpx;
background-color: #f5f5f5;
}
.table-title-border {
display: flex;
width: 96%;
@ -139,6 +155,12 @@ page {
align-self: center;
}
.border-bottom-gray {
border-bottom-width: 1rpx;
border-bottom-style: solid;
border-bottom-color: gray;
}
.table-item-title-1 {
flex: 1.3;
text-align: center;
@ -148,6 +170,22 @@ page {
align-self: center;
}
.table-item-title {
flex: 0.7;
text-align: justify;
align-items: center;
justify-content: center;
align-self: center;
}
.table-item-content-3 {
flex: 1.3;
text-align: center;
align-items: center;
justify-content: center;
align-self: center;
}
.table-item-title-4 {
flex: 0.4;
text-align: center;

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -0,0 +1,40 @@
// pages/notices/noticedetail.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
noticeContent: '',
articleId: '',
detailBean: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
articleId: options.id
})
this.getArticleDetail()
},
getArticleDetail() {
var _self = this
wx.showLoading({
title: '加载中...',
})
app.restAjax.get(app.restAjax.path(app.apis.getArticleDetailById, [app.baseUrls.cardUrl, _self.data.articleId]), {}, {},
(code, data) => {
wx.hideLoading({})
if (code == 200) {
_self.setData({
detailBean: data
})
}
}, (code, err) => {
wx.hideLoading({})
})
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,21 @@
<!--pages/notices/noticedetail.wxml-->
<cu-custom bgColor="bg-darkblue" isBack="{{true}}" isRelaunch="{{false}}">
<view slot="content" style="color:#FFFFFF;">问答详情</view>
</cu-custom>
<scroll-view style="width:100%;">
<view class="content-view">
<view class="content-detail">
<view class="notice-title text-xl text-bold">
<text>{{detailBean.title}}</text>
</view>
<view class="flex margin-top-sm" style="justify-content:space-around;width:100%">
<view>发布日期:{{detailBean.publishDate}}</view>
<view>来源:{{detailBean.source}}</view>
</view>
<view class="line-gray margin-top-sm" style="width:100%;height:20rpx;"></view>
<view class="text-lg text-black padding-sm">
<rich-text nodes="{{detailBean.content}}" space="nbsp"></rich-text>
</view>
</view>
</view>
</scroll-view>

View File

@ -0,0 +1 @@
/* pages/answer/answerdetail.wxss */

View File

@ -1,4 +1,4 @@
// pages/answer/answerlist.js
// pages/notices/noticeslist.js
const app = getApp()
Page({
@ -10,14 +10,37 @@ Page({
CustomBar: app.globalData.CustomBar,
countTime: 2000, //延迟搜索 时间
searchWaiting: false, //是否等待搜索倒计时中,
searchKey: ''
searchKey: '',
contentHeight: app.globalData.windowHeight,
currentPage: 1,
totalSize: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getResultsList('')
},
showDetail(e) {
var item = e.currentTarget.dataset.item
wx.navigateTo({
url: './answerdetail?id=' + item.contentId,
})
},
doLoadMore() {
var _self = this
if (_self.data.totalSize > _self.data.answerList.length) {
_self.setData({
currentPage: ++_self.data.currentPage
})
_self.getResultsList(_self.data.searchKey)
} else {
wx.showToast({
title: '无更多数据了',
icon: 'none'
})
}
},
doSearch(e) {
this.setData({
@ -30,14 +53,52 @@ Page({
}
},
getResultsList(key) {
console.log('搜索中' + key)
var _self = this
app.restAjax.get(app.restAjax.path(app.apis.getArticleList, [app.baseUrls.cardUrl]), {
categoryId: '494bf3cc-cab6-4710-a0b2-d84f4591c992',
page: _self.data.currentPage,
rows: '10',
keywords: key
}, {},
function (code, data) {
wx.hideLoading({})
if (code == 200) {
for (var i = 0; i < data.rows.length; i++) {
var item = data.rows[i]
if (item.coverPhotos.length > 0) {
var photos = item.coverPhotos.split(',')
data.rows[i].showPhoto = app.baseUrls.cardUrl + app.baseUrls.baseImgUrl + photos[0]
} else {
data.rows[i].showPhoto = '../../images/icons/answer_default.jpeg'
}
}
if (_self.data.currentPage > 1) {
if (data.rows.length > 0) {
_self.data.answerList = _self.data.answerList.concat(data.rows)
}
} else {
_self.data.answerList = data.rows
}
_self.setData({
answerList: _self.data.answerList,
totalSize: data.total
})
}
},
function (code, err) {
wx.hideLoading({})
console.log(err)
})
},
/**
* 延迟搜索
*/
timer() {
var _self = this;
this.setData({
currentPage: 1,
totalSize: 0,
searchWaiting: true
})
let promise = new Promise((resolve, reject) => {
@ -48,6 +109,7 @@ Page({
countTime: _self.data.countTime - 1000
})
if (_self.data.countTime <= 0) {
console.log('开始搜索: ' + _self.data.searchKey);
_self.setData({
countTime: 2000,
@ -58,6 +120,9 @@ Page({
}, 1000)
})
promise.then((setTimer) => {
wx.showLoading({
title: '搜索中...',
})
_self.getResultsList(_self.data.searchKey)
clearInterval(setTimer) //清除计时器
})

View File

@ -2,15 +2,24 @@
<cu-custom bgColor="bg-darkblue" isBack="{{true}}" isRelaunch="{{false}}">
<view slot="content" style="color:#FFFFFF;">报考问答</view>
</cu-custom>
<scroll-view>
<view class="cu-bar bg-white search fixed" style="top:{{CustomBar}}px">
<view class="search-form round" style="margin-top:5rpx;margin-bottom:5rpx">
<text class="cuIcon-search"></text>
<input type="text" placeholder="请输入关键字" confirm-type="search" bindinput="doSearch"></input>
</view>
</view>
<scroll-view style="margin-top:70rpx;padding-left:10rpx;padding-right:10rpx;height:{{contentHeight}}px;" scroll-y="true"
bindscrolltolower="doLoadMore">
<view class="list" wx:if="{{answerList.length>0}}">
<view class="item" wx:for="{{answerList}}" wx:key="index">
<view class="cu-avatar radius xl"
style="background-image:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.czcaizhi.com%2FContent%2FUploadFiles%2Fimage%2F20180920%2F20180920133956_3429.jpg&refer=http%3A%2F%2Fwww.czcaizhi.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622110389&t=4ae9d4f943c30ac6d43801515eec97e5);">
</view>
<view class="item" wx:for="{{answerList}}" wx:key="index" bindtap="showDetail" data-item="{{item}}">
<image class="cu-avatar radius" style="width:200rpx;height:120rpx;min-width:200rpx;min-height:120rpx;"
src="{{item.showPhoto}}" mode="scaleToFill"></image>
<view class="content">
<text class="text-cut text-black text-bold">2021年4-6月特种设备作业人员培训开班通知</text>
<text class="text-cut">新东方在线</text>
<text class="text-cut text-black text-bold">{{item.title}}</text>
<view class="flex justify-between">
<text class="text-cut">{{item.source}}</text>
<text class="text-cut">{{item.publishDate}}</text>
</view>
</view>
</view>
</view>

View File

@ -1,11 +1,26 @@
// pages/branches/branchesdetail.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
noticeContent: `<div class="div_class">
<p class="p">各有关单位:<br/>
为满足企业对特种设备作业人员专业素质的需求支持企业对特种设备作业人员进行专业知识操作技能和安全教育工作推进行业专业技术水平的提升广州市特种设备行业协会对国家市场监管总局已取消的特种设备作业项目组织行业相关特种设备作业人员进行继续教育培训考核欢迎各相关单位学员自愿参加对考核合格的特种设备作业人员由广州市特种设备行业协会发放广州市特种设备行业协会培训证书本协会定于2020年1-3月举办下列培训班现将有关事项通知如下<br/>
报名日期即日起至开班前两个工作日办理报名交费手续<br/>
报名交费地点广州市东风东路754号之八城迹酒店8咨询电话 020-34277197转分机号801~808或13342813020\\13500003204<br/>
报名须知<br/>
()年满18周岁且不超过60周岁<br/>
()申请人员身体健康能够适应所申请考核作业项目的需要<br/>
()具有初中及以上文化程度<br/>
()具备必要的安全技术知识与技能<br/>
()安全教育须提前1个月提交资料报名且年龄不超65周岁<br/>
广州市特种设备行业协会培训证书考证安全教育需提交资料<br/>
</p>
</div>`
},
/**
@ -14,53 +29,4 @@ Page({
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -2,3 +2,16 @@
<cu-custom bgColor="bg-darkblue" isBack="{{true}}" isRelaunch="{{false}}">
<view slot="content" style="color:#FFFFFF;">考试网点</view>
</cu-custom>
<scroll-view style="width:100%;">
<view class="content-view">
<view class="content-detail">
<view class="notice-title text-xl text-bold">
<text>新东方学校</text>
</view>
<view class="line-gray" style="width:100%;height:20rpx;"></view>
<view class="text-lg text-black">
<rich-text nodes="{{noticeContent}}" space="nbsp"></rich-text>
</view>
</view>
</view>
</scroll-view>

View File

@ -5,7 +5,7 @@ Page({
* 页面的初始数据
*/
data: {
branchesList: [],
branchesList: [{},{},{},{}],
CustomBar: app.globalData.CustomBar,
countTime: 2000, //延迟搜索 时间
searchWaiting: false, //是否等待搜索倒计时中,
@ -17,6 +17,12 @@ Page({
*/
onLoad: function (options) {
},
showDetail(e) {
var item = e.currentTarget.dataset.item
wx.navigateTo({
url: './branchesdetail',
})
},
doSearch(e) {
this.setData({

View File

@ -10,7 +10,7 @@
</view>
<scroll-view style="margin-top:70rpx;padding-left:10rpx;padding-right:10rpx;">
<view class="list" wx:if="{{branchesList.length>0}}">
<view class="item" wx:for="{{branchesList}}" wx:key="index">
<view class="item" wx:for="{{branchesList}}" wx:key="index" bindtap="showDetail" data-item="{{item}}">
<view class="cu-avatar radius xl"
style="background-image:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.czcaizhi.com%2FContent%2FUploadFiles%2Fimage%2F20180920%2F20180920133956_3429.jpg&refer=http%3A%2F%2Fwww.czcaizhi.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622110389&t=4ae9d4f943c30ac6d43801515eec97e5);">
</view>

View File

@ -1,18 +1,21 @@
// pages/card/carddetail.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
cardData: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
cardData: options.data
})
},
/**

View File

@ -2,86 +2,5 @@
<view slot="content" style="color:#FFFFFF;">准考证</view>
</cu-custom>
<scroll-view style="width:100%;">
<view class="content-view">
<view class="content-detail">
<view class="text-black text-xl text-bold margin-top-sm text-center">
2019年注册安全工程师准考证
</view>
<view class="table-list margin-top-sm">
<!-- 图片和短 -->
<view class="table-title-border">
<view class="table-item-content">
<view class="table-item-content-item border-bottom border-right">
<view class="table-item-content-item-title">考生姓名</view>
<view class="table-item-content-item-content">张三</view>
</view>
<view class="table-item-content-item border-bottom border-right">
<view class="table-item-content-item-title">性别</view>
<view class="table-item-content-item-content">男</view>
</view>
<view class="table-item-content-item border-bottom border-right">
<view class="table-item-content-item-title">证件号码</view>
<view class="table-item-content-item-content">111111111111111116</view>
</view>
<view class="table-item-content-item border-right">
<view class="table-item-content-item-title">报名序号</view>
<view class="table-item-content-item-content">1123412341234</view>
</view>
</view>
<view class="table-title-item">
<image
src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.qiezichina.com%2FPublic%2Fueditor%2Fimages%2F2017%2F10%2F12%2FjT3Af1507783336.jpg&refer=http%3A%2F%2Fwww.qiezichina.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622193850&t=5f7d149a157aac28dac15eb79f39a578"
mode="scaleToFill" style="width:230rpx;height:300rpx;border-radius:10rpx;"></image>
</view>
</view>
<!-- 长条 -->
<view class="table-item border-bottom border-left border-right">
<view class="table-item-content-item-title-4">档案号</view>
<view class="table-item-content-item-content">1234123412341234123412341234</view>
</view>
<view class="table-item border-bottom border-left border-right">
<view class="table-item-content-item-title-4">报考专业</view>
<view class="table-item-content-item-content">建筑施工安全</view>
</view>
<view class="table-item border-bottom border-left border-right">
<view class="table-item-content-item-title-4">工作单位</view>
<view class="table-item-content-item-content">内蒙古呼和浩特市</view>
</view>
<view class="table-item border-bottom border-left border-right">
<view class="table-item-content-item-title-4">考点地址</view>
<view class="table-item-content-item-content">内蒙古呼和浩特市</view>
</view>
<!-- 考试科目 -->
<view class="table-item border-left border-right border-bottom">
<view class="table-item-title-1 ">考试科目</view>
<view class="table-item-title-1 border-left ">考试时间</view>
<view class="table-item-title-4 border-left">考场</view>
<view class="table-item-title-4 border-left ">座位</view>
</view>
<view class="table-item border-left border-right border-bottom">
<view class="table-item-title-1">安全生产法律法规</view>
<view class="table-item-title-1 border-left">2021-11-11 09:00-11:20</view>
<view class="table-item-title-4 border-left">10</view>
<view class="table-item-title-4 border-left">99</view>
</view>
<view class="table-item border-left border-right border-bottom">
<view class="table-item-title-1">安全生产法律法规</view>
<view class="table-item-title-1 border-left">2021-11-11 09:00-11:20</view>
<view class="table-item-title-4 border-left">10</view>
<view class="table-item-title-4 border-left">99</view>
</view>
<view class="table-item border-left border-right border-bottom">
<view class="table-item-title-1">安全生产法律法规</view>
<view class="table-item-title-1 border-left">2021-11-11 09:00-11:20</view>
<view class="table-item-title-4 border-left">10</view>
<view class="table-item-title-4 border-left">99</view>
</view>
<view class="table-notice border-left border-right border-bottom">
<view class="text-blod text-lg">考试须知</view>
<view class="margin-top-smm">
考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知考试须知</view>
</view>
</view>
</view>
</view>
<image src="{{cardData}}" mode="widthFix" style="width:100%;"></image>
</scroll-view>

View File

@ -6,24 +6,60 @@ Page({
* 页面的初始数据
*/
data: {
cardList: [{}, {}, {}, {}],
cardList: [],
CustomBar: app.globalData.CustomBar,
countTime: 2000, //延迟搜索 时间
searchWaiting: false, //是否等待搜索倒计时中,
searchKey: ''
searchKey: '',
show: false,
cardData: '', //当前显示的准考证
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getMyExam()
},
getMyExam() {
wx.showLoading({
title: '加载中...',
})
var _self = this
app.restAjax.get(app.restAjax.path(app.apis.getCardList, [app.baseUrls.cardUrl]), {}, {
headers: {
token: app.globalData.token
}
}, (code, data) => {
wx.hideLoading({})
if (code == 200) {
_self.setData({
cardList: data
})
}
}, (code, error) => {
wx.hideLoading({})
if (error) {
wx.showToast({
title: error.msg,
})
} else {
wx.showToast({
title: '网络错误',
icon: 'error'
})
}
})
},
showDetail(e) {
var item = e.currentTarget.dataset.item
wx.navigateTo({
url: './carddetail',
this.setData({
cardData: item.distributionCardCode,
show: true
})
// wx.navigateTo({
// url: './carddetail?data=' + item.distributionCardCode,
// })
},
doSearch(e) {
this.setData({
@ -68,4 +104,9 @@ Page({
clearInterval(setTimer) //清除计时器
})
},
onClose(e) {
this.setData({
show: false
})
},
})

View File

@ -2,23 +2,37 @@
<cu-custom bgColor="bg-darkblue" isBack="{{true}}" isRelaunch="{{false}}">
<view slot="content" style="color:#FFFFFF;">准考证查询</view>
</cu-custom>
<view class="cu-bar bg-white search fixed" style="top:{{CustomBar}}px">
<view class="search-form round" style="margin-top:5rpx;margin-bottom:5rpx">
<text class="cuIcon-search"></text>
<input type="text" placeholder="请输入关键字" confirm-type="search" bindinput="doSearch"></input>
</view>
</view>
<scroll-view style="margin-top:70rpx;padding-left:10rpx;padding-right:10rpx;">
<scroll-view style="padding-left:10rpx;padding-right:10rpx;margin-top:-10px;">
<view class="list" wx:if="{{cardList.length>0}}">
<view class="item" wx:for="{{cardList}}" wx:key="index" data-item="{{item}}" bindtap="showDetail">
<view class="cu-avatar radius xl"
style="background-image:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.czcaizhi.com%2FContent%2FUploadFiles%2Fimage%2F20180920%2F20180920133956_3429.jpg&refer=http%3A%2F%2Fwww.czcaizhi.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622110389&t=4ae9d4f943c30ac6d43801515eec97e5);">
<view class="item bg-white" wx:for="{{cardList}}" wx:key="index" data-item="{{item}}" bindtap="showDetail">
<view class="content" style="width:100%;">
<text class="text-black text-bold">{{item.planName}}</text>
<view class="margin-top-sm">
<text class="cuIcon-time text-darkblue"></text>
<text>开始时间:{{item.examTimeStart}}</text>
</view>
<view class="margin-top-sm">
<text class="cuIcon-time text-darkblue"></text>
<text>结束时间:{{item.examTimeEnd}}</text>
</view>
<view class="margin-top-sm">
<text class="cuIcon-location text-darkblue"></text>
<text>培训机构:{{item.orgName}}</text>
</view>
<view class="margin-top-sm">
<text class="cuIcon-home text-darkblue"></text>
<text>地址:{{item.examAddress}}</text>
</view>
</view>
<view class="content">
<text class="text-cut text-black text-bold">2021年4-6月特种设备作业人员培训开班通知</text>
<text class="text-cut">新东方在线</text>
<view>
<text class="cuIcon-right text-gray"></text>
</view>
</view>
</view>
<van-empty description="暂无数据" wx:else />
</scroll-view>
</scroll-view>
<van-popup show="{{ show }}" position="center" bind:close="onClose">
<view style="padding:20rpx;">
<image src="{{cardData}}" mode="scaleToFill"></image>
</view>
</van-popup>

View File

@ -1,17 +1,77 @@
// index.js
// 获取应用实例
const app = getApp()
var utils = require('../../utils/util.js')
Page({
data: {
index: 1,
noticeList: [{}, {}, {}, {}, {}], //开班通告
answerList: [{}, {}, {}, {}, {}], //报考问答
noticeList: [], //开班通告
answerList: [], //报考问答
userIcon: '../../images/icons/ic_user_default.png',
nickName: '点击授权',
show: false,
phone: '', //要绑定的手机号
},
onLoad() {
this.getUserInfo()
this.getNoticeList()
this.getAnswerList()
},
//获取开班通告
getNoticeList() {
var _self = this
app.restAjax.get(app.restAjax.path(app.apis.getArticleList, [app.baseUrls.cardUrl]), {
categoryId: '2ff8f6be-a435-46c1-98b7-47b16c621395',
page: '1',
rows: '6'
}, {},
function (code, data) {
if (code == 200) {
for (var i = 0; i < data.rows.length; i++) {
var item = data.rows[i]
if (item.coverPhotos.length > 0) {
var photos = item.coverPhotos.split(',')
data.rows[i].showPhoto = app.baseUrls.cardUrl + app.baseUrls.baseImgUrl + photos[0]
} else {
data.rows[i].showPhoto = '../../images/icons/notice_default.jpeg'
}
}
_self.setData({
noticeList: data.rows
})
}
},
function (code, err) {
console.log(err)
})
},
//报考问答
getAnswerList() {
var _self = this
app.restAjax.get(app.restAjax.path(app.apis.getArticleList, [app.baseUrls.cardUrl]), {
categoryId: '494bf3cc-cab6-4710-a0b2-d84f4591c992',
page: '1',
rows: '6'
}, {},
function (code, data) {
if (code == 200) {
for (var i = 0; i < data.rows.length; i++) {
var item = data.rows[i]
if (item.coverPhotos.length > 0) {
var photos = item.coverPhotos.split(',')
data.rows[i].showPhoto = app.baseUrls.cardUrl + app.baseUrls.baseImgUrl + photos[0]
} else {
data.rows[i].showPhoto = '../../images/icons/answer_default.jpeg'
}
}
_self.setData({
answerList: data.rows
})
}
},
function (code, err) {
console.log(err)
})
},
//获取个人信息
getUserInfo() {
@ -28,6 +88,7 @@ Page({
_self.setData({
userIcon: icon
})
_self.checkBindPhone()
} else {
wx.showModal({
title: '提示',
@ -44,6 +105,58 @@ Page({
}
},
showMineInfo(e) {
try {
var icon = wx.getStorageSync('userIcon')
if (icon) {
wx.navigateTo({
url: './mineinfo',
})
} else {
this.getUserProfile(e)
}
} catch (err) {
}
},
//弹框关闭
onClose(e) {
this.setData({
show: false
})
},
//进行手机号绑定
doBindPhone(e) {
var _self = this
if (_self.checkPhonelegal()) {
app.globalData.bindPhone = _self.data.phone
wx.setStorage({
data: _self.data.phone,
key: 'bindPhone',
})
_self.setData({
show: false
})
}
},
checkPhonelegal() {
var _self = this
if (!utils.isMobile(_self.data.phone)) {
wx.showToast({
title: '请输入正确的手机号',
icon: 'none'
})
return false
} else {
return true
}
},
//绑定手机号输入监听
bindPhone(e) {
this.setData({
phone: e.detail.value
})
},
//显示更多数据
showMoreList() {
if (this.data.index == 1) {
@ -56,11 +169,13 @@ Page({
})
}
},
//新闻切换
tabSelect(e) {
this.setData({
index: e.currentTarget.dataset.id
})
},
//页面跳转
choosePage(e) {
var pagePath = ''
switch (e.currentTarget.dataset.page) {
@ -77,9 +192,19 @@ Page({
pagePath = '../branches/brancheslist'
break
}
wx.navigateTo({
url: pagePath,
})
if (e.currentTarget.dataset.page == '2' || e.currentTarget.dataset.page == '3') {
if (app.globalData.bindPhone != '' && app.globalData.bindPhone.length > 0) {
wx.navigateTo({
url: pagePath,
})
} else {
this.checkBindPhone()
}
} else {
wx.navigateTo({
url: pagePath,
})
}
}, // 获取个人信息
getUserProfile(e) {
let _self = this
@ -98,24 +223,45 @@ Page({
nickName: res.userInfo.nickName,
userIcon: res.userInfo.avatarUrl
})
_self.checkBindPhone()
},
fail(err) {
console.log(err)
//判断是否绑定手机号
wx.showToast({
title: '获取个人信息失败',
icon: 'error'
icon: 'error',
success() {
_self.checkBindPhone()
}
})
}
})
},
//判断是否绑定手机号
checkBindPhone() {
try {
var _self = this
var bindPhone = wx.getStorageSync('bindPhone')
if (bindPhone == '' || bindPhone.length <= 0) {
_self.setData({
show: true
})
}
} catch (error) {
}
},
showNoticeDetail(e) {
var item = e.currentTarget.dataset.item
wx.navigateTo({
url: '../notices/noticedetail',
url: '../notices/noticedetail?id=' + item.contentId,
})
},
showAnswerDetail(e) {
var item = e.currentTarget.dataset.item
wx.navigateTo({
url: '../answer/answerdetail?id=' + item.contentId,
})
}
})

View File

@ -4,7 +4,7 @@
</cu-custom>
<view style="display:flex;flex-direction:column;">
<!-- 姓名和头像 -->
<view style="width:100%;" bindtap="getUserProfile">
<view style="width:100%;" bindtap="showMineInfo">
<image src="/images/icons/ic_user_center_bg.png" mode="scaleToFill" style="width:100%;height:300rpx;"></image>
<view class="userinfo-container">
<view class="userinfo-icon round lg" style="background-image:url({{userIcon}});">
@ -63,12 +63,14 @@
<view wx:if="{{index==1}}">
<view class="list" wx:if="{{noticeList.length>0}}">
<view class="item" wx:for="{{noticeList}}" wx:key="index" bindtap="showNoticeDetail" data-item="{{item}}">
<view class="cu-avatar radius xl"
style="background-image:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.czcaizhi.com%2FContent%2FUploadFiles%2Fimage%2F20180920%2F20180920133956_3429.jpg&refer=http%3A%2F%2Fwww.czcaizhi.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622110389&t=4ae9d4f943c30ac6d43801515eec97e5);">
</view>
<image class="cu-avatar radius" style="width:200rpx;height:120rpx;min-width:200rpx;min-height:120rpx;"
src="{{item.showPhoto}}" mode="scaleToFill"></image>
<view class="content">
<text class="text-cut-two text-black text-bold">2021年4-6月特种设备作业人员培训开班通知</text>
<text class="text-cut">新东方在线</text>
<text class="text-cut-two text-black text-bold">{{item.title}}</text>
<view class="flex justify-between">
<text class="text-cut">{{item.source}}</text>
<text class="text-cut">{{item.publishDate}}</text>
</view>
</view>
</view>
</view>
@ -78,13 +80,15 @@
<!-- 报考问答 -->
<view wx:elif="{{index==2}}">
<view class="list" wx:if="{{answerList.length>0}}">
<view class="item" wx:for="{{answerList}}" wx:key="index" bindtap="showAnswerDetail" data-item="{{iteml}}">
<view class="cu-avatar radius xl"
style="background-image:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.mp.itc.cn%2Fupload%2F20170329%2Fe43529bd3d4b458398baa070ba4fec28_th.jpeg&refer=http%3A%2F%2Fimg.mp.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622110898&t=032e76a88837738c204fa527c1df6643);">
</view>
<view class="item" wx:for="{{answerList}}" wx:key="index" bindtap="showAnswerDetail" data-item="{{item}}">
<image class="cu-avatar radius" style="width:200rpx;height:120rpx;min-width:200rpx;min-height:120rpx;"
src="{{item.showPhoto}}" mode="scaleToFill"></image>
<view class="content">
<text class="text-cut text-black text-bold">怎么注册?</text>
<text class="text-cut">新东方在线</text>
<text class="text-cut text-black text-bold">{{item.title}}</text>
<view class="flex justify-between">
<text class="text-cut">{{item.source}}</text>
<text class="text-cut">{{item.publishDate}}</text>
</view>
</view>
</view>
</view>
@ -93,4 +97,17 @@
</view>
</view>
</view>
</view>
<van-popup show="{{ show }}" position="bottom" bind:close="onClose">
<view style="padding:20rpx;">
<view class="text-xl text-bold margin-bottom-sm">手机号绑定</view>
<view class="cu-bar bg-white search">
<view class="search-form round" style="margin-top:5rpx;margin-bottom:5rpx">
<text class="cuIcon-mobile"></text>
<input cursor-spacing="80" type="text" placeholder="请输入手机号" confirm-type="done" bindinput="bindPhone"></input>
</view>
</view>
<view class="cu-btn bg-gradual-blue radius margin-top padding-tb" style="width:100%;"
bindtap="doBindPhone">绑定</view>
</view>
</van-popup>

View File

@ -1,4 +1,53 @@
<!--pages/index/mineinfo.wxml-->
<cu-custom bgColor="bg-darkblue" isBack="{{true}}" isRelaunch="{{false}}">
<view slot="content" style="color:#FFFFFF;">个人信息</view>
</cu-custom>
</cu-custom>
<scroll-view style="width:100%;">
<view class="content-view ">
<view class="content-detail">
<view class="table-list padding-bottom">
<view class="table-item-no">
<view class="table-item-title text-blod text-black text-lg">姓名:</view>
<view class="table-item-content-3 text-black text-df">姓名</view>
</view>
<view class="line-gray"></view>
<view class="table-item-no">
<view class="table-item-title text-blod text-black text-lg">证件号码:</view>
<view class="table-item-content-3 text-black text-df">188888888888888</view>
</view>
<view class="line-gray"></view>
<view class="table-item-no">
<view class="table-item-title text-blod text-black text-lg">出生日期:</view>
<view class="table-item-content-3 text-black text-df">188888888888888</view>
</view>
<view class="line-gray"></view>
<view class="table-item-no">
<view class="table-item-title text-blod text-black text-lg">性别:</view>
<view class="table-item-content-3 text-black text-df">188888888888888</view>
</view>
<view class="line-gray"></view>
<view class="table-item-no">
<view class="table-item-title text-blod text-black text-lg">文化程度:</view>
<view class="table-item-content-3 text-black text-df">188888888888888</view>
</view>
<view class="line-gray"></view>
<view class="table-item-no">
<view class="table-item-title text-blod text-black text-lg">电话号码:</view>
<view class="table-item-content-3 text-black text-df">188888888888888</view>
</view>
<view class="line-gray"></view>
<view class="table-item-no">
<view class="table-item-title text-blod text-black text-lg">单位名称:</view>
<view class="table-item-content-3 text-black text-df">188888888888888</view>
</view>
<view class="line-gray"></view>
<view class="table-item-no">
<view class="table-item-title text-blod text-black text-lg">通信地址:</view>
<view class="table-item-content-3 text-black text-df">内蒙古呼和浩特市赛罕区内蒙古呼和浩特市赛罕区内蒙古呼和浩特市赛罕区内蒙古呼和浩特市赛罕区
</view>
</view>
<view class="line-gray"></view>
</view>
</view>
</view>
</scroll-view>

View File

@ -6,27 +6,42 @@ Page({
* 页面的初始数据
*/
data: {
noticeContent: `<div class="div_class">
<p class="p">各有关单位:<br/>
为满足企业对特种设备作业人员专业素质的需求支持企业对特种设备作业人员进行专业知识操作技能和安全教育工作推进行业专业技术水平的提升广州市特种设备行业协会对国家市场监管总局已取消的特种设备作业项目组织行业相关特种设备作业人员进行继续教育培训考核欢迎各相关单位学员自愿参加对考核合格的特种设备作业人员由广州市特种设备行业协会发放广州市特种设备行业协会培训证书本协会定于2020年1-3月举办下列培训班现将有关事项通知如下<br/>
报名日期即日起至开班前两个工作日办理报名交费手续<br/>
报名交费地点广州市东风东路754号之八城迹酒店8咨询电话 020-34277197转分机号801~808或13342813020\\13500003204<br/>
报名须知<br/>
()年满18周岁且不超过60周岁<br/>
()申请人员身体健康能够适应所申请考核作业项目的需要<br/>
()具有初中及以上文化程度<br/>
()具备必要的安全技术知识与技能<br/>
()安全教育须提前1个月提交资料报名且年龄不超65周岁<br/>
广州市特种设备行业协会培训证书考证安全教育需提交资料<br/>
</p>
</div>`
noticeContent: '',
inId: '',
detailBean: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
inId: options.id
})
this.getInstitutionDetail()
},
getInstitutionDetail() {
var _self = this
wx.showLoading({
title: '加载中...',
})
app.restAjax.get(app.restAjax.path(app.apis.getInstitutionDetailById, [app.baseUrls.cardUrl, _self.data.inId]), {}, {},
(code, data) => {
wx.hideLoading({})
if (code == 200) {
var ps = data.institutionImage.split(',')
var photos = []
for (var i = 0; i < ps.length; i++) {
var urls = app.baseUrls.cardUrl + app.baseUrls.baseImgUrl + ps[i]
photos = photos.concat(urls)
}
data.showPhoto = photos
_self.setData({
detailBean: data
})
}
}, (code, error) => {
wx.hideLoading({})
})
}
})

View File

@ -6,11 +6,35 @@
<view class="content-view">
<view class="content-detail">
<view class="notice-title text-xl text-bold">
<text>东方红培训机构</text>
<text>{{detailBean.institutionName}}</text>
</view>
<view class="line-gray" style="width:100%;height:20rpx;"></view>
<view class="text-lg text-black">
<rich-text nodes="{{noticeContent}}" space="nbsp"></rich-text>
<view class="line-gray margin-top-sm" style="width:100%;height:20rpx;"></view>
<view class="flex margin-top-sm" style="width:100%">
<view class="text-lg text-black">
<text class="cuIcon-people text-darkblue"></text>
负责人:{{detailBean.institutionPrincipal}}</view>
</view>
<view class="flex margin-top-sm" style="width:100%">
<view class="text-lg text-black">
<text class="cuIcon-mobile text-darkblue"></text>
联系方式:{{detailBean.institutionContact}}</view>
</view>
<view class="flex margin-top-sm" style="width:100%">
<view class="text-lg text-black">
<text class="cuIcon-time text-darkblue"></text>
成立日期:{{detailBean.institutionFoundingTime}}</view>
</view>
<view class="flex margin-top-sm" style="width:100%">
<view class="text-lg text-black">
<text class="cuIcon-location text-darkblue"></text>地址:{{detailBean.institutionAddress}}</view>
</view>
<view class="text-df text-black margin-top">
<rich-text nodes="{{detailBean.institutionDesc}}" space="nbsp"></rich-text>
</view>
<view class="flex margin-top flex-direction">
<view class="margin-top-sm" wx:for="{{detailBean.showPhoto}}" wx:for-item="img" wx:key="index">
<image src="{{img}}" mode="widthFix"></image>
</view>
</view>
</view>
</view>

View File

@ -8,31 +8,56 @@ Page({
*/
data: {
CustomBar: app.globalData.CustomBar,
institutionsList: [{}, {}],
institutionsList: [],
countTime: 2000, //延迟搜索 时间
searchWaiting: false, //是否等待搜索倒计时中,
searchKey: '',
mapLocs: []
mapLocs: [],
currentPage: 1,
totalSize: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {},
onLoad: function (options) {
this.getInstitutionsList('')
},
doLoadMore() {
var _self = this
if (_self.data.totalSize > _self.data.institutionsList.length) {
_self.setData({
currentPage: ++_self.data.currentPage
})
_self.getInstitutionsList(_self.data.searchKey)
} else {
wx.showToast({
title: '无更多数据了',
icon: 'none'
})
}
},
doNavigation(e) {
var item = e.currentTarget.dataset.item
var locs = utils.bdMapToQQMap(116.34304, 39.948131)
var lng = locs[0]
var lat = locs[1]
wx.openLocation({
latitude: Number(lat),
longitude: Number(lng),
})
if (item.institutionX == '' || item.institutionY == '') {
wx.showToast({
title: '机构坐标有误',
icon: 'error'
})
} else {
var locs = utils.bdMapToQQMap(item.institutionX, item.institutionY)
var lng = locs[0]
var lat = locs[1]
wx.openLocation({
latitude: Number(lat),
longitude: Number(lng),
})
}
},
showDetail(e) {
var item = e.currentTarget.dataset.item
wx.navigateTo({
url: './institutionsdetail',
url: './institutionsdetail?id=' + item.institutionId,
})
},
doSearch(e) {
@ -46,14 +71,48 @@ Page({
}
},
getInstitutionsList(key) {
console.log('搜索中' + key)
var _self = this
app.restAjax.get(app.restAjax.path(app.apis.getInstitutionList, [app.baseUrls.cardUrl]), {
page: _self.data.currentPage,
keywords: key
}, {},
(code, data) => {
wx.hideLoading({})
if (code == 200) {
for (var i = 0; i < data.rows.length; i++) {
var item = data.rows[i]
if (item.institutionImage.length > 0) {
var photos = item.institutionImage.split(',')
data.rows[i].showPhoto = app.baseUrls.cardUrl + app.baseUrls.baseImgUrl + photos[0]
} else {
data.rows[i].showPhoto = '../../images/icons/institutions_default.jpeg'
}
}
if (_self.data.currentPage > 1) {
if (data.rows.length > 0) {
_self.data.institutionsList = _self.data.institutionsList.concat(data.rows)
}
} else {
_self.data.institutionsList = data.rows
}
_self.setData({
institutionsList: _self.data.institutionsList,
totalSize: data.total
})
}
}, (code, err) => {
wx.hideLoading({})
})
},
//
/**
* 延迟搜索
*/
timer() {
var _self = this;
this.setData({
currentPage: 1,
totalSize: 0,
searchWaiting: true
})
let promise = new Promise((resolve, reject) => {
@ -64,6 +123,7 @@ Page({
countTime: _self.data.countTime - 1000
})
if (_self.data.countTime <= 0) {
console.log('开始搜索: ' + _self.data.searchKey);
_self.setData({
countTime: 2000,
@ -74,6 +134,9 @@ Page({
}, 1000)
})
promise.then((setTimer) => {
wx.showLoading({
title: '搜索中...',
})
_self.getInstitutionsList(_self.data.searchKey)
clearInterval(setTimer) //清除计时器
})

View File

@ -11,23 +11,23 @@
<scroll-view style="margin-top:70rpx;padding-left:10rpx;padding-right:10rpx;">
<view class="list" wx:if="{{institutionsList.length>0}}">
<view class="item bg-white" wx:for="{{institutionsList}}" wx:key="index">
<view class="cu-avatar radius xl" bindtap="showDetail" data-item="{{item}}"
style="background-image:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20180322%2F838c068557384d70a2fc27e2fce74af2.jpeg&refer=http%3A%2F%2F5b0988e595225.cdn.sohucs.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622183422&t=99df214728b454e7b725de7d6a3d85b9);">
</view>
<image class="cu-avatar radius" style="width:200rpx;height:120rpx;min-width:200rpx;min-height:120rpx;"
src="{{item.showPhoto}}" mode="scaleToFill" bindtap="showDetail" data-item="{{item}}"></image>
<view class="content">
<text class="text-cut-two text-black text-bold" bindtap="showDetail"
data-item="{{item}}">包头市东方红培训机构</text>
data-item="{{item}}">{{item.institutionName}}</text>
<view class="text-cut text-gray" bindtap="showDetail" data-item="{{item}}">
<text class="cuIcon-mobile text-darkblue"></text><text class="margin-left-smm">0472-8888888</text>
<text class="cuIcon-mobile text-darkblue"></text><text
class="margin-left-smm">{{item.institutionContact}}</text>
</view>
<view class="text-cut text-gray" bindtap="showDetail" data-item="{{item}}">
<text class="cuIcon-location text-darkblue"></text><text
class="margin-left-smm">包头市昆区团结路88号包头市昆区团结路88号包头市昆区团结路88号包头市昆区团结路88号</text>
class="margin-left-smm">{{item.institutionAddress}}</text>
</view>
<view class="bottom-action">
<view>
<text class="cuIcon-time text-darkblue"></text>
<text class="margin-left-smm">2021-12-12</text>
<text class="margin-left-smm">{{item.institutionFoundingTime}}</text>
</view>
<view bindtap="doNavigation" data-item="{{item}}">
<text class="cuIcon-taxi text-darkblue"></text>

View File

@ -6,28 +6,47 @@ Page({
* 页面的初始数据
*/
data: {
noticeContent: `<div class="div_class">
<p class="p">各有关单位:<br/>
为满足企业对特种设备作业人员专业素质的需求支持企业对特种设备作业人员进行专业知识操作技能和安全教育工作推进行业专业技术水平的提升广州市特种设备行业协会对国家市场监管总局已取消的特种设备作业项目组织行业相关特种设备作业人员进行继续教育培训考核欢迎各相关单位学员自愿参加对考核合格的特种设备作业人员由广州市特种设备行业协会发放广州市特种设备行业协会培训证书本协会定于2020年1-3月举办下列培训班现将有关事项通知如下<br/>
报名日期即日起至开班前两个工作日办理报名交费手续<br/>
报名交费地点广州市东风东路754号之八城迹酒店8咨询电话 020-34277197转分机号801~808或13342813020\\13500003204<br/>
报名须知<br/>
()年满18周岁且不超过60周岁<br/>
()申请人员身体健康能够适应所申请考核作业项目的需要<br/>
()具有初中及以上文化程度<br/>
()具备必要的安全技术知识与技能<br/>
()安全教育须提前1个月提交资料报名且年龄不超65周岁<br/>
广州市特种设备行业协会培训证书考证安全教育需提交资料<br/>
</p>
</div>`
noticeContent: '',
articleId: '',
detailBean: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
articleId: options.id
})
this.getArticleDetail()
},
getArticleDetail() {
var _self = this
wx.showLoading({
title: '加载中...',
})
app.restAjax.get(app.restAjax.path(app.apis.getArticleDetailById, [app.baseUrls.cardUrl, _self.data.articleId]), {}, {},
(code, data) => {
wx.hideLoading({})
if (code == 200) {
data.content = _self.checkImgSrc(data.content)
_self.setData({
detailBean: data
})
}
}, (code, err) => {
wx.hideLoading({})
})
},
checkImgSrc(content) {
if (content.indexOf('img') != -1) { //判断img是否存在
var result = content.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function (match, capture) {
console.log(capture);
return '<img src=' + app.baseUrls.cardUrl + capture + ' style="max-width:100%;height:auto;display:block;margin:10px 0;"/>';
});
return result
} else {
return content
}
}
})

View File

@ -6,11 +6,15 @@
<view class="content-view">
<view class="content-detail">
<view class="notice-title text-xl text-bold">
<text>2020年1-3月广州市特种设备行业协会培训证书开班通知</text>
<text>{{detailBean.title}}</text>
</view>
<view class="line-gray" style="width:100%;height:20rpx;"></view>
<view class="text-lg text-black">
<rich-text nodes="{{noticeContent}}" space="nbsp"></rich-text>
<view class="flex margin-top-sm" style="justify-content:space-around;width:100%">
<view>发布日期:{{detailBean.publishDate}}</view>
<view>培训机构:{{detailBean.source}}</view>
</view>
<view class="line-gray margin-top-sm" style="width:100%;height:20rpx;"></view>
<view class="text-lg text-black padding-sm">
<rich-text nodes="{{detailBean.content}}" space="nbsp"></rich-text>
</view>
</view>
</view>

View File

@ -10,21 +10,38 @@ Page({
CustomBar: app.globalData.CustomBar,
countTime: 2000, //延迟搜索 时间
searchWaiting: false, //是否等待搜索倒计时中,
searchKey: ''
searchKey: '',
contentHeight: app.globalData.windowHeight,
currentPage: 1,
totalSize: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getResultsList('')
},
showDetail(e) {
var item = e.currentTarget.dataset.item
wx.navigateTo({
url: './noticedetail',
url: './noticedetail?id=' + item.contentId,
})
},
doLoadMore() {
var _self = this
if (_self.data.totalSize > _self.data.noticeList.length) {
_self.setData({
currentPage: ++_self.data.currentPage
})
_self.getResultsList(_self.data.searchKey)
} else {
wx.showToast({
title: '无更多数据了',
icon: 'none'
})
}
},
doSearch(e) {
this.setData({
countTime: 2000,
@ -36,7 +53,42 @@ Page({
}
},
getResultsList(key) {
console.log('搜索中' + key)
var _self = this
app.restAjax.get(app.restAjax.path(app.apis.getArticleList, [app.baseUrls.cardUrl]), {
categoryId: '2ff8f6be-a435-46c1-98b7-47b16c621395',
page: _self.data.currentPage,
rows: '10',
keywords: key
}, {},
function (code, data) {
wx.hideLoading({})
if (code == 200) {
for (var i = 0; i < data.rows.length; i++) {
var item = data.rows[i]
if (item.coverPhotos.length > 0) {
var photos = item.coverPhotos.split(',')
data.rows[i].showPhoto = app.baseUrls.cardUrl + app.baseUrls.baseImgUrl + photos[0]
} else {
data.rows[i].showPhoto = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.czcaizhi.com%2FContent%2FUploadFiles%2Fimage%2F20180920%2F20180920133956_3429.jpg&refer=http%3A%2F%2Fwww.czcaizhi.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622110389&t=4ae9d4f943c30ac6d43801515eec97e5'
}
}
if (_self.data.currentPage > 1) {
if (data.rows.length > 0) {
_self.data.noticeList = _self.data.noticeList.concat(data.rows)
}
} else {
_self.data.noticeList = data.rows
}
_self.setData({
noticeList: _self.data.noticeList,
totalSize: data.total
})
}
},
function (code, err) {
wx.hideLoading({})
console.log(err)
})
},
/**
* 延迟搜索
@ -44,6 +96,8 @@ Page({
timer() {
var _self = this;
this.setData({
currentPage: 1,
totalSize: 0,
searchWaiting: true
})
let promise = new Promise((resolve, reject) => {
@ -55,6 +109,7 @@ Page({
})
if (_self.data.countTime <= 0) {
console.log('开始搜索: ' + _self.data.searchKey);
_self.setData({
countTime: 2000,
searchWaiting: false,
@ -64,6 +119,9 @@ Page({
}, 1000)
})
promise.then((setTimer) => {
wx.showLoading({
title: '搜索中...',
})
_self.getResultsList(_self.data.searchKey)
clearInterval(setTimer) //清除计时器
})

View File

@ -8,15 +8,18 @@
<input type="text" placeholder="请输入关键字" confirm-type="search" bindinput="doSearch"></input>
</view>
</view>
<scroll-view style="margin-top:70rpx;padding-left:10rpx;padding-right:10rpx;">
<view class="list" wx:if="{{noticeList.length>0}}">
<scroll-view style="margin-top:70rpx;padding-left:10rpx;padding-right:10rpx;height:{{contentHeight}}px;" scroll-y="true"
bindscrolltolower="doLoadMore">
<view class=" list" wx:if="{{noticeList.length>0}}">
<view class="item" wx:for="{{noticeList}}" wx:key="index" bindtap="showDetail" data-item="{{item}}">
<view class="cu-avatar radius xl"
style="background-image:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.czcaizhi.com%2FContent%2FUploadFiles%2Fimage%2F20180920%2F20180920133956_3429.jpg&refer=http%3A%2F%2Fwww.czcaizhi.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622110389&t=4ae9d4f943c30ac6d43801515eec97e5);">
</view>
<image class="cu-avatar radius" style="width:200rpx;height:120rpx;min-width:200rpx;min-height:120rpx;"
src="{{item.showPhoto}}" mode="scaleToFill"></image>
<view class="content">
<text class="text-cut text-black text-bold">2021年4-6月特种设备作业人员培训开班通知</text>
<text class="text-cut">新东方在线</text>
<text class="text-cut text-black text-bold">{{item.title}}</text>
<view class="flex justify-between">
<text class="text-cut">{{item.source}}</text>
<text class="text-cut">{{item.publishDate}}</text>
</view>
</view>
</view>
</view>

View File

@ -6,7 +6,7 @@ Page({
* 页面的初始数据
*/
data: {
resultsList: [{}, {}],
resultsList: [],
CustomBar: app.globalData.CustomBar,
countTime: 2000, //延迟搜索 时间
searchWaiting: false, //是否等待搜索倒计时中,
@ -17,13 +17,38 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getResultsList('')
},
getResultsList(key) {
var _self = this
wx.showLoading({
title: '加载中...',
})
app.restAjax.get(app.restAjax.path(app.apis.getScoreList, [app.baseUrls.cardUrl]), {}, {
headers: {
token: app.globalData.token
}
},
(code, data) => {
wx.hideLoading({})
if (code == 200) {
_self.setData({
resultsList: data
})
}
}, (code, error) => {
wx.hideLoading({})
wx.showToast({
title: '网络错误',
icon: 'error'
})
})
},
showDetail(e) {
var item = e.currentTarget.dataset.item
wx.navigateTo({
url: './resultsdetail',
})
// var item = e.currentTarget.dataset.item
// wx.navigateTo({
// url: './resultsdetail',
// })
},
doSearch(e) {
this.setData({
@ -35,9 +60,6 @@ Page({
this.timer();
}
},
getResultsList(key) {
console.log('搜索中' + key)
},
/**
* 延迟搜索
*/

View File

@ -2,23 +2,34 @@
<cu-custom bgColor="bg-darkblue" isBack="{{true}}" isRelaunch="{{false}}">
<view slot="content" style="color:#FFFFFF;">成绩查询</view>
</cu-custom>
<view class="cu-bar bg-white search fixed" style="top:{{CustomBar}}px">
<!-- <view class="cu-bar bg-white search fixed" style="top:{{CustomBar}}px">
<view class="search-form round" style="margin-top:5rpx;margin-bottom:5rpx">
<text class="cuIcon-search"></text>
<input type="text" placeholder="请输入关键字" confirm-type="search" bindinput="doSearch"></input>
</view>
</view>
<scroll-view style="margin-top:70rpx;padding-left:10rpx;padding-right:10rpx;">
</view> -->
<scroll-view style="padding-left:10rpx;padding-right:10rpx;margin-top:-10px;">
<view class="list" wx:if="{{resultsList.length>0}}">
<view class="item" wx:for="{{resultsList}}" wx:key="index" bindtap="showDetail" data-item="{{item}}">
<view class="cu-avatar radius xl"
style="background-image:url(https://img0.baidu.com/it/u=3328192120,981881484&fm=26&fmt=auto&gp=0.jpg);">
</view>
<view class="item bg-white" wx:for="{{resultsList}}" wx:key="index" bindtap="showDetail" data-item="{{item}}">
<view class="content">
<text class="text-cut-two text-black text-bold">2021年4月考试成绩</text>
<view class="text-cut">
<text class="cuIcon-time text-darkblue"></text>
<text class="text-darkblue margin-left-smm">考试日期:2021-12-12</text>
<text class="text-cut-two text-black text-bold">{{item.classPlanDTO.planName}}</text>
<view class="margin-top-sm">
<text class="cuIcon-time text-darkblue"></text>
<text>考试日期:{{item.examStartTime}}</text>
</view>
<view class="margin-top-sm">
<text class="cuIcon-location text-darkblue"></text>
<text>培训机构:{{item.classPlanDTO.orgName}}</text>
</view>
<view class="margin-top-sm">
<text class="cuIcon-form text-darkblue"></text>
<text>专业:{{item.classPlanDTO.workerCatalogName}}</text>
</view>
<view class="margin-top-sm flex align-center">
<text class="cuIcon-text text-darkblue"></text>
<view>成绩:
<text class="text-red text-xl">{{item.applyTestScores}}</text>
</view>
</view>
</view>
</view>

24
utils/api.js Normal file
View File

@ -0,0 +1,24 @@
var baseUrls = {
userCenter: 'https://192.168.0.103:7001/usercenter/',
cardUrl: 'http://192.168.0.111:8089/signup/',
loginUrl: 'http://192.168.0.111:8088/businesscard/',
tradeUrl: 'http://192.168.0.111:8088/businesscard/',
baseImgUrl: 'route/file/download/true/'
}
var apis = {
login: '',
doUploadImg: '{baseUrl}app/file/uploadimage', //上传图片
doUploadVideo: '{baseUrl}app/file/uploadvideo', //上传视频
getArticleList: '{baseUrl}app/contentrelease/listpage', //获取开班通告或报考问答 根据categoryId获取
getArticleDetailById: '{baseUrl}app/contentrelease/get/{contentId}', //获取开班通告报考问答详情
getInstitutionList: '{baseUrl}app/traininginstitution/listpagerelease', //培训机构列表
getInstitutionDetailById: '{baseUrl}app/traininginstitution/get/release/{applyId}', //培训机构详情
getCardList: '{baseUrl}app/basic-staff-info/list-my-exam', //获取我的考试列表
getScoreList: '{baseUrl}app/applystudents/list', //获取成绩列表
}
module.exports = {
apis,
baseUrls
}

239
utils/restAjax.js Normal file
View File

@ -0,0 +1,239 @@
const api = require('../utils/api');
var methods = {
POST_METHOD: 'POST',
DELETE_METHOD: 'DELETE',
PUT_METHOD: 'PUT',
GET_METHOD: 'GET'
};
/**
* 新增
* @param url
* @param dataObj
* @param args
* @param successCallback
* @param errorCallback
* @param completeCallback
*/
function postJson(url, dataObj, args, successCallback, errorCallback, completeCallback) {
doAjax(url, methods.POST_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
}
/**
* 删除
* @param url
* @param dataObj
* @param args
* @param successCallback
* @param errorCallback
* @param completeCallback
*/
function deleteForm(url, dataObj, args, successCallback, errorCallback, completeCallback) {
doAjax(url, methods.DELETE_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
}
/**
* 修改
* @param url
* @param dataObj
* @param args
* @param successCallback
* @param errorCallback
* @param completeCallback
*/
function putJson(url, dataObj, args, successCallback, errorCallback, completeCallback) {
doAjax(url, methods.PUT_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
}
/**
* 查询
* @param url
* @param dataObj
* @param args
* @param successCallback
* @param errorCallback
* @param completeCallback
*/
function getForm(url, dataObj, args, successCallback, errorCallback, completeCallback) {
doAjax(url, methods.GET_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
}
/**
* 执行上传
* @param url
* @param method
* @param dataObj
* @param args
* @param successCallback
* @param errorCallback
* @param completeCallback
*/
function doAjax(url, method, dataObj, args, successCallback, errorCallback, completeCallback) {
var headers = {};
if (args != null && typeof (args.headers) != 'undefined' && args.headers != null) {
headers = args.headers;
}
wx.request({
url: url,
method: method,
data: dataObj,
header: headers,
dataType: 'json',
success: function (response) {
if (response.statusCode == 200) {
successCallback(response.statusCode, response.data, args);
} else {
if (errorCallback && typeof (errorCallback) == 'function') {
errorCallback(response.statusCode, response.data);
}
}
},
fail: function (response) {
if (errorCallback && typeof errorCallback == 'function') {
errorCallback(response.statusCode, response)
}
},
complete: function () {
if (completeCallback && typeof (completeCallback) == 'function') {
completeCallback();
}
}
})
}
/**
* 检测是路径参数有重复值
* @param pathArgArray
* @returns {boolean}
*/
function pathArgsHasSameValue(pathArgArray) {
var tempArgIndex = 0;
var tempArgs = pathArgArray[tempArgIndex];
for (var i = (tempArgIndex + 1), item; item = pathArgArray[i]; i++) {
if (tempArgs == item) {
throw new Error('参数' + item + '有重复值!!!');
}
if (i == pathArgArray.length - 1) {
tempArgs = pathArgArray[++tempArgIndex];
i = tempArgIndex;
continue;
}
}
}
/**
* 获取页面间传递的参数
* @param url
*/
function getParamsArg(url) {
var params = url.split('?')[1];
var paramsObj = {};
if (typeof (params) == 'undefined' || params == null) {
return paramsObj;
}
var paramsKVs = params.split('&');
for (var i = 0, item = null; item = paramsKVs[i++];) {
var kvs = item.split('=');
if (kvs.length == 1) {
paramsObj[kvs[0]] = null;
}
if (kvs.length == 2) {
paramsObj[kvs[0]] = decodeURI(kvs[1]);
}
}
return paramsObj;
}
/**
* 构建路径
* @param basePath 请求路径{参数},
* @param pathArgs 替换的路径参数不能重复
* @returns {*}
*/
function buildPath(basePath, pathArgs) {
var path = basePath;
if (!basePath || !(typeof (basePath) == 'string')) {
throw new Error('basePath必须为字符串!!!');
}
if (!pathArgs || !Array.isArray(pathArgs)) {
throw new Error('pathArgs必须为数组!!!');
}
var pathArgArray = basePath.match(/\{\w+\}/g);
if (!pathArgArray) {
return path;
}
pathArgsHasSameValue(pathArgArray);
for (var i = 0, item; item = pathArgArray[i]; i++) {
path = path.replace(item, pathArgs[i]);
}
return path;
}
/**
* 通过form对象上传文件
* @param url
* @param formData
* @param args
* @param successCallback
* @param errorCallback
* @param beforeCallback
* @param completeCallback
*/
function postFile(url, path, name, args, successCallback, errorCallback, completeCallback) {
var headers = {};
if (args != null && typeof (args.headers) != 'undefined' && args.headers != null) {
headers = args.headers;
}
wx.uploadFile({
filePath: path,
name: name,
url: url,
header: headers,
success: function (response) {
if (response.statusCode == 200) {
successCallback(response.statusCode, response.data, args);
} else {
if (errorCallback && typeof (errorCallback) == 'function') {
errorCallback(response.statusCode, response.data);
}
}
},
fail: function (response) {
if (errorCallback && typeof errorCallback == 'function') {
errorCallback(response.statusCode, response.data)
}
},
complete: function () {
if (completeCallback && typeof (completeCallback) == 'function') {
completeCallback();
}
}
})
};
/**
* xss 转义
* @param html
* @returns {string}
*/
function escape(html) {
return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&amp;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(/'/g, '&#39;').replace(/"/g, '&quot;');
}
module.exports = {
post: postJson,
delete: deleteForm,
put: putJson,
get: getForm,
params: getParamsArg,
path: buildPath,
escape: escape,
file: postFile,
apis: api.apis,
baseUrl: api.baseUrls
}

View File

@ -49,10 +49,19 @@ function qqMapToBMap(lng, lat) {
var lng = (z * Math.cos(theta) + 0.0065).toFixed(5);
var lat = (z * Math.sin(theta) + 0.006).toFixed(5);
return [lng, lat];
}
function isMobile(phone) {
var myreg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
if (!myreg.test(phone)) {
return false
} else {
return true
}
}
module.exports = {
formatTime,
bdMapToQQMap,
qqMapToBMap
qqMapToBMap,
isMobile
}