UNPKG

@shifengsimon/ruoyi-appversion

Version:

APP版本控制器

1 lines 9.58 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("moment"),require("axios")):"function"==typeof define&&define.amd?define(["moment","axios"],e):"object"==typeof exports?exports.main=e(require("moment"),require("axios")):t.main=e(t[void 0],t[void 0])}(window,(function(t,e){return function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=2)}([function(e,o){e.exports=t},function(t,o){t.exports=e},function(t,e,o){"use strict";o.r(e);var n=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("el-dialog",{attrs:{title:t.title,visible:t.show,width:"900px","close-on-click-modal":!1},on:{"update:visible":function(e){t.show=e}}},[o("el-descriptions",{attrs:{column:3,size:"small",border:""}},[o("el-descriptions-item",[o("template",{slot:"label"},[o("i",{staticClass:"el-icon-office-building"}),t._v("\n\t\t\t\t应用平台\n\t\t\t")]),t._v(" "),t.form.id?[o("span",[t._v(t._s(t.form.platform))])]:[o("el-radio-group",{model:{value:t.form.platform,callback:function(e){t.$set(t.form,"platform",e)},expression:"form.platform"}},[o("el-radio",{attrs:{label:"android"}},[t._v("安卓")]),t._v(" "),o("el-radio",{attrs:{label:"ios"}},[t._v("苹果")])],1)]],2),t._v(" "),o("el-descriptions-item",[o("template",{slot:"label"},[o("i",{staticClass:"el-icon-office-building"}),t._v("\n\t\t\t\t版本号\n\t\t\t")]),t._v(" "),t.form.id?[o("span",[t._v(t._s(t.form.version))])]:[o("el-input",{attrs:{placeholder:"请输入版本号"},model:{value:t.form.version,callback:function(e){t.$set(t.form,"version",e)},expression:"form.version"}})]],2),t._v(" "),o("el-descriptions-item",[o("template",{slot:"label"},[o("i",{staticClass:"el-icon-office-building"}),t._v("\n\t\t\t\t更新内容\n\t\t\t")]),t._v(" "),t.form.id?[o("span",[t._v(t._s(t.form.content))])]:[o("el-input",{attrs:{type:"textarea",placeholder:"请输入更新内容"},model:{value:t.form.content,callback:function(e){t.$set(t.form,"content",e)},expression:"form.content"}})]],2),t._v(" "),o("el-descriptions-item",{attrs:{span:3}},[o("template",{slot:"label"},[o("i",{staticClass:"el-icon-office-building"}),t._v("\n\t\t\t\t上传安装包\n\t\t\t")]),t._v(" "),o("input",{ref:"filePath",attrs:{type:"file"},on:{change:function(e){return t.handleFilePathChange(e)}}})],2),t._v(" "),o("el-descriptions-item",{attrs:{span:3}},[o("template",{slot:"label"},[o("i",{staticClass:"el-icon-office-building"}),t._v("\n\t\t\t\t上传\n\t\t\t")]),t._v(" "),o("el-upload",{attrs:{action:"https://jsonplaceholder.typicode.com/posts/"}})],2)],1),t._v(" "),o("div",{attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:t.handleClose}},[t._v("取消")]),t._v(" "),o("el-button",{attrs:{type:"primary"},on:{click:t.handleSubmit}},[t._v("确定")])],1)],1)};n._withStripped=!0;var r=o(1),i=o.n(r);function a(t,e,o,n,r,i,a,l){var s,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=o,c._compiled=!0),n&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),a?(s=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},c._ssrRegister=s):r&&(s=l?function(){r.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:r),s)if(c.functional){c._injectStyles=s;var d=c.render;c.render=function(t,e){return s.call(e),d(t,e)}}else{var p=c.beforeCreate;c.beforeCreate=p?[].concat(p,s):[s]}return{exports:t,options:c}}var l=a({name:"AppVersionDialog",props:["data","visible"],data:()=>({show:!1,title:"",form:{platform:"android"},file:null}),watch:{visible:{handler(){this.show=this.visible,this.visible?this.data?(this.title="修改版本",this.form=JSON.parse(JSON.stringify(this.data))):this.title="新增版本":this.reset()},immediate:!0}},methods:{handleClose(){this.show=!1,this.$emit("update:visible",!1)},handleSubmit(){if(!this.file)return void console.error("请上传安装包");const t=new FormData;t.append("file",this.file),i.a.post("/api/appversion/upload",t,{headers:{"Content-Type":"multipart/form-data"}}).then(({data:t})=>{200===t.code?(this.form.filePath=t.data,Promise.resolve()):(console.error("上传安装包失败"),Promise.reject("上传安装包失败"))}).then(()=>{this.form.id?i.a.put("/api/appversion",this.form):i.a.post("/api/appversion",this.form)}),this.show=!1,this.$emit("update:visible",!1)},reset(){this.title=""},handleFilePathChange(t){this.file=t.target.files[0]}}},n,[],!1,null,null,null).exports;l.install=function(t){t.component(l.name,l)};var s=l,c=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"app-version__query"},[o("el-form",{attrs:{model:t.queryForm,"label-width":"80px"}},[o("el-row",{attrs:{gutter:20}},[o("el-col",{attrs:{span:6}},[o("el-form-item",{attrs:{label:"版本号"}},[o("el-input",{model:{value:t.queryForm.version,callback:function(e){t.$set(t.queryForm,"version",e)},expression:"queryForm.version"}})],1)],1),t._v(" "),o("el-col",{attrs:{span:12}},[o("el-form-item",{attrs:{label:"上传日期"}},[o("el-date-picker",{staticStyle:{width:"100%"},attrs:{type:"daterange",placeholder:"开始日期","range-separator":"至"},model:{value:t.dateRange,callback:function(e){t.dateRange=e},expression:"dateRange"}})],1)],1),t._v(" "),o("el-col",{attrs:{span:6}},[o("el-form-item",{attrs:{label:"应用平台"}},[o("el-checkbox-group",{model:{value:t.queryForm.platform,callback:function(e){t.$set(t.queryForm,"platform",e)},expression:"queryForm.platform"}},[o("el-checkbox",{attrs:{label:"android"}},[t._v("安卓")]),t._v(" "),o("el-checkbox",{attrs:{label:"ios"}},[t._v("苹果")])],1)],1)],1),t._v(" "),o("el-col",{attrs:{span:6}},[o("el-form-item",{attrs:{label:"更新内容"}},[o("el-input",{model:{value:t.queryForm.content,callback:function(e){t.$set(t.queryForm,"content",e)},expression:"queryForm.content"}})],1)],1),t._v(" "),o("el-col",{staticStyle:{"text-align":"right"},attrs:{span:18}},[o("el-form-item",[o("el-button",{attrs:{type:"primary",icon:"el-icon-upload",size:"mini"},on:{click:t.handleAdd}},[t._v("上传")]),t._v(" "),o("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:"mini"},on:{click:t.handleQuery}},[t._v("搜索")]),t._v(" "),o("el-button",{attrs:{icon:"el-icon-refresh",size:"mini"},on:{click:t.resetQuery}},[t._v("重置")])],1)],1)],1)],1)],1)};c._withStripped=!0;var d=o(0),p=o.n(d),u=a({name:"AppVersionQuery",data:()=>({dateRange:[p()().add(-7,"days").toDate(),p()().toDate()],queryForm:{version:"",startDate:"",endDate:"",platform:["android","ios"],content:""}}),watch:{dateRange:{handler(){if(this.dateRange&&Array.isArray(this.dateRange)&&2===this.dateRange.length)return this.queryForm.startDate=p()(this.dateRange[0]).format("YYYY-MM-DD"),void(this.queryForm.endDate=p()(this.dateRange[1]).format("YYYY-MM-DD"));throw new Error("字段dateRange格式违法")},immediate:!0}},methods:{handleQuery(){i.a.get("/api/appversion/list").then(t=>{this.$emit("query",t.data)})},resetQuery(){this.dateRange=[p()().add(-7,"days").toDate(),p()().toDate()],this.queryForm.version="",this.queryForm.platform=[],this.queryForm.content=""},handleAdd(){this.$emit("visible")}}},c,[],!1,null,null,null).exports;u.install=function(t){t.component(u.name,u)};var f=u,m=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("el-table",{staticStyle:{width:"100%"},attrs:{data:t.tableData,height:"500"}},[o("el-table-column",{attrs:{label:"应用平台",prop:"platform"}}),t._v(" "),o("el-table-column",{attrs:{label:"版本号",prop:"version"}}),t._v(" "),o("el-table-column",{attrs:{label:"上传日期",prop:"uploadDate"}}),t._v(" "),o("el-table-column",{attrs:{label:"更新内容",prop:"content"}}),t._v(" "),o("el-table-column",{attrs:{label:"更新图片",prop:"files"}}),t._v(" "),o("el-table-column",{attrs:{label:"操作"},scopedSlots:t._u([{key:"default",fn:function(e){return[o("el-button",{attrs:{size:"mini"},on:{click:function(o){return t.handleEdit(e.$index,e.row)}}},[t._v("编辑")]),t._v(" "),o("el-button",{attrs:{size:"mini",type:"danger"},on:{click:function(o){return t.handleDelete(e.$index,e.row)}}},[t._v("删除")])]}}])})],1)};m._withStripped=!0;var h=a({name:"AppVersionList",props:["data"],data:()=>({}),computed:{tableData(){return 200===this.data.code?this.data.rows:[]}},methods:{handleEdit(){},handleDelete(){}}},m,[],!1,null,null,null).exports;h.install=function(t){t.component(h.name,h)};var v=h;const _=[s,f,v],b=function(t,e={}){_.forEach(e=>{t.component(e.name,e)})};"undefined"!=typeof window&&window.Vue&&b(window.Vue);e.default={version:"0.0.1",install:b,AppVersionDialog:s,AppVersionQuery:f,AppVersionList:v}}]).default}));