text: (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-7986"],{"4UvY":function(e,t,n){"use strict";n.r(t);var r=n("iCc5"),a=n.n(r),i=n("V7oC"),o=n.n(i),s=n("14Xm"),l=n.n(s),u=n("FyfS"),c=n.n(u),f=n("gDS+"),p=n.n(f),d=n("D3Ub"),v=n.n(d),g=n("t6Sf"),h=(n("mRI9"),{filters:{selectType:function(e){return{0:"无",1:"单选",2:"单选（左右眼）",30:"斜视(内外侧)",31:"视力测试"}[e]}},mixins:[g.a],data:function(){return{objStr:"问卷问题",source:new b,dynamicTags:["标签一","标签二","标签三"],inputVisible:!1,inputValue:"",uploadStatus:"图片"}},methods:{upload:function(e){var t=this;return v()(l.a.mark(function n(){var r,a,i,o,s,u,f,d,v,g,h,b,m,y,w,k;return l.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:for(console.log("上传文件",e.target.files),r=e.target.files,a=void 0,[],i=!0,o=!1,s=void 0,n.prev=7,u=c()(r);!(i=(f=u.next()).done);i=!0)d=f.value,a=Bmob.File(d.name,d);n.next=15;break;case 11:n.prev=11,n.t0=n.catch(7),o=!0,s=n.t0;case 15:n.prev=15,n.prev=16,!i&&u.return&&u.return();case 18:if(n.prev=18,!o){n.next=21;break}throw s;case 21:return n.finish(18);case 22:return n.finish(15);case 23:return t.uploadStatus="正在上传",n.next=26,a.save();case 26:for(v=n.sent,g={},h=!0,b=!1,m=void 0,n.prev=31,y=c()(v);!(h=(w=y.next()).done);h=!0)k=w.value,g[k.filename]=k.url.replace("http://bmob-cdn-26875.b0.upaiyun.com","http://baishan.oversketch.com");n.next=39;break;case 35:n.prev=35,n.t1=n.catch(31),b=!0,m=n.t1;case 39:n.prev=39,n.prev=40,!h&&y.return&&y.return();case 42:if(n.prev=42,!b){n.next=45;break}throw m;case 45:return n.finish(42);case 46:return n.finish(39);case 47:console.log("res:\n",p()(v)),console.log("data:\n",p()(g)),console.log(v[0].url),t.row.image=v[0].url.replace("bmob-cdn-26875.b0.upaiyun.com","baishan.oversketch.com"),t.uploadStatus="上传完成";case 52:case"end":return n.stop()}},n,t,[[7,11,15,23],[16,,18,22],[31,35,39,47],[40,,42,46]])}))()},sort:function(e){var t=[],n=!0,r=!1,a=void 0;try{for(var i,o=c()(this.row.select);!(n=(i=o.next()).done);n=!0){var s=i.value.split("@");t.push({label:s[0],value:parseInt(s[1])})}}catch(e){r=!0,a=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw a}}0===e&&t.sort(function(e,t){return e.value-t.value}),1===e&&t.sort(function(e,t){return t.value-e.value}),this.row.select=t.map(function(e){return e.label+"@"+e.value}),this.$forceUpdate()},handleClose:function(e){console.log("remove",e,this.row.select,this.row.select.indexOf(e)),this.row.select.splice(this.row.select.indexOf(e),1),this.$forceUpdate()},showInput:function(){var e=this;this.inputVisible=!0,this.$nextTick(function(t){e.$refs.saveTagInput.$refs.input.focus()})},handleInputConfirm:function(){var e=this.inputValue;e&&(this.row.select||(this.row.select=[]),this.row.select.push(e)),this.inputVisible=!1,this.inputValue=""}}}),b=function(){function e(){a()(this,e),this.defaultObject={key:"",title:"",type:1,content:"",image:"",select:[]},this.rules={key:[{required:!0,message:"必填",trigger:"blur"}],title:[{required:!0,message:"必填",trigger:"blur"}],type:[{required:!0,message:"必填",trigger:"blur"}],content:[{required:!0,message:"必填",trigger:"blur"}],image:[{required:!0,message:"必填",trigger:"blur"}],select:[{required:!0,message:"必填",trigger:"blur"}]}}return o()(e,[{key:"all",value:function(){var e=v()(l.a.mark(function e(t){var n,r;return l.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(n=Bmob.Query("question")).equalTo("disable","==",!1),n.order("-createdAt"),e.next=5,n.find();case 5:return r=e.sent,e.abrupt("return",r);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"edit",value:function(){var e=v()(l.a.mark(function e(t){var n,r;return l.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=Bmob.Query("question"),e.next=3,n.get(t.objectId);case 3:return(r=e.sent).set("key",t.key),r.set("title",t.title),r.set("type",t.type),r.set("content",t.content),r.set("image",t.image),r.set("select",t.select),e.abrupt("return",r.save());case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"add",value:function(){var e=v()(l.a.mark(function e(t){var n;return l.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(n=Bmob.Query("question")).set("key",t.key),n.set("title",t.title),n.set("type",t.type),n.set("content",t.content),n.set("image",t.image),n.set("select",t.select),e.abrupt("return",n.save());case 8:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"editObj",value:function(){var e=v()(l.a.mark(function e(t,n){return l.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.set("key",n.key),t.set("title",n.title),t.set("type",n.type),t.set("content",n.content),t.set("image",n.image),t.set("select",n.select),e.abrupt("return",t);case 7:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"deleteObj",value:function(){var e=v()(l.a.mark(function e(t){var n,r;return l.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=Bmob.Query("question"),e.next=3,n.get(t.objectId);case 3:return(r=e.sent).set("disable",!0),e.abrupt("return",r.save());case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}(),m=h,y=(n("YMS8"),n("KHd+")),w=Object(y.a)(m,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"app-container"},[n("div",{staticClass:"filter-container"},[n("el-button",{staticClass:"filter-item",attrs:{type:"primary",icon:"el-icon-edit"},on:{click:e.add}},[e._v("添加")])],1),e._v(" "),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.listLoading,expression:"listLoading"}],attrs:{data:e.list,"element-loading-text":"Loading",border:"",fit:"","highlight-current-row":""}},[n("el-table-column",{attrs:{label:"更新日期",align:"left",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(e._s(t.row.updatedAt))]}}])}),e._v(" "),n("el-table-column",{attrs:{label:"类型",align:"left",width:"140"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("el-tag",[e._v(e._s(e._f("selectType")(t.row.type)))])]}}])}),e._v(" "),n("el-table-column",{attrs:{label:"Key",align:"left",width:"140"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(e._s(t.row.key))]}}])}),e._v(" "),n("el-table-column",{attrs:{label:"标题",align:"left",width:"150"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(e._s(t.row.title))]}}])}),e._v(" "),n("el-table-column",{attrs:{label:"内容",align:"left"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(e._s(t.row.content))]}}])}),e._v(" "),n("el-table-column",{attrs:{label:"图片",align:"center",width:"260"},scopedSlots:e._u([{key:"default",fn:function(e){return[n("img",{staticClass:"image",attrs:{src:e.row.image}})]}}])}),e._v(" "),n("el-table-column",{attrs:{label:"选项",align:"left"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(e._s(t.row.select))]}}])}),e._v(" "),n("el-table-column",{attrs:{"class-name":"status-col",label:"操作",align:"center",width:"220"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("el-button-group",[n("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(n){e.edit(t.row)}}},[e._v("修改")]),e._v(" "),n("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(n){e.deleteRow(t.row)}}},[e._v("删除")])],1)]}}])})],1),e._v(" "),e.query.total?n("div",{staticClass:"pagination-container"},[n("el-pagination",{attrs:{"current-page":e.query.pageNum,"page-sizes":[5,10,20,30,50],"page-size":e.query.pageSize,total:e.query.total,background:"",layout:"total, sizes, prev, pager, next, jumper"},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1):e._e(),e._v(" "),n("el-dialog",{attrs:{visible:e.addDialogVisible,title:e.dialogTitle},on:{"update:visible":function(t){e.addDialogVisible=t}}},[n("el-form",{staticStyle:{width:"400px","margin-left":"50px"},attrs:{model:e.row,rules:e.rules,"label-position":"left","label-width":"120px"}},[n("el-form-item",{attrs:{label:"类型",prop:"type"}},[n("el-select",{attrs:{placeholder:"请选择"},model:{value:e.row.type,callback:function(t){e.$set(e.row,"type",t)},expression:"row.type"}},[n("el-option",{key:0,attrs:{label:"无",value:0}}),e._v(" "),n("el-option",{key:1,attrs:{label:"单选",value:1}}),e._v(" "),n("el-option",{key:2,attrs:{label:"单选(左右眼)",value:2}}),e._v(" "),n("el-option",{key:30,attrs:{label:"斜视(内外侧)",value:30}}),e._v(" "),n("el-option",{key:31,attrs:{label:"视力测试",value:31}})],1)],1),e._v(" "),n("el-form-item",{attrs:{label:"Key",prop:"key"}},[n("el-input",{attrs:{placeholder:"请输入Key"},model:{value:e.row.key,callback:function(t){e.$set(e.row,"key",t)},expression:"row.key"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"标题",prop:"title"}},[n("el-input",{attrs:{placeholder:"请输入标题"},model:{value:e.row.title,callback:function(t){e.$set(e.row,"title",t)},expression:"row.title"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"内容",prop:"content"}},[n("el-input",{attrs:{placeholder:"请输入内容"},model:{value:e.row.content,callback:function(t){e.$set(e.row,"content",t)},expression:"row.content"}})],1),e._v(" "),n("el-form-item",{attrs:{label:e.uploadStatus,prop:"image"}},[n("img",{staticStyle:{height:"100px"},attrs:{src:e.row.image,alt:"图片预览"}}),e._v(" "),n("el-input",{attrs:{placeholder:"请粘贴图片地址"},model:{value:e.row.image,callback:function(t){e.$set(e.row,"image",t)},expression:"row.image"}}),e._v(" "),n("input",{attrs:{type:"file",id:"profilePhotoFileUpload",multiple:"multiple"},on:{change:e.upload}})],1),e._v(" "),n("el-form-item",{attrs:{label:"选项",prop:"image"}},[e._l(e.row.select,function(t){return n("div",[n("el-tag",{key:t,attrs:{closable:"","disable-transitions":!1},on:{close:function(n){e.handleClose(t)}}},[e._v(e._s(t))]),e._v(" "),n("br")],1)}),e._v(" "),e.inputVisible?n("el-input",{ref:"saveTagInput",staticClass:"input-new-tag",attrs:{size:"small"},on:{blur:e.handleInputConfirm},nativeOn:{keyup:function(t){return"button"in t||!e._k(t.keyCode,"enter",13,t.key,"Enter")?e.handleInputConfirm(t):null}},model:{value:e.inputValue,callback:function(t){e.inputValue=t},expression:"inputValue"}}):n("el-button",{staticClass:"button-new-tag",attrs:{size:"small"},on:{click:e.showInput}},[e._v("+ 新选项")]),e._v(" "),n("br"),e._v(" "),n("el-button",{staticClass:"button-new-tag",attrs:{size:"small"},on:{click:function(t){e.sort(0)}}},[e._v("按升序整理")]),e._v(" "),n("el-button",{staticClass:"button-new-tag",attrs:{size:"small"},on:{click:function(t){e.sort(1)}}},[e._v("按降序整理")])],2)],1),e._v(" "),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{type:"primary"},on:{click:e.submit}},[e._v("提交")])],1)],1)],1)},[],!1,null,null,null);w.options.__file="questionManage.vue";t.default=w.exports},QrDB:function(e,t,n){},"RU/L":function(e,t,n){n("Rqdy");var r=n("WEpk").Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},Rqdy:function(e,t,n){var r=n("Y7ZC");r(r.S+r.F*!n("jmDH"),"Object",{defineProperty:n("2faE").f})},SEkw:function(e,t,n){e.exports={default:n("RU/L"),__esModule:!0}},V7oC:function(e,t,n){"use strict";t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n("SEkw"));t.default=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),(0,r.default)(e,a.key,a)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()},YMS8:function(e,t,n){"use strict";var r=n("QrDB");n.n(r).a},"gDS+":function(e,t,n){e.exports={default:n("oh+g"),__esModule:!0}},iCc5:function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},mRI9:function(e,t,n){"use strict";var r=n("4d7F"),a=n.n(r),i=n("iCc5"),o=n.n(i),s=n("V7oC"),l=n.n(s);function u(){return{id:parseInt(10*Math.random()),title:"Title#"+parseInt(1e5*Math.random())}}var c=function(){function e(){o()(this,e)}return l()(e,null,[{key:"all",value:function(){return f([u(),u(),u()])}},{key:"edit",value:function(e){return f("修改结果")}},{key:"add",value:function(e){return f("添加结果")}},{key:"deleteObj",value:function(e){return f("删除结果")}}]),e}();function f(e){return console.log("模拟返回"),new a.a(function(t,n){t(e)})}c.defaultObject={},c.rules={},t.a=c},"oh+g":function(e,t,n){var r=n("WEpk"),a=r.JSON||(r.JSON={stringify:JSON.stringify});e.exports=function(e){return a.stringify.apply(a,arguments)}},t6Sf:function(e,t,n){"use strict";var r=n("4d7F"),a=n.n(r),i=n("P2sY"),o=n.n(i),s=n("14Xm"),l=n.n(s),u=n("D3Ub"),c=n.n(u),f=n("mRI9");t.a={computed:{dialogTitle:function(){return(this.isNew?"新增":"修改")+this.objStr}},filters:{},data:function(){return{objStr:"#对象#",list:[],listLoading:!0,query:{total:0,pageSize:5,page:1},addDialogVisible:!1,isNew:!1,row:{},rules:{},source:f.a,datePickOption:{shortcuts:[{text:"今天",onClick:function(e){e.$emit("pick",new Date)}},{text:"昨天",onClick:function(e){var t=new Date;t.setTime(t.getTime()-864e5),e.$emit("pick",t)}},{text:"一周前",onClick:function(e){var t=new Date;t.setTime(t.getTime()-6048e5),e.$emit("pick",t)}}]}}},created:function(){this.queryAll()},methods:{queryAll:function(){var e=this;return c()(l.a.mark(function t(){var n;return l.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e.listLoading=!0,t.prev=1,t.next=4,e.source.all(e.query);case 4:(n=t.sent).total?(e.list=n.data,e.query.total=n.total):e.list=n,console.log("查询数据:",e.list),t.next=14;break;case 9:t.prev=9,t.t0=t.catch(1),console.error(t.t0),e.notifyError("查询失败","查询数据时发生错误"),e.listLoading=!1;case 14:e.listLoading=!1;case 15:case"end":return t.stop()}},t,e,[[1,9]])}))()},add:function(){var e=this;return c()(l.a.mark(function t(){return l.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e.isNew=!0,e.row=o()({},e.source.defaultObject),e.rules=f.a.rules,e.addDialogVisible=!0;case 4:case"end":return t.stop()}},t,e)}))()},edit:function(e){console.log("edit",e),this.isNew=!1,this.row=o()({},e),this.rules=f.a.rules,this.addDialogVisible=!0},submit:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.row;return c()(l.a.mark(function n(){return l.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(console.log("###submit",t,e.isNew),n.prev=1,!e.isNew){n.next=9;break}return console.log("add"),n.next=6,e.source.add(e.row);case 6:e.notifySuccess("新增成功","成功新增"+e.objStr),n.next=13;break;case 9:return console.log("edit"),n.next=12,e.source.edit(e.row);case 12:e.notifySuccess("修改成功",e.objStr+"修改成功");case 13:n.next=19;break;case 15:n.prev=15,n.t0=n.catch(1),console.error(n.t0),e.notifyError("失败","操作发生错误，数据提交失败.");case 19:return e.addDialogVisible=!1,n.next=22,e.queryAll();case 22:case"end":return n.stop()}},n,e,[[1,15]])}))()},deleteRow:function(e){var t=this;return c()(l.a.mark(function n(){return l.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.$confirm("删除操作将不能撤销, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"error"});case 2:return n.next=4,t.source.deleteObj(e);case 4:return t.notifySuccess("删除成功",t.objStr+"已被删除"),n.next=7,t.queryAll();case 7:case"end":return n.stop()}},n,t)}))()},handleSizeChange:function(e){this.query.page=1,this.query.pageSize=e,console.log("handleSizeChange",e),this.queryAll()},handleCurrentChange:function(e){this.query.page=e,console.log("handleCurrentChange",e),this.queryAll()},goback:function(){this.$router.go(-1)},notifyError:function(e,t){this.$notify({title:e,message:t,type:"error",duration:2e3})},notifyWarning:function(e,t){this.$notify({title:e,message:t,type:"warning",duration:2e3})},notifySuccess:function(e,t){this.$notify({title:e,message:t,type:"success",duration:2e3})},needInterface:function(){this.$notify({title:"等待开发",message:"需要后台接口",type:"warning",duration:2e3})},fakePromise:function(){return new a.a(function(e,t){e()})}}}}}]);