From 208c530dda684980b24988c5e0cfbbb55134bcbd Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 14 Dec 2022 14:04:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E7=94=A8=E4=BA=91=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 4 + dist/common.js | 2 +- dist/pages/home/index.js | 2 +- dist/pages/home/index.js.LICENSE.txt | 4 +- dist/runtime.js | 2 +- src/pages/home/index.tsx | 14 ++-- src/utils/index.ts | 121 +++++++++++++++++---------- tsconfig.json | 9 +- 8 files changed, 102 insertions(+), 56 deletions(-) diff --git a/config/index.js b/config/index.js index 77d7f02..8069672 100644 --- a/config/index.js +++ b/config/index.js @@ -1,3 +1,4 @@ +const path=require("path") const config = { enableShareTimeline: true,//允许分享到朋友圈 enableShareAppMessage: true, @@ -60,6 +61,9 @@ const config = { }, }, }, + alias: { + '@/utils': path.resolve(__dirname, '..', 'src/utils'), + } }; module.exports = function (merge) { diff --git a/dist/common.js b/dist/common.js index 96bce63..7a22407 100644 --- a/dist/common.js +++ b/dist/common.js @@ -1,2 +1,2 @@ /*! For license information please see common.js.LICENSE.txt */ -"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["common"],{"./config.js":function(e,n,t){t.d(n,{type:function(){return a},appId:function(){return l},envConfig:function(){return o}});var a="people",l="people"===a?"wx515bd42ee0db5c5d":"wx2b2ec2ba5ee694bc",o="people"===a?"citynew-0givkbre03955d8c":"cloud1-5g5xrgza12a0dd6d"},"./src/pages/components/ActiveCard/index.tsx":function(e,n,t){var a=t("./node_modules/@antmjs/vantui/es/button/index.js"),l=t("./node_modules/@antmjs/vantui/es/image/index.js"),o=t("./node_modules/@antmjs/vantui/es/tag/index.js"),i=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),s=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),c=t("webpack/container/remote/react"),u=t("webpack/container/remote/moment"),r=t.n(u),d=t("webpack/container/remote/react/jsx-runtime");n.default=function ActiveCard(e){var n,t=(0,c.useState)({}),u=(0,i.default)(t,2),m=(u[0],u[1],null==e?void 0:e.dataSource),f=m.title,p=m.address,v=m.date,b=m.tagName,g=(m.tagCode,m.Status,m.images);m.isDelete;return(0,d.jsxs)(s.View,{className:"activeCard",children:[(0,d.jsxs)(s.View,{className:"left",children:[!1,(0,d.jsx)(s.View,{className:"leftImage",children:(0,d.jsx)(l.default,{width:"100%",height:"100px",fit:"cover",src:null==g||null===(n=g[0])||void 0===n?void 0:n.url})})]}),(0,d.jsxs)(s.View,{className:"middle",children:[(0,d.jsxs)(s.View,{className:"title",children:[(0,d.jsx)(o.default,{round:!0,type:"warning",style:{marginRight:"5px"},children:b}),(0,d.jsx)(s.Text,{children:f})]}),(0,d.jsxs)(s.View,{className:"down",children:[(0,d.jsxs)(s.View,{className:"date",children:[(0,d.jsx)(s.View,{className:"",children:p}),(0,d.jsx)(s.View,{className:"",children:r()(v).format("YYYY-MM-DD")})]}),(0,d.jsx)(s.View,{className:"btn",children:(0,d.jsx)(a.default,{plain:!0,hairline:!0,type:"primary",children:"立即查看"})})]})]})]})}},"./src/pages/components/TabbarCom/index.tsx":function(e,n,t){var a=t("./node_modules/@antmjs/vantui/es/tabbar/index.js"),l=t("./node_modules/@antmjs/vantui/es/tabbar-item/index.js"),o=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),i=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),s=t("webpack/container/remote/@tarojs/taro"),c=t.n(s),u=t("webpack/container/remote/react"),r=t.n(u),d=t("webpack/container/remote/react/jsx-runtime");n.default=function TabbarCom(e){var n,t=r().useState(null!==(n=null==e?void 0:e.active)&&void 0!==n?n:0),s=(0,o.default)(t,2),u=s[0],m=s[1];return(0,d.jsx)(i.View,{style:{marginTop:"40px"},children:(0,d.jsxs)(a.default,{active:u,onChange:function onChange(e){console.log("e",e),m(null==e?void 0:e.detail),0===(null==e?void 0:e.detail)&&c().redirectTo({url:"/pages/home/index"}),1===(null==e?void 0:e.detail)&&c().redirectTo({url:"/pages/activityList/index"}),2===(null==e?void 0:e.detail)&&c().redirectTo({url:"/pages/my/index"})},safeAreaInsetBottom:!0,children:[(0,d.jsx)(l.default,{icon:"home-o",children:"首页"}),(0,d.jsx)(l.default,{icon:"friends-o",children:"活动"}),(0,d.jsx)(l.default,{icon:"setting-o",children:"我的"})]})})}},"./src/utils/index.ts":function(e,n,t){t.d(n,{getTable:function(){return u},getTableid:function(){return r},updateTableid:function(){return d},phoneLogin:function(){return m}});var a=t("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),l=t("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),o=t("webpack/container/remote/@tarojs/taro"),i=t.n(o),s=t("./config.js"),c=function addTable(e){var n=e.env,t=e.tableName,a=e.objData,l=e.okFun,o=i().cloud.database({env:n}),s=null==o?void 0:o.collection(t);null==s||s.add({data:a,success:function success(e){l(e)},fail:function fail(e){console.log("err",e)}})},u=function getTable(e){var n,t=e.env,a=e.tableName,l=e.keyValue,o=void 0===l?{}:l,s=e.okFun,c=i().cloud.database({env:t}),u=null==c?void 0:c.collection(a);(null===(n=Object.keys(o))||void 0===n?void 0:n.length)>0?null==u||u.where(o).get({success:function success(e){s(e)}}):null==u||u.get({success:function success(e){s(e)}})},r=function getTableid(e){var n,t,a=e.env,l=e.tableName,o=e.id,s=e.keyValue,c=void 0===s?{}:s,u=e.okFun,r=i().cloud.database({env:a}),d=null==r?void 0:r.collection(l);(null===(n=Object.keys(c))||void 0===n?void 0:n.length)>0?null==d||d.doc(o).where(c).get({success:function success(e){u(e)},fail:function fail(e){console.log("err",e)}}):null==d||null===(t=d.doc(o))||void 0===t||t.get({success:function success(e){u(e)},fail:function fail(e){console.log("err",e)}})},d=function updateTableid(e){var n=e.env,t=e.tableName,a=e.objData,l=e.id,o=e.okFun,s=i().cloud.database({env:n});(null==s?void 0:s.collection(t)).doc(l).update({data:a,success:function success(e){o(e)},fail:function fail(e){console.log("err",e)}})},m=function(){var e=(0,l.default)((0,a.default)().mark((function _callee4(){return(0,a.default)().wrap((function _callee4$(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var t,o=i().cloud.database({}).command,r="";i().cloud.callFunction({name:"getOpenid",complete:(t=(0,l.default)((0,a.default)().mark((function _callee3(n){var t,l,i;return(0,a.default)().wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:console.log("callFunction test result: ",n),r=null==n||null===(t=n.result)||void 0===t||null===(l=t.event)||void 0===l||null===(i=l.userInfo)||void 0===i?void 0:i.openId,console.log("openId--",r),u({tableName:"userInfo",keyValue:{openId:o.eq(r)},okFun:function okFun(n){var t;console.log("res",n);var a,l,o,i=null!==(t=null==n?void 0:n.data)&&void 0!==t?t:[];if(0!==(null==i?void 0:i.length))return null!=i&&null!==(a=i[0])&&void 0!==a&&null!==(l=a.authInfo)&&void 0!==l&&null!==(o=l[0])&&void 0!==o&&o.telNumber?(e(!0),!0):(s.type,e(!1),!1);c({tableName:"userInfo",objData:{openId:r},okFun:function okFun(e){}})}});case 4:case"end":return a.stop()}}),_callee3)}))),function complete(e){return t.apply(this,arguments)})})})));case 1:case"end":return e.stop()}}),_callee4)})));return function phoneLogin(){return e.apply(this,arguments)}}()}}]); \ No newline at end of file +"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["common"],{"./config.js":function(e,n,t){t.d(n,{type:function(){return a},appId:function(){return l},envConfig:function(){return o}});var a="people",l="people"===a?"wx515bd42ee0db5c5d":"wx2b2ec2ba5ee694bc",o="people"===a?"citynew-0givkbre03955d8c":"cloud1-5g5xrgza12a0dd6d"},"./src/pages/components/ActiveCard/index.tsx":function(e,n,t){var a=t("./node_modules/@antmjs/vantui/es/button/index.js"),l=t("./node_modules/@antmjs/vantui/es/image/index.js"),o=t("./node_modules/@antmjs/vantui/es/tag/index.js"),c=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),i=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),r=t("webpack/container/remote/react"),s=t("webpack/container/remote/moment"),u=t.n(s),d=t("webpack/container/remote/react/jsx-runtime");n.default=function ActiveCard(e){var n,t=(0,r.useState)({}),s=(0,c.default)(t,2),f=(s[0],s[1],null==e?void 0:e.dataSource),p=f.title,m=f.address,v=f.date,b=f.tagName,g=(f.tagCode,f.Status,f.images);f.isDelete;return(0,d.jsxs)(i.View,{className:"activeCard",children:[(0,d.jsxs)(i.View,{className:"left",children:[!1,(0,d.jsx)(i.View,{className:"leftImage",children:(0,d.jsx)(l.default,{width:"100%",height:"100px",fit:"cover",src:null==g||null===(n=g[0])||void 0===n?void 0:n.url})})]}),(0,d.jsxs)(i.View,{className:"middle",children:[(0,d.jsxs)(i.View,{className:"title",children:[(0,d.jsx)(o.default,{round:!0,type:"warning",style:{marginRight:"5px"},children:b}),(0,d.jsx)(i.Text,{children:p})]}),(0,d.jsxs)(i.View,{className:"down",children:[(0,d.jsxs)(i.View,{className:"date",children:[(0,d.jsx)(i.View,{className:"",children:m}),(0,d.jsx)(i.View,{className:"",children:u()(v).format("YYYY-MM-DD")})]}),(0,d.jsx)(i.View,{className:"btn",children:(0,d.jsx)(a.default,{plain:!0,hairline:!0,type:"primary",children:"立即查看"})})]})]})]})}},"./src/pages/components/TabbarCom/index.tsx":function(e,n,t){var a=t("./node_modules/@antmjs/vantui/es/tabbar/index.js"),l=t("./node_modules/@antmjs/vantui/es/tabbar-item/index.js"),o=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),c=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),i=t("webpack/container/remote/@tarojs/taro"),r=t.n(i),s=t("webpack/container/remote/react"),u=t.n(s),d=t("webpack/container/remote/react/jsx-runtime");n.default=function TabbarCom(e){var n,t=u().useState(null!==(n=null==e?void 0:e.active)&&void 0!==n?n:0),i=(0,o.default)(t,2),s=i[0],f=i[1];return(0,d.jsx)(c.View,{style:{marginTop:"40px"},children:(0,d.jsxs)(a.default,{active:s,onChange:function onChange(e){console.log("e",e),f(null==e?void 0:e.detail),0===(null==e?void 0:e.detail)&&r().redirectTo({url:"/pages/home/index"}),1===(null==e?void 0:e.detail)&&r().redirectTo({url:"/pages/activityList/index"}),2===(null==e?void 0:e.detail)&&r().redirectTo({url:"/pages/my/index"})},safeAreaInsetBottom:!0,children:[(0,d.jsx)(l.default,{icon:"home-o",children:"首页"}),(0,d.jsx)(l.default,{icon:"friends-o",children:"活动"}),(0,d.jsx)(l.default,{icon:"setting-o",children:"我的"})]})})}},"./src/utils/index.ts":function(e,n,t){t.d(n,{getTable:function(){return s},getTableid:function(){return u},updateTableid:function(){return d},phoneLogin:function(){return f},cloudcall:function(){return p}});var a=t("./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"),l=t("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),o=t("webpack/container/remote/@tarojs/taro"),c=t.n(o),i=t("./config.js"),r=function addTable(e){var n=e.env,t=e.tableName,a=e.objData,l=e.okFun,o=c().cloud.database({env:n}),i=null==o?void 0:o.collection(t);null==i||i.add({data:a,success:function success(e){l(e)},fail:function fail(e){console.log("err",e)}})},s=function getTable(e){var n,t=e.env,a=e.tableName,l=e.keyValue,o=void 0===l?{}:l,i=e.okFun,r=c().cloud.database({env:t}),s=null==r?void 0:r.collection(a);(null===(n=Object.keys(o))||void 0===n?void 0:n.length)>0?null==s||s.where(o).get({success:function success(e){i(e)}}):null==s||s.get({success:function success(e){i(e)}})},u=function getTableid(e){var n,t,a=e.env,l=e.tableName,o=e.id,i=e.keyValue,r=void 0===i?{}:i,s=e.okFun,u=c().cloud.database({env:a}),d=null==u?void 0:u.collection(l);(null===(n=Object.keys(r))||void 0===n?void 0:n.length)>0?null==d||d.doc(o).where(r).get({success:function success(e){s(e)},fail:function fail(e){console.log("err",e)}}):null==d||null===(t=d.doc(o))||void 0===t||t.get({success:function success(e){s(e)},fail:function fail(e){console.log("err",e)}})},d=function updateTableid(e){var n=e.env,t=e.tableName,a=e.objData,l=e.id,o=e.okFun,i=c().cloud.database({env:n});(null==i?void 0:i.collection(t)).doc(l).update({data:a,success:function success(e){o(e)},fail:function fail(e){console.log("err",e)}})},f=function(){var e=(0,l.default)((0,a.default)().mark((function _callee4(){return(0,a.default)().wrap((function _callee4$(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var t,o=c().cloud.database({}).command,u="";c().cloud.callFunction({name:"getOpenid",complete:(t=(0,l.default)((0,a.default)().mark((function _callee3(n){var t,l,c;return(0,a.default)().wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:console.log("callFunction test result: ",n),u=null==n||null===(t=n.result)||void 0===t||null===(l=t.event)||void 0===l||null===(c=l.userInfo)||void 0===c?void 0:c.openId,console.log("openId--",u),s({tableName:"userInfo",keyValue:{openId:o.eq(u)},okFun:function okFun(n){var t;console.log("res",n);var a,l,o,c=null!==(t=null==n?void 0:n.data)&&void 0!==t?t:[];if(0!==(null==c?void 0:c.length))return null!=c&&null!==(a=c[0])&&void 0!==a&&null!==(l=a.authInfo)&&void 0!==l&&null!==(o=l[0])&&void 0!==o&&o.telNumber?(e(!0),!0):(i.type,e(!1),!1);r({tableName:"userInfo",objData:{openId:u},okFun:function okFun(e){}})}});case 4:case"end":return a.stop()}}),_callee3)}))),function complete(e){return t.apply(this,arguments)})})})));case 1:case"end":return e.stop()}}),_callee4)})));return function phoneLogin(){return e.apply(this,arguments)}}(),p=function(){var e=(0,l.default)((0,a.default)().mark((function _callee5(e){var n,t,l,o,r=arguments;return(0,a.default)().wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:0,(t={}).cloud=new(c().cloud.Cloud)({resourceAppid:i.appId,resourceEnv:"prod-4go74loxa6ac34a8"}),a.next=5,null==t?void 0:t.cloud.init();case 5:return a.prev=5,a.next=8,t.cloud.callContainer({path:e.path,method:e.method||"GET",header:{"X-WX-SERVICE":"fastapi"}});case 8:return l=a.sent,console.log("微信云托管调用结果".concat(l.errMsg," | callid:").concat(l.callID)),a.abrupt("return",l.data);case 13:if(a.prev=13,a.t0=a.catch(5),!(-1!=(o=a.t0.toString()).indexOf("Cloud API isn't enabled")&&n<3)){a.next=20;break}return a.abrupt("return",new Promise((function(a){setTimeout((function(){a(t.call(e,n+1))}),300)})));case 20:throw new Error("微信云托管调用失败".concat(o));case 21:case"end":return a.stop()}}),_callee5,null,[[5,13]])})));return function cloudcall(n){return e.apply(this,arguments)}}()}}]); \ No newline at end of file diff --git a/dist/pages/home/index.js b/dist/pages/home/index.js index 35d04d8..dc44d16 100644 --- a/dist/pages/home/index.js +++ b/dist/pages/home/index.js @@ -1,2 +1,2 @@ /*! For license information please see index.js.LICENSE.txt */ -"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["pages/home/index"],{"./node_modules/@antmjs/vantui/es/field/index.js":function(e,n,t){t.d(n,{Field:function(){return Field}});var o=t("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),r=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),a=t("webpack/container/remote/@tarojs/taro"),l=t("webpack/container/remote/react"),i=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),c=t("./node_modules/@antmjs/vantui/es/wxs/utils.js"),s=t("./node_modules/@antmjs/vantui/es/cell/index.js"),u=t("./node_modules/@antmjs/vantui/es/icon/index.js"),d=(t("./node_modules/@antmjs/vantui/es/utils/index.js"),t("./node_modules/@antmjs/vantui/es/field/wxs.js")),m=t("webpack/container/remote/react/jsx-runtime");t("webpack/container/remote/@tarojs/runtime").document;function ownKeys(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function _objectSpread(e){for(var n=1;n=W}),children:j.length>=W?W:j.length}),"/"+W]}),Q&&(0,m.jsx)(i.View,{className:c.bem("field__error-message",[$,{disabled:F,error:X}]),children:Q})]})}},"./node_modules/@antmjs/vantui/es/field/wxs.js":function(e,n,t){t.d(n,{inputStyle:function(){return inputStyle}});var o=t("./node_modules/@antmjs/vantui/es/wxs/style.js"),r=t("./node_modules/@antmjs/vantui/es/wxs/add-unit.js");function inputStyle(e){return e&&"Object"===e.constructor.name?(0,o.style)({"min-height":(0,r.addUnit)(e.minHeight),"max-height":(0,r.addUnit)(e.maxHeight)}):""}},"./node_modules/@antmjs/vantui/es/grid-item/index.js":function(e,n,t){var o=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),r=t("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),a=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),l=t("webpack/container/remote/react"),i=t("./node_modules/@antmjs/vantui/es/common/jumpLink.js"),c=t("./node_modules/@antmjs/vantui/es/wxs/utils.js"),s=t("./node_modules/@antmjs/vantui/es/icon/index.js"),u=t("./node_modules/@antmjs/vantui/es/grid-item/wxs.js"),d=t("webpack/container/remote/react/jsx-runtime"),m=["icon","iconColor","iconPrefix","dot","info","badge","text","setChildrenInstance","parentInstance","index","url","linkType","style","className"];n.default=function GridItem(e){var n=e.icon,t=e.iconColor,f=e.iconPrefix,p=void 0===f?"van-icon":f,v=e.dot,h=e.info,b=e.badge,j=e.text,g=e.setChildrenInstance,x=e.parentInstance,y=e.index,_=e.url,w=e.linkType,k=e.style,S=e.className,C=(0,r.default)(e,m),T=(0,l.useState)({}),I=(0,o.default)(T,2),N=I[0],O=I[1];(0,l.useEffect)((function(){g(y,{updateStyle:P})}),[y,g]),(0,l.useEffect)((function(){P()}),[x.columnNum]);var P=(0,l.useCallback)((function(){var e=x.columnNum,n=x.border,t=x.square,o=x.gutter,r=x.clickable,a=x.center,l=x.direction,i=x.reverse,c=x.iconSize;O({center:a,border:n,square:t,gutter:o,clickable:r,direction:l,reverse:i,iconSize:c,index:y,columnNum:e})}),[x,y]);return(0,d.jsx)(a.View,{className:" "+c.bem("grid-item",{square:null==N?void 0:N.square})+" "+S,style:c.style([u.wrapperStyle({square:null==N?void 0:N.square,gutter:null==N?void 0:N.gutter,columnNum:null==N?void 0:N.columnNum,index:null==N?void 0:N.index}),k]),onClick:function onClick(e){var n;_&&(0,i.jumpLink)(_,w),null==C||null===(n=C.onClick)||void 0===n||n.call(C,e)},children:(0,d.jsx)(a.View,{className:"content-class "+c.bem("grid-item__content",[null==N?void 0:N.direction,{center:null==N?void 0:N.center,square:null==N?void 0:N.square,reverse:null==N?void 0:N.reverse,clickable:null==N?void 0:N.clickable,surround:(null==N?void 0:N.border)&&(null==N?void 0:N.gutter)}])+" "+(null!=N&&N.border?"van-hairline--surround":""),style:u.contentStyle({square:null==N?void 0:N.square,gutter:null==N?void 0:N.gutter}),children:C.children||(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a.View,{className:"van-grid-item__icon icon-class",children:n?(0,d.jsx)(s.default,{name:n,color:t,classPrefix:p,dot:v,info:b||h,size:null==N?void 0:N.iconSize}):N.renderIcon}),(0,d.jsx)(a.View,{className:"van-grid-item__text text-class",children:j?(0,d.jsx)(a.Text,{children:j}):N.renderText})]})})})}},"./node_modules/@antmjs/vantui/es/grid-item/wxs.js":function(e,n,t){t.d(n,{wrapperStyle:function(){return wrapperStyle},contentStyle:function(){return contentStyle}});var o=t("./node_modules/@antmjs/vantui/es/wxs/style.js"),r=t("./node_modules/@antmjs/vantui/es/wxs/add-unit.js");function wrapperStyle(e){var n=100/e.columnNum+"%";return(0,o.style)({width:n,"padding-top":e.square?n:null,"padding-right":(0,r.addUnit)(e.gutter),"margin-top":e.index>=e.columnNum&&!e.square?(0,r.addUnit)(e.gutter):null})}function contentStyle(e){return e.square?(0,o.style)({right:(0,r.addUnit)(e.gutter),bottom:(0,r.addUnit)(e.gutter),height:"auto"}):""}},"./node_modules/@antmjs/vantui/es/grid/index.js":function(e,n,t){var o=t("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),r=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),a=t("webpack/container/remote/react"),l=t("./node_modules/@antmjs/vantui/es/wxs/utils.js"),i=t("./node_modules/@antmjs/vantui/es/grid/wxs.js"),c=t("webpack/container/remote/react/jsx-runtime"),s=["gutter","clickable","columnNum","center","border","direction","iconSize","square","reverse","className","style"];n.default=function Grid(e){var n=e.gutter,t=void 0===n?null:n,u=e.clickable,d=e.columnNum,m=void 0===d?4:d,f=e.center,p=void 0===f||f,v=e.border,h=void 0===v||v,b=e.direction,j=e.iconSize,g=void 0===j?"48":j,x=e.square,y=e.reverse,_=void 0!==y&&y,w=e.className,k=void 0===w?"":w,S=e.style,C=void 0===S?{}:S,T=(0,o.default)(e,s),I=(0,a.useRef)([]),N=(0,a.useCallback)((function(){I.current.forEach((function(e){e.updateStyle()}))}),[]);(0,a.useEffect)((function(){N()}),[N]);var O=(0,a.useCallback)((function(e,n){I.current[e]=n}),[]),P=(0,a.useMemo)((function(){var e=[];return T.children&&Array.isArray(T.children)&&T.children.forEach((function(n,o){e.push((0,a.cloneElement)(n,{setChildrenInstance:O,key:o,index:o,parentInstance:{columnNum:m,border:h,square:x,gutter:t,clickable:u,center:p,direction:b,reverse:_,iconSize:g}}))})),e}),[T.children,m]);return(0,c.jsx)(r.View,{className:"van-grid "+(h&&!t?"van-hairline--top":"")+" "+k,style:l.style([i.rootStyle({gutter:t}),C]),children:P})}},"./node_modules/@antmjs/vantui/es/grid/wxs.js":function(e,n,t){t.d(n,{rootStyle:function(){return rootStyle}});var o=t("./node_modules/@antmjs/vantui/es/wxs/style.js"),r=t("./node_modules/@antmjs/vantui/es/wxs/add-unit.js");function rootStyle(e){return(0,o.style)({"padding-left":(0,r.addUnit)(e.gutter)})}},"./node_modules/@antmjs/vantui/es/notice-bar/index.js":function(e,n,t){var o=t("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),r=t("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),a=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),l=t("webpack/container/remote/@tarojs/taro"),i=t("webpack/container/remote/react"),c=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),s=t("./node_modules/@antmjs/vantui/es/wxs/utils.js"),u=t("./node_modules/@antmjs/vantui/es/common/utils.js"),d=t("./node_modules/@antmjs/vantui/es/icon/index.js"),m=t("./node_modules/@antmjs/vantui/es/notice-bar/wxs.js"),f=t("webpack/container/remote/react/jsx-runtime"),p=["text","mode","url","openType","delay","speed","scrollable","leftIcon","color","backgroundColor","background","wrapable","renderLeftIcon","renderRightIcon","onClick","onClose","style","className","children"];function ownKeys(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function _objectSpread(e){for(var n=1;n0&&void 0!==arguments[0]&&arguments[0];j.current.timer&&clearTimeout(j.current.timer),j.current.timer=null,h((function(n){return _objectSpread(_objectSpread({},n),{},{animationData:j.current.resetAnimation.translateX(e?0:j.current.wrapWidth).step().export()})})),setTimeout((function(){(0,u.requestAnimationFrame)((function(){h((function(e){return _objectSpread(_objectSpread({},e),{},{animationData:j.current.animation.translateX(-j.current.contentWidth).step().export()})}))}))}),10),j.current.timer=setTimeout((function(){Q()}),j.current.duration)}),[]),G=(0,i.useCallback)((function(){(0,u.requestAnimationFrame)((function(){Promise.all([(0,u.getRect)(null,".van-notice-bar__content_".concat(o.unitag)),(0,u.getRect)(null,".van-notice-bar__wrap_".concat(o.unitag))]).then((function(e){var n=e[0],t=e[1];null!=n&&null!=t&&n.width&&t.width&&!1!==A&&(0,l.nextTick)((function(){(A||t.width<=n.width)&&(j.current.wrapWidth=t.width,j.current.contentWidth=n.width,j.current.duration=(t.width+n.width)/O*1e3,j.current.animation=(0,l.createAnimation)({duration:j.current.duration,timingFunction:"linear",delay:I}),Q(!0))}))}))}))}),[o.unitag,A,O,I,Q]),J=(0,i.useCallback)((function(e){"closeable"===_&&(j.current.timer&&clearTimeout(j.current.timer),j.current.timer=null,h((function(e){return _objectSpread(_objectSpread({},e),{},{show:!1})})),null==U||U(e))}),[_,U]);return o.show&&(0,f.jsxs)(c.View,_objectSpread(_objectSpread({className:s.bem("notice-bar",{withicon:_,wrapable:R})+" ".concat(M||""),style:s.style([m.rootStyle({color:D,backgroundColor:q,background:z}),W])},X),{},{onClick:K,children:[V?(0,f.jsx)(d.default,{name:V,className:"van-notice-bar__left-icon"}):B,(0,f.jsx)(c.View,{className:"van-notice-bar__wrap van-notice-bar__wrap_".concat(o.unitag),children:(0,f.jsxs)(c.View,{className:"van-notice-bar__content van-notice-bar__content_".concat(o.unitag," ")+(!1!==A||R?"":"van-ellipsis"),animation:o.animationData,children:[x,!x&&$]})}),"closeable"===_?(0,f.jsx)(d.default,{className:"van-notice-bar__right-icon",name:"cross",onClick:J}):"link"===_?(0,f.jsx)(c.Navigator,{url:k,openType:C,children:(0,f.jsx)(d.default,{className:"van-notice-bar__right-icon",name:"arrow"})}):H]}))}},"./node_modules/@antmjs/vantui/es/notice-bar/wxs.js":function(e,n,t){t.d(n,{rootStyle:function(){return rootStyle}});var o=t("./node_modules/@antmjs/vantui/es/wxs/style.js");function rootStyle(e){return(0,o.style)({color:e.color,"background-color":e.backgroundColor,background:e.background})}},"./node_modules/@antmjs/vantui/es/search/index.js":function(e,n,t){var o=t("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),r=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),a=t("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),l=t("webpack/container/remote/react"),i=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),c=t("./node_modules/@antmjs/vantui/es/wxs/utils.js"),s=t("./node_modules/@antmjs/vantui/es/field/index.js"),u=t("webpack/container/remote/react/jsx-runtime"),d=["value","defaultValue","label","focus","error","disabled","readonly","inputAlign","showAction","leftIcon","rightIcon","placeholder","placeholderStyle","actionText","background","maxlength","shape","clearable","clearTrigger","clearIcon","renderLabel","renderLeftIcon","renderRightIcon","renderAction","onFocus","onBlur","onChange","onClear","onClickInput","onSearch","onCancel","style","className"];function ownKeys(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function _objectSpread(e){for(var n=1;n0&&(0,S.jsx)(b.Swiper,{className:"Swiper",indicatorActiveColor:"#333",circular:!0,indicatorDots:!0,autoplay:!0,children:(null!==(T=null==J||null===(I=J[0])||void 0===I?void 0:I.imagesArr)&&void 0!==T?T:[]).map((function(e,n){return(0,S.jsx)(b.SwiperItem,{children:(0,S.jsx)(l.default,{className:"SwiperImg",src:null==e?void 0:e.url,fit:"cover",width:"100%",height:"150px"})})}))})}),(0,S.jsxs)(r.default,{children:[(0,S.jsx)(a.default,{icon:"star",text:"打卡",className:"iconStyle",onClick:(0,v.default)((0,p.default)().mark((function _callee10(){return(0,p.default)().wrap((function _callee10$(e){for(;;)switch(e.prev=e.next){case 0:if(!ae){e.next=4;break}y().getLocation({type:"gcj02",success:function success(e){console.log("lbs",e);null==e||e.latitude,null==e||e.longitude;var n={latitude:null==e?void 0:e.latitude,longitude:null==e?void 0:e.longitude};me(n)},fail:function fail(){m.default.fail({message:"定位授权异常,无法签到打卡",selector:"#vanToast-demo2"})}}),e.next=7;break;case 4:return e.next=6,se();case 6:m.default.fail({message:"请先登录",selector:"#vanToast-demo2",duration:2e3,onClose:function onClose(){y().navigateTo({url:"/pages/my/index"})}});case 7:case"end":return e.stop()}}),_callee10)})))}),(0,S.jsx)(a.default,{icon:"like",className:"iconStyle",text:"深圳十峰",onClick:function onClick(){y().navigateTo({url:"/pages/mountainPeak/index"})}}),(0,S.jsx)(a.default,{icon:"eye",className:"iconStyle",text:"活动",onClick:function onClick(){y().navigateTo({url:"/pages/activityList/index"})}}),(0,S.jsx)(a.default,{icon:"video",className:"iconStyle",text:"视频",onClick:function onClick(){var e,n,t,o,r,a;y().openChannelsActivity({finderUserName:null!==(e=null==J||null===(n=J[0])||void 0===n||null===(t=n.videoObj)||void 0===t?void 0:t.finderUserName)&&void 0!==e?e:"sphqzUmI0BlppCI",feedId:null!==(o=null==J||null===(r=J[0])||void 0===r||null===(a=r.videoObj)||void 0===a?void 0:a.feedId)&&void 0!==o?o:"export/UzFfAgtgekIEAQAAAAAAeIIQA5S-0wAAAAstQy6ubaLX4KHWvLEZgBPEj6MUcExXaL37zNPgMJpEUVVnZ9njxR_hb9_u-bQj",success:function success(e){console.log("res",e)}})}})]}),(null==$?void 0:$.length)>0?(0,S.jsx)(b.View,{children:(null!==(N=null==$||null===(O=$.reverse())||void 0===O?void 0:O.splice(0,2))&&void 0!==N?N:[]).map((function(e,n){return(0,S.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,S.jsx)(k.default,{dataSource:e})})}))}):(0,S.jsx)(o.default,{title:!0,row:4}),(0,S.jsxs)(b.View,{style:{marginTop:"20px"},children:[" ",(0,S.jsx)(b.OfficialAccount,{onLoad:function onLoad(e){console.log("加载成功",e)},onError:function onError(e){console.log("加载失败",e)}})]}),(0,S.jsx)(m.default,{id:"vanToast-demo2"}),(0,S.jsx)(_.default,{active:0})]})}},"./src/pages/home/index.tsx":function(e,n,t){var o=t("webpack/container/remote/@tarojs/runtime"),r=t("./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./src/pages/home/index.tsx");r.default.enableShareTimeline=!0,r.default.enableShareAppMessage=!0;Page((0,o.createPageConfig)(r.default,"pages/home/index",{root:{cn:[]}},{navigationBarTitleText:"首页"}||{}))}},function(e){e.O(0,["taro","vendors","common"],(function(){return n="./src/pages/home/index.tsx",e(e.s=n);var n}));e.O()}]); \ No newline at end of file +"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["pages/home/index"],{"./node_modules/@antmjs/vantui/es/field/index.js":function(e,n,t){t.d(n,{Field:function(){return Field}});var o=t("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),r=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),a=t("webpack/container/remote/@tarojs/taro"),l=t("webpack/container/remote/react"),i=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),c=t("./node_modules/@antmjs/vantui/es/wxs/utils.js"),s=t("./node_modules/@antmjs/vantui/es/cell/index.js"),u=t("./node_modules/@antmjs/vantui/es/icon/index.js"),d=(t("./node_modules/@antmjs/vantui/es/utils/index.js"),t("./node_modules/@antmjs/vantui/es/field/wxs.js")),m=t("webpack/container/remote/react/jsx-runtime");t("webpack/container/remote/@tarojs/runtime").document;function ownKeys(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function _objectSpread(e){for(var n=1;n=W}),children:j.length>=W?W:j.length}),"/"+W]}),Q&&(0,m.jsx)(i.View,{className:c.bem("field__error-message",[$,{disabled:F,error:X}]),children:Q})]})}},"./node_modules/@antmjs/vantui/es/field/wxs.js":function(e,n,t){t.d(n,{inputStyle:function(){return inputStyle}});var o=t("./node_modules/@antmjs/vantui/es/wxs/style.js"),r=t("./node_modules/@antmjs/vantui/es/wxs/add-unit.js");function inputStyle(e){return e&&"Object"===e.constructor.name?(0,o.style)({"min-height":(0,r.addUnit)(e.minHeight),"max-height":(0,r.addUnit)(e.maxHeight)}):""}},"./node_modules/@antmjs/vantui/es/grid-item/index.js":function(e,n,t){var o=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),r=t("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),a=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),l=t("webpack/container/remote/react"),i=t("./node_modules/@antmjs/vantui/es/common/jumpLink.js"),c=t("./node_modules/@antmjs/vantui/es/wxs/utils.js"),s=t("./node_modules/@antmjs/vantui/es/icon/index.js"),u=t("./node_modules/@antmjs/vantui/es/grid-item/wxs.js"),d=t("webpack/container/remote/react/jsx-runtime"),m=["icon","iconColor","iconPrefix","dot","info","badge","text","setChildrenInstance","parentInstance","index","url","linkType","style","className"];n.default=function GridItem(e){var n=e.icon,t=e.iconColor,f=e.iconPrefix,p=void 0===f?"van-icon":f,v=e.dot,h=e.info,b=e.badge,j=e.text,g=e.setChildrenInstance,x=e.parentInstance,y=e.index,_=e.url,w=e.linkType,k=e.style,S=e.className,C=(0,r.default)(e,m),T=(0,l.useState)({}),I=(0,o.default)(T,2),N=I[0],O=I[1];(0,l.useEffect)((function(){g(y,{updateStyle:P})}),[y,g]),(0,l.useEffect)((function(){P()}),[x.columnNum]);var P=(0,l.useCallback)((function(){var e=x.columnNum,n=x.border,t=x.square,o=x.gutter,r=x.clickable,a=x.center,l=x.direction,i=x.reverse,c=x.iconSize;O({center:a,border:n,square:t,gutter:o,clickable:r,direction:l,reverse:i,iconSize:c,index:y,columnNum:e})}),[x,y]);return(0,d.jsx)(a.View,{className:" "+c.bem("grid-item",{square:null==N?void 0:N.square})+" "+S,style:c.style([u.wrapperStyle({square:null==N?void 0:N.square,gutter:null==N?void 0:N.gutter,columnNum:null==N?void 0:N.columnNum,index:null==N?void 0:N.index}),k]),onClick:function onClick(e){var n;_&&(0,i.jumpLink)(_,w),null==C||null===(n=C.onClick)||void 0===n||n.call(C,e)},children:(0,d.jsx)(a.View,{className:"content-class "+c.bem("grid-item__content",[null==N?void 0:N.direction,{center:null==N?void 0:N.center,square:null==N?void 0:N.square,reverse:null==N?void 0:N.reverse,clickable:null==N?void 0:N.clickable,surround:(null==N?void 0:N.border)&&(null==N?void 0:N.gutter)}])+" "+(null!=N&&N.border?"van-hairline--surround":""),style:u.contentStyle({square:null==N?void 0:N.square,gutter:null==N?void 0:N.gutter}),children:C.children||(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a.View,{className:"van-grid-item__icon icon-class",children:n?(0,d.jsx)(s.default,{name:n,color:t,classPrefix:p,dot:v,info:b||h,size:null==N?void 0:N.iconSize}):N.renderIcon}),(0,d.jsx)(a.View,{className:"van-grid-item__text text-class",children:j?(0,d.jsx)(a.Text,{children:j}):N.renderText})]})})})}},"./node_modules/@antmjs/vantui/es/grid-item/wxs.js":function(e,n,t){t.d(n,{wrapperStyle:function(){return wrapperStyle},contentStyle:function(){return contentStyle}});var o=t("./node_modules/@antmjs/vantui/es/wxs/style.js"),r=t("./node_modules/@antmjs/vantui/es/wxs/add-unit.js");function wrapperStyle(e){var n=100/e.columnNum+"%";return(0,o.style)({width:n,"padding-top":e.square?n:null,"padding-right":(0,r.addUnit)(e.gutter),"margin-top":e.index>=e.columnNum&&!e.square?(0,r.addUnit)(e.gutter):null})}function contentStyle(e){return e.square?(0,o.style)({right:(0,r.addUnit)(e.gutter),bottom:(0,r.addUnit)(e.gutter),height:"auto"}):""}},"./node_modules/@antmjs/vantui/es/grid/index.js":function(e,n,t){var o=t("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),r=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),a=t("webpack/container/remote/react"),l=t("./node_modules/@antmjs/vantui/es/wxs/utils.js"),i=t("./node_modules/@antmjs/vantui/es/grid/wxs.js"),c=t("webpack/container/remote/react/jsx-runtime"),s=["gutter","clickable","columnNum","center","border","direction","iconSize","square","reverse","className","style"];n.default=function Grid(e){var n=e.gutter,t=void 0===n?null:n,u=e.clickable,d=e.columnNum,m=void 0===d?4:d,f=e.center,p=void 0===f||f,v=e.border,h=void 0===v||v,b=e.direction,j=e.iconSize,g=void 0===j?"48":j,x=e.square,y=e.reverse,_=void 0!==y&&y,w=e.className,k=void 0===w?"":w,S=e.style,C=void 0===S?{}:S,T=(0,o.default)(e,s),I=(0,a.useRef)([]),N=(0,a.useCallback)((function(){I.current.forEach((function(e){e.updateStyle()}))}),[]);(0,a.useEffect)((function(){N()}),[N]);var O=(0,a.useCallback)((function(e,n){I.current[e]=n}),[]),P=(0,a.useMemo)((function(){var e=[];return T.children&&Array.isArray(T.children)&&T.children.forEach((function(n,o){e.push((0,a.cloneElement)(n,{setChildrenInstance:O,key:o,index:o,parentInstance:{columnNum:m,border:h,square:x,gutter:t,clickable:u,center:p,direction:b,reverse:_,iconSize:g}}))})),e}),[T.children,m]);return(0,c.jsx)(r.View,{className:"van-grid "+(h&&!t?"van-hairline--top":"")+" "+k,style:l.style([i.rootStyle({gutter:t}),C]),children:P})}},"./node_modules/@antmjs/vantui/es/grid/wxs.js":function(e,n,t){t.d(n,{rootStyle:function(){return rootStyle}});var o=t("./node_modules/@antmjs/vantui/es/wxs/style.js"),r=t("./node_modules/@antmjs/vantui/es/wxs/add-unit.js");function rootStyle(e){return(0,o.style)({"padding-left":(0,r.addUnit)(e.gutter)})}},"./node_modules/@antmjs/vantui/es/notice-bar/index.js":function(e,n,t){var o=t("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),r=t("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),a=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),l=t("webpack/container/remote/@tarojs/taro"),i=t("webpack/container/remote/react"),c=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),s=t("./node_modules/@antmjs/vantui/es/wxs/utils.js"),u=t("./node_modules/@antmjs/vantui/es/common/utils.js"),d=t("./node_modules/@antmjs/vantui/es/icon/index.js"),m=t("./node_modules/@antmjs/vantui/es/notice-bar/wxs.js"),f=t("webpack/container/remote/react/jsx-runtime"),p=["text","mode","url","openType","delay","speed","scrollable","leftIcon","color","backgroundColor","background","wrapable","renderLeftIcon","renderRightIcon","onClick","onClose","style","className","children"];function ownKeys(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function _objectSpread(e){for(var n=1;n0&&void 0!==arguments[0]&&arguments[0];j.current.timer&&clearTimeout(j.current.timer),j.current.timer=null,h((function(n){return _objectSpread(_objectSpread({},n),{},{animationData:j.current.resetAnimation.translateX(e?0:j.current.wrapWidth).step().export()})})),setTimeout((function(){(0,u.requestAnimationFrame)((function(){h((function(e){return _objectSpread(_objectSpread({},e),{},{animationData:j.current.animation.translateX(-j.current.contentWidth).step().export()})}))}))}),10),j.current.timer=setTimeout((function(){Q()}),j.current.duration)}),[]),G=(0,i.useCallback)((function(){(0,u.requestAnimationFrame)((function(){Promise.all([(0,u.getRect)(null,".van-notice-bar__content_".concat(o.unitag)),(0,u.getRect)(null,".van-notice-bar__wrap_".concat(o.unitag))]).then((function(e){var n=e[0],t=e[1];null!=n&&null!=t&&n.width&&t.width&&!1!==A&&(0,l.nextTick)((function(){(A||t.width<=n.width)&&(j.current.wrapWidth=t.width,j.current.contentWidth=n.width,j.current.duration=(t.width+n.width)/O*1e3,j.current.animation=(0,l.createAnimation)({duration:j.current.duration,timingFunction:"linear",delay:I}),Q(!0))}))}))}))}),[o.unitag,A,O,I,Q]),J=(0,i.useCallback)((function(e){"closeable"===_&&(j.current.timer&&clearTimeout(j.current.timer),j.current.timer=null,h((function(e){return _objectSpread(_objectSpread({},e),{},{show:!1})})),null==U||U(e))}),[_,U]);return o.show&&(0,f.jsxs)(c.View,_objectSpread(_objectSpread({className:s.bem("notice-bar",{withicon:_,wrapable:R})+" ".concat(M||""),style:s.style([m.rootStyle({color:D,backgroundColor:q,background:z}),W])},X),{},{onClick:K,children:[V?(0,f.jsx)(d.default,{name:V,className:"van-notice-bar__left-icon"}):B,(0,f.jsx)(c.View,{className:"van-notice-bar__wrap van-notice-bar__wrap_".concat(o.unitag),children:(0,f.jsxs)(c.View,{className:"van-notice-bar__content van-notice-bar__content_".concat(o.unitag," ")+(!1!==A||R?"":"van-ellipsis"),animation:o.animationData,children:[x,!x&&$]})}),"closeable"===_?(0,f.jsx)(d.default,{className:"van-notice-bar__right-icon",name:"cross",onClick:J}):"link"===_?(0,f.jsx)(c.Navigator,{url:k,openType:C,children:(0,f.jsx)(d.default,{className:"van-notice-bar__right-icon",name:"arrow"})}):H]}))}},"./node_modules/@antmjs/vantui/es/notice-bar/wxs.js":function(e,n,t){t.d(n,{rootStyle:function(){return rootStyle}});var o=t("./node_modules/@antmjs/vantui/es/wxs/style.js");function rootStyle(e){return(0,o.style)({color:e.color,"background-color":e.backgroundColor,background:e.background})}},"./node_modules/@antmjs/vantui/es/search/index.js":function(e,n,t){var o=t("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),r=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),a=t("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),l=t("webpack/container/remote/react"),i=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),c=t("./node_modules/@antmjs/vantui/es/wxs/utils.js"),s=t("./node_modules/@antmjs/vantui/es/field/index.js"),u=t("webpack/container/remote/react/jsx-runtime"),d=["value","defaultValue","label","focus","error","disabled","readonly","inputAlign","showAction","leftIcon","rightIcon","placeholder","placeholderStyle","actionText","background","maxlength","shape","clearable","clearTrigger","clearIcon","renderLabel","renderLeftIcon","renderRightIcon","renderAction","onFocus","onBlur","onChange","onClear","onClickInput","onSearch","onCancel","style","className"];function ownKeys(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function _objectSpread(e){for(var n=1;n0&&(0,S.jsx)(b.Swiper,{className:"Swiper",indicatorActiveColor:"#333",circular:!0,indicatorDots:!0,autoplay:!0,children:(null!==(T=null==J||null===(I=J[0])||void 0===I?void 0:I.imagesArr)&&void 0!==T?T:[]).map((function(e,n){return(0,S.jsx)(b.SwiperItem,{children:(0,S.jsx)(l.default,{className:"SwiperImg",src:null==e?void 0:e.url,fit:"cover",width:"100%",height:"150px"})})}))})}),(0,S.jsxs)(r.default,{children:[(0,S.jsx)(a.default,{icon:"star",text:"打卡",className:"iconStyle",onClick:(0,v.default)((0,p.default)().mark((function _callee10(){return(0,p.default)().wrap((function _callee10$(e){for(;;)switch(e.prev=e.next){case 0:if(!ae){e.next=4;break}y().getLocation({type:"gcj02",success:function success(e){console.log("lbs",e);null==e||e.latitude,null==e||e.longitude;var n={latitude:null==e?void 0:e.latitude,longitude:null==e?void 0:e.longitude};me(n)},fail:function fail(){m.default.fail({message:"定位授权异常,无法签到打卡",selector:"#vanToast-demo2"})}}),e.next=7;break;case 4:return e.next=6,se();case 6:m.default.fail({message:"请先登录",selector:"#vanToast-demo2",duration:2e3,onClose:function onClose(){y().navigateTo({url:"/pages/my/index"})}});case 7:case"end":return e.stop()}}),_callee10)})))}),(0,S.jsx)(a.default,{icon:"like",className:"iconStyle",text:"深圳十峰",onClick:function onClick(){y().navigateTo({url:"/pages/mountainPeak/index"})}}),(0,S.jsx)(a.default,{icon:"eye",className:"iconStyle",text:"活动",onClick:function onClick(){y().navigateTo({url:"/pages/activityList/index"})}}),(0,S.jsx)(a.default,{icon:"video",className:"iconStyle",text:"视频",onClick:function onClick(){var e,n,t,o,r,a;y().openChannelsActivity({finderUserName:null!==(e=null==J||null===(n=J[0])||void 0===n||null===(t=n.videoObj)||void 0===t?void 0:t.finderUserName)&&void 0!==e?e:"sphqzUmI0BlppCI",feedId:null!==(o=null==J||null===(r=J[0])||void 0===r||null===(a=r.videoObj)||void 0===a?void 0:a.feedId)&&void 0!==o?o:"export/UzFfAgtgekIEAQAAAAAAeIIQA5S-0wAAAAstQy6ubaLX4KHWvLEZgBPEj6MUcExXaL37zNPgMJpEUVVnZ9njxR_hb9_u-bQj",success:function success(e){console.log("res",e)}})}})]}),(null==$?void 0:$.length)>0?(0,S.jsx)(b.View,{children:(null!==(N=null==$||null===(O=$.reverse())||void 0===O?void 0:O.splice(0,2))&&void 0!==N?N:[]).map((function(e,n){return(0,S.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,S.jsx)(k.default,{dataSource:e})})}))}):(0,S.jsx)(o.default,{title:!0,row:4}),(0,S.jsxs)(b.View,{style:{marginTop:"20px"},children:[" ",(0,S.jsx)(b.OfficialAccount,{onLoad:function onLoad(e){console.log("加载成功",e)},onError:function onError(e){console.log("加载失败",e)}})]}),(0,S.jsx)(m.default,{id:"vanToast-demo2"}),(0,S.jsx)(_.default,{active:0})]})}},"./src/pages/home/index.tsx":function(e,n,t){var o=t("webpack/container/remote/@tarojs/runtime"),r=t("./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./src/pages/home/index.tsx");r.default.enableShareTimeline=!0,r.default.enableShareAppMessage=!0;Page((0,o.createPageConfig)(r.default,"pages/home/index",{root:{cn:[]}},{navigationBarTitleText:"首页"}||{}))}},function(e){e.O(0,["taro","vendors","common"],(function(){return n="./src/pages/home/index.tsx",e(e.s=n);var n}));e.O()}]); \ No newline at end of file diff --git a/dist/pages/home/index.js.LICENSE.txt b/dist/pages/home/index.js.LICENSE.txt index 1e20503..d414d23 100644 --- a/dist/pages/home/index.js.LICENSE.txt +++ b/dist/pages/home/index.js.LICENSE.txt @@ -1,7 +1,5 @@ /*! ../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./index.tsx */ -/*! ../../utils/index */ - /*! ../cell */ /*! ../common/jumpLink */ @@ -40,6 +38,8 @@ /*! ./wxs */ +/*! @/utils/index */ + /*! @antmjs/vantui/es/dialog */ /*! @antmjs/vantui/es/grid */ diff --git a/dist/runtime.js b/dist/runtime.js index cd764fb..32e3ae2 100644 --- a/dist/runtime.js +++ b/dist/runtime.js @@ -1 +1 @@ -!function(){"use strict";var e,r,t,n,_={},a={};function __webpack_require__(e){var r=a[e];if(void 0!==r)return r.exports;var t=a[e]={id:e,loaded:!1,exports:{}};return _[e].call(t.exports,t,t.exports,__webpack_require__),t.loaded=!0,t.exports}__webpack_require__.m=_,e=[],__webpack_require__.O=function(r,t,n,_){if(!t){var a=1/0;for(c=0;c=_)&&Object.keys(__webpack_require__.O).every((function(e){return __webpack_require__.O[e](t[o])}))?t.splice(o--,1):(i=!1,_0&&e[c-1][2]>_;c--)e[c]=e[c-1];e[c]=[t,n,_]},__webpack_require__.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(r,{a:r}),r},__webpack_require__.d=function(e,r){for(var t in r)__webpack_require__.o(r,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},__webpack_require__.f={},__webpack_require__.e=function(e){return Promise.all(Object.keys(__webpack_require__.f).reduce((function(r,t){return __webpack_require__.f[t](e,r),r}),[]))},__webpack_require__.u=function(e){},__webpack_require__.miniCssF=function(e){},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.hmd=function(e){return(e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:function(){throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e},__webpack_require__.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r={},t="myApp:",__webpack_require__.l=function(e,n,_,a){if(r[e])r[e].push(n);else{var i,o;if(void 0!==_)for(var u=document.getElementsByTagName("script"),c=0;c=_)&&Object.keys(__webpack_require__.O).every((function(e){return __webpack_require__.O[e](t[o])}))?t.splice(o--,1):(i=!1,_0&&e[c-1][2]>_;c--)e[c]=e[c-1];e[c]=[t,n,_]},__webpack_require__.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(r,{a:r}),r},__webpack_require__.d=function(e,r){for(var t in r)__webpack_require__.o(r,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},__webpack_require__.f={},__webpack_require__.e=function(e){return Promise.all(Object.keys(__webpack_require__.f).reduce((function(r,t){return __webpack_require__.f[t](e,r),r}),[]))},__webpack_require__.u=function(e){},__webpack_require__.miniCssF=function(e){},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.hmd=function(e){return(e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:function(){throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e},__webpack_require__.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r={},t="myApp:",__webpack_require__.l=function(e,n,_,a){if(r[e])r[e].push(n);else{var i,o;if(void 0!==_)for(var u=document.getElementsByTagName("script"),c=0;c { }); const testCloud = async () => { - // const app = Taro.getApp() - // console.log('app',app) - // const res = await app.call({ - // path:'/' - // }) - // console.log('业务返回结果',res) + + const res = await cloudcall({ + path:'/' + }) + console.log('业务返回结果',res) }; useEffect(() => { testCloud(); diff --git a/src/utils/index.ts b/src/utils/index.ts index 80eb794..292a8cb 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,7 +1,7 @@ import { Toast } from "@antmjs/vantui"; import Taro from "@tarojs/taro"; import { getCurrentInstance } from "@tarojs/taro"; -import {type} from '../../config' +import { appId, type } from "../../config"; // 数据库环境 // const db: any = Taro.cloud.database({ @@ -23,7 +23,6 @@ export const getparams = () => { return $instance?.router?.params; }; - // 添加数据 export const addTable: any = ({ env, tableName, objData, okFun }: Typeint) => { // 数据库环境 @@ -38,34 +37,38 @@ export const addTable: any = ({ env, tableName, objData, okFun }: Typeint) => { success: (res: any) => { okFun(res); }, - fail:(err:any)=>{ - console.log('err',err) - } + fail: (err: any) => { + console.log("err", err); + }, }); }; // 获取指定集合数据表 (keyValue指定条件) -export const getTable: any = ({ env, tableName, keyValue={}, okFun }: Typeint) => { +export const getTable: any = ({ + env, + tableName, + keyValue = {}, + okFun, +}: Typeint) => { // 数据库环境 const db: any = Taro.cloud.database({ env: env, }); let nowtable: any = db?.collection(tableName); - if(Object.keys(keyValue)?.length>0){ + if (Object.keys(keyValue)?.length > 0) { nowtable?.where(keyValue).get({ success: (res: any) => { okFun(res); }, }); - }else{ + } else { nowtable?.get({ success: (res: any) => { okFun(res); }, }); } - }; // 获取指定id数据数据 @@ -73,7 +76,7 @@ export const getTableid: any = ({ env, tableName, id, - keyValue={}, + keyValue = {}, okFun, }: Typeint) => { // 数据库环境 @@ -83,30 +86,28 @@ export const getTableid: any = ({ let nowtable: any = db?.collection(tableName); - if(Object.keys(keyValue)?.length>0){ + if (Object.keys(keyValue)?.length > 0) { nowtable - ?.doc(id) - .where(keyValue) - .get({ + ?.doc(id) + .where(keyValue) + .get({ + success: (res: any) => { + okFun(res); + }, + fail: (err: any) => { + console.log("err", err); + }, + }); + } else { + nowtable?.doc(id)?.get({ success: (res: any) => { okFun(res); }, - fail:(err:any)=>{ - console.log('err',err) - } - }); - }else{ - nowtable - ?.doc(id)?.get({ - success: (res: any) => { - okFun(res); + fail: (err: any) => { + console.log("err", err); }, - fail:(err:any)=>{ - console.log('err',err) - } }); } - }; // 更新数据 @@ -129,9 +130,9 @@ export const updateTableid: any = ({ success: (res: any) => { okFun(res); }, - fail:(err:any)=>{ - console.log('err',err) - } + fail: (err: any) => { + console.log("err", err); + }, }); }; @@ -191,8 +192,9 @@ export const getOpenid = async () => { }; export const phoneLogin = async () => { - return new Promise((resolve, reject) => { // 数据库环境 - const db: any = Taro.cloud.database({ }); + return new Promise((resolve, reject) => { + // 数据库环境 + const db: any = Taro.cloud.database({}); const _ = db.command; let openId = ""; Taro.cloud.callFunction({ @@ -207,7 +209,7 @@ export const phoneLogin = async () => { // 指定条件, 有openid相等的数据 keyValue: { openId: _.eq(openId) }, // keyValue: { _openId: openId }, - + okFun: (res: any) => { console.log("res", res); let data = res?.data ?? []; @@ -223,27 +225,62 @@ export const phoneLogin = async () => { } else { //查看是否存在手机号 if (data?.[0]?.authInfo?.[0]?.telNumber) { - resolve(true) + resolve(true); return true; } else { - if(type==='people'){ + if (type === "people") { // resolve(true) // return true; - resolve(false) + resolve(false); return false; - }else{ - resolve(false) + } else { + resolve(false); return false; } - } } }, }); - }, - });}) + }); + }); - // 不存在-未登录 }; + +export const cloudcall = async (obj: any, number = 0) => { + const that: any = {}; + + that.cloud = new Taro.cloud.Cloud({ + resourceAppid: appId, // 微信云托管环境所属账号,服务商appid、公众号或小程序appid + resourceEnv: "prod-4go74loxa6ac34a8", // 微信云托管的环境ID + }); + await that?.cloud.init(); // init过程是异步的,需要等待 init 完成才可以发起调用 + + try { + const result = await that.cloud.callContainer({ + path: obj.path, // 填入业务自定义路径和参数,根目录,就是 / + method: obj.method || "GET", // 按照自己的业务开发,选择对应的方法 + // dataType:'text', // 如果返回的不是 json 格式,需要添加此项 + header: { + "X-WX-SERVICE": "fastapi", // xxx中填入服务名称(微信云托管 - 服务管理 - 服务列表 - 服务名称) + // 其他 header 参数 + }, + // 其余参数同 wx.request + }); + console.log(`微信云托管调用结果${result.errMsg} | callid:${result.callID}`); + return result.data; // 业务数据在 data 中 + } catch (e) { + const error = e.toString(); + // 如果错误信息为未初始化,则等待300ms再次尝试,因为 init 过程是异步的 + if (error.indexOf("Cloud API isn't enabled") != -1 && number < 3) { + return new Promise((resolve) => { + setTimeout(function () { + resolve(that.call(obj, number + 1)); + }, 300); + }); + } else { + throw new Error(`微信云托管调用失败${error}`); + } + } +}; diff --git a/tsconfig.json b/tsconfig.json index 0fc6d47..a7b5ddf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,9 +18,14 @@ "jsx": "react-jsx", "allowJs": true, "resolveJsonModule": true, - "typeRoots": [ + "typeRoots": [ "node_modules/@types" - ] + ], + "paths": { + "@/utils/*": [ + "./src/utils/*" + ] + } }, "include": ["./src", "./types"], "compileOnSave": false