diff --git a/app.json b/app.json index 5ad17cd..a0b252e 100644 --- a/app.json +++ b/app.json @@ -35,7 +35,9 @@ "pages/emergency/t-x-l/index/index", "pages/statistic/j-b-x-x/personnel/index", "pages/statistic/j-b-x-x/detail/index", - "pages/work/f-b-g-z/index/index" + "pages/work/f-b-g-z/index/index", + "pages/risk-pool/index", + "pages/risk-pool/add-pool/index" ], "window": { "backgroundTextStyle": "light", diff --git a/pages/index/index.js b/pages/index/index.js index 298492b..4a274ac 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -106,6 +106,11 @@ Page({ }, { icon: "icon_w_5", + name: "风险池", + href: "/pages/risk-pool/index" + }, + { + icon: "icon_w_6", name: "发布工作", href: "/pages/work/f-b-g-z/index/index" }, diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 20c4d34..103d787 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -5,6 +5,7 @@ {{userInfo.chinaName}} {{userInfo.postName}} + 道孚县“智慧鲜水”数字化平台 diff --git a/pages/index/index.wxss b/pages/index/index.wxss index c73fa6f..bdcb800 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -10,7 +10,10 @@ width: 90%; text-align: left; } - +.title-text { + color: #ffffff; + font-size: 32rpx; +} .top { width: 100vw; height: 380rpx; diff --git a/pages/risk-pool/add-pool/index.js b/pages/risk-pool/add-pool/index.js new file mode 100644 index 0000000..7124f94 --- /dev/null +++ b/pages/risk-pool/add-pool/index.js @@ -0,0 +1,310 @@ +// 上报动态 +import Utils from "../../../utils/util" +const app = getApp(); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + topBarH: app.globalData.CustomBar, + baseUrl: app.FILE_SERVER_URL, + + dateFilter: Utils.formatTime(new Date(), '-'), + showTypePop: false, + showAdvicePop: false, + TypeData: [], + postData: {}, + files: [], + userInfo:{}, + targetId:'', + }, + + /** + * 显示/关闭弹窗 + */ + popModal: function (params) { + const type = params.currentTarget.dataset.type; + this.data[type] = !this.data[type]; + this.setData(this.data) + }, + + /** + * 类型 + */ + typeChange: function (params) { + const index = params.currentTarget.dataset.index; + this.data.postData.typeId = params.currentTarget.dataset.item.typeId; + this.data.postData.type = index + 1; + this.data.showTypePop = false; + this.setData(this.data); + }, + + /** + * 输入框赋值 + */ + inputContent: function (e) { + const name = e.currentTarget.dataset.name; + this.data.postData[name] = e.detail.value; + this.setData(this.data); + }, + + /** + * 发布 + */ + push: function () { + if (!this.data.postData.title) { + wx.showToast({ + title: '请输入标题', + icon: 'none' + }) + return + } + if (!this.data.postData.startTime) { + wx.showToast({ + title: '请选择开始时间', + icon: 'none' + }) + return + } + if (!this.data.postData.endTime) { + wx.showToast({ + title: '请选择结束时间', + icon: 'none' + }) + return + } + if (!this.data.postData.detail) { + wx.showToast({ + title: '请输入动态内容', + icon: 'none' + }) + return + } + if (!this.data.postData.typeId) { + wx.showToast({ + title: '请选择类型', + icon: 'none' + }) + return + } + + let data = { + ...this.data.postData, + dynamicsId:this.data.uuid, + userId:this.data.userInfo.userId, + targetId:this.data.targetId + }; + app.axios("POST", "app", `/work/wkDynamicsAdd`,data).then(res => { + if (res.code == 1) { + wx.showToast({ + title: '发布成功', + icon: 'none' + }) + setTimeout(() => { + wx.navigateBack() + }, 1500); + } else { + wx.showToast({ + title: res.message, + icon: 'none' + }) + } + }) + }, + + /** + * 选择文件 + */ + chooseFile: function () { + wx.chooseImage({ + count: 1, + type: 'all', + success: (res) => { + const tempFilePaths = res.tempFiles; + const path = tempFilePaths[0].path; + this.postImg(path) + } + }) + }, + + /** + * 上传图片 + */ + postImg(filePath) { + wx.showLoading({ + title: '文件上传中...', + }) + app.uploadFile(this.data.uuid, app.FileType.resumptionAcs, filePath).then(res => { + wx.hideLoading(); + this.getFiles(); + }) + }, + + /** + * 获取图片 + */ + getFiles: function () { + app.axios("GET", "common", "/upload/getFile", { + otcid: this.data.postData.emerEventId || this.data.uuid, + otctype: app.FileType.resumptionAcs + }).then(res => { + if (res.code == 1) { + this.data.files = res.data; + this.setData(this.data) + } + }) + }, + + /** + * 删除图片 + * @param {*} params + */ + deleteFile: function (e) { + var id = e.currentTarget.dataset.id; + wx.showModal({ + title: '删除提示', + content: '是否要删除该附件?', + success: (res) => { + if (res.confirm) { + app.axios("GET", 'common', "/upload/delFile", { + documentId: id, + }).then(res => { + if (res.code == 1) { + this.getFiles(); + } + }) + } + } + }) + }, + + /** + * 预览文件 + */ + filePre: function (params) { + const url = params.currentTarget.dataset.url; + const imgs = []; + this.data.files.forEach(item => { + imgs.push(this.data.baseUrl + item.filepath) + }) + wx.previewImage({ + urls: imgs, + current: this.data.baseUrl + url + }) + }, + + /** + * 开始时间 + */ + bindDateChange: function (params) { + this.data.postData.startTime = params.detail.value; + this.setData(this.data) + }, + /** + * 结束时间 + */ + bindendTimeChange: function (params) { + this.data.postData.endTime = params.detail.value; + this.setData(this.data) + }, + /** + * 查询所有类型 + */ + getEmerEventType: function () { + app.axios("GET", "app", "/work/wkTypes",{classify:2}).then(res => { + if (res.code == 1) { + this.data.TypeData = res.data; + this.setData(this.data); + } + }) + }, + +/** + * 查看应急上报事件详情 + */ + getEmerEventDetail: function (id) { + app.axios("GET", "app", `/emerEvent/emerEventDetail/${id}`).then(res => { + if (res.code == 1) { + this.data.postData = res.data; + this.data.postData.emerTypeName; + for (let index = 0; index < this.data.TypeData.length; index++) { + if (this.data.TypeData[index].emerTypeName == res.data.emerTypeName) { + this.data.postData.type = index+1; + } + }; + this.setData(this.data); + this.getFiles(); + } + }) + }, + + + + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.data.uuid = Utils.uuid(); + this.data.userInfo = app.globalData.userInfo; + this.data.targetId = options.id + this.setData(this.data); + this.getEmerEventType(); + }, + + + + + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/risk-pool/add-pool/index.json b/pages/risk-pool/add-pool/index.json new file mode 100644 index 0000000..c666f1f --- /dev/null +++ b/pages/risk-pool/add-pool/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "tree": "/components/tree/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/risk-pool/add-pool/index.wxml b/pages/risk-pool/add-pool/index.wxml new file mode 100644 index 0000000..4ddb3c6 --- /dev/null +++ b/pages/risk-pool/add-pool/index.wxml @@ -0,0 +1,77 @@ + + + + + + + + 动态标题 + + + + + + 开始时间 + + + + + + + 结束时间 + + + + + + + + 类型 + + + + + + + 动态内容 + + + + + + 工作附件 + 添加图片 + + + + + + + + + + + + 上报 + + + + + + + 选择动态类型 + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/risk-pool/add-pool/index.wxss b/pages/risk-pool/add-pool/index.wxss new file mode 100644 index 0000000..3e14aab --- /dev/null +++ b/pages/risk-pool/add-pool/index.wxss @@ -0,0 +1,123 @@ +/* pages/msg/push/index.wxss */ +scroll-view { + background-color: #f5f5f5; + box-sizing: border-box; +} + +.filter { + margin: 0 10rpx; + height: 80rpx; + display: flex; + flex-direction: row; + background-color: white; + border-radius: 10rpx; +} + +.filter picker { + flex: 1; + height: 100%; + display: flex; + align-items: center; +} + +.item { + background-color: #ffffff; + margin: 32rpx 20rpx 20rpx 20rpx; + padding: 20rpx; + position: relative; + border-radius: 10rpx; + z-index: 2; +} + +.item .header { + margin-top: 16rpx; +} + +.item .header .single { + width: 8rpx; + height: 36rpx; + background: #4882EE; + border-radius: 4rpx; + margin-right: 10rpx; +} + +.item .header .title { + font-size: 30rpx; + font-weight: bold; + color: #222222; +} + +.item .put { + width: 100%; + background: #F5F7FC; + border-radius: 12rpx; + min-height: 72rpx; + padding: 15rpx; + margin-top: 16rpx; + color: #333333; + font-size: 28rpx; +} + +.grid { + margin-top: 20rpx; + display: grid; + grid-gap: 20rpx 20rpx; + grid-template-columns: calc((100vw - 140rpx)/3) auto auto; +} + +.grid .img { + width: calc((100vw - 140rpx)/3); + height: calc((100vw - 140rpx)/3); + background-color: #f5f5f5; + border-radius: 10rpx; +} + +.grid .del { + position: absolute; + bottom: 0; + left: 0; + z-index: 1; + font-size: 40rpx; +} + +.option { + position: fixed; + bottom: calc(constant(safe-area-inset-bottom) + 30rpx); + bottom: calc(env(safe-area-inset-bottom) + 30rpx); + left: 0; + right: 0; + margin-top: 30rpx; + padding: 16rpx 32rpx; + background: #FFFFFF; + box-shadow: 0rpx 0rpx 12rpx 2rpx #DDECF3; + z-index: 10; +} + +.option .btn { + padding: 14rpx; + display: flex; + align-items: center; + justify-content: center; + background: #409CFF; + color: #FFFFFF; + border-radius: 12rpx; +} + +.option .btn:active { + opacity: 0.8; +} + +.space { + height: calc(constant(safe-area-inset-bottom) + 150rpx); + height: calc(env(safe-area-inset-bottom) + 150rpx); +} +.picker1{ + width: 100%; + background: #F5F7FC; + border-radius: 12rpx; + min-height: 72rpx; + padding: 15rpx; + margin-top: 16rpx; + color: #333333; + font-size: 28rpx; +} \ No newline at end of file diff --git a/pages/risk-pool/index.js b/pages/risk-pool/index.js new file mode 100644 index 0000000..cb2b91f --- /dev/null +++ b/pages/risk-pool/index.js @@ -0,0 +1,156 @@ +const app = getApp(); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + topBarH: app.globalData.CustomBar, + list: [], + startTime: '', + endTime: '', + page: 1, + pageSize: 10, + userInfo:{}, + condition:'', + }, + /** + * 上拉刷新 + */ + refresh: function () { + this.data.page = 1; + this.data.list = []; + this.setData(this.data); + this.getList(); + }, + + /** + * 下拉加载 + */ + dropDown: function (params) { + this.data.page = this.data.page+1; + this.setData(this.data); + this.getList(); + }, + /** + * 输入内容 + */ + inputContent: function (e) { + const name = e.currentTarget.dataset.name; + this.data[name] = e.detail.value; + this.refresh(); + }, + /** + * 上报困难诉求 + */ + push: function (params) { + wx.navigateTo({ + url: `/pages/risk-pool/add-pool/index`, + }) + }, + addpush: function (params) { + let poolId = params.currentTarget.dataset.item.poolId + wx.navigateTo({ + url: `/pages/risk-pool/add-pool/index?id=${poolId}`, + }) + }, + + /** + * 获取工困难诉求列表 + */ + getList: function () { + let params = { + limit:this.data.pageSize, + page:this.data.page, + endTime:this.data.endTime, + startTime:this.data.startTime, + userId:this.data.userInfo.userId, + condition:this.data.condition + }; + app.axios("GET", "app", `/risk/riskPoolPage`, params).then(res => { + if (res.code == 1) { + this.data.freshIng = false; + this.data.list = [...this.data.list,...res.data.list]; + this.setData(this.data); + } + }) + }, + /** + * 查看详情 + */ + // toDetail: function (params) { + // wx.navigateTo({ + // url: `/pages/emergency/s-b/escalation/index?emerEventId=${params.currentTarget.dataset.item.emerEventId}`, + // }) + // }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.data.freshIng = true; + this.data.userInfo = app.globalData.userInfo; + this.setData(this.data); + this.getList(); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom(data) { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) + + + + + + + + + + diff --git a/pages/risk-pool/index.json b/pages/risk-pool/index.json new file mode 100644 index 0000000..965b8e8 --- /dev/null +++ b/pages/risk-pool/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/risk-pool/index.wxml b/pages/risk-pool/index.wxml new file mode 100644 index 0000000..eeec24b --- /dev/null +++ b/pages/risk-pool/index.wxml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + 名称:{{item.name}} + 类型:{{item.typeName}} + 地址:{{item.address}} + 风险状态: + 正常 + 超时未检查 + + 检查时间:{{item.checkTime}} + 下次检查时间:{{item.nextTime}} + + 新增动态>> + + + + + \ No newline at end of file diff --git a/pages/risk-pool/index.wxss b/pages/risk-pool/index.wxss new file mode 100644 index 0000000..04625d5 --- /dev/null +++ b/pages/risk-pool/index.wxss @@ -0,0 +1,191 @@ + +.content { + display: flex; + flex-direction: column; +} + +.content .filter { + margin: 0 10rpx; + width: calc(100vw - 20rpx); + height: 80rpx; + display: flex; + flex-direction: row; + background-color: white; + border-radius: 10rpx; + align-items: center; +} + +.content .filter picker { + flex: 1; + display: flex; + align-items: center; + justify-content: center; + font-size: 30rpx; +} + +.content .item { + background-color: #ffffff; + box-shadow: 0px 0px 6px 1px #DDECF3; + margin: 16rpx 16rpx 0 16rpx; + border-radius: 10rpx; +} + +.content .item .val::before { + display: inline-block; + content: ''; + width: 20rpx; + height: 20rpx; + margin-right: 10rpx; + border-radius: 50%; + background-color: var(--blue); +} + +.content .item .val { + font-size: 30rpx; + color: #222222; + margin-left: 16rpx; + padding: 10rpx 0; +} + + +.item .content { + font-size: 32rpx; + margin-right: 30rpx; + padding: 32rpx 20rpx 20rpx 20rpx; +} + +.item .content .time::before { + display: inline-block; + content: ''; + width: 20rpx; + height: 20rpx; + margin-right: 10rpx; + border-radius: 50%; + background-color: var(--blue); +} + +.item .content .title { + display: flex; + align-items: center; +} + +.item .content .des { + margin: 10rpx 0; +} + +.item .content .time { + font-size: 26rpx; +} + +.item .content .title::before { + display: inline-block; + content: ''; + width: 10rpx; + height: 30rpx; + margin-right: 10rpx; + border-radius: 5rpx; + background-color: var(--blue); +} + +.item .content .des { + font-size: 30rpx; + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + +.item .val { + font-size: 26rpx; + color: #222222; + margin-left: 16rpx; +} + +.item .add { + color: var(--blue); + margin-left: 15rpx; + font-size: 30rpx; + margin-left: 20rpx; +} + +.item .add .add-tv { + margin-left: 10rpx; +} + +.item .line { + margin: 10rpx 0; + border-bottom: 1rpx dashed #f5f5f5; +} + +.item .record { + display: flex; + align-items: center; + justify-content: center; + font-size: 30rpx; + color: var(--blue); +} + +.item .more { + position: absolute; + right: 10rpx; +} + +.line { + width: 1rpx; + height: 80%; + background-color: #f5f5f5; +} + +.cu-item { + font-size: 30rpx; + font-weight: bold; +} + +.option { + position: fixed; + bottom: calc(constant(safe-area-inset-bottom) + 30rpx); + bottom: calc(env(safe-area-inset-bottom) + 30rpx); + left: 0; + right: 0; + margin-top: 30rpx; + padding: 16rpx 32rpx; + background: #FFFFFF; + box-shadow: 0rpx 0rpx 12rpx 2rpx #DDECF3; + z-index: 10; +} + +.option .btn { + padding: 14rpx; + display: flex; + align-items: center; + justify-content: center; + background: #409CFF; + color: #FFFFFF; + border-radius: 12rpx; +} + +.option .btn:active { + opacity: 0.8; +} +.addbtn { + position: fixed; + right: 17rpx; + background: #409CFF; + padding: 4rpx 20rpx; + border-radius: 0 12rpx 0 12rpx; + font-size: 16rpx; + color: #FFFFFF; +} +.search { + background-color: #f5f5f5; + position: sticky; + top: 0; + z-index: 10; +} + +.cu-bar .search-form { + background: #FFFFFF; + box-shadow: 0rpx 0rpx 12rpx 2rpx #DDECF3; + border-radius: 12rpx; +} \ No newline at end of file diff --git a/pages/the-masses/escalation/index.js b/pages/the-masses/escalation/index.js index 512b310..c9698a2 100644 --- a/pages/the-masses/escalation/index.js +++ b/pages/the-masses/escalation/index.js @@ -126,6 +126,20 @@ Page({ this.postImg(path) } }) + }, + chooseVideo: function () { + let that = this + wx.chooseVideo({ + count: 1, + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + maxDuration: 60, // 拍摄视频最长拍摄时间,单位秒。需大于等于3s + camera: 'back', // 默认拉起后置摄像头,front为前置摄像头 + success (res) { + // tempFilePath可以作为video标签的src属性显示视频 + const tempFilePath = res.tempFilePath + that.postImg(tempFilePath) + } + }) }, /** * 上传图片 diff --git a/pages/the-masses/escalation/index.wxml b/pages/the-masses/escalation/index.wxml index da70502..b9f96ff 100644 --- a/pages/the-masses/escalation/index.wxml +++ b/pages/the-masses/escalation/index.wxml @@ -8,11 +8,11 @@ - + 状态 - + @@ -24,6 +24,7 @@ 附件 添加图片 + 添加视频 diff --git a/pages/the-masses/index/index.js b/pages/the-masses/index/index.js index 8a8e5ab..e1e82a4 100644 --- a/pages/the-masses/index/index.js +++ b/pages/the-masses/index/index.js @@ -218,8 +218,10 @@ if (this.data.curTab == 2) { */ toMsgDetail: function (params) { const item = params.currentTarget.dataset.item; + let id = item.learnContentId?item.learnContentId:item.publicContentId + let type = item.learnContentId?'partyMember':'publicContent' wx.navigateTo({ - url: `/pages/the-masses/web/index?id=${item.publicContentId}`, + url: `/pages/the-masses/web/index?id=${id}&type=${type}`, }) }, diff --git a/pages/the-masses/web/index.js b/pages/the-masses/web/index.js index edf7317..08a1638 100644 --- a/pages/the-masses/web/index.js +++ b/pages/the-masses/web/index.js @@ -16,19 +16,16 @@ Page({ * 查看公开内容详情 */ getDetail: function (id,type) { - console.log(id,type,'id,type==>'); + let userId = app.globalData.userInfo.userId if (type == "partyMember") { - app.axios("GET", "app", `/partyLearnContent/partyLearnDetail/${id}`, {}, false).then(res => { - if (res.code == 1) { - console.log(res,'res===>'); - this.data.content = res.data.content; - this.setData(this.data) - wx.setNavigationBarTitle({ - title: res.data.title, - }) - } - }) - }else if (type == "open") { + this.data.url = `${app.globalData.headerUrl}app/partyLearnContent/partyLearnDetail/${userId}/${id}` + this.setData(this.data) + } + else if (type == "publicContent") { + this.data.url = `${app.globalData.headerUrl}app/publicContent/publicContent/${id}` + this.setData(this.data) + } + else if (type == "open") { app.axios("GET", "app", `/publicContent/publicContentDetail/${id}`, {}, false).then(res => { if (res.code == 1) { console.log(res,'res===>'); diff --git a/pages/the-masses/web/index.wxml b/pages/the-masses/web/index.wxml index c2951f3..0b2503b 100644 --- a/pages/the-masses/web/index.wxml +++ b/pages/the-masses/web/index.wxml @@ -1,5 +1,2 @@ - - - - \ No newline at end of file + \ No newline at end of file diff --git a/pages/work/d-b-s-x/up/index.js b/pages/work/d-b-s-x/up/index.js index e7dfedb..094895a 100644 --- a/pages/work/d-b-s-x/up/index.js +++ b/pages/work/d-b-s-x/up/index.js @@ -78,6 +78,37 @@ Page({ } }) }, + chooseMessageFile() { + wx.chooseMessageFile({ + count: 1, // 默认9,这里设置为1表示只选择一个文件 + type: 'file', // 指定文件类型,这里设置为 'file' 表示可以选择所有类型的文件 + success: (res) => { + // 用户成功选择文件后执行的回调 + if (res.tempFiles.length > 0) { + // 获取用户选择的文件信息 + const file = res.tempFiles[0]; + const filePath = file.path; // 文件的本地路径 + // 在这里可以对文件进行进一步的处理,例如上传到服务器等 + this.postImg(filePath) + } else { + // 用户没有选择文件 + wx.showToast({ + title: '未选择文件', + icon: 'none', + duration: 1000 + }); + } + }, + fail: function (err) { + // 选择文件失败的回调 + wx.showToast({ + title: '选择文件失败', + icon: 'none', + duration: 1000 + }); + } + }); + }, /** * 获取工作类型 diff --git a/pages/work/d-b-s-x/up/index.wxml b/pages/work/d-b-s-x/up/index.wxml index 5c6c5c9..3d4a70f 100644 --- a/pages/work/d-b-s-x/up/index.wxml +++ b/pages/work/d-b-s-x/up/index.wxml @@ -56,6 +56,8 @@ 附件 添加图片 + + 文件上传 diff --git a/pages/work/s-b/index/index.js b/pages/work/s-b/index/index.js index 3d5c044..6be01bf 100644 --- a/pages/work/s-b/index/index.js +++ b/pages/work/s-b/index/index.js @@ -78,6 +78,37 @@ Page({ } }) }, + chooseMessageFile() { + wx.chooseMessageFile({ + count: 1, // 默认9,这里设置为1表示只选择一个文件 + type: 'file', // 指定文件类型,这里设置为 'file' 表示可以选择所有类型的文件 + success: (res) => { + // 用户成功选择文件后执行的回调 + if (res.tempFiles.length > 0) { + // 获取用户选择的文件信息 + const file = res.tempFiles[0]; + const filePath = file.path; // 文件的本地路径 + // 在这里可以对文件进行进一步的处理,例如上传到服务器等 + this.postImg(filePath) + } else { + // 用户没有选择文件 + wx.showToast({ + title: '未选择文件', + icon: 'none', + duration: 1000 + }); + } + }, + fail: function (err) { + // 选择文件失败的回调 + wx.showToast({ + title: '选择文件失败', + icon: 'none', + duration: 1000 + }); + } + }); + }, /** * 获取工作类型 diff --git a/pages/work/s-b/index/index.wxml b/pages/work/s-b/index/index.wxml index 33f4338..8a1eea8 100644 --- a/pages/work/s-b/index/index.wxml +++ b/pages/work/s-b/index/index.wxml @@ -42,6 +42,7 @@ 附件 添加图片 + 文件上传