feedback.js 8.2 KB

1
  1. require('./common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_course/feedback"],{"26a1":function(e,t,n){"use strict";(function(e,t){var i=n("47a9");n("584a");i(n("3240"));var r=i(n("2f35"));e.__webpack_require_UNI_MP_PLUGIN__=n,t(r.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},"2f35":function(e,t,n){"use strict";n.r(t);var i=n("59fa"),r=n("6adf");for(var o in r)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o);n("7f0e");var a=n("828b"),u=Object(a["a"])(r["default"],i["b"],i["c"],!1,null,"246d97cd",null,!1,i["a"],void 0);t["default"]=u.exports},"59fa":function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return i}));var i={uForm:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-form/u-form")]).then(n.bind(null,"15ec"))},uFormItem:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-form-item/u-form-item")]).then(n.bind(null,"3b953"))},"u-Textarea":function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u--textarea/u--textarea")]).then(n.bind(null,"07f1"))},uUpload:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-upload/u-upload")]).then(n.bind(null,"8541"))}},r=function(){var e=this.$createElement;this._self._c},o=[]},"6adf":function(e,t,n){"use strict";n.r(t);var i=n("708a"),r=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(o);t["default"]=r.a},"708a":function(e,t,n){"use strict";(function(e){var i=n("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n("7eb4")),o=i(n("7ca3")),a=i(n("ee10")),u=n("e86e");function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var d={data:function(){return{statusBarHeight:e.getSystemInfoSync().statusBarHeight,menuButtonH:45,pageIndex:0,list:[],feedbackItems:[],userId:"",courseId:"",videoId:"",formdata:{complaintContent:""},rules:{complaintContent:[{required:!0,message:"投诉反馈内容不能为空",trigger:["change","blur"]}]},text:"",templateId:0,user:{},isLastChild:0,isLogin:!1,fileList1:[]}},onLoad:function(e){var t=this;this.userId=e.userId||"",this.courseId=e.courseId||"",this.videoId=e.videoId||"",this.utils.isLoginCourse().then((function(e){e?(t.isLogin=!0,t.getMenuButton(),t.getList()):(t.isLogin=!1,t.goLogin())}),(function(e){}))},methods:{getMenuButton:function(){var t=e.getMenuButtonBoundingClientRect();this.menuButtonH=t.height},goBack:function(){if(0==this.pageIndex)e.navigateBack();else if(this.pageIndex--,this.formdata={complaintContent:""},1==this.isLastChild)this.isLastChild=0;else if(0==this.pageIndex)this.feedbackItems=this.list,this.templateId=0;else{var t=this.findGrandparentOrAllData(this.list,this.templateId);this.feedbackItems=t.childrenType,this.templateId=t.complaintTypeId}},findGrandparentOrAllData:function(e,t){function n(e,t){if(!e||!e.childrenType)return null;var i,r=l(e.childrenType);try{for(r.s();!(i=r.n()).done;){var o=i.value;if(o.complaintTypeId===t)return e;var a=n(o,t);if(a)return a}}catch(u){r.e(u)}finally{r.f()}return null}var i,r=l(e);try{for(r.s();!(i=r.n()).done;){var o=i.value;if(o.complaintTypeId===t)return e;var a=n(o,t);if(a){var u=n(o,a.complaintTypeId);return u||e}}}catch(s){r.e(s)}finally{r.f()}return e},handleClick:function(e,t){var n=this;if(1!=this.isLastChild&&this.pageIndex>=0){this.pageIndex++;var i=this.feedbackItems[t].childrenType||[];this.templateId=this.feedbackItems[t].complaintTypeId,this.formdata={complaintContent:""},this.text=this.feedbackItems[t].complaintTypeName,i.length>0?(this.isLastChild=0,this.feedbackItems=i,this.templateId=this.feedbackItems[0].complaintTypeId):(this.isLastChild=1,this.formdata={complaintContent:""},setTimeout((function(){n.$refs.uForm.setRules(n.rules)}),200))}},getList:function(){var e=this;(0,u.getTypeTree)().then((function(t){200==t.code&&(e.list=t.data,e.pageIndex=0,e.feedbackItems=e.list)}))},submit:function(){var t=this;if(this.fileList1.some((function(e){return"uploading"==e.status})))e.showToast({title:"等待图片上传中",icon:"none"});else{var n=[];this.fileList1.forEach((function(e){n.push(e.url)})),this.$refs.uForm.validate().then((function(i){if(i){var r={userId:t.userId,complaintTypeId:t.templateId,complaintContent:t.formdata.complaintContent,courseId:t.courseId,videoId:t.videoId,complaintUrl:n.toString()};(0,u.complaintRecord)(r).then((function(t){e.showModal({title:"",content:"我们已收到您的反馈,谢谢",showCancel:!1,success:function(t){(t.confirm||t.cancel)&&e.navigateBack()}})}))}}))}},deletePic:function(e){this["fileList".concat(e.name)].splice(e.index,1)},afterRead:function(e){var t=this;return(0,a.default)(r.default.mark((function n(){var i,o,a,u,s;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:i=[].concat(e.file),o=t["fileList".concat(e.name)].length,i.map((function(n){t["fileList".concat(e.name)].push(c(c({},n),{},{status:"uploading",message:"上传中"}))})),a=0;case 4:if(!(a<i.length)){n.next=14;break}return n.next=7,t.uploadFilePromise(i[a].url);case 7:u=n.sent,s=t["fileList".concat(e.name)][o],t["fileList".concat(e.name)].splice(o,1,Object.assign(s,{status:"success",message:"",url:u})),o++;case 11:a++,n.next=4;break;case 14:case"end":return n.stop()}}),n)})))()},uploadFilePromise:function(t){return new Promise((function(n,i){e.uploadFile({url:"https://h5api.his.cdwjyyh.com/app/common/uploadOSS",filePath:t,name:"file",success:function(e){setTimeout((function(){console.log(JSON.parse(e.data).url),n(JSON.parse(e.data).url)}),1e3)}})}))},goLogin:function(){var t=this;this.utils.getProvider().then((function(n){console.log("当前的环境商",n),n||reject(),e.login({provider:n,success:function(){var i=(0,a.default)(r.default.mark((function i(o){return r.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:console.log(o),e.getUserInfo({provider:n,success:function(n){e.showToast({title:"处理中...",icon:"loading"}),(0,u.loginByMp)({code:o.code,encryptedData:n.encryptedData,iv:n.iv,appId:"wx45cf09091aead547"}).then((function(n){e.hideLoading(),200==n.code?(e.setStorageSync("AppTokenmini_RTCourse",n.token),e.setStorageSync("userInfo",JSON.stringify(n.user)),t.userId=n.user.userId||"",t.isLogin=!0,t.getMenuButton(),t.getList()):e.showToast({title:n.msg,icon:"none"})})).catch((function(t){e.hideLoading(),e.showToast({icon:"none",title:"登录失败,请重新登录"})}))}});case 2:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()})})).catch((function(e){}))}}};t.default=d}).call(this,n("df3c")["default"])},"7f0e":function(e,t,n){"use strict";var i=n("b4fc"),r=n.n(i);r.a},b4fc:function(e,t,n){}},[["26a1","common/runtime","common/vendor"]]]);