2023-05-15 14:13:36 +08:00

1 line
6.0 KiB
JavaScript

"use strict";require("../sub-common/ba01bce307afcc9a88c0b242d7eb7cf5.js");require("../sub-common/004f11aaa141116253254b2d9892879c.js");require("../sub-common/b15a59e62f0de52477cd87cdc0559eda.js");(wx.webpackJsonp=wx.webpackJsonp||[]).push([[2069],{8508:function(e,n,t){var a=t(2180),c=t(4165),o=t(5861),s=t(1413),r=t(9439),i=t(1515),l=t(2954),u=t.n(l),d=t(7294),_={common_safe_area_y:"index-module__common_safe_area_y___hxWIp",hoverClass:"index-module__hoverClass___iM3nR","full-100":"index-module__full-100___OjNJk",collection_con:"index-module__collection_con___wsYUJ",collectionContent:"index-module__collectionContent___AeanE",title_item:"index-module__title_item___nTQPy",title:"index-module__title___j8h8w",select:"index-module__select___e2adx",input:"index-module__input___nmfFh",desc_item:"index-module__desc_item___kehIe",desc:"index-module__desc___USs1H",toTopBar:"index-module__toTopBar___voykj",toTopTitle:"index-module__toTopTitle___GjhHi",toTopTips:"index-module__toTopTips___DU5vL",bottomBar:"index-module__bottomBar___kqWGG"},m=t(9021),p=t(7082),x=t(1115),h=t(9179),f=t(519),v=t(4123),Z=t(9498),j=t(5893),k=function CollectionDetail(){var e=(0,l.useRouter)(),n=(0,d.useState)(!1),t=(0,r.Z)(n,2),a=t[0],k=t[1],g=(0,d.useState)({name:"",remark:""}),T=(0,r.Z)(g,2),y=T[0],w=T[1],N=(0,d.useRef)(void 0),S=(0,d.useState)(!1),b=(0,r.Z)(S,2),G=b[0],C=b[1];(0,d.useLayoutEffect)((function(){console.log("isEdit",e.params.isEdit),u().setNavigationBarTitle({title:e.params.title});var n,t,a,c=JSON.parse(e.params.isEdit);c?(console.log(e.params.editData),N.current=JSON.parse(e.params.editData),console.log("currentData",N.current),w({name:null===(n=N.current)||void 0===n?void 0:n.name,remark:null===(t=N.current)||void 0===t?void 0:t.remark}),C(null===(a=N.current)||void 0===a?void 0:a.is_top)):N.current=void 0;k(c)}),[e.params]);var B=(0,p.q0)().fetchData,D=function(){var e=(0,o.Z)((0,c.Z)().mark((function _callee(){var e;return(0,c.Z)().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:if(y.name){n.next=2;break}return n.abrupt("return",x.Z9.none("请输入收藏夹名称!"));case 2:return n.next=4,B((0,s.Z)((0,s.Z)({},y),{},{id:null===(e=N.current)||void 0===e?void 0:e.id,is_top:G?2:1}));case 4:n.sent.success?(x.Z9.success("编辑成功"),setTimeout((function(){u().navigateBack()}),1e3)):x.Z9.error("编辑失败");case 6:case"end":return n.stop()}}),_callee)})));return function handleEditSave(){return e.apply(this,arguments)}}(),E=(0,p.$R)().fetchData,I=function(){var e=(0,o.Z)((0,c.Z)().mark((function _callee2(){return(0,c.Z)().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:if(y.name){e.next=2;break}return e.abrupt("return",x.Z9.none("请输入收藏夹名称!"));case 2:return e.next=4,E((0,s.Z)((0,s.Z)({},y),{},{is_top:G?1:0}));case 4:e.sent.success?(x.Z9.success("创建成功"),setTimeout((function(){u().navigateBack()}),1e3)):x.Z9.error("创建失败");case 6:case"end":return e.stop()}}),_callee2)})));return function handleAddSave(){return e.apply(this,arguments)}}(),J=(0,p.X)().fetchData;return(0,Z.av)("pages/collection/collectionDetail/index"),(0,j.jsxs)(i.G7,{className:_.collection_con,children:[(0,j.jsxs)(i.G7,{className:_.collectionContent,children:[(0,j.jsxs)(f.Z,{circle:!0,children:[(0,j.jsxs)(i.G7,{className:_.title_item,children:[(0,j.jsxs)(i.G7,{className:_.title,children:["收藏夹名称",(0,j.jsx)(i.xv,{style:{color:"red"},children:"*"})]}),(0,j.jsx)(i.G7,{className:_.select,children:(0,j.jsx)(i.II,{placeholder:"请输入收藏夹名称",className:_.input,alwaysEmbed:!0,cursorSpacing:100,onInput:function changeInput(e){w((function(n){return(0,s.Z)((0,s.Z)({},n),{},{name:e.detail.value})}))},value:null==y?void 0:y.name})})]}),(0,j.jsx)(v.Z,{direction:"horizontal",customStyles:{margin:"24rpx 0"}}),(0,j.jsxs)(i.G7,{className:_.desc_item,children:[(0,j.jsx)(i.G7,{className:_.title,children:"简介信息"}),(0,j.jsx)(i.G7,{className:_.desc,children:(0,j.jsx)(m.Z,{customStyle:{background:"#fff",border:"none",padding:"0 20rpx",fontSize:"28rpx"},defaultValue:null==y?void 0:y.remark,onChange:function getOtherReason(e){w((function(n){return(0,s.Z)((0,s.Z)({},n),{},{remark:e})}))},placeholder:"请输入简介"})})]})]}),(0,j.jsx)(f.Z,{circle:!0,children:(0,j.jsxs)(i.G7,{className:_.toTopBar,children:[(0,j.jsxs)(i.G7,{children:[(0,j.jsx)(i.G7,{className:_.toTopTitle,children:"收藏夹置顶"}),(0,j.jsx)(i.G7,{className:_.toTopTips,children:"提醒:会优先展示该收藏夹"})]}),(0,j.jsx)(i.rs,{className:_.switch,checked:G,color:"#337fff",onChange:function handleChange(e){C(e.detail.value)}})]})})]}),a?(0,j.jsxs)(i.G7,{className:_.bottomBar,children:[(0,j.jsx)(h.Z,{plain:!0,type:"danger",customStyles:{width:"45%"},round:!0,onClick:function handleDelete(){u().showModal({content:"确认删除当前收藏夹?",cancelText:"取消",confirmText:"确认删除",confirmColor:"#E42945",success:function success(e){return(0,o.Z)((0,c.Z)().mark((function _callee3(){var n;return(0,c.Z)().wrap((function _callee3$(t){for(;;)switch(t.prev=t.next){case 0:if(!e.confirm){t.next=7;break}return t.next=3,J({id:null===(n=N.current)||void 0===n?void 0:n.id});case 3:t.sent.success?(x.Z9.success("删除成功"),setTimeout((function(){u().navigateBack()}),1e3)):x.Z9.error("删除失败"),t.next=8;break;case 7:e.cancel&&console.log("用户点击取消");case 8:case"end":return t.stop()}}),_callee3)})))()}})},children:"删除"}),(0,j.jsx)(h.Z,{type:"primary",round:!0,customStyles:{width:"45%"},onClick:D,children:"保存"})]}):(0,j.jsxs)(i.G7,{className:_.bottomBar,children:[(0,j.jsx)(h.Z,{plain:!0,type:"primary",customStyles:{width:"45%"},round:!0,onClick:function handleCancel(){u().navigateBack()},children:"取消"}),(0,j.jsx)(h.Z,{type:"primary",round:!0,customStyles:{width:"45%"},onClick:I,children:"保存"})]})]})};k.enableShareAppMessage=!0;Page((0,a.createPageConfig)(k,"pages/collection/collectionDetail/index",{root:{cn:[]}},{navigationBarTitleText:"收藏详情",enableShareAppMessage:!0}||{}))}},function(e){e.O(0,[9760,9498,7563,6391,2107,1216,8592],(function(){return n=8508,e(e.s=n);var n}));e.O()}]);