123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- const api = require('../../../../../utils/api.js');
- const login = require('../../../../../utils/index.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- data: [{ 'title': '整体满意度:' }, { 'title': '去现场次数满意度:' }, { 'title': '办事指南符合度:' }, { 'title': '办事效率:' }, { 'title': '服务质量:' }, { 'title': '网上体验:' }],
- items: [{ 'index': 1, 'name': '非常不满意' }, { 'index': 2, 'name': '不满意' }, { 'index': 2, 'name': '一般' },{ 'index': 3, 'name': '满意' },{ 'index': 4, 'name': '非常满意' }]
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.data.projid=options.projid
- },
- textarea:function(e){
- this.data.text=e.detail.value
- },
- assess:function(e){
- console.log(e)
- this.data.data[e.currentTarget.dataset.index].ind = e.currentTarget.dataset.ind
- this.data.data[e.currentTarget.dataset.index].name = this.data.items[e.currentTarget.dataset.ind].name
- this.setData({
- data: this.data.data
- })
- },
- submit:function(){
- let that = this
- for(let i=0;i<that.data.data.length;i++){
- if (!that.data.data[i].name){
- wx.showToast({
- title: '请对'+that.data.data[i].title+'打分',
- icon:'none'
- })
- return false;
- }
- }
- if(!that.data.text){
- wx.showToast({
- title: '请输入评价内容',
- icon: 'none'
- })
- return false;
- }
- let getUserInfo = login.default.getUserInfo();
- getUserInfo.then((resolve) => {
- that.data.userInfo = resolve
- console.log(that.data.userInfo)
- if(that.data.userInfo){
- wx.request({
- url: api.evaluate,
- method:'POST',
- data: {
- projid: that.data.projid,
- evaluatorName: that.data.userInfo.identity == '0' ? that.data.userInfo.name : that.data.userInfo.lInstitutionName,
- evaluatorPhone: that.data.userInfo.identity == '0' ? that.data.userInfo.pPhone : that.data.userInfo.lPhone,
- evaluatorEmail: that.data.userInfo.identity == '0' ? that.data.userInfo.pEmail : that.data.userInfo.lEmail,
- evaluatorAddress: that.data.userInfo.identity == '0' ? that.data.userInfo.pAddress : that.data.userInfo.lAddress,
- evaluateContent:that.data.text,
- satisfactionEvaluate: that.data.data[0].ind+1,
- errandNoEvaluate: that.data.data[1].ind + 1,
- guideEvaluate: that.data.data[2].ind + 1,
- efficiencyEvaluate: that.data.data[3].ind + 1,
- serviceQualityEvaluate: that.data.data[4].ind + 1,
- onlineExperienceEvaluate: that.data.data[5].ind + 1
- },
- success(res) {
- if(res.data.errno==0){
- wx.redirectTo({
- url: '/pages/success/index?type=assess',
- })
- }else{
- wx.showToast({
- title: '提交失败',
- icon:'none'
- })
- }
- }
- })
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|