diff --git a/app.json b/app.json
index b092dc2..41dddcf 100644
--- a/app.json
+++ b/app.json
@@ -96,7 +96,8 @@
"pages/safelist/index",
"pages/safefeedback/index",
"pages/safefeedback/add",
- "pages/operation/operationedit"
+ "pages/operation/operationedit",
+ "pages/mgt/index"
],
"window": {
"backgroundTextStyle": "light",
diff --git a/pages/bind/binduser.js b/pages/bind/binduser.js
index 460a5cd..a9371bd 100644
--- a/pages/bind/binduser.js
+++ b/pages/bind/binduser.js
@@ -191,6 +191,11 @@ Page({
url = '/pages/safelist/index?fromwx=1&id='+id
getApp().globalData.hopeUrl = url
}
+ else if(q.indexOf("mgt")!=-1){
+ let id = util.getQueryString(q, 'id')
+ url = '/pages/mgt/index?fromwx=1&id='+id
+ getApp().globalData.hopeUrl = url
+ }
}
}
if(getApp().globalData.sessionId){
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index a2da864..0ea87d9 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -84,19 +84,19 @@
-
+
diff --git a/pages/mgt/index.js b/pages/mgt/index.js
new file mode 100644
index 0000000..ab2feba
--- /dev/null
+++ b/pages/mgt/index.js
@@ -0,0 +1,195 @@
+
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ page: 1,
+ serverUrl: getApp().globalData.serverUrl,
+ datalist: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ that.onPullDownRefresh();
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+ var that = this;
+ that.getDatalist(1);
+ wx.stopPullDownRefresh();
+ this.data.page = 1;
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+ //上拉分页,将页码加1,然后调用分页函数
+ this.data.page = this.data.page + 1;
+ this.getDatalist();
+ wx.stopPullDownRefresh();
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+ getDatalist: function (page, search = '') {
+ var that = this;
+ if (page != 1) { page = that.data.page }
+ wx.showLoading({
+ title: '加载中',
+ }),
+ wx.request({
+ url: this.data.serverUrl + 'mgt/api?a=listall&rows=10&page=' + page + '&search=' + search,
+ 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,
+ datalist: []
+ })
+ }
+ else {
+ wx.showModal({
+ content: "已经到底啦!",
+ showCancel: false,
+ confirmText: "确定",
+ })
+ }
+ } else {
+ let list
+ if (page == 1) {
+ list = res.data.rows
+ } else {
+ list = this.data.datalist.concat(res.data.rows)
+ }
+ this.setData({
+ total: res.data.total,
+ datalist: list
+ })
+ }
+ }
+ wx.hideLoading();
+ }
+ });
+ },
+ //搜索框文本内容显示
+ inputBind: function (event) {
+ this.setData({
+ inputValue: event.detail.value
+ })
+ },
+ query: function () {
+ this.page = 1
+ this.getDatalist(this.page, this.data.inputValue)
+ },
+ reset: function () {
+ this.page = 1
+ this.inputValue = ''
+ this.getDatalist(this.page)
+ },
+ openfj: function(e){
+ var that = this
+ let fileurl = getApp().globalData.serverUrl + e.currentTarget.dataset.operprocepath
+ wx.showLoading({
+ title: '正在下载...',
+ })
+ wx.request({
+ url: getApp().globalData.serverUrl + 'api/getprodata?a=readnum&id=' + e.currentTarget.dataset.id,
+ header: {
+ 'content-type': 'application/json', // 默认值
+ 'Cookie': getApp().globalData.sessionId,
+ },
+ success: res => {
+ }
+ });
+ wx.downloadFile({
+ url: fileurl,
+ success(res) {
+ wx.showLoading({
+ title: '成功,正在打开...',
+ })
+ const filePath = res.tempFilePath
+ var filetype
+ if (fileurl.indexOf(".docx") != -1) {
+ filetype = 'docx'
+ }
+ else if (fileurl.indexOf(".doc") != -1) {
+ filetype = 'doc'
+ }
+ else if (fileurl.indexOf(".xlsx") != -1) {
+ filetype = 'xlsx'
+ }
+ else if (fileurl.indexOf(".xls") != -1) {
+ filetype = 'xls'
+ }
+ else if (fileurl.indexOf(".pptx") != -1) {
+ filetype = 'pptx'
+ }
+ else if (fileurl.indexOf(".ppt") != -1) {
+ filetype = 'ppt'
+ }
+ else if (fileurl.indexOf(".pdf") != -1) {
+ filetype = 'pdf'
+ } else {
+ wx.hideLoading()
+ return
+ }
+ wx.openDocument({
+ filePath,
+ fileType: filetype,
+ success(res) {
+ wx.hideLoading()
+ console.log('打开文档成功')
+ }, fail: function (e) {
+ console.log(e)
+ }
+ })
+ }
+ })
+ }
+})
\ No newline at end of file
diff --git a/pages/mgt/index.json b/pages/mgt/index.json
new file mode 100644
index 0000000..8390ee8
--- /dev/null
+++ b/pages/mgt/index.json
@@ -0,0 +1,5 @@
+{
+ "enablePullDownRefresh": true,
+ "onReachBottomDistance": 50,
+ "navigationBarTitleText": "管理制度"
+}
\ No newline at end of file
diff --git a/pages/mgt/index.wxml b/pages/mgt/index.wxml
new file mode 100644
index 0000000..1e8c2d3
--- /dev/null
+++ b/pages/mgt/index.wxml
@@ -0,0 +1,42 @@
+
+
+
+共{{total}}条管理制度
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.mgtname}}
+ {{item.mgtname}}
+ {{item.type__dickeyname}}
+
+
+
+
+
+
+
+
diff --git a/pages/mgt/index.wxss b/pages/mgt/index.wxss
new file mode 100644
index 0000000..b5cf000
--- /dev/null
+++ b/pages/mgt/index.wxss
@@ -0,0 +1,31 @@
+.weui-btn{
+ width:auto;
+ margin: 5px;
+}
+.container {
+ background-color: #fff;
+ color: #939393;
+}
+.head{
+ color:#fff;
+ background-color: cornflowerblue;
+ text-align: center;
+}
+.search
+{
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ width:100%;
+ height:auto;
+ background-color:white;
+ border:2rpx solid goldenrod;
+ border-radius: 5rpx;
+
+}
+
+/* 搜索框提示文字样式 */
+.search input
+{
+ padding-left:30rpx;
+}
diff --git a/pages/operins/index.js b/pages/operins/index.js
index 35f5783..32ead86 100644
--- a/pages/operins/index.js
+++ b/pages/operins/index.js
@@ -14,7 +14,8 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ var that = this;
+ that.onPullDownRefresh();
},
/**
@@ -28,8 +29,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
- var that = this;
- that.onPullDownRefresh();
+
},
/**
diff --git a/pages/operins/index.wxml b/pages/operins/index.wxml
index cc4b37c..0a92296 100644
--- a/pages/operins/index.wxml
+++ b/pages/operins/index.wxml
@@ -1,3 +1,4 @@
+
共{{total}}条规程
@@ -14,12 +15,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/wxs/subutil.wxs b/wxs/subutil.wxs
index e3f1313..e9bbc4e 100644
--- a/wxs/subutil.wxs
+++ b/wxs/subutil.wxs
@@ -14,5 +14,20 @@ var subDate = function(val) {
}
return val.substring(0, 10);
}
+
+function indexOf(val) {
+ if (val.indexOf(".doc") > 0 ||val.indexOf(".docx") > 0 ) {
+ return 2;
+ } else if(val.indexOf(".ppt") > 0 ||val.indexOf(".pptx") > 0 ) {
+ return 3;
+ } else if(val.indexOf(".pdf") > 0 ) {
+ return 4;
+}else if(val.indexOf(".xls") > 0 ||val.indexOf(".xlsx") > 0 ) {
+ return 5;
+}else{
+ return 7
+}
+}
module.exports.sub = sub;
-module.exports.subDate = subDate;
\ No newline at end of file
+module.exports.subDate = subDate;
+module.exports.indexOf = indexOf;
\ No newline at end of file