diff --git a/js/dist/admin.js b/js/dist/admin.js index 2c3a017..0aa58d4 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,3 +1,3 @@ /*! For license information please see admin.js.LICENSE.txt */ -(()=>{var t={535:t=>{"use strict";var e=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},o=0;o<10;o++)e["_"+String.fromCharCode(o)]=o;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,i){for(var r,a,s=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),m=1;m{"use strict";var n=o(535),i="function"==typeof Symbol&&Symbol.for;i&&Symbol.for("react.element"),i&&Symbol.for("react.portal"),i&&Symbol.for("react.fragment"),i&&Symbol.for("react.strict_mode"),i&&Symbol.for("react.profiler"),i&&Symbol.for("react.provider"),i&&Symbol.for("react.context"),i&&Symbol.for("react.forward_ref"),i&&Symbol.for("react.suspense"),i&&Symbol.for("react.memo"),i&&Symbol.for("react.lazy"),"function"==typeof Symbol&&Symbol.iterator;function r(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,o=1;o{"use strict";o(488)}},e={};function o(n){var i=e[n];if(void 0!==i)return i.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,o),r.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n);const t=flarum.core.compat["admin/app"];var e=o.n(t);function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}const a=flarum.core.compat["admin/components/ExtensionPage"];var s=o.n(a);const l=flarum.core.compat["common/components/Button"];var c=o.n(l);function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function p(t){var e=function(t,e){if("object"!=d(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var n=o.call(t,"string");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==d(e)?e:String(e)}function u(t,e){for(var o=0;o{var t={535:t=>{"use strict";var e=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},i=0;i<10;i++)e["_"+String.fromCharCode(i)]=i;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach((function(t){o[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}()?Object.assign:function(t,s){for(var a,n,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),l=1;l{"use strict";var o=i(535),s="function"==typeof Symbol&&Symbol.for;s&&Symbol.for("react.element"),s&&Symbol.for("react.portal"),s&&Symbol.for("react.fragment"),s&&Symbol.for("react.strict_mode"),s&&Symbol.for("react.profiler"),s&&Symbol.for("react.provider"),s&&Symbol.for("react.context"),s&&Symbol.for("react.forward_ref"),s&&Symbol.for("react.suspense"),s&&Symbol.for("react.memo"),s&&Symbol.for("react.lazy"),"function"==typeof Symbol&&Symbol.iterator;function a(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i{"use strict";i(488)}},e={};function i(o){var s=e[o];if(void 0!==s)return s.exports;var a=e[o]={exports:{}};return t[o](a,a.exports,i),a.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};(()=>{"use strict";i.r(o);const t=flarum.core.compat["admin/app"];var e=i.n(t);function s(t,e){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},s(t,e)}function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,s(t,e)}const n=flarum.core.compat["admin/components/ExtensionPage"];var r=i.n(n);const l=flarum.core.compat["common/components/Button"];var d=i.n(l);const c=flarum.core.compat["common/components/Modal"];var p=i.n(c);i(684);const u=flarum.core.compat["common/components/Switch"];var y=i.n(u);const h=flarum.core.compat["common/components/Select"];var f=i.n(h);const g=flarum.core.compat["common/utils/Stream"];var b=i.n(g),v=function(t){function i(){for(var e,i=arguments.length,o=new Array(i),s=0;sQ.length&&Q.push(a)}\nfunction T(a,b,c,e){var d=typeof a;if(\"undefined\"===d||\"boolean\"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case \"string\":case \"number\":g=!0;break;case \"object\":switch(a.$$typeof){case p:case q:g=!0}}if(g)return c(e,a,\"\"===b?\".\"+U(a,0):b),1;g=0;b=\"\"===b?\".\":b+\":\";if(Array.isArray(a))for(var k=0;k {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/ExtensionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : String(i);\n}","import _typeof from \"./typeof.js\";\nexport default function toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);\n }\n}\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Select'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","import app from 'flarum/admin/app';\nimport Modal, {IInternalModalAttrs} from \"flarum/common/components/Modal\";\nimport Button from 'flarum/common/components/Button';\nimport Switch from \"flarum/common/components/Switch\";\nimport Select from \"flarum/common/components/Select\";\nimport Stream from 'flarum/common/utils/Stream';\nimport type Mithril from 'mithril';\n\ninterface ISubscriptionModalAttrs extends IInternalModalAttrs {\n code: string;\n title: string;\n}\n\nexport default class AddStoreCommodityDetail extends Modal {\n\n private params = {\n status: 1,\n code: Stream(),\n title: Stream(),\n desc: Stream(),\n price: Stream(),\n stock: Stream(),\n discount: Stream(),\n limit: Stream(),\n limitUnit: 'day',\n type: 'permanent',\n outtime: Stream(),\n icon: Stream(),\n hide: 0\n }\n\n static initAttrs(attrs: ISubscriptionModalAttrs) {\n super.initAttrs(attrs);\n }\n\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n\n this.params.code = Stream(this.attrs.code || '');\n this.params.title = Stream(this.attrs.title || '');\n }\n\n title() {\n return this.attrs.title;\n }\n\n className(): string {\n return \"\";\n }\n\n content() {\n return (\n
\n
\n
\n
\n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-status\")}\n \n {\n this.params.status = val\n }}\n > \n \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-code\")} \n {this.attrs.code} \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-title\")}\n
\n \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-desc\")}\n
\n \n
\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-price\")}
\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-stock\")}
\n \n
\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-discount\")}
\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-discount-limit\")}\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-discount-limit-unit\")}\n {Select.component({\n options: {'day': '天', 'hour': '小时', 'minute': '分钟', 'second': '秒'},\n value: this.params.limitUnit,\n onchange: (val) => {\n this.params.limitUnit = val\n },\n })}\n \n\n
\n
{app.translator.trans(\"mattoid-store.admin.settings.commodity-type\")}
\n {Select.component({\n options: {'permanent': '永久有效', 'limit': '限时有效'},\n value: this.params.type,\n onchange: (val) => {\n this.params.type = val\n },\n })}\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-outtime\")}
\n \n \n
\n\n \n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-icon\")}\n
\n
\n
\n \n
\n
\n {\n\n }}>\n {app.translator.trans('mattoid-store.admin.settings.commodity-upload-button') }\n \n
\n
\n \n\n
\n {\n this.params.hide = val\n }}\n >\n {app.translator.trans(\n \"mattoid-store.admin.settings.commodity-hide\"\n )}\n \n
\n \n\n
\n {\n this.loading = true;\n this.addCommodity().then(res => {\n this.hide();\n }).catch(() => {\n this.loading = false;\n m.redraw();\n });\n }}>\n {app.translator.trans('mattoid-store.admin.settings.add-store-commodity') }\n \n
\n \n \n \n \n )\n }\n\n addCommodity() {\n return app.request<{ userMatchCount: number }>({\n method: 'POST',\n url: app.forum.attribute('apiUrl') + '/store/commodity',\n body: this.params\n });\n }\n\n}\n","import app from 'flarum/admin/app';\nimport Modal, {IInternalModalAttrs} from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport React from \"react\";\nimport AddStoreCommodityDetail from \"./AddStoreCommodityDetail\";\n\nexport default class AddStoreCommodity extends Modal {\n private _list: any[]\n get list(): any[] {\n return this._list;\n }\n\n set list(value: any[]) {\n this._list = value;\n }\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.request().then(res => {\n this.list = res.data || []\n })\n }\n\n title() {\n return app.translator.trans('mattoid-store.admin.settings.add-store-commodity');\n }\n\n className(): string {\n return \"\";\n }\n\n content() {\n if (!this.list || this.list.length == 0) {\n return (\n
\n 暂无可用商品\n
\n )\n }\n return (\n
\n {this.list.map((item: object, index: number) => (\n
\n
\n
\n {item.attributes.name}\n {\n app.modal.show(AddStoreCommodityDetail, { code: item.attributes.code, title: item.attributes.name});\n }}\n >\n { app.translator.trans('mattoid-store.admin.settings.add-store-commodity') }\n \n
\n
\n
\n ))}\n
\n )\n }\n\n request() {\n return app.request<{ userMatchCount: number }>({\n method: 'GET',\n url: app.forum.attribute('apiUrl') + '/store/commodity',\n });\n }\n\n}\n","import app from 'flarum/admin/app';\nimport ExtensionPage from 'flarum/admin/components/ExtensionPage';\nimport Button from 'flarum/common/components/Button';\nimport type Mithril from 'mithril';\nimport AddStoreCommodity from \"./AddStoreCommodity\";\n\nexport default class StoreListPage extends ExtensionPage {\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n }\n\n content() {\n return (\n
\n
\n
\n
\n {this.buildSettingComponent({\n type: 'string',\n setting: 'mattoid-store.storeName',\n label: app.translator.trans('mattoid-store.admin.settings.store-name'),\n placeholder: app.translator.trans('mattoid-store.admin.settings.store-name'),\n help: app.translator.trans('mattoid-store.admin.settings.store-name-requirement'),\n })}\n {this.buildSettingComponent({\n type: 'string',\n setting: 'mattoid-store.decorationStoreTimezone',\n label: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone'),\n placeholder: 'Asia/Shanghai',\n help: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone-requirement'),\n })}\n {this.submitButton()}\n
\n
\n {this.buildSettingComponent(function () {\n return m('.Form-group', Button.component({\n className: 'Button',\n onclick() {\n app.modal.show(AddStoreCommodity);\n },\n }, app.translator.trans('mattoid-store.admin.settings.add-store-commodity')));\n })}\n
\n
\n
\n )\n }\n}\n","import app from 'flarum/admin/app';\nimport StoreListPage from './components/StoreListPage';\n\napp.initializers.add('mattoid-store', () => {\n app.extensionData.for(\"mattoid-store\")\n // .registerSetting({\n // setting: 'mattoid-store.storeName',\n // help: app.translator.trans('mattoid-store.admin.settings.store-name-requirement'),\n // label: app.translator.trans('mattoid-store.admin.settings.store-name'),\n // type: 'string',\n // })\n // .registerSetting({\n // setting: 'mattoid-store.decorationStoreTimezone',\n // help: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone-requirement'),\n // label: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone'),\n // type: 'string',\n // })\n .registerPage(StoreListPage)\n .registerPermission(\n {\n icon: 'fas fa-id-card',\n label: app.translator.trans('mattoid-store.admin.settings.group-view'),\n permission: 'mattoid-store.group-view',\n allowGuest: true\n }, 'view')\n});\n"],"names":["getOwnPropertySymbols","Object","hasOwnProperty","prototype","propIsEnumerable","propertyIsEnumerable","module","exports","assign","test1","String","getOwnPropertyNames","test2","i","fromCharCode","map","n","join","test3","split","forEach","letter","keys","err","shouldUseNative","target","source","from","symbols","to","val","TypeError","toObject","s","arguments","length","key","call","l","require","Symbol","iterator","C","a","b","c","encodeURIComponent","D","isMounted","enqueueForceUpdate","enqueueReplaceState","enqueueSetState","E","F","this","props","context","refs","updater","G","H","isReactComponent","setState","Error","forceUpdate","I","constructor","isPureReactComponent","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","getter","__esModule","d","definition","o","defineProperty","enumerable","get","obj","prop","r","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","_typeof","toPropertyKey","t","e","toPrimitive","_defineProperties","descriptor","configurable","writable","AddStoreCommodityDetail","_Modal","_this","_len","args","Array","_key","apply","concat","params","status","code","Stream","title","desc","price","stock","discount","limit","limitUnit","type","outtime","icon","hide","initAttrs","attrs","_proto","oninit","vnode","className","content","_this2","m","style","class","app","trans","Switch","state","onchange","required","bidi","step","min","Select","options","id","Button","onclick","loading","addCommodity","then","res","redraw","method","url","attribute","body","Modal","AddStoreCommodity","_list","Constructor","protoProps","request","list","data","item","index","attributes","name","show","set","StoreListPage","_ExtensionPage","buildSettingComponent","setting","label","placeholder","help","submitButton","ExtensionPage","add","registerPage","registerPermission","permission","allowGuest"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":";kCAQA,IAAIA,EAAwBC,OAAOD,sBAC/BE,EAAiBD,OAAOE,UAAUD,eAClCE,EAAmBH,OAAOE,UAAUE,qBAsDxCC,EAAOC,QA5CP,WACC,IACC,IAAKN,OAAOO,OACX,OAAO,EAMR,IAAIC,EAAQ,IAAIC,OAAO,OAEvB,GADAD,EAAM,GAAK,KACkC,MAAzCR,OAAOU,oBAAoBF,GAAO,GACrC,OAAO,EAKR,IADA,IAAIG,EAAQ,CAAC,EACJC,EAAI,EAAGA,EAAI,GAAIA,IACvBD,EAAM,IAAMF,O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KAAKiE,OACXV,OAAQvD,KAAKuD,UAGf,OAAOyB,IAAAA,MACJ4C,KAAK,cAAe,CACnBC,OAAOuB,EACPtB,KAAM,CACJH,OAAAA,KAEF,OACK,WAAO,IACb3B,KAAKhG,KAAKoH,aAAa7E,KAAKvC,MACjC,EAACwI,CAAA,CAtJ+B,CAASa,KCL3CrE,IAAAA,aAAiBsE,IAAI,iBAAiB,WACpCtE,IAAAA,cAAiB,IAAK,iBAanBuE,aAAaf,GACbgB,mBACC,CACErF,KAAM,iBACN0E,MAAO7D,IAAAA,WAAeC,MAAM,2CAC5BwE,WAAY,2BACZC,YAAY,GACX,OACT","sources":["webpack://@mattoid/store/./node_modules/object-assign/index.js","webpack://@mattoid/store/./node_modules/react/cjs/react.production.min.js","webpack://@mattoid/store/./node_modules/react/index.js","webpack://@mattoid/store/webpack/bootstrap","webpack://@mattoid/store/webpack/runtime/compat get default export","webpack://@mattoid/store/webpack/runtime/define property getters","webpack://@mattoid/store/webpack/runtime/hasOwnProperty shorthand","webpack://@mattoid/store/webpack/runtime/make namespace object","webpack://@mattoid/store/external root \"flarum.core.compat['admin/app']\"","webpack://@mattoid/store/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@mattoid/store/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@mattoid/store/external root \"flarum.core.compat['admin/components/ExtensionPage']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Button']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Switch']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/components/Select']\"","webpack://@mattoid/store/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@mattoid/store/./src/admin/components/AddStoreCommodityDetail.tsx","webpack://@mattoid/store/./src/admin/components/AddStoreCommodity.tsx","webpack://@mattoid/store/external root \"flarum.core.compat['Component']\"","webpack://@mattoid/store/./src/admin/components/StoreListItem.tsx","webpack://@mattoid/store/./src/admin/components/StoreListPage.tsx","webpack://@mattoid/store/./src/admin/index.tsx"],"sourcesContent":["/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","/** @license React v16.14.0\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var l=require(\"object-assign\"),n=\"function\"===typeof Symbol&&Symbol.for,p=n?Symbol.for(\"react.element\"):60103,q=n?Symbol.for(\"react.portal\"):60106,r=n?Symbol.for(\"react.fragment\"):60107,t=n?Symbol.for(\"react.strict_mode\"):60108,u=n?Symbol.for(\"react.profiler\"):60114,v=n?Symbol.for(\"react.provider\"):60109,w=n?Symbol.for(\"react.context\"):60110,x=n?Symbol.for(\"react.forward_ref\"):60112,y=n?Symbol.for(\"react.suspense\"):60113,z=n?Symbol.for(\"react.memo\"):60115,A=n?Symbol.for(\"react.lazy\"):\n60116,B=\"function\"===typeof Symbol&&Symbol.iterator;function C(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cQ.length&&Q.push(a)}\nfunction T(a,b,c,e){var d=typeof a;if(\"undefined\"===d||\"boolean\"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case \"string\":case \"number\":g=!0;break;case \"object\":switch(a.$$typeof){case p:case q:g=!0}}if(g)return c(e,a,\"\"===b?\".\"+U(a,0):b),1;g=0;b=\"\"===b?\".\":b+\":\";if(Array.isArray(a))for(var k=0;k {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/ExtensionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Select'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","import app from 'flarum/admin/app';\nimport Modal, {IInternalModalAttrs} from \"flarum/common/components/Modal\";\nimport Button from 'flarum/common/components/Button';\nimport Switch from \"flarum/common/components/Switch\";\nimport Select from \"flarum/common/components/Select\";\nimport Stream from 'flarum/common/utils/Stream';\nimport type Mithril from 'mithril';\n\ninterface ISubscriptionModalAttrs extends IInternalModalAttrs {\n code: string;\n title: string;\n}\n\nexport default class AddStoreCommodityDetail extends Modal {\n\n private params = {\n status: 1,\n code: Stream(),\n title: Stream(),\n desc: Stream(),\n price: Stream(),\n stock: Stream(),\n discount: Stream(),\n limit: Stream(),\n limitUnit: 'day',\n type: 'permanent',\n outtime: Stream(),\n icon: Stream(),\n hide: 0\n }\n\n static initAttrs(attrs: ISubscriptionModalAttrs) {\n super.initAttrs(attrs);\n }\n\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n\n this.params.code = Stream(this.attrs.code || '');\n this.params.title = Stream(this.attrs.title || '');\n }\n\n title() {\n return this.attrs.title;\n }\n\n className(): string {\n return \"\";\n }\n\n content() {\n return (\n
\n
\n
\n
\n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-status\")}\n \n {\n this.params.status = val\n }}\n > \n \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-code\")}\n {this.attrs.code} \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-title\")}\n
\n \n
\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-desc\")}\n
\n \n
\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-price\")}
\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-stock\")}
\n \n
\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-discount\")}
\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-discount-limit\")}\n \n\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-discount-limit-unit\")}\n {Select.component({\n options: {\n 'day': app.translator.trans(\"mattoid-store.lib.item-limit-unit-day\"),\n 'hour': app.translator.trans(\"mattoid-store.lib.item-limit-unit-hour\"),\n 'minute': app.translator.trans(\"mattoid-store.lib.item-limit-unit-minute\"),\n 'second': app.translator.trans(\"mattoid-store.lib.item-limit-unit-second\")\n },\n value: this.params.limitUnit,\n onchange: (val) => {\n this.params.limitUnit = val\n },\n })}\n \n\n
\n
{app.translator.trans(\"mattoid-store.admin.settings.commodity-type\")}
\n {Select.component({\n options: {\n 'permanent': app.translator.trans(\"mattoid-store.lib.item-type-permanent\"),\n 'limit': app.translator.trans(\"mattoid-store.lib.item-type-limit\")\n },\n value: this.params.type,\n onchange: (val) => {\n this.params.type = val\n },\n })}\n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-outtime\")}
\n \n \n
\n\n \n\n
\n {app.translator.trans(\"mattoid-store.admin.settings.commodity-icon\")}\n
\n
\n
\n \n
\n
\n {\n\n }}>\n {app.translator.trans('mattoid-store.admin.settings.commodity-upload-button') }\n \n
\n
\n \n\n
\n {\n this.params.hide = val\n }}\n >\n {app.translator.trans(\n \"mattoid-store.admin.settings.commodity-hide\"\n )}\n \n
\n \n\n
\n {\n this.loading = true;\n this.addCommodity().then(res => {\n this.hide();\n }).catch(() => {\n this.loading = false;\n m.redraw();\n });\n }}>\n {app.translator.trans('mattoid-store.admin.settings.add-store-commodity') }\n \n
\n \n \n \n \n )\n }\n\n addCommodity() {\n return app.request<{ userMatchCount: number }>({\n method: 'POST',\n url: app.forum.attribute('apiUrl') + '/store/commodity',\n body: this.params\n });\n }\n\n}\n","import app from 'flarum/admin/app';\nimport Modal, {IInternalModalAttrs} from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport React from \"react\";\nimport AddStoreCommodityDetail from \"./AddStoreCommodityDetail\";\n\nexport default class AddStoreCommodity extends Modal {\n private commodityList: any = []\n private moreResults: boolean = false\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loadResults()\n }\n\n title() {\n return app.translator.trans('mattoid-store.admin.settings.add-store-commodity');\n }\n\n className(): string {\n return \"\";\n }\n\n content() {\n return (\n
\n {this.commodityList.map((item: object, index: number) => (\n
\n
\n
\n
\n {item.attributes.name}\n {\n app.modal.show(AddStoreCommodityDetail, {\n code: item.attributes.code,\n title: item.attributes.name\n });\n }}\n >\n {app.translator.trans('mattoid-store.admin.settings.add-store-commodity')}\n \n
\n
\n
\n
\n ))}\n\n {!this.loading && this.commodityList.length === 0 && (\n
\n {app.translator.trans(\"mattoid-store.lib.list-empty\")}
\n
\n )}\n\n {!this.loading && this.hasMoreResults() && (\n
\n \n
\n )}\n\n \n )\n }\n\n\n hasMoreResults() {\n return this.moreResults;\n }\n\n loadMore() {\n this.loading = true;\n this.loadResults(this.commodityList.length);\n }\n\n parseResults(results) {\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n [].push.apply(this.commodityList, results.payload.data);\n this.loading = false;\n m.redraw();\n\n return results;\n }\n\n loadResults(offset = 0) {\n const filters = {\n };\n\n return app.store\n .find(\"/store/commodity\", {\n filter:filters,\n page: {\n offset,\n },\n })\n .catch(() => {})\n .then(this.parseResults.bind(this));\n }\n\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['Component'];","import app from 'flarum/admin/app';\nimport Component from \"flarum/Component\";\n\nexport default class StoreListItem extends Component {\n private storeData: object = {}\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.storeData = this.attrs.item.attributes\n this.storeData.id = this.attrs.item.id\n }\n\n view() {\n return (\n
\n
\n
\n {app.translator.trans('mattoid-store.lib.item-id')}: {this.storeData.id} |  \n {app.translator.trans('mattoid-store.lib.item-title')}: {this.storeData.title}\n
\n
\n {app.translator.trans('mattoid-store.lib.item-desc')}: {this.storeData.desc}\n
\n
\n {app.translator.trans('mattoid-store.lib.item-status')}: { app.translator.trans('mattoid-store.lib.item-status-' + this.storeData.status) } | \n {app.translator.trans('mattoid-store.lib.item-price')}: {this.storeData.price} | \n {app.translator.trans('mattoid-store.lib.item-stock')}: {this.storeData.stock} | \n {app.translator.trans('mattoid-store.lib.item-discount')}: {this.storeData.discount || '无'} | \n {app.translator.trans('mattoid-store.lib.item-discount_limit')}: {this.storeData.discountLimit || 0} {this.storeData.discountLimitUnit}\n
\n
\n {app.translator.trans('mattoid-store.lib.item-type')}: {app.translator.trans('mattoid-store.lib.item-type-' + this.storeData.type)} | \n {app.translator.trans('mattoid-store.lib.item-created-at')}: {this.storeData.createdAt}\n
\n
\n
\n \n
\n
\n )\n }\n\n\n\n}\n","import app from 'flarum/admin/app';\nimport ExtensionPage from 'flarum/admin/components/ExtensionPage';\nimport Button from 'flarum/common/components/Button';\nimport Mithril from 'mithril';\nimport AddStoreCommodity from \"./AddStoreCommodity\";\nimport Select from \"flarum/common/components/Select\";\nimport Stream from 'flarum/common/utils/Stream';\nimport StoreListItem from \"./StoreListItem\";\n\nexport default class StoreListPage extends ExtensionPage {\n\n private storeList: any = []\n private moreResults: boolean = false\n\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n\n this.status = Stream('-1');\n this.type = Stream('-1');\n\n this.loadResults();\n }\n\n content() {\n return (\n
\n
\n
\n
\n {this.buildSettingComponent({\n type: 'string',\n setting: 'mattoid-store.storeName',\n label: app.translator.trans('mattoid-store.admin.settings.store-name'),\n placeholder: app.translator.trans('mattoid-store.admin.settings.store-name'),\n help: app.translator.trans('mattoid-store.admin.settings.store-name-requirement'),\n })}\n {this.buildSettingComponent({\n type: 'string',\n setting: 'mattoid-store.storeTimezone',\n label: app.translator.trans('mattoid-store.admin.settings.store-timezone'),\n placeholder: 'Asia/Shanghai',\n help: app.translator.trans('mattoid-store.admin.settings.store-timezone-requirement'),\n })}\n {this.submitButton()}\n
\n
\n {this.buildSettingComponent(function () {\n return m('.Form-group', Button.component({\n className: 'Button',\n onclick() {\n app.modal.show(AddStoreCommodity);\n },\n }, app.translator.trans('mattoid-store.admin.settings.add-store-commodity')));\n })}\n
\n
\n
\n
\n {\n this.status(e)\n this.storeList = []\n this.loadResults()\n }}\n />\n
\n
\n {\n this.type(e)\n this.storeList = []\n this.loadResults()\n }}\n />\n
\n
\n
    \n {\n this.storeList.map((item) => {\n return (\n
  • \n {StoreListItem.component({ item })}\n
  • \n );\n })\n }\n
\n\n {!this.loading && this.storeList.length === 0 && (\n
\n
\n {app.translator.trans('mattoid-store.lib.list-empty')}\n
\n
\n )}\n\n {!this.loading && this.hasMoreResults() && (\n
\n \n
\n )}\n\n
\n
\n
\n )\n }\n\n hasMoreResults() {\n return this.moreResults;\n }\n\n loadMore() {\n this.loading = true;\n this.loadResults(this.storeList.length);\n }\n\n parseResults(results) {\n this.moreResults = !!results.payload.links && !!results.payload.links.next;\n [].push.apply(this.storeList, results.payload.data);\n this.loading = false;\n m.redraw();\n\n return results;\n }\n\n loadResults(offset = 0) {\n const filters = {\n type: this.type(),\n status: this.status()\n };\n\n return app.store\n .find(\"/store/list\", {\n filter:filters,\n page: {\n offset,\n },\n })\n .catch(() => {})\n .then(this.parseResults.bind(this));\n }\n}\n","import app from 'flarum/admin/app';\nimport StoreListPage from './components/StoreListPage';\nimport StorePage from \"./components/StorePage\";\n\napp.initializers.add('mattoid-store', () => {\n app.extensionData.for(\"mattoid-store\")\n // .registerSetting({\n // setting: 'mattoid-store.storeName',\n // help: app.translator.trans('mattoid-store.admin.settings.store-name-requirement'),\n // label: app.translator.trans('mattoid-store.admin.settings.store-name'),\n // type: 'string',\n // })\n // .registerSetting({\n // setting: 'mattoid-store.decorationStoreTimezone',\n // help: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone-requirement'),\n // label: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone'),\n // type: 'string',\n // })\n .registerPage(StoreListPage)\n .registerPermission(\n {\n icon: 'fas fa-id-card',\n label: app.translator.trans('mattoid-store.admin.settings.group-view'),\n permission: 'mattoid-store.group-view',\n allowGuest: true\n }, 'view')\n});\n"],"names":["getOwnPropertySymbols","Object","hasOwnProperty","prototype","propIsEnumerable","propertyIsEnumerable","module","exports","assign","test1","String","getOwnPropertyNames","test2","i","fromCharCode","map","n","join","test3","split","forEach","letter","keys","err","shouldUseNative","target","source","from","symbols","to","val","TypeError","toObject","s","arguments","length","key","call","l","require","Symbol","iterator","C","a","b","c","encodeURIComponent","D","isMounted","enqueueForceUpdate","enqueueReplaceState","enqueueSetState","E","F","this","props","context","refs","updater","G","H","isReactComponent","setState","Error","forceUpdate","I","constructor","isPureReactComponent","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","getter","__esModule","d","definition","o","defineProperty","enumerable","get","obj","prop","r","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","AddStoreCommodityDetail","_Modal","_this","_len","args","Array","_key","apply","concat","params","status","code","Stream","title","desc","price","stock","discount","limit","limitUnit","type","outtime","icon","hide","initAttrs","attrs","_proto","oninit","vnode","className","content","_this2","m","style","class","app","trans","Switch","state","onchange","required","bidi","step","min","Select","options","id","Button","onclick","loading","addCommodity","then","res","redraw","method","url","attribute","body","Modal","AddStoreCommodity","commodityList","moreResults","loadResults","item","index","attributes","name","show","hasMoreResults","disabled","loadMore","parseResults","results","payload","links","next","push","data","offset","find","filter","page","StoreListItem","_Component","storeData","view","discountLimit","discountLimitUnit","createdAt","src","Component","StoreListPage","_ExtensionPage","storeList","buildSettingComponent","setting","label","placeholder","help","submitButton","buttonClassName","e","component","filters","ExtensionPage","add","registerPage","registerPermission","permission","allowGuest"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/admin/components/AddStoreCommodity.tsx b/js/src/admin/components/AddStoreCommodity.tsx index 65fb8c7..6f52f26 100644 --- a/js/src/admin/components/AddStoreCommodity.tsx +++ b/js/src/admin/components/AddStoreCommodity.tsx @@ -5,21 +5,13 @@ import React from "react"; import AddStoreCommodityDetail from "./AddStoreCommodityDetail"; export default class AddStoreCommodity extends Modal { - private _list: any[] - get list(): any[] { - return this._list; - } - - set list(value: any[]) { - this._list = value; - } + private commodityList: any = [] + private moreResults: boolean = false oninit(vnode) { super.oninit(vnode); - this.request().then(res => { - this.list = res.data || [] - }) + this.loadResults() } title() { @@ -31,41 +23,83 @@ export default class AddStoreCommodity extends Modal { } content() { - if (!this.list || this.list.length == 0) { - return ( -
- 暂无可用商品 -
- ) - } return (
- {this.list.map((item: object, index: number) => ( -
-
-
- {item.attributes.name} - + {this.commodityList.map((item: object, index: number) => ( +
+
+
+
+ {item.attributes.name} + +
))} + + {!this.loading && this.commodityList.length === 0 && ( +
+
{app.translator.trans("mattoid-store.lib.list-empty")}
+
+ )} + + {!this.loading && this.hasMoreResults() && ( +
+ +
+ )} +
) } - request() { - return app.request<{ userMatchCount: number }>({ - method: 'GET', - url: app.forum.attribute('apiUrl') + '/store/commodity', - }); + + hasMoreResults() { + return this.moreResults; + } + + loadMore() { + this.loading = true; + this.loadResults(this.commodityList.length); + } + + parseResults(results) { + this.moreResults = !!results.payload.links && !!results.payload.links.next; + [].push.apply(this.commodityList, results.payload.data); + this.loading = false; + m.redraw(); + + return results; + } + + loadResults(offset = 0) { + const filters = { + }; + + return app.store + .find("/store/commodity", { + filter:filters, + page: { + offset, + }, + }) + .catch(() => {}) + .then(this.parseResults.bind(this)); } } diff --git a/js/src/admin/components/AddStoreCommodityDetail.tsx b/js/src/admin/components/AddStoreCommodityDetail.tsx index d661bcc..4f70090 100644 --- a/js/src/admin/components/AddStoreCommodityDetail.tsx +++ b/js/src/admin/components/AddStoreCommodityDetail.tsx @@ -66,9 +66,9 @@ export default class AddStoreCommodityDetail extends Modal
- {app.translator.trans("mattoid-store.admin.settings.commodity-code")} + {app.translator.trans("mattoid-store.admin.settings.commodity-code")} {this.attrs.code} + style="font-weight: normal; cursor: pointer; border-bottom: 2px dotted; margin-left: 15px;"> {this.attrs.code}
{app.translator.trans("mattoid-store.admin.settings.commodity-discount-limit-unit")}
{Select.component({ - options: {'day': '天', 'hour': '小时', 'minute': '分钟', 'second': '秒'}, + options: { + 'day': app.translator.trans("mattoid-store.lib.item-limit-unit-day"), + 'hour': app.translator.trans("mattoid-store.lib.item-limit-unit-hour"), + 'minute': app.translator.trans("mattoid-store.lib.item-limit-unit-minute"), + 'second': app.translator.trans("mattoid-store.lib.item-limit-unit-second") + }, value: this.params.limitUnit, onchange: (val) => { this.params.limitUnit = val @@ -120,7 +125,10 @@ export default class AddStoreCommodityDetail extends Modal
{app.translator.trans("mattoid-store.admin.settings.commodity-type")}
{Select.component({ - options: {'permanent': '永久有效', 'limit': '限时有效'}, + options: { + 'permanent': app.translator.trans("mattoid-store.lib.item-type-permanent"), + 'limit': app.translator.trans("mattoid-store.lib.item-type-limit") + }, value: this.params.type, onchange: (val) => { this.params.type = val diff --git a/js/src/admin/components/StoreListItem.tsx b/js/src/admin/components/StoreListItem.tsx new file mode 100644 index 0000000..96311ae --- /dev/null +++ b/js/src/admin/components/StoreListItem.tsx @@ -0,0 +1,46 @@ +import app from 'flarum/admin/app'; +import Component from "flarum/Component"; + +export default class StoreListItem extends Component { + private storeData: object = {} + + oninit(vnode) { + super.oninit(vnode); + + this.storeData = this.attrs.item.attributes + this.storeData.id = this.attrs.item.id + } + + view() { + return ( +
+
+
+ {app.translator.trans('mattoid-store.lib.item-id')}: {this.storeData.id} |   + {app.translator.trans('mattoid-store.lib.item-title')}: {this.storeData.title} +
+
+ {app.translator.trans('mattoid-store.lib.item-desc')}: {this.storeData.desc} +
+
+ {app.translator.trans('mattoid-store.lib.item-status')}: { app.translator.trans('mattoid-store.lib.item-status-' + this.storeData.status) } |  + {app.translator.trans('mattoid-store.lib.item-price')}: {this.storeData.price} |  + {app.translator.trans('mattoid-store.lib.item-stock')}: {this.storeData.stock} |  + {app.translator.trans('mattoid-store.lib.item-discount')}: {this.storeData.discount || '无'} |  + {app.translator.trans('mattoid-store.lib.item-discount_limit')}: {this.storeData.discountLimit || 0} {this.storeData.discountLimitUnit} +
+
+ {app.translator.trans('mattoid-store.lib.item-type')}: {app.translator.trans('mattoid-store.lib.item-type-' + this.storeData.type)} |  + {app.translator.trans('mattoid-store.lib.item-created-at')}: {this.storeData.createdAt} +
+
+
+ +
+
+ ) + } + + + +} diff --git a/js/src/admin/components/StoreListPage.tsx b/js/src/admin/components/StoreListPage.tsx index b5e2d45..5a5cbc3 100644 --- a/js/src/admin/components/StoreListPage.tsx +++ b/js/src/admin/components/StoreListPage.tsx @@ -1,12 +1,24 @@ import app from 'flarum/admin/app'; import ExtensionPage from 'flarum/admin/components/ExtensionPage'; import Button from 'flarum/common/components/Button'; -import type Mithril from 'mithril'; +import Mithril from 'mithril'; import AddStoreCommodity from "./AddStoreCommodity"; +import Select from "flarum/common/components/Select"; +import Stream from 'flarum/common/utils/Stream'; +import StoreListItem from "./StoreListItem"; export default class StoreListPage extends ExtensionPage { + + private storeList: any = [] + private moreResults: boolean = false + oninit(vnode: Mithril.Vnode) { super.oninit(vnode); + + this.status = Stream('-1'); + this.type = Stream('-1'); + + this.loadResults(); } content() { @@ -24,10 +36,10 @@ export default class StoreListPage extends ExtensionPage { })} {this.buildSettingComponent({ type: 'string', - setting: 'mattoid-store.decorationStoreTimezone', - label: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone'), + setting: 'mattoid-store.storeTimezone', + label: app.translator.trans('mattoid-store.admin.settings.store-timezone'), placeholder: 'Asia/Shanghai', - help: app.translator.trans('mattoid-store.admin.settings.decorationStoreTimezone-requirement'), + help: app.translator.trans('mattoid-store.admin.settings.store-timezone-requirement'), })} {this.submitButton()} @@ -41,8 +53,109 @@ export default class StoreListPage extends ExtensionPage { }, app.translator.trans('mattoid-store.admin.settings.add-store-commodity'))); })}
+
+
+
+ { + this.type(e) + this.storeList = [] + this.loadResults() + }} + /> +
+
+
    + { + this.storeList.map((item) => { + return ( +
  • + {StoreListItem.component({ item })} +
  • + ); + }) + } +
+ + {!this.loading && this.storeList.length === 0 && ( +
+
+ {app.translator.trans('mattoid-store.lib.list-empty')} +
+
+ )} + + {!this.loading && this.hasMoreResults() && ( +
+ +
+ )} + +
) } + + hasMoreResults() { + return this.moreResults; + } + + loadMore() { + this.loading = true; + this.loadResults(this.storeList.length); + } + + parseResults(results) { + this.moreResults = !!results.payload.links && !!results.payload.links.next; + [].push.apply(this.storeList, results.payload.data); + this.loading = false; + m.redraw(); + + return results; + } + + loadResults(offset = 0) { + const filters = { + type: this.type(), + status: this.status() + }; + + return app.store + .find("/store/list", { + filter:filters, + page: { + offset, + }, + }) + .catch(() => {}) + .then(this.parseResults.bind(this)); + } } diff --git a/js/src/admin/index.tsx b/js/src/admin/index.tsx index 253fe9e..650eff0 100644 --- a/js/src/admin/index.tsx +++ b/js/src/admin/index.tsx @@ -1,5 +1,6 @@ import app from 'flarum/admin/app'; import StoreListPage from './components/StoreListPage'; +import StorePage from "./components/StorePage"; app.initializers.add('mattoid-store', () => { app.extensionData.for("mattoid-store") diff --git a/less/admin.less b/less/admin.less index 6527738..c9154bc 100644 --- a/less/admin.less +++ b/less/admin.less @@ -16,3 +16,36 @@ .center { text-align: center; } + +.storeItemContainer { + border: 1px dotted var(--control-color); + padding: 10px; + border-radius: var(--border-radius); + overflow: hidden; +} + +.rightAligned { + float: right; +} + +.leftAligned { + float: left; +} + +.inlineBlock { + display: inline-block +} + + +.icon-size { + width: 80px; + height: 80px; +} + +.red { + color: #FF0000 +} + +.green { + color: #00FF00 +} diff --git a/locale/en.yml b/locale/en.yml index cb5ef53..e428281 100644 --- a/locale/en.yml +++ b/locale/en.yml @@ -29,3 +29,27 @@ mattoid-store: forum: tital: Store + + lib: + item-status-all: All product statuses + item-status-up: Listing + item-status-down: Delisting + item-type-all: All purchase types + item-type-permanent: Permanent validity + item-type-limit: Time limited validity + + item-id: ID + item-desc: Product Description + item-title: Product Title + item-status: Product Status + item-status-0: 下架 + item-status-1: 上架 + item-price: Price + item-stock: Stock + item-discount: discount + item-discount_limit: Discount period + item-type: Purchase type + item-created-at: Add time + + list-empty: This place is completely empty + list-load-more: more diff --git a/locale/zh-Hans.yml b/locale/zh-Hans.yml index 6aaafe6..3f1f727 100644 --- a/locale/zh-Hans.yml +++ b/locale/zh-Hans.yml @@ -1,12 +1,10 @@ mattoid-store: - # For more details on the format - # Checkout https://docs.flarum.org/extend/i18n/#appendix-a-standard-key-format admin: settings: store-name: 商店名称 store-name-requirement: 商店名称会显示在首页菜单与标题栏 - decorationStoreTimezone: 时区设置 - decorationStoreTimezone-requirement: 设置时区。默认为 "Asia/Shanghai" + store-timezone: 时区设置 + store-timezone-requirement: 设置时区。默认为 "Asia/Shanghai" group-view: 允许用户组访问商店 add-store-commodity: 添加商品 commodity-status: 商品状态 @@ -29,3 +27,31 @@ mattoid-store: forum: tital: 商店 + + lib: + item-status-all: 全部商品状态 + item-status-up: 上架 + item-status-down: 下架 + item-type-all: 全部购买类型 + item-type-permanent: 永久有效 + item-type-limit: 限时有效 + item-limit-unit-day: 天 + item-limit-unit-hour: 小时 + item-limit-unit-minute: 分钟 + item-limit-unit-second: 秒 + + item-id: ID + item-desc: 商品描述 + item-title: 商品名称 + item-status: 商品状态 + item-status-0: 下架 + item-status-1: 上架 + item-price: 价格 + item-stock: 库存 + item-discount: 折扣 + item-discount_limit: 折扣期限 + item-type: 购买类型 + item-created-at: 添加时间 + + list-empty: 这里空空如也 + list-load-more: 更多 diff --git a/migrations/2024_06_25_000001_create_store_table.php b/migrations/2024_06_25_000001_create_store_table.php index e644fc5..420f7ff 100644 --- a/migrations/2024_06_25_000001_create_store_table.php +++ b/migrations/2024_06_25_000001_create_store_table.php @@ -14,9 +14,10 @@ function (Blueprint $table) { $table->decimal('price', 10 ,2)->comment("商品价格"); $table->integer('stock')->comment("库存数量"); $table->integer('discount')->comment("折扣(%)"); - $table->integer('discount_limit')->comment("折扣(%)"); - $table->integer('discount_limit_unit')->comment("折扣(%)"); - $table->integer('type')->comment("购买类型"); + $table->integer('discount_limit')->comment("折扣期限"); + $table->string('discount_limit_unit')->comment("折扣期限单位"); + $table->string('type')->comment("购买类型"); + $table->integer('status')->default(1)->comment("商品状态 0-下架 1-上架"); $table->integer('outtime')->comment("商品有效期"); $table->string('icon')->comment("商品图标"); $table->integer('hide')->comment("无权限时隐藏商品"); diff --git a/src/Controller/ListStoreController.php b/src/Controller/ListStoreController.php index bed5b57..d4b6c98 100644 --- a/src/Controller/ListStoreController.php +++ b/src/Controller/ListStoreController.php @@ -7,6 +7,7 @@ use Flarum\Http\UrlGenerator; use Flarum\Locale\Translator; use Flarum\User\UserRepository; +use Illuminate\Support\Arr; use Mattoid\Store\Model\StoreModel; use Mattoid\Store\Serializer\StoreSerializer; use Psr\Http\Message\ServerRequestInterface; @@ -27,12 +28,23 @@ public function __construct(UserRepository $repository, UrlGenerator $url, Trans } protected function data(ServerRequestInterface $request, Document $document) { + $filter = []; $actor = RequestUtil::getActor($request); $params = $request->getQueryParams(); $limit = $this->extractLimit($request); $offset = $this->extractOffset($request); + $type = Arr::get($params, 'filter.type'); + $status = Arr::get($params, 'filter.status'); + + if ($type != '-1') { + $filter['type'] = $type; + } + if ($status != '-1') { + $filter['status'] = $status; + } $list = StoreModel::query() + ->where($filter) ->skip($offset) ->take($limit + 1) ->get(); diff --git a/src/Controller/PostStoreController.php b/src/Controller/PostStoreController.php index ead74a5..3e0531f 100644 --- a/src/Controller/PostStoreController.php +++ b/src/Controller/PostStoreController.php @@ -2,6 +2,7 @@ namespace Mattoid\Store\Controller; +use Carbon\Carbon; use Flarum\Api\Controller\AbstractListController; use Flarum\Http\RequestUtil; use Flarum\Http\UrlGenerator; @@ -44,14 +45,17 @@ protected function data(ServerRequestInterface $request, Document $document) { 'pop_up' => $commodity->pop_up, 'price' => $parseBody['price'], 'stock' => $parseBody['stock'], - 'discount' => $parseBody['discount'], - 'discount_limit' => $parseBody['limit'], - 'discount_limit_unit' => $parseBody['limitUnit'], + 'status' => $parseBody['status'], + 'discount' => $parseBody['discount'] || 0, + 'discount_limit' => $parseBody['limit'] || 0, + 'discount_limit_unit' => $parseBody['limitUnit'] || 'day', 'type' => $parseBody['type'], - 'outtime' => $parseBody['outtime'], - 'icon' => $parseBody['icon'], + 'outtime' => $parseBody['outtime'] || 0, + 'icon' => $parseBody['icon'] || '', 'hide' => $parseBody['hide'], - 'desc' => $parseBody['desc'], + 'desc' => $parseBody['desc'] ? $parseBody['desc'] : '', + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now() ]); return $result; diff --git a/src/Enum/LimitUnitEnum.php b/src/Enum/LimitUnitEnum.php new file mode 100644 index 0000000..e438da8 --- /dev/null +++ b/src/Enum/LimitUnitEnum.php @@ -0,0 +1,8 @@ + '天', 'hour' => '小时', 'minute' => '分钟', 'second' => '秒']; +} diff --git a/src/Extend/StoreExtend.php b/src/Extend/StoreExtend.php index 1e7e3c7..89e3917 100644 --- a/src/Extend/StoreExtend.php +++ b/src/Extend/StoreExtend.php @@ -56,7 +56,7 @@ public function onDisable(Container $container, Extension $extension) { $commodity = $this->getStoreGoods($extension->name); // 插件关闭自动删除已上架商品 - StoreModel::query()->where('code', $commodity->code)->delete(); + StoreModel::query()->where('code', $commodity->code)->update(['status' => 0]); // 插件关闭自动移除可上架商品 StoreCommodityModel::query()->where('code', $commodity->code)->delete(); } diff --git a/src/Serializer/StoreSerializer.php b/src/Serializer/StoreSerializer.php index c3cec3e..06477c1 100644 --- a/src/Serializer/StoreSerializer.php +++ b/src/Serializer/StoreSerializer.php @@ -4,6 +4,8 @@ use Flarum\Api\Serializer\AbstractSerializer; use Flarum\Locale\Translator; +use Illuminate\Cache\RateLimiting\Limit; +use Mattoid\Store\Enum\LimitUnitEnum; class StoreSerializer extends AbstractSerializer { @@ -17,9 +19,22 @@ protected function getDefaultAttributes($data) { return [ 'id' => $data->id, 'code' => $data->code, - 'name' => $this->translator->trans($data->name), + 'title' => $data->title, 'uri' => $data->uri, - 'createTime' => $data->create_time, + 'price' => $data->price, + 'stock' => $data->stock, + 'discount' => $data->discount, + 'discountLimit' => $data->discount_limit, + 'discountLimitUnit' => LimitUnitEnum::$LIMIT_UNIT[$data->discount_limit_unit], + 'type' => $data->type, + 'outtime' => $data->outtime, + 'icon' => $data->icon, + 'hide' => $data->hide, + 'desc' => $data->desc, + 'popUp' => $data->pop_up, + 'status' => $data->status, + 'createdAt' => $data->created_at, + 'updatedAt' => $data->updated_at, ]; } }