From eff12ed88fd7a34949c9a8e83fc61f240663ee35 Mon Sep 17 00:00:00 2001 From: eric Date: Sun, 27 Nov 2022 10:03:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BE=85=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/pages/my/index.js | 2 +- dist/pages/my/index.js.LICENSE.txt | 10 ++ dist/pages/my/index.wxss | 9 ++ src/pages/my/index.module.scss | 7 ++ src/pages/my/index.tsx | 177 +++++++++++++++-------------- 5 files changed, 119 insertions(+), 86 deletions(-) diff --git a/dist/pages/my/index.js b/dist/pages/my/index.js index 616ee81..cc2f678 100644 --- a/dist/pages/my/index.js +++ b/dist/pages/my/index.js @@ -1,2 +1,2 @@ /*! For license information please see index.js.LICENSE.txt */ -"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["pages/my/index"],{"./node_modules/@antmjs/vantui/es/mixins/page-scroll.js":function(e,t,n){n.d(t,{usePageScroll:function(){return usePageScroll}});var o=n("webpack/container/remote/react"),r=n("webpack/container/remote/@tarojs/taro");n("webpack/container/remote/@tarojs/runtime"),n("webpack/container/remote/@tarojs/runtime").document;function usePageScroll(e){(0,o.useEffect)((function(){return void 0}),[e]),(0,r.usePageScroll)((function(t){e(t)}))}},"./node_modules/@antmjs/vantui/es/sticky/index.js":function(e,t,n){n.d(t,{Sticky:function(){return Sticky}});var o=n("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),r=n("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),i=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),a=n("webpack/container/remote/react"),s=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),l=n("./node_modules/@antmjs/vantui/es/wxs/utils.js"),c=n("./node_modules/@antmjs/vantui/es/common/utils.js"),u=n("./node_modules/@antmjs/vantui/es/common/validator.js"),d=n("./node_modules/@antmjs/vantui/es/mixins/page-scroll.js"),f=n("./node_modules/@antmjs/vantui/es/sticky/wxs.js"),m=n("webpack/container/remote/react/jsx-runtime"),p=["zIndex","offsetTop","scrollTop","disabled","container","onScroll","style","className","children"];function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function _objectSpread(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:[];return t(e[0])}))}))}),[w]),P=(0,a.useCallback)((function(e){var t=Object.keys(e).reduce((function(t,n){return e[n]!==b[n]&&(t[n]=e[n]),t}),{});Object.keys(t).length>0&&v((function(e){return _objectSpread(_objectSpread({},e),t)})),null==_||_({detail:{scrollTop:C.current.scrollTop,isFixed:e.fixed||b.fixed}})}),[_,b]),I=(0,a.useCallback)((function(e){g?P({fixed:!1,transform:0}):(C.current.scrollTop=e||C.current.scrollTop,"function"!=typeof w?(0,c.getRect)(null,"#sticky-com-index".concat(t.current)).then((function(e){(0,u.isDef)(e)&&(x>=e.top?P({fixed:!0,height:e.height}):P({fixed:!1}))})):Promise.all([(0,c.getRect)(null,"#sticky-com-index".concat(t.current)),N()]).then((function(e){var t=(0,i.default)(e,2),n=t[0],o=t[1];n&&o&&(x+n.height>o.height+o.top?P({fixed:!1,transform:o.height-n.height}):x>=n.top?P({fixed:!0,height:n.height,transform:0}):P({fixed:!1,transform:0}))})).catch((function(e){console.log(e)})))}),[w,g,N,x,P]);return(0,a.useEffect)((function(){I(y)}),[y,w,g,x]),(0,d.usePageScroll)((function(e){I(e.scrollTop)})),(0,m.jsx)(s.View,_objectSpread(_objectSpread({id:"sticky-com-index".concat(t.current),className:" van-sticky "+(S||""),style:l.style([f.containerStyle({fixed:b.fixed,height:b.height,zIndex:j}),k])},O),{},{children:(0,m.jsx)(s.View,{className:l.bem("sticky-wrap",{fixed:b.fixed})+" ".concat(S||""),style:l.style([f.wrapStyle({fixed:b.fixed,offsetTop:x,transform:b.transform,zIndex:j}),k]),children:T})}))}},"./node_modules/@antmjs/vantui/es/sticky/wxs.js":function(e,t,n){n.d(t,{wrapStyle:function(){return wrapStyle},containerStyle:function(){return containerStyle}});var o=n("./node_modules/@antmjs/vantui/es/wxs/style.js");function wrapStyle(e){return(0,o.style)({transform:e.transform?"translate3d(0, "+e.transform+"px, 0)":"",top:e.fixed?e.offsetTop+"px":"","z-index":e.zIndex})}function containerStyle(e){return(0,o.style)({height:e.fixed?e.height+"px":"","z-index":e.zIndex})}},"./node_modules/@antmjs/vantui/es/tab/index.js":function(e,t,n){var o=n("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),r=n("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),i=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),a=n("webpack/container/remote/react"),s=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),l=n("./node_modules/@antmjs/vantui/es/wxs/utils.js"),c=n("webpack/container/remote/react/jsx-runtime"),u=["children","style","className","active","lazyRender","lazyTimeout","animated","title"];function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function _objectSpread(e){for(var t=1;t=ge.length||e<0)&&e!==V){var t=null!==V;P((function(t){return _objectSpread(_objectSpread({},t),{},{currentIndex:e})})),(0,v.requestAnimationFrame)((function(){Te(e),Ce(e)})),(0,c.nextTick)((function(){t&&we("onChange",ge[e])}))}},Se=function setCurrentIndexByName(e){var t=ge.filter((function(t){return(t.props.name||t.props.index)===e}));t.length&&ke(t[0].props.index)},Te=function resize(e){var o;"line"===K&&(e=null!==(o=e)&&void 0!==o?o:V,(0,c.nextTick)((function(){Promise.all([(0,v.getAllRect)(null,".tabs-com-index".concat(n.current," .van-tab")),(0,v.getRect)(null,".tabs-com-index".concat(n.current," .van-tabs__line"))]).then((function(n){var o=(0,i.default)(n,2),r=o[0],a=void 0===r?[]:r,s=o[1];if(a&&s){var l=a[e];if(null==l)return;var u=a.slice(0,e).reduce((function(e,t){return e+t.width}),0);u+=(l.width-s.width)/2+(Q?0:8),P((function(e){return _objectSpread(_objectSpread({},e),{},{lineOffsetLeft:u})})),t.current.swiping=!0,R&&(0,c.nextTick)((function(){P((function(e){return _objectSpread(_objectSpread({},e),{},{skipTransition:!1})}))}))}}))})))},Oe=function onTap(e){var t=e.currentTarget.dataset.index;t=parseInt(t);var n=ge[t];n.props.disabled?we("onDisabled",n):(ke(t),(0,c.nextTick)((function(){we("onClick",n)})))},Ce=function scrollIntoView(e){var t;D&&(e=null!==(t=e)&&void 0!==t?t:V,Promise.all([(0,v.getAllRect)(null,".tabs-com-index".concat(n.current," .van-tab")),(0,v.getRect)(null,".tabs-com-index".concat(n.current," .van-tabs__nav"))]).then((function(t){var n=(0,i.default)(t,2),o=n[0],r=n[1];if(o&&r){var a=o[e],s=o.slice(0,e).reduce((function(e,t){return e+t.width}),0);P((function(e){return _objectSpread(_objectSpread({},e),{},{scrollLeft:s-(r.width-a.width)/2})})),z||(0,c.nextTick)((function(){P((function(e){return _objectSpread(_objectSpread({},e),{},{scrollWithAnimation:!0})}))}))}})))},Ne=function touchStart(e){!function resetTouchStatus(){t.current.direction="",t.current.deltaX=0,t.current.deltaY=0,t.current.offsetX=0,t.current.offsetY=0}();var n=e.touches[0];t.current.startX=n.clientX,t.current.startY=n.clientY},Pe=function onTouchEnd(){if(L&&t.current.swiping){var e=t.current,n=e.direction,o=e.deltaX,r=e.offsetX;if("horizontal"===n&&r>=50){var i=function getAvaiableTab(e){for(var t=e>0?-1:1,n=t;V+n=0;n+=t){var o=V+n;if(o>=0&&ole||!Q})}))}),[le,ge,Q]),(0,u.useEffect)((function(){(0,c.nextTick)((function(){Te()}))}),[ge]);var Ie=(0,u.useCallback)((0,o.default)(l().mark((function _callee(){var e,t,o;return l().wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:if(e=0,!ue||!g){r.next=6;break}return r.next=4,(0,v.getAllRect)(null,"."+m.bem("renderNavLeft"+n.current));case 4:(t=r.sent).length&&(e+=t[0].width);case 6:if(!de||!g){r.next=11;break}return r.next=9,(0,v.getAllRect)(null,"."+m.bem("renderNavRight"+n.current));case 9:(o=r.sent).length&&(e+=o[0].width);case 11:e&&T("calc(100% - ".concat(e,"px)"));case 12:case"end":return r.stop()}}),_callee)}))),[ue,g,de]);return(0,u.useEffect)((function(){setTimeout((function(){Ie()}))}),[Ie,g]),(0,x.jsxs)(f.View,_objectSpread(_objectSpread({className:"tabs-com-index".concat(n.current," ")+" "+m.bem("tabs",[K]+" ".concat(je||"")),style:ve},xe),{},{children:[(0,x.jsx)(b.Sticky,{disabled:!F,zIndex:q,offsetTop:G,container:H,onScroll:fe,children:(0,x.jsxs)(f.View,{className:m.bem("tabs__wrap",{scrollable:D})+" "+("line"===K&&U?"van-hairline--top-bottom":""),children:[(0,x.jsx)(f.View,{className:m.bem("renderNavLeft"+n.current),children:ue}),(0,x.jsx)(f.ScrollView,{scrollX:D,scrollWithAnimation:z,scrollLeft:I,className:m.bem("tabs__scroll",[K]),style:{width:S,borderColor:J},children:(0,x.jsxs)(f.View,{className:m.bem("tabs__nav",[K,{complete:!Q}])+" nav-class",style:h.navStyle(J,K),children:["line"===K&&(0,x.jsx)(f.View,{className:"van-tabs__line",style:h.lineStyle({color:J,lineOffsetLeft:E,lineHeight:ee,skipTransition:R,duration:ne,lineWidth:re})}),ye.map((function(e,t){return(0,x.jsx)(f.View,{"data-index":t,className:h.tabClass(t===V,Q)+" "+m.bem("tab",{active:t===V,disabled:e.disabled,complete:!Q}),style:h.tabStyle({active:t===V,ellipsis:Q,color:J,type:K,disabled:e.disabled,titleActiveColor:ie,titleInactiveColor:ae,swipeThreshold:le,scrollable:D}),onClick:Oe,children:(0,x.jsxs)(f.View,{className:Q?"van-ellipsis":"",style:e.titleStyle,children:[e.title,(null!==e.info||e.dot)&&(0,x.jsx)(j.Info,{info:e.info,dot:e.dot,className:"van-tab__title__info"})]})},t)}))]})}),(0,x.jsx)(f.View,{className:m.bem("renderNavRight"+n.current),children:de})]})}),(0,x.jsx)(f.View,{className:"van-tabs__content",onTouchStart:function onTouchStart(e){L&&(t.current.swiping=!0,Ne(e))},onTouchMove:function onTouchMove(e){L&&t.current.swiping&&function touchMove(e){var n=e.touches[0];t.current.deltaX=n.clientX-t.current.startX,t.current.deltaY=n.clientY-t.current.startY,t.current.offsetX=Math.abs(t.current.deltaX),t.current.offsetY=Math.abs(t.current.deltaY),t.current.direction=t.current.direction||function getDirection(e,t){return e>t&&e>10?"horizontal":t>e&&t>10?"vertical":""}(t.current.offsetX,t.current.offsetY)}(e)},onTouchEnd:Pe,onTouchCancel:Pe,children:(0,x.jsx)(f.View,{className:m.bem("tabs__track",[{animated:ce}])+" van-tabs__track",style:h.trackStyle({duration:ne,currentIndex:V,animated:ce}),children:ge})})]}))}},"./node_modules/@antmjs/vantui/es/tabs/wxs.js":function(e,t,n){n.d(t,{tabClass:function(){return tabClass},tabStyle:function(){return tabStyle},trackStyle:function(){return trackStyle},lineStyle:function(){return lineStyle},navStyle:function(){return navStyle}});var o=n("./node_modules/@antmjs/vantui/es/wxs/style.js"),r=n("./node_modules/@antmjs/vantui/es/wxs/utils.js");function tabClass(e,t){var n=["tab-class"];return e&&n.push("tab-active-class"),t&&n.push("van-ellipsis"),n.join(" ")}function tabStyle(e){var t=e.active?e.titleActiveColor:e.titleInactiveColor,n=e.scrollable&&e.ellipsis;return"card"===e.type?(0,o.style)({"border-color":e.color,"background-color":!e.disabled&&e.active?e.color:null,color:t||(e.disabled||e.active?null:e.color),"flex-basis":n?88/e.swipeThreshold+"%":null}):(0,o.style)({color:t,"flex-basis":n?88/e.swipeThreshold+"%":null})}function navStyle(e,t){return(0,o.style)({"border-color":"card"===t&&e?e:null})}function trackStyle(e){return e.animated?(0,o.style)({transform:"translate3d(".concat(-100*e.currentIndex,"%, 0px, 0px)"),"-webkit-transform":"translate3d(".concat(-100*e.currentIndex,"%, 0px, 0px)"),"transition-duration":e.duration+"s","-webkit-transition-duration":e.duration+"s",transition:e.duration+"s"}):""}function lineStyle(e){return(0,o.style)({visibility:0===e.lineOffsetLeft?"hidden":"visible",width:r.addUnit(e.lineWidth),transform:"translateX("+e.lineOffsetLeft+"px)","-webkit-transform":"translateX("+e.lineOffsetLeft+"px)","background-color":e.color,height:-1!==e.lineHeight?r.addUnit(e.lineHeight):null,"border-radius":-1!==e.lineHeight?r.addUnit(e.lineHeight):null,"transition-duration":e.skipTransition?null:e.duration+"s","-webkit-transition-duration":e.skipTransition?null:e.duration+"s"})}},"./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./src/pages/my/index.tsx":function(e,t,n){var o=n("./node_modules/@antmjs/vantui/es/icon/index.js"),r=n("./node_modules/@antmjs/vantui/es/cell/index.js"),i=n("./node_modules/@antmjs/vantui/es/toast/index.js"),a=n("./node_modules/@antmjs/vantui/es/tabs/index.js"),s=n("./node_modules/@antmjs/vantui/es/tab/index.js"),l=n("./node_modules/@antmjs/vantui/es/button/index.js"),c=n("./node_modules/@antmjs/vantui/es/image/index.js"),u=n("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),d=n("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),f=n("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),m=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),p=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),b=n("webpack/container/remote/react"),v=n("./src/pages/components/TabbarCom/index.tsx"),j=n("webpack/container/remote/@tarojs/taro"),h=n.n(j),x=n("./src/pages/components/ActiveCard/index.tsx"),y=n("./src/utils/index.ts"),g=n("./config.js"),w=n("webpack/container/remote/react/jsx-runtime");t.default=function my(e){var t=(0,b.useState)({}),n=(0,m.default)(t,2),j=(n[0],n[1],(0,b.useState)([])),_=(0,m.default)(j,2),k=_[0],S=(_[1],(0,b.useState)(0)),T=(0,m.default)(S,2),O=T[0],C=T[1],N=(0,b.useState)(!0),P=(0,m.default)(N,2),I=P[0],D=P[1],V=(0,b.useState)([]),R=(0,m.default)(V,2);R[0],R[1];(0,b.useEffect)((function(){z()}),[]);var z=function(){var e=(0,f.default)((0,d.default)().mark((function _callee(){var e;return(0,d.default)().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,y.phoneLogin)();case 2:e=t.sent,console.log("isok",e),D(e);case 5:case"end":return t.stop()}}),_callee)})));return function getok(){return e.apply(this,arguments)}}();(0,b.useEffect)((function(){}),[]);var E=function getPhoneNumber(e){console.log("点击获取手机事件",e.detail.cloudID),function getLogin(e){h().cloud.callFunction({name:"getPhoneNum",data:{weRunData:h().cloud.CloudID(e.detail.cloudID)}}).then((function(e){var t,n,o,r,i,a,s,l,c;console.log("res222",e);var d=null==e||null===(t=e.result)||void 0===t||null===(n=t.event)||void 0===n||null===(o=n.weRunData)||void 0===o||null===(r=o.data)||void 0===r?void 0:r.phoneNumber,f=null==e||null===(i=e.result)||void 0===i||null===(a=i.context)||void 0===a?void 0:a.tencentcloud_uin,m={tableName:"userInfo",keyValue:{openId:null==e||null===(s=e.result)||void 0===s||null===(l=s.event)||void 0===l||null===(c=l.userInfo)||void 0===c?void 0:c.openId},okFun:function okFun(e){var t,n;console.log("q",e),(0,y.updateTableid)({id:null==e||null===(t=e.data)||void 0===t||null===(n=t[0])||void 0===n?void 0:n._id,tableName:"userInfo",objData:{tencentcloud_uin:f,authInfo:{authPhonenum:d}},okFun:function okFun(e){z()}})}};(0,y.getTable)((0,u.default)({},m))}))}(e)};return(0,w.jsxs)(p.View,{className:"myContent",children:[(0,w.jsxs)(p.View,{className:"myImage",children:[(0,w.jsx)(c.default,{round:!0,width:"100px",height:"100px",src:"cloud://citynew-0givkbre03955d8c.6369-citynew-0givkbre03955d8c-1253655588/images/touxiang/images.jpg"}),!I&&(0,w.jsx)(p.View,{className:"loginBtn",children:(0,w.jsx)(l.default,{type:"primary",size:"mini","open-type":"getPhoneNumber",lang:"zh_CN",onGetPhoneNumber:function onGetPhoneNumber(e){console.log("info",e),E(e)},children:"登录"})})]}),(0,w.jsx)(p.View,{children:(0,w.jsxs)(a.default,{sticky:!0,active:O,onClick:function onClick(e){var t,n;console.log("e",e),C(null!==(t=null==e||null===(n=e.detail)||void 0===n?void 0:n.index)&&void 0!==t?t:0)},children:[(0,w.jsx)(s.default,{title:"待审核",children:(0,w.jsx)(p.View,{children:function CardCom(){return(0,w.jsx)(p.View,{children:k.splice(0,2).map((function(e,t){return(0,w.jsx)(p.View,{onClick:function onClick(){console.log("Card"),h().navigateTo({url:"/pages/activityList/components/details/index?id=".concat(null==e?void 0:e._id)})},children:(0,w.jsx)(x.default,{dataSource:e})})}))})}()})}),(0,w.jsx)(s.default,{title:"待参加",children:"333"}),(0,w.jsx)(s.default,{title:"已结束",children:"44"})]})}),(0,w.jsxs)(p.View,{className:"cellArr",children:[(0,w.jsx)(r.default,{icon:"star",title:"打卡记录",isLink:!0,onClick:function onClick(){I?h().navigateTo({url:"/pages/my/components/CheckinDetail/index"}):i.default.fail({message:"请先登录",selector:"#vanToast-demo2"})}}),(0,w.jsx)(r.default,{icon:"coupon",title:"更新收货地址",isLink:!0,onClick:function onClick(){h().chooseAddress({success:function success(e){console.log(e.userName),console.log(e.postalCode),console.log(e.provinceName),console.log(e.cityName),console.log(e.countyName),console.log(e.detailInfo),console.log(e.nationalCode),console.log(e.telNumber)}})}}),(0,w.jsx)(r.default,{icon:"manager",title:"申请成为领队",isLink:!0,onClick:function onClick(){i.default.fail({message:"首次参加活动后,可申请成为领队",selector:"#vanToast-demo2"})}}),(0,w.jsxs)(p.View,{className:"wechat",children:[(0,w.jsx)(o.default,{name:"wechat",size:"16px",className:"icon"}),(0,w.jsx)(l.default,{"open-type":"contact",className:"wecahtBtn",children:"联系我们"})]}),"people"!==g.type&&(0,w.jsx)(r.default,{title:"微信客服",icon:"wechat",isLink:!0,value:"",onClick:function onClick(){h().openCustomerServiceChat({corpId:"wwb04af9a97514271c",extInfo:{url:"https://work.weixin.qq.com/kfid/kfc70f3f112c97a54c5"},success:function success(e){}})}})]}),(0,w.jsx)(i.default,{id:"vanToast-demo2"}),(0,w.jsx)(v.default,{active:2})]})}},"./src/pages/my/index.tsx":function(e,t,n){var o=n("webpack/container/remote/@tarojs/runtime"),r=n("./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./src/pages/my/index.tsx");Page((0,o.createPageConfig)(r.default,"pages/my/index",{root:{cn:[]}},{navigationBarTitleText:"我的"}||{}))}},function(e){e.O(0,["taro","vendors","common"],(function(){return t="./src/pages/my/index.tsx",e(e.s=t);var t}));e.O()}]); \ No newline at end of file +"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["pages/my/index"],{"./node_modules/@antmjs/vantui/es/empty/index.js":function(e,t,n){var r=n("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),o=n("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),i=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),a=n("./node_modules/@antmjs/vantui/es/empty/wxs.js"),s=n("webpack/container/remote/react/jsx-runtime"),l=["image","description","renderImage","renderDescription","style","className","children"];function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:[];return t(e[0])}))}))}),[w]),P=(0,a.useCallback)((function(e){var t=Object.keys(e).reduce((function(t,n){return e[n]!==b[n]&&(t[n]=e[n]),t}),{});Object.keys(t).length>0&&j((function(e){return _objectSpread(_objectSpread({},e),t)})),null==_||_({detail:{scrollTop:C.current.scrollTop,isFixed:e.fixed||b.fixed}})}),[_,b]),I=(0,a.useCallback)((function(e){g?P({fixed:!1,transform:0}):(C.current.scrollTop=e||C.current.scrollTop,"function"!=typeof w?(0,c.getRect)(null,"#sticky-com-index".concat(t.current)).then((function(e){(0,u.isDef)(e)&&(y>=e.top?P({fixed:!0,height:e.height}):P({fixed:!1}))})):Promise.all([(0,c.getRect)(null,"#sticky-com-index".concat(t.current)),N()]).then((function(e){var t=(0,i.default)(e,2),n=t[0],r=t[1];n&&r&&(y+n.height>r.height+r.top?P({fixed:!1,transform:r.height-n.height}):y>=n.top?P({fixed:!0,height:n.height,transform:0}):P({fixed:!1,transform:0}))})).catch((function(e){console.log(e)})))}),[w,g,N,y,P]);return(0,a.useEffect)((function(){I(x)}),[x,w,g,y]),(0,d.usePageScroll)((function(e){I(e.scrollTop)})),(0,m.jsx)(s.View,_objectSpread(_objectSpread({id:"sticky-com-index".concat(t.current),className:" van-sticky "+(S||""),style:l.style([f.containerStyle({fixed:b.fixed,height:b.height,zIndex:v}),k])},T),{},{children:(0,m.jsx)(s.View,{className:l.bem("sticky-wrap",{fixed:b.fixed})+" ".concat(S||""),style:l.style([f.wrapStyle({fixed:b.fixed,offsetTop:y,transform:b.transform,zIndex:v}),k]),children:O})}))}},"./node_modules/@antmjs/vantui/es/sticky/wxs.js":function(e,t,n){n.d(t,{wrapStyle:function(){return wrapStyle},containerStyle:function(){return containerStyle}});var r=n("./node_modules/@antmjs/vantui/es/wxs/style.js");function wrapStyle(e){return(0,r.style)({transform:e.transform?"translate3d(0, "+e.transform+"px, 0)":"",top:e.fixed?e.offsetTop+"px":"","z-index":e.zIndex})}function containerStyle(e){return(0,r.style)({height:e.fixed?e.height+"px":"","z-index":e.zIndex})}},"./node_modules/@antmjs/vantui/es/tab/index.js":function(e,t,n){var r=n("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),o=n("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),i=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),a=n("webpack/container/remote/react"),s=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),l=n("./node_modules/@antmjs/vantui/es/wxs/utils.js"),c=n("webpack/container/remote/react/jsx-runtime"),u=["children","style","className","active","lazyRender","lazyTimeout","animated","title"];function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t=ge.length||e<0)&&e!==D){var t=null!==D;P((function(t){return _objectSpread(_objectSpread({},t),{},{currentIndex:e})})),(0,j.requestAnimationFrame)((function(){Oe(e),Ce(e)})),(0,c.nextTick)((function(){t&&we("onChange",ge[e])}))}},Se=function setCurrentIndexByName(e){var t=ge.filter((function(t){return(t.props.name||t.props.index)===e}));t.length&&ke(t[0].props.index)},Oe=function resize(e){var r;"line"===W&&(e=null!==(r=e)&&void 0!==r?r:D,(0,c.nextTick)((function(){Promise.all([(0,j.getAllRect)(null,".tabs-com-index".concat(n.current," .van-tab")),(0,j.getRect)(null,".tabs-com-index".concat(n.current," .van-tabs__line"))]).then((function(n){var r=(0,i.default)(n,2),o=r[0],a=void 0===o?[]:o,s=r[1];if(a&&s){var l=a[e];if(null==l)return;var u=a.slice(0,e).reduce((function(e,t){return e+t.width}),0);u+=(l.width-s.width)/2+(Q?0:8),P((function(e){return _objectSpread(_objectSpread({},e),{},{lineOffsetLeft:u})})),t.current.swiping=!0,E&&(0,c.nextTick)((function(){P((function(e){return _objectSpread(_objectSpread({},e),{},{skipTransition:!1})}))}))}}))})))},Te=function onTap(e){var t=e.currentTarget.dataset.index;t=parseInt(t);var n=ge[t];n.props.disabled?we("onDisabled",n):(ke(t),(0,c.nextTick)((function(){we("onClick",n)})))},Ce=function scrollIntoView(e){var t;V&&(e=null!==(t=e)&&void 0!==t?t:D,Promise.all([(0,j.getAllRect)(null,".tabs-com-index".concat(n.current," .van-tab")),(0,j.getRect)(null,".tabs-com-index".concat(n.current," .van-tabs__nav"))]).then((function(t){var n=(0,i.default)(t,2),r=n[0],o=n[1];if(r&&o){var a=r[e],s=r.slice(0,e).reduce((function(e,t){return e+t.width}),0);P((function(e){return _objectSpread(_objectSpread({},e),{},{scrollLeft:s-(o.width-a.width)/2})})),z||(0,c.nextTick)((function(){P((function(e){return _objectSpread(_objectSpread({},e),{},{scrollWithAnimation:!0})}))}))}})))},Ne=function touchStart(e){!function resetTouchStatus(){t.current.direction="",t.current.deltaX=0,t.current.deltaY=0,t.current.offsetX=0,t.current.offsetY=0}();var n=e.touches[0];t.current.startX=n.clientX,t.current.startY=n.clientY},Pe=function onTouchEnd(){if(R&&t.current.swiping){var e=t.current,n=e.direction,r=e.deltaX,o=e.offsetX;if("horizontal"===n&&o>=50){var i=function getAvaiableTab(e){for(var t=e>0?-1:1,n=t;D+n=0;n+=t){var r=D+n;if(r>=0&&rle||!Q})}))}),[le,ge,Q]),(0,u.useEffect)((function(){(0,c.nextTick)((function(){Oe()}))}),[ge]);var Ie=(0,u.useCallback)((0,r.default)(l().mark((function _callee(){var e,t,r;return l().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:if(e=0,!ue||!g){o.next=6;break}return o.next=4,(0,j.getAllRect)(null,"."+m.bem("renderNavLeft"+n.current));case 4:(t=o.sent).length&&(e+=t[0].width);case 6:if(!de||!g){o.next=11;break}return o.next=9,(0,j.getAllRect)(null,"."+m.bem("renderNavRight"+n.current));case 9:(r=o.sent).length&&(e+=r[0].width);case 11:e&&O("calc(100% - ".concat(e,"px)"));case 12:case"end":return o.stop()}}),_callee)}))),[ue,g,de]);return(0,u.useEffect)((function(){setTimeout((function(){Ie()}))}),[Ie,g]),(0,y.jsxs)(f.View,_objectSpread(_objectSpread({className:"tabs-com-index".concat(n.current," ")+" "+m.bem("tabs",[W]+" ".concat(ve||"")),style:je},ye),{},{children:[(0,y.jsx)(b.Sticky,{disabled:!F,zIndex:H,offsetTop:B,container:U,onScroll:fe,children:(0,y.jsxs)(f.View,{className:m.bem("tabs__wrap",{scrollable:V})+" "+("line"===W&&$?"van-hairline--top-bottom":""),children:[(0,y.jsx)(f.View,{className:m.bem("renderNavLeft"+n.current),children:ue}),(0,y.jsx)(f.ScrollView,{scrollX:V,scrollWithAnimation:z,scrollLeft:I,className:m.bem("tabs__scroll",[W]),style:{width:S,borderColor:G},children:(0,y.jsxs)(f.View,{className:m.bem("tabs__nav",[W,{complete:!Q}])+" nav-class",style:h.navStyle(G,W),children:["line"===W&&(0,y.jsx)(f.View,{className:"van-tabs__line",style:h.lineStyle({color:G,lineOffsetLeft:A,lineHeight:ee,skipTransition:E,duration:ne,lineWidth:oe})}),xe.map((function(e,t){return(0,y.jsx)(f.View,{"data-index":t,className:h.tabClass(t===D,Q)+" "+m.bem("tab",{active:t===D,disabled:e.disabled,complete:!Q}),style:h.tabStyle({active:t===D,ellipsis:Q,color:G,type:W,disabled:e.disabled,titleActiveColor:ie,titleInactiveColor:ae,swipeThreshold:le,scrollable:V}),onClick:Te,children:(0,y.jsxs)(f.View,{className:Q?"van-ellipsis":"",style:e.titleStyle,children:[e.title,(null!==e.info||e.dot)&&(0,y.jsx)(v.Info,{info:e.info,dot:e.dot,className:"van-tab__title__info"})]})},t)}))]})}),(0,y.jsx)(f.View,{className:m.bem("renderNavRight"+n.current),children:de})]})}),(0,y.jsx)(f.View,{className:"van-tabs__content",onTouchStart:function onTouchStart(e){R&&(t.current.swiping=!0,Ne(e))},onTouchMove:function onTouchMove(e){R&&t.current.swiping&&function touchMove(e){var n=e.touches[0];t.current.deltaX=n.clientX-t.current.startX,t.current.deltaY=n.clientY-t.current.startY,t.current.offsetX=Math.abs(t.current.deltaX),t.current.offsetY=Math.abs(t.current.deltaY),t.current.direction=t.current.direction||function getDirection(e,t){return e>t&&e>10?"horizontal":t>e&&t>10?"vertical":""}(t.current.offsetX,t.current.offsetY)}(e)},onTouchEnd:Pe,onTouchCancel:Pe,children:(0,y.jsx)(f.View,{className:m.bem("tabs__track",[{animated:ce}])+" van-tabs__track",style:h.trackStyle({duration:ne,currentIndex:D,animated:ce}),children:ge})})]}))}},"./node_modules/@antmjs/vantui/es/tabs/wxs.js":function(e,t,n){n.d(t,{tabClass:function(){return tabClass},tabStyle:function(){return tabStyle},trackStyle:function(){return trackStyle},lineStyle:function(){return lineStyle},navStyle:function(){return navStyle}});var r=n("./node_modules/@antmjs/vantui/es/wxs/style.js"),o=n("./node_modules/@antmjs/vantui/es/wxs/utils.js");function tabClass(e,t){var n=["tab-class"];return e&&n.push("tab-active-class"),t&&n.push("van-ellipsis"),n.join(" ")}function tabStyle(e){var t=e.active?e.titleActiveColor:e.titleInactiveColor,n=e.scrollable&&e.ellipsis;return"card"===e.type?(0,r.style)({"border-color":e.color,"background-color":!e.disabled&&e.active?e.color:null,color:t||(e.disabled||e.active?null:e.color),"flex-basis":n?88/e.swipeThreshold+"%":null}):(0,r.style)({color:t,"flex-basis":n?88/e.swipeThreshold+"%":null})}function navStyle(e,t){return(0,r.style)({"border-color":"card"===t&&e?e:null})}function trackStyle(e){return e.animated?(0,r.style)({transform:"translate3d(".concat(-100*e.currentIndex,"%, 0px, 0px)"),"-webkit-transform":"translate3d(".concat(-100*e.currentIndex,"%, 0px, 0px)"),"transition-duration":e.duration+"s","-webkit-transition-duration":e.duration+"s",transition:e.duration+"s"}):""}function lineStyle(e){return(0,r.style)({visibility:0===e.lineOffsetLeft?"hidden":"visible",width:o.addUnit(e.lineWidth),transform:"translateX("+e.lineOffsetLeft+"px)","-webkit-transform":"translateX("+e.lineOffsetLeft+"px)","background-color":e.color,height:-1!==e.lineHeight?o.addUnit(e.lineHeight):null,"border-radius":-1!==e.lineHeight?o.addUnit(e.lineHeight):null,"transition-duration":e.skipTransition?null:e.duration+"s","-webkit-transition-duration":e.skipTransition?null:e.duration+"s"})}},"./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./src/pages/my/index.tsx":function(e,t,n){var r=n("./node_modules/@antmjs/vantui/es/icon/index.js"),o=n("./node_modules/@antmjs/vantui/es/cell/index.js"),i=n("./node_modules/@antmjs/vantui/es/toast/index.js"),a=n("./node_modules/@antmjs/vantui/es/tabs/index.js"),s=n("./node_modules/@antmjs/vantui/es/tab/index.js"),l=n("./node_modules/@antmjs/vantui/es/button/index.js"),c=n("./node_modules/@antmjs/vantui/es/image/index.js"),u=n("./node_modules/@antmjs/vantui/es/empty/index.js"),d=n("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),f=n("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),m=n("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),p=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),b=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),j=n("webpack/container/remote/react"),v=n("./src/pages/components/TabbarCom/index.tsx"),h=n("webpack/container/remote/@tarojs/taro"),y=n.n(h),x=n("./src/pages/components/ActiveCard/index.tsx"),g=n("./src/utils/index.ts"),w=n("./config.js"),_=n("webpack/container/remote/react/jsx-runtime");t.default=function my(e){var t=(0,j.useState)({}),n=(0,p.default)(t,2),h=(n[0],n[1]),k=(0,j.useState)(""),S=(0,p.default)(k,2),O=S[0],T=S[1],C=(0,j.useState)([]),N=(0,p.default)(C,2),P=(N[0],N[1]),I=(0,j.useState)([]),V=(0,p.default)(I,2),D=V[0],E=V[1],z=(0,j.useState)(0),A=(0,p.default)(z,2),R=A[0],L=A[1],X=(0,j.useState)(!0),M=(0,p.default)(X,2),Y=M[0],K=M[1];(0,j.useEffect)((function(){W()}),[]);var W=function(){var e=(0,m.default)((0,f.default)().mark((function _callee(){var e;return(0,f.default)().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,g.phoneLogin)();case 2:e=t.sent,K(e);case 4:case"end":return t.stop()}}),_callee)})));return function getok(){return e.apply(this,arguments)}}();(0,j.useEffect)((function(){Y&&F()}),[Y]);var F=function getUserInfo(){var e;y().cloud.callFunction({name:"getOpenid",complete:(e=(0,m.default)((0,f.default)().mark((function _callee2(e){var t,n,r,o,i;return(0,f.default)().wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:console.log("callFunction test result: ",e),o=null==e||null===(t=e.result)||void 0===t||null===(n=t.event)||void 0===n||null===(r=n.userInfo)||void 0===r?void 0:r.openId,T(o),i={tableName:"userInfo",keyValue:{openId:o},okFun:function okFun(e){var t,n,r,i;console.log("userinfo--",e),h(null!==(t=null==e||null===(n=e.data)||void 0===n?void 0:n[0])&&void 0!==t?t:{}),P(null!==(r=null==e||null===(i=e.data)||void 0===i?void 0:i.activeidArr)&&void 0!==r?r:[]),U(o)}},(0,g.getTable)(i);case 5:case"end":return a.stop()}}),_callee2)}))),function complete(t){return e.apply(this,arguments)})})},U=function getDetails(e,t){var n=y().cloud.database({}).command,r=t?{peopleArr:n.elemMatch({openid:n.eq(e),status:n.eq(t)})}:{peopleArr:n.elemMatch({openid:n.eq(e)})},o={tableName:"details",keyValue:(0,d.default)({},r),okFun:function okFun(e){var t;console.log("detailsData/usero--",e),E(null!==(t=null==e?void 0:e.data)&&void 0!==t?t:[])}};(0,g.getTable)(o)};(0,j.useEffect)((function(){}),[]);var H=function CardCom(){return(0,_.jsx)(b.View,{children:(null==D?void 0:D.length)>0?(0,_.jsx)(b.View,{children:D.splice(0,2).map((function(e,t){return(0,_.jsx)(b.View,{onClick:function onClick(){console.log("Card"),y().navigateTo({url:"/pages/activityList/components/details/index?id=".concat(null==e?void 0:e._id)})},children:(0,_.jsx)(x.default,{dataSource:e})})}))}):(0,_.jsx)(b.View,{children:(0,_.jsx)(u.default,{className:"customImage",image:"https://img.yzcdn.cn/vant/custom-empty-image.png"})})})};return(0,_.jsxs)(b.View,{className:"myContent",children:[(0,_.jsxs)(b.View,{className:"myImage",children:[(0,_.jsx)(c.default,{round:!0,width:"100px",height:"100px",src:"cloud://citynew-0givkbre03955d8c.6369-citynew-0givkbre03955d8c-1253655588/images/touxiang/images.jpg"}),!Y&&(0,_.jsx)(b.View,{className:"loginBtn",children:(0,_.jsx)(l.default,{type:"primary",size:"mini","open-type":"getPhoneNumber",lang:"zh_CN",children:"登录"})})]}),(0,_.jsx)(b.View,{children:(0,_.jsxs)(a.default,{sticky:!0,active:R,onClick:function onClick(e){var t,n;console.log("e",e),U(O,null==e||null===(t=e.detail)||void 0===t?void 0:t.name),L(null==e||null===(n=e.detail)||void 0===n?void 0:n.name)},children:[(0,_.jsx)(s.default,{title:"待审核",name:"1",children:(0,_.jsx)(b.View,{children:H()})}),(0,_.jsx)(s.default,{title:"待参加",name:"2",children:H()}),(0,_.jsx)(s.default,{title:"已取消",name:"4",children:H()})]})}),(0,_.jsxs)(b.View,{className:"cellArr",children:[(0,_.jsx)(o.default,{icon:"star",title:"打卡记录",isLink:!0,onClick:function onClick(){Y?y().navigateTo({url:"/pages/my/components/CheckinDetail/index"}):i.default.fail({message:"请先登录",selector:"#vanToast-demo2"})}}),(0,_.jsx)(o.default,{icon:"coupon",title:"更新收货地址",isLink:!0,onClick:function onClick(){y().chooseAddress({success:function success(e){console.log(e.userName),console.log(e.postalCode),console.log(e.provinceName),console.log(e.cityName),console.log(e.countyName),console.log(e.detailInfo),console.log(e.nationalCode),console.log(e.telNumber)}})}}),(0,_.jsx)(o.default,{icon:"manager",title:"申请成为领队",isLink:!0,onClick:function onClick(){i.default.fail({message:"首次参加活动后,可申请成为领队",selector:"#vanToast-demo2"})}}),(0,_.jsxs)(b.View,{className:"wechat",children:[(0,_.jsx)(r.default,{name:"wechat",size:"16px",className:"icon"}),(0,_.jsx)(l.default,{"open-type":"contact",className:"wecahtBtn",children:"联系我们"})]}),"people"!==w.type&&(0,_.jsx)(o.default,{title:"微信客服",icon:"wechat",isLink:!0,value:"",onClick:function onClick(){y().openCustomerServiceChat({corpId:"wwb04af9a97514271c",extInfo:{url:"https://work.weixin.qq.com/kfid/kfc70f3f112c97a54c5"},success:function success(e){}})}})]}),(0,_.jsx)(i.default,{id:"vanToast-demo2"}),(0,_.jsx)(v.default,{active:2})]})}},"./src/pages/my/index.tsx":function(e,t,n){var r=n("webpack/container/remote/@tarojs/runtime"),o=n("./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./src/pages/my/index.tsx");Page((0,r.createPageConfig)(o.default,"pages/my/index",{root:{cn:[]}},{navigationBarTitleText:"我的"}||{}))}},function(e){e.O(0,["taro","vendors","common"],(function(){return t="./src/pages/my/index.tsx",e(e.s=t);var t}));e.O()}]); \ No newline at end of file diff --git a/dist/pages/my/index.js.LICENSE.txt b/dist/pages/my/index.js.LICENSE.txt index 93fba02..581b9c5 100644 --- a/dist/pages/my/index.js.LICENSE.txt +++ b/dist/pages/my/index.js.LICENSE.txt @@ -36,6 +36,8 @@ /*! @antmjs/vantui/es/cell */ +/*! @antmjs/vantui/es/empty */ + /*! @antmjs/vantui/es/icon */ /*! @antmjs/vantui/es/image */ @@ -76,6 +78,10 @@ !*** ./node_modules/@antmjs/vantui/es/tabs/wxs.js ***! \****************************************************/ +/*!*****************************************************!*\ + !*** ./node_modules/@antmjs/vantui/es/empty/wxs.js ***! + \*****************************************************/ + /*!*****************************************************!*\ !*** ./node_modules/@antmjs/vantui/es/tab/index.js ***! \*****************************************************/ @@ -88,6 +94,10 @@ !*** ./node_modules/@antmjs/vantui/es/tabs/index.js ***! \******************************************************/ +/*!*******************************************************!*\ + !*** ./node_modules/@antmjs/vantui/es/empty/index.js ***! + \*******************************************************/ + /*!********************************************************!*\ !*** ./node_modules/@antmjs/vantui/es/sticky/index.js ***! \********************************************************/ diff --git a/dist/pages/my/index.wxss b/dist/pages/my/index.wxss index fe3401c..b1c9f39 100644 --- a/dist/pages/my/index.wxss +++ b/dist/pages/my/index.wxss @@ -10,6 +10,10 @@ !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[0].use[2]!./node_modules/@antmjs/vantui/es/tab/index.css ***! \********************************************************************************************************************************************************************************************************************/ .van-tab__pane{box-sizing:border-box;overflow-y:auto;-webkit-overflow-scrolling:touch;-webkit-flex-shrink:0;flex-shrink:0;width:100%}.van-tab__pane--active{height:auto}.van-tab__pane--inactive{height:0;overflow:visible} +/*!**********************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[0].use[2]!./node_modules/@antmjs/vantui/es/empty/index.css ***! + \**********************************************************************************************************************************************************************************************************************/ +.van-empty{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;padding:64rpx 0}.van-empty__image{width:320rpx;height:320rpx}.van-empty__image:empty{display:none}.van-empty__image__img{width:100%;height:100%}.van-empty__image:not(:empty)+.van-empty__image{display:none}.van-empty__description{margin-top:32rpx;padding:0 120rpx;color:#969799;font-size:28rpx;line-height:40rpx}.van-empty__description:empty{display:none}.van-empty__description:not(:empty)+.van-empty__description{display:none}.van-empty__bottom{margin-top:48rpx} /*!*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ !*** css ./node_modules/cache-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[2]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[3]!./node_modules/resolve-url-loader/index.js!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[5]!./src/pages/my/index.module.scss ***! \*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ @@ -67,3 +71,8 @@ position: relative; left: -245rpx; } + +.customImage { + width: 100%; + height: 230rpx; +} diff --git a/src/pages/my/index.module.scss b/src/pages/my/index.module.scss index 74ae5fa..6476aea 100644 --- a/src/pages/my/index.module.scss +++ b/src/pages/my/index.module.scss @@ -38,4 +38,11 @@ left: -245px; } } +} + +.customImage{ + width: 100%; + // height: 200px; + height: 230px; + } \ No newline at end of file diff --git a/src/pages/my/index.tsx b/src/pages/my/index.tsx index f29bc9b..e4617b4 100644 --- a/src/pages/my/index.tsx +++ b/src/pages/my/index.tsx @@ -3,6 +3,7 @@ import { Card, Cell, Col, + Empty, Icon, Row, Tabbar, @@ -33,11 +34,12 @@ const my = (props: any) => { // const [active, setActive] = react.useState(props?.active ?? 0); const [userInfo, setuserInfo] = useState({}); //用户信息 + const [openId, setopenId] = useState(""); //用户信息 + const [activeidArr, setactiveidArr] = useState([]); //用户参与的活动 + const [detailsData, setdetailsData] = useState([]); //活动详情 const [currentIndex, setcurrentIndex] = useState(0); const [isin, setisin] = useState(true); //0初始 1未登录 2有手机号 - const [activeidArr , setactiveidArr ] = useState([]); //用户参与的活动 - useEffect(() => { getok(); @@ -49,57 +51,66 @@ const my = (props: any) => { const getok = async () => { let isOk: any = await phoneLogin(); - console.log("isok", isOk); setisin(isOk); - // setisin(isOk?'2':'1'); }; - // 云函数,-获取手机号 - const getLogin = (e: any) => { - Taro.cloud - .callFunction({ - name: "getPhoneNum", - data: { - weRunData: Taro.cloud.CloudID(e.detail.cloudID), - }, - }) - .then((res: any) => { - console.log("res222", res); - let phoneNumber = res?.result?.event?.weRunData?.data?.phoneNumber; - let tencentcloud_uin = res?.result?.context?.tencentcloud_uin; - let openId: any = res?.result?.event?.userInfo?.openId; - let postData = { + useEffect(() => { + if (isin) { + // 获取当前用户信息 + getUserInfo(); + } + }, [isin]); + + // 获取用户 + const getUserInfo = () => { + Taro.cloud.callFunction({ + name: "getOpenid", + complete: async (res: any) => { + console.log("callFunction test result: ", res); + let openid = res?.result?.event?.userInfo?.openId; + setopenId(openid); + let objParams = { tableName: "userInfo", - keyValue: { openId: openId }, - okFun: (res: any) => { - console.log("q", res); - updateTableid({ - id: res?.data?.[0]?._id, - tableName: "userInfo", - objData: { - tencentcloud_uin: tencentcloud_uin, //微信号 - authInfo: { - authPhonenum: phoneNumber, //手机号 - }, - }, - okFun: (res: any) => { - getok(); - }, - }); + // id: "80516fb66370bcf300b8f43c5f4dd52b", + keyValue: { openId: openid }, + okFun: (res) => { + console.log("userinfo--", res); + setuserInfo(res?.data?.[0] ?? {}); + setactiveidArr(res?.data?.activeidArr ?? []); + + // 获取当前用户参与的活动 + getDetails(openid); }, }; - getTable({ ...postData }); - - // setisin(true); - }); + getTable(objParams); + }, + }); }; - const getDetails = () => { - let objParams = { + // 获取该用户所有活动详情 + const getDetails = (openid: any, status?: string) => { + const db: any = Taro.cloud.database({}); + const _: any = db.command; + let newKey: any = status + ? { + peopleArr: _.elemMatch({ + openid: _.eq(openid), + status: _.eq(status), //审核通过的数据 + }), + } + : { + peopleArr: _.elemMatch({ + openid: _.eq(openid), + }), + }; + let objParams: any = { tableName: "details", // id: "80516fb66370bcf300b8f43c5f4dd52b", + keyValue: { + ...newKey, + }, okFun: (res) => { - console.log("details--", res); + console.log("detailsData/usero--", res); setdetailsData(res?.data ?? []); }, }; @@ -111,53 +122,42 @@ const my = (props: any) => { definePageConfig({ navigationBarTitleText: "我的", }); - - // 获取活动详情 - // getDetails(); }, []); const CardCom = () => { - // console.log("details===", details); - return ( - {detailsData.splice(0, 2).map((item: any, index: any) => { - return ( - { - console.log("Card"); - Taro.navigateTo({ - url: `/pages/activityList/components/details/index?id=${item?._id}`, - }); - }} - > - {/* 活动卡片 */} - - - ); - })} + {detailsData?.length>0 ? ( + + {detailsData.splice(0, 2).map((item: any, index: any) => { + return ( + { + console.log("Card"); + Taro.navigateTo({ + url: `/pages/activityList/components/details/index?id=${item?._id}`, + }); + }} + > + {/* 活动卡片 */} + + + ); + })} + + ) : ( + + + + )} ); }; - // 获取用户信息 [头像/昵称] - const onGetUserInfo = (info: any) => { - console.log("info", info); - }; - - // 获取用户手机 [手机号]-需要揭秘 - const onGetPhoneNumber = (info: any) => { - console.log("info", info); - getPhoneNumber(info); - // Taro.cloud.openapi.phonenumber.getPhoneNumber({code:'code'}) - }; - - const getPhoneNumber = (e: any) => { - console.log("点击获取手机事件", e.detail.cloudID); - // 调用云函数获取手机号 - getLogin(e); - }; - return ( {/* */} @@ -178,7 +178,7 @@ const my = (props: any) => { size="mini" open-type="getPhoneNumber" lang="zh_CN" - onGetPhoneNumber={onGetPhoneNumber} + // onGetPhoneNumber={onGetPhoneNumber} > 登录 @@ -192,17 +192,24 @@ const my = (props: any) => { active={currentIndex} onClick={(e: any) => { console.log("e", e); - setcurrentIndex(e?.detail?.index ?? 0); + getDetails(openId, e?.detail?.name); + setcurrentIndex(e?.detail?.name); }} > - + {/* */} + {CardCom()} {/* 222 */} - 333 - 44 + + {CardCom()} + + + {CardCom()} + + {/* 44 */}