1 line
7.2 KiB
JavaScript
1 line
7.2 KiB
JavaScript
"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[333],{1766:function(e,s,n){var r=n(8774),l=n(9439),a=n(7294),t=n(1515),i=n(2954),o=n.n(i),c={settingsPage:"index-module__settingsPage___e4OOt",profileCard:"index-module__profileCard___x2Mm4",avatar:"index-module__avatar___jGUXh",profileInfo:"index-module__profileInfo___A9OaO",profileName:"index-module__profileName___XeXIk",profileRole:"index-module__profileRole___FNiNg",profileEmail:"index-module__profileEmail___E_pGP",section:"index-module__section___UVl60",sectionTitle:"index-module__sectionTitle___G2Llq",menuList:"index-module__menuList___wybvQ",menuItem:"index-module__menuItem___xgY58",menuIcon:"index-module__menuIcon___LmrOJ",menuLabel:"index-module__menuLabel___qkCUi",menuArrow:"index-module__menuArrow___aRAjw",menuValue:"index-module__menuValue___RCdHF",serverCard:"index-module__serverCard___CmshN",serverLabel:"index-module__serverLabel___KBMXv",serverInput:"index-module__serverInput___RUyi0",serverHint:"index-module__serverHint___RnmI1",serverBtns:"index-module__serverBtns___imFVc",serverBtn:"index-module__serverBtn___W_8E0",serverBtnPrimary:"index-module__serverBtnPrimary___qzWhV",serverBtnDefault:"index-module__serverBtnDefault___umenV",serverBtnText:"index-module__serverBtnText___nSsZJ",serverBtnTextDefault:"index-module__serverBtnTextDefault___CNbNE",logoutBtn:"index-module__logoutBtn___WTmK5",logoutText:"index-module__logoutText___lDhj5",versionText:"index-module__versionText___VCg6v"},_=n(3851),m=n(5616),u=n(8106),d=n(5893),x=function(){var e=(0,_.o)(),s=e.user,n=e.logout,r=(0,a.useState)((0,u.RU)()),i=(0,l.Z)(r,2),x=i[0],v=i[1],h=function(){var e=x.trim();if(e){var s=e.endsWith("/api/v1")?e:"".concat(e.replace(/\/$/,""),"/api/v1");(0,u.tY)(s),o().showToast({title:"\u5df2\u4fdd\u5b58\uff0c\u91cd\u542f\u5c0f\u7a0b\u5e8f\u540e\u751f\u6548",icon:"none"})}else o().showToast({title:"\u8bf7\u8f93\u5165\u670d\u52a1\u5668\u5730\u5740",icon:"none"})},f=function(){(0,u.tY)(""),v((0,u.RU)()),o().showToast({title:"\u5df2\u6062\u590d\u9ed8\u8ba4\u5730\u5740",icon:"success"})},N=function(){o().showModal({title:"\u786e\u8ba4\u9000\u51fa",content:"\u786e\u5b9a\u8981\u9000\u51fa\u767b\u5f55\u5417\uff1f",confirmColor:"#f53f3f",success:function(e){e.confirm&&(n(),console.log("[Settings] \u7528\u6237\u5df2\u9000\u51fa\u767b\u5f55"))}})},j=function(e){switch(e){case"thresholds":o().navigateTo({url:"/pages/thresholds/index"});break;case"about":o().showModal({title:"\u5173\u4e8e",content:"\u8695\u623f\u73af\u5883\u76d1\u63a7\u7cfb\u7edf v1.0.0\n\u667a\u80fd\u8695\u4e1a\u73af\u5883\u76d1\u6d4b\u7ba1\u7406\u5e73\u53f0",showCancel:!1,confirmText:"\u77e5\u9053\u4e86"});break;case"clearCache":o().showModal({title:"\u6e05\u9664\u7f13\u5b58",content:"\u786e\u5b9a\u8981\u6e05\u9664\u672c\u5730\u7f13\u5b58\u5417\uff1f",success:function(e){if(e.confirm){var s=o().getStorageSync("token"),n=o().getStorageSync("refreshToken"),r=o().getStorageSync("user"),l=o().getStorageSync("apiBaseUrl");o().clearStorageSync(),s&&o().setStorageSync("token",s),n&&o().setStorageSync("refreshToken",n),r&&o().setStorageSync("user",r),l&&o().setStorageSync("apiBaseUrl",l),o().showToast({title:"\u7f13\u5b58\u5df2\u6e05\u9664",icon:"success"})}}});break;case"wsStatus":var s=m.X.isConnected();o().showToast({title:s?"WebSocket \u5df2\u8fde\u63a5":"WebSocket \u672a\u8fde\u63a5",icon:"none"});break;default:break}},g=function(e){var s={admin:"\u7ba1\u7406\u5458",operator:"\u64cd\u4f5c\u5458",viewer:"\u67e5\u770b\u8005",user:"\u7528\u6237"};return s[e]||e};return(0,d.jsxs)(t.G7,{className:c.settingsPage,children:[(0,d.jsxs)(t.G7,{className:c.profileCard,children:[(0,d.jsx)(t.G7,{className:c.avatar,children:(0,d.jsx)(t.xv,{children:"\ud83d\udc64"})}),(0,d.jsxs)(t.G7,{className:c.profileInfo,children:[(0,d.jsx)(t.xv,{className:c.profileName,children:(null===s||void 0===s?void 0:s.fullName)||(null===s||void 0===s?void 0:s.username)||"\u7ba1\u7406\u5458"}),(0,d.jsx)(t.xv,{className:c.profileRole,children:g((null===s||void 0===s?void 0:s.role)||"user")}),(null===s||void 0===s?void 0:s.email)&&(0,d.jsx)(t.xv,{className:c.profileEmail,children:s.email})]})]}),(0,d.jsxs)(t.G7,{className:c.section,children:[(0,d.jsx)(t.xv,{className:c.sectionTitle,children:"\u670d\u52a1\u5668\u914d\u7f6e"}),(0,d.jsxs)(t.G7,{className:c.serverCard,children:[(0,d.jsx)(t.xv,{className:c.serverLabel,children:"API \u5730\u5740"}),(0,d.jsx)(t.II,{className:c.serverInput,type:"text",placeholder:"\u4f8b\u5982\uff1ahttp://192.168.1.100:3000",value:x,onInput:function(e){return v(e.detail.value)},maxlength:200}),(0,d.jsx)(t.xv,{className:c.serverHint,children:"\u8f93\u5165\u670d\u52a1\u5668\u5730\u5740\uff08\u4e0d\u542b /api/v1\uff09\uff0c\u4fdd\u5b58\u540e\u91cd\u542f\u5c0f\u7a0b\u5e8f\u751f\u6548\u3002"}),(0,d.jsxs)(t.G7,{className:c.serverBtns,children:[(0,d.jsx)(t.zx,{className:"".concat(c.serverBtn," ").concat(c.serverBtnPrimary),onClick:h,children:(0,d.jsx)(t.xv,{className:c.serverBtnText,children:"\u4fdd\u5b58"})}),(0,d.jsx)(t.zx,{className:"".concat(c.serverBtn," ").concat(c.serverBtnDefault),onClick:f,children:(0,d.jsx)(t.xv,{className:c.serverBtnTextDefault,children:"\u6062\u590d\u9ed8\u8ba4"})})]})]})]}),(0,d.jsxs)(t.G7,{className:c.section,children:[(0,d.jsx)(t.xv,{className:c.sectionTitle,children:"\u76d1\u63a7\u7ba1\u7406"}),(0,d.jsxs)(t.G7,{className:c.menuList,children:[(0,d.jsxs)(t.G7,{className:c.menuItem,onClick:function(){return j("thresholds")},children:[(0,d.jsx)(t.xv,{className:c.menuIcon,children:"\u2699\ufe0f"}),(0,d.jsx)(t.xv,{className:c.menuLabel,children:"\u9608\u503c\u7ba1\u7406"}),(0,d.jsx)(t.xv,{className:c.menuArrow,children:"\u203a"})]}),(0,d.jsxs)(t.G7,{className:c.menuItem,onClick:function(){return j("wsStatus")},children:[(0,d.jsx)(t.xv,{className:c.menuIcon,children:"\ud83d\udd17"}),(0,d.jsx)(t.xv,{className:c.menuLabel,children:"\u8fde\u63a5\u72b6\u6001"}),(0,d.jsx)(t.xv,{className:c.menuValue,children:"\u67e5\u770b"}),(0,d.jsx)(t.xv,{className:c.menuArrow,children:"\u203a"})]})]})]}),(0,d.jsxs)(t.G7,{className:c.section,children:[(0,d.jsx)(t.xv,{className:c.sectionTitle,children:"\u7cfb\u7edf"}),(0,d.jsxs)(t.G7,{className:c.menuList,children:[(0,d.jsxs)(t.G7,{className:c.menuItem,onClick:function(){return j("clearCache")},children:[(0,d.jsx)(t.xv,{className:c.menuIcon,children:"\ud83d\uddd1\ufe0f"}),(0,d.jsx)(t.xv,{className:c.menuLabel,children:"\u6e05\u9664\u7f13\u5b58"}),(0,d.jsx)(t.xv,{className:c.menuArrow,children:"\u203a"})]}),(0,d.jsxs)(t.G7,{className:c.menuItem,onClick:function(){return j("about")},children:[(0,d.jsx)(t.xv,{className:c.menuIcon,children:"\u2139\ufe0f"}),(0,d.jsx)(t.xv,{className:c.menuLabel,children:"\u5173\u4e8e\u7cfb\u7edf"}),(0,d.jsx)(t.xv,{className:c.menuValue,children:"v1.0.0"}),(0,d.jsx)(t.xv,{className:c.menuArrow,children:"\u203a"})]})]})]}),(0,d.jsx)(t.G7,{className:c.logoutBtn,onClick:N,children:(0,d.jsx)(t.xv,{className:c.logoutText,children:"\u9000\u51fa\u767b\u5f55"})}),(0,d.jsx)(t.xv,{className:c.versionText,children:"\u8695\u623f\u73af\u5883\u76d1\u63a7\u7cfb\u7edf v1.0.0"})]})},v=x,h={navigationBarTitleText:"\u8bbe\u7f6e"},f=(0,r.R4)(v,"pages/settings/index",{root:{cn:[]}},h||{});v&&v.behaviors&&(f.behaviors=(f.behaviors||[]).concat(v.behaviors));Page(f)}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[107,216,592],function(){return s(1766)});e.O()}]); |