diff --git a/app.js b/app.js index 2042b90..92a1fc0 100644 --- a/app.js +++ b/app.js @@ -571,6 +571,9 @@ App({ }, }); }, + /** + * 点击震感反馈 + */ vibrateShort () { wx.vibrateShort({ type: "heavy", @@ -579,6 +582,9 @@ App({ }, }); }, + /** + * 小程序分享配置 + */ sharePageImage (path = "/pages/firstBill/index", image = "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/fenxiang2025.png", title = " ") { let params = { path: path, @@ -589,6 +595,9 @@ App({ console.log('分享数据:', params) return params; }, + /** + * 内容复制 + */ copyFun (data, callBack) { wx.setClipboardData({ data, diff --git a/app.json b/app.json index 1709046..fe256c5 100644 --- a/app.json +++ b/app.json @@ -85,7 +85,8 @@ "pages/creatorSelectPage/index", "components/chat/text", "components/chat/hello", - "components/chat/html" + "components/chat/html", + "components/chat/loading" ], "permission": { "scope.userLocation": { @@ -120,7 +121,12 @@ "navigationBarTitleText": "Weixin", "navigationBarTextStyle": "black" }, - "plugins": {}, + "plugins": { + "WechatSI": { + "version": "0.3.1", + "provider": "wx069ba97219f66d99" + } + }, "tabBar": { "custom": true, "color": "#444", diff --git a/components/chat/loading.js b/components/chat/loading.js new file mode 100644 index 0000000..4ded714 --- /dev/null +++ b/components/chat/loading.js @@ -0,0 +1,66 @@ +// components/chat/loading.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/components/chat/loading.json b/components/chat/loading.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/components/chat/loading.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/components/chat/loading.wxml b/components/chat/loading.wxml new file mode 100644 index 0000000..f6a25b5 --- /dev/null +++ b/components/chat/loading.wxml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/components/chat/loading.wxss b/components/chat/loading.wxss new file mode 100644 index 0000000..303108f --- /dev/null +++ b/components/chat/loading.wxss @@ -0,0 +1 @@ +/* components/chat/loading.wxss */ \ No newline at end of file diff --git a/components/job-sub/index.js b/components/job-sub/index.js index 382a2a6..556dff7 100644 --- a/components/job-sub/index.js +++ b/components/job-sub/index.js @@ -21,8 +21,8 @@ Component({ value: {}, }, agencyStatus: { - type: Boolean, - value: true + type: Number, + value: 0 }, hasUserInfo: { type: Number, diff --git a/components/job-sub/index.wxml b/components/job-sub/index.wxml index 2a319ac..7bceb16 100644 --- a/components/job-sub/index.wxml +++ b/components/job-sub/index.wxml @@ -76,7 +76,7 @@ 登录查看 - {{(item.picked || corpUserFlag) ? (agencyStatus == 1 ? (item.fuWuFei ? item.fuWuFei : '详询客服') : '仅代理可见') : '详询客服' }} + {{(agencyStatus == 1 ? (item.fuWuFei ? item.fuWuFei : '详询客服') : '仅代理可见') }} diff --git a/components/service-modal/index.js b/components/service-modal/index.js new file mode 100644 index 0000000..16a7442 --- /dev/null +++ b/components/service-modal/index.js @@ -0,0 +1,43 @@ +const app = getApp() +// let app = null; +Component({ + data: { + labelColor: ["#c41d7f", "#096dd9", "#531dab", "#d46b08", "#389e0d", "#08979c", "#cf1322"], + bgColor: ["#fff0f6", "#e6f7ff", "#f9f0ff", "#fff7e6", "#f6ffed", "#e6fffb", "#fff1f0"], + corpUserFlag: false, + serviceInfo: {} + }, + properties: { + // 抽屉高度 + showModal: { + type: Boolean, + value: false, + }, + }, + lifetimes: { + attached: function () { + this.setData({ + serviceInfo: app.globalData.serviceInfo, + }); + // 在组件实例进入页面节点树时执行 + }, + detached: function () { + // 在组件实例被从页面节点树移除时执行 + }, + }, + ready () { + // console.log('app.globalData.loginUserInfo.corpUserFlag', app.globalData.loginUserInfo.corpUserFlag); + console.log('this.properties.loginUserInfo', this.properties.loginUserInfo); + // app.getLoginUserTokenInfo().then(() => { + + // }); + + }, + methods: { + closeDialog () { + this.setData({ + showModal: false + }) + } + } +}) \ No newline at end of file diff --git a/components/service-modal/index.json b/components/service-modal/index.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/components/service-modal/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/service-modal/index.wxml b/components/service-modal/index.wxml new file mode 100644 index 0000000..87fb4dc --- /dev/null +++ b/components/service-modal/index.wxml @@ -0,0 +1,25 @@ + + + + + + + + + + 加客户经理微信 + + + + + 加载中... + + + + + 长按识别二维码 + + + \ No newline at end of file diff --git a/components/service-modal/index.wxss b/components/service-modal/index.wxss new file mode 100644 index 0000000..9503cb7 --- /dev/null +++ b/components/service-modal/index.wxss @@ -0,0 +1,37 @@ +@import "../../app.wxss"; +/* + 成为代理二维码弹窗 +*/ +.weui-mask { + background: rgba(0, 0, 0, 0.6); +} +.weui-dialog { + position: fixed; + z-index: 5000; + top: 50%; + left: 50%; + -webkit-transform: translateY(-50%); + transform: translate(-50%, -50%); + background-color: var(--weui-BG-2); + text-align: center; + border-radius: 12px; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-flex-direction: column; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + flex-direction: column; + max-height: 90%; + outline: 0; +} +.weui-mask, +.weui-mask_transparent { + position: fixed; + z-index: 1000; + top: 0; + right: 0; + left: 0; + bottom: 0; +} diff --git a/pages/detail/index.wxml b/pages/detail/index.wxml index 1abf0ba..29d5f8c 100644 --- a/pages/detail/index.wxml +++ b/pages/detail/index.wxml @@ -40,7 +40,7 @@ - {{ (jobDetail.record.picked || corpUserFlag) ? (fuWuFei || '详询客服') : '详询客服'}} + {{ (fuWuFei || '详询客服')}} *** diff --git a/pages/firstBill/index.js b/pages/firstBill/index.js index 8ef7098..87a34b0 100644 --- a/pages/firstBill/index.js +++ b/pages/firstBill/index.js @@ -38,20 +38,6 @@ Page({ picked: '0' }, ], - sortList: [ - { - name: '综合排序', - key: 'zuigao', - }, - { - name: '综合排序', - key: 'zuigao', - }, - { - name: '综合排序', - key: 'zuigao', - }, - ], anchorList: [ { id: 'age', @@ -137,7 +123,7 @@ Page({ lat: "", lng: "", jobClassify: "", - sortTag: 0, + sortTag: 1, jobRequestLabelIds: "", cityName: "", brandIds: "", @@ -1717,7 +1703,7 @@ Page({ console.log(e); let that = this; // let data = e.currentTarget.dataset.item; - this.data.storeJobListSearchForm.sortTag = 0; + this.data.storeJobListSearchForm.sortTag = 1; that.data.storeJobListSearchForm.pageNum = 1; this.setData({ firstMenu: "工价", @@ -4346,7 +4332,7 @@ Page({ let item = e.currentTarget.dataset.item that.data.choiceCollect = item.key; // that.data.storeJobListSearchForm.ucj = e.currentTarget.dataset.id; - that.data.storeJobListSearchForm.sortTag = item.key; + // that.data.storeJobListSearchForm.sortTag = 0; that.data.storeJobListSearchForm.picked = item.picked; that.data.storeJobListSearchForm.pageNum = 1; that.setData({ @@ -4372,7 +4358,7 @@ Page({ let str = e.currentTarget.dataset.id; console.log(e); if (str == "all") { - that.data.storeJobListSearchForm.sortTag = 0; + that.data.storeJobListSearchForm.sortTag = 1; that.setData({ firstMenu: "工价", // storeJobListSearchForm: that.data.storeJobListSearchForm, @@ -4471,11 +4457,7 @@ Page({ firstMenu: "工价", recordList: [], }); - that.getJobList().then(() => { - that.setData({ - siv: "menu", - }); - }); + } else if (str == "fuwufei") { console.log(str); that.data.storeJobListSearchForm.sortTag = 3; @@ -4485,17 +4467,22 @@ Page({ // storeJobListSearchForm: tha t.data.storeJobListSearchForm, recordList: [], }); - that.getJobList().then(() => { - that.setData({ - siv: "menu", - }); - }); + } else if (str == "shijian") { + that.data.storeJobListSearchForm.sortTag = 2; + that.data.storeJobListSearchForm.pageNum = 1; that.setData({ firstMenu: "时间", // storeJobListSearchForm: tha t.data.storeJobListSearchForm, + recordList: [], }); + } + that.getJobList().then(() => { + that.setData({ + siv: "menu", + }); + }); that.setData({ activez: str, whichOneShow: "", diff --git a/pages/firstBill/index.wxml b/pages/firstBill/index.wxml index cd96d46..6159e12 100644 --- a/pages/firstBill/index.wxml +++ b/pages/firstBill/index.wxml @@ -3,7 +3,7 @@ 伯才供应链 --> - + {{searchCityParamStorage.name == '' ? '全国' : searchCityParamStorage.shortName}} @@ -65,7 +65,7 @@ 按工价 - 按佣金 + 按佣金 按时间 diff --git a/pages/message/index.js b/pages/message/index.js index d02fb84..7b1fb50 100644 --- a/pages/message/index.js +++ b/pages/message/index.js @@ -10,6 +10,7 @@ Page({ isLogin: app.globalData.isLogin, serviceInfo: {}, iosDialog: false, + showModalShow: false, isLoading: true, messageClick: false, infoList: [], @@ -164,7 +165,7 @@ Page({ */ onHide () { this.setData({ - iosDialog: false, + showModalShow: false, }); }, @@ -201,7 +202,7 @@ Page({ showdialog () { this.setData({ - iosDialog: true, + showModalShow: true, loading: true, }); }, @@ -270,4 +271,12 @@ Page({ }); } }, + makePhoneCall () { + console.log(1); + var that = this; + wx.makePhoneCall({ + // number: that.data.jobDetail.assistantUserTel + "" + phoneNumber: that.data.serviceInfo.workPhone || "0371-6611 3723", + }); + }, }); diff --git a/pages/message/index.json b/pages/message/index.json index 61f167f..edbfefd 100644 --- a/pages/message/index.json +++ b/pages/message/index.json @@ -1,5 +1,7 @@ { - "usingComponents": {}, + "usingComponents": { + "service-modal":"../../components/service-modal" + }, "navigationBarTitleText" : "消息", "navigationBarBackgroundColor": "#fff", "backgroundColor": "#f5f5f5", diff --git a/pages/message/index.wxml b/pages/message/index.wxml index 07725cf..db5d2e8 100644 --- a/pages/message/index.wxml +++ b/pages/message/index.wxml @@ -1,10 +1,29 @@ + + + + + + + + 客户经理 + + {{serviceInfo.userName }} + {{serviceInfo.tel || '0371-6611 3723'}} + + + + + + + + - + {{item.title}} @@ -23,4 +42,5 @@ 内容内容内容内容内容内容 --> + diff --git a/pages/message/index.wxss b/pages/message/index.wxss index 8aee7ac..b15889c 100644 --- a/pages/message/index.wxss +++ b/pages/message/index.wxss @@ -1,15 +1,27 @@ /* pages/message/index.wxss */ -.container{ +.container { padding-top: 10px; } -.noticImg{ +.noticImg { width: 48px; height: 48px; border-radius: 12px; } -.sub{ +.sub { padding: 12px; font-size: 14px; background-color: #fff; /* border-radius: 8px; */ -} \ No newline at end of file +} +.servicebox { + padding: 12px; + /* padding-bottom: 0; */ + /* padding-right: 10px; */ + background-color: #fff; +} +.servicebox .serviceinfo { +} +.servicebox .serviceinfo image { + width: 52px; + height: 52px; +} diff --git a/pages/mine/index.js b/pages/mine/index.js index 8b397b0..3510c38 100644 --- a/pages/mine/index.js +++ b/pages/mine/index.js @@ -9,6 +9,7 @@ Page({ * 页面的初始数据 */ data: { + // appId: '1' || app.globalData.appId, appId: app.globalData.appId, pageShow: true, isopen: 1, // 账户余额是否显示 @@ -66,7 +67,8 @@ Page({ jobCategoryLabelIds: "", ucj: 0, }, - recordList: [] + recordList: [], + myService: [] // agencyStatus: 0, // 是否是代理判断 }, @@ -89,7 +91,53 @@ Page({ this.getTeamList() } this.getJobList() - + this.setData({ + myService: this.data.appId == 'wxe431e0b3abd9ae0b' ? [ + { + name: '证件', + url: '/pages/addUserCard/index', + icon: 'https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/zjb.svg' + }, + { + name: '银行卡', + url: '/pages/addCard/index', + icon: 'https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/yhkb.svg' + }, + { + name: '地址本', + url: '/subPage/addressBook/index', + icon: 'https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/dzbb.svg' + }, + { + name: '反馈与建议', + url: '/pages/opinion/index', + icon: 't-icon-fankuiyujianyi', + iconType: 'icon' + }, + { + name: '设置', + url: '/pages/setting/index', + icon: 't-icon-shezhi1', + iconType: 'icon' + } + ] : [ + { + name: '证件', + url: '/pages/addUserCard/index', + icon: 'https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/zjb.svg' + }, + { + name: '银行卡', + url: '/pages/addCard/index', + icon: 'https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/yhkb.svg' + }, + { + name: '地址本', + url: '/subPage/addressBook/index', + icon: 'https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/dzbb.svg' + }, + ] + }) }, 100); }, hidedrawershow (e) { @@ -284,7 +332,6 @@ Page({ * 生命周期函数--监听页面隐藏 */ onHide: function () { - console.log(123); this.setData({ iosDialog: false, diff --git a/pages/mine/index.wxml b/pages/mine/index.wxml index 612729c..4dc43e8 100644 --- a/pages/mine/index.wxml +++ b/pages/mine/index.wxml @@ -4,7 +4,7 @@ - + @@ -260,61 +260,130 @@ --> + + + + 10/90 + 今日/职位数 + + + 102 + 关注发单号 + + + 180 + 我的粉丝 + + + + + + + + + + + 当前团队 + + + + + + {{userInfo.agencyName || '-'}} + + + + + + + + + + + + + + + + + 我要发单 + 快速创建新职位 + + + + + + + + 发展代理 + 让更多代理关注我 + + + - + 我的服务 - + + + + + {{item.name}} + + + 银行卡 - - 地址本 - + --> + + + + + - + @@ -336,80 +405,59 @@ - - - - - - - - - 当前团队 + + + + + + + + 反馈与建议 + - - - - {{userInfo.agencyName || '-'}} - - - - + + + + + + + + + + 设置 + - + - - - - - - 反馈与建议 - - - - - - - - - - - - - 设置 - - - - - - + - + {{item.name}} - + @@ -465,12 +513,6 @@ 长按识别二维码 - diff --git a/pages/mine/index.wxss b/pages/mine/index.wxss index 1c012fd..e3dcb32 100644 --- a/pages/mine/index.wxss +++ b/pages/mine/index.wxss @@ -5,7 +5,8 @@ page { } .container { /* height: 100vh; */ - padding: 10px 0; + /* margin-top: 10px; */ + padding: 0; overflow: auto; } .container .no_login { @@ -378,10 +379,10 @@ page { display: flex; justify-content: space-between; align-items: center; - padding: 12px; - margin: 0 10px; + padding: 12px 24px; + /* margin: 0 10px; */ background-color: #fff; - border-radius: 8px; + /* border-radius: 8px; */ box-shadow: 0px 4px 4px 0px rgba(218, 218, 218, 0.5); } .sticky { diff --git a/pages/opinion/index.js b/pages/opinion/index.js index 1e1ea66..5fed3d2 100644 --- a/pages/opinion/index.js +++ b/pages/opinion/index.js @@ -1,6 +1,7 @@ // pages/opinion/index.js const app = getApp(); import { customRequest } from '../../utils/request.js'; +import { uploadImg } from "../../utils/commonUtil.js"; Page({ /** * 页面的初始数据 @@ -10,6 +11,9 @@ Page({ loading: false, subLoad: false, success: false, + troubleList: ["投诉", "建议", "故障", "其他"], + troubleIndex: 0, + imgList: [] }, /** @@ -40,7 +44,12 @@ Page({ that.setData({ loading: true, }); - customRequest("/daotian/feedback/add",{header:'headers', method: 'post', data: {content: that.data.textVal}}).then((res)=>{ + customRequest("/daotian/feedback/add", { + header: 'headers', method: 'post', data: { + content: that.data.textVal, classify: that.data.troubleIndex + 1, + imgs: that.data.imgList.join(","), + } + }).then((res) => { console.log(res); if (res.data.status == 200) { that.setData({ @@ -57,47 +66,17 @@ Page({ }); that.data.subLoad = false - }).catch(()=>{ + }).catch(() => { that.setData({ loading: false, }); }) - // wx.request({ - // url: app.globalData.ip + "/daotian/feedback/add", - // method: 'post', - // header: app.globalData.headers, - // data: { - // content: that.data.textVal - // }, - // success: function (res) { - // console.log(res); - // if (res.data.status == 200) { - // that.setData({ - // success: true, - // }); - // } else { - // wx.showToast({ - // title: res.data.msg, - // icon: 'none' - // }) - // } - // that.setData({ - // loading: false, - // }); - // that.data.subLoad = false - - // }, - // fail: function (res) { - // that.setData({ - // loading: false, - // }); - // }, - // }); } else { wx.showToast({ title: '请输入内容再提交', icon: 'none' }) + that.data.subLoad = false } @@ -109,6 +88,34 @@ Page({ }) console.log(this.data.textVal); }, + uploadImg () { + let that = this + uploadImg(4, (res) => { + console.log(res); + if (res.status == 200 && that.data.imgList.length < 4) { + if (that.data.imgList.length > 4) { + wx.showToast({ + title: '最多上传4张图片', + }) + } else { + that.data.imgList.push(res.data) + } + } + that.setData({ + imgList: that.data.imgList + }) + }) + }, + delImg (e) { + let ind = e.currentTarget.dataset.ind + this.data.imgList.splice( + this.data.imgList.findIndex((item, index) => index == ind), + 1 + ); + this.setData({ + imgList: this.data.imgList + }) + }, goback () { wx.navigateBack({ delta: 1, @@ -119,6 +126,11 @@ Page({ url: "/pages/opinionList/index", }); }, + changeType (e) { + this.setData({ + troubleIndex: e.currentTarget.dataset.index + }) + }, /** * 生命周期函数--监听页面隐藏 */ diff --git a/pages/opinion/index.wxml b/pages/opinion/index.wxml index 4cd2571..e03f2b3 100644 --- a/pages/opinion/index.wxml +++ b/pages/opinion/index.wxml @@ -1,8 +1,29 @@ - - 提交 - 查看记录 + + + + {{item}} + + + + + {{ textVal.length }}/150 + + + + + + + + + + + 上传照片截图,最多传4张(选填) + + 提交 + + 查看记录 diff --git a/pages/opinion/index.wxss b/pages/opinion/index.wxss index f8b7e8f..538a577 100644 --- a/pages/opinion/index.wxss +++ b/pages/opinion/index.wxss @@ -3,13 +3,47 @@ height: 100vh; box-sizing: border-box; } +.submit{ + height: 100%; + display: flex; + flex-direction: column; + justify-content: space-between; +} .textarea { width: 100%; - height: 200px; + /* height: 200px; */ padding: 12px; line-height: 20px; box-sizing: border-box; } .lh20{ line-height: 20px; +} +.sub_type{ + padding: 4px 14px; + font-size: 14px; + margin-right: 12px; + border-radius: 20px; + background-color: #fff; +} +.active{ + color: #fff; + background-color: var(--color-ysd); +} +.imgUpload{ + margin-top: 16px; +} +.close { + position: absolute; + width: 18px; + height: 18px; + right: -6px; + top: -6px; + z-index: 99; + background-color: #666; + color: #fff; + font-size: 8px; + text-align: center; + line-height: 18px; + border-radius: 50%; } \ No newline at end of file diff --git a/pages/publishJob/index.js b/pages/publishJob/index.js index 8cbc45d..9689f4b 100644 --- a/pages/publishJob/index.js +++ b/pages/publishJob/index.js @@ -27,7 +27,7 @@ Page({ { id: 1, name: '按日', unit: '元/日', checked: false }, { id: 2, name: '按月', unit: '元/月', checked: false }, { id: 3, name: '按次', unit: '元/次', checked: false }, - { id: 4, name: '按件', unit: '元/公斤', checked: false }, + { id: 4, name: '按件', unit: '元/件', checked: false }, { id: 5, name: '按百分比', unit: '%', checked: false }, { id: 6, name: '总计', unit: '元', checked: false }, ], diff --git a/subPage/chat/index.js b/subPage/chat/index.js index 22eb28f..adb262d 100644 --- a/subPage/chat/index.js +++ b/subPage/chat/index.js @@ -1,4 +1,6 @@ // subPage/chat/index.js +var plugin = requirePlugin("WechatSI") +let manager = plugin.getRecordRecognitionManager() Page({ /** @@ -7,80 +9,104 @@ Page({ data: { eventType:'input',// 底部事件类型 input 键盘输入,voice 语音输入 sendText:'',// 发送的输入框内容 + voiceBtnText:'按住 说话', + screenHeight:'0', list:[ { id:-1, type:'text', isUp:false, isDown:false, + loading:false, }, - ] + ], + voiceSpeed:-1, }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - wx.setNavigationBarTitle({ - title: options.title, - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - /** * 生命周期函数--监听页面显示 */ onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - + const res = wx.getSystemInfoSync(); + console.log('设备数据',res); + this.setData({ + screenHeight: (res.screenHeight - 92) + 'px', + }); }, - - handleEvent(e){ + handleEvent(e) { let that = this; that.animate(); that.setData({ - eventType:e.currentTarget.dataset.type == 'input' ? 'voice':'input' - }) + eventType: e.currentTarget.dataset.type == 'input' ? 'voice' : 'input', + voiceSpeed:-1 + }); + if (that.data.eventType == 'voice') { + // 检查是否有录音权限 + wx.getSetting({ + success(res) { + if (!res.authSetting['scope.record']) { + that.setData({ + voiceSpeed:4 + }); + wx.authorize({ + scope: 'scope.record', + success() { + console.log('录音权限已授权'); + // 继续执行其他逻辑 + that.setData({ + voiceSpeed:2 + }); + }, + fail() { + console.log('录音权限未授权'); + that.setData({ + voiceSpeed:4 + }); + wx.showModal({ + title: '提示', + content: '需要录音权限才能使用语音输入功能,请在设置中授权。', + confirmText: '去设置', + cancelText: '取消', + success(res) { + if (res.confirm) { + wx.openSetting({ + success(res) { + console.log('用户打开设置', res.authSetting); + if (res.authSetting['scope.record']) { + console.log('用户已授权录音权限'); + // 用户授权后可以继续执行其他逻辑 + that.setData({ + voiceSpeed:2 + }); + } else { + console.log('用户未授权录音权限'); + // 用户未授权录音权限后的逻辑 + that.setData({ + voiceSpeed:3 + }); + } + } + }); + } else if (res.cancel) { + console.log('用户取消授权'); + // 用户取消授权后的逻辑 + that.setData({ + voiceSpeed:3 + }); + } + } + }); + } + }); + } else { + console.log('录音权限已授权'); + // 继续执行其他逻辑 + that.setData({ + voiceSpeed:2 + }); + } + } + }); + } }, handleUp(e){ let that = this; @@ -138,7 +164,6 @@ Page({ sendText:e.detail.value }); }, - animate($type='light') { wx.vibrateShort({ type:$type @@ -146,8 +171,6 @@ Page({ }, - - // 文本消息发送 handleSend(){ let that = this; @@ -167,17 +190,113 @@ Page({ type:'text', isUp:false, isDown:false, - content:that.data.sendText + content:that.data.sendText, + loading:false, }, { id:that.data.list.length + 1, type:'html', isUp:false, isDown:false, - content:`【北京奔驰连接器日结工】🚻 男女 18-48, 18-48周岁, 男女不限, 要求26个英文字母, 纹身烟疤拍照确认, 黑户,明显纹身,临时身份证不予接收,两班倒,站班💰 员工250元/天,支付60天;60天以后员工220元/天;每月10号发薪。培训工资100元/天,员工 16 元/时以上部分含税6个点的,打卡不满七天无工资;60天以后员工缴纳社保` + content:`【北京奔驰连接器日结工】🚻 男女 18-48, 18-48周岁, 男女不限, 要求26个英文字母, 纹身烟疤拍照确认, 黑户,明显纹身,临时身份证不予接收,两班倒,站班💰 员工250元/天,支付60天;60天以后员工220元/天;每月10号发薪。培训工资100元/天,员工 16 元/时以上部分含税6个点的,打卡不满七天无工资;60天以后员工缴纳社保`, + loading:true, }, ], sendText:'' }); - } + setTimeout(()=>{ + that.data.list.forEach(item=>{ + item.loading = false; + }) + that.setData({ + list:[ + ...that.data.list, + ], + }); + },300) + }, + /** + * 语音消息发送 + */ + handleTouchStart: function(event) { + console.log('手指按下事件触发'); + let that = this; + that.setData({ + voiceSpeed: 0 // 假设 0 表示按下 + }); + }, + handleLongPress: function(event) { + let that = this; + console.log('长按事件触发'); + that.setData({ + voiceSpeed:1 + }); + manager.start({duration:30000, lang: "zh_CN"}) + // 处理长按事件的逻辑 + manager.onStart = function(res) { + that.setData({ + voiceSpeed:5 + }); + console.log("成功开始录音识别", res) + } + }, + handleTouchEnd: function(event) { + console.log('手指抬起事件触发',this.data.voiceSpeed); + let that = this; + if(that.data.voiceSpeed >= 1){ + that.animate(); + that.data.sendText = '模拟语音转文本'; + that.setData({ + list:[ + ...that.data.list, + { + id:that.data.list.length, + type:'text', + isUp:false, + isDown:false, + content:that.data.sendText, + loading:false, + }, + { + id:that.data.list.length + 1, + type:'html', + isUp:false, + isDown:false, + content:`【北京奔驰连接器日结工】🚻 男女 18-48, 18-48周岁, 男女不限, 要求26个英文字母, 纹身烟疤拍照确认, 黑户,明显纹身,临时身份证不予接收,两班倒,站班💰 员工250元/天,支付60天;60天以后员工220元/天;每月10号发薪。培训工资100元/天,员工 16 元/时以上部分含税6个点的,打卡不满七天无工资;60天以后员工缴纳社保`, + loading:true, + }, + ], + sendText:'' + }); + setTimeout(()=>{ + that.data.list.forEach(item => { + item.loading = false; + }) + that.setData({ + list:[ + ...that.data.list, + ], + sendText:'' + }); + },300) + } + that.setData({ + voiceSpeed:9 + }); + // 处理手指抬起事件的逻辑 + manager.stop(); + manager.onStop = function(res) { + that.setData({ + voiceSpeed:6 + }); + console.log("监听录音结束 ;临时路径record file path", res.tempFilePath) + console.log("监听录音结束 结果result", res.result) + } + // manager.onError = function(res) { + // that.setData({ + // voiceSpeed:8 + // }); + // console.error("监听录音异常 error msg", res.msg) + // } + }, }) \ No newline at end of file diff --git a/subPage/chat/index.json b/subPage/chat/index.json index a4fd187..b064874 100644 --- a/subPage/chat/index.json +++ b/subPage/chat/index.json @@ -2,6 +2,7 @@ "usingComponents": { "hello-panel": "../../components/chat/hello", "text-panel": "../../components/chat/text", - "html-panel": "../../components/chat/html" + "html-panel": "../../components/chat/html", + "loading-panel": "../../components/chat/loading" } } \ No newline at end of file diff --git a/subPage/chat/index.wxml b/subPage/chat/index.wxml index 7e5b73e..eba3e82 100644 --- a/subPage/chat/index.wxml +++ b/subPage/chat/index.wxml @@ -1,7 +1,7 @@ - - - + + + - + - + - @@ -85,12 +88,17 @@ value="{{sendText}}" /> - - 按住 说话 + + {{ voiceBtnText }} - diff --git a/subPage/chat/index.wxss b/subPage/chat/index.wxss index 09e3c42..e39dcda 100644 --- a/subPage/chat/index.wxss +++ b/subPage/chat/index.wxss @@ -63,7 +63,6 @@ } .p-home-chat .chat-operate .m-input .voice-box{ padding: 0 12px; - width: 100%; text-align: center; font-size: 17px; font-weight: 700; @@ -250,4 +249,12 @@ textarea { } .max80{ max-width: 80vw; +} + + +.voice-click{ + background-color: #1677ff !important; +} +.voice-click .event-icon,.voice-click .send-icon{ + opacity: 0; } \ No newline at end of file diff --git a/utils/commonUtil.js b/utils/commonUtil.js index 2f0b614..bb5912f 100644 --- a/utils/commonUtil.js +++ b/utils/commonUtil.js @@ -1079,7 +1079,7 @@ export function returnFeeTypeArray (value) { { id: 1, value: "1", text: "按日", name: "天", name1: `${value}元/日` }, { id: 2, value: "2", text: "按月", name: "月", name1: `${value}元/月` }, { id: 3, value: "3", text: "按次", name: "次", name1: `${value}元/次` }, - { id: 4, value: "4", text: "按件", name: "件", name1: `${value}元/公斤` }, + { id: 4, value: "4", text: "按件", name: "件", name1: `${value}元/件` }, { id: 5, value: "5", text: "百分比", name: "百分比", name1: `工人收入${value}%` }, { id: 6, value: "6", text: "共计", name: "人", name1: `共${value}元` }, { id: 7, value: "7", name1: "费用待定" }, @@ -1783,4 +1783,52 @@ export function roundRect1 (ctx, x, y, w, h, r, color) { ctx.fillRect(x + r, y + r, w - r * 2, h - r * 2); ctx.stroke(); ctx.closePath(); -} \ No newline at end of file +} +export function choiceImg ($num = 1) { + return new Promise((resolve) => { + wx.chooseImage({ + count: $num, + sizeType: ["original", "compressed"], + sourceType: ["album", "camera"], + success (res) { + console.log(); + // debugger; + resolve(res) + }, + }); + }) +} +export function uploadImg ($num = 1, callBack = () => { }) { + choiceImg($num).then((res) => { + console.log('res', res); + const tempFilePaths = res.tempFilePaths; + tempFilePaths.forEach((item, index) => { + wx.uploadFile({ + url: "https://daotian.matripe.com.cn/imgs/uploadImage", + method: "post", + // data:currData, + // name: "uploadFile", + filePath: tempFilePaths[index], + name: "uploadFile", + header: { + "content-type": "application/x-www-form-urlencoded", + Authorization: "", + Cookie: "", + appId: wx.getAccountInfoSync().miniProgram.appId, + "g-open-env": 'MP_MINI', + appClassify: 1, + }, + success: function (res) { + console.log(res); + let val = JSON.parse(res.data); + callBack(val) + }, + fail: function (res) { + let val = JSON.parse(res.data); + callBack(val) + }, + }); + }) + }) + +}
{{serviceInfo.tel || '0371-6611 3723'}}